freestyle-sandboxes 0.0.97 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -48
- package/index.cjs +4362 -0
- package/index.d.cts +9401 -0
- package/index.d.mts +9401 -0
- package/index.mjs +4348 -0
- package/package.json +16 -109
- package/dist/ai/inde.d.cts +0 -75
- package/dist/ai/inde.d.mts +0 -75
- package/dist/ai/index.cjs +0 -13
- package/dist/ai/index.d.cts +0 -75
- package/dist/ai/index.d.mts +0 -75
- package/dist/ai/index.mjs +0 -4
- package/dist/expo/inde.d.cts +0 -6
- package/dist/expo/inde.d.mts +0 -6
- package/dist/expo/index.cjs +0 -319
- package/dist/expo/index.d.cts +0 -6
- package/dist/expo/index.d.mts +0 -6
- package/dist/expo/index.mjs +0 -297
- package/dist/inde.d.cts +0 -373
- package/dist/inde.d.mts +0 -373
- package/dist/index-BKAG8L-o.mjs +0 -3061
- package/dist/index-DuOpIaWc.cjs +0 -3068
- package/dist/index.cjs +0 -1329
- package/dist/index.d-9H_wnIbz.d.ts +0 -4223
- package/dist/index.d.cts +0 -373
- package/dist/index.d.mts +0 -373
- package/dist/index.mjs +0 -1327
- package/dist/langgraph/inde.d.cts +0 -4180
- package/dist/langgraph/inde.d.mts +0 -4180
- package/dist/langgraph/index.cjs +0 -17155
- package/dist/langgraph/index.d.cts +0 -4180
- package/dist/langgraph/index.d.mts +0 -4180
- package/dist/langgraph/index.mjs +0 -17153
- package/dist/mastra/inde.d.cts +0 -2623
- package/dist/mastra/inde.d.mts +0 -2623
- package/dist/mastra/index.cjs +0 -55
- package/dist/mastra/index.d.cts +0 -2623
- package/dist/mastra/index.d.mts +0 -2623
- package/dist/mastra/index.mjs +0 -53
- package/dist/react/dev-server/index..d.cts +0 -33
- package/dist/react/dev-server/index..d.mts +0 -33
- package/dist/react/dev-server/index.cjs +0 -148
- package/dist/react/dev-server/index.d.cts +0 -33
- package/dist/react/dev-server/index.d.mts +0 -33
- package/dist/react/dev-server/index.mjs +0 -145
- package/dist/types.gen-CJa21P0C.d.ts +0 -1902
- package/dist/types.gen-DKjMRuu5.d.ts +0 -1898
- package/dist/utils/inde.d.cts +0 -10
- package/dist/utils/inde.d.mts +0 -10
- package/dist/utils/index.cjs +0 -100
- package/dist/utils/index.d.cts +0 -10
- package/dist/utils/index.d.mts +0 -10
- package/dist/utils/index.mjs +0 -75
- package/openapi/index.ts +0 -3
- package/openapi/sdk.gen.ts +0 -929
- package/openapi/types.gen.ts +0 -2234
- package/openapi-ts.config.ts +0 -7
- package/openapi.json +0 -1
- package/src/ai/index.ts +0 -164
- package/src/dev-server.ts +0 -95
- package/src/expo/_expo_internals.ts +0 -389
- package/src/expo/index.ts +0 -26
- package/src/index.ts +0 -1459
- package/src/langgraph/index.ts +0 -33
- package/src/mastra/index.ts +0 -38
- package/src/react/dev-server/index.tsx +0 -195
- package/src/react/dev-server/types.ts +0 -5
- package/src/utils/index.ts +0 -97
- package/tsconfig.json +0 -8
package/index.mjs
ADDED
|
@@ -0,0 +1,4348 @@
|
|
|
1
|
+
function errorFromJSON(body) {
|
|
2
|
+
const ErrorClass = FREESTYLE_ERROR_CODE_MAP[body.code];
|
|
3
|
+
if (ErrorClass) {
|
|
4
|
+
return new ErrorClass(body);
|
|
5
|
+
} else {
|
|
6
|
+
return new Error(`Unknown error code: ${body.code} - ${body.description}`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
class VmNotFoundInFsError extends Error {
|
|
10
|
+
constructor(body) {
|
|
11
|
+
super(
|
|
12
|
+
`VM_NOT_FOUND_IN_FS: ${body.message}`
|
|
13
|
+
);
|
|
14
|
+
this.body = body;
|
|
15
|
+
this.name = "VmNotFoundInFsError";
|
|
16
|
+
}
|
|
17
|
+
static code = "VM_NOT_FOUND_IN_FS";
|
|
18
|
+
static statusCode = 406;
|
|
19
|
+
static description = `Vm Not found in filesystem`;
|
|
20
|
+
}
|
|
21
|
+
class VmNotRunningError extends Error {
|
|
22
|
+
constructor(body) {
|
|
23
|
+
super(
|
|
24
|
+
`VM_NOT_RUNNING: ${body.message}`
|
|
25
|
+
);
|
|
26
|
+
this.body = body;
|
|
27
|
+
this.name = "VmNotRunningError";
|
|
28
|
+
}
|
|
29
|
+
static code = "VM_NOT_RUNNING";
|
|
30
|
+
static statusCode = 400;
|
|
31
|
+
static description = `VmNotRunning`;
|
|
32
|
+
}
|
|
33
|
+
class VmNotFoundError extends Error {
|
|
34
|
+
constructor(body) {
|
|
35
|
+
super(
|
|
36
|
+
`VM_NOT_FOUND: ${body.message}`
|
|
37
|
+
);
|
|
38
|
+
this.body = body;
|
|
39
|
+
this.name = "VmNotFoundError";
|
|
40
|
+
}
|
|
41
|
+
static code = "VM_NOT_FOUND";
|
|
42
|
+
static statusCode = 404;
|
|
43
|
+
static description = `VmNotFound`;
|
|
44
|
+
}
|
|
45
|
+
class InternalForkVmNotFoundError extends Error {
|
|
46
|
+
constructor(body) {
|
|
47
|
+
super(
|
|
48
|
+
`INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
|
|
49
|
+
);
|
|
50
|
+
this.body = body;
|
|
51
|
+
this.name = "InternalForkVmNotFoundError";
|
|
52
|
+
}
|
|
53
|
+
static code = "INTERNAL_FORK_VM_NOT_FOUND";
|
|
54
|
+
static statusCode = 404;
|
|
55
|
+
static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
|
|
56
|
+
}
|
|
57
|
+
class BadRequestError extends Error {
|
|
58
|
+
constructor(body) {
|
|
59
|
+
super(
|
|
60
|
+
`BAD_REQUEST: ${body.message}`
|
|
61
|
+
);
|
|
62
|
+
this.body = body;
|
|
63
|
+
this.name = "BadRequestError";
|
|
64
|
+
}
|
|
65
|
+
static code = "BAD_REQUEST";
|
|
66
|
+
static statusCode = 400;
|
|
67
|
+
static description = `Bad request: {message}`;
|
|
68
|
+
}
|
|
69
|
+
class InternalVmNotFoundError extends Error {
|
|
70
|
+
constructor(body) {
|
|
71
|
+
super(
|
|
72
|
+
`INTERNAL_VM_NOT_FOUND: ${body.message}`
|
|
73
|
+
);
|
|
74
|
+
this.body = body;
|
|
75
|
+
this.name = "InternalVmNotFoundError";
|
|
76
|
+
}
|
|
77
|
+
static code = "INTERNAL_VM_NOT_FOUND";
|
|
78
|
+
static statusCode = 404;
|
|
79
|
+
static description = `VM not found: {vm_id}`;
|
|
80
|
+
}
|
|
81
|
+
class VmMustBeStoppedError extends Error {
|
|
82
|
+
constructor(body) {
|
|
83
|
+
super(
|
|
84
|
+
`VM_MUST_BE_STOPPED: ${body.message}`
|
|
85
|
+
);
|
|
86
|
+
this.body = body;
|
|
87
|
+
this.name = "VmMustBeStoppedError";
|
|
88
|
+
}
|
|
89
|
+
static code = "VM_MUST_BE_STOPPED";
|
|
90
|
+
static statusCode = 400;
|
|
91
|
+
static description = `VM must be stopped before converting to base`;
|
|
92
|
+
}
|
|
93
|
+
class AlreadyHasBaseError extends Error {
|
|
94
|
+
constructor(body) {
|
|
95
|
+
super(
|
|
96
|
+
`ALREADY_HAS_BASE: ${body.message}`
|
|
97
|
+
);
|
|
98
|
+
this.body = body;
|
|
99
|
+
this.name = "AlreadyHasBaseError";
|
|
100
|
+
}
|
|
101
|
+
static code = "ALREADY_HAS_BASE";
|
|
102
|
+
static statusCode = 400;
|
|
103
|
+
static description = `VM already has a base rootfs`;
|
|
104
|
+
}
|
|
105
|
+
class NotFoundError extends Error {
|
|
106
|
+
constructor(body) {
|
|
107
|
+
super(
|
|
108
|
+
`NOT_FOUND: ${body.message}`
|
|
109
|
+
);
|
|
110
|
+
this.body = body;
|
|
111
|
+
this.name = "NotFoundError";
|
|
112
|
+
}
|
|
113
|
+
static code = "NOT_FOUND";
|
|
114
|
+
static statusCode = 404;
|
|
115
|
+
static description = `VM not found`;
|
|
116
|
+
}
|
|
117
|
+
class InternalErrorError extends Error {
|
|
118
|
+
constructor(body) {
|
|
119
|
+
super(
|
|
120
|
+
`INTERNAL_ERROR: ${body.message}`
|
|
121
|
+
);
|
|
122
|
+
this.body = body;
|
|
123
|
+
this.name = "InternalErrorError";
|
|
124
|
+
}
|
|
125
|
+
static code = "INTERNAL_ERROR";
|
|
126
|
+
static statusCode = 500;
|
|
127
|
+
static description = `Internal error: {message}`;
|
|
128
|
+
}
|
|
129
|
+
class DockerImportBadRequestError extends Error {
|
|
130
|
+
constructor(body) {
|
|
131
|
+
super(
|
|
132
|
+
`DOCKER_IMPORT_BAD_REQUEST: ${body.message}`
|
|
133
|
+
);
|
|
134
|
+
this.body = body;
|
|
135
|
+
this.name = "DockerImportBadRequestError";
|
|
136
|
+
}
|
|
137
|
+
static code = "DOCKER_IMPORT_BAD_REQUEST";
|
|
138
|
+
static statusCode = 400;
|
|
139
|
+
static description = `Bad request: {message}`;
|
|
140
|
+
}
|
|
141
|
+
class ForkVmNotFoundError extends Error {
|
|
142
|
+
constructor(body) {
|
|
143
|
+
super(
|
|
144
|
+
`FORK_VM_NOT_FOUND: ${body.message}`
|
|
145
|
+
);
|
|
146
|
+
this.body = body;
|
|
147
|
+
this.name = "ForkVmNotFoundError";
|
|
148
|
+
}
|
|
149
|
+
static code = "FORK_VM_NOT_FOUND";
|
|
150
|
+
static statusCode = 404;
|
|
151
|
+
static description = `Fork VM not found: {fork_vm_id}`;
|
|
152
|
+
}
|
|
153
|
+
class CreateSnapshotBadRequestError extends Error {
|
|
154
|
+
constructor(body) {
|
|
155
|
+
super(
|
|
156
|
+
`CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
|
|
157
|
+
);
|
|
158
|
+
this.body = body;
|
|
159
|
+
this.name = "CreateSnapshotBadRequestError";
|
|
160
|
+
}
|
|
161
|
+
static code = "CREATE_SNAPSHOT_BAD_REQUEST";
|
|
162
|
+
static statusCode = 400;
|
|
163
|
+
static description = `Bad request: {message}`;
|
|
164
|
+
}
|
|
165
|
+
class SnapshotVmBadRequestError extends Error {
|
|
166
|
+
constructor(body) {
|
|
167
|
+
super(
|
|
168
|
+
`SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
|
|
169
|
+
);
|
|
170
|
+
this.body = body;
|
|
171
|
+
this.name = "SnapshotVmBadRequestError";
|
|
172
|
+
}
|
|
173
|
+
static code = "SNAPSHOT_VM_BAD_REQUEST";
|
|
174
|
+
static statusCode = 400;
|
|
175
|
+
static description = `Bad request: {message}`;
|
|
176
|
+
}
|
|
177
|
+
class FileNotFoundError extends Error {
|
|
178
|
+
constructor(body) {
|
|
179
|
+
super(
|
|
180
|
+
`FILE_NOT_FOUND: ${body.message}`
|
|
181
|
+
);
|
|
182
|
+
this.body = body;
|
|
183
|
+
this.name = "FileNotFoundError";
|
|
184
|
+
}
|
|
185
|
+
static code = "FILE_NOT_FOUND";
|
|
186
|
+
static statusCode = 404;
|
|
187
|
+
static description = `File not found: {path}`;
|
|
188
|
+
}
|
|
189
|
+
class FilesBadRequestError extends Error {
|
|
190
|
+
constructor(body) {
|
|
191
|
+
super(
|
|
192
|
+
`FILES_BAD_REQUEST: ${body.message}`
|
|
193
|
+
);
|
|
194
|
+
this.body = body;
|
|
195
|
+
this.name = "FilesBadRequestError";
|
|
196
|
+
}
|
|
197
|
+
static code = "FILES_BAD_REQUEST";
|
|
198
|
+
static statusCode = 400;
|
|
199
|
+
static description = `Bad request: {message}`;
|
|
200
|
+
}
|
|
201
|
+
class VmDeletedError extends Error {
|
|
202
|
+
constructor(body) {
|
|
203
|
+
super(
|
|
204
|
+
`VM_DELETED: ${body.message}`
|
|
205
|
+
);
|
|
206
|
+
this.body = body;
|
|
207
|
+
this.name = "VmDeletedError";
|
|
208
|
+
}
|
|
209
|
+
static code = "VM_DELETED";
|
|
210
|
+
static statusCode = 410;
|
|
211
|
+
static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
|
|
212
|
+
}
|
|
213
|
+
class ReqwestError extends Error {
|
|
214
|
+
constructor(body) {
|
|
215
|
+
super(
|
|
216
|
+
`REQWEST: ${body.message}`
|
|
217
|
+
);
|
|
218
|
+
this.body = body;
|
|
219
|
+
this.name = "ReqwestError";
|
|
220
|
+
}
|
|
221
|
+
static code = "REQWEST";
|
|
222
|
+
static statusCode = 500;
|
|
223
|
+
static description = `Reqwest error`;
|
|
224
|
+
}
|
|
225
|
+
class FirecrackerPidNotFoundError extends Error {
|
|
226
|
+
constructor(body) {
|
|
227
|
+
super(
|
|
228
|
+
`FIRECRACKER_PID_NOT_FOUND: ${body.message}`
|
|
229
|
+
);
|
|
230
|
+
this.body = body;
|
|
231
|
+
this.name = "FirecrackerPidNotFoundError";
|
|
232
|
+
}
|
|
233
|
+
static code = "FIRECRACKER_PID_NOT_FOUND";
|
|
234
|
+
static statusCode = 500;
|
|
235
|
+
static description = `Firecracker PID not found`;
|
|
236
|
+
}
|
|
237
|
+
class FirecrackerApiSocketNotFoundError extends Error {
|
|
238
|
+
constructor(body) {
|
|
239
|
+
super(
|
|
240
|
+
`FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
|
|
241
|
+
);
|
|
242
|
+
this.body = body;
|
|
243
|
+
this.name = "FirecrackerApiSocketNotFoundError";
|
|
244
|
+
}
|
|
245
|
+
static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
|
|
246
|
+
static statusCode = 500;
|
|
247
|
+
static description = `Firecracker API socket not found`;
|
|
248
|
+
}
|
|
249
|
+
class VmStartTimeoutError extends Error {
|
|
250
|
+
constructor(body) {
|
|
251
|
+
super(
|
|
252
|
+
`VM_START_TIMEOUT: ${body.message}`
|
|
253
|
+
);
|
|
254
|
+
this.body = body;
|
|
255
|
+
this.name = "VmStartTimeoutError";
|
|
256
|
+
}
|
|
257
|
+
static code = "VM_START_TIMEOUT";
|
|
258
|
+
static statusCode = 504;
|
|
259
|
+
static description = `VM did not become ready within the specified timeout`;
|
|
260
|
+
}
|
|
261
|
+
class VmExitDuringStartError extends Error {
|
|
262
|
+
constructor(body) {
|
|
263
|
+
super(
|
|
264
|
+
`VM_EXIT_DURING_START: ${body.message}`
|
|
265
|
+
);
|
|
266
|
+
this.body = body;
|
|
267
|
+
this.name = "VmExitDuringStartError";
|
|
268
|
+
}
|
|
269
|
+
static code = "VM_EXIT_DURING_START";
|
|
270
|
+
static statusCode = 500;
|
|
271
|
+
static description = `VM process exited unexpectedly during start`;
|
|
272
|
+
}
|
|
273
|
+
class StdIoError extends Error {
|
|
274
|
+
constructor(body) {
|
|
275
|
+
super(
|
|
276
|
+
`STD_IO: ${body.message}`
|
|
277
|
+
);
|
|
278
|
+
this.body = body;
|
|
279
|
+
this.name = "StdIoError";
|
|
280
|
+
}
|
|
281
|
+
static code = "STD_IO";
|
|
282
|
+
static statusCode = 500;
|
|
283
|
+
static description = `Standard IO error`;
|
|
284
|
+
}
|
|
285
|
+
class VmCreateTmuxSessionError extends Error {
|
|
286
|
+
constructor(body) {
|
|
287
|
+
super(
|
|
288
|
+
`VM_CREATE_TMUX_SESSION: ${body.message}`
|
|
289
|
+
);
|
|
290
|
+
this.body = body;
|
|
291
|
+
this.name = "VmCreateTmuxSessionError";
|
|
292
|
+
}
|
|
293
|
+
static code = "VM_CREATE_TMUX_SESSION";
|
|
294
|
+
static statusCode = 500;
|
|
295
|
+
static description = `Failed to create tmux session for VM`;
|
|
296
|
+
}
|
|
297
|
+
class VmSubnetNotFoundError extends Error {
|
|
298
|
+
constructor(body) {
|
|
299
|
+
super(
|
|
300
|
+
`VM_SUBNET_NOT_FOUND: ${body.message}`
|
|
301
|
+
);
|
|
302
|
+
this.body = body;
|
|
303
|
+
this.name = "VmSubnetNotFoundError";
|
|
304
|
+
}
|
|
305
|
+
static code = "VM_SUBNET_NOT_FOUND";
|
|
306
|
+
static statusCode = 500;
|
|
307
|
+
static description = `Subnet for VM not found`;
|
|
308
|
+
}
|
|
309
|
+
class VmOperationDeniedDuringTransactionError extends Error {
|
|
310
|
+
constructor(body) {
|
|
311
|
+
super(
|
|
312
|
+
`VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
|
|
313
|
+
);
|
|
314
|
+
this.body = body;
|
|
315
|
+
this.name = "VmOperationDeniedDuringTransactionError";
|
|
316
|
+
}
|
|
317
|
+
static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
|
|
318
|
+
static statusCode = 409;
|
|
319
|
+
static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
|
|
320
|
+
}
|
|
321
|
+
class VmTransactionIdMismatchError extends Error {
|
|
322
|
+
constructor(body) {
|
|
323
|
+
super(
|
|
324
|
+
`VM_TRANSACTION_ID_MISMATCH: ${body.message}`
|
|
325
|
+
);
|
|
326
|
+
this.body = body;
|
|
327
|
+
this.name = "VmTransactionIdMismatchError";
|
|
328
|
+
}
|
|
329
|
+
static code = "VM_TRANSACTION_ID_MISMATCH";
|
|
330
|
+
static statusCode = 400;
|
|
331
|
+
static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
|
|
332
|
+
}
|
|
333
|
+
class VmNotInTransactionError extends Error {
|
|
334
|
+
constructor(body) {
|
|
335
|
+
super(
|
|
336
|
+
`VM_NOT_IN_TRANSACTION: ${body.message}`
|
|
337
|
+
);
|
|
338
|
+
this.body = body;
|
|
339
|
+
this.name = "VmNotInTransactionError";
|
|
340
|
+
}
|
|
341
|
+
static code = "VM_NOT_IN_TRANSACTION";
|
|
342
|
+
static statusCode = 404;
|
|
343
|
+
static description = `VM not in a transaction: {vm_id}`;
|
|
344
|
+
}
|
|
345
|
+
class CreateVmBadRequestError extends Error {
|
|
346
|
+
constructor(body) {
|
|
347
|
+
super(
|
|
348
|
+
`CREATE_VM_BAD_REQUEST: ${body.message}`
|
|
349
|
+
);
|
|
350
|
+
this.body = body;
|
|
351
|
+
this.name = "CreateVmBadRequestError";
|
|
352
|
+
}
|
|
353
|
+
static code = "CREATE_VM_BAD_REQUEST";
|
|
354
|
+
static statusCode = 400;
|
|
355
|
+
static description = `Bad request: {message}`;
|
|
356
|
+
}
|
|
357
|
+
class UserNotFoundError extends Error {
|
|
358
|
+
constructor(body) {
|
|
359
|
+
super(
|
|
360
|
+
`USER_NOT_FOUND: ${body.message}`
|
|
361
|
+
);
|
|
362
|
+
this.body = body;
|
|
363
|
+
this.name = "UserNotFoundError";
|
|
364
|
+
}
|
|
365
|
+
static code = "USER_NOT_FOUND";
|
|
366
|
+
static statusCode = 404;
|
|
367
|
+
static description = `User not found: {user_name}`;
|
|
368
|
+
}
|
|
369
|
+
class UserAlreadyExistsError extends Error {
|
|
370
|
+
constructor(body) {
|
|
371
|
+
super(
|
|
372
|
+
`USER_ALREADY_EXISTS: ${body.message}`
|
|
373
|
+
);
|
|
374
|
+
this.body = body;
|
|
375
|
+
this.name = "UserAlreadyExistsError";
|
|
376
|
+
}
|
|
377
|
+
static code = "USER_ALREADY_EXISTS";
|
|
378
|
+
static statusCode = 409;
|
|
379
|
+
static description = `Conflict: User '{user_name}' already exists`;
|
|
380
|
+
}
|
|
381
|
+
class ValidationErrorError extends Error {
|
|
382
|
+
constructor(body) {
|
|
383
|
+
super(
|
|
384
|
+
`VALIDATION_ERROR: ${body.message}`
|
|
385
|
+
);
|
|
386
|
+
this.body = body;
|
|
387
|
+
this.name = "ValidationErrorError";
|
|
388
|
+
}
|
|
389
|
+
static code = "VALIDATION_ERROR";
|
|
390
|
+
static statusCode = 400;
|
|
391
|
+
static description = `Validation error: {message}`;
|
|
392
|
+
}
|
|
393
|
+
class GroupNotFoundError extends Error {
|
|
394
|
+
constructor(body) {
|
|
395
|
+
super(
|
|
396
|
+
`GROUP_NOT_FOUND: ${body.message}`
|
|
397
|
+
);
|
|
398
|
+
this.body = body;
|
|
399
|
+
this.name = "GroupNotFoundError";
|
|
400
|
+
}
|
|
401
|
+
static code = "GROUP_NOT_FOUND";
|
|
402
|
+
static statusCode = 404;
|
|
403
|
+
static description = `Group not found: {group_name}`;
|
|
404
|
+
}
|
|
405
|
+
class GroupAlreadyExistsError extends Error {
|
|
406
|
+
constructor(body) {
|
|
407
|
+
super(
|
|
408
|
+
`GROUP_ALREADY_EXISTS: ${body.message}`
|
|
409
|
+
);
|
|
410
|
+
this.body = body;
|
|
411
|
+
this.name = "GroupAlreadyExistsError";
|
|
412
|
+
}
|
|
413
|
+
static code = "GROUP_ALREADY_EXISTS";
|
|
414
|
+
static statusCode = 409;
|
|
415
|
+
static description = `Conflict: Group '{group_name}' already exists`;
|
|
416
|
+
}
|
|
417
|
+
class DuplicateUserNameError extends Error {
|
|
418
|
+
constructor(body) {
|
|
419
|
+
super(
|
|
420
|
+
`DUPLICATE_USER_NAME: ${body.message}`
|
|
421
|
+
);
|
|
422
|
+
this.body = body;
|
|
423
|
+
this.name = "DuplicateUserNameError";
|
|
424
|
+
}
|
|
425
|
+
static code = "DUPLICATE_USER_NAME";
|
|
426
|
+
static statusCode = 400;
|
|
427
|
+
static description = `Duplicate user name '{name}' found`;
|
|
428
|
+
}
|
|
429
|
+
class UserGroupEmptyError extends Error {
|
|
430
|
+
constructor(body) {
|
|
431
|
+
super(
|
|
432
|
+
`USER_GROUP_EMPTY: ${body.message}`
|
|
433
|
+
);
|
|
434
|
+
this.body = body;
|
|
435
|
+
this.name = "UserGroupEmptyError";
|
|
436
|
+
}
|
|
437
|
+
static code = "USER_GROUP_EMPTY";
|
|
438
|
+
static statusCode = 400;
|
|
439
|
+
static description = `User '{user}' has empty string in groups`;
|
|
440
|
+
}
|
|
441
|
+
class UserSystemFlagMismatchError extends Error {
|
|
442
|
+
constructor(body) {
|
|
443
|
+
super(
|
|
444
|
+
`USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
|
|
445
|
+
);
|
|
446
|
+
this.body = body;
|
|
447
|
+
this.name = "UserSystemFlagMismatchError";
|
|
448
|
+
}
|
|
449
|
+
static code = "USER_SYSTEM_FLAG_MISMATCH";
|
|
450
|
+
static statusCode = 400;
|
|
451
|
+
static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
|
|
452
|
+
}
|
|
453
|
+
class UserUidOutOfRangeError extends Error {
|
|
454
|
+
constructor(body) {
|
|
455
|
+
super(
|
|
456
|
+
`USER_UID_OUT_OF_RANGE: ${body.message}`
|
|
457
|
+
);
|
|
458
|
+
this.body = body;
|
|
459
|
+
this.name = "UserUidOutOfRangeError";
|
|
460
|
+
}
|
|
461
|
+
static code = "USER_UID_OUT_OF_RANGE";
|
|
462
|
+
static statusCode = 400;
|
|
463
|
+
static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
|
|
464
|
+
}
|
|
465
|
+
class UserHomeInvalidError extends Error {
|
|
466
|
+
constructor(body) {
|
|
467
|
+
super(
|
|
468
|
+
`USER_HOME_INVALID: ${body.message}`
|
|
469
|
+
);
|
|
470
|
+
this.body = body;
|
|
471
|
+
this.name = "UserHomeInvalidError";
|
|
472
|
+
}
|
|
473
|
+
static code = "USER_HOME_INVALID";
|
|
474
|
+
static statusCode = 400;
|
|
475
|
+
static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
|
|
476
|
+
}
|
|
477
|
+
class UserShellInvalidError extends Error {
|
|
478
|
+
constructor(body) {
|
|
479
|
+
super(
|
|
480
|
+
`USER_SHELL_INVALID: ${body.message}`
|
|
481
|
+
);
|
|
482
|
+
this.body = body;
|
|
483
|
+
this.name = "UserShellInvalidError";
|
|
484
|
+
}
|
|
485
|
+
static code = "USER_SHELL_INVALID";
|
|
486
|
+
static statusCode = 400;
|
|
487
|
+
static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
|
|
488
|
+
}
|
|
489
|
+
class DuplicateGroupNameError extends Error {
|
|
490
|
+
constructor(body) {
|
|
491
|
+
super(
|
|
492
|
+
`DUPLICATE_GROUP_NAME: ${body.message}`
|
|
493
|
+
);
|
|
494
|
+
this.body = body;
|
|
495
|
+
this.name = "DuplicateGroupNameError";
|
|
496
|
+
}
|
|
497
|
+
static code = "DUPLICATE_GROUP_NAME";
|
|
498
|
+
static statusCode = 400;
|
|
499
|
+
static description = `Duplicate group name '{name}' found`;
|
|
500
|
+
}
|
|
501
|
+
class GroupNameReservedError extends Error {
|
|
502
|
+
constructor(body) {
|
|
503
|
+
super(
|
|
504
|
+
`GROUP_NAME_RESERVED: ${body.message}`
|
|
505
|
+
);
|
|
506
|
+
this.body = body;
|
|
507
|
+
this.name = "GroupNameReservedError";
|
|
508
|
+
}
|
|
509
|
+
static code = "GROUP_NAME_RESERVED";
|
|
510
|
+
static statusCode = 400;
|
|
511
|
+
static description = `Group name '{name}' is reserved and cannot be used`;
|
|
512
|
+
}
|
|
513
|
+
class GroupNameInvalidCharsError extends Error {
|
|
514
|
+
constructor(body) {
|
|
515
|
+
super(
|
|
516
|
+
`GROUP_NAME_INVALID_CHARS: ${body.message}`
|
|
517
|
+
);
|
|
518
|
+
this.body = body;
|
|
519
|
+
this.name = "GroupNameInvalidCharsError";
|
|
520
|
+
}
|
|
521
|
+
static code = "GROUP_NAME_INVALID_CHARS";
|
|
522
|
+
static statusCode = 400;
|
|
523
|
+
static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
|
|
524
|
+
}
|
|
525
|
+
class GroupNameTooLongError extends Error {
|
|
526
|
+
constructor(body) {
|
|
527
|
+
super(
|
|
528
|
+
`GROUP_NAME_TOO_LONG: ${body.message}`
|
|
529
|
+
);
|
|
530
|
+
this.body = body;
|
|
531
|
+
this.name = "GroupNameTooLongError";
|
|
532
|
+
}
|
|
533
|
+
static code = "GROUP_NAME_TOO_LONG";
|
|
534
|
+
static statusCode = 400;
|
|
535
|
+
static description = `Group name '{name}' is too long (max {max_length} characters)`;
|
|
536
|
+
}
|
|
537
|
+
class GroupNameEmptyError extends Error {
|
|
538
|
+
constructor(body) {
|
|
539
|
+
super(
|
|
540
|
+
`GROUP_NAME_EMPTY: ${body.message}`
|
|
541
|
+
);
|
|
542
|
+
this.body = body;
|
|
543
|
+
this.name = "GroupNameEmptyError";
|
|
544
|
+
}
|
|
545
|
+
static code = "GROUP_NAME_EMPTY";
|
|
546
|
+
static statusCode = 400;
|
|
547
|
+
static description = `Group name cannot be empty`;
|
|
548
|
+
}
|
|
549
|
+
class WantedByEmptyError extends Error {
|
|
550
|
+
constructor(body) {
|
|
551
|
+
super(
|
|
552
|
+
`WANTED_BY_EMPTY: ${body.message}`
|
|
553
|
+
);
|
|
554
|
+
this.body = body;
|
|
555
|
+
this.name = "WantedByEmptyError";
|
|
556
|
+
}
|
|
557
|
+
static code = "WANTED_BY_EMPTY";
|
|
558
|
+
static statusCode = 400;
|
|
559
|
+
static description = `wanted_by cannot be empty if provided`;
|
|
560
|
+
}
|
|
561
|
+
class WorkdirEmptyError extends Error {
|
|
562
|
+
constructor(body) {
|
|
563
|
+
super(
|
|
564
|
+
`WORKDIR_EMPTY: ${body.message}`
|
|
565
|
+
);
|
|
566
|
+
this.body = body;
|
|
567
|
+
this.name = "WorkdirEmptyError";
|
|
568
|
+
}
|
|
569
|
+
static code = "WORKDIR_EMPTY";
|
|
570
|
+
static statusCode = 400;
|
|
571
|
+
static description = `Working directory cannot be empty if provided`;
|
|
572
|
+
}
|
|
573
|
+
class GroupEmptyError extends Error {
|
|
574
|
+
constructor(body) {
|
|
575
|
+
super(
|
|
576
|
+
`GROUP_EMPTY: ${body.message}`
|
|
577
|
+
);
|
|
578
|
+
this.body = body;
|
|
579
|
+
this.name = "GroupEmptyError";
|
|
580
|
+
}
|
|
581
|
+
static code = "GROUP_EMPTY";
|
|
582
|
+
static statusCode = 400;
|
|
583
|
+
static description = `Group cannot be empty if provided`;
|
|
584
|
+
}
|
|
585
|
+
class UserEmptyError extends Error {
|
|
586
|
+
constructor(body) {
|
|
587
|
+
super(
|
|
588
|
+
`USER_EMPTY: ${body.message}`
|
|
589
|
+
);
|
|
590
|
+
this.body = body;
|
|
591
|
+
this.name = "UserEmptyError";
|
|
592
|
+
}
|
|
593
|
+
static code = "USER_EMPTY";
|
|
594
|
+
static statusCode = 400;
|
|
595
|
+
static description = `User cannot be empty if provided`;
|
|
596
|
+
}
|
|
597
|
+
class OnFailureArrayContainsEmptyError extends Error {
|
|
598
|
+
constructor(body) {
|
|
599
|
+
super(
|
|
600
|
+
`ON_FAILURE_ARRAY_CONTAINS_EMPTY: ${body.message}`
|
|
601
|
+
);
|
|
602
|
+
this.body = body;
|
|
603
|
+
this.name = "OnFailureArrayContainsEmptyError";
|
|
604
|
+
}
|
|
605
|
+
static code = "ON_FAILURE_ARRAY_CONTAINS_EMPTY";
|
|
606
|
+
static statusCode = 400;
|
|
607
|
+
static description = `'onFailure' array cannot contain empty strings`;
|
|
608
|
+
}
|
|
609
|
+
class RequiresArrayContainsEmptyError extends Error {
|
|
610
|
+
constructor(body) {
|
|
611
|
+
super(
|
|
612
|
+
`REQUIRES_ARRAY_CONTAINS_EMPTY: ${body.message}`
|
|
613
|
+
);
|
|
614
|
+
this.body = body;
|
|
615
|
+
this.name = "RequiresArrayContainsEmptyError";
|
|
616
|
+
}
|
|
617
|
+
static code = "REQUIRES_ARRAY_CONTAINS_EMPTY";
|
|
618
|
+
static statusCode = 400;
|
|
619
|
+
static description = `'requires' array cannot contain empty strings`;
|
|
620
|
+
}
|
|
621
|
+
class AfterArrayContainsEmptyError extends Error {
|
|
622
|
+
constructor(body) {
|
|
623
|
+
super(
|
|
624
|
+
`AFTER_ARRAY_CONTAINS_EMPTY: ${body.message}`
|
|
625
|
+
);
|
|
626
|
+
this.body = body;
|
|
627
|
+
this.name = "AfterArrayContainsEmptyError";
|
|
628
|
+
}
|
|
629
|
+
static code = "AFTER_ARRAY_CONTAINS_EMPTY";
|
|
630
|
+
static statusCode = 400;
|
|
631
|
+
static description = `'after' array cannot contain empty strings`;
|
|
632
|
+
}
|
|
633
|
+
class EnvKeyContainsEqualsError extends Error {
|
|
634
|
+
constructor(body) {
|
|
635
|
+
super(
|
|
636
|
+
`ENV_KEY_CONTAINS_EQUALS: ${body.message}`
|
|
637
|
+
);
|
|
638
|
+
this.body = body;
|
|
639
|
+
this.name = "EnvKeyContainsEqualsError";
|
|
640
|
+
}
|
|
641
|
+
static code = "ENV_KEY_CONTAINS_EQUALS";
|
|
642
|
+
static statusCode = 400;
|
|
643
|
+
static description = `Environment variable key '{key}' cannot contain '='`;
|
|
644
|
+
}
|
|
645
|
+
class EnvKeyEmptyError extends Error {
|
|
646
|
+
constructor(body) {
|
|
647
|
+
super(
|
|
648
|
+
`ENV_KEY_EMPTY: ${body.message}`
|
|
649
|
+
);
|
|
650
|
+
this.body = body;
|
|
651
|
+
this.name = "EnvKeyEmptyError";
|
|
652
|
+
}
|
|
653
|
+
static code = "ENV_KEY_EMPTY";
|
|
654
|
+
static statusCode = 400;
|
|
655
|
+
static description = `Environment variable key cannot be empty`;
|
|
656
|
+
}
|
|
657
|
+
class ExecEmptyError extends Error {
|
|
658
|
+
constructor(body) {
|
|
659
|
+
super(
|
|
660
|
+
`EXEC_EMPTY: ${body.message}`
|
|
661
|
+
);
|
|
662
|
+
this.body = body;
|
|
663
|
+
this.name = "ExecEmptyError";
|
|
664
|
+
}
|
|
665
|
+
static code = "EXEC_EMPTY";
|
|
666
|
+
static statusCode = 400;
|
|
667
|
+
static description = `Executable path (exec) cannot be empty`;
|
|
668
|
+
}
|
|
669
|
+
class ServiceNameTooLongError extends Error {
|
|
670
|
+
constructor(body) {
|
|
671
|
+
super(
|
|
672
|
+
`SERVICE_NAME_TOO_LONG: ${body.message}`
|
|
673
|
+
);
|
|
674
|
+
this.body = body;
|
|
675
|
+
this.name = "ServiceNameTooLongError";
|
|
676
|
+
}
|
|
677
|
+
static code = "SERVICE_NAME_TOO_LONG";
|
|
678
|
+
static statusCode = 400;
|
|
679
|
+
static description = `Service name '{name}' is too long (max {max_length} characters)`;
|
|
680
|
+
}
|
|
681
|
+
class ServiceNameInvalidPrefixError extends Error {
|
|
682
|
+
constructor(body) {
|
|
683
|
+
super(
|
|
684
|
+
`SERVICE_NAME_INVALID_PREFIX: ${body.message}`
|
|
685
|
+
);
|
|
686
|
+
this.body = body;
|
|
687
|
+
this.name = "ServiceNameInvalidPrefixError";
|
|
688
|
+
}
|
|
689
|
+
static code = "SERVICE_NAME_INVALID_PREFIX";
|
|
690
|
+
static statusCode = 400;
|
|
691
|
+
static description = `Service name '{name}' cannot start with '.' or '-'`;
|
|
692
|
+
}
|
|
693
|
+
class ServiceNameInvalidCharsError extends Error {
|
|
694
|
+
constructor(body) {
|
|
695
|
+
super(
|
|
696
|
+
`SERVICE_NAME_INVALID_CHARS: ${body.message}`
|
|
697
|
+
);
|
|
698
|
+
this.body = body;
|
|
699
|
+
this.name = "ServiceNameInvalidCharsError";
|
|
700
|
+
}
|
|
701
|
+
static code = "SERVICE_NAME_INVALID_CHARS";
|
|
702
|
+
static statusCode = 400;
|
|
703
|
+
static description = `Service name '{name}' contains invalid characters (/ or null)`;
|
|
704
|
+
}
|
|
705
|
+
class ServiceNameEmptyError extends Error {
|
|
706
|
+
constructor(body) {
|
|
707
|
+
super(
|
|
708
|
+
`SERVICE_NAME_EMPTY: ${body.message}`
|
|
709
|
+
);
|
|
710
|
+
this.body = body;
|
|
711
|
+
this.name = "ServiceNameEmptyError";
|
|
712
|
+
}
|
|
713
|
+
static code = "SERVICE_NAME_EMPTY";
|
|
714
|
+
static statusCode = 400;
|
|
715
|
+
static description = `Service name cannot be empty`;
|
|
716
|
+
}
|
|
717
|
+
class ServiceAlreadyExistsError extends Error {
|
|
718
|
+
constructor(body) {
|
|
719
|
+
super(
|
|
720
|
+
`SERVICE_ALREADY_EXISTS: ${body.message}`
|
|
721
|
+
);
|
|
722
|
+
this.body = body;
|
|
723
|
+
this.name = "ServiceAlreadyExistsError";
|
|
724
|
+
}
|
|
725
|
+
static code = "SERVICE_ALREADY_EXISTS";
|
|
726
|
+
static statusCode = 409;
|
|
727
|
+
static description = `Service '{service_name}' already exists`;
|
|
728
|
+
}
|
|
729
|
+
class ServiceNotFoundError extends Error {
|
|
730
|
+
constructor(body) {
|
|
731
|
+
super(
|
|
732
|
+
`SERVICE_NOT_FOUND: ${body.message}`
|
|
733
|
+
);
|
|
734
|
+
this.body = body;
|
|
735
|
+
this.name = "ServiceNotFoundError";
|
|
736
|
+
}
|
|
737
|
+
static code = "SERVICE_NOT_FOUND";
|
|
738
|
+
static statusCode = 404;
|
|
739
|
+
static description = `null`;
|
|
740
|
+
}
|
|
741
|
+
class InternalError extends Error {
|
|
742
|
+
constructor(body) {
|
|
743
|
+
super(
|
|
744
|
+
`INTERNAL: ${body.message}`
|
|
745
|
+
);
|
|
746
|
+
this.body = body;
|
|
747
|
+
this.name = "InternalError";
|
|
748
|
+
}
|
|
749
|
+
static code = "INTERNAL";
|
|
750
|
+
static statusCode = 500;
|
|
751
|
+
static description = `Internal error: {0}`;
|
|
752
|
+
}
|
|
753
|
+
class SigningError extends Error {
|
|
754
|
+
constructor(body) {
|
|
755
|
+
super(
|
|
756
|
+
`SIGNING: ${body.message}`
|
|
757
|
+
);
|
|
758
|
+
this.body = body;
|
|
759
|
+
this.name = "SigningError";
|
|
760
|
+
}
|
|
761
|
+
static code = "SIGNING";
|
|
762
|
+
static statusCode = 500;
|
|
763
|
+
static description = `Signing error`;
|
|
764
|
+
}
|
|
765
|
+
class InvalidSignatureError extends Error {
|
|
766
|
+
constructor(body) {
|
|
767
|
+
super(
|
|
768
|
+
`INVALID_SIGNATURE: ${body.message}`
|
|
769
|
+
);
|
|
770
|
+
this.body = body;
|
|
771
|
+
this.name = "InvalidSignatureError";
|
|
772
|
+
}
|
|
773
|
+
static code = "INVALID_SIGNATURE";
|
|
774
|
+
static statusCode = 403;
|
|
775
|
+
static description = `Invalid signature`;
|
|
776
|
+
}
|
|
777
|
+
class InvalidParametersError extends Error {
|
|
778
|
+
constructor(body) {
|
|
779
|
+
super(
|
|
780
|
+
`INVALID_PARAMETERS: ${body.message}`
|
|
781
|
+
);
|
|
782
|
+
this.body = body;
|
|
783
|
+
this.name = "InvalidParametersError";
|
|
784
|
+
}
|
|
785
|
+
static code = "INVALID_PARAMETERS";
|
|
786
|
+
static statusCode = 400;
|
|
787
|
+
static description = `Invalid parameters`;
|
|
788
|
+
}
|
|
789
|
+
class MaxUsesExceededError extends Error {
|
|
790
|
+
constructor(body) {
|
|
791
|
+
super(
|
|
792
|
+
`MAX_USES_EXCEEDED: ${body.message}`
|
|
793
|
+
);
|
|
794
|
+
this.body = body;
|
|
795
|
+
this.name = "MaxUsesExceededError";
|
|
796
|
+
}
|
|
797
|
+
static code = "MAX_USES_EXCEEDED";
|
|
798
|
+
static statusCode = 403;
|
|
799
|
+
static description = `Session maximum uses exceeded`;
|
|
800
|
+
}
|
|
801
|
+
class ExpiredError extends Error {
|
|
802
|
+
constructor(body) {
|
|
803
|
+
super(
|
|
804
|
+
`EXPIRED: ${body.message}`
|
|
805
|
+
);
|
|
806
|
+
this.body = body;
|
|
807
|
+
this.name = "ExpiredError";
|
|
808
|
+
}
|
|
809
|
+
static code = "EXPIRED";
|
|
810
|
+
static statusCode = 403;
|
|
811
|
+
static description = `Session has expired`;
|
|
812
|
+
}
|
|
813
|
+
class ConflictError extends Error {
|
|
814
|
+
constructor(body) {
|
|
815
|
+
super(
|
|
816
|
+
`CONFLICT: ${body.message}`
|
|
817
|
+
);
|
|
818
|
+
this.body = body;
|
|
819
|
+
this.name = "ConflictError";
|
|
820
|
+
}
|
|
821
|
+
static code = "CONFLICT";
|
|
822
|
+
static statusCode = 409;
|
|
823
|
+
static description = `Sync conflict: {message}`;
|
|
824
|
+
}
|
|
825
|
+
class RepoNotFoundError extends Error {
|
|
826
|
+
constructor(body) {
|
|
827
|
+
super(
|
|
828
|
+
`REPO_NOT_FOUND: ${body.message}`
|
|
829
|
+
);
|
|
830
|
+
this.body = body;
|
|
831
|
+
this.name = "RepoNotFoundError";
|
|
832
|
+
}
|
|
833
|
+
static code = "REPO_NOT_FOUND";
|
|
834
|
+
static statusCode = 404;
|
|
835
|
+
static description = `Repository not found`;
|
|
836
|
+
}
|
|
837
|
+
class ForbiddenError extends Error {
|
|
838
|
+
constructor(body) {
|
|
839
|
+
super(
|
|
840
|
+
`FORBIDDEN: ${body.message}`
|
|
841
|
+
);
|
|
842
|
+
this.body = body;
|
|
843
|
+
this.name = "ForbiddenError";
|
|
844
|
+
}
|
|
845
|
+
static code = "FORBIDDEN";
|
|
846
|
+
static statusCode = 403;
|
|
847
|
+
static description = `Forbidden: {message}`;
|
|
848
|
+
}
|
|
849
|
+
class UnsupportedTransferError extends Error {
|
|
850
|
+
constructor(body) {
|
|
851
|
+
super(
|
|
852
|
+
`UNSUPPORTED_TRANSFER: ${body.message}`
|
|
853
|
+
);
|
|
854
|
+
this.body = body;
|
|
855
|
+
this.name = "UnsupportedTransferError";
|
|
856
|
+
}
|
|
857
|
+
static code = "UNSUPPORTED_TRANSFER";
|
|
858
|
+
static statusCode = 400;
|
|
859
|
+
static description = `Unsupported LFS transfer protocol(s)`;
|
|
860
|
+
}
|
|
861
|
+
class BranchNotFoundError extends Error {
|
|
862
|
+
constructor(body) {
|
|
863
|
+
super(
|
|
864
|
+
`BRANCH_NOT_FOUND: ${body.message}`
|
|
865
|
+
);
|
|
866
|
+
this.body = body;
|
|
867
|
+
this.name = "BranchNotFoundError";
|
|
868
|
+
}
|
|
869
|
+
static code = "BRANCH_NOT_FOUND";
|
|
870
|
+
static statusCode = 404;
|
|
871
|
+
static description = `Branch not found: {branch}`;
|
|
872
|
+
}
|
|
873
|
+
class InvalidObjectIdError extends Error {
|
|
874
|
+
constructor(body) {
|
|
875
|
+
super(
|
|
876
|
+
`INVALID_OBJECT_ID: ${body.message}`
|
|
877
|
+
);
|
|
878
|
+
this.body = body;
|
|
879
|
+
this.name = "InvalidObjectIdError";
|
|
880
|
+
}
|
|
881
|
+
static code = "INVALID_OBJECT_ID";
|
|
882
|
+
static statusCode = 400;
|
|
883
|
+
static description = `Invalid object ID`;
|
|
884
|
+
}
|
|
885
|
+
class BlobNotFoundError extends Error {
|
|
886
|
+
constructor(body) {
|
|
887
|
+
super(
|
|
888
|
+
`BLOB_NOT_FOUND: ${body.message}`
|
|
889
|
+
);
|
|
890
|
+
this.body = body;
|
|
891
|
+
this.name = "BlobNotFoundError";
|
|
892
|
+
}
|
|
893
|
+
static code = "BLOB_NOT_FOUND";
|
|
894
|
+
static statusCode = 404;
|
|
895
|
+
static description = `Blob not found: {hash}`;
|
|
896
|
+
}
|
|
897
|
+
class ReferenceNotFoundError extends Error {
|
|
898
|
+
constructor(body) {
|
|
899
|
+
super(
|
|
900
|
+
`REFERENCE_NOT_FOUND: ${body.message}`
|
|
901
|
+
);
|
|
902
|
+
this.body = body;
|
|
903
|
+
this.name = "ReferenceNotFoundError";
|
|
904
|
+
}
|
|
905
|
+
static code = "REFERENCE_NOT_FOUND";
|
|
906
|
+
static statusCode = 404;
|
|
907
|
+
static description = `Reference not found: {reference}`;
|
|
908
|
+
}
|
|
909
|
+
class TagNotFoundError extends Error {
|
|
910
|
+
constructor(body) {
|
|
911
|
+
super(
|
|
912
|
+
`TAG_NOT_FOUND: ${body.message}`
|
|
913
|
+
);
|
|
914
|
+
this.body = body;
|
|
915
|
+
this.name = "TagNotFoundError";
|
|
916
|
+
}
|
|
917
|
+
static code = "TAG_NOT_FOUND";
|
|
918
|
+
static statusCode = 404;
|
|
919
|
+
static description = `Tag not found: {tag}`;
|
|
920
|
+
}
|
|
921
|
+
class CommitNotFoundError extends Error {
|
|
922
|
+
constructor(body) {
|
|
923
|
+
super(
|
|
924
|
+
`COMMIT_NOT_FOUND: ${body.message}`
|
|
925
|
+
);
|
|
926
|
+
this.body = body;
|
|
927
|
+
this.name = "CommitNotFoundError";
|
|
928
|
+
}
|
|
929
|
+
static code = "COMMIT_NOT_FOUND";
|
|
930
|
+
static statusCode = 404;
|
|
931
|
+
static description = `Commit not found: {hash}`;
|
|
932
|
+
}
|
|
933
|
+
class InvalidRequestError extends Error {
|
|
934
|
+
constructor(body) {
|
|
935
|
+
super(
|
|
936
|
+
`INVALID_REQUEST: ${body.message}`
|
|
937
|
+
);
|
|
938
|
+
this.body = body;
|
|
939
|
+
this.name = "InvalidRequestError";
|
|
940
|
+
}
|
|
941
|
+
static code = "INVALID_REQUEST";
|
|
942
|
+
static statusCode = 400;
|
|
943
|
+
static description = `Invalid request: {message}`;
|
|
944
|
+
}
|
|
945
|
+
class PathNotFoundError extends Error {
|
|
946
|
+
constructor(body) {
|
|
947
|
+
super(
|
|
948
|
+
`PATH_NOT_FOUND: ${body.message}`
|
|
949
|
+
);
|
|
950
|
+
this.body = body;
|
|
951
|
+
this.name = "PathNotFoundError";
|
|
952
|
+
}
|
|
953
|
+
static code = "PATH_NOT_FOUND";
|
|
954
|
+
static statusCode = 404;
|
|
955
|
+
static description = `Path not found: {path}`;
|
|
956
|
+
}
|
|
957
|
+
class InvalidRevisionError extends Error {
|
|
958
|
+
constructor(body) {
|
|
959
|
+
super(
|
|
960
|
+
`INVALID_REVISION: ${body.message}`
|
|
961
|
+
);
|
|
962
|
+
this.body = body;
|
|
963
|
+
this.name = "InvalidRevisionError";
|
|
964
|
+
}
|
|
965
|
+
static code = "INVALID_REVISION";
|
|
966
|
+
static statusCode = 400;
|
|
967
|
+
static description = `null`;
|
|
968
|
+
}
|
|
969
|
+
class UnauthorizedError extends Error {
|
|
970
|
+
constructor(body) {
|
|
971
|
+
super(
|
|
972
|
+
`UNAUTHORIZED: ${body.message}`
|
|
973
|
+
);
|
|
974
|
+
this.body = body;
|
|
975
|
+
this.name = "UnauthorizedError";
|
|
976
|
+
}
|
|
977
|
+
static code = "UNAUTHORIZED";
|
|
978
|
+
static statusCode = 401;
|
|
979
|
+
static description = `Unauthorized`;
|
|
980
|
+
}
|
|
981
|
+
class TreeNotFoundError extends Error {
|
|
982
|
+
constructor(body) {
|
|
983
|
+
super(
|
|
984
|
+
`TREE_NOT_FOUND: ${body.message}`
|
|
985
|
+
);
|
|
986
|
+
this.body = body;
|
|
987
|
+
this.name = "TreeNotFoundError";
|
|
988
|
+
}
|
|
989
|
+
static code = "TREE_NOT_FOUND";
|
|
990
|
+
static statusCode = 404;
|
|
991
|
+
static description = `Tree not found: {hash}`;
|
|
992
|
+
}
|
|
993
|
+
class BuildFailedError extends Error {
|
|
994
|
+
constructor(body) {
|
|
995
|
+
super(
|
|
996
|
+
`BUILD_FAILED: ${body.message}`
|
|
997
|
+
);
|
|
998
|
+
this.body = body;
|
|
999
|
+
this.name = "BuildFailedError";
|
|
1000
|
+
}
|
|
1001
|
+
static code = "BUILD_FAILED";
|
|
1002
|
+
static statusCode = 500;
|
|
1003
|
+
static description = `Build failed on VM {vm_id}`;
|
|
1004
|
+
}
|
|
1005
|
+
class NoEntrypointFoundError extends Error {
|
|
1006
|
+
constructor(body) {
|
|
1007
|
+
super(
|
|
1008
|
+
`NO_ENTRYPOINT_FOUND: ${body.message}`
|
|
1009
|
+
);
|
|
1010
|
+
this.body = body;
|
|
1011
|
+
this.name = "NoEntrypointFoundError";
|
|
1012
|
+
}
|
|
1013
|
+
static code = "NO_ENTRYPOINT_FOUND";
|
|
1014
|
+
static statusCode = 400;
|
|
1015
|
+
static description = `No entrypoint found in deployment`;
|
|
1016
|
+
}
|
|
1017
|
+
class EntrypointNotFoundError extends Error {
|
|
1018
|
+
constructor(body) {
|
|
1019
|
+
super(
|
|
1020
|
+
`ENTRYPOINT_NOT_FOUND: ${body.message}`
|
|
1021
|
+
);
|
|
1022
|
+
this.body = body;
|
|
1023
|
+
this.name = "EntrypointNotFoundError";
|
|
1024
|
+
}
|
|
1025
|
+
static code = "ENTRYPOINT_NOT_FOUND";
|
|
1026
|
+
static statusCode = 400;
|
|
1027
|
+
static description = `Entrypoint not found: {entrypoint}`;
|
|
1028
|
+
}
|
|
1029
|
+
class NoDomainOwnershipError extends Error {
|
|
1030
|
+
constructor(body) {
|
|
1031
|
+
super(
|
|
1032
|
+
`NO_DOMAIN_OWNERSHIP: ${body.message}`
|
|
1033
|
+
);
|
|
1034
|
+
this.body = body;
|
|
1035
|
+
this.name = "NoDomainOwnershipError";
|
|
1036
|
+
}
|
|
1037
|
+
static code = "NO_DOMAIN_OWNERSHIP";
|
|
1038
|
+
static statusCode = 403;
|
|
1039
|
+
static description = `No domain ownership for: {domain}`;
|
|
1040
|
+
}
|
|
1041
|
+
class InvalidDomainsError extends Error {
|
|
1042
|
+
constructor(body) {
|
|
1043
|
+
super(
|
|
1044
|
+
`INVALID_DOMAINS: ${body.message}`
|
|
1045
|
+
);
|
|
1046
|
+
this.body = body;
|
|
1047
|
+
this.name = "InvalidDomainsError";
|
|
1048
|
+
}
|
|
1049
|
+
static code = "INVALID_DOMAINS";
|
|
1050
|
+
static statusCode = 400;
|
|
1051
|
+
static description = `Invalid domains provided`;
|
|
1052
|
+
}
|
|
1053
|
+
class WebDeploymentBadRequestError extends Error {
|
|
1054
|
+
constructor(body) {
|
|
1055
|
+
super(
|
|
1056
|
+
`WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
|
|
1057
|
+
);
|
|
1058
|
+
this.body = body;
|
|
1059
|
+
this.name = "WebDeploymentBadRequestError";
|
|
1060
|
+
}
|
|
1061
|
+
static code = "WEB_DEPLOYMENT_BAD_REQUEST";
|
|
1062
|
+
static statusCode = 400;
|
|
1063
|
+
static description = `Bad request: {message}`;
|
|
1064
|
+
}
|
|
1065
|
+
class DeploymentNotFoundError extends Error {
|
|
1066
|
+
constructor(body) {
|
|
1067
|
+
super(
|
|
1068
|
+
`DEPLOYMENT_NOT_FOUND: ${body.message}`
|
|
1069
|
+
);
|
|
1070
|
+
this.body = body;
|
|
1071
|
+
this.name = "DeploymentNotFoundError";
|
|
1072
|
+
}
|
|
1073
|
+
static code = "DEPLOYMENT_NOT_FOUND";
|
|
1074
|
+
static statusCode = 404;
|
|
1075
|
+
static description = `Deployment not found`;
|
|
1076
|
+
}
|
|
1077
|
+
class DatabaseErrorError extends Error {
|
|
1078
|
+
constructor(body) {
|
|
1079
|
+
super(
|
|
1080
|
+
`DATABASE_ERROR: ${body.message}`
|
|
1081
|
+
);
|
|
1082
|
+
this.body = body;
|
|
1083
|
+
this.name = "DatabaseErrorError";
|
|
1084
|
+
}
|
|
1085
|
+
static code = "DATABASE_ERROR";
|
|
1086
|
+
static statusCode = 500;
|
|
1087
|
+
static description = `Database operation failed: {message}`;
|
|
1088
|
+
}
|
|
1089
|
+
class TriggerErrorError extends Error {
|
|
1090
|
+
constructor(body) {
|
|
1091
|
+
super(
|
|
1092
|
+
`TRIGGER_ERROR: ${body.message}`
|
|
1093
|
+
);
|
|
1094
|
+
this.body = body;
|
|
1095
|
+
this.name = "TriggerErrorError";
|
|
1096
|
+
}
|
|
1097
|
+
static code = "TRIGGER_ERROR";
|
|
1098
|
+
static statusCode = 500;
|
|
1099
|
+
static description = `Failed to manage triggers: {message}`;
|
|
1100
|
+
}
|
|
1101
|
+
class TokenErrorError extends Error {
|
|
1102
|
+
constructor(body) {
|
|
1103
|
+
super(
|
|
1104
|
+
`TOKEN_ERROR: ${body.message}`
|
|
1105
|
+
);
|
|
1106
|
+
this.body = body;
|
|
1107
|
+
this.name = "TokenErrorError";
|
|
1108
|
+
}
|
|
1109
|
+
static code = "TOKEN_ERROR";
|
|
1110
|
+
static statusCode = 500;
|
|
1111
|
+
static description = `Failed to manage tokens: {message}`;
|
|
1112
|
+
}
|
|
1113
|
+
class PermissionErrorError extends Error {
|
|
1114
|
+
constructor(body) {
|
|
1115
|
+
super(
|
|
1116
|
+
`PERMISSION_ERROR: ${body.message}`
|
|
1117
|
+
);
|
|
1118
|
+
this.body = body;
|
|
1119
|
+
this.name = "PermissionErrorError";
|
|
1120
|
+
}
|
|
1121
|
+
static code = "PERMISSION_ERROR";
|
|
1122
|
+
static statusCode = 500;
|
|
1123
|
+
static description = `Failed to manage permissions: {message}`;
|
|
1124
|
+
}
|
|
1125
|
+
class IdentityErrorError extends Error {
|
|
1126
|
+
constructor(body) {
|
|
1127
|
+
super(
|
|
1128
|
+
`IDENTITY_ERROR: ${body.message}`
|
|
1129
|
+
);
|
|
1130
|
+
this.body = body;
|
|
1131
|
+
this.name = "IdentityErrorError";
|
|
1132
|
+
}
|
|
1133
|
+
static code = "IDENTITY_ERROR";
|
|
1134
|
+
static statusCode = 500;
|
|
1135
|
+
static description = `Failed to manage identity: {message}`;
|
|
1136
|
+
}
|
|
1137
|
+
class GetContentFailedError extends Error {
|
|
1138
|
+
constructor(body) {
|
|
1139
|
+
super(
|
|
1140
|
+
`GET_CONTENT_FAILED: ${body.message}`
|
|
1141
|
+
);
|
|
1142
|
+
this.body = body;
|
|
1143
|
+
this.name = "GetContentFailedError";
|
|
1144
|
+
}
|
|
1145
|
+
static code = "GET_CONTENT_FAILED";
|
|
1146
|
+
static statusCode = 500;
|
|
1147
|
+
static description = `Failed to get content: {message}`;
|
|
1148
|
+
}
|
|
1149
|
+
class ContentNotFoundError extends Error {
|
|
1150
|
+
constructor(body) {
|
|
1151
|
+
super(
|
|
1152
|
+
`CONTENT_NOT_FOUND: ${body.message}`
|
|
1153
|
+
);
|
|
1154
|
+
this.body = body;
|
|
1155
|
+
this.name = "ContentNotFoundError";
|
|
1156
|
+
}
|
|
1157
|
+
static code = "CONTENT_NOT_FOUND";
|
|
1158
|
+
static statusCode = 404;
|
|
1159
|
+
static description = `Content not found: {path}`;
|
|
1160
|
+
}
|
|
1161
|
+
class DownloadFailedError extends Error {
|
|
1162
|
+
constructor(body) {
|
|
1163
|
+
super(
|
|
1164
|
+
`DOWNLOAD_FAILED: ${body.message}`
|
|
1165
|
+
);
|
|
1166
|
+
this.body = body;
|
|
1167
|
+
this.name = "DownloadFailedError";
|
|
1168
|
+
}
|
|
1169
|
+
static code = "DOWNLOAD_FAILED";
|
|
1170
|
+
static statusCode = 500;
|
|
1171
|
+
static description = `Failed to download repository: {message}`;
|
|
1172
|
+
}
|
|
1173
|
+
class GitServerErrorError extends Error {
|
|
1174
|
+
constructor(body) {
|
|
1175
|
+
super(
|
|
1176
|
+
`GIT_SERVER_ERROR: ${body.message}`
|
|
1177
|
+
);
|
|
1178
|
+
this.body = body;
|
|
1179
|
+
this.name = "GitServerErrorError";
|
|
1180
|
+
}
|
|
1181
|
+
static code = "GIT_SERVER_ERROR";
|
|
1182
|
+
static statusCode = 500;
|
|
1183
|
+
static description = `Git server error: {message}`;
|
|
1184
|
+
}
|
|
1185
|
+
class ParseResponseErrorError extends Error {
|
|
1186
|
+
constructor(body) {
|
|
1187
|
+
super(
|
|
1188
|
+
`PARSE_RESPONSE_ERROR: ${body.message}`
|
|
1189
|
+
);
|
|
1190
|
+
this.body = body;
|
|
1191
|
+
this.name = "ParseResponseErrorError";
|
|
1192
|
+
}
|
|
1193
|
+
static code = "PARSE_RESPONSE_ERROR";
|
|
1194
|
+
static statusCode = 500;
|
|
1195
|
+
static description = `Failed to parse response from Git server: {message}`;
|
|
1196
|
+
}
|
|
1197
|
+
class RepositoryAccessDeniedError extends Error {
|
|
1198
|
+
constructor(body) {
|
|
1199
|
+
super(
|
|
1200
|
+
`REPOSITORY_ACCESS_DENIED: ${body.message}`
|
|
1201
|
+
);
|
|
1202
|
+
this.body = body;
|
|
1203
|
+
this.name = "RepositoryAccessDeniedError";
|
|
1204
|
+
}
|
|
1205
|
+
static code = "REPOSITORY_ACCESS_DENIED";
|
|
1206
|
+
static statusCode = 403;
|
|
1207
|
+
static description = `Repository does not belong to account`;
|
|
1208
|
+
}
|
|
1209
|
+
class GitHubSyncFailedError extends Error {
|
|
1210
|
+
constructor(body) {
|
|
1211
|
+
super(
|
|
1212
|
+
`GIT_HUB_SYNC_FAILED: ${body.message}`
|
|
1213
|
+
);
|
|
1214
|
+
this.body = body;
|
|
1215
|
+
this.name = "GitHubSyncFailedError";
|
|
1216
|
+
}
|
|
1217
|
+
static code = "GIT_HUB_SYNC_FAILED";
|
|
1218
|
+
static statusCode = 500;
|
|
1219
|
+
static description = `Failed to configure GitHub sync: {message}`;
|
|
1220
|
+
}
|
|
1221
|
+
class UpdateDefaultBranchFailedError extends Error {
|
|
1222
|
+
constructor(body) {
|
|
1223
|
+
super(
|
|
1224
|
+
`UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
|
|
1225
|
+
);
|
|
1226
|
+
this.body = body;
|
|
1227
|
+
this.name = "UpdateDefaultBranchFailedError";
|
|
1228
|
+
}
|
|
1229
|
+
static code = "UPDATE_DEFAULT_BRANCH_FAILED";
|
|
1230
|
+
static statusCode = 500;
|
|
1231
|
+
static description = `Failed to update default branch: {message}`;
|
|
1232
|
+
}
|
|
1233
|
+
class GetRepositoryInfoFailedError extends Error {
|
|
1234
|
+
constructor(body) {
|
|
1235
|
+
super(
|
|
1236
|
+
`GET_REPOSITORY_INFO_FAILED: ${body.message}`
|
|
1237
|
+
);
|
|
1238
|
+
this.body = body;
|
|
1239
|
+
this.name = "GetRepositoryInfoFailedError";
|
|
1240
|
+
}
|
|
1241
|
+
static code = "GET_REPOSITORY_INFO_FAILED";
|
|
1242
|
+
static statusCode = 500;
|
|
1243
|
+
static description = `Failed to get repository info: {message}`;
|
|
1244
|
+
}
|
|
1245
|
+
class ListRepositoriesFailedError extends Error {
|
|
1246
|
+
constructor(body) {
|
|
1247
|
+
super(
|
|
1248
|
+
`LIST_REPOSITORIES_FAILED: ${body.message}`
|
|
1249
|
+
);
|
|
1250
|
+
this.body = body;
|
|
1251
|
+
this.name = "ListRepositoriesFailedError";
|
|
1252
|
+
}
|
|
1253
|
+
static code = "LIST_REPOSITORIES_FAILED";
|
|
1254
|
+
static statusCode = 500;
|
|
1255
|
+
static description = `Failed to list repositories: {message}`;
|
|
1256
|
+
}
|
|
1257
|
+
class DeleteRepositoryFailedError extends Error {
|
|
1258
|
+
constructor(body) {
|
|
1259
|
+
super(
|
|
1260
|
+
`DELETE_REPOSITORY_FAILED: ${body.message}`
|
|
1261
|
+
);
|
|
1262
|
+
this.body = body;
|
|
1263
|
+
this.name = "DeleteRepositoryFailedError";
|
|
1264
|
+
}
|
|
1265
|
+
static code = "DELETE_REPOSITORY_FAILED";
|
|
1266
|
+
static statusCode = 500;
|
|
1267
|
+
static description = `Failed to delete repository: {message}`;
|
|
1268
|
+
}
|
|
1269
|
+
class CreateRepositoryFailedError extends Error {
|
|
1270
|
+
constructor(body) {
|
|
1271
|
+
super(
|
|
1272
|
+
`CREATE_REPOSITORY_FAILED: ${body.message}`
|
|
1273
|
+
);
|
|
1274
|
+
this.body = body;
|
|
1275
|
+
this.name = "CreateRepositoryFailedError";
|
|
1276
|
+
}
|
|
1277
|
+
static code = "CREATE_REPOSITORY_FAILED";
|
|
1278
|
+
static statusCode = 500;
|
|
1279
|
+
static description = `Failed to create repository: {message}`;
|
|
1280
|
+
}
|
|
1281
|
+
class SerializationErrorError extends Error {
|
|
1282
|
+
constructor(body) {
|
|
1283
|
+
super(
|
|
1284
|
+
`SERIALIZATION_ERROR: ${body.message}`
|
|
1285
|
+
);
|
|
1286
|
+
this.body = body;
|
|
1287
|
+
this.name = "SerializationErrorError";
|
|
1288
|
+
}
|
|
1289
|
+
static code = "SERIALIZATION_ERROR";
|
|
1290
|
+
static statusCode = 400;
|
|
1291
|
+
static description = `Failed to serialize request: {message}`;
|
|
1292
|
+
}
|
|
1293
|
+
class GitInvalidRequestError extends Error {
|
|
1294
|
+
constructor(body) {
|
|
1295
|
+
super(
|
|
1296
|
+
`GIT_INVALID_REQUEST: ${body.message}`
|
|
1297
|
+
);
|
|
1298
|
+
this.body = body;
|
|
1299
|
+
this.name = "GitInvalidRequestError";
|
|
1300
|
+
}
|
|
1301
|
+
static code = "GIT_INVALID_REQUEST";
|
|
1302
|
+
static statusCode = 400;
|
|
1303
|
+
static description = `Invalid request: {message}`;
|
|
1304
|
+
}
|
|
1305
|
+
class RepositoryNotFoundError extends Error {
|
|
1306
|
+
constructor(body) {
|
|
1307
|
+
super(
|
|
1308
|
+
`REPOSITORY_NOT_FOUND: ${body.message}`
|
|
1309
|
+
);
|
|
1310
|
+
this.body = body;
|
|
1311
|
+
this.name = "RepositoryNotFoundError";
|
|
1312
|
+
}
|
|
1313
|
+
static code = "REPOSITORY_NOT_FOUND";
|
|
1314
|
+
static statusCode = 404;
|
|
1315
|
+
static description = `Repository not found: {repo_id}`;
|
|
1316
|
+
}
|
|
1317
|
+
class FailedToProvisionCertificateError extends Error {
|
|
1318
|
+
constructor(body) {
|
|
1319
|
+
super(
|
|
1320
|
+
`FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
|
|
1321
|
+
);
|
|
1322
|
+
this.body = body;
|
|
1323
|
+
this.name = "FailedToProvisionCertificateError";
|
|
1324
|
+
}
|
|
1325
|
+
static code = "FAILED_TO_PROVISION_CERTIFICATE";
|
|
1326
|
+
static statusCode = 422;
|
|
1327
|
+
static description = `Failed to provision certificate: {message}`;
|
|
1328
|
+
}
|
|
1329
|
+
class FailedToInsertDomainMappingError extends Error {
|
|
1330
|
+
constructor(body) {
|
|
1331
|
+
super(
|
|
1332
|
+
`FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
|
|
1333
|
+
);
|
|
1334
|
+
this.body = body;
|
|
1335
|
+
this.name = "FailedToInsertDomainMappingError";
|
|
1336
|
+
}
|
|
1337
|
+
static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
|
|
1338
|
+
static statusCode = 500;
|
|
1339
|
+
static description = `Failed to insert domain mapping: {message}`;
|
|
1340
|
+
}
|
|
1341
|
+
class PermissionDeniedError extends Error {
|
|
1342
|
+
constructor(body) {
|
|
1343
|
+
super(
|
|
1344
|
+
`PERMISSION_DENIED: ${body.message}`
|
|
1345
|
+
);
|
|
1346
|
+
this.body = body;
|
|
1347
|
+
this.name = "PermissionDeniedError";
|
|
1348
|
+
}
|
|
1349
|
+
static code = "PERMISSION_DENIED";
|
|
1350
|
+
static statusCode = 401;
|
|
1351
|
+
static description = `Permission denied: {message}`;
|
|
1352
|
+
}
|
|
1353
|
+
class FailedToCheckPermissionsError extends Error {
|
|
1354
|
+
constructor(body) {
|
|
1355
|
+
super(
|
|
1356
|
+
`FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
|
|
1357
|
+
);
|
|
1358
|
+
this.body = body;
|
|
1359
|
+
this.name = "FailedToCheckPermissionsError";
|
|
1360
|
+
}
|
|
1361
|
+
static code = "FAILED_TO_CHECK_PERMISSIONS";
|
|
1362
|
+
static statusCode = 502;
|
|
1363
|
+
static description = `Failed to check permissions: {message}`;
|
|
1364
|
+
}
|
|
1365
|
+
class FailedToListDomainsError extends Error {
|
|
1366
|
+
constructor(body) {
|
|
1367
|
+
super(
|
|
1368
|
+
`FAILED_TO_LIST_DOMAINS: ${body.message}`
|
|
1369
|
+
);
|
|
1370
|
+
this.body = body;
|
|
1371
|
+
this.name = "FailedToListDomainsError";
|
|
1372
|
+
}
|
|
1373
|
+
static code = "FAILED_TO_LIST_DOMAINS";
|
|
1374
|
+
static statusCode = 500;
|
|
1375
|
+
static description = `Failed to list domains: {message}`;
|
|
1376
|
+
}
|
|
1377
|
+
class FailedToListVerificationsError extends Error {
|
|
1378
|
+
constructor(body) {
|
|
1379
|
+
super(
|
|
1380
|
+
`FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
|
|
1381
|
+
);
|
|
1382
|
+
this.body = body;
|
|
1383
|
+
this.name = "FailedToListVerificationsError";
|
|
1384
|
+
}
|
|
1385
|
+
static code = "FAILED_TO_LIST_VERIFICATIONS";
|
|
1386
|
+
static statusCode = 500;
|
|
1387
|
+
static description = `Failed to list verifications: {message}`;
|
|
1388
|
+
}
|
|
1389
|
+
class FailedToVerifyDomainError extends Error {
|
|
1390
|
+
constructor(body) {
|
|
1391
|
+
super(
|
|
1392
|
+
`FAILED_TO_VERIFY_DOMAIN: ${body.message}`
|
|
1393
|
+
);
|
|
1394
|
+
this.body = body;
|
|
1395
|
+
this.name = "FailedToVerifyDomainError";
|
|
1396
|
+
}
|
|
1397
|
+
static code = "FAILED_TO_VERIFY_DOMAIN";
|
|
1398
|
+
static statusCode = 500;
|
|
1399
|
+
static description = `Failed to verify domain: {message}`;
|
|
1400
|
+
}
|
|
1401
|
+
class VerificationFailedError extends Error {
|
|
1402
|
+
constructor(body) {
|
|
1403
|
+
super(
|
|
1404
|
+
`VERIFICATION_FAILED: ${body.message}`
|
|
1405
|
+
);
|
|
1406
|
+
this.body = body;
|
|
1407
|
+
this.name = "VerificationFailedError";
|
|
1408
|
+
}
|
|
1409
|
+
static code = "VERIFICATION_FAILED";
|
|
1410
|
+
static statusCode = 400;
|
|
1411
|
+
static description = `Domain verification failed: {message}`;
|
|
1412
|
+
}
|
|
1413
|
+
class FailedToDeleteVerificationError extends Error {
|
|
1414
|
+
constructor(body) {
|
|
1415
|
+
super(
|
|
1416
|
+
`FAILED_TO_DELETE_VERIFICATION: ${body.message}`
|
|
1417
|
+
);
|
|
1418
|
+
this.body = body;
|
|
1419
|
+
this.name = "FailedToDeleteVerificationError";
|
|
1420
|
+
}
|
|
1421
|
+
static code = "FAILED_TO_DELETE_VERIFICATION";
|
|
1422
|
+
static statusCode = 400;
|
|
1423
|
+
static description = `Failed to delete verification: {message}`;
|
|
1424
|
+
}
|
|
1425
|
+
class VerificationNotFoundError extends Error {
|
|
1426
|
+
constructor(body) {
|
|
1427
|
+
super(
|
|
1428
|
+
`VERIFICATION_NOT_FOUND: ${body.message}`
|
|
1429
|
+
);
|
|
1430
|
+
this.body = body;
|
|
1431
|
+
this.name = "VerificationNotFoundError";
|
|
1432
|
+
}
|
|
1433
|
+
static code = "VERIFICATION_NOT_FOUND";
|
|
1434
|
+
static statusCode = 404;
|
|
1435
|
+
static description = `Verification request not found for domain: {domain}`;
|
|
1436
|
+
}
|
|
1437
|
+
class FailedToCreateVerificationCodeError extends Error {
|
|
1438
|
+
constructor(body) {
|
|
1439
|
+
super(
|
|
1440
|
+
`FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
|
|
1441
|
+
);
|
|
1442
|
+
this.body = body;
|
|
1443
|
+
this.name = "FailedToCreateVerificationCodeError";
|
|
1444
|
+
}
|
|
1445
|
+
static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
|
|
1446
|
+
static statusCode = 400;
|
|
1447
|
+
static description = `Failed to create verification code: {message}`;
|
|
1448
|
+
}
|
|
1449
|
+
class InvalidDomainError extends Error {
|
|
1450
|
+
constructor(body) {
|
|
1451
|
+
super(
|
|
1452
|
+
`INVALID_DOMAIN: ${body.message}`
|
|
1453
|
+
);
|
|
1454
|
+
this.body = body;
|
|
1455
|
+
this.name = "InvalidDomainError";
|
|
1456
|
+
}
|
|
1457
|
+
static code = "INVALID_DOMAIN";
|
|
1458
|
+
static statusCode = 400;
|
|
1459
|
+
static description = `Invalid domain: {domain}`;
|
|
1460
|
+
}
|
|
1461
|
+
class DomainAlreadyExistsError extends Error {
|
|
1462
|
+
constructor(body) {
|
|
1463
|
+
super(
|
|
1464
|
+
`DOMAIN_ALREADY_EXISTS: ${body.message}`
|
|
1465
|
+
);
|
|
1466
|
+
this.body = body;
|
|
1467
|
+
this.name = "DomainAlreadyExistsError";
|
|
1468
|
+
}
|
|
1469
|
+
static code = "DOMAIN_ALREADY_EXISTS";
|
|
1470
|
+
static statusCode = 400;
|
|
1471
|
+
static description = `Domain already exists: {domain}`;
|
|
1472
|
+
}
|
|
1473
|
+
class FailedToInsertOwnershipError extends Error {
|
|
1474
|
+
constructor(body) {
|
|
1475
|
+
super(
|
|
1476
|
+
`FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
|
|
1477
|
+
);
|
|
1478
|
+
this.body = body;
|
|
1479
|
+
this.name = "FailedToInsertOwnershipError";
|
|
1480
|
+
}
|
|
1481
|
+
static code = "FAILED_TO_INSERT_OWNERSHIP";
|
|
1482
|
+
static statusCode = 500;
|
|
1483
|
+
static description = `Failed to insert domain ownership: {message}`;
|
|
1484
|
+
}
|
|
1485
|
+
class FailedRemoveDomainMappingError extends Error {
|
|
1486
|
+
constructor(body) {
|
|
1487
|
+
super(
|
|
1488
|
+
`FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
|
|
1489
|
+
);
|
|
1490
|
+
this.body = body;
|
|
1491
|
+
this.name = "FailedRemoveDomainMappingError";
|
|
1492
|
+
}
|
|
1493
|
+
static code = "FAILED_REMOVE_DOMAIN_MAPPING";
|
|
1494
|
+
static statusCode = 500;
|
|
1495
|
+
static description = `Failed to remove domain mapping: {message}`;
|
|
1496
|
+
}
|
|
1497
|
+
class FailedPermissionsCheckError extends Error {
|
|
1498
|
+
constructor(body) {
|
|
1499
|
+
super(
|
|
1500
|
+
`FAILED_PERMISSIONS_CHECK: ${body.message}`
|
|
1501
|
+
);
|
|
1502
|
+
this.body = body;
|
|
1503
|
+
this.name = "FailedPermissionsCheckError";
|
|
1504
|
+
}
|
|
1505
|
+
static code = "FAILED_PERMISSIONS_CHECK";
|
|
1506
|
+
static statusCode = 401;
|
|
1507
|
+
static description = `You do not have permission to delete the domain mapping for: {domain}`;
|
|
1508
|
+
}
|
|
1509
|
+
class FailedToCheckDomainMappingPermissionsError extends Error {
|
|
1510
|
+
constructor(body) {
|
|
1511
|
+
super(
|
|
1512
|
+
`FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
|
|
1513
|
+
);
|
|
1514
|
+
this.body = body;
|
|
1515
|
+
this.name = "FailedToCheckDomainMappingPermissionsError";
|
|
1516
|
+
}
|
|
1517
|
+
static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
|
|
1518
|
+
static statusCode = 502;
|
|
1519
|
+
static description = `Failed to check permissions: {message}`;
|
|
1520
|
+
}
|
|
1521
|
+
class AnyhowError extends Error {
|
|
1522
|
+
constructor(body) {
|
|
1523
|
+
super(
|
|
1524
|
+
`ANYHOW: ${body.message}`
|
|
1525
|
+
);
|
|
1526
|
+
this.body = body;
|
|
1527
|
+
this.name = "AnyhowError";
|
|
1528
|
+
}
|
|
1529
|
+
static code = "ANYHOW";
|
|
1530
|
+
static statusCode = 500;
|
|
1531
|
+
static description = `null`;
|
|
1532
|
+
}
|
|
1533
|
+
class ObservabilityDatabaseErrorError extends Error {
|
|
1534
|
+
constructor(body) {
|
|
1535
|
+
super(
|
|
1536
|
+
`OBSERVABILITY_DATABASE_ERROR: ${body.message}`
|
|
1537
|
+
);
|
|
1538
|
+
this.body = body;
|
|
1539
|
+
this.name = "ObservabilityDatabaseErrorError";
|
|
1540
|
+
}
|
|
1541
|
+
static code = "OBSERVABILITY_DATABASE_ERROR";
|
|
1542
|
+
static statusCode = 500;
|
|
1543
|
+
static description = `Database operation failed: {message}`;
|
|
1544
|
+
}
|
|
1545
|
+
class ObservabilityAccessDeniedError extends Error {
|
|
1546
|
+
constructor(body) {
|
|
1547
|
+
super(
|
|
1548
|
+
`OBSERVABILITY_ACCESS_DENIED: ${body.message}`
|
|
1549
|
+
);
|
|
1550
|
+
this.body = body;
|
|
1551
|
+
this.name = "ObservabilityAccessDeniedError";
|
|
1552
|
+
}
|
|
1553
|
+
static code = "OBSERVABILITY_ACCESS_DENIED";
|
|
1554
|
+
static statusCode = 403;
|
|
1555
|
+
static description = `Access denied to logs for deployment: {deployment_id}`;
|
|
1556
|
+
}
|
|
1557
|
+
class ParseLogsFailedError extends Error {
|
|
1558
|
+
constructor(body) {
|
|
1559
|
+
super(
|
|
1560
|
+
`PARSE_LOGS_FAILED: ${body.message}`
|
|
1561
|
+
);
|
|
1562
|
+
this.body = body;
|
|
1563
|
+
this.name = "ParseLogsFailedError";
|
|
1564
|
+
}
|
|
1565
|
+
static code = "PARSE_LOGS_FAILED";
|
|
1566
|
+
static statusCode = 500;
|
|
1567
|
+
static description = `Failed to parse logs: {message}`;
|
|
1568
|
+
}
|
|
1569
|
+
class RetrieveLogsFailedError extends Error {
|
|
1570
|
+
constructor(body) {
|
|
1571
|
+
super(
|
|
1572
|
+
`RETRIEVE_LOGS_FAILED: ${body.message}`
|
|
1573
|
+
);
|
|
1574
|
+
this.body = body;
|
|
1575
|
+
this.name = "RetrieveLogsFailedError";
|
|
1576
|
+
}
|
|
1577
|
+
static code = "RETRIEVE_LOGS_FAILED";
|
|
1578
|
+
static statusCode = 500;
|
|
1579
|
+
static description = `Failed to retrieve logs: {message}`;
|
|
1580
|
+
}
|
|
1581
|
+
class InvalidQueryError extends Error {
|
|
1582
|
+
constructor(body) {
|
|
1583
|
+
super(
|
|
1584
|
+
`INVALID_QUERY: ${body.message}`
|
|
1585
|
+
);
|
|
1586
|
+
this.body = body;
|
|
1587
|
+
this.name = "InvalidQueryError";
|
|
1588
|
+
}
|
|
1589
|
+
static code = "INVALID_QUERY";
|
|
1590
|
+
static statusCode = 400;
|
|
1591
|
+
static description = `Invalid log query: {message}`;
|
|
1592
|
+
}
|
|
1593
|
+
class LogsNotFoundError extends Error {
|
|
1594
|
+
constructor(body) {
|
|
1595
|
+
super(
|
|
1596
|
+
`LOGS_NOT_FOUND: ${body.message}`
|
|
1597
|
+
);
|
|
1598
|
+
this.body = body;
|
|
1599
|
+
this.name = "LogsNotFoundError";
|
|
1600
|
+
}
|
|
1601
|
+
static code = "LOGS_NOT_FOUND";
|
|
1602
|
+
static statusCode = 404;
|
|
1603
|
+
static description = `Logs not found for deployment: {deployment_id}`;
|
|
1604
|
+
}
|
|
1605
|
+
class PermissionAlreadyExistsError extends Error {
|
|
1606
|
+
constructor(body) {
|
|
1607
|
+
super(
|
|
1608
|
+
`PERMISSION_ALREADY_EXISTS: ${body.message}`
|
|
1609
|
+
);
|
|
1610
|
+
this.body = body;
|
|
1611
|
+
this.name = "PermissionAlreadyExistsError";
|
|
1612
|
+
}
|
|
1613
|
+
static code = "PERMISSION_ALREADY_EXISTS";
|
|
1614
|
+
static statusCode = 409;
|
|
1615
|
+
static description = `Permission already exists`;
|
|
1616
|
+
}
|
|
1617
|
+
class ListTokensFailedError extends Error {
|
|
1618
|
+
constructor(body) {
|
|
1619
|
+
super(
|
|
1620
|
+
`LIST_TOKENS_FAILED: ${body.message}`
|
|
1621
|
+
);
|
|
1622
|
+
this.body = body;
|
|
1623
|
+
this.name = "ListTokensFailedError";
|
|
1624
|
+
}
|
|
1625
|
+
static code = "LIST_TOKENS_FAILED";
|
|
1626
|
+
static statusCode = 500;
|
|
1627
|
+
static description = `Failed to list tokens: {message}`;
|
|
1628
|
+
}
|
|
1629
|
+
class RevokeTokenFailedError extends Error {
|
|
1630
|
+
constructor(body) {
|
|
1631
|
+
super(
|
|
1632
|
+
`REVOKE_TOKEN_FAILED: ${body.message}`
|
|
1633
|
+
);
|
|
1634
|
+
this.body = body;
|
|
1635
|
+
this.name = "RevokeTokenFailedError";
|
|
1636
|
+
}
|
|
1637
|
+
static code = "REVOKE_TOKEN_FAILED";
|
|
1638
|
+
static statusCode = 500;
|
|
1639
|
+
static description = `Failed to revoke token: {message}`;
|
|
1640
|
+
}
|
|
1641
|
+
class CreateTokenFailedError extends Error {
|
|
1642
|
+
constructor(body) {
|
|
1643
|
+
super(
|
|
1644
|
+
`CREATE_TOKEN_FAILED: ${body.message}`
|
|
1645
|
+
);
|
|
1646
|
+
this.body = body;
|
|
1647
|
+
this.name = "CreateTokenFailedError";
|
|
1648
|
+
}
|
|
1649
|
+
static code = "CREATE_TOKEN_FAILED";
|
|
1650
|
+
static statusCode = 500;
|
|
1651
|
+
static description = `Failed to create token: {message}`;
|
|
1652
|
+
}
|
|
1653
|
+
class ListPermissionsFailedError extends Error {
|
|
1654
|
+
constructor(body) {
|
|
1655
|
+
super(
|
|
1656
|
+
`LIST_PERMISSIONS_FAILED: ${body.message}`
|
|
1657
|
+
);
|
|
1658
|
+
this.body = body;
|
|
1659
|
+
this.name = "ListPermissionsFailedError";
|
|
1660
|
+
}
|
|
1661
|
+
static code = "LIST_PERMISSIONS_FAILED";
|
|
1662
|
+
static statusCode = 500;
|
|
1663
|
+
static description = `Failed to list permissions: {message}`;
|
|
1664
|
+
}
|
|
1665
|
+
class GetPermissionFailedError extends Error {
|
|
1666
|
+
constructor(body) {
|
|
1667
|
+
super(
|
|
1668
|
+
`GET_PERMISSION_FAILED: ${body.message}`
|
|
1669
|
+
);
|
|
1670
|
+
this.body = body;
|
|
1671
|
+
this.name = "GetPermissionFailedError";
|
|
1672
|
+
}
|
|
1673
|
+
static code = "GET_PERMISSION_FAILED";
|
|
1674
|
+
static statusCode = 500;
|
|
1675
|
+
static description = `Failed to get permission: {message}`;
|
|
1676
|
+
}
|
|
1677
|
+
class UpdatePermissionFailedError extends Error {
|
|
1678
|
+
constructor(body) {
|
|
1679
|
+
super(
|
|
1680
|
+
`UPDATE_PERMISSION_FAILED: ${body.message}`
|
|
1681
|
+
);
|
|
1682
|
+
this.body = body;
|
|
1683
|
+
this.name = "UpdatePermissionFailedError";
|
|
1684
|
+
}
|
|
1685
|
+
static code = "UPDATE_PERMISSION_FAILED";
|
|
1686
|
+
static statusCode = 500;
|
|
1687
|
+
static description = `Failed to update permission: {message}`;
|
|
1688
|
+
}
|
|
1689
|
+
class RevokePermissionFailedError extends Error {
|
|
1690
|
+
constructor(body) {
|
|
1691
|
+
super(
|
|
1692
|
+
`REVOKE_PERMISSION_FAILED: ${body.message}`
|
|
1693
|
+
);
|
|
1694
|
+
this.body = body;
|
|
1695
|
+
this.name = "RevokePermissionFailedError";
|
|
1696
|
+
}
|
|
1697
|
+
static code = "REVOKE_PERMISSION_FAILED";
|
|
1698
|
+
static statusCode = 500;
|
|
1699
|
+
static description = `Failed to revoke permission: {message}`;
|
|
1700
|
+
}
|
|
1701
|
+
class GrantPermissionFailedError extends Error {
|
|
1702
|
+
constructor(body) {
|
|
1703
|
+
super(
|
|
1704
|
+
`GRANT_PERMISSION_FAILED: ${body.message}`
|
|
1705
|
+
);
|
|
1706
|
+
this.body = body;
|
|
1707
|
+
this.name = "GrantPermissionFailedError";
|
|
1708
|
+
}
|
|
1709
|
+
static code = "GRANT_PERMISSION_FAILED";
|
|
1710
|
+
static statusCode = 500;
|
|
1711
|
+
static description = `Failed to grant permission: {message}`;
|
|
1712
|
+
}
|
|
1713
|
+
class ListIdentitiesFailedError extends Error {
|
|
1714
|
+
constructor(body) {
|
|
1715
|
+
super(
|
|
1716
|
+
`LIST_IDENTITIES_FAILED: ${body.message}`
|
|
1717
|
+
);
|
|
1718
|
+
this.body = body;
|
|
1719
|
+
this.name = "ListIdentitiesFailedError";
|
|
1720
|
+
}
|
|
1721
|
+
static code = "LIST_IDENTITIES_FAILED";
|
|
1722
|
+
static statusCode = 500;
|
|
1723
|
+
static description = `Failed to list identities: {message}`;
|
|
1724
|
+
}
|
|
1725
|
+
class DeleteIdentityFailedError extends Error {
|
|
1726
|
+
constructor(body) {
|
|
1727
|
+
super(
|
|
1728
|
+
`DELETE_IDENTITY_FAILED: ${body.message}`
|
|
1729
|
+
);
|
|
1730
|
+
this.body = body;
|
|
1731
|
+
this.name = "DeleteIdentityFailedError";
|
|
1732
|
+
}
|
|
1733
|
+
static code = "DELETE_IDENTITY_FAILED";
|
|
1734
|
+
static statusCode = 500;
|
|
1735
|
+
static description = `Failed to delete identity: {message}`;
|
|
1736
|
+
}
|
|
1737
|
+
class CreateIdentityFailedError extends Error {
|
|
1738
|
+
constructor(body) {
|
|
1739
|
+
super(
|
|
1740
|
+
`CREATE_IDENTITY_FAILED: ${body.message}`
|
|
1741
|
+
);
|
|
1742
|
+
this.body = body;
|
|
1743
|
+
this.name = "CreateIdentityFailedError";
|
|
1744
|
+
}
|
|
1745
|
+
static code = "CREATE_IDENTITY_FAILED";
|
|
1746
|
+
static statusCode = 500;
|
|
1747
|
+
static description = `Failed to create identity: {message}`;
|
|
1748
|
+
}
|
|
1749
|
+
class VmPermissionNotFoundError extends Error {
|
|
1750
|
+
constructor(body) {
|
|
1751
|
+
super(
|
|
1752
|
+
`VM_PERMISSION_NOT_FOUND: ${body.message}`
|
|
1753
|
+
);
|
|
1754
|
+
this.body = body;
|
|
1755
|
+
this.name = "VmPermissionNotFoundError";
|
|
1756
|
+
}
|
|
1757
|
+
static code = "VM_PERMISSION_NOT_FOUND";
|
|
1758
|
+
static statusCode = 404;
|
|
1759
|
+
static description = `VM permission not found`;
|
|
1760
|
+
}
|
|
1761
|
+
class PermissionNotFoundError extends Error {
|
|
1762
|
+
constructor(body) {
|
|
1763
|
+
super(
|
|
1764
|
+
`PERMISSION_NOT_FOUND: ${body.message}`
|
|
1765
|
+
);
|
|
1766
|
+
this.body = body;
|
|
1767
|
+
this.name = "PermissionNotFoundError";
|
|
1768
|
+
}
|
|
1769
|
+
static code = "PERMISSION_NOT_FOUND";
|
|
1770
|
+
static statusCode = 404;
|
|
1771
|
+
static description = `Permission not found`;
|
|
1772
|
+
}
|
|
1773
|
+
class VmAccessDeniedError extends Error {
|
|
1774
|
+
constructor(body) {
|
|
1775
|
+
super(
|
|
1776
|
+
`VM_ACCESS_DENIED: ${body.message}`
|
|
1777
|
+
);
|
|
1778
|
+
this.body = body;
|
|
1779
|
+
this.name = "VmAccessDeniedError";
|
|
1780
|
+
}
|
|
1781
|
+
static code = "VM_ACCESS_DENIED";
|
|
1782
|
+
static statusCode = 403;
|
|
1783
|
+
static description = `You are not allowed to access this VM`;
|
|
1784
|
+
}
|
|
1785
|
+
class GitRepositoryAccessDeniedError extends Error {
|
|
1786
|
+
constructor(body) {
|
|
1787
|
+
super(
|
|
1788
|
+
`GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
|
|
1789
|
+
);
|
|
1790
|
+
this.body = body;
|
|
1791
|
+
this.name = "GitRepositoryAccessDeniedError";
|
|
1792
|
+
}
|
|
1793
|
+
static code = "GIT_REPOSITORY_ACCESS_DENIED";
|
|
1794
|
+
static statusCode = 403;
|
|
1795
|
+
static description = `You are not allowed to access this repository`;
|
|
1796
|
+
}
|
|
1797
|
+
class GitRepositoryNotFoundError extends Error {
|
|
1798
|
+
constructor(body) {
|
|
1799
|
+
super(
|
|
1800
|
+
`GIT_REPOSITORY_NOT_FOUND: ${body.message}`
|
|
1801
|
+
);
|
|
1802
|
+
this.body = body;
|
|
1803
|
+
this.name = "GitRepositoryNotFoundError";
|
|
1804
|
+
}
|
|
1805
|
+
static code = "GIT_REPOSITORY_NOT_FOUND";
|
|
1806
|
+
static statusCode = 404;
|
|
1807
|
+
static description = `Repository not found`;
|
|
1808
|
+
}
|
|
1809
|
+
class CannotDeleteManagedIdentityError extends Error {
|
|
1810
|
+
constructor(body) {
|
|
1811
|
+
super(
|
|
1812
|
+
`CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
|
|
1813
|
+
);
|
|
1814
|
+
this.body = body;
|
|
1815
|
+
this.name = "CannotDeleteManagedIdentityError";
|
|
1816
|
+
}
|
|
1817
|
+
static code = "CANNOT_DELETE_MANAGED_IDENTITY";
|
|
1818
|
+
static statusCode = 403;
|
|
1819
|
+
static description = `Cannot delete managed identities`;
|
|
1820
|
+
}
|
|
1821
|
+
class CannotModifyManagedIdentityError extends Error {
|
|
1822
|
+
constructor(body) {
|
|
1823
|
+
super(
|
|
1824
|
+
`CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
|
|
1825
|
+
);
|
|
1826
|
+
this.body = body;
|
|
1827
|
+
this.name = "CannotModifyManagedIdentityError";
|
|
1828
|
+
}
|
|
1829
|
+
static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
|
|
1830
|
+
static statusCode = 403;
|
|
1831
|
+
static description = `Cannot modify managed identities`;
|
|
1832
|
+
}
|
|
1833
|
+
class IdentityAccessDeniedError extends Error {
|
|
1834
|
+
constructor(body) {
|
|
1835
|
+
super(
|
|
1836
|
+
`IDENTITY_ACCESS_DENIED: ${body.message}`
|
|
1837
|
+
);
|
|
1838
|
+
this.body = body;
|
|
1839
|
+
this.name = "IdentityAccessDeniedError";
|
|
1840
|
+
}
|
|
1841
|
+
static code = "IDENTITY_ACCESS_DENIED";
|
|
1842
|
+
static statusCode = 403;
|
|
1843
|
+
static description = `You are not allowed to access this identity`;
|
|
1844
|
+
}
|
|
1845
|
+
class IdentityNotFoundError extends Error {
|
|
1846
|
+
constructor(body) {
|
|
1847
|
+
super(
|
|
1848
|
+
`IDENTITY_NOT_FOUND: ${body.message}`
|
|
1849
|
+
);
|
|
1850
|
+
this.body = body;
|
|
1851
|
+
this.name = "IdentityNotFoundError";
|
|
1852
|
+
}
|
|
1853
|
+
static code = "IDENTITY_NOT_FOUND";
|
|
1854
|
+
static statusCode = 404;
|
|
1855
|
+
static description = `Identity not found`;
|
|
1856
|
+
}
|
|
1857
|
+
class ExecuteInternalErrorError extends Error {
|
|
1858
|
+
constructor(body) {
|
|
1859
|
+
super(
|
|
1860
|
+
`EXECUTE_INTERNAL_ERROR: ${body.message}`
|
|
1861
|
+
);
|
|
1862
|
+
this.body = body;
|
|
1863
|
+
this.name = "ExecuteInternalErrorError";
|
|
1864
|
+
}
|
|
1865
|
+
static code = "EXECUTE_INTERNAL_ERROR";
|
|
1866
|
+
static statusCode = 500;
|
|
1867
|
+
static description = `Internal error: {message}`;
|
|
1868
|
+
}
|
|
1869
|
+
class ExecuteAccessDeniedError extends Error {
|
|
1870
|
+
constructor(body) {
|
|
1871
|
+
super(
|
|
1872
|
+
`EXECUTE_ACCESS_DENIED: ${body.message}`
|
|
1873
|
+
);
|
|
1874
|
+
this.body = body;
|
|
1875
|
+
this.name = "ExecuteAccessDeniedError";
|
|
1876
|
+
}
|
|
1877
|
+
static code = "EXECUTE_ACCESS_DENIED";
|
|
1878
|
+
static statusCode = 403;
|
|
1879
|
+
static description = `Access denied to execute run`;
|
|
1880
|
+
}
|
|
1881
|
+
class ListRunsFailedError extends Error {
|
|
1882
|
+
constructor(body) {
|
|
1883
|
+
super(
|
|
1884
|
+
`LIST_RUNS_FAILED: ${body.message}`
|
|
1885
|
+
);
|
|
1886
|
+
this.body = body;
|
|
1887
|
+
this.name = "ListRunsFailedError";
|
|
1888
|
+
}
|
|
1889
|
+
static code = "LIST_RUNS_FAILED";
|
|
1890
|
+
static statusCode = 500;
|
|
1891
|
+
static description = `Failed to list execute runs: {message}`;
|
|
1892
|
+
}
|
|
1893
|
+
class ExecutionErrorError extends Error {
|
|
1894
|
+
constructor(body) {
|
|
1895
|
+
super(
|
|
1896
|
+
`EXECUTION_ERROR: ${body.message}`
|
|
1897
|
+
);
|
|
1898
|
+
this.body = body;
|
|
1899
|
+
this.name = "ExecutionErrorError";
|
|
1900
|
+
}
|
|
1901
|
+
static code = "EXECUTION_ERROR";
|
|
1902
|
+
static statusCode = 500;
|
|
1903
|
+
static description = `Script execution error: {message}`;
|
|
1904
|
+
}
|
|
1905
|
+
class ConnectionFailedError extends Error {
|
|
1906
|
+
constructor(body) {
|
|
1907
|
+
super(
|
|
1908
|
+
`CONNECTION_FAILED: ${body.message}`
|
|
1909
|
+
);
|
|
1910
|
+
this.body = body;
|
|
1911
|
+
this.name = "ConnectionFailedError";
|
|
1912
|
+
}
|
|
1913
|
+
static code = "CONNECTION_FAILED";
|
|
1914
|
+
static statusCode = 500;
|
|
1915
|
+
static description = `Failed to connect to execute server: {message}`;
|
|
1916
|
+
}
|
|
1917
|
+
class MetadataWriteFailedError extends Error {
|
|
1918
|
+
constructor(body) {
|
|
1919
|
+
super(
|
|
1920
|
+
`METADATA_WRITE_FAILED: ${body.message}`
|
|
1921
|
+
);
|
|
1922
|
+
this.body = body;
|
|
1923
|
+
this.name = "MetadataWriteFailedError";
|
|
1924
|
+
}
|
|
1925
|
+
static code = "METADATA_WRITE_FAILED";
|
|
1926
|
+
static statusCode = 500;
|
|
1927
|
+
static description = `Failed to write metadata file: {message}`;
|
|
1928
|
+
}
|
|
1929
|
+
class NodeModulesInstallFailedError extends Error {
|
|
1930
|
+
constructor(body) {
|
|
1931
|
+
super(
|
|
1932
|
+
`NODE_MODULES_INSTALL_FAILED: ${body.message}`
|
|
1933
|
+
);
|
|
1934
|
+
this.body = body;
|
|
1935
|
+
this.name = "NodeModulesInstallFailedError";
|
|
1936
|
+
}
|
|
1937
|
+
static code = "NODE_MODULES_INSTALL_FAILED";
|
|
1938
|
+
static statusCode = 500;
|
|
1939
|
+
static description = `Failed to install node modules: {message}`;
|
|
1940
|
+
}
|
|
1941
|
+
class NodeModulesDownloadFailedError extends Error {
|
|
1942
|
+
constructor(body) {
|
|
1943
|
+
super(
|
|
1944
|
+
`NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
|
|
1945
|
+
);
|
|
1946
|
+
this.body = body;
|
|
1947
|
+
this.name = "NodeModulesDownloadFailedError";
|
|
1948
|
+
}
|
|
1949
|
+
static code = "NODE_MODULES_DOWNLOAD_FAILED";
|
|
1950
|
+
static statusCode = 500;
|
|
1951
|
+
static description = `Failed to download node modules: {message}`;
|
|
1952
|
+
}
|
|
1953
|
+
class LockGenerationFailedError extends Error {
|
|
1954
|
+
constructor(body) {
|
|
1955
|
+
super(
|
|
1956
|
+
`LOCK_GENERATION_FAILED: ${body.message}`
|
|
1957
|
+
);
|
|
1958
|
+
this.body = body;
|
|
1959
|
+
this.name = "LockGenerationFailedError";
|
|
1960
|
+
}
|
|
1961
|
+
static code = "LOCK_GENERATION_FAILED";
|
|
1962
|
+
static statusCode = 500;
|
|
1963
|
+
static description = `Failed to generate lock file: {message}`;
|
|
1964
|
+
}
|
|
1965
|
+
class WriteScriptFailedError extends Error {
|
|
1966
|
+
constructor(body) {
|
|
1967
|
+
super(
|
|
1968
|
+
`WRITE_SCRIPT_FAILED: ${body.message}`
|
|
1969
|
+
);
|
|
1970
|
+
this.body = body;
|
|
1971
|
+
this.name = "WriteScriptFailedError";
|
|
1972
|
+
}
|
|
1973
|
+
static code = "WRITE_SCRIPT_FAILED";
|
|
1974
|
+
static statusCode = 500;
|
|
1975
|
+
static description = `Failed to write script file: {message}`;
|
|
1976
|
+
}
|
|
1977
|
+
class DirectoryCreationFailedError extends Error {
|
|
1978
|
+
constructor(body) {
|
|
1979
|
+
super(
|
|
1980
|
+
`DIRECTORY_CREATION_FAILED: ${body.message}`
|
|
1981
|
+
);
|
|
1982
|
+
this.body = body;
|
|
1983
|
+
this.name = "DirectoryCreationFailedError";
|
|
1984
|
+
}
|
|
1985
|
+
static code = "DIRECTORY_CREATION_FAILED";
|
|
1986
|
+
static statusCode = 500;
|
|
1987
|
+
static description = `Failed to create script directory: {message}`;
|
|
1988
|
+
}
|
|
1989
|
+
class NetworkPermissionsFailedError extends Error {
|
|
1990
|
+
constructor(body) {
|
|
1991
|
+
super(
|
|
1992
|
+
`NETWORK_PERMISSIONS_FAILED: ${body.message}`
|
|
1993
|
+
);
|
|
1994
|
+
this.body = body;
|
|
1995
|
+
this.name = "NetworkPermissionsFailedError";
|
|
1996
|
+
}
|
|
1997
|
+
static code = "NETWORK_PERMISSIONS_FAILED";
|
|
1998
|
+
static statusCode = 500;
|
|
1999
|
+
static description = `Failed to insert network permissions: {message}`;
|
|
2000
|
+
}
|
|
2001
|
+
class LoggingFailedError extends Error {
|
|
2002
|
+
constructor(body) {
|
|
2003
|
+
super(
|
|
2004
|
+
`LOGGING_FAILED: ${body.message}`
|
|
2005
|
+
);
|
|
2006
|
+
this.body = body;
|
|
2007
|
+
this.name = "LoggingFailedError";
|
|
2008
|
+
}
|
|
2009
|
+
static code = "LOGGING_FAILED";
|
|
2010
|
+
static statusCode = 500;
|
|
2011
|
+
static description = `Failed to log execute run: {message}`;
|
|
2012
|
+
}
|
|
2013
|
+
class RunNotFoundError extends Error {
|
|
2014
|
+
constructor(body) {
|
|
2015
|
+
super(
|
|
2016
|
+
`RUN_NOT_FOUND: ${body.message}`
|
|
2017
|
+
);
|
|
2018
|
+
this.body = body;
|
|
2019
|
+
this.name = "RunNotFoundError";
|
|
2020
|
+
}
|
|
2021
|
+
static code = "RUN_NOT_FOUND";
|
|
2022
|
+
static statusCode = 404;
|
|
2023
|
+
static description = `Execute run not found: {run_id}`;
|
|
2024
|
+
}
|
|
2025
|
+
class CloudstateInternalErrorError extends Error {
|
|
2026
|
+
constructor(body) {
|
|
2027
|
+
super(
|
|
2028
|
+
`CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
|
|
2029
|
+
);
|
|
2030
|
+
this.body = body;
|
|
2031
|
+
this.name = "CloudstateInternalErrorError";
|
|
2032
|
+
}
|
|
2033
|
+
static code = "CLOUDSTATE_INTERNAL_ERROR";
|
|
2034
|
+
static statusCode = 500;
|
|
2035
|
+
static description = `Internal error: {message}`;
|
|
2036
|
+
}
|
|
2037
|
+
class CloudstateDatabaseErrorError extends Error {
|
|
2038
|
+
constructor(body) {
|
|
2039
|
+
super(
|
|
2040
|
+
`CLOUDSTATE_DATABASE_ERROR: ${body.message}`
|
|
2041
|
+
);
|
|
2042
|
+
this.body = body;
|
|
2043
|
+
this.name = "CloudstateDatabaseErrorError";
|
|
2044
|
+
}
|
|
2045
|
+
static code = "CLOUDSTATE_DATABASE_ERROR";
|
|
2046
|
+
static statusCode = 500;
|
|
2047
|
+
static description = `Database operation failed: {message}`;
|
|
2048
|
+
}
|
|
2049
|
+
class CloudstateAccessDeniedError extends Error {
|
|
2050
|
+
constructor(body) {
|
|
2051
|
+
super(
|
|
2052
|
+
`CLOUDSTATE_ACCESS_DENIED: ${body.message}`
|
|
2053
|
+
);
|
|
2054
|
+
this.body = body;
|
|
2055
|
+
this.name = "CloudstateAccessDeniedError";
|
|
2056
|
+
}
|
|
2057
|
+
static code = "CLOUDSTATE_ACCESS_DENIED";
|
|
2058
|
+
static statusCode = 403;
|
|
2059
|
+
static description = `Access denied to project: {project_id}`;
|
|
2060
|
+
}
|
|
2061
|
+
class RestoreFailedError extends Error {
|
|
2062
|
+
constructor(body) {
|
|
2063
|
+
super(
|
|
2064
|
+
`RESTORE_FAILED: ${body.message}`
|
|
2065
|
+
);
|
|
2066
|
+
this.body = body;
|
|
2067
|
+
this.name = "RestoreFailedError";
|
|
2068
|
+
}
|
|
2069
|
+
static code = "RESTORE_FAILED";
|
|
2070
|
+
static statusCode = 500;
|
|
2071
|
+
static description = `Failed to restore from backup: {message}`;
|
|
2072
|
+
}
|
|
2073
|
+
class CreateBackupFailedError extends Error {
|
|
2074
|
+
constructor(body) {
|
|
2075
|
+
super(
|
|
2076
|
+
`CREATE_BACKUP_FAILED: ${body.message}`
|
|
2077
|
+
);
|
|
2078
|
+
this.body = body;
|
|
2079
|
+
this.name = "CreateBackupFailedError";
|
|
2080
|
+
}
|
|
2081
|
+
static code = "CREATE_BACKUP_FAILED";
|
|
2082
|
+
static statusCode = 500;
|
|
2083
|
+
static description = `Failed to create backup: {message}`;
|
|
2084
|
+
}
|
|
2085
|
+
class BackupFailedError extends Error {
|
|
2086
|
+
constructor(body) {
|
|
2087
|
+
super(
|
|
2088
|
+
`BACKUP_FAILED: ${body.message}`
|
|
2089
|
+
);
|
|
2090
|
+
this.body = body;
|
|
2091
|
+
this.name = "BackupFailedError";
|
|
2092
|
+
}
|
|
2093
|
+
static code = "BACKUP_FAILED";
|
|
2094
|
+
static statusCode = 500;
|
|
2095
|
+
static description = `Backup failed: {message}`;
|
|
2096
|
+
}
|
|
2097
|
+
class DeploymentFailedError extends Error {
|
|
2098
|
+
constructor(body) {
|
|
2099
|
+
super(
|
|
2100
|
+
`DEPLOYMENT_FAILED: ${body.message}`
|
|
2101
|
+
);
|
|
2102
|
+
this.body = body;
|
|
2103
|
+
this.name = "DeploymentFailedError";
|
|
2104
|
+
}
|
|
2105
|
+
static code = "DEPLOYMENT_FAILED";
|
|
2106
|
+
static statusCode = 500;
|
|
2107
|
+
static description = `Deployment failed: {message}`;
|
|
2108
|
+
}
|
|
2109
|
+
class InvalidDeploymentRequestError extends Error {
|
|
2110
|
+
constructor(body) {
|
|
2111
|
+
super(
|
|
2112
|
+
`INVALID_DEPLOYMENT_REQUEST: ${body.message}`
|
|
2113
|
+
);
|
|
2114
|
+
this.body = body;
|
|
2115
|
+
this.name = "InvalidDeploymentRequestError";
|
|
2116
|
+
}
|
|
2117
|
+
static code = "INVALID_DEPLOYMENT_REQUEST";
|
|
2118
|
+
static statusCode = 400;
|
|
2119
|
+
static description = `Invalid deployment request: {message}`;
|
|
2120
|
+
}
|
|
2121
|
+
class ProjectNotFoundError extends Error {
|
|
2122
|
+
constructor(body) {
|
|
2123
|
+
super(
|
|
2124
|
+
`PROJECT_NOT_FOUND: ${body.message}`
|
|
2125
|
+
);
|
|
2126
|
+
this.body = body;
|
|
2127
|
+
this.name = "ProjectNotFoundError";
|
|
2128
|
+
}
|
|
2129
|
+
static code = "PROJECT_NOT_FOUND";
|
|
2130
|
+
static statusCode = 404;
|
|
2131
|
+
static description = `Project not found: {project_id}`;
|
|
2132
|
+
}
|
|
2133
|
+
class ResizeFailedError extends Error {
|
|
2134
|
+
constructor(body) {
|
|
2135
|
+
super(
|
|
2136
|
+
`RESIZE_FAILED: ${body.message}`
|
|
2137
|
+
);
|
|
2138
|
+
this.body = body;
|
|
2139
|
+
this.name = "ResizeFailedError";
|
|
2140
|
+
}
|
|
2141
|
+
static code = "RESIZE_FAILED";
|
|
2142
|
+
static statusCode = 500;
|
|
2143
|
+
static description = `Failed to resize VM: {message}`;
|
|
2144
|
+
}
|
|
2145
|
+
class InternalResizeVmNotFoundError extends Error {
|
|
2146
|
+
constructor(body) {
|
|
2147
|
+
super(
|
|
2148
|
+
`INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
|
|
2149
|
+
);
|
|
2150
|
+
this.body = body;
|
|
2151
|
+
this.name = "InternalResizeVmNotFoundError";
|
|
2152
|
+
}
|
|
2153
|
+
static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
|
|
2154
|
+
static statusCode = 404;
|
|
2155
|
+
static description = `VM not found`;
|
|
2156
|
+
}
|
|
2157
|
+
class DomainOwnershipVerificationFailedError extends Error {
|
|
2158
|
+
constructor(body) {
|
|
2159
|
+
super(
|
|
2160
|
+
`DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
|
|
2161
|
+
);
|
|
2162
|
+
this.body = body;
|
|
2163
|
+
this.name = "DomainOwnershipVerificationFailedError";
|
|
2164
|
+
}
|
|
2165
|
+
static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
|
|
2166
|
+
static statusCode = 403;
|
|
2167
|
+
static description = `Domain ownership verification failed`;
|
|
2168
|
+
}
|
|
2169
|
+
class ErrorDeletingRecordError extends Error {
|
|
2170
|
+
constructor(body) {
|
|
2171
|
+
super(
|
|
2172
|
+
`ERROR_DELETING_RECORD: ${body.message}`
|
|
2173
|
+
);
|
|
2174
|
+
this.body = body;
|
|
2175
|
+
this.name = "ErrorDeletingRecordError";
|
|
2176
|
+
}
|
|
2177
|
+
static code = "ERROR_DELETING_RECORD";
|
|
2178
|
+
static statusCode = 500;
|
|
2179
|
+
static description = `Error deleting DNS record for {domain}/{name}: {message}`;
|
|
2180
|
+
}
|
|
2181
|
+
class RecordOwnershipErrorError extends Error {
|
|
2182
|
+
constructor(body) {
|
|
2183
|
+
super(
|
|
2184
|
+
`RECORD_OWNERSHIP_ERROR: ${body.message}`
|
|
2185
|
+
);
|
|
2186
|
+
this.body = body;
|
|
2187
|
+
this.name = "RecordOwnershipErrorError";
|
|
2188
|
+
}
|
|
2189
|
+
static code = "RECORD_OWNERSHIP_ERROR";
|
|
2190
|
+
static statusCode = 403;
|
|
2191
|
+
static description = `Account {account_id} does not own record {record_id}`;
|
|
2192
|
+
}
|
|
2193
|
+
class ErrorCreatingRecordError extends Error {
|
|
2194
|
+
constructor(body) {
|
|
2195
|
+
super(
|
|
2196
|
+
`ERROR_CREATING_RECORD: ${body.message}`
|
|
2197
|
+
);
|
|
2198
|
+
this.body = body;
|
|
2199
|
+
this.name = "ErrorCreatingRecordError";
|
|
2200
|
+
}
|
|
2201
|
+
static code = "ERROR_CREATING_RECORD";
|
|
2202
|
+
static statusCode = 500;
|
|
2203
|
+
static description = `Error creating DNS record: {message}`;
|
|
2204
|
+
}
|
|
2205
|
+
class DomainOwnershipErrorError extends Error {
|
|
2206
|
+
constructor(body) {
|
|
2207
|
+
super(
|
|
2208
|
+
`DOMAIN_OWNERSHIP_ERROR: ${body.message}`
|
|
2209
|
+
);
|
|
2210
|
+
this.body = body;
|
|
2211
|
+
this.name = "DomainOwnershipErrorError";
|
|
2212
|
+
}
|
|
2213
|
+
static code = "DOMAIN_OWNERSHIP_ERROR";
|
|
2214
|
+
static statusCode = 403;
|
|
2215
|
+
static description = `Account {account_id} does not own domain {domain}`;
|
|
2216
|
+
}
|
|
2217
|
+
class BrowserOperationFailedError extends Error {
|
|
2218
|
+
constructor(body) {
|
|
2219
|
+
super(
|
|
2220
|
+
`BROWSER_OPERATION_FAILED: ${body.message}`
|
|
2221
|
+
);
|
|
2222
|
+
this.body = body;
|
|
2223
|
+
this.name = "BrowserOperationFailedError";
|
|
2224
|
+
}
|
|
2225
|
+
static code = "BROWSER_OPERATION_FAILED";
|
|
2226
|
+
static statusCode = 500;
|
|
2227
|
+
static description = `Browser operation failed: {message}`;
|
|
2228
|
+
}
|
|
2229
|
+
class WatchFilesFailedError extends Error {
|
|
2230
|
+
constructor(body) {
|
|
2231
|
+
super(
|
|
2232
|
+
`WATCH_FILES_FAILED: ${body.message}`
|
|
2233
|
+
);
|
|
2234
|
+
this.body = body;
|
|
2235
|
+
this.name = "WatchFilesFailedError";
|
|
2236
|
+
}
|
|
2237
|
+
static code = "WATCH_FILES_FAILED";
|
|
2238
|
+
static statusCode = 500;
|
|
2239
|
+
static description = `Failed to watch files: {message}`;
|
|
2240
|
+
}
|
|
2241
|
+
class LogsFailedError extends Error {
|
|
2242
|
+
constructor(body) {
|
|
2243
|
+
super(
|
|
2244
|
+
`LOGS_FAILED: ${body.message}`
|
|
2245
|
+
);
|
|
2246
|
+
this.body = body;
|
|
2247
|
+
this.name = "LogsFailedError";
|
|
2248
|
+
}
|
|
2249
|
+
static code = "LOGS_FAILED";
|
|
2250
|
+
static statusCode = 500;
|
|
2251
|
+
static description = `Failed to get logs: {message}`;
|
|
2252
|
+
}
|
|
2253
|
+
class StatusFailedError extends Error {
|
|
2254
|
+
constructor(body) {
|
|
2255
|
+
super(
|
|
2256
|
+
`STATUS_FAILED: ${body.message}`
|
|
2257
|
+
);
|
|
2258
|
+
this.body = body;
|
|
2259
|
+
this.name = "StatusFailedError";
|
|
2260
|
+
}
|
|
2261
|
+
static code = "STATUS_FAILED";
|
|
2262
|
+
static statusCode = 500;
|
|
2263
|
+
static description = `Failed to get dev server status: {message}`;
|
|
2264
|
+
}
|
|
2265
|
+
class RestartFailedError extends Error {
|
|
2266
|
+
constructor(body) {
|
|
2267
|
+
super(
|
|
2268
|
+
`RESTART_FAILED: ${body.message}`
|
|
2269
|
+
);
|
|
2270
|
+
this.body = body;
|
|
2271
|
+
this.name = "RestartFailedError";
|
|
2272
|
+
}
|
|
2273
|
+
static code = "RESTART_FAILED";
|
|
2274
|
+
static statusCode = 500;
|
|
2275
|
+
static description = `Failed to restart dev server: {message}`;
|
|
2276
|
+
}
|
|
2277
|
+
class ShutdownFailedError extends Error {
|
|
2278
|
+
constructor(body) {
|
|
2279
|
+
super(
|
|
2280
|
+
`SHUTDOWN_FAILED: ${body.message}`
|
|
2281
|
+
);
|
|
2282
|
+
this.body = body;
|
|
2283
|
+
this.name = "ShutdownFailedError";
|
|
2284
|
+
}
|
|
2285
|
+
static code = "SHUTDOWN_FAILED";
|
|
2286
|
+
static statusCode = 500;
|
|
2287
|
+
static description = `Failed to shutdown dev server: {message}`;
|
|
2288
|
+
}
|
|
2289
|
+
class CommitFailedError extends Error {
|
|
2290
|
+
constructor(body) {
|
|
2291
|
+
super(
|
|
2292
|
+
`COMMIT_FAILED: ${body.message}`
|
|
2293
|
+
);
|
|
2294
|
+
this.body = body;
|
|
2295
|
+
this.name = "CommitFailedError";
|
|
2296
|
+
}
|
|
2297
|
+
static code = "COMMIT_FAILED";
|
|
2298
|
+
static statusCode = 500;
|
|
2299
|
+
static description = `Failed to commit changes: {message}`;
|
|
2300
|
+
}
|
|
2301
|
+
class WriteFileFailedError extends Error {
|
|
2302
|
+
constructor(body) {
|
|
2303
|
+
super(
|
|
2304
|
+
`WRITE_FILE_FAILED: ${body.message}`
|
|
2305
|
+
);
|
|
2306
|
+
this.body = body;
|
|
2307
|
+
this.name = "WriteFileFailedError";
|
|
2308
|
+
}
|
|
2309
|
+
static code = "WRITE_FILE_FAILED";
|
|
2310
|
+
static statusCode = 500;
|
|
2311
|
+
static description = `Failed to write file: {message}`;
|
|
2312
|
+
}
|
|
2313
|
+
class ReadFileFailedError extends Error {
|
|
2314
|
+
constructor(body) {
|
|
2315
|
+
super(
|
|
2316
|
+
`READ_FILE_FAILED: ${body.message}`
|
|
2317
|
+
);
|
|
2318
|
+
this.body = body;
|
|
2319
|
+
this.name = "ReadFileFailedError";
|
|
2320
|
+
}
|
|
2321
|
+
static code = "READ_FILE_FAILED";
|
|
2322
|
+
static statusCode = 500;
|
|
2323
|
+
static description = `Failed to read file: {message}`;
|
|
2324
|
+
}
|
|
2325
|
+
class ExecutionFailedError extends Error {
|
|
2326
|
+
constructor(body) {
|
|
2327
|
+
super(
|
|
2328
|
+
`EXECUTION_FAILED: ${body.message}`
|
|
2329
|
+
);
|
|
2330
|
+
this.body = body;
|
|
2331
|
+
this.name = "ExecutionFailedError";
|
|
2332
|
+
}
|
|
2333
|
+
static code = "EXECUTION_FAILED";
|
|
2334
|
+
static statusCode = 500;
|
|
2335
|
+
static description = `Failed to execute command: {message}`;
|
|
2336
|
+
}
|
|
2337
|
+
class RequestFailedError extends Error {
|
|
2338
|
+
constructor(body) {
|
|
2339
|
+
super(
|
|
2340
|
+
`REQUEST_FAILED: ${body.message}`
|
|
2341
|
+
);
|
|
2342
|
+
this.body = body;
|
|
2343
|
+
this.name = "RequestFailedError";
|
|
2344
|
+
}
|
|
2345
|
+
static code = "REQUEST_FAILED";
|
|
2346
|
+
static statusCode = 500;
|
|
2347
|
+
static description = `Failed to request dev server: {message}`;
|
|
2348
|
+
}
|
|
2349
|
+
class DevServerFileNotFoundError extends Error {
|
|
2350
|
+
constructor(body) {
|
|
2351
|
+
super(
|
|
2352
|
+
`DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
|
|
2353
|
+
);
|
|
2354
|
+
this.body = body;
|
|
2355
|
+
this.name = "DevServerFileNotFoundError";
|
|
2356
|
+
}
|
|
2357
|
+
static code = "DEV_SERVER_FILE_NOT_FOUND";
|
|
2358
|
+
static statusCode = 404;
|
|
2359
|
+
static description = `Dev server file not found: {path}`;
|
|
2360
|
+
}
|
|
2361
|
+
class DevServerInvalidRequestError extends Error {
|
|
2362
|
+
constructor(body) {
|
|
2363
|
+
super(
|
|
2364
|
+
`DEV_SERVER_INVALID_REQUEST: ${body.message}`
|
|
2365
|
+
);
|
|
2366
|
+
this.body = body;
|
|
2367
|
+
this.name = "DevServerInvalidRequestError";
|
|
2368
|
+
}
|
|
2369
|
+
static code = "DEV_SERVER_INVALID_REQUEST";
|
|
2370
|
+
static statusCode = 400;
|
|
2371
|
+
static description = `Invalid dev server request: {message}`;
|
|
2372
|
+
}
|
|
2373
|
+
class DevServerNotFoundError extends Error {
|
|
2374
|
+
constructor(body) {
|
|
2375
|
+
super(
|
|
2376
|
+
`DEV_SERVER_NOT_FOUND: ${body.message}`
|
|
2377
|
+
);
|
|
2378
|
+
this.body = body;
|
|
2379
|
+
this.name = "DevServerNotFoundError";
|
|
2380
|
+
}
|
|
2381
|
+
static code = "DEV_SERVER_NOT_FOUND";
|
|
2382
|
+
static statusCode = 404;
|
|
2383
|
+
static description = `Dev server not found: {server_id}`;
|
|
2384
|
+
}
|
|
2385
|
+
const FREESTYLE_ERROR_CODE_MAP = {
|
|
2386
|
+
"VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
|
|
2387
|
+
"VM_NOT_RUNNING": VmNotRunningError,
|
|
2388
|
+
"VM_NOT_FOUND": VmNotFoundError,
|
|
2389
|
+
"INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
|
|
2390
|
+
"BAD_REQUEST": BadRequestError,
|
|
2391
|
+
"INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
|
|
2392
|
+
"VM_MUST_BE_STOPPED": VmMustBeStoppedError,
|
|
2393
|
+
"ALREADY_HAS_BASE": AlreadyHasBaseError,
|
|
2394
|
+
"NOT_FOUND": NotFoundError,
|
|
2395
|
+
"INTERNAL_ERROR": InternalErrorError,
|
|
2396
|
+
"DOCKER_IMPORT_BAD_REQUEST": DockerImportBadRequestError,
|
|
2397
|
+
"FORK_VM_NOT_FOUND": ForkVmNotFoundError,
|
|
2398
|
+
"CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
|
|
2399
|
+
"SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
|
|
2400
|
+
"FILE_NOT_FOUND": FileNotFoundError,
|
|
2401
|
+
"FILES_BAD_REQUEST": FilesBadRequestError,
|
|
2402
|
+
"VM_DELETED": VmDeletedError,
|
|
2403
|
+
"REQWEST": ReqwestError,
|
|
2404
|
+
"FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
|
|
2405
|
+
"FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
|
|
2406
|
+
"VM_START_TIMEOUT": VmStartTimeoutError,
|
|
2407
|
+
"VM_EXIT_DURING_START": VmExitDuringStartError,
|
|
2408
|
+
"STD_IO": StdIoError,
|
|
2409
|
+
"VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
|
|
2410
|
+
"VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
|
|
2411
|
+
"VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
|
|
2412
|
+
"VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
|
|
2413
|
+
"VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
|
|
2414
|
+
"CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
|
|
2415
|
+
"USER_NOT_FOUND": UserNotFoundError,
|
|
2416
|
+
"USER_ALREADY_EXISTS": UserAlreadyExistsError,
|
|
2417
|
+
"VALIDATION_ERROR": ValidationErrorError,
|
|
2418
|
+
"GROUP_NOT_FOUND": GroupNotFoundError,
|
|
2419
|
+
"GROUP_ALREADY_EXISTS": GroupAlreadyExistsError,
|
|
2420
|
+
"DUPLICATE_USER_NAME": DuplicateUserNameError,
|
|
2421
|
+
"USER_GROUP_EMPTY": UserGroupEmptyError,
|
|
2422
|
+
"USER_SYSTEM_FLAG_MISMATCH": UserSystemFlagMismatchError,
|
|
2423
|
+
"USER_UID_OUT_OF_RANGE": UserUidOutOfRangeError,
|
|
2424
|
+
"USER_HOME_INVALID": UserHomeInvalidError,
|
|
2425
|
+
"USER_SHELL_INVALID": UserShellInvalidError,
|
|
2426
|
+
"DUPLICATE_GROUP_NAME": DuplicateGroupNameError,
|
|
2427
|
+
"GROUP_NAME_RESERVED": GroupNameReservedError,
|
|
2428
|
+
"GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
|
|
2429
|
+
"GROUP_NAME_TOO_LONG": GroupNameTooLongError,
|
|
2430
|
+
"GROUP_NAME_EMPTY": GroupNameEmptyError,
|
|
2431
|
+
"WANTED_BY_EMPTY": WantedByEmptyError,
|
|
2432
|
+
"WORKDIR_EMPTY": WorkdirEmptyError,
|
|
2433
|
+
"GROUP_EMPTY": GroupEmptyError,
|
|
2434
|
+
"USER_EMPTY": UserEmptyError,
|
|
2435
|
+
"ON_FAILURE_ARRAY_CONTAINS_EMPTY": OnFailureArrayContainsEmptyError,
|
|
2436
|
+
"REQUIRES_ARRAY_CONTAINS_EMPTY": RequiresArrayContainsEmptyError,
|
|
2437
|
+
"AFTER_ARRAY_CONTAINS_EMPTY": AfterArrayContainsEmptyError,
|
|
2438
|
+
"ENV_KEY_CONTAINS_EQUALS": EnvKeyContainsEqualsError,
|
|
2439
|
+
"ENV_KEY_EMPTY": EnvKeyEmptyError,
|
|
2440
|
+
"EXEC_EMPTY": ExecEmptyError,
|
|
2441
|
+
"SERVICE_NAME_TOO_LONG": ServiceNameTooLongError,
|
|
2442
|
+
"SERVICE_NAME_INVALID_PREFIX": ServiceNameInvalidPrefixError,
|
|
2443
|
+
"SERVICE_NAME_INVALID_CHARS": ServiceNameInvalidCharsError,
|
|
2444
|
+
"SERVICE_NAME_EMPTY": ServiceNameEmptyError,
|
|
2445
|
+
"SERVICE_ALREADY_EXISTS": ServiceAlreadyExistsError,
|
|
2446
|
+
"SERVICE_NOT_FOUND": ServiceNotFoundError,
|
|
2447
|
+
"INTERNAL": InternalError,
|
|
2448
|
+
"SIGNING": SigningError,
|
|
2449
|
+
"INVALID_SIGNATURE": InvalidSignatureError,
|
|
2450
|
+
"INVALID_PARAMETERS": InvalidParametersError,
|
|
2451
|
+
"MAX_USES_EXCEEDED": MaxUsesExceededError,
|
|
2452
|
+
"EXPIRED": ExpiredError,
|
|
2453
|
+
"CONFLICT": ConflictError,
|
|
2454
|
+
"REPO_NOT_FOUND": RepoNotFoundError,
|
|
2455
|
+
"FORBIDDEN": ForbiddenError,
|
|
2456
|
+
"UNSUPPORTED_TRANSFER": UnsupportedTransferError,
|
|
2457
|
+
"BRANCH_NOT_FOUND": BranchNotFoundError,
|
|
2458
|
+
"INVALID_OBJECT_ID": InvalidObjectIdError,
|
|
2459
|
+
"BLOB_NOT_FOUND": BlobNotFoundError,
|
|
2460
|
+
"REFERENCE_NOT_FOUND": ReferenceNotFoundError,
|
|
2461
|
+
"TAG_NOT_FOUND": TagNotFoundError,
|
|
2462
|
+
"COMMIT_NOT_FOUND": CommitNotFoundError,
|
|
2463
|
+
"INVALID_REQUEST": InvalidRequestError,
|
|
2464
|
+
"PATH_NOT_FOUND": PathNotFoundError,
|
|
2465
|
+
"INVALID_REVISION": InvalidRevisionError,
|
|
2466
|
+
"UNAUTHORIZED": UnauthorizedError,
|
|
2467
|
+
"TREE_NOT_FOUND": TreeNotFoundError,
|
|
2468
|
+
"BUILD_FAILED": BuildFailedError,
|
|
2469
|
+
"NO_ENTRYPOINT_FOUND": NoEntrypointFoundError,
|
|
2470
|
+
"ENTRYPOINT_NOT_FOUND": EntrypointNotFoundError,
|
|
2471
|
+
"NO_DOMAIN_OWNERSHIP": NoDomainOwnershipError,
|
|
2472
|
+
"INVALID_DOMAINS": InvalidDomainsError,
|
|
2473
|
+
"WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
|
|
2474
|
+
"DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
|
|
2475
|
+
"DATABASE_ERROR": DatabaseErrorError,
|
|
2476
|
+
"TRIGGER_ERROR": TriggerErrorError,
|
|
2477
|
+
"TOKEN_ERROR": TokenErrorError,
|
|
2478
|
+
"PERMISSION_ERROR": PermissionErrorError,
|
|
2479
|
+
"IDENTITY_ERROR": IdentityErrorError,
|
|
2480
|
+
"GET_CONTENT_FAILED": GetContentFailedError,
|
|
2481
|
+
"CONTENT_NOT_FOUND": ContentNotFoundError,
|
|
2482
|
+
"DOWNLOAD_FAILED": DownloadFailedError,
|
|
2483
|
+
"GIT_SERVER_ERROR": GitServerErrorError,
|
|
2484
|
+
"PARSE_RESPONSE_ERROR": ParseResponseErrorError,
|
|
2485
|
+
"REPOSITORY_ACCESS_DENIED": RepositoryAccessDeniedError,
|
|
2486
|
+
"GIT_HUB_SYNC_FAILED": GitHubSyncFailedError,
|
|
2487
|
+
"UPDATE_DEFAULT_BRANCH_FAILED": UpdateDefaultBranchFailedError,
|
|
2488
|
+
"GET_REPOSITORY_INFO_FAILED": GetRepositoryInfoFailedError,
|
|
2489
|
+
"LIST_REPOSITORIES_FAILED": ListRepositoriesFailedError,
|
|
2490
|
+
"DELETE_REPOSITORY_FAILED": DeleteRepositoryFailedError,
|
|
2491
|
+
"CREATE_REPOSITORY_FAILED": CreateRepositoryFailedError,
|
|
2492
|
+
"SERIALIZATION_ERROR": SerializationErrorError,
|
|
2493
|
+
"GIT_INVALID_REQUEST": GitInvalidRequestError,
|
|
2494
|
+
"REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
|
|
2495
|
+
"FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
|
|
2496
|
+
"FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
|
|
2497
|
+
"PERMISSION_DENIED": PermissionDeniedError,
|
|
2498
|
+
"FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
|
|
2499
|
+
"FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
|
|
2500
|
+
"FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
|
|
2501
|
+
"FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
|
|
2502
|
+
"VERIFICATION_FAILED": VerificationFailedError,
|
|
2503
|
+
"FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
|
|
2504
|
+
"VERIFICATION_NOT_FOUND": VerificationNotFoundError,
|
|
2505
|
+
"FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
|
|
2506
|
+
"INVALID_DOMAIN": InvalidDomainError,
|
|
2507
|
+
"DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
|
|
2508
|
+
"FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
|
|
2509
|
+
"FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
|
|
2510
|
+
"FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
|
|
2511
|
+
"FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
|
|
2512
|
+
"ANYHOW": AnyhowError,
|
|
2513
|
+
"OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
|
|
2514
|
+
"OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
|
|
2515
|
+
"PARSE_LOGS_FAILED": ParseLogsFailedError,
|
|
2516
|
+
"RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
|
|
2517
|
+
"INVALID_QUERY": InvalidQueryError,
|
|
2518
|
+
"LOGS_NOT_FOUND": LogsNotFoundError,
|
|
2519
|
+
"PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
|
|
2520
|
+
"LIST_TOKENS_FAILED": ListTokensFailedError,
|
|
2521
|
+
"REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
|
|
2522
|
+
"CREATE_TOKEN_FAILED": CreateTokenFailedError,
|
|
2523
|
+
"LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
|
|
2524
|
+
"GET_PERMISSION_FAILED": GetPermissionFailedError,
|
|
2525
|
+
"UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
|
|
2526
|
+
"REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
|
|
2527
|
+
"GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
|
|
2528
|
+
"LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
|
|
2529
|
+
"DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
|
|
2530
|
+
"CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
|
|
2531
|
+
"VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
|
|
2532
|
+
"PERMISSION_NOT_FOUND": PermissionNotFoundError,
|
|
2533
|
+
"VM_ACCESS_DENIED": VmAccessDeniedError,
|
|
2534
|
+
"GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
|
|
2535
|
+
"GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
|
|
2536
|
+
"CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
|
|
2537
|
+
"CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
|
|
2538
|
+
"IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
|
|
2539
|
+
"IDENTITY_NOT_FOUND": IdentityNotFoundError,
|
|
2540
|
+
"EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
|
|
2541
|
+
"EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
|
|
2542
|
+
"LIST_RUNS_FAILED": ListRunsFailedError,
|
|
2543
|
+
"EXECUTION_ERROR": ExecutionErrorError,
|
|
2544
|
+
"CONNECTION_FAILED": ConnectionFailedError,
|
|
2545
|
+
"METADATA_WRITE_FAILED": MetadataWriteFailedError,
|
|
2546
|
+
"NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
|
|
2547
|
+
"NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
|
|
2548
|
+
"LOCK_GENERATION_FAILED": LockGenerationFailedError,
|
|
2549
|
+
"WRITE_SCRIPT_FAILED": WriteScriptFailedError,
|
|
2550
|
+
"DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
|
|
2551
|
+
"NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
|
|
2552
|
+
"LOGGING_FAILED": LoggingFailedError,
|
|
2553
|
+
"RUN_NOT_FOUND": RunNotFoundError,
|
|
2554
|
+
"CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
|
|
2555
|
+
"CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
|
|
2556
|
+
"CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
|
|
2557
|
+
"RESTORE_FAILED": RestoreFailedError,
|
|
2558
|
+
"CREATE_BACKUP_FAILED": CreateBackupFailedError,
|
|
2559
|
+
"BACKUP_FAILED": BackupFailedError,
|
|
2560
|
+
"DEPLOYMENT_FAILED": DeploymentFailedError,
|
|
2561
|
+
"INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
|
|
2562
|
+
"PROJECT_NOT_FOUND": ProjectNotFoundError,
|
|
2563
|
+
"RESIZE_FAILED": ResizeFailedError,
|
|
2564
|
+
"INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
|
|
2565
|
+
"DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
|
|
2566
|
+
"ERROR_DELETING_RECORD": ErrorDeletingRecordError,
|
|
2567
|
+
"RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
|
|
2568
|
+
"ERROR_CREATING_RECORD": ErrorCreatingRecordError,
|
|
2569
|
+
"DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
|
|
2570
|
+
"BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
|
|
2571
|
+
"WATCH_FILES_FAILED": WatchFilesFailedError,
|
|
2572
|
+
"LOGS_FAILED": LogsFailedError,
|
|
2573
|
+
"STATUS_FAILED": StatusFailedError,
|
|
2574
|
+
"RESTART_FAILED": RestartFailedError,
|
|
2575
|
+
"SHUTDOWN_FAILED": ShutdownFailedError,
|
|
2576
|
+
"COMMIT_FAILED": CommitFailedError,
|
|
2577
|
+
"WRITE_FILE_FAILED": WriteFileFailedError,
|
|
2578
|
+
"READ_FILE_FAILED": ReadFileFailedError,
|
|
2579
|
+
"EXECUTION_FAILED": ExecutionFailedError,
|
|
2580
|
+
"REQUEST_FAILED": RequestFailedError,
|
|
2581
|
+
"DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
|
|
2582
|
+
"DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
|
|
2583
|
+
"DEV_SERVER_NOT_FOUND": DevServerNotFoundError
|
|
2584
|
+
};
|
|
2585
|
+
|
|
2586
|
+
var errors = /*#__PURE__*/Object.freeze({
|
|
2587
|
+
__proto__: null,
|
|
2588
|
+
AfterArrayContainsEmptyError: AfterArrayContainsEmptyError,
|
|
2589
|
+
AlreadyHasBaseError: AlreadyHasBaseError,
|
|
2590
|
+
AnyhowError: AnyhowError,
|
|
2591
|
+
BackupFailedError: BackupFailedError,
|
|
2592
|
+
BadRequestError: BadRequestError,
|
|
2593
|
+
BlobNotFoundError: BlobNotFoundError,
|
|
2594
|
+
BranchNotFoundError: BranchNotFoundError,
|
|
2595
|
+
BrowserOperationFailedError: BrowserOperationFailedError,
|
|
2596
|
+
BuildFailedError: BuildFailedError,
|
|
2597
|
+
CannotDeleteManagedIdentityError: CannotDeleteManagedIdentityError,
|
|
2598
|
+
CannotModifyManagedIdentityError: CannotModifyManagedIdentityError,
|
|
2599
|
+
CloudstateAccessDeniedError: CloudstateAccessDeniedError,
|
|
2600
|
+
CloudstateDatabaseErrorError: CloudstateDatabaseErrorError,
|
|
2601
|
+
CloudstateInternalErrorError: CloudstateInternalErrorError,
|
|
2602
|
+
CommitFailedError: CommitFailedError,
|
|
2603
|
+
CommitNotFoundError: CommitNotFoundError,
|
|
2604
|
+
ConflictError: ConflictError,
|
|
2605
|
+
ConnectionFailedError: ConnectionFailedError,
|
|
2606
|
+
ContentNotFoundError: ContentNotFoundError,
|
|
2607
|
+
CreateBackupFailedError: CreateBackupFailedError,
|
|
2608
|
+
CreateIdentityFailedError: CreateIdentityFailedError,
|
|
2609
|
+
CreateRepositoryFailedError: CreateRepositoryFailedError,
|
|
2610
|
+
CreateSnapshotBadRequestError: CreateSnapshotBadRequestError,
|
|
2611
|
+
CreateTokenFailedError: CreateTokenFailedError,
|
|
2612
|
+
CreateVmBadRequestError: CreateVmBadRequestError,
|
|
2613
|
+
DatabaseErrorError: DatabaseErrorError,
|
|
2614
|
+
DeleteIdentityFailedError: DeleteIdentityFailedError,
|
|
2615
|
+
DeleteRepositoryFailedError: DeleteRepositoryFailedError,
|
|
2616
|
+
DeploymentFailedError: DeploymentFailedError,
|
|
2617
|
+
DeploymentNotFoundError: DeploymentNotFoundError,
|
|
2618
|
+
DevServerFileNotFoundError: DevServerFileNotFoundError,
|
|
2619
|
+
DevServerInvalidRequestError: DevServerInvalidRequestError,
|
|
2620
|
+
DevServerNotFoundError: DevServerNotFoundError,
|
|
2621
|
+
DirectoryCreationFailedError: DirectoryCreationFailedError,
|
|
2622
|
+
DockerImportBadRequestError: DockerImportBadRequestError,
|
|
2623
|
+
DomainAlreadyExistsError: DomainAlreadyExistsError,
|
|
2624
|
+
DomainOwnershipErrorError: DomainOwnershipErrorError,
|
|
2625
|
+
DomainOwnershipVerificationFailedError: DomainOwnershipVerificationFailedError,
|
|
2626
|
+
DownloadFailedError: DownloadFailedError,
|
|
2627
|
+
DuplicateGroupNameError: DuplicateGroupNameError,
|
|
2628
|
+
DuplicateUserNameError: DuplicateUserNameError,
|
|
2629
|
+
EntrypointNotFoundError: EntrypointNotFoundError,
|
|
2630
|
+
EnvKeyContainsEqualsError: EnvKeyContainsEqualsError,
|
|
2631
|
+
EnvKeyEmptyError: EnvKeyEmptyError,
|
|
2632
|
+
ErrorCreatingRecordError: ErrorCreatingRecordError,
|
|
2633
|
+
ErrorDeletingRecordError: ErrorDeletingRecordError,
|
|
2634
|
+
ExecEmptyError: ExecEmptyError,
|
|
2635
|
+
ExecuteAccessDeniedError: ExecuteAccessDeniedError,
|
|
2636
|
+
ExecuteInternalErrorError: ExecuteInternalErrorError,
|
|
2637
|
+
ExecutionErrorError: ExecutionErrorError,
|
|
2638
|
+
ExecutionFailedError: ExecutionFailedError,
|
|
2639
|
+
ExpiredError: ExpiredError,
|
|
2640
|
+
FREESTYLE_ERROR_CODE_MAP: FREESTYLE_ERROR_CODE_MAP,
|
|
2641
|
+
FailedPermissionsCheckError: FailedPermissionsCheckError,
|
|
2642
|
+
FailedRemoveDomainMappingError: FailedRemoveDomainMappingError,
|
|
2643
|
+
FailedToCheckDomainMappingPermissionsError: FailedToCheckDomainMappingPermissionsError,
|
|
2644
|
+
FailedToCheckPermissionsError: FailedToCheckPermissionsError,
|
|
2645
|
+
FailedToCreateVerificationCodeError: FailedToCreateVerificationCodeError,
|
|
2646
|
+
FailedToDeleteVerificationError: FailedToDeleteVerificationError,
|
|
2647
|
+
FailedToInsertDomainMappingError: FailedToInsertDomainMappingError,
|
|
2648
|
+
FailedToInsertOwnershipError: FailedToInsertOwnershipError,
|
|
2649
|
+
FailedToListDomainsError: FailedToListDomainsError,
|
|
2650
|
+
FailedToListVerificationsError: FailedToListVerificationsError,
|
|
2651
|
+
FailedToProvisionCertificateError: FailedToProvisionCertificateError,
|
|
2652
|
+
FailedToVerifyDomainError: FailedToVerifyDomainError,
|
|
2653
|
+
FileNotFoundError: FileNotFoundError,
|
|
2654
|
+
FilesBadRequestError: FilesBadRequestError,
|
|
2655
|
+
FirecrackerApiSocketNotFoundError: FirecrackerApiSocketNotFoundError,
|
|
2656
|
+
FirecrackerPidNotFoundError: FirecrackerPidNotFoundError,
|
|
2657
|
+
ForbiddenError: ForbiddenError,
|
|
2658
|
+
ForkVmNotFoundError: ForkVmNotFoundError,
|
|
2659
|
+
GetContentFailedError: GetContentFailedError,
|
|
2660
|
+
GetPermissionFailedError: GetPermissionFailedError,
|
|
2661
|
+
GetRepositoryInfoFailedError: GetRepositoryInfoFailedError,
|
|
2662
|
+
GitHubSyncFailedError: GitHubSyncFailedError,
|
|
2663
|
+
GitInvalidRequestError: GitInvalidRequestError,
|
|
2664
|
+
GitRepositoryAccessDeniedError: GitRepositoryAccessDeniedError,
|
|
2665
|
+
GitRepositoryNotFoundError: GitRepositoryNotFoundError,
|
|
2666
|
+
GitServerErrorError: GitServerErrorError,
|
|
2667
|
+
GrantPermissionFailedError: GrantPermissionFailedError,
|
|
2668
|
+
GroupAlreadyExistsError: GroupAlreadyExistsError,
|
|
2669
|
+
GroupEmptyError: GroupEmptyError,
|
|
2670
|
+
GroupNameEmptyError: GroupNameEmptyError,
|
|
2671
|
+
GroupNameInvalidCharsError: GroupNameInvalidCharsError,
|
|
2672
|
+
GroupNameReservedError: GroupNameReservedError,
|
|
2673
|
+
GroupNameTooLongError: GroupNameTooLongError,
|
|
2674
|
+
GroupNotFoundError: GroupNotFoundError,
|
|
2675
|
+
IdentityAccessDeniedError: IdentityAccessDeniedError,
|
|
2676
|
+
IdentityErrorError: IdentityErrorError,
|
|
2677
|
+
IdentityNotFoundError: IdentityNotFoundError,
|
|
2678
|
+
InternalError: InternalError,
|
|
2679
|
+
InternalErrorError: InternalErrorError,
|
|
2680
|
+
InternalForkVmNotFoundError: InternalForkVmNotFoundError,
|
|
2681
|
+
InternalResizeVmNotFoundError: InternalResizeVmNotFoundError,
|
|
2682
|
+
InternalVmNotFoundError: InternalVmNotFoundError,
|
|
2683
|
+
InvalidDeploymentRequestError: InvalidDeploymentRequestError,
|
|
2684
|
+
InvalidDomainError: InvalidDomainError,
|
|
2685
|
+
InvalidDomainsError: InvalidDomainsError,
|
|
2686
|
+
InvalidObjectIdError: InvalidObjectIdError,
|
|
2687
|
+
InvalidParametersError: InvalidParametersError,
|
|
2688
|
+
InvalidQueryError: InvalidQueryError,
|
|
2689
|
+
InvalidRequestError: InvalidRequestError,
|
|
2690
|
+
InvalidRevisionError: InvalidRevisionError,
|
|
2691
|
+
InvalidSignatureError: InvalidSignatureError,
|
|
2692
|
+
ListIdentitiesFailedError: ListIdentitiesFailedError,
|
|
2693
|
+
ListPermissionsFailedError: ListPermissionsFailedError,
|
|
2694
|
+
ListRepositoriesFailedError: ListRepositoriesFailedError,
|
|
2695
|
+
ListRunsFailedError: ListRunsFailedError,
|
|
2696
|
+
ListTokensFailedError: ListTokensFailedError,
|
|
2697
|
+
LockGenerationFailedError: LockGenerationFailedError,
|
|
2698
|
+
LoggingFailedError: LoggingFailedError,
|
|
2699
|
+
LogsFailedError: LogsFailedError,
|
|
2700
|
+
LogsNotFoundError: LogsNotFoundError,
|
|
2701
|
+
MaxUsesExceededError: MaxUsesExceededError,
|
|
2702
|
+
MetadataWriteFailedError: MetadataWriteFailedError,
|
|
2703
|
+
NetworkPermissionsFailedError: NetworkPermissionsFailedError,
|
|
2704
|
+
NoDomainOwnershipError: NoDomainOwnershipError,
|
|
2705
|
+
NoEntrypointFoundError: NoEntrypointFoundError,
|
|
2706
|
+
NodeModulesDownloadFailedError: NodeModulesDownloadFailedError,
|
|
2707
|
+
NodeModulesInstallFailedError: NodeModulesInstallFailedError,
|
|
2708
|
+
NotFoundError: NotFoundError,
|
|
2709
|
+
ObservabilityAccessDeniedError: ObservabilityAccessDeniedError,
|
|
2710
|
+
ObservabilityDatabaseErrorError: ObservabilityDatabaseErrorError,
|
|
2711
|
+
OnFailureArrayContainsEmptyError: OnFailureArrayContainsEmptyError,
|
|
2712
|
+
ParseLogsFailedError: ParseLogsFailedError,
|
|
2713
|
+
ParseResponseErrorError: ParseResponseErrorError,
|
|
2714
|
+
PathNotFoundError: PathNotFoundError,
|
|
2715
|
+
PermissionAlreadyExistsError: PermissionAlreadyExistsError,
|
|
2716
|
+
PermissionDeniedError: PermissionDeniedError,
|
|
2717
|
+
PermissionErrorError: PermissionErrorError,
|
|
2718
|
+
PermissionNotFoundError: PermissionNotFoundError,
|
|
2719
|
+
ProjectNotFoundError: ProjectNotFoundError,
|
|
2720
|
+
ReadFileFailedError: ReadFileFailedError,
|
|
2721
|
+
RecordOwnershipErrorError: RecordOwnershipErrorError,
|
|
2722
|
+
ReferenceNotFoundError: ReferenceNotFoundError,
|
|
2723
|
+
RepoNotFoundError: RepoNotFoundError,
|
|
2724
|
+
RepositoryAccessDeniedError: RepositoryAccessDeniedError,
|
|
2725
|
+
RepositoryNotFoundError: RepositoryNotFoundError,
|
|
2726
|
+
RequestFailedError: RequestFailedError,
|
|
2727
|
+
RequiresArrayContainsEmptyError: RequiresArrayContainsEmptyError,
|
|
2728
|
+
ReqwestError: ReqwestError,
|
|
2729
|
+
ResizeFailedError: ResizeFailedError,
|
|
2730
|
+
RestartFailedError: RestartFailedError,
|
|
2731
|
+
RestoreFailedError: RestoreFailedError,
|
|
2732
|
+
RetrieveLogsFailedError: RetrieveLogsFailedError,
|
|
2733
|
+
RevokePermissionFailedError: RevokePermissionFailedError,
|
|
2734
|
+
RevokeTokenFailedError: RevokeTokenFailedError,
|
|
2735
|
+
RunNotFoundError: RunNotFoundError,
|
|
2736
|
+
SerializationErrorError: SerializationErrorError,
|
|
2737
|
+
ServiceAlreadyExistsError: ServiceAlreadyExistsError,
|
|
2738
|
+
ServiceNameEmptyError: ServiceNameEmptyError,
|
|
2739
|
+
ServiceNameInvalidCharsError: ServiceNameInvalidCharsError,
|
|
2740
|
+
ServiceNameInvalidPrefixError: ServiceNameInvalidPrefixError,
|
|
2741
|
+
ServiceNameTooLongError: ServiceNameTooLongError,
|
|
2742
|
+
ServiceNotFoundError: ServiceNotFoundError,
|
|
2743
|
+
ShutdownFailedError: ShutdownFailedError,
|
|
2744
|
+
SigningError: SigningError,
|
|
2745
|
+
SnapshotVmBadRequestError: SnapshotVmBadRequestError,
|
|
2746
|
+
StatusFailedError: StatusFailedError,
|
|
2747
|
+
StdIoError: StdIoError,
|
|
2748
|
+
TagNotFoundError: TagNotFoundError,
|
|
2749
|
+
TokenErrorError: TokenErrorError,
|
|
2750
|
+
TreeNotFoundError: TreeNotFoundError,
|
|
2751
|
+
TriggerErrorError: TriggerErrorError,
|
|
2752
|
+
UnauthorizedError: UnauthorizedError,
|
|
2753
|
+
UnsupportedTransferError: UnsupportedTransferError,
|
|
2754
|
+
UpdateDefaultBranchFailedError: UpdateDefaultBranchFailedError,
|
|
2755
|
+
UpdatePermissionFailedError: UpdatePermissionFailedError,
|
|
2756
|
+
UserAlreadyExistsError: UserAlreadyExistsError,
|
|
2757
|
+
UserEmptyError: UserEmptyError,
|
|
2758
|
+
UserGroupEmptyError: UserGroupEmptyError,
|
|
2759
|
+
UserHomeInvalidError: UserHomeInvalidError,
|
|
2760
|
+
UserNotFoundError: UserNotFoundError,
|
|
2761
|
+
UserShellInvalidError: UserShellInvalidError,
|
|
2762
|
+
UserSystemFlagMismatchError: UserSystemFlagMismatchError,
|
|
2763
|
+
UserUidOutOfRangeError: UserUidOutOfRangeError,
|
|
2764
|
+
ValidationErrorError: ValidationErrorError,
|
|
2765
|
+
VerificationFailedError: VerificationFailedError,
|
|
2766
|
+
VerificationNotFoundError: VerificationNotFoundError,
|
|
2767
|
+
VmAccessDeniedError: VmAccessDeniedError,
|
|
2768
|
+
VmCreateTmuxSessionError: VmCreateTmuxSessionError,
|
|
2769
|
+
VmDeletedError: VmDeletedError,
|
|
2770
|
+
VmExitDuringStartError: VmExitDuringStartError,
|
|
2771
|
+
VmMustBeStoppedError: VmMustBeStoppedError,
|
|
2772
|
+
VmNotFoundError: VmNotFoundError,
|
|
2773
|
+
VmNotFoundInFsError: VmNotFoundInFsError,
|
|
2774
|
+
VmNotInTransactionError: VmNotInTransactionError,
|
|
2775
|
+
VmNotRunningError: VmNotRunningError,
|
|
2776
|
+
VmOperationDeniedDuringTransactionError: VmOperationDeniedDuringTransactionError,
|
|
2777
|
+
VmPermissionNotFoundError: VmPermissionNotFoundError,
|
|
2778
|
+
VmStartTimeoutError: VmStartTimeoutError,
|
|
2779
|
+
VmSubnetNotFoundError: VmSubnetNotFoundError,
|
|
2780
|
+
VmTransactionIdMismatchError: VmTransactionIdMismatchError,
|
|
2781
|
+
WantedByEmptyError: WantedByEmptyError,
|
|
2782
|
+
WatchFilesFailedError: WatchFilesFailedError,
|
|
2783
|
+
WebDeploymentBadRequestError: WebDeploymentBadRequestError,
|
|
2784
|
+
WorkdirEmptyError: WorkdirEmptyError,
|
|
2785
|
+
WriteFileFailedError: WriteFileFailedError,
|
|
2786
|
+
WriteScriptFailedError: WriteScriptFailedError,
|
|
2787
|
+
errorFromJSON: errorFromJSON
|
|
2788
|
+
});
|
|
2789
|
+
|
|
2790
|
+
const SDK_VERSION = "0.1.0";
|
|
2791
|
+
const SDK_NAME = "freestyle-sdk-ts";
|
|
2792
|
+
class ApiClient {
|
|
2793
|
+
baseUrl;
|
|
2794
|
+
apiKey;
|
|
2795
|
+
accessToken;
|
|
2796
|
+
fetchFn;
|
|
2797
|
+
constructor(config = {}) {
|
|
2798
|
+
this.baseUrl = config.baseUrl || "https://api.freestyle.sh";
|
|
2799
|
+
this.apiKey = "apiKey" in config ? config.apiKey : void 0;
|
|
2800
|
+
this.accessToken = "accessToken" in config ? config.accessToken : void 0;
|
|
2801
|
+
this.fetchFn = config.fetch || fetch;
|
|
2802
|
+
}
|
|
2803
|
+
buildUrl(path, params, query) {
|
|
2804
|
+
let url = path;
|
|
2805
|
+
if (params) {
|
|
2806
|
+
for (const [key, value] of Object.entries(params)) {
|
|
2807
|
+
url = url.replace(`{${key}}`, encodeURIComponent(value));
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
if (query) {
|
|
2811
|
+
const searchParams = new URLSearchParams();
|
|
2812
|
+
for (const [key, value] of Object.entries(query)) {
|
|
2813
|
+
if (value !== void 0 && value !== null) {
|
|
2814
|
+
searchParams.append(key, String(value));
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
const queryString = searchParams.toString();
|
|
2818
|
+
if (queryString) {
|
|
2819
|
+
url += `?${queryString}`;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
return this.baseUrl + url;
|
|
2823
|
+
}
|
|
2824
|
+
getDefaultHeaders() {
|
|
2825
|
+
const headers = {
|
|
2826
|
+
"X-Freestyle-SDK": SDK_NAME,
|
|
2827
|
+
"X-Freestyle-SDK-Version": SDK_VERSION,
|
|
2828
|
+
"User-Agent": `${SDK_NAME}/${SDK_VERSION}`
|
|
2829
|
+
};
|
|
2830
|
+
if (this.apiKey) {
|
|
2831
|
+
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
2832
|
+
} else if (this.accessToken) {
|
|
2833
|
+
headers["X-Freestyle-Identity-Access-Token"] = this.accessToken;
|
|
2834
|
+
}
|
|
2835
|
+
return headers;
|
|
2836
|
+
}
|
|
2837
|
+
async request(method, url, body) {
|
|
2838
|
+
const headers = this.getDefaultHeaders();
|
|
2839
|
+
if (body) {
|
|
2840
|
+
headers["Content-Type"] = "application/json";
|
|
2841
|
+
}
|
|
2842
|
+
const response = await this.fetchFn(url, {
|
|
2843
|
+
method,
|
|
2844
|
+
headers,
|
|
2845
|
+
body: body ? JSON.stringify(body) : void 0
|
|
2846
|
+
});
|
|
2847
|
+
if (!response.ok) {
|
|
2848
|
+
const errorData = await response.json();
|
|
2849
|
+
throw errorFromJSON(errorData);
|
|
2850
|
+
}
|
|
2851
|
+
return response.json();
|
|
2852
|
+
}
|
|
2853
|
+
async fetch(url, options) {
|
|
2854
|
+
const headers = this.getDefaultHeaders();
|
|
2855
|
+
const finalOptions = {
|
|
2856
|
+
...options,
|
|
2857
|
+
headers: {
|
|
2858
|
+
...headers,
|
|
2859
|
+
...options?.headers || {}
|
|
2860
|
+
}
|
|
2861
|
+
};
|
|
2862
|
+
return this.fetchFn(url, finalOptions);
|
|
2863
|
+
}
|
|
2864
|
+
get(path, ...args) {
|
|
2865
|
+
const options = args[0];
|
|
2866
|
+
const url = this.buildUrl(path, options?.params, options?.query);
|
|
2867
|
+
return this.request("GET", url, options?.body);
|
|
2868
|
+
}
|
|
2869
|
+
post(path, ...args) {
|
|
2870
|
+
const options = args[0];
|
|
2871
|
+
const url = this.buildUrl(path, options?.params, options?.query);
|
|
2872
|
+
return this.request("POST", url, options?.body);
|
|
2873
|
+
}
|
|
2874
|
+
put(path, ...args) {
|
|
2875
|
+
const options = args[0];
|
|
2876
|
+
const url = this.buildUrl(path, options?.params, options?.query);
|
|
2877
|
+
return this.request("PUT", url, options?.body);
|
|
2878
|
+
}
|
|
2879
|
+
delete(path, ...args) {
|
|
2880
|
+
const options = args[0];
|
|
2881
|
+
const url = this.buildUrl(path, options?.params, options?.query);
|
|
2882
|
+
return this.request("DELETE", url, options?.body);
|
|
2883
|
+
}
|
|
2884
|
+
patch(path, ...args) {
|
|
2885
|
+
const options = args[0];
|
|
2886
|
+
const url = this.buildUrl(path, options?.params, options?.query);
|
|
2887
|
+
return this.request("PATCH", url, options?.body);
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
class DomainVerificationsNamespace {
|
|
2892
|
+
constructor(apiClient) {
|
|
2893
|
+
this.apiClient = apiClient;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* Create a domain verification request.
|
|
2897
|
+
*/
|
|
2898
|
+
async create({ domain }) {
|
|
2899
|
+
const response = await this.apiClient.post("/domains/v1/verifications", {
|
|
2900
|
+
body: { domain }
|
|
2901
|
+
});
|
|
2902
|
+
return {
|
|
2903
|
+
verificationId: response.id,
|
|
2904
|
+
instructions: `Navigate to your domain's DNS settings and create a TXT record with the following details:
|
|
2905
|
+
|
|
2906
|
+
Name: _freestyle-verification.${domain}
|
|
2907
|
+
|
|
2908
|
+
Value: ${response.verificationCode}
|
|
2909
|
+
|
|
2910
|
+
After adding the record, return here to complete the verification process. Note that DNS changes may take some time to propagate. If verification fails after waiting a few minutes, try setting the Name to just "_freestyle-verification". Some DNS providers automatically append the domain name to the record name.`,
|
|
2911
|
+
record: {
|
|
2912
|
+
type: "TXT",
|
|
2913
|
+
name: `_freestyle-verification.${domain}`,
|
|
2914
|
+
value: response.verificationCode
|
|
2915
|
+
}
|
|
2916
|
+
};
|
|
2917
|
+
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Complete a domain verification by domain or verification ID.
|
|
2920
|
+
*/
|
|
2921
|
+
async complete(options) {
|
|
2922
|
+
return this.apiClient.put("/domains/v1/verifications", {
|
|
2923
|
+
body: "verificationId" in options ? { id: options.verificationId } : { domain: options.domain }
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* List domain verification requests.
|
|
2928
|
+
*/
|
|
2929
|
+
async list() {
|
|
2930
|
+
return this.apiClient.get("/domains/v1/verifications", void 0);
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Cancel a domain verification request.
|
|
2934
|
+
*/
|
|
2935
|
+
async cancel({
|
|
2936
|
+
domain,
|
|
2937
|
+
verificationCode
|
|
2938
|
+
}) {
|
|
2939
|
+
return this.apiClient.delete("/domains/v1/verifications", {
|
|
2940
|
+
body: { domain, verificationCode }
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
class DomainCertificatesNamespace {
|
|
2945
|
+
constructor(apiClient) {
|
|
2946
|
+
this.apiClient = apiClient;
|
|
2947
|
+
}
|
|
2948
|
+
/**
|
|
2949
|
+
* Provision a wildcard certificate for a domain.
|
|
2950
|
+
*/
|
|
2951
|
+
async createWildcard({
|
|
2952
|
+
domain
|
|
2953
|
+
}) {
|
|
2954
|
+
return this.apiClient.post("/domains/v1/certs/{domain}/wildcard", {
|
|
2955
|
+
params: { domain }
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
class DomainMappingsNamespace {
|
|
2960
|
+
constructor(apiClient) {
|
|
2961
|
+
this.apiClient = apiClient;
|
|
2962
|
+
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Create a domain mapping to a deployment.
|
|
2965
|
+
*/
|
|
2966
|
+
async create({
|
|
2967
|
+
domain,
|
|
2968
|
+
deploymentId
|
|
2969
|
+
}) {
|
|
2970
|
+
return this.apiClient.post("/domains/v1/mappings/{domain}", {
|
|
2971
|
+
params: { domain },
|
|
2972
|
+
body: { deploymentId }
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2975
|
+
/**
|
|
2976
|
+
* Delete a domain mapping.
|
|
2977
|
+
*/
|
|
2978
|
+
async delete({
|
|
2979
|
+
domain
|
|
2980
|
+
}) {
|
|
2981
|
+
return this.apiClient.delete("/domains/v1/mappings/{domain}", {
|
|
2982
|
+
params: { domain }
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
* List domain mappings.
|
|
2987
|
+
*/
|
|
2988
|
+
async list({
|
|
2989
|
+
domain,
|
|
2990
|
+
domainOwnership,
|
|
2991
|
+
limit = 10,
|
|
2992
|
+
cursor
|
|
2993
|
+
} = {}) {
|
|
2994
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
2995
|
+
const mappings = await this.apiClient.get("/domains/v1/mappings", {
|
|
2996
|
+
query: { domain, domainOwnership, limit, offset }
|
|
2997
|
+
});
|
|
2998
|
+
return { mappings };
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
class DomainsNamespace {
|
|
3002
|
+
constructor(apiClient) {
|
|
3003
|
+
this.apiClient = apiClient;
|
|
3004
|
+
this.verifications = new DomainVerificationsNamespace(apiClient);
|
|
3005
|
+
this.certificates = new DomainCertificatesNamespace(apiClient);
|
|
3006
|
+
this.mappings = new DomainMappingsNamespace(apiClient);
|
|
3007
|
+
}
|
|
3008
|
+
verifications;
|
|
3009
|
+
certificates;
|
|
3010
|
+
mappings;
|
|
3011
|
+
/**
|
|
3012
|
+
* List verified domains.
|
|
3013
|
+
*/
|
|
3014
|
+
async list({
|
|
3015
|
+
limit,
|
|
3016
|
+
cursor
|
|
3017
|
+
} = {}) {
|
|
3018
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3019
|
+
return this.apiClient.get("/domains/v1/domains", {
|
|
3020
|
+
query: { limit, offset }
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
class GitRepo {
|
|
3026
|
+
constructor(repoId, apiClient) {
|
|
3027
|
+
this.apiClient = apiClient;
|
|
3028
|
+
this.repoId = repoId;
|
|
3029
|
+
}
|
|
3030
|
+
repoId;
|
|
3031
|
+
/**
|
|
3032
|
+
* Set the default branch for this repository.
|
|
3033
|
+
*/
|
|
3034
|
+
async setDefaultBranch({
|
|
3035
|
+
defaultBranch
|
|
3036
|
+
}) {
|
|
3037
|
+
return this.apiClient.put("/git/v1/repo/{repo_id}/default-branch", {
|
|
3038
|
+
params: { repo_id: this.repoId },
|
|
3039
|
+
body: { defaultBranch }
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
/**
|
|
3043
|
+
* Get the default branch for this repository.
|
|
3044
|
+
*/
|
|
3045
|
+
async getDefaultBranch() {
|
|
3046
|
+
return this.apiClient.get("/git/v1/repo/{repo_id}/default-branch", {
|
|
3047
|
+
params: { repo_id: this.repoId }
|
|
3048
|
+
});
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Get the contents of this repository at the given path.
|
|
3052
|
+
*/
|
|
3053
|
+
async getContents({
|
|
3054
|
+
path = "",
|
|
3055
|
+
ref
|
|
3056
|
+
} = {}) {
|
|
3057
|
+
return this.apiClient.get("/git/v1/repo/{repo}/contents/{path}", {
|
|
3058
|
+
params: { repo: this.repoId, path },
|
|
3059
|
+
query: { ref }
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
3062
|
+
/**
|
|
3063
|
+
* Get the GitHub sync configuration for this repository.
|
|
3064
|
+
*/
|
|
3065
|
+
async getGitHubSyncConfig() {
|
|
3066
|
+
try {
|
|
3067
|
+
return await this.apiClient.get("/git/v1/repo/{repo_id}/github-sync", {
|
|
3068
|
+
params: { repo_id: this.repoId }
|
|
3069
|
+
});
|
|
3070
|
+
} catch (error) {
|
|
3071
|
+
if (error.message?.includes("404")) {
|
|
3072
|
+
return null;
|
|
3073
|
+
}
|
|
3074
|
+
throw error;
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
/**
|
|
3078
|
+
* List git triggers for this repository.
|
|
3079
|
+
*/
|
|
3080
|
+
async listTriggers() {
|
|
3081
|
+
return this.apiClient.get("/git/v1/repo/{repo}/trigger", {
|
|
3082
|
+
params: { repo: this.repoId }
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
/**
|
|
3086
|
+
* Create a git trigger for this repository.
|
|
3087
|
+
*/
|
|
3088
|
+
async createTrigger({
|
|
3089
|
+
trigger,
|
|
3090
|
+
action
|
|
3091
|
+
}) {
|
|
3092
|
+
const response = await this.apiClient.post("/git/v1/repo/{repo}/trigger", {
|
|
3093
|
+
params: { repo: this.repoId },
|
|
3094
|
+
body: { trigger, action }
|
|
3095
|
+
});
|
|
3096
|
+
return {
|
|
3097
|
+
triggerId: response.triggerId
|
|
3098
|
+
};
|
|
3099
|
+
}
|
|
3100
|
+
/**
|
|
3101
|
+
* Delete a git trigger.
|
|
3102
|
+
*/
|
|
3103
|
+
async deleteTrigger({
|
|
3104
|
+
triggerId
|
|
3105
|
+
}) {
|
|
3106
|
+
return this.apiClient.delete("/git/v1/repo/{repo}/trigger/{trigger}", {
|
|
3107
|
+
params: { repo: this.repoId, trigger: triggerId }
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
class GitReposNamespace {
|
|
3112
|
+
constructor(apiClient) {
|
|
3113
|
+
this.apiClient = apiClient;
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* Create a new git repository.
|
|
3117
|
+
*/
|
|
3118
|
+
async create({ ...body }) {
|
|
3119
|
+
const response = await this.apiClient.post("/git/v1/repo", { body });
|
|
3120
|
+
const repoId = response.repoId;
|
|
3121
|
+
return {
|
|
3122
|
+
repoId,
|
|
3123
|
+
repo: new GitRepo(repoId, this.apiClient)
|
|
3124
|
+
};
|
|
3125
|
+
}
|
|
3126
|
+
/**
|
|
3127
|
+
* List git repositories.
|
|
3128
|
+
*/
|
|
3129
|
+
async list({
|
|
3130
|
+
limit = 10,
|
|
3131
|
+
cursor
|
|
3132
|
+
} = {}) {
|
|
3133
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3134
|
+
return this.apiClient.get("/git/v1/repo", {
|
|
3135
|
+
query: { limit, offset }
|
|
3136
|
+
});
|
|
3137
|
+
}
|
|
3138
|
+
/**
|
|
3139
|
+
* Get a repository instance by ID.
|
|
3140
|
+
*/
|
|
3141
|
+
instance({ repoId }) {
|
|
3142
|
+
return new GitRepo(repoId, this.apiClient);
|
|
3143
|
+
}
|
|
3144
|
+
/**
|
|
3145
|
+
* Delete a git repository.
|
|
3146
|
+
*/
|
|
3147
|
+
async delete({
|
|
3148
|
+
repoId
|
|
3149
|
+
}) {
|
|
3150
|
+
return this.apiClient.delete("/git/v1/repo/{repo}", {
|
|
3151
|
+
params: { repo: repoId }
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
class GitNamespace {
|
|
3156
|
+
constructor(apiClient, freestyle) {
|
|
3157
|
+
this.apiClient = apiClient;
|
|
3158
|
+
this.freestyle = freestyle;
|
|
3159
|
+
this.repos = new GitReposNamespace(apiClient);
|
|
3160
|
+
}
|
|
3161
|
+
repos;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
class Identity {
|
|
3165
|
+
constructor(identityId, apiClient) {
|
|
3166
|
+
this.apiClient = apiClient;
|
|
3167
|
+
this.identityId = identityId;
|
|
3168
|
+
this.permissions = new IdentityPermissions(identityId, apiClient);
|
|
3169
|
+
}
|
|
3170
|
+
identityId;
|
|
3171
|
+
permissions;
|
|
3172
|
+
/**
|
|
3173
|
+
* Create a new access token for this identity.
|
|
3174
|
+
*/
|
|
3175
|
+
async createToken() {
|
|
3176
|
+
const response = await this.apiClient.post(
|
|
3177
|
+
"/identity/v1/identities/{identity}/tokens",
|
|
3178
|
+
{
|
|
3179
|
+
params: { identity: this.identityId }
|
|
3180
|
+
}
|
|
3181
|
+
);
|
|
3182
|
+
return {
|
|
3183
|
+
tokenId: response.id,
|
|
3184
|
+
token: response.token
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
/**
|
|
3188
|
+
* Revoke an access token.
|
|
3189
|
+
*/
|
|
3190
|
+
async revokeToken({
|
|
3191
|
+
tokenId
|
|
3192
|
+
}) {
|
|
3193
|
+
return this.apiClient.delete(
|
|
3194
|
+
"/identity/v1/identities/{identity}/tokens/{token}",
|
|
3195
|
+
{
|
|
3196
|
+
params: { identity: this.identityId, token: tokenId }
|
|
3197
|
+
}
|
|
3198
|
+
);
|
|
3199
|
+
}
|
|
3200
|
+
/**
|
|
3201
|
+
* List access tokens for this identity.
|
|
3202
|
+
*/
|
|
3203
|
+
async listTokens() {
|
|
3204
|
+
return this.apiClient.get("/identity/v1/identities/{identity}/tokens", {
|
|
3205
|
+
params: { identity: this.identityId }
|
|
3206
|
+
});
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
class IdentityPermissions {
|
|
3210
|
+
constructor(identityId, apiClient) {
|
|
3211
|
+
this.identityId = identityId;
|
|
3212
|
+
this.apiClient = apiClient;
|
|
3213
|
+
this.git = new GitPermissions(identityId, apiClient);
|
|
3214
|
+
this.vms = new VmPermissions(identityId, apiClient);
|
|
3215
|
+
}
|
|
3216
|
+
git;
|
|
3217
|
+
vms;
|
|
3218
|
+
}
|
|
3219
|
+
class GitPermissions {
|
|
3220
|
+
constructor(identityId, apiClient) {
|
|
3221
|
+
this.identityId = identityId;
|
|
3222
|
+
this.apiClient = apiClient;
|
|
3223
|
+
}
|
|
3224
|
+
/**
|
|
3225
|
+
* List all git repository access permissions for this identity.
|
|
3226
|
+
*/
|
|
3227
|
+
async list({
|
|
3228
|
+
limit,
|
|
3229
|
+
cursor
|
|
3230
|
+
} = {}) {
|
|
3231
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3232
|
+
return this.apiClient.get(
|
|
3233
|
+
"/identity/v1/identities/{identity}/permissions/git",
|
|
3234
|
+
{
|
|
3235
|
+
params: { identity: this.identityId },
|
|
3236
|
+
query: { limit, offset }
|
|
3237
|
+
}
|
|
3238
|
+
);
|
|
3239
|
+
}
|
|
3240
|
+
/**
|
|
3241
|
+
* Get this identity's permission level for a specific repository.
|
|
3242
|
+
*/
|
|
3243
|
+
async get({
|
|
3244
|
+
repoId
|
|
3245
|
+
}) {
|
|
3246
|
+
return this.apiClient.get(
|
|
3247
|
+
"/identity/v1/identities/{identity}/permissions/git/{repo}",
|
|
3248
|
+
{
|
|
3249
|
+
params: { identity: this.identityId, repo: repoId }
|
|
3250
|
+
}
|
|
3251
|
+
);
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* Update this identity's access to a repository.
|
|
3255
|
+
*/
|
|
3256
|
+
async update({
|
|
3257
|
+
repoId,
|
|
3258
|
+
permission
|
|
3259
|
+
}) {
|
|
3260
|
+
return this.apiClient.put(
|
|
3261
|
+
"/identity/v1/identities/{identity}/permissions/git/{repo}",
|
|
3262
|
+
{
|
|
3263
|
+
params: { identity: this.identityId, repo: repoId },
|
|
3264
|
+
body: { permission }
|
|
3265
|
+
}
|
|
3266
|
+
);
|
|
3267
|
+
}
|
|
3268
|
+
/**
|
|
3269
|
+
* Grant this identity access to a repository.
|
|
3270
|
+
*/
|
|
3271
|
+
async create({
|
|
3272
|
+
repoId,
|
|
3273
|
+
permission
|
|
3274
|
+
}) {
|
|
3275
|
+
return this.apiClient.post(
|
|
3276
|
+
"/identity/v1/identities/{identity}/permissions/git/{repo}",
|
|
3277
|
+
{
|
|
3278
|
+
params: { identity: this.identityId, repo: repoId },
|
|
3279
|
+
body: { permission }
|
|
3280
|
+
}
|
|
3281
|
+
);
|
|
3282
|
+
}
|
|
3283
|
+
/**
|
|
3284
|
+
* Revoke this identity's access to a repository.
|
|
3285
|
+
*/
|
|
3286
|
+
async delete({
|
|
3287
|
+
repoId
|
|
3288
|
+
}) {
|
|
3289
|
+
return this.apiClient.delete(
|
|
3290
|
+
"/identity/v1/identities/{identity}/permissions/git/{repo}",
|
|
3291
|
+
{
|
|
3292
|
+
params: { identity: this.identityId, repo: repoId }
|
|
3293
|
+
}
|
|
3294
|
+
);
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
class VmPermissions {
|
|
3298
|
+
constructor(identityId, apiClient) {
|
|
3299
|
+
this.identityId = identityId;
|
|
3300
|
+
this.apiClient = apiClient;
|
|
3301
|
+
}
|
|
3302
|
+
/**
|
|
3303
|
+
* List all VM access permissions for this identity.
|
|
3304
|
+
*/
|
|
3305
|
+
async list({
|
|
3306
|
+
limit,
|
|
3307
|
+
cursor
|
|
3308
|
+
} = {}) {
|
|
3309
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3310
|
+
return this.apiClient.get(
|
|
3311
|
+
"/identity/v1/identities/{identity}/permissions/vm",
|
|
3312
|
+
{
|
|
3313
|
+
params: { identity: this.identityId },
|
|
3314
|
+
query: { limit, offset }
|
|
3315
|
+
}
|
|
3316
|
+
);
|
|
3317
|
+
}
|
|
3318
|
+
/**
|
|
3319
|
+
* Get this identity's permission level for a specific VM.
|
|
3320
|
+
*/
|
|
3321
|
+
async get({
|
|
3322
|
+
vmId
|
|
3323
|
+
}) {
|
|
3324
|
+
return this.apiClient.get(
|
|
3325
|
+
"/identity/v1/identities/{identity}/permissions/vm/{vm_id}",
|
|
3326
|
+
{
|
|
3327
|
+
params: { identity: this.identityId, vm_id: vmId }
|
|
3328
|
+
}
|
|
3329
|
+
);
|
|
3330
|
+
}
|
|
3331
|
+
/**
|
|
3332
|
+
* Update this identity's access to a VM.
|
|
3333
|
+
*/
|
|
3334
|
+
async update({
|
|
3335
|
+
vmId,
|
|
3336
|
+
allowedUsers
|
|
3337
|
+
}) {
|
|
3338
|
+
return this.apiClient.put(
|
|
3339
|
+
"/identity/v1/identities/{identity}/permissions/vm/{vm_id}",
|
|
3340
|
+
{
|
|
3341
|
+
params: { identity: this.identityId, vm_id: vmId },
|
|
3342
|
+
body: { allowedUsers }
|
|
3343
|
+
}
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Grant this identity access to a VM.
|
|
3348
|
+
*/
|
|
3349
|
+
async create({
|
|
3350
|
+
vmId,
|
|
3351
|
+
allowedUsers
|
|
3352
|
+
}) {
|
|
3353
|
+
return this.apiClient.post(
|
|
3354
|
+
"/identity/v1/identities/{identity}/permissions/vm/{vm_id}",
|
|
3355
|
+
{
|
|
3356
|
+
params: { identity: this.identityId, vm_id: vmId },
|
|
3357
|
+
body: { allowedUsers }
|
|
3358
|
+
}
|
|
3359
|
+
);
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* Revoke this identity's access to a VM.
|
|
3363
|
+
*/
|
|
3364
|
+
async delete({
|
|
3365
|
+
vmId
|
|
3366
|
+
}) {
|
|
3367
|
+
return this.apiClient.delete(
|
|
3368
|
+
"/identity/v1/identities/{identity}/permissions/vm/{vm_id}",
|
|
3369
|
+
{
|
|
3370
|
+
params: { identity: this.identityId, vm_id: vmId }
|
|
3371
|
+
}
|
|
3372
|
+
);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
class IdentitiesNamespace {
|
|
3376
|
+
constructor(apiClient) {
|
|
3377
|
+
this.apiClient = apiClient;
|
|
3378
|
+
}
|
|
3379
|
+
/**
|
|
3380
|
+
* List all identities.
|
|
3381
|
+
*/
|
|
3382
|
+
async list({
|
|
3383
|
+
limit,
|
|
3384
|
+
cursor
|
|
3385
|
+
} = {}) {
|
|
3386
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3387
|
+
return this.apiClient.get("/identity/v1/identities", {
|
|
3388
|
+
query: { limit, offset }
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
/**
|
|
3392
|
+
* Create a new identity.
|
|
3393
|
+
* Identities are global entities that can be granted permissions to access git repositories and VMs.
|
|
3394
|
+
*/
|
|
3395
|
+
async create({} = {}) {
|
|
3396
|
+
const response = await this.apiClient.post(
|
|
3397
|
+
"/identity/v1/identities",
|
|
3398
|
+
void 0
|
|
3399
|
+
);
|
|
3400
|
+
const identityId = response.id;
|
|
3401
|
+
return {
|
|
3402
|
+
identityId,
|
|
3403
|
+
identity: new Identity(identityId, this.apiClient)
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
/**
|
|
3407
|
+
* Create an identity instance by ID without making an api call.
|
|
3408
|
+
*/
|
|
3409
|
+
ref({ identityId }) {
|
|
3410
|
+
return new Identity(identityId, this.apiClient);
|
|
3411
|
+
}
|
|
3412
|
+
/**
|
|
3413
|
+
* Delete an identity.
|
|
3414
|
+
*/
|
|
3415
|
+
async delete({
|
|
3416
|
+
identityId
|
|
3417
|
+
}) {
|
|
3418
|
+
return this.apiClient.delete("/identity/v1/identities/{identity}", {
|
|
3419
|
+
params: { identity: identityId }
|
|
3420
|
+
});
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
class DnsRecordsNamespace {
|
|
3425
|
+
constructor(apiClient) {
|
|
3426
|
+
this.apiClient = apiClient;
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* Create DNS records.
|
|
3430
|
+
*/
|
|
3431
|
+
async create({
|
|
3432
|
+
...body
|
|
3433
|
+
}) {
|
|
3434
|
+
return this.apiClient.post("/dns/v1/records", { body });
|
|
3435
|
+
}
|
|
3436
|
+
/**
|
|
3437
|
+
* List DNS records.
|
|
3438
|
+
*/
|
|
3439
|
+
async list({
|
|
3440
|
+
...query
|
|
3441
|
+
} = {}) {
|
|
3442
|
+
return this.apiClient.get("/dns/v1/records", { query });
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* Delete DNS records.
|
|
3446
|
+
*/
|
|
3447
|
+
async delete({
|
|
3448
|
+
...query
|
|
3449
|
+
} = {}) {
|
|
3450
|
+
return this.apiClient.delete("/dns/v1/records", { query });
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
class DnsNamespace {
|
|
3454
|
+
constructor(apiClient) {
|
|
3455
|
+
this.apiClient = apiClient;
|
|
3456
|
+
this.records = new DnsRecordsNamespace(apiClient);
|
|
3457
|
+
}
|
|
3458
|
+
records;
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
class Deployment {
|
|
3462
|
+
constructor(deploymentId, apiClient) {
|
|
3463
|
+
this.apiClient = apiClient;
|
|
3464
|
+
this.deploymentId = deploymentId;
|
|
3465
|
+
}
|
|
3466
|
+
deploymentId;
|
|
3467
|
+
/**
|
|
3468
|
+
* Get details of this deployment (execute type).
|
|
3469
|
+
*/
|
|
3470
|
+
async getDetails() {
|
|
3471
|
+
return this.apiClient.get("/execute/v1/deployments/{deployment}", {
|
|
3472
|
+
params: { deployment: this.deploymentId }
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Get logs for this deployment.
|
|
3477
|
+
*/
|
|
3478
|
+
async getLogs() {
|
|
3479
|
+
return this.apiClient.get("/observability/v1/logs", {
|
|
3480
|
+
query: { deploymentId: this.deploymentId }
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
class DeploymentsNamespace {
|
|
3485
|
+
constructor(apiClient) {
|
|
3486
|
+
this.apiClient = apiClient;
|
|
3487
|
+
}
|
|
3488
|
+
/**
|
|
3489
|
+
* Create a web deployment on the edge.
|
|
3490
|
+
*/
|
|
3491
|
+
async create({ ...body }) {
|
|
3492
|
+
let source;
|
|
3493
|
+
if ("repo" in body) {
|
|
3494
|
+
source = {
|
|
3495
|
+
kind: "git",
|
|
3496
|
+
url: body.repo,
|
|
3497
|
+
branch: body.branch,
|
|
3498
|
+
dir: body.rootPath
|
|
3499
|
+
};
|
|
3500
|
+
} else if ("code" in body) {
|
|
3501
|
+
source = {
|
|
3502
|
+
kind: "files",
|
|
3503
|
+
files: {
|
|
3504
|
+
"index.js": {
|
|
3505
|
+
content: body.code
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
};
|
|
3509
|
+
} else if ("files" in body) {
|
|
3510
|
+
source = {
|
|
3511
|
+
kind: "files",
|
|
3512
|
+
files: Object.fromEntries(
|
|
3513
|
+
body.files.map((file) => [file.path, { content: file.content }])
|
|
3514
|
+
)
|
|
3515
|
+
};
|
|
3516
|
+
} else if ("tarUrl" in body) {
|
|
3517
|
+
source = {
|
|
3518
|
+
kind: "tar",
|
|
3519
|
+
url: body.tarUrl
|
|
3520
|
+
};
|
|
3521
|
+
} else {
|
|
3522
|
+
throw new Error(
|
|
3523
|
+
"Invalid deployment source. You must provide repo, code, files, or tarUrl."
|
|
3524
|
+
);
|
|
3525
|
+
}
|
|
3526
|
+
const response = await this.apiClient.post("/web/v1/deployment", {
|
|
3527
|
+
body: {
|
|
3528
|
+
source,
|
|
3529
|
+
config: {
|
|
3530
|
+
await: body.waitForRollout,
|
|
3531
|
+
build: body.build,
|
|
3532
|
+
domains: body.domains,
|
|
3533
|
+
networkPermissions: body.networkPermissions?.map((np) => ({
|
|
3534
|
+
action: np.action,
|
|
3535
|
+
query: np.domain,
|
|
3536
|
+
behavior: np.behavior
|
|
3537
|
+
})),
|
|
3538
|
+
envVars: body.envVars,
|
|
3539
|
+
nodeModules: body.nodeModules,
|
|
3540
|
+
timeout: body.timeoutMs,
|
|
3541
|
+
entrypoint: body.entrypointPath
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
});
|
|
3545
|
+
return {
|
|
3546
|
+
deploymentId: response.deploymentId,
|
|
3547
|
+
deployment: new Deployment(response.deploymentId, this.apiClient),
|
|
3548
|
+
domains: body.domains || []
|
|
3549
|
+
};
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* List web deployments.
|
|
3553
|
+
*/
|
|
3554
|
+
async list({
|
|
3555
|
+
limit = 50,
|
|
3556
|
+
cursor
|
|
3557
|
+
} = {}) {
|
|
3558
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3559
|
+
return this.apiClient.get("/web/v1/deployments", {
|
|
3560
|
+
query: { limit, offset }
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Get a deployment instance by ID.
|
|
3565
|
+
*/
|
|
3566
|
+
ref({ deploymentId }) {
|
|
3567
|
+
return new Deployment(deploymentId, this.apiClient);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
class RunsNamespace {
|
|
3571
|
+
constructor(apiClient) {
|
|
3572
|
+
this.apiClient = apiClient;
|
|
3573
|
+
}
|
|
3574
|
+
/**
|
|
3575
|
+
* Create and execute a script run.
|
|
3576
|
+
*/
|
|
3577
|
+
async create({
|
|
3578
|
+
code,
|
|
3579
|
+
...config
|
|
3580
|
+
}) {
|
|
3581
|
+
const response = await this.apiClient.post("/execute/v1/script", {
|
|
3582
|
+
body: {
|
|
3583
|
+
script: code,
|
|
3584
|
+
config: {
|
|
3585
|
+
customHeaders: config.customHeaders,
|
|
3586
|
+
networkPermissions: config.networkPermissions?.map((np) => ({
|
|
3587
|
+
action: np.action,
|
|
3588
|
+
query: np.domain,
|
|
3589
|
+
behavior: np.behavior
|
|
3590
|
+
})),
|
|
3591
|
+
envVars: config.envVars,
|
|
3592
|
+
nodeModules: config.nodeModules,
|
|
3593
|
+
timeout: config.timeoutMs
|
|
3594
|
+
// entrypoint: config.entrypointPath,
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
});
|
|
3598
|
+
if (!response.result && !response.logs) {
|
|
3599
|
+
throw new Error("Execution failed");
|
|
3600
|
+
}
|
|
3601
|
+
return {
|
|
3602
|
+
result: response.result,
|
|
3603
|
+
logs: response.logs || []
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
/**
|
|
3607
|
+
* List execution runs.
|
|
3608
|
+
*/
|
|
3609
|
+
async list({
|
|
3610
|
+
limit = 50,
|
|
3611
|
+
cursor
|
|
3612
|
+
} = {}) {
|
|
3613
|
+
const offset = cursor ? parseInt(cursor, 10) : 0;
|
|
3614
|
+
const res = await this.apiClient.get("/execute/v1/deployments", {
|
|
3615
|
+
query: { limit, offset }
|
|
3616
|
+
});
|
|
3617
|
+
return {
|
|
3618
|
+
runs: res.entries.map((item) => ({
|
|
3619
|
+
createdAt: item.provisionedAt,
|
|
3620
|
+
startedAt: item.startedAt || void 0,
|
|
3621
|
+
runId: item.deployment,
|
|
3622
|
+
status: item.state
|
|
3623
|
+
})),
|
|
3624
|
+
nextCursor: res.offset < res.total ? res.offset.toString() : void 0,
|
|
3625
|
+
totalCount: res.total
|
|
3626
|
+
};
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
class EdgeNamespace {
|
|
3630
|
+
constructor(apiClient) {
|
|
3631
|
+
this.apiClient = apiClient;
|
|
3632
|
+
this.deployments = new DeploymentsNamespace(apiClient);
|
|
3633
|
+
this.runs = new RunsNamespace(apiClient);
|
|
3634
|
+
}
|
|
3635
|
+
deployments;
|
|
3636
|
+
runs;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
class FileSystem {
|
|
3640
|
+
constructor(vmId, client) {
|
|
3641
|
+
this.vmId = vmId;
|
|
3642
|
+
this.client = client;
|
|
3643
|
+
}
|
|
3644
|
+
/**
|
|
3645
|
+
* Read a file from the VM as a buffer.
|
|
3646
|
+
* @param filepath The path to the file in the VM
|
|
3647
|
+
* @returns Buffer containing the file content
|
|
3648
|
+
*/
|
|
3649
|
+
async readFile(filepath) {
|
|
3650
|
+
const response = await this.client.get("/v1/vms/{vm_id}/files/{filepath}", {
|
|
3651
|
+
params: { vm_id: this.vmId, filepath }
|
|
3652
|
+
});
|
|
3653
|
+
if (response && typeof response === "object" && "content" in response) {
|
|
3654
|
+
const content = response.content;
|
|
3655
|
+
try {
|
|
3656
|
+
return Buffer.from(content, "base64");
|
|
3657
|
+
} catch {
|
|
3658
|
+
return Buffer.from(content, "utf-8");
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
throw new Error("Unexpected response format from VM file read");
|
|
3662
|
+
}
|
|
3663
|
+
/**
|
|
3664
|
+
* Write a file to the VM from a buffer.
|
|
3665
|
+
* @param filepath The path to the file in the VM
|
|
3666
|
+
* @param content Buffer containing the content to write
|
|
3667
|
+
*/
|
|
3668
|
+
async writeFile(filepath, content) {
|
|
3669
|
+
const base64Content = content.toString("base64");
|
|
3670
|
+
await this.client.put("/v1/vms/{vm_id}/files/{filepath}", {
|
|
3671
|
+
params: { vm_id: this.vmId, filepath },
|
|
3672
|
+
body: { content: base64Content }
|
|
3673
|
+
});
|
|
3674
|
+
}
|
|
3675
|
+
/**
|
|
3676
|
+
* Read a text file from the VM.
|
|
3677
|
+
* @param filepath The path to the file in the VM
|
|
3678
|
+
* @param encoding The text encoding to use (default: utf-8)
|
|
3679
|
+
* @returns The file content as a string
|
|
3680
|
+
*/
|
|
3681
|
+
async readTextFile(filepath, encoding = "utf-8") {
|
|
3682
|
+
const buffer = await this.readFile(filepath);
|
|
3683
|
+
return buffer.toString(encoding);
|
|
3684
|
+
}
|
|
3685
|
+
/**
|
|
3686
|
+
* Write a text file to the VM.
|
|
3687
|
+
* @param filepath The path to the file in the VM
|
|
3688
|
+
* @param content The text content to write
|
|
3689
|
+
* @param encoding The text encoding to use (default: utf-8)
|
|
3690
|
+
*/
|
|
3691
|
+
async writeTextFile(filepath, content, encoding = "utf-8") {
|
|
3692
|
+
const buffer = Buffer.from(content, encoding);
|
|
3693
|
+
await this.writeFile(filepath, buffer);
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* Read a directory from the VM.
|
|
3697
|
+
* @param path The path to the directory in the VM
|
|
3698
|
+
* @returns Array of file/directory names
|
|
3699
|
+
*/
|
|
3700
|
+
async readDir(path) {
|
|
3701
|
+
throw new Error("Not implemented");
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* Create a directory in the VM.
|
|
3705
|
+
* @param path The path to create
|
|
3706
|
+
*/
|
|
3707
|
+
async mkdir(path) {
|
|
3708
|
+
throw new Error("Not implemented");
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Remove a file or directory from the VM.
|
|
3712
|
+
* @param path The path to remove
|
|
3713
|
+
*/
|
|
3714
|
+
async remove(path) {
|
|
3715
|
+
throw new Error("Not implemented");
|
|
3716
|
+
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Check if a file or directory exists in the VM.
|
|
3719
|
+
* @param path The path to check
|
|
3720
|
+
* @returns True if exists, false otherwise
|
|
3721
|
+
*/
|
|
3722
|
+
async exists(path) {
|
|
3723
|
+
throw new Error("Not implemented");
|
|
3724
|
+
}
|
|
3725
|
+
/**
|
|
3726
|
+
* Get file/directory stats.
|
|
3727
|
+
* @param path The path to stat
|
|
3728
|
+
* @returns File/directory stats
|
|
3729
|
+
*/
|
|
3730
|
+
async stat(path) {
|
|
3731
|
+
throw new Error("Not implemented");
|
|
3732
|
+
}
|
|
3733
|
+
/**
|
|
3734
|
+
* Watch for file changes in the VM.
|
|
3735
|
+
* @returns An async generator that yields file change events
|
|
3736
|
+
*/
|
|
3737
|
+
async *watchFiles() {
|
|
3738
|
+
const response = await this.client.fetch(
|
|
3739
|
+
`/v1/vms/${this.vmId}/watch-files`,
|
|
3740
|
+
{
|
|
3741
|
+
method: "POST"
|
|
3742
|
+
}
|
|
3743
|
+
);
|
|
3744
|
+
if (!response.ok) {
|
|
3745
|
+
throw new Error(
|
|
3746
|
+
`Failed to watch files: ${response.status} ${response.statusText}`
|
|
3747
|
+
);
|
|
3748
|
+
}
|
|
3749
|
+
if (!response.body) {
|
|
3750
|
+
throw new Error("Failed to watch files: No response body");
|
|
3751
|
+
}
|
|
3752
|
+
const reader = response.body.getReader();
|
|
3753
|
+
const decoder = new TextDecoder("utf-8");
|
|
3754
|
+
let buffer = "";
|
|
3755
|
+
while (true) {
|
|
3756
|
+
const { done, value } = await reader.read();
|
|
3757
|
+
if (done) break;
|
|
3758
|
+
buffer += decoder.decode(value, { stream: true });
|
|
3759
|
+
let newlineIndex;
|
|
3760
|
+
while ((newlineIndex = buffer.indexOf("\n")) >= 0) {
|
|
3761
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
3762
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
3763
|
+
if (line) {
|
|
3764
|
+
yield JSON.parse(line);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
if (buffer.trim()) {
|
|
3769
|
+
yield JSON.parse(buffer.trim());
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3774
|
+
class VmWithInstance {
|
|
3775
|
+
vm;
|
|
3776
|
+
_init(vm) {
|
|
3777
|
+
this.vm = vm;
|
|
3778
|
+
return this;
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
class VmWith {
|
|
3782
|
+
instance;
|
|
3783
|
+
/**
|
|
3784
|
+
* Helper method to compose multiple configurations together.
|
|
3785
|
+
* Uses the same merging strategy as the main compose function.
|
|
3786
|
+
*/
|
|
3787
|
+
compose(...configs) {
|
|
3788
|
+
return composeCreateVmOptions(configs);
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
const VmService = VmWith;
|
|
3792
|
+
const VmBuilder = VmWith;
|
|
3793
|
+
function composeCreateVmOptions(arr) {
|
|
3794
|
+
const result = {};
|
|
3795
|
+
for (const options of arr) {
|
|
3796
|
+
if (options.idleTimeoutSeconds !== void 0)
|
|
3797
|
+
result.idleTimeoutSeconds = options.idleTimeoutSeconds;
|
|
3798
|
+
if (options.waitForReadySignal !== void 0)
|
|
3799
|
+
result.waitForReadySignal = options.waitForReadySignal;
|
|
3800
|
+
if (options.readySignalTimeoutSeconds !== void 0)
|
|
3801
|
+
result.readySignalTimeoutSeconds = options.readySignalTimeoutSeconds;
|
|
3802
|
+
if (options.workdir !== void 0) result.workdir = options.workdir;
|
|
3803
|
+
if (options.snapshotId !== void 0)
|
|
3804
|
+
result.snapshotId = options.snapshotId;
|
|
3805
|
+
if (options.recreate !== void 0) result.recreate = options.recreate;
|
|
3806
|
+
if (options.persistence !== void 0)
|
|
3807
|
+
result.persistence = options.persistence;
|
|
3808
|
+
if (options.ports !== void 0) {
|
|
3809
|
+
if (!result.ports) {
|
|
3810
|
+
result.ports = options.ports;
|
|
3811
|
+
} else if (options.ports !== null) {
|
|
3812
|
+
const existingPorts = result.ports || [];
|
|
3813
|
+
const newPorts = options.ports;
|
|
3814
|
+
const portMap = /* @__PURE__ */ new Map();
|
|
3815
|
+
for (const port of existingPorts) {
|
|
3816
|
+
portMap.set(port.port, port);
|
|
3817
|
+
}
|
|
3818
|
+
for (const port of newPorts) {
|
|
3819
|
+
portMap.set(port.port, port);
|
|
3820
|
+
}
|
|
3821
|
+
result.ports = Array.from(portMap.values());
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
if (options.systemd !== void 0) {
|
|
3825
|
+
if (!result.systemd) {
|
|
3826
|
+
result.systemd = options.systemd;
|
|
3827
|
+
} else if (options.systemd !== null) {
|
|
3828
|
+
if (options.systemd.services !== void 0) {
|
|
3829
|
+
const existingServices = result.systemd.services || [];
|
|
3830
|
+
const newServices = options.systemd.services || [];
|
|
3831
|
+
const serviceMap = /* @__PURE__ */ new Map();
|
|
3832
|
+
for (const service of existingServices) {
|
|
3833
|
+
serviceMap.set(service.name, service);
|
|
3834
|
+
}
|
|
3835
|
+
for (const service of newServices) {
|
|
3836
|
+
serviceMap.set(service.name, service);
|
|
3837
|
+
}
|
|
3838
|
+
result.systemd.services = Array.from(serviceMap.values());
|
|
3839
|
+
}
|
|
3840
|
+
if (options.systemd.patchedServices !== void 0) {
|
|
3841
|
+
const existingPatched = result.systemd.patchedServices || [];
|
|
3842
|
+
const newPatched = options.systemd.patchedServices || [];
|
|
3843
|
+
const patchedMap = /* @__PURE__ */ new Map();
|
|
3844
|
+
for (const service of existingPatched) {
|
|
3845
|
+
patchedMap.set(service.name, service);
|
|
3846
|
+
}
|
|
3847
|
+
for (const service of newPatched) {
|
|
3848
|
+
patchedMap.set(service.name, service);
|
|
3849
|
+
}
|
|
3850
|
+
result.systemd.patchedServices = Array.from(patchedMap.values());
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
if (options.users !== void 0) {
|
|
3855
|
+
if (!result.users) {
|
|
3856
|
+
result.users = options.users;
|
|
3857
|
+
} else if (options.users !== null) {
|
|
3858
|
+
const existingUsers = result.users || [];
|
|
3859
|
+
const newUsers = options.users;
|
|
3860
|
+
const userMap = /* @__PURE__ */ new Map();
|
|
3861
|
+
for (const user of existingUsers) {
|
|
3862
|
+
userMap.set(user.name, user);
|
|
3863
|
+
}
|
|
3864
|
+
for (const user of newUsers) {
|
|
3865
|
+
userMap.set(user.name, user);
|
|
3866
|
+
}
|
|
3867
|
+
result.users = Array.from(userMap.values());
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
if (options.groups !== void 0) {
|
|
3871
|
+
if (!result.groups) {
|
|
3872
|
+
result.groups = options.groups;
|
|
3873
|
+
} else if (options.groups !== null) {
|
|
3874
|
+
const existingGroups = result.groups || [];
|
|
3875
|
+
const newGroups = options.groups;
|
|
3876
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
3877
|
+
for (const group of existingGroups) {
|
|
3878
|
+
groupMap.set(group.name, group);
|
|
3879
|
+
}
|
|
3880
|
+
for (const group of newGroups) {
|
|
3881
|
+
groupMap.set(group.name, group);
|
|
3882
|
+
}
|
|
3883
|
+
result.groups = Array.from(groupMap.values());
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
if (options.additionalFiles !== void 0) {
|
|
3887
|
+
if (!result.additionalFiles) {
|
|
3888
|
+
result.additionalFiles = options.additionalFiles;
|
|
3889
|
+
} else if (options.additionalFiles !== null) {
|
|
3890
|
+
result.additionalFiles = {
|
|
3891
|
+
...result.additionalFiles,
|
|
3892
|
+
...options.additionalFiles
|
|
3893
|
+
};
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
if (options.gitRepos !== void 0) {
|
|
3897
|
+
if (!result.gitRepos) {
|
|
3898
|
+
result.gitRepos = options.gitRepos;
|
|
3899
|
+
} else if (options.gitRepos !== null) {
|
|
3900
|
+
const existingRepos = result.gitRepos || [];
|
|
3901
|
+
const newRepos = options.gitRepos;
|
|
3902
|
+
const repoMap = /* @__PURE__ */ new Map();
|
|
3903
|
+
for (const repo of existingRepos) {
|
|
3904
|
+
repoMap.set(repo.path, repo);
|
|
3905
|
+
}
|
|
3906
|
+
for (const repo of newRepos) {
|
|
3907
|
+
repoMap.set(repo.path, repo);
|
|
3908
|
+
}
|
|
3909
|
+
result.gitRepos = Array.from(repoMap.values());
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
if (options.template !== void 0) {
|
|
3913
|
+
if (!result.template) {
|
|
3914
|
+
result.template = options.template;
|
|
3915
|
+
} else if (options.template !== null) {
|
|
3916
|
+
const baseTemplate = result.template instanceof VmTemplate ? result.template["template"] : result.template;
|
|
3917
|
+
const newTemplate = options.template instanceof VmTemplate ? options.template["template"] : options.template;
|
|
3918
|
+
result.template = {
|
|
3919
|
+
// Simple overrides - start with base, override with new
|
|
3920
|
+
snapshotId: newTemplate.snapshotId !== void 0 ? newTemplate.snapshotId : baseTemplate.snapshotId,
|
|
3921
|
+
rootfsSizeMb: newTemplate.rootfsSizeMb !== void 0 ? newTemplate.rootfsSizeMb : baseTemplate.rootfsSizeMb,
|
|
3922
|
+
workdir: newTemplate.workdir !== void 0 ? newTemplate.workdir : baseTemplate.workdir,
|
|
3923
|
+
idleTimeoutSeconds: newTemplate.idleTimeoutSeconds !== void 0 ? newTemplate.idleTimeoutSeconds : baseTemplate.idleTimeoutSeconds,
|
|
3924
|
+
waitForReadySignal: newTemplate.waitForReadySignal !== void 0 ? newTemplate.waitForReadySignal : baseTemplate.waitForReadySignal,
|
|
3925
|
+
readySignalTimeoutSeconds: newTemplate.readySignalTimeoutSeconds !== void 0 ? newTemplate.readySignalTimeoutSeconds : baseTemplate.readySignalTimeoutSeconds,
|
|
3926
|
+
persistence: newTemplate.persistence !== void 0 ? newTemplate.persistence : baseTemplate.persistence,
|
|
3927
|
+
// Merge ports
|
|
3928
|
+
ports: (() => {
|
|
3929
|
+
if (newTemplate.ports === null) return null;
|
|
3930
|
+
if (!baseTemplate.ports) return newTemplate.ports;
|
|
3931
|
+
if (newTemplate.ports === void 0) return baseTemplate.ports;
|
|
3932
|
+
const portMap = /* @__PURE__ */ new Map();
|
|
3933
|
+
for (const port of baseTemplate.ports || []) {
|
|
3934
|
+
portMap.set(port.port, port);
|
|
3935
|
+
}
|
|
3936
|
+
for (const port of newTemplate.ports || []) {
|
|
3937
|
+
portMap.set(port.port, port);
|
|
3938
|
+
}
|
|
3939
|
+
return Array.from(portMap.values());
|
|
3940
|
+
})(),
|
|
3941
|
+
// Merge systemd
|
|
3942
|
+
systemd: (() => {
|
|
3943
|
+
if (newTemplate.systemd === null) return null;
|
|
3944
|
+
if (!baseTemplate.systemd) return newTemplate.systemd;
|
|
3945
|
+
if (newTemplate.systemd === void 0) return baseTemplate.systemd;
|
|
3946
|
+
const mergedSystemd = {
|
|
3947
|
+
...baseTemplate.systemd,
|
|
3948
|
+
...newTemplate.systemd
|
|
3949
|
+
};
|
|
3950
|
+
const baseServices = baseTemplate.systemd?.services || [];
|
|
3951
|
+
const newServices = newTemplate.systemd?.services || [];
|
|
3952
|
+
if (baseServices.length > 0 || newServices.length > 0) {
|
|
3953
|
+
const serviceMap = /* @__PURE__ */ new Map();
|
|
3954
|
+
for (const svc of baseServices) {
|
|
3955
|
+
serviceMap.set(svc.name, svc);
|
|
3956
|
+
}
|
|
3957
|
+
for (const svc of newServices) {
|
|
3958
|
+
serviceMap.set(svc.name, svc);
|
|
3959
|
+
}
|
|
3960
|
+
mergedSystemd.services = Array.from(serviceMap.values());
|
|
3961
|
+
}
|
|
3962
|
+
const basePatchedServices = baseTemplate.systemd?.patchedServices || [];
|
|
3963
|
+
const newPatchedServices = newTemplate.systemd?.patchedServices || [];
|
|
3964
|
+
if (basePatchedServices.length > 0 || newPatchedServices.length > 0) {
|
|
3965
|
+
const patchedMap = /* @__PURE__ */ new Map();
|
|
3966
|
+
for (const svc of basePatchedServices) {
|
|
3967
|
+
patchedMap.set(svc.name, svc);
|
|
3968
|
+
}
|
|
3969
|
+
for (const svc of newPatchedServices) {
|
|
3970
|
+
patchedMap.set(svc.name, svc);
|
|
3971
|
+
}
|
|
3972
|
+
mergedSystemd.patchedServices = Array.from(patchedMap.values());
|
|
3973
|
+
}
|
|
3974
|
+
return mergedSystemd;
|
|
3975
|
+
})(),
|
|
3976
|
+
// Merge users
|
|
3977
|
+
users: (() => {
|
|
3978
|
+
if (newTemplate.users === null) return null;
|
|
3979
|
+
if (!baseTemplate.users) return newTemplate.users;
|
|
3980
|
+
if (newTemplate.users === void 0) return baseTemplate.users;
|
|
3981
|
+
const userMap = /* @__PURE__ */ new Map();
|
|
3982
|
+
for (const user of baseTemplate.users || []) {
|
|
3983
|
+
userMap.set(user.name, user);
|
|
3984
|
+
}
|
|
3985
|
+
for (const user of newTemplate.users || []) {
|
|
3986
|
+
userMap.set(user.name, user);
|
|
3987
|
+
}
|
|
3988
|
+
return Array.from(userMap.values());
|
|
3989
|
+
})(),
|
|
3990
|
+
// Merge groups
|
|
3991
|
+
groups: (() => {
|
|
3992
|
+
if (newTemplate.groups === null) return null;
|
|
3993
|
+
if (!baseTemplate.groups) return newTemplate.groups;
|
|
3994
|
+
if (newTemplate.groups === void 0) return baseTemplate.groups;
|
|
3995
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
3996
|
+
for (const group of baseTemplate.groups || []) {
|
|
3997
|
+
groupMap.set(group.name, group);
|
|
3998
|
+
}
|
|
3999
|
+
for (const group of newTemplate.groups || []) {
|
|
4000
|
+
groupMap.set(group.name, group);
|
|
4001
|
+
}
|
|
4002
|
+
return Array.from(groupMap.values());
|
|
4003
|
+
})(),
|
|
4004
|
+
// Merge additionalFiles
|
|
4005
|
+
additionalFiles: (() => {
|
|
4006
|
+
if (newTemplate.additionalFiles === null) return null;
|
|
4007
|
+
if (!baseTemplate.additionalFiles)
|
|
4008
|
+
return newTemplate.additionalFiles;
|
|
4009
|
+
if (newTemplate.additionalFiles === void 0)
|
|
4010
|
+
return baseTemplate.additionalFiles;
|
|
4011
|
+
return {
|
|
4012
|
+
...baseTemplate.additionalFiles,
|
|
4013
|
+
...newTemplate.additionalFiles
|
|
4014
|
+
};
|
|
4015
|
+
})(),
|
|
4016
|
+
// Merge gitRepos
|
|
4017
|
+
gitRepos: (() => {
|
|
4018
|
+
if (newTemplate.gitRepos === null) return null;
|
|
4019
|
+
if (!baseTemplate.gitRepos) return newTemplate.gitRepos;
|
|
4020
|
+
if (newTemplate.gitRepos === void 0)
|
|
4021
|
+
return baseTemplate.gitRepos;
|
|
4022
|
+
const repoMap = /* @__PURE__ */ new Map();
|
|
4023
|
+
for (const repo of baseTemplate.gitRepos || []) {
|
|
4024
|
+
repoMap.set(repo.path, repo);
|
|
4025
|
+
}
|
|
4026
|
+
for (const repo of newTemplate.gitRepos || []) {
|
|
4027
|
+
repoMap.set(repo.path, repo);
|
|
4028
|
+
}
|
|
4029
|
+
return Array.from(repoMap.values());
|
|
4030
|
+
})()
|
|
4031
|
+
};
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
return result;
|
|
4036
|
+
}
|
|
4037
|
+
|
|
4038
|
+
class VmTerminals {
|
|
4039
|
+
constructor(vmId, client) {
|
|
4040
|
+
this.vmId = vmId;
|
|
4041
|
+
this.client = client;
|
|
4042
|
+
}
|
|
4043
|
+
/**
|
|
4044
|
+
* List all terminals in the VM.
|
|
4045
|
+
* @returns Array of terminal information
|
|
4046
|
+
*/
|
|
4047
|
+
async list() {
|
|
4048
|
+
return this.client.get("/v1/vms/{vm_id}/terminals", {
|
|
4049
|
+
params: { vm_id: this.vmId }
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
/**
|
|
4053
|
+
* Get logs from a specific terminal.
|
|
4054
|
+
* @param terminalId The ID of the terminal
|
|
4055
|
+
* @returns Terminal log entries
|
|
4056
|
+
*/
|
|
4057
|
+
async getLogs({ terminalId }) {
|
|
4058
|
+
return this.client.get("/v1/vms/{vm_id}/terminals/{terminal_id}/logs", {
|
|
4059
|
+
params: { vm_id: this.vmId, terminal_id: terminalId }
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4062
|
+
/**
|
|
4063
|
+
* Get xterm-256color output from a specific terminal.
|
|
4064
|
+
* @param terminalId The ID of the terminal
|
|
4065
|
+
* @returns Terminal output
|
|
4066
|
+
*/
|
|
4067
|
+
async getOutput({ terminalId }) {
|
|
4068
|
+
return this.client.get(
|
|
4069
|
+
"/v1/vms/{vm_id}/terminals/{terminal_id}/xterm-256color",
|
|
4070
|
+
{
|
|
4071
|
+
params: { vm_id: this.vmId, terminal_id: terminalId }
|
|
4072
|
+
}
|
|
4073
|
+
);
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
class Vm {
|
|
4077
|
+
constructor(vmId, apiClient) {
|
|
4078
|
+
this.apiClient = apiClient;
|
|
4079
|
+
this.vmId = vmId;
|
|
4080
|
+
this.fs = new FileSystem(vmId, apiClient);
|
|
4081
|
+
this.terminals = new VmTerminals(vmId, apiClient);
|
|
4082
|
+
}
|
|
4083
|
+
vmId;
|
|
4084
|
+
fs;
|
|
4085
|
+
terminals;
|
|
4086
|
+
/**
|
|
4087
|
+
* Get the current state and metadata of the VM.
|
|
4088
|
+
* @returns VM state information
|
|
4089
|
+
*/
|
|
4090
|
+
async getInfo() {
|
|
4091
|
+
return this.apiClient.get("/v1/vms/{vm_id}", {
|
|
4092
|
+
params: { vm_id: this.vmId }
|
|
4093
|
+
});
|
|
4094
|
+
}
|
|
4095
|
+
/**
|
|
4096
|
+
* Start the VM.
|
|
4097
|
+
* @param options Optional startup configuration
|
|
4098
|
+
* @returns Start response with VM information
|
|
4099
|
+
*/
|
|
4100
|
+
async start({ ...options } = {}) {
|
|
4101
|
+
return this.apiClient.post("/v1/vms/{vm_id}/start", {
|
|
4102
|
+
params: { vm_id: this.vmId },
|
|
4103
|
+
body: options
|
|
4104
|
+
});
|
|
4105
|
+
}
|
|
4106
|
+
/**
|
|
4107
|
+
* Stop the VM gracefully.
|
|
4108
|
+
* @returns Stop response
|
|
4109
|
+
*/
|
|
4110
|
+
async stop() {
|
|
4111
|
+
return this.apiClient.post("/v1/vms/{vm_id}/stop", {
|
|
4112
|
+
params: { vm_id: this.vmId }
|
|
4113
|
+
});
|
|
4114
|
+
}
|
|
4115
|
+
/**
|
|
4116
|
+
* Suspend the VM to disk.
|
|
4117
|
+
* @returns Suspend response
|
|
4118
|
+
*/
|
|
4119
|
+
async suspend() {
|
|
4120
|
+
return this.apiClient.post("/v1/vms/{vm_id}/suspend", {
|
|
4121
|
+
params: { vm_id: this.vmId }
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
/**
|
|
4125
|
+
* Kill the VM immediately.
|
|
4126
|
+
* @returns Kill response
|
|
4127
|
+
*/
|
|
4128
|
+
async kill() {
|
|
4129
|
+
return this.apiClient.post("/v1/vms/{vm_id}/kill", {
|
|
4130
|
+
params: { vm_id: this.vmId }
|
|
4131
|
+
});
|
|
4132
|
+
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Wait for the VM to exit.
|
|
4135
|
+
* @returns Await response with exit information
|
|
4136
|
+
*/
|
|
4137
|
+
async waitForExit() {
|
|
4138
|
+
return this.apiClient.post("/v1/vms/{vm_id}/await", {
|
|
4139
|
+
params: { vm_id: this.vmId }
|
|
4140
|
+
});
|
|
4141
|
+
}
|
|
4142
|
+
/**
|
|
4143
|
+
* Execute a command in the VM and wait for it to complete.
|
|
4144
|
+
* @param command The command to execute
|
|
4145
|
+
* @param terminal Optional terminal ID
|
|
4146
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
4147
|
+
* @returns Execution result with stdout/stderr
|
|
4148
|
+
*/
|
|
4149
|
+
async exec(options) {
|
|
4150
|
+
if (typeof options === "string") {
|
|
4151
|
+
options = { command: options };
|
|
4152
|
+
}
|
|
4153
|
+
const { command, terminal, timeoutMs } = options;
|
|
4154
|
+
return this.apiClient.post("/v1/vms/{vm_id}/exec-await", {
|
|
4155
|
+
params: { vm_id: this.vmId },
|
|
4156
|
+
body: {
|
|
4157
|
+
command,
|
|
4158
|
+
terminal: terminal ?? null,
|
|
4159
|
+
timeoutMs: timeoutMs ?? null
|
|
4160
|
+
}
|
|
4161
|
+
});
|
|
4162
|
+
}
|
|
4163
|
+
/**
|
|
4164
|
+
* Fork (clone) the VM.
|
|
4165
|
+
* @param options Optional fork configuration
|
|
4166
|
+
* @returns A new VM instance representing the forked VM
|
|
4167
|
+
*/
|
|
4168
|
+
async fork({
|
|
4169
|
+
...options
|
|
4170
|
+
} = {}) {
|
|
4171
|
+
const response = await this.apiClient.post("/v1/vms/{vm_id}/fork", {
|
|
4172
|
+
params: { vm_id: this.vmId },
|
|
4173
|
+
body: options
|
|
4174
|
+
});
|
|
4175
|
+
const vmId = response.id;
|
|
4176
|
+
return {
|
|
4177
|
+
vmId,
|
|
4178
|
+
vm: new Vm(vmId, this.apiClient)
|
|
4179
|
+
};
|
|
4180
|
+
}
|
|
4181
|
+
/**
|
|
4182
|
+
* Optimize the VM (compact memory/disk).
|
|
4183
|
+
* @returns Optimization response
|
|
4184
|
+
*/
|
|
4185
|
+
async optimize() {
|
|
4186
|
+
return this.apiClient.post("/v1/vms/{vm_id}/optimize", {
|
|
4187
|
+
params: { vm_id: this.vmId }
|
|
4188
|
+
});
|
|
4189
|
+
}
|
|
4190
|
+
/**
|
|
4191
|
+
* Resize the VM's disk.
|
|
4192
|
+
* @param sizeMb New disk size in megabytes
|
|
4193
|
+
* @returns Resize response
|
|
4194
|
+
*/
|
|
4195
|
+
async resize({
|
|
4196
|
+
sizeMb
|
|
4197
|
+
}) {
|
|
4198
|
+
return this.apiClient.post("/v1/vms/{id}/resize", {
|
|
4199
|
+
params: { id: this.vmId },
|
|
4200
|
+
body: { sizeMb }
|
|
4201
|
+
});
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
class VmSnapshotsNamespace {
|
|
4205
|
+
constructor(apiClient) {
|
|
4206
|
+
this.apiClient = apiClient;
|
|
4207
|
+
}
|
|
4208
|
+
async ensure(options) {
|
|
4209
|
+
return this.apiClient.post("/v1/vms/snapshots", {
|
|
4210
|
+
body: {
|
|
4211
|
+
...options,
|
|
4212
|
+
// @ts-ignore
|
|
4213
|
+
template: options.template?.template
|
|
4214
|
+
}
|
|
4215
|
+
});
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
class VmsNamespace {
|
|
4219
|
+
constructor(apiClient) {
|
|
4220
|
+
this.apiClient = apiClient;
|
|
4221
|
+
this.snapshots = new VmSnapshotsNamespace(apiClient);
|
|
4222
|
+
}
|
|
4223
|
+
snapshots;
|
|
4224
|
+
/**
|
|
4225
|
+
* Create a new VM.
|
|
4226
|
+
* @param options Optional VM configuration
|
|
4227
|
+
* @returns A VM instance representing the created VM
|
|
4228
|
+
*/
|
|
4229
|
+
async create(options = {}) {
|
|
4230
|
+
const builders = options.with || {};
|
|
4231
|
+
const { with: _, ...baseConfig } = options;
|
|
4232
|
+
let config = baseConfig;
|
|
4233
|
+
const keys = Object.keys(builders);
|
|
4234
|
+
for (const key of keys) {
|
|
4235
|
+
const builder = builders[key];
|
|
4236
|
+
if (builder) {
|
|
4237
|
+
config = await builder.configure(config);
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
const response = await this.apiClient.post("/v1/vms", {
|
|
4241
|
+
body: {
|
|
4242
|
+
...config,
|
|
4243
|
+
template: config.template instanceof VmTemplate ? config.template["template"] : config.template
|
|
4244
|
+
}
|
|
4245
|
+
});
|
|
4246
|
+
const vmId = response.id;
|
|
4247
|
+
const vm = new Vm(vmId, this.apiClient);
|
|
4248
|
+
for (const key in builders) {
|
|
4249
|
+
const builder = builders[key];
|
|
4250
|
+
if (builder) {
|
|
4251
|
+
const instance = builder.createInstance();
|
|
4252
|
+
builder.createInstance = () => {
|
|
4253
|
+
throw new Error(
|
|
4254
|
+
`Attempted to create multiple instances from the same VmWith ${key}: ${builder.constructor.name}`
|
|
4255
|
+
);
|
|
4256
|
+
};
|
|
4257
|
+
builder.instance = instance;
|
|
4258
|
+
instance._init(vm);
|
|
4259
|
+
vm[key] = instance;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
return {
|
|
4263
|
+
...response,
|
|
4264
|
+
vmId,
|
|
4265
|
+
vm,
|
|
4266
|
+
domains: response.domains || []
|
|
4267
|
+
};
|
|
4268
|
+
}
|
|
4269
|
+
/**
|
|
4270
|
+
* List all VMs.
|
|
4271
|
+
* @returns List of VMs with their states and metadata
|
|
4272
|
+
*/
|
|
4273
|
+
async list() {
|
|
4274
|
+
return this.apiClient.get("/v1/vms", void 0);
|
|
4275
|
+
}
|
|
4276
|
+
/**
|
|
4277
|
+
* Create a VM instance by ID without making an api call.
|
|
4278
|
+
*/
|
|
4279
|
+
ref({ vmId }) {
|
|
4280
|
+
return new Vm(vmId, this.apiClient);
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
class VmTemplate {
|
|
4284
|
+
template;
|
|
4285
|
+
constructor(template) {
|
|
4286
|
+
this.template = template;
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
class Freestyle {
|
|
4291
|
+
apiClient;
|
|
4292
|
+
// Organized namespaces
|
|
4293
|
+
domains;
|
|
4294
|
+
git;
|
|
4295
|
+
identities;
|
|
4296
|
+
dns;
|
|
4297
|
+
edge;
|
|
4298
|
+
vms;
|
|
4299
|
+
constructor(options = {}) {
|
|
4300
|
+
options.baseUrl ?? process.env.FREESTYLE_API_URL;
|
|
4301
|
+
let apiKey;
|
|
4302
|
+
if ("accessToken" in options && options.accessToken) {
|
|
4303
|
+
options.accessToken;
|
|
4304
|
+
} else {
|
|
4305
|
+
apiKey = options.apiKey ?? process.env.FREESTYLE_API_KEY;
|
|
4306
|
+
if (!apiKey) {
|
|
4307
|
+
throw new Error(
|
|
4308
|
+
"API key is required. Please provide it in the constructor or set the FREESTYLE_API_KEY environment variable."
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4312
|
+
this.apiClient = new ApiClient(options);
|
|
4313
|
+
this.domains = new DomainsNamespace(this.apiClient);
|
|
4314
|
+
this.git = new GitNamespace(this.apiClient, this);
|
|
4315
|
+
this.identities = new IdentitiesNamespace(this.apiClient);
|
|
4316
|
+
this.dns = new DnsNamespace(this.apiClient);
|
|
4317
|
+
this.edge = new EdgeNamespace(this.apiClient);
|
|
4318
|
+
this.vms = new VmsNamespace(this.apiClient);
|
|
4319
|
+
}
|
|
4320
|
+
/**
|
|
4321
|
+
* Helper method to make raw fetch requests to the API.
|
|
4322
|
+
*/
|
|
4323
|
+
fetch(path, init) {
|
|
4324
|
+
return this.apiClient.fetch(path, init);
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
function createLazyFreestyle(options = {}) {
|
|
4328
|
+
let instance = null;
|
|
4329
|
+
const getOrCreateInstance = () => {
|
|
4330
|
+
if (!instance) {
|
|
4331
|
+
instance = new Freestyle(options);
|
|
4332
|
+
}
|
|
4333
|
+
return instance;
|
|
4334
|
+
};
|
|
4335
|
+
return new Proxy({}, {
|
|
4336
|
+
get(_target, prop) {
|
|
4337
|
+
const inst = getOrCreateInstance();
|
|
4338
|
+
const value = inst[prop];
|
|
4339
|
+
if (typeof value === "function") {
|
|
4340
|
+
return value.bind(inst);
|
|
4341
|
+
}
|
|
4342
|
+
return value;
|
|
4343
|
+
}
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
const freestyle = createLazyFreestyle();
|
|
4347
|
+
|
|
4348
|
+
export { Deployment, errors as Errors, FileSystem, Freestyle, GitRepo, Identity, Vm, VmBuilder, VmService, VmTemplate, VmWith, VmWithInstance, freestyle };
|