1
1
import { z } from "../../framework" ;
2
2
3
- export const ComputeServerIdBodySchema = z
3
+ export const ComputeServerIdSchema = z
4
4
. number ( )
5
5
. int ( )
6
6
. min ( 0 )
7
- . describe ( "**Integer** compute server id." ) ;
7
+ . describe ( "Compute server id." ) ;
8
8
9
- export const ComputeServerIdQueryParamSchema = z
10
- . string ( )
11
- . describe ( "**String** compute server id." ) ;
12
-
13
- export const ServerImageNoCacheQueryParamSchema = z
14
- . object ( {
15
- noCache : z
16
- . string ( )
17
- . describe ( "**Administrators only**. Disables database caching for this query." )
18
- . optional ( ) ,
19
- } ) ;
9
+ export const ServerImageNoCacheSchema = z . object ( {
10
+ noCache : z
11
+ . string ( )
12
+ . describe (
13
+ "**Administrators only**. Disables database caching for this query." ,
14
+ )
15
+ . optional ( ) ,
16
+ } ) ;
20
17
21
18
export const ComputeServerStateSchema = z
22
19
. enum ( [
@@ -31,129 +28,102 @@ export const ComputeServerStateSchema = z
31
28
] )
32
29
. describe ( "The state of the compute server." ) ;
33
30
34
- export const ComputeServerColorSchema = z
35
- . string ( )
36
- . describe (
37
- `Compute server color in rgb(#,#,#) format. Used for color-coding compute servers in
31
+ export const ComputeServerColorSchema = z . string ( ) . describe (
32
+ `Compute server color in \`rgb(#,#,#)\` format. Used for color-coding compute servers in
38
33
the CoCalc UI.` ,
39
- ) ;
34
+ ) ;
40
35
41
- export const ComputeServerTitleSchema = z
42
- . string ( )
43
- . describe (
44
- `Title of this compute server. Used purely to make it easier for the user to keep
45
- track of it.`
46
- ) ;
36
+ export const ComputeServerTitleSchema = z . string ( ) . describe (
37
+ `Title of this compute server. Used purely to make it easier for the user to keep
38
+ track of it.` ,
39
+ ) ;
47
40
48
41
export const ComputeServerCloudSchema = z
49
- . enum ( [
50
- "google-cloud" ,
51
- "hyperstack" ,
52
- "onprem" ,
53
- ] )
42
+ . enum ( [ "google-cloud" , "hyperstack" , "onprem" ] )
54
43
. describe ( "The cloud provider used to run this compute server" ) ;
55
44
56
- export const ComputeServerImageProxySchema = z
57
- . object ( {
58
- path : z
59
- . string ( ) ,
60
- target : z
61
- . string ( ) ,
62
- ws : z
63
- . boolean ( )
64
- . optional ( ) ,
65
- app : z
66
- . string ( )
67
- . optional ( ) ,
68
- name : z
69
- . string ( )
70
- . optional ( ) ,
71
- } )
45
+ export const ComputeServerImageProxySchema = z . object ( {
46
+ path : z . string ( ) ,
47
+ target : z . string ( ) ,
48
+ ws : z . boolean ( ) . optional ( ) ,
49
+ app : z . string ( ) . optional ( ) ,
50
+ name : z . string ( ) . optional ( ) ,
51
+ } ) ;
72
52
73
- export const GoogleCloudServerConfigurationSchema = z
74
- . object ( { } ) ;
53
+ export const GoogleCloudServerConfigurationSchema = z . object ( { } ) ;
75
54
76
- export const HyperstackServerConfigurationSchema = z
77
- . object ( { } ) ;
55
+ export const HyperstackServerConfigurationSchema = z . object ( { } ) ;
78
56
79
- export const ServerConfigurationSchema = z
80
- . union ( [
81
- GoogleCloudServerConfigurationSchema ,
82
- HyperstackServerConfigurationSchema ,
83
- ] ) ;
57
+ export const ServerConfigurationSchema = z . union ( [
58
+ GoogleCloudServerConfigurationSchema ,
59
+ HyperstackServerConfigurationSchema ,
60
+ ] ) ;
84
61
85
- export const BaseServerConfigurationSchema = z
86
- . object ( {
87
- cloud : ComputeServerCloudSchema ,
88
- dns : z
89
- . string ( )
90
- . describe ( "DNS name" ) ,
91
- spot : z
92
- . boolean ( )
93
- . describe ( "If true, provision a spot instance." ) ,
94
- zone : z
95
- . string ( )
96
- . describe ( "Cloud provider zone to which this template defaults." ) ,
97
- image : z
98
- . string ( )
99
- . describe ( "Compute server template image name." ) ,
100
- region : z
101
- . string ( )
102
- . describe ( "Compute server template region name." ) ,
103
- ephemeral : z
104
- . boolean ( )
105
- . describe ( "Indicates whether the compute server is ephemeral." )
106
- . optional ( ) ,
107
- diskType : z
108
- . string ( )
109
- . describe ( "Compute server template disk type." ) ,
110
- diskSizeGb : z
111
- . number ( )
112
- . min ( 0 )
113
- . describe ( "Compute server template disk image size in GB." ) ,
114
- externalIp : z
115
- . boolean ( )
116
- . describe (
117
- `When true, the compute server is configured with an external IP address.`
118
- ) ,
119
- tag_cocalc : z
120
- . string ( )
121
- . describe ( "CoCalc tag" ) ,
122
- machineType : z
123
- . string ( )
124
- . describe (
125
- "Cloud-specific machine type for this template (e.g., `t2d-standard-1`)."
126
- ) ,
127
- excludeFromSync : z
128
- . array ( z . string ( ) )
129
- . describe ( "Array of top level directories to exclude from sync." ) ,
130
- acceleratorType : z
131
- . string ( )
132
- . describe (
133
- "Number of hardware accelerators to be provisioned to this server."
134
- )
135
- . optional ( ) ,
136
- acceleratorCount : z
137
- . number ( )
138
- . int ( )
139
- . min ( 0 )
140
- . describe (
141
- "Number of hardware accelerators to be provisioned with this server."
142
- )
143
- . optional ( ) ,
144
- proxy : ComputeServerImageProxySchema
145
- . optional ( )
146
- } ) ;
62
+ export const BaseServerConfigurationSchema = z . object ( {
63
+ cloud : ComputeServerCloudSchema ,
64
+ dns : z . string ( ) . describe ( "DNS name" ) ,
65
+ spot : z . boolean ( ) . describe ( "If true, provision a spot instance." ) ,
66
+ zone : z
67
+ . string ( )
68
+ . describe ( "Cloud provider zone to which this template defaults." ) ,
69
+ image : z . string ( ) . describe ( "Compute server template image name." ) ,
70
+ region : z . string ( ) . describe ( "Compute server template region name." ) ,
71
+ ephemeral : z
72
+ . boolean ( )
73
+ . describe ( "Indicates whether the compute server is ephemeral." )
74
+ . optional ( ) ,
75
+ diskType : z . string ( ) . describe ( "Compute server template disk type." ) ,
76
+ diskSizeGb : z
77
+ . number ( )
78
+ . min ( 0 )
79
+ . describe ( "Compute server template disk image size in GB." ) ,
80
+ externalIp : z
81
+ . boolean ( )
82
+ . describe (
83
+ `When true, the compute server is configured with an external IP address.` ,
84
+ ) ,
85
+ tag_cocalc : z . string ( ) . describe ( "CoCalc tag" ) ,
86
+ machineType : z
87
+ . string ( )
88
+ . describe (
89
+ "Cloud-specific machine type for this template (e.g., `t2d-standard-1`)." ,
90
+ ) ,
91
+ excludeFromSync : z
92
+ . array ( z . string ( ) )
93
+ . describe ( "Array of top level directories to exclude from sync." ) ,
94
+ acceleratorType : z
95
+ . string ( )
96
+ . describe (
97
+ "Number of hardware accelerators to be provisioned to this server." ,
98
+ )
99
+ . optional ( ) ,
100
+ acceleratorCount : z
101
+ . number ( )
102
+ . int ( )
103
+ . min ( 0 )
104
+ . describe (
105
+ "Number of hardware accelerators to be provisioned with this server." ,
106
+ )
107
+ . optional ( ) ,
108
+ proxy : ComputeServerImageProxySchema . optional ( ) ,
109
+ } ) ;
147
110
148
- export type BaseServerConfiguration = z . infer < typeof BaseServerConfigurationSchema > ;
149
- export type ComputeServerBodyId = z . infer < typeof ComputeServerIdBodySchema > ;
111
+ export type BaseServerConfiguration = z . infer <
112
+ typeof BaseServerConfigurationSchema
113
+ > ;
114
+ export type ComputeServerBodyId = z . infer < typeof ComputeServerIdSchema > ;
150
115
export type ComputeServerCloud = z . infer < typeof ComputeServerCloudSchema > ;
151
116
export type ComputeServerColor = z . infer < typeof ComputeServerColorSchema > ;
152
- export type ComputeServerImageProxy = z . infer < typeof ComputeServerImageProxySchema > ;
153
- export type ComputeServerQueryParamId = z . infer < typeof ComputeServerIdBodySchema > ;
117
+ export type ComputeServerImageProxy = z . infer <
118
+ typeof ComputeServerImageProxySchema
119
+ > ;
154
120
export type ComputeServerState = z . infer < typeof ComputeServerStateSchema > ;
155
121
export type ComputeServerTitle = z . infer < typeof ComputeServerTitleSchema > ;
156
- export type GoogleCloudServerConfiguration = z . infer < typeof GoogleCloudServerConfigurationSchema > ;
157
- export type HyperstackServerConfiguration = z . infer < typeof HyperstackServerConfigurationSchema > ;
122
+ export type GoogleCloudServerConfiguration = z . infer <
123
+ typeof GoogleCloudServerConfigurationSchema
124
+ > ;
125
+ export type HyperstackServerConfiguration = z . infer <
126
+ typeof HyperstackServerConfigurationSchema
127
+ > ;
158
128
export type ServerConfiguration = z . infer < typeof ServerConfigurationSchema > ;
159
- export type ServerImageNoCache = z . infer < typeof ServerImageNoCacheQueryParamSchema > ;
129
+ export type ServerImageNoCache = z . infer < typeof ServerImageNoCacheSchema > ;
0 commit comments