freestyle-sandboxes 0.1.15 → 0.1.17

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.
Files changed (5) hide show
  1. package/index.cjs +1688 -1156
  2. package/index.d.cts +1656 -1299
  3. package/index.d.mts +1656 -1299
  4. package/index.mjs +1687 -1157
  5. package/package.json +27 -24
package/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var path = require('path');
4
+
3
5
  function errorFromJSON(body) {
4
6
  const ErrorClass = FREESTYLE_ERROR_CODE_MAP[body.code];
5
7
  if (ErrorClass) {
@@ -20,233 +22,257 @@ class GitErrorError extends Error {
20
22
  static statusCode = 500;
21
23
  static description = `{message}`;
22
24
  }
23
- class UserNotFoundError extends Error {
25
+ class BadParseError extends Error {
24
26
  constructor(body) {
25
27
  super(
26
- `USER_NOT_FOUND: ${body.message}`
28
+ `BAD_PARSE: ${body.message}`
27
29
  );
28
30
  this.body = body;
29
- this.name = "UserNotFoundError";
31
+ this.name = "BadParseError";
30
32
  }
31
- static code = "USER_NOT_FOUND";
32
- static statusCode = 404;
33
- static description = `User not found: {user_name}`;
33
+ static code = "BAD_PARSE";
34
+ static statusCode = 400;
35
+ static description = `error parsing event object: {0}`;
34
36
  }
35
- class UserAlreadyExistsError extends Error {
37
+ class BadTimestampError extends Error {
36
38
  constructor(body) {
37
39
  super(
38
- `USER_ALREADY_EXISTS: ${body.message}`
40
+ `BAD_TIMESTAMP: ${body.message}`
39
41
  );
40
42
  this.body = body;
41
- this.name = "UserAlreadyExistsError";
43
+ this.name = "BadTimestampError";
42
44
  }
43
- static code = "USER_ALREADY_EXISTS";
44
- static statusCode = 409;
45
- static description = `Conflict: User '{user_name}' already exists`;
45
+ static code = "BAD_TIMESTAMP";
46
+ static statusCode = 403;
47
+ static description = `error comparing timestamps - over tolerance`;
46
48
  }
47
- class ValidationErrorError extends Error {
49
+ class BadSignatureError extends Error {
48
50
  constructor(body) {
49
51
  super(
50
- `VALIDATION_ERROR: ${body.message}`
52
+ `BAD_SIGNATURE: ${body.message}`
51
53
  );
52
54
  this.body = body;
53
- this.name = "ValidationErrorError";
55
+ this.name = "BadSignatureError";
54
56
  }
55
- static code = "VALIDATION_ERROR";
56
- static statusCode = 400;
57
- static description = `Validation error: {message}`;
57
+ static code = "BAD_SIGNATURE";
58
+ static statusCode = 403;
59
+ static description = `error comparing signatures`;
58
60
  }
59
- class GroupNotFoundError extends Error {
61
+ class BadHeaderError extends Error {
60
62
  constructor(body) {
61
63
  super(
62
- `GROUP_NOT_FOUND: ${body.message}`
64
+ `BAD_HEADER: ${body.message}`
63
65
  );
64
66
  this.body = body;
65
- this.name = "GroupNotFoundError";
67
+ this.name = "BadHeaderError";
66
68
  }
67
- static code = "GROUP_NOT_FOUND";
68
- static statusCode = 404;
69
- static description = `Group not found: {group_name}`;
69
+ static code = "BAD_HEADER";
70
+ static statusCode = 400;
71
+ static description = `error parsing timestamp: {0}`;
70
72
  }
71
- class GroupAlreadyExistsError extends Error {
73
+ class BadKeyError extends Error {
72
74
  constructor(body) {
73
75
  super(
74
- `GROUP_ALREADY_EXISTS: ${body.message}`
76
+ `BAD_KEY: ${body.message}`
75
77
  );
76
78
  this.body = body;
77
- this.name = "GroupAlreadyExistsError";
79
+ this.name = "BadKeyError";
78
80
  }
79
- static code = "GROUP_ALREADY_EXISTS";
80
- static statusCode = 409;
81
- static description = `Conflict: Group '{group_name}' already exists`;
81
+ static code = "BAD_KEY";
82
+ static statusCode = 400;
83
+ static description = `invalid key length`;
82
84
  }
83
- class DuplicateUserNameError extends Error {
85
+ class SnapshotVmBadRequestError extends Error {
84
86
  constructor(body) {
85
87
  super(
86
- `DUPLICATE_USER_NAME: ${body.message}`
88
+ `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
87
89
  );
88
90
  this.body = body;
89
- this.name = "DuplicateUserNameError";
91
+ this.name = "SnapshotVmBadRequestError";
90
92
  }
91
- static code = "DUPLICATE_USER_NAME";
93
+ static code = "SNAPSHOT_VM_BAD_REQUEST";
92
94
  static statusCode = 400;
93
- static description = `Duplicate user name '{name}' found`;
95
+ static description = `Bad request: {message}`;
94
96
  }
95
- class UserGroupEmptyError extends Error {
97
+ class ResumedVmNonResponsiveError extends Error {
96
98
  constructor(body) {
97
99
  super(
98
- `USER_GROUP_EMPTY: ${body.message}`
100
+ `RESUMED_VM_NON_RESPONSIVE: ${body.message}`
99
101
  );
100
102
  this.body = body;
101
- this.name = "UserGroupEmptyError";
103
+ this.name = "ResumedVmNonResponsiveError";
102
104
  }
103
- static code = "USER_GROUP_EMPTY";
104
- static statusCode = 400;
105
- static description = `User '{user}' has empty string in groups`;
105
+ static code = "RESUMED_VM_NON_RESPONSIVE";
106
+ static statusCode = 500;
107
+ static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
106
108
  }
107
- class UserSystemFlagMismatchError extends Error {
109
+ class SnapshotLoadTimeoutError extends Error {
108
110
  constructor(body) {
109
111
  super(
110
- `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
112
+ `SNAPSHOT_LOAD_TIMEOUT: ${body.message}`
111
113
  );
112
114
  this.body = body;
113
- this.name = "UserSystemFlagMismatchError";
115
+ this.name = "SnapshotLoadTimeoutError";
114
116
  }
115
- static code = "USER_SYSTEM_FLAG_MISMATCH";
116
- static statusCode = 400;
117
- static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
117
+ static code = "SNAPSHOT_LOAD_TIMEOUT";
118
+ static statusCode = 500;
119
+ static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
118
120
  }
119
- class UserUidOutOfRangeError extends Error {
121
+ class UffdTimeoutErrorError extends Error {
120
122
  constructor(body) {
121
123
  super(
122
- `USER_UID_OUT_OF_RANGE: ${body.message}`
124
+ `UFFD_TIMEOUT_ERROR: ${body.message}`
123
125
  );
124
126
  this.body = body;
125
- this.name = "UserUidOutOfRangeError";
127
+ this.name = "UffdTimeoutErrorError";
126
128
  }
127
- static code = "USER_UID_OUT_OF_RANGE";
128
- static statusCode = 400;
129
- static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
129
+ static code = "UFFD_TIMEOUT_ERROR";
130
+ static statusCode = 500;
131
+ static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
130
132
  }
131
- class UserHomeInvalidError extends Error {
133
+ class KernelPanicError extends Error {
132
134
  constructor(body) {
133
135
  super(
134
- `USER_HOME_INVALID: ${body.message}`
136
+ `KERNEL_PANIC: ${body.message}`
135
137
  );
136
138
  this.body = body;
137
- this.name = "UserHomeInvalidError";
139
+ this.name = "KernelPanicError";
138
140
  }
139
- static code = "USER_HOME_INVALID";
140
- static statusCode = 400;
141
- static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
141
+ static code = "KERNEL_PANIC";
142
+ static statusCode = 500;
143
+ static description = `VM kernel panic detected`;
142
144
  }
143
- class UserShellInvalidError extends Error {
145
+ class VmDeletedError extends Error {
144
146
  constructor(body) {
145
147
  super(
146
- `USER_SHELL_INVALID: ${body.message}`
148
+ `VM_DELETED: ${body.message}`
147
149
  );
148
150
  this.body = body;
149
- this.name = "UserShellInvalidError";
151
+ this.name = "VmDeletedError";
150
152
  }
151
- static code = "USER_SHELL_INVALID";
152
- static statusCode = 400;
153
- static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
153
+ static code = "VM_DELETED";
154
+ static statusCode = 410;
155
+ static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
154
156
  }
155
- class DuplicateGroupNameError extends Error {
157
+ class ReqwestError extends Error {
156
158
  constructor(body) {
157
159
  super(
158
- `DUPLICATE_GROUP_NAME: ${body.message}`
160
+ `REQWEST: ${body.message}`
159
161
  );
160
162
  this.body = body;
161
- this.name = "DuplicateGroupNameError";
163
+ this.name = "ReqwestError";
162
164
  }
163
- static code = "DUPLICATE_GROUP_NAME";
164
- static statusCode = 400;
165
- static description = `Duplicate group name '{name}' found`;
165
+ static code = "REQWEST";
166
+ static statusCode = 500;
167
+ static description = `Reqwest error: {details}`;
166
168
  }
167
- class GroupNameReservedError extends Error {
169
+ class FirecrackerPidNotFoundError extends Error {
168
170
  constructor(body) {
169
171
  super(
170
- `GROUP_NAME_RESERVED: ${body.message}`
172
+ `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
171
173
  );
172
174
  this.body = body;
173
- this.name = "GroupNameReservedError";
175
+ this.name = "FirecrackerPidNotFoundError";
174
176
  }
175
- static code = "GROUP_NAME_RESERVED";
176
- static statusCode = 400;
177
- static description = `Group name '{name}' is reserved and cannot be used`;
177
+ static code = "FIRECRACKER_PID_NOT_FOUND";
178
+ static statusCode = 500;
179
+ static description = `Firecracker PID not found`;
178
180
  }
179
- class GroupNameInvalidCharsError extends Error {
181
+ class FirecrackerApiSocketNotFoundError extends Error {
180
182
  constructor(body) {
181
183
  super(
182
- `GROUP_NAME_INVALID_CHARS: ${body.message}`
184
+ `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
183
185
  );
184
186
  this.body = body;
185
- this.name = "GroupNameInvalidCharsError";
187
+ this.name = "FirecrackerApiSocketNotFoundError";
186
188
  }
187
- static code = "GROUP_NAME_INVALID_CHARS";
188
- static statusCode = 400;
189
- static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
189
+ static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
190
+ static statusCode = 500;
191
+ static description = `Firecracker API socket not found`;
190
192
  }
191
- class GroupNameTooLongError extends Error {
193
+ class InvalidSnapshotIdError extends Error {
192
194
  constructor(body) {
193
195
  super(
194
- `GROUP_NAME_TOO_LONG: ${body.message}`
196
+ `INVALID_SNAPSHOT_ID: ${body.message}`
195
197
  );
196
198
  this.body = body;
197
- this.name = "GroupNameTooLongError";
199
+ this.name = "InvalidSnapshotIdError";
198
200
  }
199
- static code = "GROUP_NAME_TOO_LONG";
201
+ static code = "INVALID_SNAPSHOT_ID";
200
202
  static statusCode = 400;
201
- static description = `Group name '{name}' is too long (max {max_length} characters)`;
203
+ static description = `Invalid snapshot id: {id}`;
202
204
  }
203
- class GroupNameEmptyError extends Error {
205
+ class VmStartTimeoutError extends Error {
204
206
  constructor(body) {
205
207
  super(
206
- `GROUP_NAME_EMPTY: ${body.message}`
208
+ `VM_START_TIMEOUT: ${body.message}`
207
209
  );
208
210
  this.body = body;
209
- this.name = "GroupNameEmptyError";
211
+ this.name = "VmStartTimeoutError";
210
212
  }
211
- static code = "GROUP_NAME_EMPTY";
212
- static statusCode = 400;
213
- static description = `Group name cannot be empty`;
213
+ static code = "VM_START_TIMEOUT";
214
+ static statusCode = 504;
215
+ static description = `VM did not become ready within the specified timeout`;
214
216
  }
215
- class SnapshotVmBadRequestError extends Error {
217
+ class VmExitDuringStartError extends Error {
216
218
  constructor(body) {
217
219
  super(
218
- `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
220
+ `VM_EXIT_DURING_START: ${body.message}`
219
221
  );
220
222
  this.body = body;
221
- this.name = "SnapshotVmBadRequestError";
223
+ this.name = "VmExitDuringStartError";
222
224
  }
223
- static code = "SNAPSHOT_VM_BAD_REQUEST";
224
- static statusCode = 400;
225
- static description = `Bad request: {message}`;
225
+ static code = "VM_EXIT_DURING_START";
226
+ static statusCode = 500;
227
+ static description = `VM process exited unexpectedly during start`;
226
228
  }
227
- class FileNotFoundError extends Error {
229
+ class VmAccessDeniedError extends Error {
228
230
  constructor(body) {
229
231
  super(
230
- `FILE_NOT_FOUND: ${body.message}`
232
+ `VM_ACCESS_DENIED: ${body.message}`
231
233
  );
232
234
  this.body = body;
233
- this.name = "FileNotFoundError";
235
+ this.name = "VmAccessDeniedError";
234
236
  }
235
- static code = "FILE_NOT_FOUND";
236
- static statusCode = 404;
237
- static description = `File not found: {path}`;
237
+ static code = "VM_ACCESS_DENIED";
238
+ static statusCode = 403;
239
+ static description = `You do not have access to this VM`;
238
240
  }
239
- class FilesBadRequestError extends Error {
241
+ class StdIoError extends Error {
240
242
  constructor(body) {
241
243
  super(
242
- `FILES_BAD_REQUEST: ${body.message}`
244
+ `STD_IO: ${body.message}`
243
245
  );
244
246
  this.body = body;
245
- this.name = "FilesBadRequestError";
247
+ this.name = "StdIoError";
246
248
  }
247
- static code = "FILES_BAD_REQUEST";
248
- static statusCode = 400;
249
- static description = `Bad request: {message}`;
249
+ static code = "STD_IO";
250
+ static statusCode = 500;
251
+ static description = `Standard IO error`;
252
+ }
253
+ class VmCreateTmuxSessionError extends Error {
254
+ constructor(body) {
255
+ super(
256
+ `VM_CREATE_TMUX_SESSION: ${body.message}`
257
+ );
258
+ this.body = body;
259
+ this.name = "VmCreateTmuxSessionError";
260
+ }
261
+ static code = "VM_CREATE_TMUX_SESSION";
262
+ static statusCode = 500;
263
+ static description = `Failed to create tmux session for VM`;
264
+ }
265
+ class VmSubnetNotFoundError extends Error {
266
+ constructor(body) {
267
+ super(
268
+ `VM_SUBNET_NOT_FOUND: ${body.message}`
269
+ );
270
+ this.body = body;
271
+ this.name = "VmSubnetNotFoundError";
272
+ }
273
+ static code = "VM_SUBNET_NOT_FOUND";
274
+ static statusCode = 500;
275
+ static description = `Subnet for VM not found`;
250
276
  }
251
277
  class VmMustBeStoppedError extends Error {
252
278
  constructor(body) {
@@ -284,103 +310,55 @@ class NotFoundError extends Error {
284
310
  static statusCode = 404;
285
311
  static description = `VM not found`;
286
312
  }
287
- class VmNotFoundInFsError extends Error {
313
+ class VmOperationDeniedDuringTransactionError extends Error {
288
314
  constructor(body) {
289
315
  super(
290
- `VM_NOT_FOUND_IN_FS: ${body.message}`
316
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
291
317
  );
292
318
  this.body = body;
293
- this.name = "VmNotFoundInFsError";
319
+ this.name = "VmOperationDeniedDuringTransactionError";
294
320
  }
295
- static code = "VM_NOT_FOUND_IN_FS";
296
- static statusCode = 406;
297
- static description = `Vm Not found in filesystem`;
321
+ static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
322
+ static statusCode = 409;
323
+ static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
298
324
  }
299
- class DatabaseErrorError extends Error {
325
+ class VmTransactionIdMismatchError extends Error {
300
326
  constructor(body) {
301
327
  super(
302
- `DATABASE_ERROR: ${body.message}`
328
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
303
329
  );
304
330
  this.body = body;
305
- this.name = "DatabaseErrorError";
331
+ this.name = "VmTransactionIdMismatchError";
306
332
  }
307
- static code = "DATABASE_ERROR";
308
- static statusCode = 500;
309
- static description = `Database error occurred`;
333
+ static code = "VM_TRANSACTION_ID_MISMATCH";
334
+ static statusCode = 400;
335
+ static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
310
336
  }
311
- class PartitionNotFoundError extends Error {
337
+ class VmNotInTransactionError extends Error {
312
338
  constructor(body) {
313
339
  super(
314
- `PARTITION_NOT_FOUND: ${body.message}`
340
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
315
341
  );
316
342
  this.body = body;
317
- this.name = "PartitionNotFoundError";
343
+ this.name = "VmNotInTransactionError";
318
344
  }
319
- static code = "PARTITION_NOT_FOUND";
345
+ static code = "VM_NOT_IN_TRANSACTION";
320
346
  static statusCode = 404;
321
- static description = `Partition not found: {partition_id}`;
347
+ static description = `VM not in a transaction: {vm_id}`;
322
348
  }
323
- class InvalidVmIdError extends Error {
349
+ class VmNotFoundInFsError extends Error {
324
350
  constructor(body) {
325
351
  super(
326
- `INVALID_VM_ID: ${body.message}`
352
+ `VM_NOT_FOUND_IN_FS: ${body.message}`
327
353
  );
328
354
  this.body = body;
329
- this.name = "InvalidVmIdError";
355
+ this.name = "VmNotFoundInFsError";
330
356
  }
331
- static code = "INVALID_VM_ID";
332
- static statusCode = 400;
333
- static description = `Invalid VM ID: {vm_id}, details: {details}`;
357
+ static code = "VM_NOT_FOUND_IN_FS";
358
+ static statusCode = 406;
359
+ static description = `Vm Not found in filesystem`;
334
360
  }
335
- class InvalidGitRepoSpecErrorError extends Error {
336
- constructor(body) {
337
- super(
338
- `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
339
- );
340
- this.body = body;
341
- this.name = "InvalidGitRepoSpecErrorError";
342
- }
343
- static code = "INVALID_GIT_REPO_SPEC_ERROR";
344
- static statusCode = 400;
345
- static description = `Invalid git repository specification: {message}`;
346
- }
347
- class InternalErrorError extends Error {
348
- constructor(body) {
349
- super(
350
- `INTERNAL_ERROR: ${body.message}`
351
- );
352
- this.body = body;
353
- this.name = "InternalErrorError";
354
- }
355
- static code = "INTERNAL_ERROR";
356
- static statusCode = 500;
357
- static description = `Internal error: {message}`;
358
- }
359
- class ForkVmNotFoundError extends Error {
360
- constructor(body) {
361
- super(
362
- `FORK_VM_NOT_FOUND: ${body.message}`
363
- );
364
- this.body = body;
365
- this.name = "ForkVmNotFoundError";
366
- }
367
- static code = "FORK_VM_NOT_FOUND";
368
- static statusCode = 404;
369
- static description = `Fork VM not found: {fork_vm_id}`;
370
- }
371
- class CreateSnapshotBadRequestError extends Error {
372
- constructor(body) {
373
- super(
374
- `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
375
- );
376
- this.body = body;
377
- this.name = "CreateSnapshotBadRequestError";
378
- }
379
- static code = "CREATE_SNAPSHOT_BAD_REQUEST";
380
- static statusCode = 400;
381
- static description = `Bad request: {message}`;
382
- }
383
- class VmNotRunningError extends Error {
361
+ class VmNotRunningError extends Error {
384
362
  constructor(body) {
385
363
  super(
386
364
  `VM_NOT_RUNNING: ${body.message}`
@@ -440,229 +418,445 @@ class InternalVmNotFoundError extends Error {
440
418
  static statusCode = 404;
441
419
  static description = `VM not found: {vm_id}`;
442
420
  }
443
- class KernelPanicError extends Error {
421
+ class DatabaseErrorError extends Error {
444
422
  constructor(body) {
445
423
  super(
446
- `KERNEL_PANIC: ${body.message}`
424
+ `DATABASE_ERROR: ${body.message}`
447
425
  );
448
426
  this.body = body;
449
- this.name = "KernelPanicError";
427
+ this.name = "DatabaseErrorError";
450
428
  }
451
- static code = "KERNEL_PANIC";
429
+ static code = "DATABASE_ERROR";
452
430
  static statusCode = 500;
453
- static description = `VM kernel panic detected`;
431
+ static description = `Database error occurred while constructing VmRecord, details: {details}`;
454
432
  }
455
- class VmDeletedError extends Error {
433
+ class PartitionNotFoundError extends Error {
456
434
  constructor(body) {
457
435
  super(
458
- `VM_DELETED: ${body.message}`
436
+ `PARTITION_NOT_FOUND: ${body.message}`
459
437
  );
460
438
  this.body = body;
461
- this.name = "VmDeletedError";
439
+ this.name = "PartitionNotFoundError";
462
440
  }
463
- static code = "VM_DELETED";
464
- static statusCode = 410;
465
- static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
441
+ static code = "PARTITION_NOT_FOUND";
442
+ static statusCode = 404;
443
+ static description = `Partition not found: {partition_id}`;
466
444
  }
467
- class ReqwestError extends Error {
445
+ class InvalidVmIdError extends Error {
468
446
  constructor(body) {
469
447
  super(
470
- `REQWEST: ${body.message}`
448
+ `INVALID_VM_ID: ${body.message}`
471
449
  );
472
450
  this.body = body;
473
- this.name = "ReqwestError";
451
+ this.name = "InvalidVmIdError";
474
452
  }
475
- static code = "REQWEST";
476
- static statusCode = 500;
477
- static description = `Reqwest error: {details}`;
453
+ static code = "INVALID_VM_ID";
454
+ static statusCode = 400;
455
+ static description = `Invalid VM ID: {vm_id}, details: {details}`;
478
456
  }
479
- class FirecrackerPidNotFoundError extends Error {
457
+ class UserNotFoundError extends Error {
480
458
  constructor(body) {
481
459
  super(
482
- `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
460
+ `USER_NOT_FOUND: ${body.message}`
483
461
  );
484
462
  this.body = body;
485
- this.name = "FirecrackerPidNotFoundError";
463
+ this.name = "UserNotFoundError";
486
464
  }
487
- static code = "FIRECRACKER_PID_NOT_FOUND";
488
- static statusCode = 500;
489
- static description = `Firecracker PID not found`;
465
+ static code = "USER_NOT_FOUND";
466
+ static statusCode = 404;
467
+ static description = `User not found: {user_name}`;
490
468
  }
491
- class FirecrackerApiSocketNotFoundError extends Error {
469
+ class UserAlreadyExistsError extends Error {
492
470
  constructor(body) {
493
471
  super(
494
- `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
472
+ `USER_ALREADY_EXISTS: ${body.message}`
495
473
  );
496
474
  this.body = body;
497
- this.name = "FirecrackerApiSocketNotFoundError";
475
+ this.name = "UserAlreadyExistsError";
498
476
  }
499
- static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
500
- static statusCode = 500;
501
- static description = `Firecracker API socket not found`;
477
+ static code = "USER_ALREADY_EXISTS";
478
+ static statusCode = 409;
479
+ static description = `Conflict: User '{user_name}' already exists`;
502
480
  }
503
- class InvalidSnapshotIdError extends Error {
481
+ class ValidationErrorError extends Error {
504
482
  constructor(body) {
505
483
  super(
506
- `INVALID_SNAPSHOT_ID: ${body.message}`
484
+ `VALIDATION_ERROR: ${body.message}`
507
485
  );
508
486
  this.body = body;
509
- this.name = "InvalidSnapshotIdError";
487
+ this.name = "ValidationErrorError";
510
488
  }
511
- static code = "INVALID_SNAPSHOT_ID";
489
+ static code = "VALIDATION_ERROR";
512
490
  static statusCode = 400;
513
- static description = `Invalid snapshot id: {id}`;
491
+ static description = `Validation error: {message}`;
514
492
  }
515
- class VmStartTimeoutError extends Error {
493
+ class GroupNotFoundError extends Error {
516
494
  constructor(body) {
517
495
  super(
518
- `VM_START_TIMEOUT: ${body.message}`
496
+ `GROUP_NOT_FOUND: ${body.message}`
519
497
  );
520
498
  this.body = body;
521
- this.name = "VmStartTimeoutError";
499
+ this.name = "GroupNotFoundError";
522
500
  }
523
- static code = "VM_START_TIMEOUT";
524
- static statusCode = 504;
525
- static description = `VM did not become ready within the specified timeout`;
501
+ static code = "GROUP_NOT_FOUND";
502
+ static statusCode = 404;
503
+ static description = `Group not found: {group_name}`;
526
504
  }
527
- class VmExitDuringStartError extends Error {
505
+ class GroupAlreadyExistsError extends Error {
528
506
  constructor(body) {
529
507
  super(
530
- `VM_EXIT_DURING_START: ${body.message}`
508
+ `GROUP_ALREADY_EXISTS: ${body.message}`
531
509
  );
532
510
  this.body = body;
533
- this.name = "VmExitDuringStartError";
511
+ this.name = "GroupAlreadyExistsError";
534
512
  }
535
- static code = "VM_EXIT_DURING_START";
536
- static statusCode = 500;
537
- static description = `VM process exited unexpectedly during start`;
513
+ static code = "GROUP_ALREADY_EXISTS";
514
+ static statusCode = 409;
515
+ static description = `Conflict: Group '{group_name}' already exists`;
538
516
  }
539
- class VmAccessDeniedError extends Error {
517
+ class DuplicateUserNameError extends Error {
540
518
  constructor(body) {
541
519
  super(
542
- `VM_ACCESS_DENIED: ${body.message}`
520
+ `DUPLICATE_USER_NAME: ${body.message}`
543
521
  );
544
522
  this.body = body;
545
- this.name = "VmAccessDeniedError";
523
+ this.name = "DuplicateUserNameError";
546
524
  }
547
- static code = "VM_ACCESS_DENIED";
548
- static statusCode = 403;
549
- static description = `You do not have access to this VM`;
525
+ static code = "DUPLICATE_USER_NAME";
526
+ static statusCode = 400;
527
+ static description = `Duplicate user name '{name}' found`;
550
528
  }
551
- class StdIoError extends Error {
529
+ class UserGroupEmptyError extends Error {
552
530
  constructor(body) {
553
531
  super(
554
- `STD_IO: ${body.message}`
532
+ `USER_GROUP_EMPTY: ${body.message}`
555
533
  );
556
534
  this.body = body;
557
- this.name = "StdIoError";
535
+ this.name = "UserGroupEmptyError";
558
536
  }
559
- static code = "STD_IO";
560
- static statusCode = 500;
561
- static description = `Standard IO error`;
537
+ static code = "USER_GROUP_EMPTY";
538
+ static statusCode = 400;
539
+ static description = `User '{user}' has empty string in groups`;
562
540
  }
563
- class VmCreateTmuxSessionError extends Error {
541
+ class UserSystemFlagMismatchError extends Error {
564
542
  constructor(body) {
565
543
  super(
566
- `VM_CREATE_TMUX_SESSION: ${body.message}`
544
+ `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
567
545
  );
568
546
  this.body = body;
569
- this.name = "VmCreateTmuxSessionError";
547
+ this.name = "UserSystemFlagMismatchError";
570
548
  }
571
- static code = "VM_CREATE_TMUX_SESSION";
572
- static statusCode = 500;
573
- static description = `Failed to create tmux session for VM`;
549
+ static code = "USER_SYSTEM_FLAG_MISMATCH";
550
+ static statusCode = 400;
551
+ static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
574
552
  }
575
- class VmSubnetNotFoundError extends Error {
553
+ class UserUidOutOfRangeError extends Error {
576
554
  constructor(body) {
577
555
  super(
578
- `VM_SUBNET_NOT_FOUND: ${body.message}`
556
+ `USER_UID_OUT_OF_RANGE: ${body.message}`
579
557
  );
580
558
  this.body = body;
581
- this.name = "VmSubnetNotFoundError";
559
+ this.name = "UserUidOutOfRangeError";
582
560
  }
583
- static code = "VM_SUBNET_NOT_FOUND";
584
- static statusCode = 500;
585
- static description = `Subnet for VM not found`;
561
+ static code = "USER_UID_OUT_OF_RANGE";
562
+ static statusCode = 400;
563
+ static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
586
564
  }
587
- class VmOperationDeniedDuringTransactionError extends Error {
565
+ class UserHomeInvalidError extends Error {
588
566
  constructor(body) {
589
567
  super(
590
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
568
+ `USER_HOME_INVALID: ${body.message}`
591
569
  );
592
570
  this.body = body;
593
- this.name = "VmOperationDeniedDuringTransactionError";
571
+ this.name = "UserHomeInvalidError";
594
572
  }
595
- static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
596
- static statusCode = 409;
597
- static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
573
+ static code = "USER_HOME_INVALID";
574
+ static statusCode = 400;
575
+ static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
598
576
  }
599
- class VmTransactionIdMismatchError extends Error {
577
+ class UserShellInvalidError extends Error {
600
578
  constructor(body) {
601
579
  super(
602
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
580
+ `USER_SHELL_INVALID: ${body.message}`
603
581
  );
604
582
  this.body = body;
605
- this.name = "VmTransactionIdMismatchError";
583
+ this.name = "UserShellInvalidError";
606
584
  }
607
- static code = "VM_TRANSACTION_ID_MISMATCH";
585
+ static code = "USER_SHELL_INVALID";
608
586
  static statusCode = 400;
609
- static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
587
+ static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
610
588
  }
611
- class VmNotInTransactionError extends Error {
589
+ class DuplicateGroupNameError extends Error {
612
590
  constructor(body) {
613
591
  super(
614
- `VM_NOT_IN_TRANSACTION: ${body.message}`
592
+ `DUPLICATE_GROUP_NAME: ${body.message}`
615
593
  );
616
594
  this.body = body;
617
- this.name = "VmNotInTransactionError";
595
+ this.name = "DuplicateGroupNameError";
618
596
  }
619
- static code = "VM_NOT_IN_TRANSACTION";
620
- static statusCode = 404;
621
- static description = `VM not in a transaction: {vm_id}`;
597
+ static code = "DUPLICATE_GROUP_NAME";
598
+ static statusCode = 400;
599
+ static description = `Duplicate group name '{name}' found`;
622
600
  }
623
- class CreateVmBadRequestError extends Error {
601
+ class GroupNameReservedError extends Error {
624
602
  constructor(body) {
625
603
  super(
626
- `CREATE_VM_BAD_REQUEST: ${body.message}`
604
+ `GROUP_NAME_RESERVED: ${body.message}`
627
605
  );
628
606
  this.body = body;
629
- this.name = "CreateVmBadRequestError";
607
+ this.name = "GroupNameReservedError";
630
608
  }
631
- static code = "CREATE_VM_BAD_REQUEST";
609
+ static code = "GROUP_NAME_RESERVED";
632
610
  static statusCode = 400;
633
- static description = `Bad request: {message}`;
611
+ static description = `Group name '{name}' is reserved and cannot be used`;
634
612
  }
635
- class WantedByEmptyError extends Error {
613
+ class GroupNameInvalidCharsError extends Error {
636
614
  constructor(body) {
637
615
  super(
638
- `WANTED_BY_EMPTY: ${body.message}`
616
+ `GROUP_NAME_INVALID_CHARS: ${body.message}`
639
617
  );
640
618
  this.body = body;
641
- this.name = "WantedByEmptyError";
619
+ this.name = "GroupNameInvalidCharsError";
642
620
  }
643
- static code = "WANTED_BY_EMPTY";
621
+ static code = "GROUP_NAME_INVALID_CHARS";
644
622
  static statusCode = 400;
645
- static description = `wanted_by cannot be empty if provided`;
623
+ static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
646
624
  }
647
- class WorkdirEmptyError extends Error {
625
+ class GroupNameTooLongError extends Error {
648
626
  constructor(body) {
649
627
  super(
650
- `WORKDIR_EMPTY: ${body.message}`
628
+ `GROUP_NAME_TOO_LONG: ${body.message}`
651
629
  );
652
630
  this.body = body;
653
- this.name = "WorkdirEmptyError";
631
+ this.name = "GroupNameTooLongError";
654
632
  }
655
- static code = "WORKDIR_EMPTY";
633
+ static code = "GROUP_NAME_TOO_LONG";
656
634
  static statusCode = 400;
657
- static description = `Working directory cannot be empty if provided`;
635
+ static description = `Group name '{name}' is too long (max {max_length} characters)`;
658
636
  }
659
- class GroupEmptyError extends Error {
637
+ class GroupNameEmptyError extends Error {
660
638
  constructor(body) {
661
639
  super(
662
- `GROUP_EMPTY: ${body.message}`
640
+ `GROUP_NAME_EMPTY: ${body.message}`
663
641
  );
664
642
  this.body = body;
665
- this.name = "GroupEmptyError";
643
+ this.name = "GroupNameEmptyError";
644
+ }
645
+ static code = "GROUP_NAME_EMPTY";
646
+ static statusCode = 400;
647
+ static description = `Group name cannot be empty`;
648
+ }
649
+ class InvalidGitRepoSpecErrorError extends Error {
650
+ constructor(body) {
651
+ super(
652
+ `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
653
+ );
654
+ this.body = body;
655
+ this.name = "InvalidGitRepoSpecErrorError";
656
+ }
657
+ static code = "INVALID_GIT_REPO_SPEC_ERROR";
658
+ static statusCode = 400;
659
+ static description = `Invalid git repository specification: {message}`;
660
+ }
661
+ class InternalErrorError extends Error {
662
+ constructor(body) {
663
+ super(
664
+ `INTERNAL_ERROR: ${body.message}`
665
+ );
666
+ this.body = body;
667
+ this.name = "InternalErrorError";
668
+ }
669
+ static code = "INTERNAL_ERROR";
670
+ static statusCode = 500;
671
+ static description = `Internal error: {message}`;
672
+ }
673
+ class ForkVmNotFoundError extends Error {
674
+ constructor(body) {
675
+ super(
676
+ `FORK_VM_NOT_FOUND: ${body.message}`
677
+ );
678
+ this.body = body;
679
+ this.name = "ForkVmNotFoundError";
680
+ }
681
+ static code = "FORK_VM_NOT_FOUND";
682
+ static statusCode = 404;
683
+ static description = `Fork VM not found: {fork_vm_id}`;
684
+ }
685
+ class CreateSnapshotBadRequestError extends Error {
686
+ constructor(body) {
687
+ super(
688
+ `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
689
+ );
690
+ this.body = body;
691
+ this.name = "CreateSnapshotBadRequestError";
692
+ }
693
+ static code = "CREATE_SNAPSHOT_BAD_REQUEST";
694
+ static statusCode = 400;
695
+ static description = `Bad request: {message}`;
696
+ }
697
+ class DockerSnapshotFailedError extends Error {
698
+ constructor(body) {
699
+ super(
700
+ `DOCKER_SNAPSHOT_FAILED: ${body.message}`
701
+ );
702
+ this.body = body;
703
+ this.name = "DockerSnapshotFailedError";
704
+ }
705
+ static code = "DOCKER_SNAPSHOT_FAILED";
706
+ static statusCode = 500;
707
+ static description = `Failed to create snapshot from Docker image {docker_image} for account {account_id}: {details}`;
708
+ }
709
+ class SetDefaultSnapshotFailedError extends Error {
710
+ constructor(body) {
711
+ super(
712
+ `SET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
713
+ );
714
+ this.body = body;
715
+ this.name = "SetDefaultSnapshotFailedError";
716
+ }
717
+ static code = "SET_DEFAULT_SNAPSHOT_FAILED";
718
+ static statusCode = 500;
719
+ static description = `Failed to update default snapshot in database for account {account_id}, snapshot {snapshot_id}: {details}`;
720
+ }
721
+ class SnapshotLayerCreationFailedError extends Error {
722
+ constructor(body) {
723
+ super(
724
+ `SNAPSHOT_LAYER_CREATION_FAILED: ${body.message}`
725
+ );
726
+ this.body = body;
727
+ this.name = "SnapshotLayerCreationFailedError";
728
+ }
729
+ static code = "SNAPSHOT_LAYER_CREATION_FAILED";
730
+ static statusCode = 500;
731
+ static description = `Failed to create snapshot layer for account {account_id} from {source_snapshot_dir}: {details}`;
732
+ }
733
+ class SnapshotDirNotFoundError extends Error {
734
+ constructor(body) {
735
+ super(
736
+ `SNAPSHOT_DIR_NOT_FOUND: ${body.message}`
737
+ );
738
+ this.body = body;
739
+ this.name = "SnapshotDirNotFoundError";
740
+ }
741
+ static code = "SNAPSHOT_DIR_NOT_FOUND";
742
+ static statusCode = 500;
743
+ static description = `Snapshot directory not found at {snapshot_dir} for account {account_id}, snapshot {snapshot_id}`;
744
+ }
745
+ class SubvolumeCreationFailedError extends Error {
746
+ constructor(body) {
747
+ super(
748
+ `SUBVOLUME_CREATION_FAILED: ${body.message}`
749
+ );
750
+ this.body = body;
751
+ this.name = "SubvolumeCreationFailedError";
752
+ }
753
+ static code = "SUBVOLUME_CREATION_FAILED";
754
+ static statusCode = 500;
755
+ static description = `Failed to create account subvolume for account {account_id} on partition {partition_id}: {details}`;
756
+ }
757
+ class GetDefaultSnapshotFailedError extends Error {
758
+ constructor(body) {
759
+ super(
760
+ `GET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
761
+ );
762
+ this.body = body;
763
+ this.name = "GetDefaultSnapshotFailedError";
764
+ }
765
+ static code = "GET_DEFAULT_SNAPSHOT_FAILED";
766
+ static statusCode = 500;
767
+ static description = `Failed to query account default snapshot for account {account_id}: {details}`;
768
+ }
769
+ class ActiveTransactionErrorError extends Error {
770
+ constructor(body) {
771
+ super(
772
+ `ACTIVE_TRANSACTION_ERROR: ${body.message}`
773
+ );
774
+ this.body = body;
775
+ this.name = "ActiveTransactionErrorError";
776
+ }
777
+ static code = "ACTIVE_TRANSACTION_ERROR";
778
+ static statusCode = 500;
779
+ static description = `Active transaction error: {details}`;
780
+ }
781
+ class RootfsCopyErrorError extends Error {
782
+ constructor(body) {
783
+ super(
784
+ `ROOTFS_COPY_ERROR: ${body.message}`
785
+ );
786
+ this.body = body;
787
+ this.name = "RootfsCopyErrorError";
788
+ }
789
+ static code = "ROOTFS_COPY_ERROR";
790
+ static statusCode = 500;
791
+ static description = `Failed to copy rootfs from {from} to {to}: {details}`;
792
+ }
793
+ class FileNotFoundError extends Error {
794
+ constructor(body) {
795
+ super(
796
+ `FILE_NOT_FOUND: ${body.message}`
797
+ );
798
+ this.body = body;
799
+ this.name = "FileNotFoundError";
800
+ }
801
+ static code = "FILE_NOT_FOUND";
802
+ static statusCode = 404;
803
+ static description = `File not found: {path}`;
804
+ }
805
+ class FilesBadRequestError extends Error {
806
+ constructor(body) {
807
+ super(
808
+ `FILES_BAD_REQUEST: ${body.message}`
809
+ );
810
+ this.body = body;
811
+ this.name = "FilesBadRequestError";
812
+ }
813
+ static code = "FILES_BAD_REQUEST";
814
+ static statusCode = 400;
815
+ static description = `Bad request: {message}`;
816
+ }
817
+ class CreateVmBadRequestError extends Error {
818
+ constructor(body) {
819
+ super(
820
+ `CREATE_VM_BAD_REQUEST: ${body.message}`
821
+ );
822
+ this.body = body;
823
+ this.name = "CreateVmBadRequestError";
824
+ }
825
+ static code = "CREATE_VM_BAD_REQUEST";
826
+ static statusCode = 400;
827
+ static description = `Bad request: {message}`;
828
+ }
829
+ class WantedByEmptyError extends Error {
830
+ constructor(body) {
831
+ super(
832
+ `WANTED_BY_EMPTY: ${body.message}`
833
+ );
834
+ this.body = body;
835
+ this.name = "WantedByEmptyError";
836
+ }
837
+ static code = "WANTED_BY_EMPTY";
838
+ static statusCode = 400;
839
+ static description = `wanted_by cannot be empty if provided`;
840
+ }
841
+ class WorkdirEmptyError extends Error {
842
+ constructor(body) {
843
+ super(
844
+ `WORKDIR_EMPTY: ${body.message}`
845
+ );
846
+ this.body = body;
847
+ this.name = "WorkdirEmptyError";
848
+ }
849
+ static code = "WORKDIR_EMPTY";
850
+ static statusCode = 400;
851
+ static description = `Working directory cannot be empty if provided`;
852
+ }
853
+ class GroupEmptyError extends Error {
854
+ constructor(body) {
855
+ super(
856
+ `GROUP_EMPTY: ${body.message}`
857
+ );
858
+ this.body = body;
859
+ this.name = "GroupEmptyError";
666
860
  }
667
861
  static code = "GROUP_EMPTY";
668
862
  static statusCode = 400;
@@ -869,7 +1063,7 @@ class SyntaxErrorError extends Error {
869
1063
  this.name = "SyntaxErrorError";
870
1064
  }
871
1065
  static code = "SYNTAX_ERROR";
872
- static statusCode = 503;
1066
+ static statusCode = 400;
873
1067
  static description = `The provided script has a syntax error: {message}`;
874
1068
  }
875
1069
  class InternalError extends Error {
@@ -944,17 +1138,17 @@ class ExpiredError extends Error {
944
1138
  static statusCode = 403;
945
1139
  static description = `Session has expired`;
946
1140
  }
947
- class TagNotFoundError extends Error {
1141
+ class PackfileError extends Error {
948
1142
  constructor(body) {
949
1143
  super(
950
- `TAG_NOT_FOUND: ${body.message}`
1144
+ `PACKFILE: ${body.message}`
951
1145
  );
952
1146
  this.body = body;
953
- this.name = "TagNotFoundError";
1147
+ this.name = "PackfileError";
954
1148
  }
955
- static code = "TAG_NOT_FOUND";
956
- static statusCode = 404;
957
- static description = `Tag not found: {tag}`;
1149
+ static code = "PACKFILE";
1150
+ static statusCode = 500;
1151
+ static description = `Error building packfile`;
958
1152
  }
959
1153
  class TreeNotFoundError extends Error {
960
1154
  constructor(body) {
@@ -1052,221 +1246,233 @@ class CommitNotFoundError extends Error {
1052
1246
  static statusCode = 404;
1053
1247
  static description = `Commit {commit_hash} not found in repository {repo_id}`;
1054
1248
  }
1055
- class PackfileError extends Error {
1249
+ class PathNotFoundError extends Error {
1056
1250
  constructor(body) {
1057
1251
  super(
1058
- `PACKFILE: ${body.message}`
1252
+ `PATH_NOT_FOUND: ${body.message}`
1059
1253
  );
1060
1254
  this.body = body;
1061
- this.name = "PackfileError";
1255
+ this.name = "PathNotFoundError";
1062
1256
  }
1063
- static code = "PACKFILE";
1064
- static statusCode = 500;
1065
- static description = `Error building packfile`;
1257
+ static code = "PATH_NOT_FOUND";
1258
+ static statusCode = 404;
1259
+ static description = `Path not found: {path}`;
1066
1260
  }
1067
- class SendErrorError extends Error {
1261
+ class ReferenceNotFoundError extends Error {
1068
1262
  constructor(body) {
1069
1263
  super(
1070
- `SEND_ERROR: ${body.message}`
1264
+ `REFERENCE_NOT_FOUND: ${body.message}`
1071
1265
  );
1072
1266
  this.body = body;
1073
- this.name = "SendErrorError";
1267
+ this.name = "ReferenceNotFoundError";
1074
1268
  }
1075
- static code = "SEND_ERROR";
1076
- static statusCode = 500;
1077
- static description = `Stream receiver dropped`;
1269
+ static code = "REFERENCE_NOT_FOUND";
1270
+ static statusCode = 404;
1271
+ static description = `Reference not found: {reference}`;
1078
1272
  }
1079
- class UnsupportedTransferError extends Error {
1273
+ class AmbiguousError extends Error {
1080
1274
  constructor(body) {
1081
1275
  super(
1082
- `UNSUPPORTED_TRANSFER: ${body.message}`
1276
+ `AMBIGUOUS: ${body.message}`
1083
1277
  );
1084
1278
  this.body = body;
1085
- this.name = "UnsupportedTransferError";
1279
+ this.name = "AmbiguousError";
1086
1280
  }
1087
- static code = "UNSUPPORTED_TRANSFER";
1281
+ static code = "AMBIGUOUS";
1088
1282
  static statusCode = 400;
1089
- static description = `Unsupported LFS transfer protocol(s)`;
1283
+ static description = `rev is ambiguous: {rev}`;
1090
1284
  }
1091
- class InvalidRangeError extends Error {
1285
+ class InvalidError extends Error {
1092
1286
  constructor(body) {
1093
1287
  super(
1094
- `INVALID_RANGE: ${body.message}`
1288
+ `INVALID: ${body.message}`
1095
1289
  );
1096
1290
  this.body = body;
1097
- this.name = "InvalidRangeError";
1291
+ this.name = "InvalidError";
1098
1292
  }
1099
- static code = "INVALID_RANGE";
1293
+ static code = "INVALID";
1100
1294
  static statusCode = 400;
1101
- static description = `Invalid range: 'until' commit ({until}) must be a descendant of 'since' commit ({since}). In other words, 'until' must be newer than 'since' in the commit graph.`;
1295
+ static description = `invalid rev syntax: {rev}`;
1102
1296
  }
1103
- class OffsetWithSelectorError extends Error {
1297
+ class InvalidAccountIdError extends Error {
1104
1298
  constructor(body) {
1105
1299
  super(
1106
- `OFFSET_WITH_SELECTOR: ${body.message}`
1300
+ `INVALID_ACCOUNT_ID: ${body.message}`
1107
1301
  );
1108
1302
  this.body = body;
1109
- this.name = "OffsetWithSelectorError";
1303
+ this.name = "InvalidAccountIdError";
1110
1304
  }
1111
- static code = "OFFSET_WITH_SELECTOR";
1305
+ static code = "INVALID_ACCOUNT_ID";
1112
1306
  static statusCode = 400;
1113
- static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1307
+ static description = `Invalid account ID: {account_id}`;
1114
1308
  }
1115
- class CommitNotInBranchError extends Error {
1309
+ class SourceImportConflictError extends Error {
1116
1310
  constructor(body) {
1117
1311
  super(
1118
- `COMMIT_NOT_IN_BRANCH: ${body.message}`
1312
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
1119
1313
  );
1120
1314
  this.body = body;
1121
- this.name = "CommitNotInBranchError";
1315
+ this.name = "SourceImportConflictError";
1122
1316
  }
1123
- static code = "COMMIT_NOT_IN_BRANCH";
1317
+ static code = "SOURCE_IMPORT_CONFLICT";
1124
1318
  static statusCode = 400;
1125
- static description = `Commit {sha} is not in the history of branch {branch}`;
1319
+ static description = `Source and import are mutually exclusive`;
1126
1320
  }
1127
- class BlobNotFoundError extends Error {
1321
+ class SourceUnauthorizedError extends Error {
1128
1322
  constructor(body) {
1129
1323
  super(
1130
- `BLOB_NOT_FOUND: ${body.message}`
1324
+ `SOURCE_UNAUTHORIZED: ${body.message}`
1131
1325
  );
1132
1326
  this.body = body;
1133
- this.name = "BlobNotFoundError";
1327
+ this.name = "SourceUnauthorizedError";
1134
1328
  }
1135
- static code = "BLOB_NOT_FOUND";
1136
- static statusCode = 404;
1137
- static description = `Blob not found: {hash}`;
1329
+ static code = "SOURCE_UNAUTHORIZED";
1330
+ static statusCode = 400;
1331
+ static description = `Unauthorized to access source repository at {url}`;
1138
1332
  }
1139
- class InvalidServiceError extends Error {
1333
+ class SourceNotFoundError extends Error {
1140
1334
  constructor(body) {
1141
1335
  super(
1142
- `INVALID_SERVICE: ${body.message}`
1336
+ `SOURCE_NOT_FOUND: ${body.message}`
1143
1337
  );
1144
1338
  this.body = body;
1145
- this.name = "InvalidServiceError";
1339
+ this.name = "SourceNotFoundError";
1146
1340
  }
1147
- static code = "INVALID_SERVICE";
1148
- static statusCode = 403;
1149
- static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1341
+ static code = "SOURCE_NOT_FOUND";
1342
+ static statusCode = 400;
1343
+ static description = `Source repository not found at {url}`;
1150
1344
  }
1151
- class ExpectedServiceError extends Error {
1345
+ class ImportSubdirNotFoundError extends Error {
1152
1346
  constructor(body) {
1153
1347
  super(
1154
- `EXPECTED_SERVICE: ${body.message}`
1348
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1155
1349
  );
1156
1350
  this.body = body;
1157
- this.name = "ExpectedServiceError";
1351
+ this.name = "ImportSubdirNotFoundError";
1158
1352
  }
1159
- static code = "EXPECTED_SERVICE";
1160
- static statusCode = 403;
1161
- static description = `Expected 'service' query parameter`;
1353
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1354
+ static statusCode = 400;
1355
+ static description = `Directory not found in {source}: {dir}`;
1162
1356
  }
1163
- class PathNotFoundError extends Error {
1357
+ class TagNotFoundError extends Error {
1164
1358
  constructor(body) {
1165
1359
  super(
1166
- `PATH_NOT_FOUND: ${body.message}`
1360
+ `TAG_NOT_FOUND: ${body.message}`
1167
1361
  );
1168
1362
  this.body = body;
1169
- this.name = "PathNotFoundError";
1363
+ this.name = "TagNotFoundError";
1170
1364
  }
1171
- static code = "PATH_NOT_FOUND";
1365
+ static code = "TAG_NOT_FOUND";
1172
1366
  static statusCode = 404;
1173
- static description = `Path not found: {path}`;
1367
+ static description = `Tag not found: {tag}`;
1174
1368
  }
1175
- class ReferenceNotFoundError extends Error {
1369
+ class UnsupportedTransferError extends Error {
1176
1370
  constructor(body) {
1177
1371
  super(
1178
- `REFERENCE_NOT_FOUND: ${body.message}`
1372
+ `UNSUPPORTED_TRANSFER: ${body.message}`
1179
1373
  );
1180
1374
  this.body = body;
1181
- this.name = "ReferenceNotFoundError";
1375
+ this.name = "UnsupportedTransferError";
1182
1376
  }
1183
- static code = "REFERENCE_NOT_FOUND";
1184
- static statusCode = 404;
1185
- static description = `Reference not found: {reference}`;
1377
+ static code = "UNSUPPORTED_TRANSFER";
1378
+ static statusCode = 400;
1379
+ static description = `Unsupported LFS transfer protocol(s)`;
1186
1380
  }
1187
- class AmbiguousError extends Error {
1381
+ class SendErrorError extends Error {
1188
1382
  constructor(body) {
1189
1383
  super(
1190
- `AMBIGUOUS: ${body.message}`
1384
+ `SEND_ERROR: ${body.message}`
1191
1385
  );
1192
1386
  this.body = body;
1193
- this.name = "AmbiguousError";
1387
+ this.name = "SendErrorError";
1194
1388
  }
1195
- static code = "AMBIGUOUS";
1196
- static statusCode = 400;
1197
- static description = `rev is ambiguous: {rev}`;
1389
+ static code = "SEND_ERROR";
1390
+ static statusCode = 500;
1391
+ static description = `Stream receiver dropped`;
1198
1392
  }
1199
- class InvalidError extends Error {
1393
+ class InvalidServiceError extends Error {
1200
1394
  constructor(body) {
1201
1395
  super(
1202
- `INVALID: ${body.message}`
1396
+ `INVALID_SERVICE: ${body.message}`
1203
1397
  );
1204
1398
  this.body = body;
1205
- this.name = "InvalidError";
1399
+ this.name = "InvalidServiceError";
1206
1400
  }
1207
- static code = "INVALID";
1208
- static statusCode = 400;
1209
- static description = `invalid rev syntax: {rev}`;
1401
+ static code = "INVALID_SERVICE";
1402
+ static statusCode = 403;
1403
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1210
1404
  }
1211
- class InvalidAccountIdError extends Error {
1405
+ class ExpectedServiceError extends Error {
1212
1406
  constructor(body) {
1213
1407
  super(
1214
- `INVALID_ACCOUNT_ID: ${body.message}`
1408
+ `EXPECTED_SERVICE: ${body.message}`
1215
1409
  );
1216
1410
  this.body = body;
1217
- this.name = "InvalidAccountIdError";
1411
+ this.name = "ExpectedServiceError";
1218
1412
  }
1219
- static code = "INVALID_ACCOUNT_ID";
1220
- static statusCode = 400;
1221
- static description = `Invalid account ID: {account_id}`;
1413
+ static code = "EXPECTED_SERVICE";
1414
+ static statusCode = 403;
1415
+ static description = `Expected 'service' query parameter`;
1222
1416
  }
1223
- class SourceImportConflictError extends Error {
1417
+ class InvalidRangeError extends Error {
1224
1418
  constructor(body) {
1225
1419
  super(
1226
- `SOURCE_IMPORT_CONFLICT: ${body.message}`
1420
+ `INVALID_RANGE: ${body.message}`
1227
1421
  );
1228
1422
  this.body = body;
1229
- this.name = "SourceImportConflictError";
1423
+ this.name = "InvalidRangeError";
1230
1424
  }
1231
- static code = "SOURCE_IMPORT_CONFLICT";
1425
+ static code = "INVALID_RANGE";
1232
1426
  static statusCode = 400;
1233
- static description = `Source and import are mutually exclusive`;
1427
+ static description = `Invalid range: 'until' commit ({until}) must be a descendant of 'since' commit ({since}). In other words, 'until' must be newer than 'since' in the commit graph.`;
1234
1428
  }
1235
- class SourceUnauthorizedError extends Error {
1429
+ class OffsetWithSelectorError extends Error {
1236
1430
  constructor(body) {
1237
1431
  super(
1238
- `SOURCE_UNAUTHORIZED: ${body.message}`
1432
+ `OFFSET_WITH_SELECTOR: ${body.message}`
1239
1433
  );
1240
1434
  this.body = body;
1241
- this.name = "SourceUnauthorizedError";
1435
+ this.name = "OffsetWithSelectorError";
1242
1436
  }
1243
- static code = "SOURCE_UNAUTHORIZED";
1437
+ static code = "OFFSET_WITH_SELECTOR";
1244
1438
  static statusCode = 400;
1245
- static description = `Unauthorized to access source repository at {url}`;
1439
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1246
1440
  }
1247
- class SourceNotFoundError extends Error {
1441
+ class CommitNotInBranchError extends Error {
1248
1442
  constructor(body) {
1249
1443
  super(
1250
- `SOURCE_NOT_FOUND: ${body.message}`
1444
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1251
1445
  );
1252
1446
  this.body = body;
1253
- this.name = "SourceNotFoundError";
1447
+ this.name = "CommitNotInBranchError";
1254
1448
  }
1255
- static code = "SOURCE_NOT_FOUND";
1449
+ static code = "COMMIT_NOT_IN_BRANCH";
1256
1450
  static statusCode = 400;
1257
- static description = `Source repository not found at {url}`;
1451
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1258
1452
  }
1259
- class ImportSubdirNotFoundError extends Error {
1453
+ class BlobNotFoundError extends Error {
1260
1454
  constructor(body) {
1261
1455
  super(
1262
- `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1456
+ `BLOB_NOT_FOUND: ${body.message}`
1263
1457
  );
1264
1458
  this.body = body;
1265
- this.name = "ImportSubdirNotFoundError";
1459
+ this.name = "BlobNotFoundError";
1266
1460
  }
1267
- static code = "IMPORT_SUBDIR_NOT_FOUND";
1461
+ static code = "BLOB_NOT_FOUND";
1462
+ static statusCode = 404;
1463
+ static description = `Blob not found: {hash}`;
1464
+ }
1465
+ class InvalidRevisionError extends Error {
1466
+ constructor(body) {
1467
+ super(
1468
+ `INVALID_REVISION: ${body.message}`
1469
+ );
1470
+ this.body = body;
1471
+ this.name = "InvalidRevisionError";
1472
+ }
1473
+ static code = "INVALID_REVISION";
1268
1474
  static statusCode = 400;
1269
- static description = `Directory not found in {source}: {dir}`;
1475
+ static description = `Invalid revision: {revision}`;
1270
1476
  }
1271
1477
  class ConflictError extends Error {
1272
1478
  constructor(body) {
@@ -1280,17 +1486,17 @@ class ConflictError extends Error {
1280
1486
  static statusCode = 409;
1281
1487
  static description = `Sync conflict: {message}`;
1282
1488
  }
1283
- class InvalidRevisionError extends Error {
1489
+ class UnavailableError extends Error {
1284
1490
  constructor(body) {
1285
1491
  super(
1286
- `INVALID_REVISION: ${body.message}`
1492
+ `UNAVAILABLE: ${body.message}`
1287
1493
  );
1288
1494
  this.body = body;
1289
- this.name = "InvalidRevisionError";
1495
+ this.name = "UnavailableError";
1290
1496
  }
1291
- static code = "INVALID_REVISION";
1292
- static statusCode = 400;
1293
- static description = `Invalid revision: {revision}`;
1497
+ static code = "UNAVAILABLE";
1498
+ static statusCode = 503;
1499
+ static description = `Cron service unavailable`;
1294
1500
  }
1295
1501
  class DevServerNotFoundError extends Error {
1296
1502
  constructor(body) {
@@ -1304,1361 +1510,1349 @@ class DevServerNotFoundError extends Error {
1304
1510
  static statusCode = 404;
1305
1511
  static description = `dev server not found`;
1306
1512
  }
1307
- class BranchNameEmptyError extends Error {
1513
+ class EmptyTagError extends Error {
1308
1514
  constructor(body) {
1309
1515
  super(
1310
- `BRANCH_NAME_EMPTY: ${body.message}`
1516
+ `EMPTY_TAG: ${body.message}`
1311
1517
  );
1312
1518
  this.body = body;
1313
- this.name = "BranchNameEmptyError";
1519
+ this.name = "EmptyTagError";
1314
1520
  }
1315
- static code = "BRANCH_NAME_EMPTY";
1521
+ static code = "EMPTY_TAG";
1316
1522
  static statusCode = 400;
1317
- static description = `Branch name cannot be empty`;
1523
+ static description = `Invalid request: tag cannot be empty`;
1318
1524
  }
1319
- class ObservabilityDatabaseErrorError extends Error {
1525
+ class VmLimitExceededError extends Error {
1320
1526
  constructor(body) {
1321
1527
  super(
1322
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
1528
+ `VM_LIMIT_EXCEEDED: ${body.message}`
1323
1529
  );
1324
1530
  this.body = body;
1325
- this.name = "ObservabilityDatabaseErrorError";
1531
+ this.name = "VmLimitExceededError";
1326
1532
  }
1327
- static code = "OBSERVABILITY_DATABASE_ERROR";
1328
- static statusCode = 500;
1329
- static description = `Database operation failed: {message}`;
1533
+ static code = "VM_LIMIT_EXCEEDED";
1534
+ static statusCode = 403;
1535
+ static description = `VM limit exceeded: your plan allows {limit} VMs, you currently have {current}`;
1330
1536
  }
1331
- class ObservabilityAccessDeniedError extends Error {
1537
+ class DomainOwnershipVerificationFailedError extends Error {
1332
1538
  constructor(body) {
1333
1539
  super(
1334
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
1540
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1335
1541
  );
1336
1542
  this.body = body;
1337
- this.name = "ObservabilityAccessDeniedError";
1543
+ this.name = "DomainOwnershipVerificationFailedError";
1338
1544
  }
1339
- static code = "OBSERVABILITY_ACCESS_DENIED";
1545
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1340
1546
  static statusCode = 403;
1341
- static description = `Access denied to logs for deployment: {deployment_id}`;
1547
+ static description = `Domain ownership verification failed`;
1342
1548
  }
1343
- class ParseLogsFailedError extends Error {
1549
+ class ErrorDeletingRecordError extends Error {
1344
1550
  constructor(body) {
1345
1551
  super(
1346
- `PARSE_LOGS_FAILED: ${body.message}`
1552
+ `ERROR_DELETING_RECORD: ${body.message}`
1347
1553
  );
1348
1554
  this.body = body;
1349
- this.name = "ParseLogsFailedError";
1555
+ this.name = "ErrorDeletingRecordError";
1350
1556
  }
1351
- static code = "PARSE_LOGS_FAILED";
1557
+ static code = "ERROR_DELETING_RECORD";
1352
1558
  static statusCode = 500;
1353
- static description = `Failed to parse logs: {message}`;
1559
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1354
1560
  }
1355
- class RetrieveLogsFailedError extends Error {
1561
+ class RecordOwnershipErrorError extends Error {
1356
1562
  constructor(body) {
1357
1563
  super(
1358
- `RETRIEVE_LOGS_FAILED: ${body.message}`
1564
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
1359
1565
  );
1360
1566
  this.body = body;
1361
- this.name = "RetrieveLogsFailedError";
1567
+ this.name = "RecordOwnershipErrorError";
1362
1568
  }
1363
- static code = "RETRIEVE_LOGS_FAILED";
1364
- static statusCode = 500;
1365
- static description = `Failed to retrieve logs: {message}`;
1569
+ static code = "RECORD_OWNERSHIP_ERROR";
1570
+ static statusCode = 403;
1571
+ static description = `Account {account_id} does not own record {record_id}`;
1366
1572
  }
1367
- class InvalidQueryError extends Error {
1573
+ class ErrorCreatingRecordError extends Error {
1368
1574
  constructor(body) {
1369
1575
  super(
1370
- `INVALID_QUERY: ${body.message}`
1576
+ `ERROR_CREATING_RECORD: ${body.message}`
1371
1577
  );
1372
1578
  this.body = body;
1373
- this.name = "InvalidQueryError";
1579
+ this.name = "ErrorCreatingRecordError";
1374
1580
  }
1375
- static code = "INVALID_QUERY";
1376
- static statusCode = 400;
1377
- static description = `Invalid log query: {message}`;
1581
+ static code = "ERROR_CREATING_RECORD";
1582
+ static statusCode = 500;
1583
+ static description = `Error creating DNS record: {message}`;
1378
1584
  }
1379
- class LogsNotFoundError extends Error {
1585
+ class DomainOwnershipErrorError extends Error {
1380
1586
  constructor(body) {
1381
1587
  super(
1382
- `LOGS_NOT_FOUND: ${body.message}`
1588
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1383
1589
  );
1384
1590
  this.body = body;
1385
- this.name = "LogsNotFoundError";
1591
+ this.name = "DomainOwnershipErrorError";
1386
1592
  }
1387
- static code = "LOGS_NOT_FOUND";
1388
- static statusCode = 404;
1389
- static description = `Logs not found for deployment: {deployment_id}`;
1593
+ static code = "DOMAIN_OWNERSHIP_ERROR";
1594
+ static statusCode = 403;
1595
+ static description = `Account {account_id} does not own domain {domain}`;
1390
1596
  }
1391
- class FailedToProvisionCertificateError extends Error {
1597
+ class CloudstateInternalErrorError extends Error {
1392
1598
  constructor(body) {
1393
1599
  super(
1394
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
1600
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
1395
1601
  );
1396
1602
  this.body = body;
1397
- this.name = "FailedToProvisionCertificateError";
1603
+ this.name = "CloudstateInternalErrorError";
1398
1604
  }
1399
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
1400
- static statusCode = 422;
1401
- static description = `Failed to provision certificate: {message}`;
1605
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
1606
+ static statusCode = 500;
1607
+ static description = `Internal error: {message}`;
1402
1608
  }
1403
- class FailedToInsertDomainMappingError extends Error {
1609
+ class CloudstateDatabaseErrorError extends Error {
1404
1610
  constructor(body) {
1405
1611
  super(
1406
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
1612
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
1407
1613
  );
1408
1614
  this.body = body;
1409
- this.name = "FailedToInsertDomainMappingError";
1615
+ this.name = "CloudstateDatabaseErrorError";
1410
1616
  }
1411
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
1617
+ static code = "CLOUDSTATE_DATABASE_ERROR";
1412
1618
  static statusCode = 500;
1413
- static description = `Failed to insert domain mapping: {message}`;
1619
+ static description = `Database operation failed: {message}`;
1414
1620
  }
1415
- class PermissionDeniedError extends Error {
1621
+ class CloudstateAccessDeniedError extends Error {
1416
1622
  constructor(body) {
1417
1623
  super(
1418
- `PERMISSION_DENIED: ${body.message}`
1624
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
1419
1625
  );
1420
1626
  this.body = body;
1421
- this.name = "PermissionDeniedError";
1627
+ this.name = "CloudstateAccessDeniedError";
1422
1628
  }
1423
- static code = "PERMISSION_DENIED";
1424
- static statusCode = 401;
1425
- static description = `Permission denied: {message}`;
1426
- }
1427
- class FailedToCheckPermissionsError extends Error {
1428
- constructor(body) {
1429
- super(
1430
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
1431
- );
1432
- this.body = body;
1433
- this.name = "FailedToCheckPermissionsError";
1434
- }
1435
- static code = "FAILED_TO_CHECK_PERMISSIONS";
1436
- static statusCode = 502;
1437
- static description = `Failed to check permissions: {message}`;
1629
+ static code = "CLOUDSTATE_ACCESS_DENIED";
1630
+ static statusCode = 403;
1631
+ static description = `Access denied to project: {project_id}`;
1438
1632
  }
1439
- class FailedToListDomainsError extends Error {
1633
+ class RestoreFailedError extends Error {
1440
1634
  constructor(body) {
1441
1635
  super(
1442
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
1636
+ `RESTORE_FAILED: ${body.message}`
1443
1637
  );
1444
1638
  this.body = body;
1445
- this.name = "FailedToListDomainsError";
1639
+ this.name = "RestoreFailedError";
1446
1640
  }
1447
- static code = "FAILED_TO_LIST_DOMAINS";
1641
+ static code = "RESTORE_FAILED";
1448
1642
  static statusCode = 500;
1449
- static description = `Failed to list domains: {message}`;
1643
+ static description = `Failed to restore from backup: {message}`;
1450
1644
  }
1451
- class FailedToListVerificationsError extends Error {
1645
+ class CreateBackupFailedError extends Error {
1452
1646
  constructor(body) {
1453
1647
  super(
1454
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
1648
+ `CREATE_BACKUP_FAILED: ${body.message}`
1455
1649
  );
1456
1650
  this.body = body;
1457
- this.name = "FailedToListVerificationsError";
1651
+ this.name = "CreateBackupFailedError";
1458
1652
  }
1459
- static code = "FAILED_TO_LIST_VERIFICATIONS";
1653
+ static code = "CREATE_BACKUP_FAILED";
1460
1654
  static statusCode = 500;
1461
- static description = `Failed to list verifications: {message}`;
1655
+ static description = `Failed to create backup: {message}`;
1462
1656
  }
1463
- class FailedToVerifyDomainError extends Error {
1657
+ class BackupFailedError extends Error {
1464
1658
  constructor(body) {
1465
1659
  super(
1466
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
1660
+ `BACKUP_FAILED: ${body.message}`
1467
1661
  );
1468
1662
  this.body = body;
1469
- this.name = "FailedToVerifyDomainError";
1663
+ this.name = "BackupFailedError";
1470
1664
  }
1471
- static code = "FAILED_TO_VERIFY_DOMAIN";
1665
+ static code = "BACKUP_FAILED";
1472
1666
  static statusCode = 500;
1473
- static description = `Failed to verify domain: {message}`;
1667
+ static description = `Backup failed: {message}`;
1474
1668
  }
1475
- class VerificationFailedError extends Error {
1669
+ class DeploymentFailedError extends Error {
1476
1670
  constructor(body) {
1477
1671
  super(
1478
- `VERIFICATION_FAILED: ${body.message}`
1672
+ `DEPLOYMENT_FAILED: ${body.message}`
1479
1673
  );
1480
1674
  this.body = body;
1481
- this.name = "VerificationFailedError";
1675
+ this.name = "DeploymentFailedError";
1482
1676
  }
1483
- static code = "VERIFICATION_FAILED";
1484
- static statusCode = 400;
1485
- static description = `Domain verification failed: {message}`;
1677
+ static code = "DEPLOYMENT_FAILED";
1678
+ static statusCode = 500;
1679
+ static description = `Deployment failed: {message}`;
1486
1680
  }
1487
- class FailedToDeleteVerificationError extends Error {
1681
+ class InvalidDeploymentRequestError extends Error {
1488
1682
  constructor(body) {
1489
1683
  super(
1490
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
1684
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
1491
1685
  );
1492
1686
  this.body = body;
1493
- this.name = "FailedToDeleteVerificationError";
1687
+ this.name = "InvalidDeploymentRequestError";
1494
1688
  }
1495
- static code = "FAILED_TO_DELETE_VERIFICATION";
1689
+ static code = "INVALID_DEPLOYMENT_REQUEST";
1496
1690
  static statusCode = 400;
1497
- static description = `Failed to delete verification: {message}`;
1691
+ static description = `Invalid deployment request: {message}`;
1498
1692
  }
1499
- class VerificationNotFoundError extends Error {
1693
+ class ProjectNotFoundError extends Error {
1500
1694
  constructor(body) {
1501
1695
  super(
1502
- `VERIFICATION_NOT_FOUND: ${body.message}`
1696
+ `PROJECT_NOT_FOUND: ${body.message}`
1503
1697
  );
1504
1698
  this.body = body;
1505
- this.name = "VerificationNotFoundError";
1699
+ this.name = "ProjectNotFoundError";
1506
1700
  }
1507
- static code = "VERIFICATION_NOT_FOUND";
1701
+ static code = "PROJECT_NOT_FOUND";
1508
1702
  static statusCode = 404;
1509
- static description = `Verification request not found for domain: {domain}`;
1703
+ static description = `Project not found: {project_id}`;
1510
1704
  }
1511
- class FailedToCreateVerificationCodeError extends Error {
1705
+ class UnauthorizedErrorError extends Error {
1512
1706
  constructor(body) {
1513
1707
  super(
1514
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
1708
+ `UNAUTHORIZED_ERROR: ${body.message}`
1515
1709
  );
1516
1710
  this.body = body;
1517
- this.name = "FailedToCreateVerificationCodeError";
1711
+ this.name = "UnauthorizedErrorError";
1518
1712
  }
1519
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
1520
- static statusCode = 400;
1521
- static description = `Failed to create verification code: {message}`;
1713
+ static code = "UNAUTHORIZED_ERROR";
1714
+ static statusCode = 401;
1715
+ static description = `Unauthorized request to {route}`;
1522
1716
  }
1523
- class InvalidDomainError extends Error {
1717
+ class ExecuteLimitExceededError extends Error {
1524
1718
  constructor(body) {
1525
1719
  super(
1526
- `INVALID_DOMAIN: ${body.message}`
1720
+ `EXECUTE_LIMIT_EXCEEDED: ${body.message}`
1527
1721
  );
1528
1722
  this.body = body;
1529
- this.name = "InvalidDomainError";
1723
+ this.name = "ExecuteLimitExceededError";
1530
1724
  }
1531
- static code = "INVALID_DOMAIN";
1532
- static statusCode = 400;
1533
- static description = `Invalid domain: {domain}`;
1725
+ static code = "EXECUTE_LIMIT_EXCEEDED";
1726
+ static statusCode = 403;
1727
+ static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
1534
1728
  }
1535
- class ResizeFailedError extends Error {
1729
+ class ExecuteInternalErrorError extends Error {
1536
1730
  constructor(body) {
1537
1731
  super(
1538
- `RESIZE_FAILED: ${body.message}`
1732
+ `EXECUTE_INTERNAL_ERROR: ${body.message}`
1539
1733
  );
1540
1734
  this.body = body;
1541
- this.name = "ResizeFailedError";
1735
+ this.name = "ExecuteInternalErrorError";
1542
1736
  }
1543
- static code = "RESIZE_FAILED";
1737
+ static code = "EXECUTE_INTERNAL_ERROR";
1544
1738
  static statusCode = 500;
1545
- static description = `Failed to resize VM: {message}`;
1739
+ static description = `Internal error: {message}`;
1546
1740
  }
1547
- class InternalResizeVmNotFoundError extends Error {
1741
+ class ExecuteAccessDeniedError extends Error {
1548
1742
  constructor(body) {
1549
1743
  super(
1550
- `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
1744
+ `EXECUTE_ACCESS_DENIED: ${body.message}`
1551
1745
  );
1552
1746
  this.body = body;
1553
- this.name = "InternalResizeVmNotFoundError";
1747
+ this.name = "ExecuteAccessDeniedError";
1554
1748
  }
1555
- static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
1556
- static statusCode = 404;
1557
- static description = `VM not found`;
1749
+ static code = "EXECUTE_ACCESS_DENIED";
1750
+ static statusCode = 403;
1751
+ static description = `Access denied to execute run`;
1558
1752
  }
1559
- class PermissionAlreadyExistsError extends Error {
1753
+ class ListRunsFailedError extends Error {
1560
1754
  constructor(body) {
1561
1755
  super(
1562
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
1756
+ `LIST_RUNS_FAILED: ${body.message}`
1563
1757
  );
1564
1758
  this.body = body;
1565
- this.name = "PermissionAlreadyExistsError";
1759
+ this.name = "ListRunsFailedError";
1566
1760
  }
1567
- static code = "PERMISSION_ALREADY_EXISTS";
1568
- static statusCode = 409;
1569
- static description = `Permission already exists`;
1761
+ static code = "LIST_RUNS_FAILED";
1762
+ static statusCode = 500;
1763
+ static description = `Failed to list execute runs: {message}`;
1570
1764
  }
1571
- class ListTokensFailedError extends Error {
1765
+ class ExecutionErrorError extends Error {
1572
1766
  constructor(body) {
1573
1767
  super(
1574
- `LIST_TOKENS_FAILED: ${body.message}`
1768
+ `EXECUTION_ERROR: ${body.message}`
1575
1769
  );
1576
1770
  this.body = body;
1577
- this.name = "ListTokensFailedError";
1771
+ this.name = "ExecutionErrorError";
1578
1772
  }
1579
- static code = "LIST_TOKENS_FAILED";
1773
+ static code = "EXECUTION_ERROR";
1580
1774
  static statusCode = 500;
1581
- static description = `Failed to list tokens: {message}`;
1775
+ static description = `Script execution error: {message}`;
1582
1776
  }
1583
- class RevokeTokenFailedError extends Error {
1777
+ class ConnectionFailedError extends Error {
1584
1778
  constructor(body) {
1585
1779
  super(
1586
- `REVOKE_TOKEN_FAILED: ${body.message}`
1780
+ `CONNECTION_FAILED: ${body.message}`
1587
1781
  );
1588
1782
  this.body = body;
1589
- this.name = "RevokeTokenFailedError";
1783
+ this.name = "ConnectionFailedError";
1590
1784
  }
1591
- static code = "REVOKE_TOKEN_FAILED";
1785
+ static code = "CONNECTION_FAILED";
1592
1786
  static statusCode = 500;
1593
- static description = `Failed to revoke token: {message}`;
1787
+ static description = `Failed to connect to execute server: {message}`;
1594
1788
  }
1595
- class CreateTokenFailedError extends Error {
1789
+ class MetadataWriteFailedError extends Error {
1596
1790
  constructor(body) {
1597
1791
  super(
1598
- `CREATE_TOKEN_FAILED: ${body.message}`
1792
+ `METADATA_WRITE_FAILED: ${body.message}`
1599
1793
  );
1600
1794
  this.body = body;
1601
- this.name = "CreateTokenFailedError";
1795
+ this.name = "MetadataWriteFailedError";
1602
1796
  }
1603
- static code = "CREATE_TOKEN_FAILED";
1797
+ static code = "METADATA_WRITE_FAILED";
1604
1798
  static statusCode = 500;
1605
- static description = `Failed to create token: {message}`;
1799
+ static description = `Failed to write metadata file: {message}`;
1606
1800
  }
1607
- class ListPermissionsFailedError extends Error {
1801
+ class NodeModulesInstallFailedError extends Error {
1608
1802
  constructor(body) {
1609
1803
  super(
1610
- `LIST_PERMISSIONS_FAILED: ${body.message}`
1804
+ `NODE_MODULES_INSTALL_FAILED: ${body.message}`
1611
1805
  );
1612
1806
  this.body = body;
1613
- this.name = "ListPermissionsFailedError";
1807
+ this.name = "NodeModulesInstallFailedError";
1614
1808
  }
1615
- static code = "LIST_PERMISSIONS_FAILED";
1809
+ static code = "NODE_MODULES_INSTALL_FAILED";
1616
1810
  static statusCode = 500;
1617
- static description = `Failed to list permissions: {message}`;
1811
+ static description = `Failed to install node modules: {message}`;
1618
1812
  }
1619
- class GetPermissionFailedError extends Error {
1813
+ class NodeModulesDownloadFailedError extends Error {
1620
1814
  constructor(body) {
1621
1815
  super(
1622
- `GET_PERMISSION_FAILED: ${body.message}`
1816
+ `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
1623
1817
  );
1624
1818
  this.body = body;
1625
- this.name = "GetPermissionFailedError";
1819
+ this.name = "NodeModulesDownloadFailedError";
1626
1820
  }
1627
- static code = "GET_PERMISSION_FAILED";
1821
+ static code = "NODE_MODULES_DOWNLOAD_FAILED";
1628
1822
  static statusCode = 500;
1629
- static description = `Failed to get permission: {message}`;
1823
+ static description = `Failed to download node modules: {message}`;
1630
1824
  }
1631
- class UpdatePermissionFailedError extends Error {
1825
+ class LockGenerationFailedError extends Error {
1632
1826
  constructor(body) {
1633
1827
  super(
1634
- `UPDATE_PERMISSION_FAILED: ${body.message}`
1828
+ `LOCK_GENERATION_FAILED: ${body.message}`
1635
1829
  );
1636
1830
  this.body = body;
1637
- this.name = "UpdatePermissionFailedError";
1831
+ this.name = "LockGenerationFailedError";
1638
1832
  }
1639
- static code = "UPDATE_PERMISSION_FAILED";
1833
+ static code = "LOCK_GENERATION_FAILED";
1640
1834
  static statusCode = 500;
1641
- static description = `Failed to update permission: {message}`;
1835
+ static description = `Failed to generate lock file: {message}`;
1642
1836
  }
1643
- class RevokePermissionFailedError extends Error {
1837
+ class WriteScriptFailedError extends Error {
1644
1838
  constructor(body) {
1645
1839
  super(
1646
- `REVOKE_PERMISSION_FAILED: ${body.message}`
1840
+ `WRITE_SCRIPT_FAILED: ${body.message}`
1647
1841
  );
1648
1842
  this.body = body;
1649
- this.name = "RevokePermissionFailedError";
1843
+ this.name = "WriteScriptFailedError";
1650
1844
  }
1651
- static code = "REVOKE_PERMISSION_FAILED";
1845
+ static code = "WRITE_SCRIPT_FAILED";
1652
1846
  static statusCode = 500;
1653
- static description = `Failed to revoke permission: {message}`;
1847
+ static description = `Failed to write script file: {message}`;
1654
1848
  }
1655
- class GrantPermissionFailedError extends Error {
1849
+ class DirectoryCreationFailedError extends Error {
1656
1850
  constructor(body) {
1657
1851
  super(
1658
- `GRANT_PERMISSION_FAILED: ${body.message}`
1852
+ `DIRECTORY_CREATION_FAILED: ${body.message}`
1659
1853
  );
1660
1854
  this.body = body;
1661
- this.name = "GrantPermissionFailedError";
1855
+ this.name = "DirectoryCreationFailedError";
1662
1856
  }
1663
- static code = "GRANT_PERMISSION_FAILED";
1857
+ static code = "DIRECTORY_CREATION_FAILED";
1664
1858
  static statusCode = 500;
1665
- static description = `Failed to grant permission: {message}`;
1859
+ static description = `Failed to create script directory: {message}`;
1666
1860
  }
1667
- class ListIdentitiesFailedError extends Error {
1861
+ class NetworkPermissionsFailedError extends Error {
1668
1862
  constructor(body) {
1669
1863
  super(
1670
- `LIST_IDENTITIES_FAILED: ${body.message}`
1864
+ `NETWORK_PERMISSIONS_FAILED: ${body.message}`
1671
1865
  );
1672
1866
  this.body = body;
1673
- this.name = "ListIdentitiesFailedError";
1867
+ this.name = "NetworkPermissionsFailedError";
1674
1868
  }
1675
- static code = "LIST_IDENTITIES_FAILED";
1869
+ static code = "NETWORK_PERMISSIONS_FAILED";
1676
1870
  static statusCode = 500;
1677
- static description = `Failed to list identities: {message}`;
1871
+ static description = `Failed to insert network permissions: {message}`;
1678
1872
  }
1679
- class DeleteIdentityFailedError extends Error {
1873
+ class LoggingFailedError extends Error {
1680
1874
  constructor(body) {
1681
1875
  super(
1682
- `DELETE_IDENTITY_FAILED: ${body.message}`
1876
+ `LOGGING_FAILED: ${body.message}`
1683
1877
  );
1684
1878
  this.body = body;
1685
- this.name = "DeleteIdentityFailedError";
1879
+ this.name = "LoggingFailedError";
1686
1880
  }
1687
- static code = "DELETE_IDENTITY_FAILED";
1881
+ static code = "LOGGING_FAILED";
1688
1882
  static statusCode = 500;
1689
- static description = `Failed to delete identity: {message}`;
1883
+ static description = `Failed to log execute run: {message}`;
1690
1884
  }
1691
- class CreateIdentityFailedError extends Error {
1885
+ class RunNotFoundError extends Error {
1692
1886
  constructor(body) {
1693
1887
  super(
1694
- `CREATE_IDENTITY_FAILED: ${body.message}`
1888
+ `RUN_NOT_FOUND: ${body.message}`
1695
1889
  );
1696
1890
  this.body = body;
1697
- this.name = "CreateIdentityFailedError";
1891
+ this.name = "RunNotFoundError";
1698
1892
  }
1699
- static code = "CREATE_IDENTITY_FAILED";
1700
- static statusCode = 500;
1701
- static description = `Failed to create identity: {message}`;
1893
+ static code = "RUN_NOT_FOUND";
1894
+ static statusCode = 404;
1895
+ static description = `Execute run not found: {run_id}`;
1702
1896
  }
1703
- class VmPermissionNotFoundError extends Error {
1897
+ class FailedToProvisionCertificateError extends Error {
1704
1898
  constructor(body) {
1705
1899
  super(
1706
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
1900
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
1707
1901
  );
1708
1902
  this.body = body;
1709
- this.name = "VmPermissionNotFoundError";
1903
+ this.name = "FailedToProvisionCertificateError";
1710
1904
  }
1711
- static code = "VM_PERMISSION_NOT_FOUND";
1712
- static statusCode = 404;
1713
- static description = `VM permission not found`;
1905
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
1906
+ static statusCode = 422;
1907
+ static description = `Failed to provision certificate: {message}`;
1714
1908
  }
1715
- class PermissionNotFoundError extends Error {
1909
+ class FailedToInsertDomainMappingError extends Error {
1716
1910
  constructor(body) {
1717
1911
  super(
1718
- `PERMISSION_NOT_FOUND: ${body.message}`
1912
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
1719
1913
  );
1720
1914
  this.body = body;
1721
- this.name = "PermissionNotFoundError";
1915
+ this.name = "FailedToInsertDomainMappingError";
1722
1916
  }
1723
- static code = "PERMISSION_NOT_FOUND";
1724
- static statusCode = 404;
1725
- static description = `Permission not found`;
1917
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
1918
+ static statusCode = 500;
1919
+ static description = `Failed to insert domain mapping: {message}`;
1726
1920
  }
1727
- class GitRepositoryAccessDeniedError extends Error {
1921
+ class PermissionDeniedError extends Error {
1728
1922
  constructor(body) {
1729
1923
  super(
1730
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
1924
+ `PERMISSION_DENIED: ${body.message}`
1731
1925
  );
1732
1926
  this.body = body;
1733
- this.name = "GitRepositoryAccessDeniedError";
1927
+ this.name = "PermissionDeniedError";
1734
1928
  }
1735
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
1736
- static statusCode = 403;
1737
- static description = `You are not allowed to access this repository`;
1929
+ static code = "PERMISSION_DENIED";
1930
+ static statusCode = 401;
1931
+ static description = `Permission denied: {message}`;
1738
1932
  }
1739
- class GitRepositoryNotFoundError extends Error {
1933
+ class FailedToCheckPermissionsError extends Error {
1740
1934
  constructor(body) {
1741
1935
  super(
1742
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
1936
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
1743
1937
  );
1744
1938
  this.body = body;
1745
- this.name = "GitRepositoryNotFoundError";
1939
+ this.name = "FailedToCheckPermissionsError";
1746
1940
  }
1747
- static code = "GIT_REPOSITORY_NOT_FOUND";
1748
- static statusCode = 404;
1749
- static description = `Repository not found`;
1941
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
1942
+ static statusCode = 502;
1943
+ static description = `Failed to check permissions: {message}`;
1750
1944
  }
1751
- class CannotDeleteManagedIdentityError extends Error {
1945
+ class FailedToListDomainsError extends Error {
1752
1946
  constructor(body) {
1753
1947
  super(
1754
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
1948
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
1755
1949
  );
1756
1950
  this.body = body;
1757
- this.name = "CannotDeleteManagedIdentityError";
1951
+ this.name = "FailedToListDomainsError";
1758
1952
  }
1759
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
1760
- static statusCode = 403;
1761
- static description = `Cannot delete managed identities`;
1953
+ static code = "FAILED_TO_LIST_DOMAINS";
1954
+ static statusCode = 500;
1955
+ static description = `Failed to list domains: {message}`;
1762
1956
  }
1763
- class CannotModifyManagedIdentityError extends Error {
1957
+ class FailedToListVerificationsError extends Error {
1764
1958
  constructor(body) {
1765
1959
  super(
1766
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
1960
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
1767
1961
  );
1768
1962
  this.body = body;
1769
- this.name = "CannotModifyManagedIdentityError";
1963
+ this.name = "FailedToListVerificationsError";
1770
1964
  }
1771
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
1772
- static statusCode = 403;
1773
- static description = `Cannot modify managed identities`;
1965
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
1966
+ static statusCode = 500;
1967
+ static description = `Failed to list verifications: {message}`;
1774
1968
  }
1775
- class IdentityAccessDeniedError extends Error {
1969
+ class FailedToVerifyDomainError extends Error {
1776
1970
  constructor(body) {
1777
1971
  super(
1778
- `IDENTITY_ACCESS_DENIED: ${body.message}`
1972
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
1779
1973
  );
1780
1974
  this.body = body;
1781
- this.name = "IdentityAccessDeniedError";
1975
+ this.name = "FailedToVerifyDomainError";
1782
1976
  }
1783
- static code = "IDENTITY_ACCESS_DENIED";
1784
- static statusCode = 403;
1785
- static description = `You are not allowed to access this identity`;
1977
+ static code = "FAILED_TO_VERIFY_DOMAIN";
1978
+ static statusCode = 500;
1979
+ static description = `Failed to verify domain: {message}`;
1786
1980
  }
1787
- class IdentityNotFoundError extends Error {
1981
+ class VerificationFailedError extends Error {
1788
1982
  constructor(body) {
1789
1983
  super(
1790
- `IDENTITY_NOT_FOUND: ${body.message}`
1984
+ `VERIFICATION_FAILED: ${body.message}`
1791
1985
  );
1792
1986
  this.body = body;
1793
- this.name = "IdentityNotFoundError";
1987
+ this.name = "VerificationFailedError";
1794
1988
  }
1795
- static code = "IDENTITY_NOT_FOUND";
1796
- static statusCode = 404;
1797
- static description = `Identity not found`;
1989
+ static code = "VERIFICATION_FAILED";
1990
+ static statusCode = 400;
1991
+ static description = `Domain verification failed: {message}`;
1798
1992
  }
1799
- class TriggerErrorError extends Error {
1993
+ class FailedToDeleteVerificationError extends Error {
1800
1994
  constructor(body) {
1801
1995
  super(
1802
- `TRIGGER_ERROR: ${body.message}`
1996
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
1803
1997
  );
1804
1998
  this.body = body;
1805
- this.name = "TriggerErrorError";
1999
+ this.name = "FailedToDeleteVerificationError";
1806
2000
  }
1807
- static code = "TRIGGER_ERROR";
1808
- static statusCode = 500;
1809
- static description = `Failed to manage triggers: {message}`;
2001
+ static code = "FAILED_TO_DELETE_VERIFICATION";
2002
+ static statusCode = 400;
2003
+ static description = `Failed to delete verification: {message}`;
1810
2004
  }
1811
- class TokenErrorError extends Error {
2005
+ class VerificationNotFoundError extends Error {
1812
2006
  constructor(body) {
1813
2007
  super(
1814
- `TOKEN_ERROR: ${body.message}`
2008
+ `VERIFICATION_NOT_FOUND: ${body.message}`
1815
2009
  );
1816
2010
  this.body = body;
1817
- this.name = "TokenErrorError";
2011
+ this.name = "VerificationNotFoundError";
1818
2012
  }
1819
- static code = "TOKEN_ERROR";
1820
- static statusCode = 500;
1821
- static description = `Failed to manage tokens: {message}`;
2013
+ static code = "VERIFICATION_NOT_FOUND";
2014
+ static statusCode = 404;
2015
+ static description = `Verification request not found for domain: {domain}`;
1822
2016
  }
1823
- class PermissionErrorError extends Error {
2017
+ class FailedToCreateVerificationCodeError extends Error {
1824
2018
  constructor(body) {
1825
2019
  super(
1826
- `PERMISSION_ERROR: ${body.message}`
2020
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
1827
2021
  );
1828
2022
  this.body = body;
1829
- this.name = "PermissionErrorError";
2023
+ this.name = "FailedToCreateVerificationCodeError";
1830
2024
  }
1831
- static code = "PERMISSION_ERROR";
1832
- static statusCode = 500;
1833
- static description = `Failed to manage permissions: {message}`;
2025
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2026
+ static statusCode = 400;
2027
+ static description = `Failed to create verification code: {message}`;
1834
2028
  }
1835
- class IdentityErrorError extends Error {
2029
+ class InvalidDomainError extends Error {
1836
2030
  constructor(body) {
1837
2031
  super(
1838
- `IDENTITY_ERROR: ${body.message}`
2032
+ `INVALID_DOMAIN: ${body.message}`
1839
2033
  );
1840
2034
  this.body = body;
1841
- this.name = "IdentityErrorError";
2035
+ this.name = "InvalidDomainError";
1842
2036
  }
1843
- static code = "IDENTITY_ERROR";
1844
- static statusCode = 500;
1845
- static description = `Failed to manage identity: {message}`;
2037
+ static code = "INVALID_DOMAIN";
2038
+ static statusCode = 400;
2039
+ static description = `Invalid domain: {domain}`;
1846
2040
  }
1847
- class GetContentFailedError extends Error {
2041
+ class LimitExceededError extends Error {
1848
2042
  constructor(body) {
1849
2043
  super(
1850
- `GET_CONTENT_FAILED: ${body.message}`
2044
+ `LIMIT_EXCEEDED: ${body.message}`
1851
2045
  );
1852
2046
  this.body = body;
1853
- this.name = "GetContentFailedError";
2047
+ this.name = "LimitExceededError";
1854
2048
  }
1855
- static code = "GET_CONTENT_FAILED";
1856
- static statusCode = 500;
1857
- static description = `Failed to get content: {message}`;
2049
+ static code = "LIMIT_EXCEEDED";
2050
+ static statusCode = 403;
2051
+ static description = `Domain limit exceeded: your plan allows {limit} domains, you currently have {current}`;
1858
2052
  }
1859
- class ContentNotFoundError extends Error {
2053
+ class DomainOwnershipNotVerifiedError extends Error {
1860
2054
  constructor(body) {
1861
2055
  super(
1862
- `CONTENT_NOT_FOUND: ${body.message}`
2056
+ `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
1863
2057
  );
1864
2058
  this.body = body;
1865
- this.name = "ContentNotFoundError";
2059
+ this.name = "DomainOwnershipNotVerifiedError";
1866
2060
  }
1867
- static code = "CONTENT_NOT_FOUND";
1868
- static statusCode = 404;
1869
- static description = `Content not found: {path}`;
2061
+ static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
2062
+ static statusCode = 401;
2063
+ static description = `You have not verified ownership of domain: {domain}`;
1870
2064
  }
1871
- class DownloadFailedError extends Error {
2065
+ class VmAccessDeniedForMappingError extends Error {
1872
2066
  constructor(body) {
1873
2067
  super(
1874
- `DOWNLOAD_FAILED: ${body.message}`
2068
+ `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
1875
2069
  );
1876
2070
  this.body = body;
1877
- this.name = "DownloadFailedError";
2071
+ this.name = "VmAccessDeniedForMappingError";
1878
2072
  }
1879
- static code = "DOWNLOAD_FAILED";
1880
- static statusCode = 500;
1881
- static description = `Failed to download repository: {message}`;
2073
+ static code = "VM_ACCESS_DENIED_FOR_MAPPING";
2074
+ static statusCode = 401;
2075
+ static description = `You do not have permission to map to this VM: {vm_id}`;
1882
2076
  }
1883
- class GitServerErrorError extends Error {
2077
+ class DeploymentAccessDeniedError extends Error {
1884
2078
  constructor(body) {
1885
2079
  super(
1886
- `GIT_SERVER_ERROR: ${body.message}`
2080
+ `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
1887
2081
  );
1888
2082
  this.body = body;
1889
- this.name = "GitServerErrorError";
2083
+ this.name = "DeploymentAccessDeniedError";
1890
2084
  }
1891
- static code = "GIT_SERVER_ERROR";
1892
- static statusCode = 500;
1893
- static description = `Git server error: {message}`;
2085
+ static code = "DEPLOYMENT_ACCESS_DENIED";
2086
+ static statusCode = 401;
2087
+ static description = `You do not have permission to map to this deployment: {deployment_id}`;
1894
2088
  }
1895
- class ParseResponseErrorError extends Error {
2089
+ class FailedToProvisionCertificateForMappingError extends Error {
1896
2090
  constructor(body) {
1897
2091
  super(
1898
- `PARSE_RESPONSE_ERROR: ${body.message}`
2092
+ `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
1899
2093
  );
1900
2094
  this.body = body;
1901
- this.name = "ParseResponseErrorError";
2095
+ this.name = "FailedToProvisionCertificateForMappingError";
1902
2096
  }
1903
- static code = "PARSE_RESPONSE_ERROR";
1904
- static statusCode = 500;
1905
- static description = `Failed to parse response from Git server: {message}`;
2097
+ static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
2098
+ static statusCode = 422;
2099
+ static description = `Failed to provision certificate for mapping: {message}`;
1906
2100
  }
1907
- class RepositoryAccessDeniedError extends Error {
2101
+ class FailedInsertDomainMappingError extends Error {
1908
2102
  constructor(body) {
1909
2103
  super(
1910
- `REPOSITORY_ACCESS_DENIED: ${body.message}`
2104
+ `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
1911
2105
  );
1912
2106
  this.body = body;
1913
- this.name = "RepositoryAccessDeniedError";
2107
+ this.name = "FailedInsertDomainMappingError";
1914
2108
  }
1915
- static code = "REPOSITORY_ACCESS_DENIED";
1916
- static statusCode = 403;
1917
- static description = `Repository does not belong to account`;
2109
+ static code = "FAILED_INSERT_DOMAIN_MAPPING";
2110
+ static statusCode = 500;
2111
+ static description = `Failed to insert domain mapping: {message}`;
1918
2112
  }
1919
- class GitHubSyncFailedError extends Error {
2113
+ class DomainAlreadyExistsError extends Error {
1920
2114
  constructor(body) {
1921
2115
  super(
1922
- `GIT_HUB_SYNC_FAILED: ${body.message}`
2116
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
1923
2117
  );
1924
2118
  this.body = body;
1925
- this.name = "GitHubSyncFailedError";
2119
+ this.name = "DomainAlreadyExistsError";
1926
2120
  }
1927
- static code = "GIT_HUB_SYNC_FAILED";
1928
- static statusCode = 500;
1929
- static description = `Failed to configure GitHub sync: {message}`;
2121
+ static code = "DOMAIN_ALREADY_EXISTS";
2122
+ static statusCode = 400;
2123
+ static description = `Domain already exists: {domain}`;
1930
2124
  }
1931
- class UpdateDefaultBranchFailedError extends Error {
2125
+ class FailedToInsertOwnershipError extends Error {
1932
2126
  constructor(body) {
1933
2127
  super(
1934
- `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2128
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
1935
2129
  );
1936
2130
  this.body = body;
1937
- this.name = "UpdateDefaultBranchFailedError";
2131
+ this.name = "FailedToInsertOwnershipError";
1938
2132
  }
1939
- static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2133
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
1940
2134
  static statusCode = 500;
1941
- static description = `Failed to update default branch: {message}`;
2135
+ static description = `Failed to insert domain ownership: {message}`;
1942
2136
  }
1943
- class GetRepositoryInfoFailedError extends Error {
2137
+ class FailedRemoveDomainMappingError extends Error {
1944
2138
  constructor(body) {
1945
2139
  super(
1946
- `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2140
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
1947
2141
  );
1948
2142
  this.body = body;
1949
- this.name = "GetRepositoryInfoFailedError";
2143
+ this.name = "FailedRemoveDomainMappingError";
1950
2144
  }
1951
- static code = "GET_REPOSITORY_INFO_FAILED";
2145
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
1952
2146
  static statusCode = 500;
1953
- static description = `Failed to get repository info: {message}`;
2147
+ static description = `Failed to remove domain mapping: {message}`;
1954
2148
  }
1955
- class ListRepositoriesFailedError extends Error {
2149
+ class FailedPermissionsCheckError extends Error {
1956
2150
  constructor(body) {
1957
2151
  super(
1958
- `LIST_REPOSITORIES_FAILED: ${body.message}`
2152
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
1959
2153
  );
1960
2154
  this.body = body;
1961
- this.name = "ListRepositoriesFailedError";
2155
+ this.name = "FailedPermissionsCheckError";
1962
2156
  }
1963
- static code = "LIST_REPOSITORIES_FAILED";
1964
- static statusCode = 500;
1965
- static description = `Failed to list repositories: {message}`;
2157
+ static code = "FAILED_PERMISSIONS_CHECK";
2158
+ static statusCode = 401;
2159
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
1966
2160
  }
1967
- class DeleteRepositoryFailedError extends Error {
2161
+ class FailedToCheckDomainMappingPermissionsError extends Error {
1968
2162
  constructor(body) {
1969
2163
  super(
1970
- `DELETE_REPOSITORY_FAILED: ${body.message}`
2164
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
1971
2165
  );
1972
2166
  this.body = body;
1973
- this.name = "DeleteRepositoryFailedError";
2167
+ this.name = "FailedToCheckDomainMappingPermissionsError";
1974
2168
  }
1975
- static code = "DELETE_REPOSITORY_FAILED";
1976
- static statusCode = 500;
1977
- static description = `Failed to delete repository: {message}`;
2169
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2170
+ static statusCode = 502;
2171
+ static description = `Failed to check permissions: {message}`;
1978
2172
  }
1979
- class CreateRepositoryFailedError extends Error {
2173
+ class BuildFailedError extends Error {
1980
2174
  constructor(body) {
1981
2175
  super(
1982
- `CREATE_REPOSITORY_FAILED: ${body.message}`
2176
+ `BUILD_FAILED: ${body.message}`
1983
2177
  );
1984
2178
  this.body = body;
1985
- this.name = "CreateRepositoryFailedError";
2179
+ this.name = "BuildFailedError";
1986
2180
  }
1987
- static code = "CREATE_REPOSITORY_FAILED";
2181
+ static code = "BUILD_FAILED";
1988
2182
  static statusCode = 500;
1989
- static description = `Failed to create repository: {message}`;
2183
+ static description = `Build failed on VM {vm_id}`;
1990
2184
  }
1991
- class SerializationErrorError extends Error {
2185
+ class ServerDeploymentFailedError extends Error {
1992
2186
  constructor(body) {
1993
2187
  super(
1994
- `SERIALIZATION_ERROR: ${body.message}`
2188
+ `SERVER_DEPLOYMENT_FAILED: ${body.message}`
1995
2189
  );
1996
2190
  this.body = body;
1997
- this.name = "SerializationErrorError";
2191
+ this.name = "ServerDeploymentFailedError";
1998
2192
  }
1999
- static code = "SERIALIZATION_ERROR";
2000
- static statusCode = 400;
2001
- static description = `Failed to serialize request: {message}`;
2193
+ static code = "SERVER_DEPLOYMENT_FAILED";
2194
+ static statusCode = 502;
2195
+ static description = `Failed to deploy to servers`;
2002
2196
  }
2003
- class GitInvalidRequestError extends Error {
2197
+ class LockfileErrorError extends Error {
2004
2198
  constructor(body) {
2005
2199
  super(
2006
- `GIT_INVALID_REQUEST: ${body.message}`
2200
+ `LOCKFILE_ERROR: ${body.message}`
2007
2201
  );
2008
2202
  this.body = body;
2009
- this.name = "GitInvalidRequestError";
2203
+ this.name = "LockfileErrorError";
2010
2204
  }
2011
- static code = "GIT_INVALID_REQUEST";
2012
- static statusCode = 400;
2013
- static description = `Invalid request: {message}`;
2205
+ static code = "LOCKFILE_ERROR";
2206
+ static statusCode = 500;
2207
+ static description = `Failed to generate dependency lockfile: {message}`;
2014
2208
  }
2015
- class RepositoryNotFoundError extends Error {
2209
+ class UploadErrorError extends Error {
2016
2210
  constructor(body) {
2017
2211
  super(
2018
- `REPOSITORY_NOT_FOUND: ${body.message}`
2212
+ `UPLOAD_ERROR: ${body.message}`
2019
2213
  );
2020
2214
  this.body = body;
2021
- this.name = "RepositoryNotFoundError";
2215
+ this.name = "UploadErrorError";
2022
2216
  }
2023
- static code = "REPOSITORY_NOT_FOUND";
2024
- static statusCode = 404;
2025
- static description = `Repository not found: {repo_id}`;
2217
+ static code = "UPLOAD_ERROR";
2218
+ static statusCode = 500;
2219
+ static description = `Failed to upload deployment to storage`;
2026
2220
  }
2027
- class ExecuteInternalErrorError extends Error {
2221
+ class DomainMappingErrorError extends Error {
2028
2222
  constructor(body) {
2029
2223
  super(
2030
- `EXECUTE_INTERNAL_ERROR: ${body.message}`
2224
+ `DOMAIN_MAPPING_ERROR: ${body.message}`
2031
2225
  );
2032
2226
  this.body = body;
2033
- this.name = "ExecuteInternalErrorError";
2227
+ this.name = "DomainMappingErrorError";
2034
2228
  }
2035
- static code = "EXECUTE_INTERNAL_ERROR";
2229
+ static code = "DOMAIN_MAPPING_ERROR";
2036
2230
  static statusCode = 500;
2037
- static description = `Internal error: {message}`;
2231
+ static description = `Failed to configure domain mapping for: {domain}`;
2038
2232
  }
2039
- class ExecuteAccessDeniedError extends Error {
2233
+ class CertificateProvisioningErrorError extends Error {
2040
2234
  constructor(body) {
2041
2235
  super(
2042
- `EXECUTE_ACCESS_DENIED: ${body.message}`
2236
+ `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2043
2237
  );
2044
2238
  this.body = body;
2045
- this.name = "ExecuteAccessDeniedError";
2239
+ this.name = "CertificateProvisioningErrorError";
2046
2240
  }
2047
- static code = "EXECUTE_ACCESS_DENIED";
2048
- static statusCode = 403;
2049
- static description = `Access denied to execute run`;
2241
+ static code = "CERTIFICATE_PROVISIONING_ERROR";
2242
+ static statusCode = 502;
2243
+ static description = `Failed to provision certificate for domain: {domain}`;
2050
2244
  }
2051
- class ListRunsFailedError extends Error {
2245
+ class NoEntrypointFoundError extends Error {
2052
2246
  constructor(body) {
2053
2247
  super(
2054
- `LIST_RUNS_FAILED: ${body.message}`
2248
+ `NO_ENTRYPOINT_FOUND: ${body.message}`
2055
2249
  );
2056
2250
  this.body = body;
2057
- this.name = "ListRunsFailedError";
2251
+ this.name = "NoEntrypointFoundError";
2058
2252
  }
2059
- static code = "LIST_RUNS_FAILED";
2060
- static statusCode = 500;
2061
- static description = `Failed to list execute runs: {message}`;
2253
+ static code = "NO_ENTRYPOINT_FOUND";
2254
+ static statusCode = 400;
2255
+ static description = `No entrypoint found in deployment`;
2062
2256
  }
2063
- class ExecutionErrorError extends Error {
2257
+ class EntrypointNotFoundError extends Error {
2064
2258
  constructor(body) {
2065
2259
  super(
2066
- `EXECUTION_ERROR: ${body.message}`
2260
+ `ENTRYPOINT_NOT_FOUND: ${body.message}`
2067
2261
  );
2068
2262
  this.body = body;
2069
- this.name = "ExecutionErrorError";
2263
+ this.name = "EntrypointNotFoundError";
2070
2264
  }
2071
- static code = "EXECUTION_ERROR";
2072
- static statusCode = 500;
2073
- static description = `Script execution error: {message}`;
2265
+ static code = "ENTRYPOINT_NOT_FOUND";
2266
+ static statusCode = 400;
2267
+ static description = `Entrypoint not found: {entrypoint}`;
2074
2268
  }
2075
- class ConnectionFailedError extends Error {
2269
+ class NoDomainOwnershipError extends Error {
2076
2270
  constructor(body) {
2077
2271
  super(
2078
- `CONNECTION_FAILED: ${body.message}`
2272
+ `NO_DOMAIN_OWNERSHIP: ${body.message}`
2079
2273
  );
2080
2274
  this.body = body;
2081
- this.name = "ConnectionFailedError";
2275
+ this.name = "NoDomainOwnershipError";
2082
2276
  }
2083
- static code = "CONNECTION_FAILED";
2084
- static statusCode = 500;
2085
- static description = `Failed to connect to execute server: {message}`;
2277
+ static code = "NO_DOMAIN_OWNERSHIP";
2278
+ static statusCode = 403;
2279
+ static description = `No domain ownership for: {domain}`;
2086
2280
  }
2087
- class MetadataWriteFailedError extends Error {
2281
+ class InvalidDomainsError extends Error {
2088
2282
  constructor(body) {
2089
2283
  super(
2090
- `METADATA_WRITE_FAILED: ${body.message}`
2284
+ `INVALID_DOMAINS: ${body.message}`
2091
2285
  );
2092
2286
  this.body = body;
2093
- this.name = "MetadataWriteFailedError";
2287
+ this.name = "InvalidDomainsError";
2094
2288
  }
2095
- static code = "METADATA_WRITE_FAILED";
2096
- static statusCode = 500;
2097
- static description = `Failed to write metadata file: {message}`;
2289
+ static code = "INVALID_DOMAINS";
2290
+ static statusCode = 400;
2291
+ static description = `Invalid domains provided`;
2098
2292
  }
2099
- class NodeModulesInstallFailedError extends Error {
2293
+ class WebDeploymentBadRequestError extends Error {
2100
2294
  constructor(body) {
2101
2295
  super(
2102
- `NODE_MODULES_INSTALL_FAILED: ${body.message}`
2296
+ `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2103
2297
  );
2104
2298
  this.body = body;
2105
- this.name = "NodeModulesInstallFailedError";
2299
+ this.name = "WebDeploymentBadRequestError";
2106
2300
  }
2107
- static code = "NODE_MODULES_INSTALL_FAILED";
2108
- static statusCode = 500;
2109
- static description = `Failed to install node modules: {message}`;
2301
+ static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2302
+ static statusCode = 400;
2303
+ static description = `Bad request: {message}`;
2110
2304
  }
2111
- class NodeModulesDownloadFailedError extends Error {
2305
+ class DeploymentNotFoundError extends Error {
2112
2306
  constructor(body) {
2113
2307
  super(
2114
- `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
2308
+ `DEPLOYMENT_NOT_FOUND: ${body.message}`
2115
2309
  );
2116
2310
  this.body = body;
2117
- this.name = "NodeModulesDownloadFailedError";
2311
+ this.name = "DeploymentNotFoundError";
2118
2312
  }
2119
- static code = "NODE_MODULES_DOWNLOAD_FAILED";
2120
- static statusCode = 500;
2121
- static description = `Failed to download node modules: {message}`;
2313
+ static code = "DEPLOYMENT_NOT_FOUND";
2314
+ static statusCode = 404;
2315
+ static description = `Deployment not found`;
2122
2316
  }
2123
- class LockGenerationFailedError extends Error {
2317
+ class ObservabilityDatabaseErrorError extends Error {
2124
2318
  constructor(body) {
2125
2319
  super(
2126
- `LOCK_GENERATION_FAILED: ${body.message}`
2320
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2127
2321
  );
2128
2322
  this.body = body;
2129
- this.name = "LockGenerationFailedError";
2323
+ this.name = "ObservabilityDatabaseErrorError";
2130
2324
  }
2131
- static code = "LOCK_GENERATION_FAILED";
2325
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2132
2326
  static statusCode = 500;
2133
- static description = `Failed to generate lock file: {message}`;
2327
+ static description = `Database operation failed: {message}`;
2134
2328
  }
2135
- class WriteScriptFailedError extends Error {
2329
+ class ObservabilityAccessDeniedError extends Error {
2136
2330
  constructor(body) {
2137
2331
  super(
2138
- `WRITE_SCRIPT_FAILED: ${body.message}`
2332
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2139
2333
  );
2140
2334
  this.body = body;
2141
- this.name = "WriteScriptFailedError";
2335
+ this.name = "ObservabilityAccessDeniedError";
2142
2336
  }
2143
- static code = "WRITE_SCRIPT_FAILED";
2144
- static statusCode = 500;
2145
- static description = `Failed to write script file: {message}`;
2337
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2338
+ static statusCode = 403;
2339
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2146
2340
  }
2147
- class DirectoryCreationFailedError extends Error {
2341
+ class ParseLogsFailedError extends Error {
2148
2342
  constructor(body) {
2149
2343
  super(
2150
- `DIRECTORY_CREATION_FAILED: ${body.message}`
2344
+ `PARSE_LOGS_FAILED: ${body.message}`
2151
2345
  );
2152
2346
  this.body = body;
2153
- this.name = "DirectoryCreationFailedError";
2347
+ this.name = "ParseLogsFailedError";
2154
2348
  }
2155
- static code = "DIRECTORY_CREATION_FAILED";
2349
+ static code = "PARSE_LOGS_FAILED";
2156
2350
  static statusCode = 500;
2157
- static description = `Failed to create script directory: {message}`;
2351
+ static description = `Failed to parse logs: {message}`;
2158
2352
  }
2159
- class NetworkPermissionsFailedError extends Error {
2353
+ class RetrieveLogsFailedError extends Error {
2160
2354
  constructor(body) {
2161
2355
  super(
2162
- `NETWORK_PERMISSIONS_FAILED: ${body.message}`
2356
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2163
2357
  );
2164
2358
  this.body = body;
2165
- this.name = "NetworkPermissionsFailedError";
2359
+ this.name = "RetrieveLogsFailedError";
2166
2360
  }
2167
- static code = "NETWORK_PERMISSIONS_FAILED";
2361
+ static code = "RETRIEVE_LOGS_FAILED";
2168
2362
  static statusCode = 500;
2169
- static description = `Failed to insert network permissions: {message}`;
2363
+ static description = `Failed to retrieve logs: {message}`;
2170
2364
  }
2171
- class LoggingFailedError extends Error {
2365
+ class InvalidQueryError extends Error {
2172
2366
  constructor(body) {
2173
2367
  super(
2174
- `LOGGING_FAILED: ${body.message}`
2368
+ `INVALID_QUERY: ${body.message}`
2175
2369
  );
2176
2370
  this.body = body;
2177
- this.name = "LoggingFailedError";
2371
+ this.name = "InvalidQueryError";
2178
2372
  }
2179
- static code = "LOGGING_FAILED";
2180
- static statusCode = 500;
2181
- static description = `Failed to log execute run: {message}`;
2373
+ static code = "INVALID_QUERY";
2374
+ static statusCode = 400;
2375
+ static description = `Invalid log query: {message}`;
2182
2376
  }
2183
- class RunNotFoundError extends Error {
2377
+ class LogsNotFoundError extends Error {
2184
2378
  constructor(body) {
2185
2379
  super(
2186
- `RUN_NOT_FOUND: ${body.message}`
2380
+ `LOGS_NOT_FOUND: ${body.message}`
2187
2381
  );
2188
2382
  this.body = body;
2189
- this.name = "RunNotFoundError";
2383
+ this.name = "LogsNotFoundError";
2190
2384
  }
2191
- static code = "RUN_NOT_FOUND";
2385
+ static code = "LOGS_NOT_FOUND";
2192
2386
  static statusCode = 404;
2193
- static description = `Execute run not found: {run_id}`;
2387
+ static description = `Logs not found for deployment: {deployment_id}`;
2194
2388
  }
2195
- class CloudstateInternalErrorError extends Error {
2389
+ class PermissionAlreadyExistsError extends Error {
2196
2390
  constructor(body) {
2197
2391
  super(
2198
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2392
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
2199
2393
  );
2200
2394
  this.body = body;
2201
- this.name = "CloudstateInternalErrorError";
2395
+ this.name = "PermissionAlreadyExistsError";
2202
2396
  }
2203
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2204
- static statusCode = 500;
2205
- static description = `Internal error: {message}`;
2397
+ static code = "PERMISSION_ALREADY_EXISTS";
2398
+ static statusCode = 409;
2399
+ static description = `Permission already exists`;
2206
2400
  }
2207
- class CloudstateDatabaseErrorError extends Error {
2401
+ class ListTokensFailedError extends Error {
2208
2402
  constructor(body) {
2209
2403
  super(
2210
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2404
+ `LIST_TOKENS_FAILED: ${body.message}`
2211
2405
  );
2212
2406
  this.body = body;
2213
- this.name = "CloudstateDatabaseErrorError";
2407
+ this.name = "ListTokensFailedError";
2214
2408
  }
2215
- static code = "CLOUDSTATE_DATABASE_ERROR";
2409
+ static code = "LIST_TOKENS_FAILED";
2216
2410
  static statusCode = 500;
2217
- static description = `Database operation failed: {message}`;
2411
+ static description = `Failed to list tokens: {message}`;
2218
2412
  }
2219
- class CloudstateAccessDeniedError extends Error {
2413
+ class RevokeTokenFailedError extends Error {
2220
2414
  constructor(body) {
2221
2415
  super(
2222
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2416
+ `REVOKE_TOKEN_FAILED: ${body.message}`
2223
2417
  );
2224
2418
  this.body = body;
2225
- this.name = "CloudstateAccessDeniedError";
2419
+ this.name = "RevokeTokenFailedError";
2226
2420
  }
2227
- static code = "CLOUDSTATE_ACCESS_DENIED";
2228
- static statusCode = 403;
2229
- static description = `Access denied to project: {project_id}`;
2421
+ static code = "REVOKE_TOKEN_FAILED";
2422
+ static statusCode = 500;
2423
+ static description = `Failed to revoke token: {message}`;
2230
2424
  }
2231
- class RestoreFailedError extends Error {
2425
+ class CreateTokenFailedError extends Error {
2232
2426
  constructor(body) {
2233
2427
  super(
2234
- `RESTORE_FAILED: ${body.message}`
2428
+ `CREATE_TOKEN_FAILED: ${body.message}`
2235
2429
  );
2236
2430
  this.body = body;
2237
- this.name = "RestoreFailedError";
2431
+ this.name = "CreateTokenFailedError";
2238
2432
  }
2239
- static code = "RESTORE_FAILED";
2433
+ static code = "CREATE_TOKEN_FAILED";
2240
2434
  static statusCode = 500;
2241
- static description = `Failed to restore from backup: {message}`;
2435
+ static description = `Failed to create token: {message}`;
2242
2436
  }
2243
- class CreateBackupFailedError extends Error {
2437
+ class ListPermissionsFailedError extends Error {
2244
2438
  constructor(body) {
2245
2439
  super(
2246
- `CREATE_BACKUP_FAILED: ${body.message}`
2440
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
2247
2441
  );
2248
2442
  this.body = body;
2249
- this.name = "CreateBackupFailedError";
2443
+ this.name = "ListPermissionsFailedError";
2250
2444
  }
2251
- static code = "CREATE_BACKUP_FAILED";
2445
+ static code = "LIST_PERMISSIONS_FAILED";
2252
2446
  static statusCode = 500;
2253
- static description = `Failed to create backup: {message}`;
2447
+ static description = `Failed to list permissions: {message}`;
2254
2448
  }
2255
- class BackupFailedError extends Error {
2449
+ class GetPermissionFailedError extends Error {
2256
2450
  constructor(body) {
2257
2451
  super(
2258
- `BACKUP_FAILED: ${body.message}`
2452
+ `GET_PERMISSION_FAILED: ${body.message}`
2259
2453
  );
2260
2454
  this.body = body;
2261
- this.name = "BackupFailedError";
2455
+ this.name = "GetPermissionFailedError";
2262
2456
  }
2263
- static code = "BACKUP_FAILED";
2457
+ static code = "GET_PERMISSION_FAILED";
2264
2458
  static statusCode = 500;
2265
- static description = `Backup failed: {message}`;
2459
+ static description = `Failed to get permission: {message}`;
2266
2460
  }
2267
- class DeploymentFailedError extends Error {
2461
+ class UpdatePermissionFailedError extends Error {
2268
2462
  constructor(body) {
2269
2463
  super(
2270
- `DEPLOYMENT_FAILED: ${body.message}`
2464
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
2271
2465
  );
2272
2466
  this.body = body;
2273
- this.name = "DeploymentFailedError";
2467
+ this.name = "UpdatePermissionFailedError";
2274
2468
  }
2275
- static code = "DEPLOYMENT_FAILED";
2469
+ static code = "UPDATE_PERMISSION_FAILED";
2276
2470
  static statusCode = 500;
2277
- static description = `Deployment failed: {message}`;
2471
+ static description = `Failed to update permission: {message}`;
2278
2472
  }
2279
- class InvalidDeploymentRequestError extends Error {
2473
+ class RevokePermissionFailedError extends Error {
2280
2474
  constructor(body) {
2281
2475
  super(
2282
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2476
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
2283
2477
  );
2284
2478
  this.body = body;
2285
- this.name = "InvalidDeploymentRequestError";
2479
+ this.name = "RevokePermissionFailedError";
2286
2480
  }
2287
- static code = "INVALID_DEPLOYMENT_REQUEST";
2288
- static statusCode = 400;
2289
- static description = `Invalid deployment request: {message}`;
2481
+ static code = "REVOKE_PERMISSION_FAILED";
2482
+ static statusCode = 500;
2483
+ static description = `Failed to revoke permission: {message}`;
2290
2484
  }
2291
- class ProjectNotFoundError extends Error {
2485
+ class GrantPermissionFailedError extends Error {
2292
2486
  constructor(body) {
2293
2487
  super(
2294
- `PROJECT_NOT_FOUND: ${body.message}`
2488
+ `GRANT_PERMISSION_FAILED: ${body.message}`
2295
2489
  );
2296
2490
  this.body = body;
2297
- this.name = "ProjectNotFoundError";
2491
+ this.name = "GrantPermissionFailedError";
2298
2492
  }
2299
- static code = "PROJECT_NOT_FOUND";
2300
- static statusCode = 404;
2301
- static description = `Project not found: {project_id}`;
2493
+ static code = "GRANT_PERMISSION_FAILED";
2494
+ static statusCode = 500;
2495
+ static description = `Failed to grant permission: {message}`;
2302
2496
  }
2303
- class UnauthorizedErrorError extends Error {
2497
+ class ListIdentitiesFailedError extends Error {
2304
2498
  constructor(body) {
2305
2499
  super(
2306
- `UNAUTHORIZED_ERROR: ${body.message}`
2500
+ `LIST_IDENTITIES_FAILED: ${body.message}`
2307
2501
  );
2308
2502
  this.body = body;
2309
- this.name = "UnauthorizedErrorError";
2503
+ this.name = "ListIdentitiesFailedError";
2310
2504
  }
2311
- static code = "UNAUTHORIZED_ERROR";
2312
- static statusCode = 401;
2313
- static description = `Unauthorized request to {route}`;
2505
+ static code = "LIST_IDENTITIES_FAILED";
2506
+ static statusCode = 500;
2507
+ static description = `Failed to list identities: {message}`;
2314
2508
  }
2315
- class BuildFailedError extends Error {
2509
+ class DeleteIdentityFailedError extends Error {
2316
2510
  constructor(body) {
2317
2511
  super(
2318
- `BUILD_FAILED: ${body.message}`
2512
+ `DELETE_IDENTITY_FAILED: ${body.message}`
2319
2513
  );
2320
2514
  this.body = body;
2321
- this.name = "BuildFailedError";
2515
+ this.name = "DeleteIdentityFailedError";
2322
2516
  }
2323
- static code = "BUILD_FAILED";
2517
+ static code = "DELETE_IDENTITY_FAILED";
2324
2518
  static statusCode = 500;
2325
- static description = `Build failed on VM {vm_id}`;
2519
+ static description = `Failed to delete identity: {message}`;
2326
2520
  }
2327
- class ServerDeploymentFailedError extends Error {
2521
+ class CreateIdentityFailedError extends Error {
2328
2522
  constructor(body) {
2329
2523
  super(
2330
- `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2524
+ `CREATE_IDENTITY_FAILED: ${body.message}`
2331
2525
  );
2332
2526
  this.body = body;
2333
- this.name = "ServerDeploymentFailedError";
2527
+ this.name = "CreateIdentityFailedError";
2334
2528
  }
2335
- static code = "SERVER_DEPLOYMENT_FAILED";
2336
- static statusCode = 502;
2337
- static description = `Failed to deploy to servers`;
2529
+ static code = "CREATE_IDENTITY_FAILED";
2530
+ static statusCode = 500;
2531
+ static description = `Failed to create identity: {message}`;
2338
2532
  }
2339
- class LockfileErrorError extends Error {
2533
+ class VmPermissionNotFoundError extends Error {
2340
2534
  constructor(body) {
2341
2535
  super(
2342
- `LOCKFILE_ERROR: ${body.message}`
2536
+ `VM_PERMISSION_NOT_FOUND: ${body.message}`
2343
2537
  );
2344
2538
  this.body = body;
2345
- this.name = "LockfileErrorError";
2539
+ this.name = "VmPermissionNotFoundError";
2346
2540
  }
2347
- static code = "LOCKFILE_ERROR";
2348
- static statusCode = 500;
2349
- static description = `Failed to generate dependency lockfile: {message}`;
2541
+ static code = "VM_PERMISSION_NOT_FOUND";
2542
+ static statusCode = 404;
2543
+ static description = `VM permission not found`;
2350
2544
  }
2351
- class UploadErrorError extends Error {
2545
+ class PermissionNotFoundError extends Error {
2352
2546
  constructor(body) {
2353
2547
  super(
2354
- `UPLOAD_ERROR: ${body.message}`
2548
+ `PERMISSION_NOT_FOUND: ${body.message}`
2355
2549
  );
2356
2550
  this.body = body;
2357
- this.name = "UploadErrorError";
2551
+ this.name = "PermissionNotFoundError";
2358
2552
  }
2359
- static code = "UPLOAD_ERROR";
2360
- static statusCode = 500;
2361
- static description = `Failed to upload deployment to storage`;
2553
+ static code = "PERMISSION_NOT_FOUND";
2554
+ static statusCode = 404;
2555
+ static description = `Permission not found`;
2362
2556
  }
2363
- class DomainMappingErrorError extends Error {
2557
+ class GitRepositoryAccessDeniedError extends Error {
2364
2558
  constructor(body) {
2365
2559
  super(
2366
- `DOMAIN_MAPPING_ERROR: ${body.message}`
2560
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2367
2561
  );
2368
2562
  this.body = body;
2369
- this.name = "DomainMappingErrorError";
2563
+ this.name = "GitRepositoryAccessDeniedError";
2370
2564
  }
2371
- static code = "DOMAIN_MAPPING_ERROR";
2372
- static statusCode = 500;
2373
- static description = `Failed to configure domain mapping for: {domain}`;
2565
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
2566
+ static statusCode = 403;
2567
+ static description = `You are not allowed to access this repository`;
2374
2568
  }
2375
- class CertificateProvisioningErrorError extends Error {
2569
+ class GitRepositoryNotFoundError extends Error {
2376
2570
  constructor(body) {
2377
2571
  super(
2378
- `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2572
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
2379
2573
  );
2380
2574
  this.body = body;
2381
- this.name = "CertificateProvisioningErrorError";
2575
+ this.name = "GitRepositoryNotFoundError";
2382
2576
  }
2383
- static code = "CERTIFICATE_PROVISIONING_ERROR";
2384
- static statusCode = 502;
2385
- static description = `Failed to provision certificate for domain: {domain}`;
2577
+ static code = "GIT_REPOSITORY_NOT_FOUND";
2578
+ static statusCode = 404;
2579
+ static description = `Repository not found`;
2386
2580
  }
2387
- class NoEntrypointFoundError extends Error {
2581
+ class CannotDeleteManagedIdentityError extends Error {
2388
2582
  constructor(body) {
2389
2583
  super(
2390
- `NO_ENTRYPOINT_FOUND: ${body.message}`
2584
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
2391
2585
  );
2392
2586
  this.body = body;
2393
- this.name = "NoEntrypointFoundError";
2587
+ this.name = "CannotDeleteManagedIdentityError";
2394
2588
  }
2395
- static code = "NO_ENTRYPOINT_FOUND";
2396
- static statusCode = 400;
2397
- static description = `No entrypoint found in deployment`;
2589
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2590
+ static statusCode = 403;
2591
+ static description = `Cannot delete managed identities`;
2398
2592
  }
2399
- class EntrypointNotFoundError extends Error {
2593
+ class CannotModifyManagedIdentityError extends Error {
2400
2594
  constructor(body) {
2401
2595
  super(
2402
- `ENTRYPOINT_NOT_FOUND: ${body.message}`
2596
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
2403
2597
  );
2404
2598
  this.body = body;
2405
- this.name = "EntrypointNotFoundError";
2599
+ this.name = "CannotModifyManagedIdentityError";
2406
2600
  }
2407
- static code = "ENTRYPOINT_NOT_FOUND";
2408
- static statusCode = 400;
2409
- static description = `Entrypoint not found: {entrypoint}`;
2601
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2602
+ static statusCode = 403;
2603
+ static description = `Cannot modify managed identities`;
2410
2604
  }
2411
- class NoDomainOwnershipError extends Error {
2605
+ class IdentityAccessDeniedError extends Error {
2412
2606
  constructor(body) {
2413
2607
  super(
2414
- `NO_DOMAIN_OWNERSHIP: ${body.message}`
2608
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
2415
2609
  );
2416
2610
  this.body = body;
2417
- this.name = "NoDomainOwnershipError";
2611
+ this.name = "IdentityAccessDeniedError";
2418
2612
  }
2419
- static code = "NO_DOMAIN_OWNERSHIP";
2613
+ static code = "IDENTITY_ACCESS_DENIED";
2420
2614
  static statusCode = 403;
2421
- static description = `No domain ownership for: {domain}`;
2615
+ static description = `You are not allowed to access this identity`;
2422
2616
  }
2423
- class InvalidDomainsError extends Error {
2617
+ class IdentityNotFoundError extends Error {
2424
2618
  constructor(body) {
2425
2619
  super(
2426
- `INVALID_DOMAINS: ${body.message}`
2620
+ `IDENTITY_NOT_FOUND: ${body.message}`
2427
2621
  );
2428
2622
  this.body = body;
2429
- this.name = "InvalidDomainsError";
2623
+ this.name = "IdentityNotFoundError";
2430
2624
  }
2431
- static code = "INVALID_DOMAINS";
2432
- static statusCode = 400;
2433
- static description = `Invalid domains provided`;
2625
+ static code = "IDENTITY_NOT_FOUND";
2626
+ static statusCode = 404;
2627
+ static description = `Identity not found`;
2434
2628
  }
2435
- class WebDeploymentBadRequestError extends Error {
2629
+ class TriggerErrorError extends Error {
2436
2630
  constructor(body) {
2437
2631
  super(
2438
- `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2632
+ `TRIGGER_ERROR: ${body.message}`
2439
2633
  );
2440
2634
  this.body = body;
2441
- this.name = "WebDeploymentBadRequestError";
2635
+ this.name = "TriggerErrorError";
2442
2636
  }
2443
- static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2444
- static statusCode = 400;
2445
- static description = `Bad request: {message}`;
2637
+ static code = "TRIGGER_ERROR";
2638
+ static statusCode = 500;
2639
+ static description = `Failed to manage triggers: {message}`;
2446
2640
  }
2447
- class DeploymentNotFoundError extends Error {
2641
+ class TokenErrorError extends Error {
2448
2642
  constructor(body) {
2449
2643
  super(
2450
- `DEPLOYMENT_NOT_FOUND: ${body.message}`
2644
+ `TOKEN_ERROR: ${body.message}`
2451
2645
  );
2452
2646
  this.body = body;
2453
- this.name = "DeploymentNotFoundError";
2647
+ this.name = "TokenErrorError";
2454
2648
  }
2455
- static code = "DEPLOYMENT_NOT_FOUND";
2456
- static statusCode = 404;
2457
- static description = `Deployment not found`;
2649
+ static code = "TOKEN_ERROR";
2650
+ static statusCode = 500;
2651
+ static description = `Failed to manage tokens: {message}`;
2458
2652
  }
2459
- class DomainOwnershipVerificationFailedError extends Error {
2653
+ class PermissionErrorError extends Error {
2460
2654
  constructor(body) {
2461
2655
  super(
2462
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2656
+ `PERMISSION_ERROR: ${body.message}`
2463
2657
  );
2464
2658
  this.body = body;
2465
- this.name = "DomainOwnershipVerificationFailedError";
2659
+ this.name = "PermissionErrorError";
2466
2660
  }
2467
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2468
- static statusCode = 403;
2469
- static description = `Domain ownership verification failed`;
2661
+ static code = "PERMISSION_ERROR";
2662
+ static statusCode = 500;
2663
+ static description = `Failed to manage permissions: {message}`;
2470
2664
  }
2471
- class ErrorDeletingRecordError extends Error {
2665
+ class IdentityErrorError extends Error {
2472
2666
  constructor(body) {
2473
2667
  super(
2474
- `ERROR_DELETING_RECORD: ${body.message}`
2668
+ `IDENTITY_ERROR: ${body.message}`
2475
2669
  );
2476
2670
  this.body = body;
2477
- this.name = "ErrorDeletingRecordError";
2671
+ this.name = "IdentityErrorError";
2478
2672
  }
2479
- static code = "ERROR_DELETING_RECORD";
2673
+ static code = "IDENTITY_ERROR";
2480
2674
  static statusCode = 500;
2481
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2675
+ static description = `Failed to manage identity: {message}`;
2482
2676
  }
2483
- class RecordOwnershipErrorError extends Error {
2677
+ class GetContentFailedError extends Error {
2484
2678
  constructor(body) {
2485
2679
  super(
2486
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
2680
+ `GET_CONTENT_FAILED: ${body.message}`
2487
2681
  );
2488
2682
  this.body = body;
2489
- this.name = "RecordOwnershipErrorError";
2683
+ this.name = "GetContentFailedError";
2490
2684
  }
2491
- static code = "RECORD_OWNERSHIP_ERROR";
2492
- static statusCode = 403;
2493
- static description = `Account {account_id} does not own record {record_id}`;
2685
+ static code = "GET_CONTENT_FAILED";
2686
+ static statusCode = 500;
2687
+ static description = `Failed to get content: {message}`;
2494
2688
  }
2495
- class ErrorCreatingRecordError extends Error {
2689
+ class ContentNotFoundError extends Error {
2496
2690
  constructor(body) {
2497
2691
  super(
2498
- `ERROR_CREATING_RECORD: ${body.message}`
2692
+ `CONTENT_NOT_FOUND: ${body.message}`
2499
2693
  );
2500
2694
  this.body = body;
2501
- this.name = "ErrorCreatingRecordError";
2695
+ this.name = "ContentNotFoundError";
2502
2696
  }
2503
- static code = "ERROR_CREATING_RECORD";
2504
- static statusCode = 500;
2505
- static description = `Error creating DNS record: {message}`;
2697
+ static code = "CONTENT_NOT_FOUND";
2698
+ static statusCode = 404;
2699
+ static description = `Content not found: {path}`;
2506
2700
  }
2507
- class DomainOwnershipErrorError extends Error {
2701
+ class DownloadFailedError extends Error {
2508
2702
  constructor(body) {
2509
2703
  super(
2510
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2704
+ `DOWNLOAD_FAILED: ${body.message}`
2511
2705
  );
2512
2706
  this.body = body;
2513
- this.name = "DomainOwnershipErrorError";
2707
+ this.name = "DownloadFailedError";
2514
2708
  }
2515
- static code = "DOMAIN_OWNERSHIP_ERROR";
2516
- static statusCode = 403;
2517
- static description = `Account {account_id} does not own domain {domain}`;
2709
+ static code = "DOWNLOAD_FAILED";
2710
+ static statusCode = 500;
2711
+ static description = `Failed to download repository: {message}`;
2518
2712
  }
2519
- class AnyhowError extends Error {
2713
+ class GitServerErrorError extends Error {
2520
2714
  constructor(body) {
2521
2715
  super(
2522
- `ANYHOW: ${body.message}`
2716
+ `GIT_SERVER_ERROR: ${body.message}`
2523
2717
  );
2524
2718
  this.body = body;
2525
- this.name = "AnyhowError";
2719
+ this.name = "GitServerErrorError";
2526
2720
  }
2527
- static code = "ANYHOW";
2721
+ static code = "GIT_SERVER_ERROR";
2528
2722
  static statusCode = 500;
2529
- static description = `Internal server error: {0}`;
2723
+ static description = `Git server error: {message}`;
2530
2724
  }
2531
- class EmptyTagError extends Error {
2725
+ class ParseResponseErrorError extends Error {
2532
2726
  constructor(body) {
2533
2727
  super(
2534
- `EMPTY_TAG: ${body.message}`
2728
+ `PARSE_RESPONSE_ERROR: ${body.message}`
2535
2729
  );
2536
2730
  this.body = body;
2537
- this.name = "EmptyTagError";
2731
+ this.name = "ParseResponseErrorError";
2538
2732
  }
2539
- static code = "EMPTY_TAG";
2540
- static statusCode = 400;
2541
- static description = `Invalid request: tag cannot be empty`;
2733
+ static code = "PARSE_RESPONSE_ERROR";
2734
+ static statusCode = 500;
2735
+ static description = `Failed to parse response from Git server: {message}`;
2542
2736
  }
2543
- class DomainOwnershipNotVerifiedError extends Error {
2737
+ class RepositoryAccessDeniedError extends Error {
2544
2738
  constructor(body) {
2545
2739
  super(
2546
- `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
2740
+ `REPOSITORY_ACCESS_DENIED: ${body.message}`
2547
2741
  );
2548
2742
  this.body = body;
2549
- this.name = "DomainOwnershipNotVerifiedError";
2743
+ this.name = "RepositoryAccessDeniedError";
2550
2744
  }
2551
- static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
2552
- static statusCode = 401;
2553
- static description = `You have not verified ownership of domain: {domain}`;
2745
+ static code = "REPOSITORY_ACCESS_DENIED";
2746
+ static statusCode = 403;
2747
+ static description = `Repository does not belong to account`;
2554
2748
  }
2555
- class VmAccessDeniedForMappingError extends Error {
2749
+ class GitHubSyncFailedError extends Error {
2556
2750
  constructor(body) {
2557
2751
  super(
2558
- `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
2752
+ `GIT_HUB_SYNC_FAILED: ${body.message}`
2559
2753
  );
2560
2754
  this.body = body;
2561
- this.name = "VmAccessDeniedForMappingError";
2755
+ this.name = "GitHubSyncFailedError";
2562
2756
  }
2563
- static code = "VM_ACCESS_DENIED_FOR_MAPPING";
2564
- static statusCode = 401;
2565
- static description = `You do not have permission to map to this VM: {vm_id}`;
2757
+ static code = "GIT_HUB_SYNC_FAILED";
2758
+ static statusCode = 500;
2759
+ static description = `Failed to configure GitHub sync: {message}`;
2566
2760
  }
2567
- class DeploymentAccessDeniedError extends Error {
2761
+ class UpdateDefaultBranchFailedError extends Error {
2568
2762
  constructor(body) {
2569
2763
  super(
2570
- `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
2764
+ `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2571
2765
  );
2572
2766
  this.body = body;
2573
- this.name = "DeploymentAccessDeniedError";
2767
+ this.name = "UpdateDefaultBranchFailedError";
2574
2768
  }
2575
- static code = "DEPLOYMENT_ACCESS_DENIED";
2576
- static statusCode = 401;
2577
- static description = `You do not have permission to map to this deployment: {deployment_id}`;
2769
+ static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2770
+ static statusCode = 500;
2771
+ static description = `Failed to update default branch: {message}`;
2578
2772
  }
2579
- class FailedToProvisionCertificateForMappingError extends Error {
2773
+ class GetRepositoryInfoFailedError extends Error {
2580
2774
  constructor(body) {
2581
2775
  super(
2582
- `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
2776
+ `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2583
2777
  );
2584
2778
  this.body = body;
2585
- this.name = "FailedToProvisionCertificateForMappingError";
2779
+ this.name = "GetRepositoryInfoFailedError";
2586
2780
  }
2587
- static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
2588
- static statusCode = 422;
2589
- static description = `Failed to provision certificate for mapping: {message}`;
2781
+ static code = "GET_REPOSITORY_INFO_FAILED";
2782
+ static statusCode = 500;
2783
+ static description = `Failed to get repository info: {message}`;
2590
2784
  }
2591
- class FailedInsertDomainMappingError extends Error {
2785
+ class ListRepositoriesFailedError extends Error {
2592
2786
  constructor(body) {
2593
2787
  super(
2594
- `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
2788
+ `LIST_REPOSITORIES_FAILED: ${body.message}`
2595
2789
  );
2596
2790
  this.body = body;
2597
- this.name = "FailedInsertDomainMappingError";
2791
+ this.name = "ListRepositoriesFailedError";
2598
2792
  }
2599
- static code = "FAILED_INSERT_DOMAIN_MAPPING";
2793
+ static code = "LIST_REPOSITORIES_FAILED";
2600
2794
  static statusCode = 500;
2601
- static description = `Failed to insert domain mapping: {message}`;
2795
+ static description = `Failed to list repositories: {message}`;
2602
2796
  }
2603
- class DomainAlreadyExistsError extends Error {
2797
+ class DeleteRepositoryFailedError extends Error {
2604
2798
  constructor(body) {
2605
2799
  super(
2606
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2800
+ `DELETE_REPOSITORY_FAILED: ${body.message}`
2607
2801
  );
2608
2802
  this.body = body;
2609
- this.name = "DomainAlreadyExistsError";
2803
+ this.name = "DeleteRepositoryFailedError";
2610
2804
  }
2611
- static code = "DOMAIN_ALREADY_EXISTS";
2612
- static statusCode = 400;
2613
- static description = `Domain already exists: {domain}`;
2805
+ static code = "DELETE_REPOSITORY_FAILED";
2806
+ static statusCode = 500;
2807
+ static description = `Failed to delete repository: {message}`;
2614
2808
  }
2615
- class FailedToInsertOwnershipError extends Error {
2809
+ class CreateRepositoryFailedError extends Error {
2616
2810
  constructor(body) {
2617
2811
  super(
2618
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2812
+ `CREATE_REPOSITORY_FAILED: ${body.message}`
2619
2813
  );
2620
2814
  this.body = body;
2621
- this.name = "FailedToInsertOwnershipError";
2815
+ this.name = "CreateRepositoryFailedError";
2622
2816
  }
2623
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2817
+ static code = "CREATE_REPOSITORY_FAILED";
2624
2818
  static statusCode = 500;
2625
- static description = `Failed to insert domain ownership: {message}`;
2819
+ static description = `Failed to create repository: {message}`;
2626
2820
  }
2627
- class FailedRemoveDomainMappingError extends Error {
2821
+ class SerializationErrorError extends Error {
2628
2822
  constructor(body) {
2629
2823
  super(
2630
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2824
+ `SERIALIZATION_ERROR: ${body.message}`
2631
2825
  );
2632
2826
  this.body = body;
2633
- this.name = "FailedRemoveDomainMappingError";
2827
+ this.name = "SerializationErrorError";
2634
2828
  }
2635
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2636
- static statusCode = 500;
2637
- static description = `Failed to remove domain mapping: {message}`;
2829
+ static code = "SERIALIZATION_ERROR";
2830
+ static statusCode = 400;
2831
+ static description = `Failed to serialize request: {message}`;
2638
2832
  }
2639
- class FailedPermissionsCheckError extends Error {
2833
+ class GitInvalidRequestError extends Error {
2640
2834
  constructor(body) {
2641
2835
  super(
2642
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2836
+ `GIT_INVALID_REQUEST: ${body.message}`
2643
2837
  );
2644
2838
  this.body = body;
2645
- this.name = "FailedPermissionsCheckError";
2839
+ this.name = "GitInvalidRequestError";
2646
2840
  }
2647
- static code = "FAILED_PERMISSIONS_CHECK";
2648
- static statusCode = 401;
2649
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2841
+ static code = "GIT_INVALID_REQUEST";
2842
+ static statusCode = 400;
2843
+ static description = `Invalid request: {message}`;
2650
2844
  }
2651
- class FailedToCheckDomainMappingPermissionsError extends Error {
2845
+ class RepositoryNotFoundError extends Error {
2652
2846
  constructor(body) {
2653
2847
  super(
2654
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2848
+ `REPOSITORY_NOT_FOUND: ${body.message}`
2655
2849
  );
2656
2850
  this.body = body;
2657
- this.name = "FailedToCheckDomainMappingPermissionsError";
2851
+ this.name = "RepositoryNotFoundError";
2658
2852
  }
2659
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2660
- static statusCode = 502;
2661
- static description = `Failed to check permissions: {message}`;
2853
+ static code = "REPOSITORY_NOT_FOUND";
2854
+ static statusCode = 404;
2855
+ static description = `Repository not found: {repo_id}`;
2662
2856
  }
2663
2857
  class BrowserOperationFailedError extends Error {
2664
2858
  constructor(body) {
@@ -2816,8 +3010,116 @@ class DevServerInvalidRequestError extends Error {
2816
3010
  static statusCode = 400;
2817
3011
  static description = `Invalid dev server request: {message}`;
2818
3012
  }
3013
+ class ScheduleNotFoundError extends Error {
3014
+ constructor(body) {
3015
+ super(
3016
+ `SCHEDULE_NOT_FOUND: ${body.message}`
3017
+ );
3018
+ this.body = body;
3019
+ this.name = "ScheduleNotFoundError";
3020
+ }
3021
+ static code = "SCHEDULE_NOT_FOUND";
3022
+ static statusCode = 404;
3023
+ static description = `Schedule not found`;
3024
+ }
3025
+ class ServiceUnavailableError extends Error {
3026
+ constructor(body) {
3027
+ super(
3028
+ `SERVICE_UNAVAILABLE: ${body.message}`
3029
+ );
3030
+ this.body = body;
3031
+ this.name = "ServiceUnavailableError";
3032
+ }
3033
+ static code = "SERVICE_UNAVAILABLE";
3034
+ static statusCode = 503;
3035
+ static description = `Cron service not configured`;
3036
+ }
3037
+ class GitRepoLimitExceededError extends Error {
3038
+ constructor(body) {
3039
+ super(
3040
+ `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
3041
+ );
3042
+ this.body = body;
3043
+ this.name = "GitRepoLimitExceededError";
3044
+ }
3045
+ static code = "GIT_REPO_LIMIT_EXCEEDED";
3046
+ static statusCode = 403;
3047
+ static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
3048
+ }
3049
+ class BranchNameEmptyError extends Error {
3050
+ constructor(body) {
3051
+ super(
3052
+ `BRANCH_NAME_EMPTY: ${body.message}`
3053
+ );
3054
+ this.body = body;
3055
+ this.name = "BranchNameEmptyError";
3056
+ }
3057
+ static code = "BRANCH_NAME_EMPTY";
3058
+ static statusCode = 400;
3059
+ static description = `Branch name cannot be empty`;
3060
+ }
3061
+ class ResizeFailedError extends Error {
3062
+ constructor(body) {
3063
+ super(
3064
+ `RESIZE_FAILED: ${body.message}`
3065
+ );
3066
+ this.body = body;
3067
+ this.name = "ResizeFailedError";
3068
+ }
3069
+ static code = "RESIZE_FAILED";
3070
+ static statusCode = 500;
3071
+ static description = `Failed to resize VM: {message}`;
3072
+ }
3073
+ class InternalResizeVmNotFoundError extends Error {
3074
+ constructor(body) {
3075
+ super(
3076
+ `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
3077
+ );
3078
+ this.body = body;
3079
+ this.name = "InternalResizeVmNotFoundError";
3080
+ }
3081
+ static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
3082
+ static statusCode = 404;
3083
+ static description = `VM not found`;
3084
+ }
2819
3085
  const FREESTYLE_ERROR_CODE_MAP = {
2820
3086
  "GIT_ERROR": GitErrorError,
3087
+ "BAD_PARSE": BadParseError,
3088
+ "BAD_TIMESTAMP": BadTimestampError,
3089
+ "BAD_SIGNATURE": BadSignatureError,
3090
+ "BAD_HEADER": BadHeaderError,
3091
+ "BAD_KEY": BadKeyError,
3092
+ "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3093
+ "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3094
+ "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3095
+ "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3096
+ "KERNEL_PANIC": KernelPanicError,
3097
+ "VM_DELETED": VmDeletedError,
3098
+ "REQWEST": ReqwestError,
3099
+ "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3100
+ "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
3101
+ "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
3102
+ "VM_START_TIMEOUT": VmStartTimeoutError,
3103
+ "VM_EXIT_DURING_START": VmExitDuringStartError,
3104
+ "VM_ACCESS_DENIED": VmAccessDeniedError,
3105
+ "STD_IO": StdIoError,
3106
+ "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
3107
+ "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3108
+ "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
3109
+ "ALREADY_HAS_BASE": AlreadyHasBaseError,
3110
+ "NOT_FOUND": NotFoundError,
3111
+ "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
3112
+ "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
3113
+ "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
3114
+ "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3115
+ "VM_NOT_RUNNING": VmNotRunningError,
3116
+ "VM_NOT_FOUND": VmNotFoundError,
3117
+ "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3118
+ "BAD_REQUEST": BadRequestError,
3119
+ "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
3120
+ "DATABASE_ERROR": DatabaseErrorError,
3121
+ "PARTITION_NOT_FOUND": PartitionNotFoundError,
3122
+ "INVALID_VM_ID": InvalidVmIdError,
2821
3123
  "USER_NOT_FOUND": UserNotFoundError,
2822
3124
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
2823
3125
  "VALIDATION_ERROR": ValidationErrorError,
@@ -2832,42 +3134,22 @@ const FREESTYLE_ERROR_CODE_MAP = {
2832
3134
  "DUPLICATE_GROUP_NAME": DuplicateGroupNameError,
2833
3135
  "GROUP_NAME_RESERVED": GroupNameReservedError,
2834
3136
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
2835
- "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
2836
- "GROUP_NAME_EMPTY": GroupNameEmptyError,
2837
- "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
2838
- "FILE_NOT_FOUND": FileNotFoundError,
2839
- "FILES_BAD_REQUEST": FilesBadRequestError,
2840
- "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2841
- "ALREADY_HAS_BASE": AlreadyHasBaseError,
2842
- "NOT_FOUND": NotFoundError,
2843
- "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
2844
- "DATABASE_ERROR": DatabaseErrorError,
2845
- "PARTITION_NOT_FOUND": PartitionNotFoundError,
2846
- "INVALID_VM_ID": InvalidVmIdError,
3137
+ "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
3138
+ "GROUP_NAME_EMPTY": GroupNameEmptyError,
2847
3139
  "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
2848
3140
  "INTERNAL_ERROR": InternalErrorError,
2849
3141
  "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
2850
3142
  "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
2851
- "VM_NOT_RUNNING": VmNotRunningError,
2852
- "VM_NOT_FOUND": VmNotFoundError,
2853
- "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
2854
- "BAD_REQUEST": BadRequestError,
2855
- "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
2856
- "KERNEL_PANIC": KernelPanicError,
2857
- "VM_DELETED": VmDeletedError,
2858
- "REQWEST": ReqwestError,
2859
- "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
2860
- "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
2861
- "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
2862
- "VM_START_TIMEOUT": VmStartTimeoutError,
2863
- "VM_EXIT_DURING_START": VmExitDuringStartError,
2864
- "VM_ACCESS_DENIED": VmAccessDeniedError,
2865
- "STD_IO": StdIoError,
2866
- "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
2867
- "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
2868
- "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
2869
- "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
2870
- "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
3143
+ "DOCKER_SNAPSHOT_FAILED": DockerSnapshotFailedError,
3144
+ "SET_DEFAULT_SNAPSHOT_FAILED": SetDefaultSnapshotFailedError,
3145
+ "SNAPSHOT_LAYER_CREATION_FAILED": SnapshotLayerCreationFailedError,
3146
+ "SNAPSHOT_DIR_NOT_FOUND": SnapshotDirNotFoundError,
3147
+ "SUBVOLUME_CREATION_FAILED": SubvolumeCreationFailedError,
3148
+ "GET_DEFAULT_SNAPSHOT_FAILED": GetDefaultSnapshotFailedError,
3149
+ "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3150
+ "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3151
+ "FILE_NOT_FOUND": FileNotFoundError,
3152
+ "FILES_BAD_REQUEST": FilesBadRequestError,
2871
3153
  "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2872
3154
  "WANTED_BY_EMPTY": WantedByEmptyError,
2873
3155
  "WORKDIR_EMPTY": WorkdirEmptyError,
@@ -2895,7 +3177,7 @@ const FREESTYLE_ERROR_CODE_MAP = {
2895
3177
  "INVALID_PARAMETERS": InvalidParametersError,
2896
3178
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
2897
3179
  "EXPIRED": ExpiredError,
2898
- "TAG_NOT_FOUND": TagNotFoundError,
3180
+ "PACKFILE": PackfileError,
2899
3181
  "TREE_NOT_FOUND": TreeNotFoundError,
2900
3182
  "BRANCH_NOT_FOUND": BranchNotFoundError,
2901
3183
  "FORBIDDEN": ForbiddenError,
@@ -2904,15 +3186,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
2904
3186
  "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
2905
3187
  "INVALID_OBJECT_ID": InvalidObjectIdError,
2906
3188
  "COMMIT_NOT_FOUND": CommitNotFoundError,
2907
- "PACKFILE": PackfileError,
2908
- "SEND_ERROR": SendErrorError,
2909
- "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2910
- "INVALID_RANGE": InvalidRangeError,
2911
- "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
2912
- "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
2913
- "BLOB_NOT_FOUND": BlobNotFoundError,
2914
- "INVALID_SERVICE": InvalidServiceError,
2915
- "EXPECTED_SERVICE": ExpectedServiceError,
2916
3189
  "PATH_NOT_FOUND": PathNotFoundError,
2917
3190
  "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2918
3191
  "AMBIGUOUS": AmbiguousError,
@@ -2922,16 +3195,51 @@ const FREESTYLE_ERROR_CODE_MAP = {
2922
3195
  "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
2923
3196
  "SOURCE_NOT_FOUND": SourceNotFoundError,
2924
3197
  "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
2925
- "CONFLICT": ConflictError,
3198
+ "TAG_NOT_FOUND": TagNotFoundError,
3199
+ "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3200
+ "SEND_ERROR": SendErrorError,
3201
+ "INVALID_SERVICE": InvalidServiceError,
3202
+ "EXPECTED_SERVICE": ExpectedServiceError,
3203
+ "INVALID_RANGE": InvalidRangeError,
3204
+ "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
3205
+ "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
3206
+ "BLOB_NOT_FOUND": BlobNotFoundError,
2926
3207
  "INVALID_REVISION": InvalidRevisionError,
3208
+ "CONFLICT": ConflictError,
3209
+ "UNAVAILABLE": UnavailableError,
2927
3210
  "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
2928
- "BRANCH_NAME_EMPTY": BranchNameEmptyError,
2929
- "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2930
- "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2931
- "PARSE_LOGS_FAILED": ParseLogsFailedError,
2932
- "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2933
- "INVALID_QUERY": InvalidQueryError,
2934
- "LOGS_NOT_FOUND": LogsNotFoundError,
3211
+ "EMPTY_TAG": EmptyTagError,
3212
+ "VM_LIMIT_EXCEEDED": VmLimitExceededError,
3213
+ "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3214
+ "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3215
+ "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3216
+ "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3217
+ "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3218
+ "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3219
+ "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3220
+ "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
3221
+ "RESTORE_FAILED": RestoreFailedError,
3222
+ "CREATE_BACKUP_FAILED": CreateBackupFailedError,
3223
+ "BACKUP_FAILED": BackupFailedError,
3224
+ "DEPLOYMENT_FAILED": DeploymentFailedError,
3225
+ "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
3226
+ "PROJECT_NOT_FOUND": ProjectNotFoundError,
3227
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3228
+ "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3229
+ "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
3230
+ "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
3231
+ "LIST_RUNS_FAILED": ListRunsFailedError,
3232
+ "EXECUTION_ERROR": ExecutionErrorError,
3233
+ "CONNECTION_FAILED": ConnectionFailedError,
3234
+ "METADATA_WRITE_FAILED": MetadataWriteFailedError,
3235
+ "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
3236
+ "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
3237
+ "LOCK_GENERATION_FAILED": LockGenerationFailedError,
3238
+ "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
3239
+ "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
3240
+ "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3241
+ "LOGGING_FAILED": LoggingFailedError,
3242
+ "RUN_NOT_FOUND": RunNotFoundError,
2935
3243
  "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
2936
3244
  "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
2937
3245
  "PERMISSION_DENIED": PermissionDeniedError,
@@ -2944,8 +3252,35 @@ const FREESTYLE_ERROR_CODE_MAP = {
2944
3252
  "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
2945
3253
  "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
2946
3254
  "INVALID_DOMAIN": InvalidDomainError,
2947
- "RESIZE_FAILED": ResizeFailedError,
2948
- "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3255
+ "LIMIT_EXCEEDED": LimitExceededError,
3256
+ "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3257
+ "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3258
+ "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3259
+ "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3260
+ "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3261
+ "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3262
+ "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3263
+ "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3264
+ "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3265
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3266
+ "BUILD_FAILED": BuildFailedError,
3267
+ "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
3268
+ "LOCKFILE_ERROR": LockfileErrorError,
3269
+ "UPLOAD_ERROR": UploadErrorError,
3270
+ "DOMAIN_MAPPING_ERROR": DomainMappingErrorError,
3271
+ "CERTIFICATE_PROVISIONING_ERROR": CertificateProvisioningErrorError,
3272
+ "NO_ENTRYPOINT_FOUND": NoEntrypointFoundError,
3273
+ "ENTRYPOINT_NOT_FOUND": EntrypointNotFoundError,
3274
+ "NO_DOMAIN_OWNERSHIP": NoDomainOwnershipError,
3275
+ "INVALID_DOMAINS": InvalidDomainsError,
3276
+ "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
3277
+ "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3278
+ "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
3279
+ "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
3280
+ "PARSE_LOGS_FAILED": ParseLogsFailedError,
3281
+ "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
3282
+ "INVALID_QUERY": InvalidQueryError,
3283
+ "LOGS_NOT_FOUND": LogsNotFoundError,
2949
3284
  "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
2950
3285
  "LIST_TOKENS_FAILED": ListTokensFailedError,
2951
3286
  "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
@@ -2985,59 +3320,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
2985
3320
  "SERIALIZATION_ERROR": SerializationErrorError,
2986
3321
  "GIT_INVALID_REQUEST": GitInvalidRequestError,
2987
3322
  "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
2988
- "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
2989
- "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
2990
- "LIST_RUNS_FAILED": ListRunsFailedError,
2991
- "EXECUTION_ERROR": ExecutionErrorError,
2992
- "CONNECTION_FAILED": ConnectionFailedError,
2993
- "METADATA_WRITE_FAILED": MetadataWriteFailedError,
2994
- "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
2995
- "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
2996
- "LOCK_GENERATION_FAILED": LockGenerationFailedError,
2997
- "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
2998
- "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
2999
- "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3000
- "LOGGING_FAILED": LoggingFailedError,
3001
- "RUN_NOT_FOUND": RunNotFoundError,
3002
- "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3003
- "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3004
- "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
3005
- "RESTORE_FAILED": RestoreFailedError,
3006
- "CREATE_BACKUP_FAILED": CreateBackupFailedError,
3007
- "BACKUP_FAILED": BackupFailedError,
3008
- "DEPLOYMENT_FAILED": DeploymentFailedError,
3009
- "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
3010
- "PROJECT_NOT_FOUND": ProjectNotFoundError,
3011
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3012
- "BUILD_FAILED": BuildFailedError,
3013
- "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
3014
- "LOCKFILE_ERROR": LockfileErrorError,
3015
- "UPLOAD_ERROR": UploadErrorError,
3016
- "DOMAIN_MAPPING_ERROR": DomainMappingErrorError,
3017
- "CERTIFICATE_PROVISIONING_ERROR": CertificateProvisioningErrorError,
3018
- "NO_ENTRYPOINT_FOUND": NoEntrypointFoundError,
3019
- "ENTRYPOINT_NOT_FOUND": EntrypointNotFoundError,
3020
- "NO_DOMAIN_OWNERSHIP": NoDomainOwnershipError,
3021
- "INVALID_DOMAINS": InvalidDomainsError,
3022
- "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
3023
- "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3024
- "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3025
- "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3026
- "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3027
- "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3028
- "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3029
- "ANYHOW": AnyhowError,
3030
- "EMPTY_TAG": EmptyTagError,
3031
- "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3032
- "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3033
- "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3034
- "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3035
- "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3036
- "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3037
- "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3038
- "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3039
- "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3040
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3041
3323
  "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
3042
3324
  "WATCH_FILES_FAILED": WatchFilesFailedError,
3043
3325
  "LOGS_FAILED": LogsFailedError,
@@ -3050,17 +3332,28 @@ const FREESTYLE_ERROR_CODE_MAP = {
3050
3332
  "EXECUTION_FAILED": ExecutionFailedError,
3051
3333
  "REQUEST_FAILED": RequestFailedError,
3052
3334
  "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
3053
- "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError
3335
+ "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
3336
+ "SCHEDULE_NOT_FOUND": ScheduleNotFoundError,
3337
+ "SERVICE_UNAVAILABLE": ServiceUnavailableError,
3338
+ "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
3339
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError,
3340
+ "RESIZE_FAILED": ResizeFailedError,
3341
+ "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError
3054
3342
  };
3055
3343
 
3056
3344
  var errors = /*#__PURE__*/Object.freeze({
3057
3345
  __proto__: null,
3346
+ ActiveTransactionErrorError: ActiveTransactionErrorError,
3058
3347
  AfterArrayContainsEmptyError: AfterArrayContainsEmptyError,
3059
3348
  AlreadyHasBaseError: AlreadyHasBaseError,
3060
3349
  AmbiguousError: AmbiguousError,
3061
- AnyhowError: AnyhowError,
3062
3350
  BackupFailedError: BackupFailedError,
3351
+ BadHeaderError: BadHeaderError,
3352
+ BadKeyError: BadKeyError,
3353
+ BadParseError: BadParseError,
3063
3354
  BadRequestError: BadRequestError,
3355
+ BadSignatureError: BadSignatureError,
3356
+ BadTimestampError: BadTimestampError,
3064
3357
  BlobNotFoundError: BlobNotFoundError,
3065
3358
  BranchNameEmptyError: BranchNameEmptyError,
3066
3359
  BranchNotFoundError: BranchNotFoundError,
@@ -3094,6 +3387,7 @@ var errors = /*#__PURE__*/Object.freeze({
3094
3387
  DevServerInvalidRequestError: DevServerInvalidRequestError,
3095
3388
  DevServerNotFoundError: DevServerNotFoundError,
3096
3389
  DirectoryCreationFailedError: DirectoryCreationFailedError,
3390
+ DockerSnapshotFailedError: DockerSnapshotFailedError,
3097
3391
  DomainAlreadyExistsError: DomainAlreadyExistsError,
3098
3392
  DomainMappingErrorError: DomainMappingErrorError,
3099
3393
  DomainOwnershipErrorError: DomainOwnershipErrorError,
@@ -3111,6 +3405,7 @@ var errors = /*#__PURE__*/Object.freeze({
3111
3405
  ExecEmptyError: ExecEmptyError,
3112
3406
  ExecuteAccessDeniedError: ExecuteAccessDeniedError,
3113
3407
  ExecuteInternalErrorError: ExecuteInternalErrorError,
3408
+ ExecuteLimitExceededError: ExecuteLimitExceededError,
3114
3409
  ExecutionErrorError: ExecutionErrorError,
3115
3410
  ExecutionFailedError: ExecutionFailedError,
3116
3411
  ExpectedServiceError: ExpectedServiceError,
@@ -3137,12 +3432,14 @@ var errors = /*#__PURE__*/Object.freeze({
3137
3432
  ForbiddenError: ForbiddenError,
3138
3433
  ForkVmNotFoundError: ForkVmNotFoundError,
3139
3434
  GetContentFailedError: GetContentFailedError,
3435
+ GetDefaultSnapshotFailedError: GetDefaultSnapshotFailedError,
3140
3436
  GetPermissionFailedError: GetPermissionFailedError,
3141
3437
  GetRepositoryInfoFailedError: GetRepositoryInfoFailedError,
3142
3438
  GitErrorError: GitErrorError,
3143
3439
  GitHubSyncConflictError: GitHubSyncConflictError,
3144
3440
  GitHubSyncFailedError: GitHubSyncFailedError,
3145
3441
  GitInvalidRequestError: GitInvalidRequestError,
3442
+ GitRepoLimitExceededError: GitRepoLimitExceededError,
3146
3443
  GitRepositoryAccessDeniedError: GitRepositoryAccessDeniedError,
3147
3444
  GitRepositoryNotFoundError: GitRepositoryNotFoundError,
3148
3445
  GitServerErrorError: GitServerErrorError,
@@ -3180,6 +3477,7 @@ var errors = /*#__PURE__*/Object.freeze({
3180
3477
  InvalidSnapshotIdError: InvalidSnapshotIdError,
3181
3478
  InvalidVmIdError: InvalidVmIdError,
3182
3479
  KernelPanicError: KernelPanicError,
3480
+ LimitExceededError: LimitExceededError,
3183
3481
  ListIdentitiesFailedError: ListIdentitiesFailedError,
3184
3482
  ListPermissionsFailedError: ListPermissionsFailedError,
3185
3483
  ListRepositoriesFailedError: ListRepositoriesFailedError,
@@ -3225,11 +3523,14 @@ var errors = /*#__PURE__*/Object.freeze({
3225
3523
  ResizeFailedError: ResizeFailedError,
3226
3524
  RestartFailedError: RestartFailedError,
3227
3525
  RestoreFailedError: RestoreFailedError,
3526
+ ResumedVmNonResponsiveError: ResumedVmNonResponsiveError,
3228
3527
  RetrieveLogsFailedError: RetrieveLogsFailedError,
3229
3528
  RevokePermissionFailedError: RevokePermissionFailedError,
3230
3529
  RevokeTokenFailedError: RevokeTokenFailedError,
3530
+ RootfsCopyErrorError: RootfsCopyErrorError,
3231
3531
  RunNotFoundError: RunNotFoundError,
3232
3532
  RuntimeErrorError: RuntimeErrorError,
3533
+ ScheduleNotFoundError: ScheduleNotFoundError,
3233
3534
  SendErrorError: SendErrorError,
3234
3535
  SerializationErrorError: SerializationErrorError,
3235
3536
  ServerDeploymentFailedError: ServerDeploymentFailedError,
@@ -3239,21 +3540,29 @@ var errors = /*#__PURE__*/Object.freeze({
3239
3540
  ServiceNameInvalidPrefixError: ServiceNameInvalidPrefixError,
3240
3541
  ServiceNameTooLongError: ServiceNameTooLongError,
3241
3542
  ServiceNotFoundError: ServiceNotFoundError,
3543
+ ServiceUnavailableError: ServiceUnavailableError,
3544
+ SetDefaultSnapshotFailedError: SetDefaultSnapshotFailedError,
3242
3545
  ShutdownFailedError: ShutdownFailedError,
3243
3546
  SigningError: SigningError,
3547
+ SnapshotDirNotFoundError: SnapshotDirNotFoundError,
3548
+ SnapshotLayerCreationFailedError: SnapshotLayerCreationFailedError,
3549
+ SnapshotLoadTimeoutError: SnapshotLoadTimeoutError,
3244
3550
  SnapshotVmBadRequestError: SnapshotVmBadRequestError,
3245
3551
  SourceImportConflictError: SourceImportConflictError,
3246
3552
  SourceNotFoundError: SourceNotFoundError,
3247
3553
  SourceUnauthorizedError: SourceUnauthorizedError,
3248
3554
  StatusFailedError: StatusFailedError,
3249
3555
  StdIoError: StdIoError,
3556
+ SubvolumeCreationFailedError: SubvolumeCreationFailedError,
3250
3557
  SyntaxErrorError: SyntaxErrorError,
3251
3558
  TagNotFoundError: TagNotFoundError,
3252
3559
  TokenErrorError: TokenErrorError,
3253
3560
  TreeNotFoundError: TreeNotFoundError,
3254
3561
  TriggerErrorError: TriggerErrorError,
3562
+ UffdTimeoutErrorError: UffdTimeoutErrorError,
3255
3563
  UnauthorizedError: UnauthorizedError,
3256
3564
  UnauthorizedErrorError: UnauthorizedErrorError,
3565
+ UnavailableError: UnavailableError,
3257
3566
  UnsupportedTransferError: UnsupportedTransferError,
3258
3567
  UpdateDefaultBranchFailedError: UpdateDefaultBranchFailedError,
3259
3568
  UpdatePermissionFailedError: UpdatePermissionFailedError,
@@ -3274,6 +3583,7 @@ var errors = /*#__PURE__*/Object.freeze({
3274
3583
  VmCreateTmuxSessionError: VmCreateTmuxSessionError,
3275
3584
  VmDeletedError: VmDeletedError,
3276
3585
  VmExitDuringStartError: VmExitDuringStartError,
3586
+ VmLimitExceededError: VmLimitExceededError,
3277
3587
  VmMustBeStoppedError: VmMustBeStoppedError,
3278
3588
  VmNotFoundError: VmNotFoundError,
3279
3589
  VmNotFoundInFsError: VmNotFoundInFsError,
@@ -4444,11 +4754,70 @@ class Deployment {
4444
4754
  /**
4445
4755
  * Get logs for this deployment.
4446
4756
  */
4447
- async getLogs() {
4757
+ async getLogs(options) {
4448
4758
  return this.apiClient.get("/observability/v1/logs", {
4449
- query: { deploymentId: this.deploymentId }
4759
+ query: { deploymentId: this.deploymentId, ...options }
4450
4760
  });
4451
4761
  }
4762
+ /**
4763
+ * Fetch content from this deployment.
4764
+ * Makes a request directly to nginx-web with the deployment ID header.
4765
+ *
4766
+ * @param url - The URL path to fetch (e.g., "/api/hello" or "https://example.com/path")
4767
+ * @param init - Fetch options (headers, method, body, etc.)
4768
+ * @returns The response from the deployment
4769
+ *
4770
+ * @example
4771
+ * // Relative path
4772
+ * await deployment.fetch("/api/hello")
4773
+ *
4774
+ * @example
4775
+ * // Absolute URL (domain is ignored, only path is used)
4776
+ * await deployment.fetch("https://example.com/api/hello")
4777
+ *
4778
+ * @example
4779
+ * // With custom headers and method
4780
+ * await deployment.fetch("/api/data", {
4781
+ * method: "POST",
4782
+ * headers: { "Content-Type": "application/json" },
4783
+ * body: JSON.stringify({ key: "value" })
4784
+ * })
4785
+ */
4786
+ async fetch(url, init) {
4787
+ let requestUrl;
4788
+ try {
4789
+ const parsedUrl = new URL(url);
4790
+ requestUrl = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
4791
+ } catch {
4792
+ requestUrl = url;
4793
+ }
4794
+ const apiPath = `/web/v1/deployments/{deployment_id}/fetch`;
4795
+ const headers = {
4796
+ "X-Freestyle-Request-Url": requestUrl
4797
+ };
4798
+ if (init?.headers) {
4799
+ const userHeaders = init.headers;
4800
+ if (userHeaders instanceof Headers) {
4801
+ userHeaders.forEach((value, key) => {
4802
+ headers[key] = value;
4803
+ });
4804
+ } else if (Array.isArray(userHeaders)) {
4805
+ userHeaders.forEach(([key, value]) => {
4806
+ headers[key] = value;
4807
+ });
4808
+ } else {
4809
+ Object.assign(headers, userHeaders);
4810
+ }
4811
+ }
4812
+ return this.apiClient.fetch(
4813
+ this.apiClient.buildUrl(apiPath, { deployment_id: this.deploymentId }),
4814
+ {
4815
+ ...init,
4816
+ method: init?.method || "GET",
4817
+ headers
4818
+ }
4819
+ );
4820
+ }
4452
4821
  }
4453
4822
  class DeploymentsNamespace {
4454
4823
  constructor(apiClient) {
@@ -4484,7 +4853,7 @@ class DeploymentsNamespace {
4484
4853
  source = {
4485
4854
  kind: "files",
4486
4855
  files: {
4487
- "index.js": {
4856
+ "index.ts": {
4488
4857
  content: body.code
4489
4858
  }
4490
4859
  }
@@ -5971,6 +6340,165 @@ function linuxUsernameHeader(linux_username) {
5971
6340
  return linux_username ? { "X-Freestyle-Vm-Linux-User-Id": linux_username } : void 0;
5972
6341
  }
5973
6342
 
6343
+ class CronNamespace {
6344
+ constructor(apiClient) {
6345
+ this.apiClient = apiClient;
6346
+ }
6347
+ /**
6348
+ * Create a cron schedule.
6349
+ */
6350
+ async schedule({
6351
+ deploymentId,
6352
+ cron,
6353
+ timezone,
6354
+ payload,
6355
+ path
6356
+ }) {
6357
+ const response = await this.apiClient.post("/v1/cron/schedules", {
6358
+ body: {
6359
+ deploymentId,
6360
+ cron,
6361
+ timezone: timezone ?? "UTC",
6362
+ payload: payload ?? {},
6363
+ path
6364
+ }
6365
+ });
6366
+ return {
6367
+ job: new CronJob({
6368
+ apiClient: this.apiClient,
6369
+ schedule: response.schedule
6370
+ })
6371
+ };
6372
+ }
6373
+ /**
6374
+ * List cron schedules.
6375
+ */
6376
+ async list({
6377
+ deploymentId
6378
+ } = {}) {
6379
+ const response = await this.apiClient.get("/v1/cron/schedules", {
6380
+ query: deploymentId ? { deploymentId } : {}
6381
+ });
6382
+ return {
6383
+ jobs: response.schedules.map(
6384
+ (schedule) => new CronJob({ apiClient: this.apiClient, schedule })
6385
+ )
6386
+ };
6387
+ }
6388
+ }
6389
+ class CronJob {
6390
+ schedule;
6391
+ #apiClient;
6392
+ constructor({
6393
+ apiClient,
6394
+ schedule
6395
+ }) {
6396
+ this.#apiClient = apiClient;
6397
+ this.schedule = schedule;
6398
+ }
6399
+ /**
6400
+ * Enable this cron schedule.
6401
+ */
6402
+ async enable() {
6403
+ await this.#apiClient.patch("/v1/cron/schedules/{id}", {
6404
+ params: { id: this.schedule.id },
6405
+ body: { active: true }
6406
+ });
6407
+ }
6408
+ /**
6409
+ * Disable this cron schedule.
6410
+ */
6411
+ async disable() {
6412
+ await this.#apiClient.patch("/v1/cron/schedules/{id}", {
6413
+ params: { id: this.schedule.id },
6414
+ body: { active: false }
6415
+ });
6416
+ }
6417
+ /**
6418
+ * List executions for this cron schedule.
6419
+ */
6420
+ async executions({
6421
+ limit = 50,
6422
+ cursor
6423
+ } = {}) {
6424
+ const offset = cursor ? parseInt(cursor, 10) : 0;
6425
+ const res = await this.#apiClient.get(
6426
+ "/v1/cron/schedules/{id}/executions",
6427
+ {
6428
+ params: { id: this.schedule.id },
6429
+ query: { limit, offset }
6430
+ }
6431
+ );
6432
+ return {
6433
+ executions: res.executions,
6434
+ nextCursor: res.offset < res.total ? res.offset.toString() : void 0,
6435
+ totalCount: res.total
6436
+ };
6437
+ }
6438
+ /**
6439
+ * Get execution success rate for this schedule within a time range.
6440
+ */
6441
+ async successRate({
6442
+ start,
6443
+ end
6444
+ }) {
6445
+ const startIso = start instanceof Date ? start.toISOString() : start;
6446
+ const endIso = end instanceof Date ? end.toISOString() : end;
6447
+ const res = await this.#apiClient.get(
6448
+ "/v1/cron/schedules/{id}/success-rate",
6449
+ {
6450
+ params: { id: this.schedule.id },
6451
+ query: { start: startIso, end: endIso }
6452
+ }
6453
+ );
6454
+ return {
6455
+ total: res.total,
6456
+ succeeded: res.succeeded,
6457
+ failed: res.failed,
6458
+ successRate: res.successRate,
6459
+ start: res.start,
6460
+ end: res.end
6461
+ };
6462
+ }
6463
+ }
6464
+
6465
+ async function readFiles(directory) {
6466
+ let fs;
6467
+ let glob;
6468
+ try {
6469
+ fs = await import('fs/promises');
6470
+ glob = (await import('glob')).glob;
6471
+ } catch (error) {
6472
+ console.error("Error importing fs/promises or glob:", error);
6473
+ throw new Error("Failed to import required modules.", {
6474
+ cause: error
6475
+ });
6476
+ }
6477
+ const files = [];
6478
+ const patterns = await glob("**/*", {
6479
+ cwd: directory,
6480
+ nodir: true,
6481
+ ignore: ["**/node_modules/**"],
6482
+ absolute: false,
6483
+ dot: true,
6484
+ posix: true
6485
+ });
6486
+ for (const relativePath of patterns) {
6487
+ try {
6488
+ const filePath = path.join(directory, relativePath);
6489
+ const content = await fs.readFile(filePath, "base64");
6490
+ files.push({
6491
+ content,
6492
+ path: relativePath,
6493
+ encoding: "base64"
6494
+ });
6495
+ } catch (error) {
6496
+ console.error(`Error reading file ${relativePath}:`, error);
6497
+ }
6498
+ }
6499
+ return files;
6500
+ }
6501
+
5974
6502
  class Freestyle {
5975
6503
  /**
5976
6504
  * @internal
@@ -5984,6 +6512,7 @@ class Freestyle {
5984
6512
  dns;
5985
6513
  serverless;
5986
6514
  vms;
6515
+ cron;
5987
6516
  constructor(options = {}) {
5988
6517
  if (!options.baseUrl) {
5989
6518
  options.baseUrl = process.env.FREESTYLE_API_URL;
@@ -6009,6 +6538,7 @@ class Freestyle {
6009
6538
  this.dns = new DnsNamespace(this._apiClient);
6010
6539
  this.serverless = new ServerlessNamespace(this._apiClient);
6011
6540
  this.vms = new VmsNamespace(this);
6541
+ this.cron = new CronNamespace(this._apiClient);
6012
6542
  }
6013
6543
  /**
6014
6544
  * Helper method to make raw fetch requests to the API.
@@ -6038,6 +6568,7 @@ function createLazyFreestyle(options = {}) {
6038
6568
  }
6039
6569
  const freestyle = createLazyFreestyle();
6040
6570
 
6571
+ exports.CronNamespace = CronNamespace;
6041
6572
  exports.Deployment = Deployment;
6042
6573
  exports.Errors = errors;
6043
6574
  exports.FileSystem = FileSystem;
@@ -6054,3 +6585,4 @@ exports.VmTemplate = VmTemplate;
6054
6585
  exports.VmWith = VmWith;
6055
6586
  exports.VmWithInstance = VmWithInstance;
6056
6587
  exports.freestyle = freestyle;
6588
+ exports.readFiles = readFiles;