freestyle-sandboxes 0.1.21 → 0.1.23

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 (7) hide show
  1. package/README.md +17 -0
  2. package/cli.mjs +453 -31
  3. package/index.cjs +1662 -1328
  4. package/index.d.cts +1835 -1043
  5. package/index.d.mts +1835 -1043
  6. package/index.mjs +1662 -1328
  7. package/package.json +3 -2
package/index.mjs CHANGED
@@ -80,41 +80,29 @@ class BadKeyError extends Error {
80
80
  static statusCode = 400;
81
81
  static description = `invalid key length`;
82
82
  }
83
- class ActiveTransactionErrorError extends Error {
84
- constructor(body) {
85
- super(
86
- `ACTIVE_TRANSACTION_ERROR: ${body.message}`
87
- );
88
- this.body = body;
89
- this.name = "ActiveTransactionErrorError";
90
- }
91
- static code = "ACTIVE_TRANSACTION_ERROR";
92
- static statusCode = 500;
93
- static description = `Active transaction error: {details}`;
94
- }
95
- class InternalErrorError extends Error {
83
+ class FileNotFoundError extends Error {
96
84
  constructor(body) {
97
85
  super(
98
- `INTERNAL_ERROR: ${body.message}`
86
+ `FILE_NOT_FOUND: ${body.message}`
99
87
  );
100
88
  this.body = body;
101
- this.name = "InternalErrorError";
89
+ this.name = "FileNotFoundError";
102
90
  }
103
- static code = "INTERNAL_ERROR";
104
- static statusCode = 500;
105
- static description = `Fork failed: {message}`;
91
+ static code = "FILE_NOT_FOUND";
92
+ static statusCode = 404;
93
+ static description = `File not found: {path}`;
106
94
  }
107
- class RootfsCopyErrorError extends Error {
95
+ class FilesBadRequestError extends Error {
108
96
  constructor(body) {
109
97
  super(
110
- `ROOTFS_COPY_ERROR: ${body.message}`
98
+ `FILES_BAD_REQUEST: ${body.message}`
111
99
  );
112
100
  this.body = body;
113
- this.name = "RootfsCopyErrorError";
101
+ this.name = "FilesBadRequestError";
114
102
  }
115
- static code = "ROOTFS_COPY_ERROR";
116
- static statusCode = 500;
117
- static description = `Failed to copy rootfs from {from} to {to}: {details}`;
103
+ static code = "FILES_BAD_REQUEST";
104
+ static statusCode = 400;
105
+ static description = `Bad request: {message}`;
118
106
  }
119
107
  class VmNotFoundInFsError extends Error {
120
108
  constructor(body) {
@@ -128,65 +116,77 @@ class VmNotFoundInFsError extends Error {
128
116
  static statusCode = 406;
129
117
  static description = `Vm Not found in filesystem`;
130
118
  }
131
- class VmNotRunningError extends Error {
119
+ class DatabaseErrorError extends Error {
132
120
  constructor(body) {
133
121
  super(
134
- `VM_NOT_RUNNING: ${body.message}`
122
+ `DATABASE_ERROR: ${body.message}`
135
123
  );
136
124
  this.body = body;
137
- this.name = "VmNotRunningError";
125
+ this.name = "DatabaseErrorError";
138
126
  }
139
- static code = "VM_NOT_RUNNING";
140
- static statusCode = 400;
141
- static description = `VM is not running: {vm_id}`;
127
+ static code = "DATABASE_ERROR";
128
+ static statusCode = 500;
129
+ static description = `Database error occurred while constructing VmRecord, details: {details}`;
142
130
  }
143
- class VmNotFoundError extends Error {
131
+ class PartitionNotFoundError extends Error {
144
132
  constructor(body) {
145
133
  super(
146
- `VM_NOT_FOUND: ${body.message}`
134
+ `PARTITION_NOT_FOUND: ${body.message}`
147
135
  );
148
136
  this.body = body;
149
- this.name = "VmNotFoundError";
137
+ this.name = "PartitionNotFoundError";
150
138
  }
151
- static code = "VM_NOT_FOUND";
139
+ static code = "PARTITION_NOT_FOUND";
152
140
  static statusCode = 404;
153
- static description = `VM not found: {vm_id}`;
141
+ static description = `Partition not found: {partition_id}`;
154
142
  }
155
- class InternalForkVmNotFoundError extends Error {
143
+ class InvalidVmIdError extends Error {
156
144
  constructor(body) {
157
145
  super(
158
- `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
146
+ `INVALID_VM_ID: ${body.message}`
159
147
  );
160
148
  this.body = body;
161
- this.name = "InternalForkVmNotFoundError";
149
+ this.name = "InvalidVmIdError";
162
150
  }
163
- static code = "INTERNAL_FORK_VM_NOT_FOUND";
164
- static statusCode = 404;
165
- static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
151
+ static code = "INVALID_VM_ID";
152
+ static statusCode = 400;
153
+ static description = `Invalid VM ID: {vm_id}, details: {details}`;
166
154
  }
167
- class BadRequestError extends Error {
155
+ class VmMustBeStoppedError extends Error {
168
156
  constructor(body) {
169
157
  super(
170
- `BAD_REQUEST: ${body.message}`
158
+ `VM_MUST_BE_STOPPED: ${body.message}`
171
159
  );
172
160
  this.body = body;
173
- this.name = "BadRequestError";
161
+ this.name = "VmMustBeStoppedError";
174
162
  }
175
- static code = "BAD_REQUEST";
163
+ static code = "VM_MUST_BE_STOPPED";
176
164
  static statusCode = 400;
177
- static description = `Bad request: {message}`;
165
+ static description = `VM must be stopped before converting to base`;
178
166
  }
179
- class InternalVmNotFoundError extends Error {
167
+ class AlreadyHasBaseError extends Error {
180
168
  constructor(body) {
181
169
  super(
182
- `INTERNAL_VM_NOT_FOUND: ${body.message}`
170
+ `ALREADY_HAS_BASE: ${body.message}`
183
171
  );
184
172
  this.body = body;
185
- this.name = "InternalVmNotFoundError";
173
+ this.name = "AlreadyHasBaseError";
186
174
  }
187
- static code = "INTERNAL_VM_NOT_FOUND";
175
+ static code = "ALREADY_HAS_BASE";
176
+ static statusCode = 400;
177
+ static description = `VM already has a base rootfs`;
178
+ }
179
+ class NotFoundError extends Error {
180
+ constructor(body) {
181
+ super(
182
+ `NOT_FOUND: ${body.message}`
183
+ );
184
+ this.body = body;
185
+ this.name = "NotFoundError";
186
+ }
187
+ static code = "NOT_FOUND";
188
188
  static statusCode = 404;
189
- static description = `VM not found: {vm_id}`;
189
+ static description = `VM not found`;
190
190
  }
191
191
  class SnapshotSetupFailedError extends Error {
192
192
  constructor(body) {
@@ -212,545 +212,545 @@ class SnapshotVmBadRequestError extends Error {
212
212
  static statusCode = 400;
213
213
  static description = `Bad request: {message}`;
214
214
  }
215
- class ResumedVmNonResponsiveError extends Error {
215
+ class UserNotFoundError extends Error {
216
216
  constructor(body) {
217
217
  super(
218
- `RESUMED_VM_NON_RESPONSIVE: ${body.message}`
218
+ `USER_NOT_FOUND: ${body.message}`
219
219
  );
220
220
  this.body = body;
221
- this.name = "ResumedVmNonResponsiveError";
221
+ this.name = "UserNotFoundError";
222
222
  }
223
- static code = "RESUMED_VM_NON_RESPONSIVE";
224
- static statusCode = 500;
225
- static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
223
+ static code = "USER_NOT_FOUND";
224
+ static statusCode = 404;
225
+ static description = `User not found: {user_name}`;
226
226
  }
227
- class SnapshotLoadTimeoutError extends Error {
227
+ class UserAlreadyExistsError extends Error {
228
228
  constructor(body) {
229
229
  super(
230
- `SNAPSHOT_LOAD_TIMEOUT: ${body.message}`
230
+ `USER_ALREADY_EXISTS: ${body.message}`
231
231
  );
232
232
  this.body = body;
233
- this.name = "SnapshotLoadTimeoutError";
233
+ this.name = "UserAlreadyExistsError";
234
234
  }
235
- static code = "SNAPSHOT_LOAD_TIMEOUT";
236
- static statusCode = 500;
237
- static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
235
+ static code = "USER_ALREADY_EXISTS";
236
+ static statusCode = 409;
237
+ static description = `Conflict: User '{user_name}' already exists`;
238
238
  }
239
- class UffdTimeoutErrorError extends Error {
239
+ class ValidationErrorError extends Error {
240
240
  constructor(body) {
241
241
  super(
242
- `UFFD_TIMEOUT_ERROR: ${body.message}`
242
+ `VALIDATION_ERROR: ${body.message}`
243
243
  );
244
244
  this.body = body;
245
- this.name = "UffdTimeoutErrorError";
245
+ this.name = "ValidationErrorError";
246
246
  }
247
- static code = "UFFD_TIMEOUT_ERROR";
248
- static statusCode = 500;
249
- static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
247
+ static code = "VALIDATION_ERROR";
248
+ static statusCode = 400;
249
+ static description = `Validation error: {message}`;
250
250
  }
251
- class KernelPanicError extends Error {
251
+ class GroupNotFoundError extends Error {
252
252
  constructor(body) {
253
253
  super(
254
- `KERNEL_PANIC: ${body.message}`
254
+ `GROUP_NOT_FOUND: ${body.message}`
255
255
  );
256
256
  this.body = body;
257
- this.name = "KernelPanicError";
257
+ this.name = "GroupNotFoundError";
258
258
  }
259
- static code = "KERNEL_PANIC";
260
- static statusCode = 500;
261
- static description = `VM kernel panic detected`;
259
+ static code = "GROUP_NOT_FOUND";
260
+ static statusCode = 404;
261
+ static description = `Group not found: {group_name}`;
262
262
  }
263
- class VmDeletedError extends Error {
263
+ class GroupAlreadyExistsError extends Error {
264
264
  constructor(body) {
265
265
  super(
266
- `VM_DELETED: ${body.message}`
266
+ `GROUP_ALREADY_EXISTS: ${body.message}`
267
267
  );
268
268
  this.body = body;
269
- this.name = "VmDeletedError";
269
+ this.name = "GroupAlreadyExistsError";
270
270
  }
271
- static code = "VM_DELETED";
272
- static statusCode = 410;
273
- static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
271
+ static code = "GROUP_ALREADY_EXISTS";
272
+ static statusCode = 409;
273
+ static description = `Conflict: Group '{group_name}' already exists`;
274
274
  }
275
- class ReqwestError extends Error {
275
+ class DuplicateUserNameError extends Error {
276
276
  constructor(body) {
277
277
  super(
278
- `REQWEST: ${body.message}`
278
+ `DUPLICATE_USER_NAME: ${body.message}`
279
279
  );
280
280
  this.body = body;
281
- this.name = "ReqwestError";
281
+ this.name = "DuplicateUserNameError";
282
282
  }
283
- static code = "REQWEST";
284
- static statusCode = 500;
285
- static description = `Reqwest error: {details}`;
283
+ static code = "DUPLICATE_USER_NAME";
284
+ static statusCode = 400;
285
+ static description = `Duplicate user name '{name}' found`;
286
286
  }
287
- class FirecrackerPidNotFoundError extends Error {
287
+ class UserGroupEmptyError extends Error {
288
288
  constructor(body) {
289
289
  super(
290
- `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
290
+ `USER_GROUP_EMPTY: ${body.message}`
291
291
  );
292
292
  this.body = body;
293
- this.name = "FirecrackerPidNotFoundError";
293
+ this.name = "UserGroupEmptyError";
294
294
  }
295
- static code = "FIRECRACKER_PID_NOT_FOUND";
296
- static statusCode = 500;
297
- static description = `Firecracker PID not found`;
295
+ static code = "USER_GROUP_EMPTY";
296
+ static statusCode = 400;
297
+ static description = `User '{user}' has empty string in groups`;
298
298
  }
299
- class FirecrackerApiSocketNotFoundError extends Error {
299
+ class UserSystemFlagMismatchError extends Error {
300
300
  constructor(body) {
301
301
  super(
302
- `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
302
+ `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
303
303
  );
304
304
  this.body = body;
305
- this.name = "FirecrackerApiSocketNotFoundError";
305
+ this.name = "UserSystemFlagMismatchError";
306
306
  }
307
- static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
308
- static statusCode = 500;
309
- static description = `Firecracker API socket not found`;
307
+ static code = "USER_SYSTEM_FLAG_MISMATCH";
308
+ static statusCode = 400;
309
+ static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
310
310
  }
311
- class InvalidSnapshotIdError extends Error {
311
+ class UserUidOutOfRangeError extends Error {
312
312
  constructor(body) {
313
313
  super(
314
- `INVALID_SNAPSHOT_ID: ${body.message}`
314
+ `USER_UID_OUT_OF_RANGE: ${body.message}`
315
315
  );
316
316
  this.body = body;
317
- this.name = "InvalidSnapshotIdError";
317
+ this.name = "UserUidOutOfRangeError";
318
318
  }
319
- static code = "INVALID_SNAPSHOT_ID";
319
+ static code = "USER_UID_OUT_OF_RANGE";
320
320
  static statusCode = 400;
321
- static description = `Invalid snapshot id: {id}`;
321
+ static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
322
322
  }
323
- class VmStartTimeoutError extends Error {
323
+ class UserHomeInvalidError extends Error {
324
324
  constructor(body) {
325
325
  super(
326
- `VM_START_TIMEOUT: ${body.message}`
326
+ `USER_HOME_INVALID: ${body.message}`
327
327
  );
328
328
  this.body = body;
329
- this.name = "VmStartTimeoutError";
329
+ this.name = "UserHomeInvalidError";
330
330
  }
331
- static code = "VM_START_TIMEOUT";
332
- static statusCode = 504;
333
- static description = `VM did not become ready within the specified timeout`;
331
+ static code = "USER_HOME_INVALID";
332
+ static statusCode = 400;
333
+ static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
334
334
  }
335
- class VmExitDuringStartError extends Error {
335
+ class UserShellInvalidError extends Error {
336
336
  constructor(body) {
337
337
  super(
338
- `VM_EXIT_DURING_START: ${body.message}`
338
+ `USER_SHELL_INVALID: ${body.message}`
339
339
  );
340
340
  this.body = body;
341
- this.name = "VmExitDuringStartError";
341
+ this.name = "UserShellInvalidError";
342
342
  }
343
- static code = "VM_EXIT_DURING_START";
344
- static statusCode = 500;
345
- static description = `VM process exited unexpectedly during start`;
343
+ static code = "USER_SHELL_INVALID";
344
+ static statusCode = 400;
345
+ static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
346
346
  }
347
- class VmAccessDeniedError extends Error {
347
+ class DuplicateGroupNameError extends Error {
348
348
  constructor(body) {
349
349
  super(
350
- `VM_ACCESS_DENIED: ${body.message}`
350
+ `DUPLICATE_GROUP_NAME: ${body.message}`
351
351
  );
352
352
  this.body = body;
353
- this.name = "VmAccessDeniedError";
353
+ this.name = "DuplicateGroupNameError";
354
354
  }
355
- static code = "VM_ACCESS_DENIED";
356
- static statusCode = 403;
357
- static description = `You do not have access to this VM`;
355
+ static code = "DUPLICATE_GROUP_NAME";
356
+ static statusCode = 400;
357
+ static description = `Duplicate group name '{name}' found`;
358
358
  }
359
- class StdIoError extends Error {
359
+ class GroupNameReservedError extends Error {
360
360
  constructor(body) {
361
361
  super(
362
- `STD_IO: ${body.message}`
362
+ `GROUP_NAME_RESERVED: ${body.message}`
363
363
  );
364
364
  this.body = body;
365
- this.name = "StdIoError";
365
+ this.name = "GroupNameReservedError";
366
366
  }
367
- static code = "STD_IO";
368
- static statusCode = 500;
369
- static description = `Standard IO error`;
367
+ static code = "GROUP_NAME_RESERVED";
368
+ static statusCode = 400;
369
+ static description = `Group name '{name}' is reserved and cannot be used`;
370
370
  }
371
- class VmCreateTmuxSessionError extends Error {
371
+ class GroupNameInvalidCharsError extends Error {
372
372
  constructor(body) {
373
373
  super(
374
- `VM_CREATE_TMUX_SESSION: ${body.message}`
374
+ `GROUP_NAME_INVALID_CHARS: ${body.message}`
375
375
  );
376
376
  this.body = body;
377
- this.name = "VmCreateTmuxSessionError";
377
+ this.name = "GroupNameInvalidCharsError";
378
378
  }
379
- static code = "VM_CREATE_TMUX_SESSION";
380
- static statusCode = 500;
381
- static description = `Failed to create tmux session for VM`;
379
+ static code = "GROUP_NAME_INVALID_CHARS";
380
+ static statusCode = 400;
381
+ static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
382
382
  }
383
- class VmSubnetNotFoundError extends Error {
383
+ class GroupNameTooLongError extends Error {
384
384
  constructor(body) {
385
385
  super(
386
- `VM_SUBNET_NOT_FOUND: ${body.message}`
386
+ `GROUP_NAME_TOO_LONG: ${body.message}`
387
387
  );
388
388
  this.body = body;
389
- this.name = "VmSubnetNotFoundError";
389
+ this.name = "GroupNameTooLongError";
390
390
  }
391
- static code = "VM_SUBNET_NOT_FOUND";
392
- static statusCode = 500;
393
- static description = `Subnet for VM not found`;
391
+ static code = "GROUP_NAME_TOO_LONG";
392
+ static statusCode = 400;
393
+ static description = `Group name '{name}' is too long (max {max_length} characters)`;
394
394
  }
395
- class FileNotFoundError extends Error {
395
+ class GroupNameEmptyError extends Error {
396
396
  constructor(body) {
397
397
  super(
398
- `FILE_NOT_FOUND: ${body.message}`
398
+ `GROUP_NAME_EMPTY: ${body.message}`
399
399
  );
400
400
  this.body = body;
401
- this.name = "FileNotFoundError";
401
+ this.name = "GroupNameEmptyError";
402
402
  }
403
- static code = "FILE_NOT_FOUND";
404
- static statusCode = 404;
405
- static description = `File not found: {path}`;
403
+ static code = "GROUP_NAME_EMPTY";
404
+ static statusCode = 400;
405
+ static description = `Group name cannot be empty`;
406
406
  }
407
- class FilesBadRequestError extends Error {
407
+ class InvalidGitRepoSpecErrorError extends Error {
408
408
  constructor(body) {
409
409
  super(
410
- `FILES_BAD_REQUEST: ${body.message}`
410
+ `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
411
411
  );
412
412
  this.body = body;
413
- this.name = "FilesBadRequestError";
413
+ this.name = "InvalidGitRepoSpecErrorError";
414
414
  }
415
- static code = "FILES_BAD_REQUEST";
415
+ static code = "INVALID_GIT_REPO_SPEC_ERROR";
416
416
  static statusCode = 400;
417
- static description = `Bad request: {message}`;
417
+ static description = `Invalid git repository specification: {message}`;
418
418
  }
419
- class VmMustBeStoppedError extends Error {
419
+ class InternalErrorError extends Error {
420
420
  constructor(body) {
421
421
  super(
422
- `VM_MUST_BE_STOPPED: ${body.message}`
422
+ `INTERNAL_ERROR: ${body.message}`
423
423
  );
424
424
  this.body = body;
425
- this.name = "VmMustBeStoppedError";
425
+ this.name = "InternalErrorError";
426
426
  }
427
- static code = "VM_MUST_BE_STOPPED";
428
- static statusCode = 400;
429
- static description = `VM must be stopped before converting to base`;
427
+ static code = "INTERNAL_ERROR";
428
+ static statusCode = 500;
429
+ static description = `Internal error: {message}`;
430
430
  }
431
- class AlreadyHasBaseError extends Error {
431
+ class ForkVmNotFoundError extends Error {
432
432
  constructor(body) {
433
433
  super(
434
- `ALREADY_HAS_BASE: ${body.message}`
434
+ `FORK_VM_NOT_FOUND: ${body.message}`
435
435
  );
436
436
  this.body = body;
437
- this.name = "AlreadyHasBaseError";
437
+ this.name = "ForkVmNotFoundError";
438
438
  }
439
- static code = "ALREADY_HAS_BASE";
440
- static statusCode = 400;
441
- static description = `VM already has a base rootfs`;
439
+ static code = "FORK_VM_NOT_FOUND";
440
+ static statusCode = 404;
441
+ static description = `Fork VM not found: {fork_vm_id}`;
442
442
  }
443
- class NotFoundError extends Error {
443
+ class CreateSnapshotBadRequestError extends Error {
444
444
  constructor(body) {
445
445
  super(
446
- `NOT_FOUND: ${body.message}`
446
+ `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
447
447
  );
448
448
  this.body = body;
449
- this.name = "NotFoundError";
449
+ this.name = "CreateSnapshotBadRequestError";
450
450
  }
451
- static code = "NOT_FOUND";
452
- static statusCode = 404;
453
- static description = `VM not found`;
451
+ static code = "CREATE_SNAPSHOT_BAD_REQUEST";
452
+ static statusCode = 400;
453
+ static description = `Bad request: {message}`;
454
454
  }
455
- class DatabaseErrorError extends Error {
455
+ class ResumedVmNonResponsiveError extends Error {
456
456
  constructor(body) {
457
457
  super(
458
- `DATABASE_ERROR: ${body.message}`
458
+ `RESUMED_VM_NON_RESPONSIVE: ${body.message}`
459
459
  );
460
460
  this.body = body;
461
- this.name = "DatabaseErrorError";
461
+ this.name = "ResumedVmNonResponsiveError";
462
462
  }
463
- static code = "DATABASE_ERROR";
463
+ static code = "RESUMED_VM_NON_RESPONSIVE";
464
464
  static statusCode = 500;
465
- static description = `Database error occurred while constructing VmRecord, details: {details}`;
465
+ static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
466
466
  }
467
- class PartitionNotFoundError extends Error {
467
+ class SnapshotLoadTimeoutError extends Error {
468
468
  constructor(body) {
469
469
  super(
470
- `PARTITION_NOT_FOUND: ${body.message}`
470
+ `SNAPSHOT_LOAD_TIMEOUT: ${body.message}`
471
471
  );
472
472
  this.body = body;
473
- this.name = "PartitionNotFoundError";
473
+ this.name = "SnapshotLoadTimeoutError";
474
474
  }
475
- static code = "PARTITION_NOT_FOUND";
476
- static statusCode = 404;
477
- static description = `Partition not found: {partition_id}`;
475
+ static code = "SNAPSHOT_LOAD_TIMEOUT";
476
+ static statusCode = 500;
477
+ static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
478
478
  }
479
- class InvalidVmIdError extends Error {
479
+ class UffdTimeoutErrorError extends Error {
480
480
  constructor(body) {
481
481
  super(
482
- `INVALID_VM_ID: ${body.message}`
482
+ `UFFD_TIMEOUT_ERROR: ${body.message}`
483
483
  );
484
484
  this.body = body;
485
- this.name = "InvalidVmIdError";
485
+ this.name = "UffdTimeoutErrorError";
486
486
  }
487
- static code = "INVALID_VM_ID";
488
- static statusCode = 400;
489
- static description = `Invalid VM ID: {vm_id}, details: {details}`;
487
+ static code = "UFFD_TIMEOUT_ERROR";
488
+ static statusCode = 500;
489
+ static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
490
490
  }
491
- class InvalidGitRepoSpecErrorError extends Error {
491
+ class KernelPanicError extends Error {
492
492
  constructor(body) {
493
493
  super(
494
- `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
494
+ `KERNEL_PANIC: ${body.message}`
495
495
  );
496
496
  this.body = body;
497
- this.name = "InvalidGitRepoSpecErrorError";
497
+ this.name = "KernelPanicError";
498
498
  }
499
- static code = "INVALID_GIT_REPO_SPEC_ERROR";
500
- static statusCode = 400;
501
- static description = `Invalid git repository specification: {message}`;
499
+ static code = "KERNEL_PANIC";
500
+ static statusCode = 500;
501
+ static description = `VM kernel panic detected`;
502
502
  }
503
- class ForkVmNotFoundError extends Error {
503
+ class VmDeletedError extends Error {
504
504
  constructor(body) {
505
505
  super(
506
- `FORK_VM_NOT_FOUND: ${body.message}`
506
+ `VM_DELETED: ${body.message}`
507
507
  );
508
508
  this.body = body;
509
- this.name = "ForkVmNotFoundError";
509
+ this.name = "VmDeletedError";
510
510
  }
511
- static code = "FORK_VM_NOT_FOUND";
512
- static statusCode = 404;
513
- static description = `Fork VM not found: {fork_vm_id}`;
511
+ static code = "VM_DELETED";
512
+ static statusCode = 410;
513
+ static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
514
514
  }
515
- class CreateSnapshotBadRequestError extends Error {
515
+ class ReqwestError extends Error {
516
516
  constructor(body) {
517
517
  super(
518
- `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
518
+ `REQWEST: ${body.message}`
519
519
  );
520
520
  this.body = body;
521
- this.name = "CreateSnapshotBadRequestError";
521
+ this.name = "ReqwestError";
522
522
  }
523
- static code = "CREATE_SNAPSHOT_BAD_REQUEST";
524
- static statusCode = 400;
525
- static description = `Bad request: {message}`;
523
+ static code = "REQWEST";
524
+ static statusCode = 500;
525
+ static description = `Reqwest error: {details}`;
526
526
  }
527
- class UserNotFoundError extends Error {
527
+ class FirecrackerPidNotFoundError extends Error {
528
528
  constructor(body) {
529
529
  super(
530
- `USER_NOT_FOUND: ${body.message}`
530
+ `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
531
531
  );
532
532
  this.body = body;
533
- this.name = "UserNotFoundError";
533
+ this.name = "FirecrackerPidNotFoundError";
534
534
  }
535
- static code = "USER_NOT_FOUND";
536
- static statusCode = 404;
537
- static description = `User not found: {user_name}`;
535
+ static code = "FIRECRACKER_PID_NOT_FOUND";
536
+ static statusCode = 500;
537
+ static description = `Firecracker PID not found`;
538
538
  }
539
- class UserAlreadyExistsError extends Error {
539
+ class FirecrackerApiSocketNotFoundError extends Error {
540
540
  constructor(body) {
541
541
  super(
542
- `USER_ALREADY_EXISTS: ${body.message}`
542
+ `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
543
543
  );
544
544
  this.body = body;
545
- this.name = "UserAlreadyExistsError";
545
+ this.name = "FirecrackerApiSocketNotFoundError";
546
546
  }
547
- static code = "USER_ALREADY_EXISTS";
548
- static statusCode = 409;
549
- static description = `Conflict: User '{user_name}' already exists`;
547
+ static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
548
+ static statusCode = 500;
549
+ static description = `Firecracker API socket not found`;
550
550
  }
551
- class ValidationErrorError extends Error {
551
+ class InvalidSnapshotIdError extends Error {
552
552
  constructor(body) {
553
553
  super(
554
- `VALIDATION_ERROR: ${body.message}`
554
+ `INVALID_SNAPSHOT_ID: ${body.message}`
555
555
  );
556
556
  this.body = body;
557
- this.name = "ValidationErrorError";
557
+ this.name = "InvalidSnapshotIdError";
558
558
  }
559
- static code = "VALIDATION_ERROR";
559
+ static code = "INVALID_SNAPSHOT_ID";
560
560
  static statusCode = 400;
561
- static description = `Validation error: {message}`;
561
+ static description = `Invalid snapshot id: {id}`;
562
562
  }
563
- class GroupNotFoundError extends Error {
563
+ class VmStartTimeoutError extends Error {
564
564
  constructor(body) {
565
565
  super(
566
- `GROUP_NOT_FOUND: ${body.message}`
566
+ `VM_START_TIMEOUT: ${body.message}`
567
567
  );
568
568
  this.body = body;
569
- this.name = "GroupNotFoundError";
569
+ this.name = "VmStartTimeoutError";
570
570
  }
571
- static code = "GROUP_NOT_FOUND";
572
- static statusCode = 404;
573
- static description = `Group not found: {group_name}`;
571
+ static code = "VM_START_TIMEOUT";
572
+ static statusCode = 504;
573
+ static description = `VM did not become ready within the specified timeout`;
574
574
  }
575
- class GroupAlreadyExistsError extends Error {
575
+ class VmExitDuringStartError extends Error {
576
576
  constructor(body) {
577
577
  super(
578
- `GROUP_ALREADY_EXISTS: ${body.message}`
578
+ `VM_EXIT_DURING_START: ${body.message}`
579
579
  );
580
580
  this.body = body;
581
- this.name = "GroupAlreadyExistsError";
581
+ this.name = "VmExitDuringStartError";
582
582
  }
583
- static code = "GROUP_ALREADY_EXISTS";
584
- static statusCode = 409;
585
- static description = `Conflict: Group '{group_name}' already exists`;
583
+ static code = "VM_EXIT_DURING_START";
584
+ static statusCode = 500;
585
+ static description = `VM process exited unexpectedly during start`;
586
586
  }
587
- class DuplicateUserNameError extends Error {
587
+ class VmAccessDeniedError extends Error {
588
588
  constructor(body) {
589
589
  super(
590
- `DUPLICATE_USER_NAME: ${body.message}`
590
+ `VM_ACCESS_DENIED: ${body.message}`
591
591
  );
592
592
  this.body = body;
593
- this.name = "DuplicateUserNameError";
593
+ this.name = "VmAccessDeniedError";
594
594
  }
595
- static code = "DUPLICATE_USER_NAME";
596
- static statusCode = 400;
597
- static description = `Duplicate user name '{name}' found`;
595
+ static code = "VM_ACCESS_DENIED";
596
+ static statusCode = 403;
597
+ static description = `You do not have access to this VM`;
598
598
  }
599
- class UserGroupEmptyError extends Error {
599
+ class StdIoError extends Error {
600
600
  constructor(body) {
601
601
  super(
602
- `USER_GROUP_EMPTY: ${body.message}`
602
+ `STD_IO: ${body.message}`
603
603
  );
604
604
  this.body = body;
605
- this.name = "UserGroupEmptyError";
605
+ this.name = "StdIoError";
606
606
  }
607
- static code = "USER_GROUP_EMPTY";
608
- static statusCode = 400;
609
- static description = `User '{user}' has empty string in groups`;
607
+ static code = "STD_IO";
608
+ static statusCode = 500;
609
+ static description = `Standard IO error`;
610
610
  }
611
- class UserSystemFlagMismatchError extends Error {
611
+ class VmCreateTmuxSessionError extends Error {
612
612
  constructor(body) {
613
613
  super(
614
- `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
614
+ `VM_CREATE_TMUX_SESSION: ${body.message}`
615
615
  );
616
616
  this.body = body;
617
- this.name = "UserSystemFlagMismatchError";
617
+ this.name = "VmCreateTmuxSessionError";
618
618
  }
619
- static code = "USER_SYSTEM_FLAG_MISMATCH";
620
- static statusCode = 400;
621
- static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
619
+ static code = "VM_CREATE_TMUX_SESSION";
620
+ static statusCode = 500;
621
+ static description = `Failed to create tmux session for VM`;
622
622
  }
623
- class UserUidOutOfRangeError extends Error {
623
+ class VmSubnetNotFoundError extends Error {
624
624
  constructor(body) {
625
625
  super(
626
- `USER_UID_OUT_OF_RANGE: ${body.message}`
626
+ `VM_SUBNET_NOT_FOUND: ${body.message}`
627
627
  );
628
628
  this.body = body;
629
- this.name = "UserUidOutOfRangeError";
629
+ this.name = "VmSubnetNotFoundError";
630
630
  }
631
- static code = "USER_UID_OUT_OF_RANGE";
632
- static statusCode = 400;
633
- static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
631
+ static code = "VM_SUBNET_NOT_FOUND";
632
+ static statusCode = 500;
633
+ static description = `Subnet for VM not found`;
634
634
  }
635
- class UserHomeInvalidError extends Error {
635
+ class VmOperationDeniedDuringTransactionError extends Error {
636
636
  constructor(body) {
637
637
  super(
638
- `USER_HOME_INVALID: ${body.message}`
638
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
639
639
  );
640
640
  this.body = body;
641
- this.name = "UserHomeInvalidError";
641
+ this.name = "VmOperationDeniedDuringTransactionError";
642
642
  }
643
- static code = "USER_HOME_INVALID";
644
- static statusCode = 400;
645
- static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
643
+ static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
644
+ static statusCode = 409;
645
+ static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
646
646
  }
647
- class UserShellInvalidError extends Error {
647
+ class VmTransactionIdMismatchError extends Error {
648
648
  constructor(body) {
649
649
  super(
650
- `USER_SHELL_INVALID: ${body.message}`
650
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
651
651
  );
652
652
  this.body = body;
653
- this.name = "UserShellInvalidError";
653
+ this.name = "VmTransactionIdMismatchError";
654
654
  }
655
- static code = "USER_SHELL_INVALID";
655
+ static code = "VM_TRANSACTION_ID_MISMATCH";
656
656
  static statusCode = 400;
657
- static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
657
+ static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
658
658
  }
659
- class DuplicateGroupNameError extends Error {
659
+ class VmNotInTransactionError extends Error {
660
660
  constructor(body) {
661
661
  super(
662
- `DUPLICATE_GROUP_NAME: ${body.message}`
662
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
663
663
  );
664
664
  this.body = body;
665
- this.name = "DuplicateGroupNameError";
665
+ this.name = "VmNotInTransactionError";
666
666
  }
667
- static code = "DUPLICATE_GROUP_NAME";
668
- static statusCode = 400;
669
- static description = `Duplicate group name '{name}' found`;
667
+ static code = "VM_NOT_IN_TRANSACTION";
668
+ static statusCode = 404;
669
+ static description = `VM not in a transaction: {vm_id}`;
670
670
  }
671
- class GroupNameReservedError extends Error {
671
+ class ActiveTransactionErrorError extends Error {
672
672
  constructor(body) {
673
673
  super(
674
- `GROUP_NAME_RESERVED: ${body.message}`
674
+ `ACTIVE_TRANSACTION_ERROR: ${body.message}`
675
675
  );
676
676
  this.body = body;
677
- this.name = "GroupNameReservedError";
677
+ this.name = "ActiveTransactionErrorError";
678
678
  }
679
- static code = "GROUP_NAME_RESERVED";
680
- static statusCode = 400;
681
- static description = `Group name '{name}' is reserved and cannot be used`;
679
+ static code = "ACTIVE_TRANSACTION_ERROR";
680
+ static statusCode = 500;
681
+ static description = `Active transaction error: {details}`;
682
682
  }
683
- class GroupNameInvalidCharsError extends Error {
683
+ class RootfsCopyErrorError extends Error {
684
684
  constructor(body) {
685
685
  super(
686
- `GROUP_NAME_INVALID_CHARS: ${body.message}`
686
+ `ROOTFS_COPY_ERROR: ${body.message}`
687
687
  );
688
688
  this.body = body;
689
- this.name = "GroupNameInvalidCharsError";
689
+ this.name = "RootfsCopyErrorError";
690
690
  }
691
- static code = "GROUP_NAME_INVALID_CHARS";
692
- static statusCode = 400;
693
- static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
691
+ static code = "ROOTFS_COPY_ERROR";
692
+ static statusCode = 500;
693
+ static description = `Failed to copy rootfs from {from} to {to}: {details}`;
694
694
  }
695
- class GroupNameTooLongError extends Error {
695
+ class VmNotRunningError extends Error {
696
696
  constructor(body) {
697
697
  super(
698
- `GROUP_NAME_TOO_LONG: ${body.message}`
698
+ `VM_NOT_RUNNING: ${body.message}`
699
699
  );
700
700
  this.body = body;
701
- this.name = "GroupNameTooLongError";
701
+ this.name = "VmNotRunningError";
702
702
  }
703
- static code = "GROUP_NAME_TOO_LONG";
703
+ static code = "VM_NOT_RUNNING";
704
704
  static statusCode = 400;
705
- static description = `Group name '{name}' is too long (max {max_length} characters)`;
705
+ static description = `VM is not running: {vm_id}`;
706
706
  }
707
- class GroupNameEmptyError extends Error {
707
+ class VmNotFoundError extends Error {
708
708
  constructor(body) {
709
709
  super(
710
- `GROUP_NAME_EMPTY: ${body.message}`
710
+ `VM_NOT_FOUND: ${body.message}`
711
711
  );
712
712
  this.body = body;
713
- this.name = "GroupNameEmptyError";
713
+ this.name = "VmNotFoundError";
714
714
  }
715
- static code = "GROUP_NAME_EMPTY";
716
- static statusCode = 400;
717
- static description = `Group name cannot be empty`;
715
+ static code = "VM_NOT_FOUND";
716
+ static statusCode = 404;
717
+ static description = `VM not found: {vm_id}`;
718
718
  }
719
- class VmOperationDeniedDuringTransactionError extends Error {
719
+ class InternalForkVmNotFoundError extends Error {
720
720
  constructor(body) {
721
721
  super(
722
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
722
+ `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
723
723
  );
724
724
  this.body = body;
725
- this.name = "VmOperationDeniedDuringTransactionError";
725
+ this.name = "InternalForkVmNotFoundError";
726
726
  }
727
- static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
728
- static statusCode = 409;
729
- static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
727
+ static code = "INTERNAL_FORK_VM_NOT_FOUND";
728
+ static statusCode = 404;
729
+ static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
730
730
  }
731
- class VmTransactionIdMismatchError extends Error {
731
+ class BadRequestError extends Error {
732
732
  constructor(body) {
733
733
  super(
734
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
734
+ `BAD_REQUEST: ${body.message}`
735
735
  );
736
736
  this.body = body;
737
- this.name = "VmTransactionIdMismatchError";
737
+ this.name = "BadRequestError";
738
738
  }
739
- static code = "VM_TRANSACTION_ID_MISMATCH";
739
+ static code = "BAD_REQUEST";
740
740
  static statusCode = 400;
741
- static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
741
+ static description = `Bad request: {message}`;
742
742
  }
743
- class VmNotInTransactionError extends Error {
743
+ class InternalVmNotFoundError extends Error {
744
744
  constructor(body) {
745
745
  super(
746
- `VM_NOT_IN_TRANSACTION: ${body.message}`
746
+ `INTERNAL_VM_NOT_FOUND: ${body.message}`
747
747
  );
748
748
  this.body = body;
749
- this.name = "VmNotInTransactionError";
749
+ this.name = "InternalVmNotFoundError";
750
750
  }
751
- static code = "VM_NOT_IN_TRANSACTION";
751
+ static code = "INTERNAL_VM_NOT_FOUND";
752
752
  static statusCode = 404;
753
- static description = `VM not in a transaction: {vm_id}`;
753
+ static description = `VM not found: {vm_id}`;
754
754
  }
755
755
  class DockerSnapshotFailedError extends Error {
756
756
  constructor(body) {
@@ -1148,149 +1148,221 @@ class MaxUsesExceededError extends Error {
1148
1148
  static statusCode = 403;
1149
1149
  static description = `Session maximum uses exceeded`;
1150
1150
  }
1151
- class ExpiredError extends Error {
1151
+ class ExpiredError extends Error {
1152
+ constructor(body) {
1153
+ super(
1154
+ `EXPIRED: ${body.message}`
1155
+ );
1156
+ this.body = body;
1157
+ this.name = "ExpiredError";
1158
+ }
1159
+ static code = "EXPIRED";
1160
+ static statusCode = 403;
1161
+ static description = `Session has expired`;
1162
+ }
1163
+ class InvalidRangeError extends Error {
1164
+ constructor(body) {
1165
+ super(
1166
+ `INVALID_RANGE: ${body.message}`
1167
+ );
1168
+ this.body = body;
1169
+ this.name = "InvalidRangeError";
1170
+ }
1171
+ static code = "INVALID_RANGE";
1172
+ static statusCode = 400;
1173
+ 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.`;
1174
+ }
1175
+ class OffsetWithSelectorError extends Error {
1176
+ constructor(body) {
1177
+ super(
1178
+ `OFFSET_WITH_SELECTOR: ${body.message}`
1179
+ );
1180
+ this.body = body;
1181
+ this.name = "OffsetWithSelectorError";
1182
+ }
1183
+ static code = "OFFSET_WITH_SELECTOR";
1184
+ static statusCode = 400;
1185
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1186
+ }
1187
+ class CommitNotInBranchError extends Error {
1188
+ constructor(body) {
1189
+ super(
1190
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1191
+ );
1192
+ this.body = body;
1193
+ this.name = "CommitNotInBranchError";
1194
+ }
1195
+ static code = "COMMIT_NOT_IN_BRANCH";
1196
+ static statusCode = 400;
1197
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1198
+ }
1199
+ class CommitNotFoundError extends Error {
1200
+ constructor(body) {
1201
+ super(
1202
+ `COMMIT_NOT_FOUND: ${body.message}`
1203
+ );
1204
+ this.body = body;
1205
+ this.name = "CommitNotFoundError";
1206
+ }
1207
+ static code = "COMMIT_NOT_FOUND";
1208
+ static statusCode = 400;
1209
+ static description = `Commit not found: {sha}`;
1210
+ }
1211
+ class BranchNotFoundError extends Error {
1212
+ constructor(body) {
1213
+ super(
1214
+ `BRANCH_NOT_FOUND: ${body.message}`
1215
+ );
1216
+ this.body = body;
1217
+ this.name = "BranchNotFoundError";
1218
+ }
1219
+ static code = "BRANCH_NOT_FOUND";
1220
+ static statusCode = 404;
1221
+ static description = `Branch not found: {branch}`;
1222
+ }
1223
+ class NoDefaultBranchError extends Error {
1152
1224
  constructor(body) {
1153
1225
  super(
1154
- `EXPIRED: ${body.message}`
1226
+ `NO_DEFAULT_BRANCH: ${body.message}`
1155
1227
  );
1156
1228
  this.body = body;
1157
- this.name = "ExpiredError";
1229
+ this.name = "NoDefaultBranchError";
1158
1230
  }
1159
- static code = "EXPIRED";
1160
- static statusCode = 403;
1161
- static description = `Session has expired`;
1231
+ static code = "NO_DEFAULT_BRANCH";
1232
+ static statusCode = 404;
1233
+ static description = `Repository has no default branch configured`;
1162
1234
  }
1163
- class PackfileError extends Error {
1235
+ class InvalidBase64ContentError extends Error {
1164
1236
  constructor(body) {
1165
1237
  super(
1166
- `PACKFILE: ${body.message}`
1238
+ `INVALID_BASE64_CONTENT: ${body.message}`
1167
1239
  );
1168
1240
  this.body = body;
1169
- this.name = "PackfileError";
1241
+ this.name = "InvalidBase64ContentError";
1170
1242
  }
1171
- static code = "PACKFILE";
1172
- static statusCode = 500;
1173
- static description = `Error building packfile`;
1243
+ static code = "INVALID_BASE64_CONTENT";
1244
+ static statusCode = 400;
1245
+ static description = `Invalid base64 content for file: {path}`;
1174
1246
  }
1175
- class TreeNotFoundError extends Error {
1247
+ class InvalidFileChangeError extends Error {
1176
1248
  constructor(body) {
1177
1249
  super(
1178
- `TREE_NOT_FOUND: ${body.message}`
1250
+ `INVALID_FILE_CHANGE: ${body.message}`
1179
1251
  );
1180
1252
  this.body = body;
1181
- this.name = "TreeNotFoundError";
1253
+ this.name = "InvalidFileChangeError";
1182
1254
  }
1183
- static code = "TREE_NOT_FOUND";
1184
- static statusCode = 404;
1185
- static description = `Tree not found: {hash}`;
1255
+ static code = "INVALID_FILE_CHANGE";
1256
+ static statusCode = 400;
1257
+ static description = `File change must have either content or deleted flag, not both: {path}`;
1186
1258
  }
1187
- class BranchNotFoundError extends Error {
1259
+ class InvalidFilePathError extends Error {
1188
1260
  constructor(body) {
1189
1261
  super(
1190
- `BRANCH_NOT_FOUND: ${body.message}`
1262
+ `INVALID_FILE_PATH: ${body.message}`
1191
1263
  );
1192
1264
  this.body = body;
1193
- this.name = "BranchNotFoundError";
1265
+ this.name = "InvalidFilePathError";
1194
1266
  }
1195
- static code = "BRANCH_NOT_FOUND";
1196
- static statusCode = 404;
1197
- static description = `Branch not found: {branch}`;
1267
+ static code = "INVALID_FILE_PATH";
1268
+ static statusCode = 400;
1269
+ static description = `Invalid file path: {path}`;
1198
1270
  }
1199
- class ForbiddenError extends Error {
1271
+ class ConflictingParentError extends Error {
1200
1272
  constructor(body) {
1201
1273
  super(
1202
- `FORBIDDEN: ${body.message}`
1274
+ `CONFLICTING_PARENT: ${body.message}`
1203
1275
  );
1204
1276
  this.body = body;
1205
- this.name = "ForbiddenError";
1277
+ this.name = "ConflictingParentError";
1206
1278
  }
1207
- static code = "FORBIDDEN";
1208
- static statusCode = 403;
1209
- static description = `Forbidden: {message}`;
1279
+ static code = "CONFLICTING_PARENT";
1280
+ static statusCode = 409;
1281
+ static description = `Conflict: expected parent SHA {expected} but current is {actual:?}`;
1210
1282
  }
1211
- class UnauthorizedError extends Error {
1283
+ class InvalidServiceError extends Error {
1212
1284
  constructor(body) {
1213
1285
  super(
1214
- `UNAUTHORIZED: ${body.message}`
1286
+ `INVALID_SERVICE: ${body.message}`
1215
1287
  );
1216
1288
  this.body = body;
1217
- this.name = "UnauthorizedError";
1289
+ this.name = "InvalidServiceError";
1218
1290
  }
1219
- static code = "UNAUTHORIZED";
1220
- static statusCode = 401;
1221
- static description = `Unauthorized: {message}`;
1291
+ static code = "INVALID_SERVICE";
1292
+ static statusCode = 403;
1293
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1222
1294
  }
1223
- class RepoAlreadyExistsError extends Error {
1295
+ class ExpectedServiceError extends Error {
1224
1296
  constructor(body) {
1225
1297
  super(
1226
- `REPO_ALREADY_EXISTS: ${body.message}`
1298
+ `EXPECTED_SERVICE: ${body.message}`
1227
1299
  );
1228
1300
  this.body = body;
1229
- this.name = "RepoAlreadyExistsError";
1301
+ this.name = "ExpectedServiceError";
1230
1302
  }
1231
- static code = "REPO_ALREADY_EXISTS";
1232
- static statusCode = 409;
1233
- static description = `Repository {repo_id} already exists`;
1303
+ static code = "EXPECTED_SERVICE";
1304
+ static statusCode = 403;
1305
+ static description = `Expected 'service' query parameter`;
1234
1306
  }
1235
- class GitHubSyncConflictError extends Error {
1307
+ class TagNotFoundError extends Error {
1236
1308
  constructor(body) {
1237
1309
  super(
1238
- `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1310
+ `TAG_NOT_FOUND: ${body.message}`
1239
1311
  );
1240
1312
  this.body = body;
1241
- this.name = "GitHubSyncConflictError";
1313
+ this.name = "TagNotFoundError";
1242
1314
  }
1243
- static code = "GIT_HUB_SYNC_CONFLICT";
1244
- static statusCode = 409;
1245
- static description = `GitHub Sync Conflict: {message}`;
1315
+ static code = "TAG_NOT_FOUND";
1316
+ static statusCode = 404;
1317
+ static description = `Tag not found: {hash}`;
1246
1318
  }
1247
- class InvalidObjectIdError extends Error {
1319
+ class InvalidRevisionError extends Error {
1248
1320
  constructor(body) {
1249
1321
  super(
1250
- `INVALID_OBJECT_ID: ${body.message}`
1322
+ `INVALID_REVISION: ${body.message}`
1251
1323
  );
1252
1324
  this.body = body;
1253
- this.name = "InvalidObjectIdError";
1325
+ this.name = "InvalidRevisionError";
1254
1326
  }
1255
- static code = "INVALID_OBJECT_ID";
1327
+ static code = "INVALID_REVISION";
1256
1328
  static statusCode = 400;
1257
- static description = `Invalid object ID: {hash}`;
1329
+ static description = `Invalid revision: {revision}`;
1258
1330
  }
1259
- class CommitNotFoundError extends Error {
1331
+ class ForbiddenError extends Error {
1260
1332
  constructor(body) {
1261
1333
  super(
1262
- `COMMIT_NOT_FOUND: ${body.message}`
1334
+ `FORBIDDEN: ${body.message}`
1263
1335
  );
1264
1336
  this.body = body;
1265
- this.name = "CommitNotFoundError";
1337
+ this.name = "ForbiddenError";
1266
1338
  }
1267
- static code = "COMMIT_NOT_FOUND";
1268
- static statusCode = 404;
1269
- static description = `Commit {commit_hash} not found in repository {repo_id}`;
1339
+ static code = "FORBIDDEN";
1340
+ static statusCode = 403;
1341
+ static description = `Forbidden`;
1270
1342
  }
1271
- class PathNotFoundError extends Error {
1343
+ class UnauthorizedError extends Error {
1272
1344
  constructor(body) {
1273
1345
  super(
1274
- `PATH_NOT_FOUND: ${body.message}`
1346
+ `UNAUTHORIZED: ${body.message}`
1275
1347
  );
1276
1348
  this.body = body;
1277
- this.name = "PathNotFoundError";
1349
+ this.name = "UnauthorizedError";
1278
1350
  }
1279
- static code = "PATH_NOT_FOUND";
1280
- static statusCode = 404;
1281
- static description = `Path not found: {path}`;
1351
+ static code = "UNAUTHORIZED";
1352
+ static statusCode = 401;
1353
+ static description = `Unauthorized`;
1282
1354
  }
1283
- class ReferenceNotFoundError extends Error {
1355
+ class BlobNotFoundError extends Error {
1284
1356
  constructor(body) {
1285
1357
  super(
1286
- `REFERENCE_NOT_FOUND: ${body.message}`
1358
+ `BLOB_NOT_FOUND: ${body.message}`
1287
1359
  );
1288
1360
  this.body = body;
1289
- this.name = "ReferenceNotFoundError";
1361
+ this.name = "BlobNotFoundError";
1290
1362
  }
1291
- static code = "REFERENCE_NOT_FOUND";
1363
+ static code = "BLOB_NOT_FOUND";
1292
1364
  static statusCode = 404;
1293
- static description = `Reference not found: {reference}`;
1365
+ static description = `Blob not found: {hash}`;
1294
1366
  }
1295
1367
  class AmbiguousError extends Error {
1296
1368
  constructor(body) {
@@ -1376,137 +1448,149 @@ class ImportSubdirNotFoundError extends Error {
1376
1448
  static statusCode = 400;
1377
1449
  static description = `Directory not found in {source}: {dir}`;
1378
1450
  }
1379
- class TagNotFoundError extends Error {
1451
+ class RepoAlreadyExistsError extends Error {
1380
1452
  constructor(body) {
1381
1453
  super(
1382
- `TAG_NOT_FOUND: ${body.message}`
1454
+ `REPO_ALREADY_EXISTS: ${body.message}`
1383
1455
  );
1384
1456
  this.body = body;
1385
- this.name = "TagNotFoundError";
1457
+ this.name = "RepoAlreadyExistsError";
1386
1458
  }
1387
- static code = "TAG_NOT_FOUND";
1459
+ static code = "REPO_ALREADY_EXISTS";
1460
+ static statusCode = 409;
1461
+ static description = `Repo '{repo_id}' already exists`;
1462
+ }
1463
+ class TreeNotFoundError extends Error {
1464
+ constructor(body) {
1465
+ super(
1466
+ `TREE_NOT_FOUND: ${body.message}`
1467
+ );
1468
+ this.body = body;
1469
+ this.name = "TreeNotFoundError";
1470
+ }
1471
+ static code = "TREE_NOT_FOUND";
1388
1472
  static statusCode = 404;
1389
- static description = `Tag not found: {tag}`;
1473
+ static description = `Tree not found: {hash}`;
1390
1474
  }
1391
- class UnsupportedTransferError extends Error {
1475
+ class PathNotFoundError extends Error {
1392
1476
  constructor(body) {
1393
1477
  super(
1394
- `UNSUPPORTED_TRANSFER: ${body.message}`
1478
+ `PATH_NOT_FOUND: ${body.message}`
1395
1479
  );
1396
1480
  this.body = body;
1397
- this.name = "UnsupportedTransferError";
1481
+ this.name = "PathNotFoundError";
1398
1482
  }
1399
- static code = "UNSUPPORTED_TRANSFER";
1400
- static statusCode = 400;
1401
- static description = `Unsupported LFS transfer protocol(s)`;
1483
+ static code = "PATH_NOT_FOUND";
1484
+ static statusCode = 404;
1485
+ static description = `Path not found: {path}`;
1402
1486
  }
1403
- class SendErrorError extends Error {
1487
+ class ReferenceNotFoundError extends Error {
1404
1488
  constructor(body) {
1405
1489
  super(
1406
- `SEND_ERROR: ${body.message}`
1490
+ `REFERENCE_NOT_FOUND: ${body.message}`
1407
1491
  );
1408
1492
  this.body = body;
1409
- this.name = "SendErrorError";
1493
+ this.name = "ReferenceNotFoundError";
1410
1494
  }
1411
- static code = "SEND_ERROR";
1412
- static statusCode = 500;
1413
- static description = `Stream receiver dropped`;
1495
+ static code = "REFERENCE_NOT_FOUND";
1496
+ static statusCode = 404;
1497
+ static description = `Reference not found: {reference}`;
1414
1498
  }
1415
- class InvalidServiceError extends Error {
1499
+ class ConflictError extends Error {
1416
1500
  constructor(body) {
1417
1501
  super(
1418
- `INVALID_SERVICE: ${body.message}`
1502
+ `CONFLICT: ${body.message}`
1419
1503
  );
1420
1504
  this.body = body;
1421
- this.name = "InvalidServiceError";
1505
+ this.name = "ConflictError";
1422
1506
  }
1423
- static code = "INVALID_SERVICE";
1424
- static statusCode = 403;
1425
- static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1507
+ static code = "CONFLICT";
1508
+ static statusCode = 409;
1509
+ static description = `Sync conflict: {message}`;
1426
1510
  }
1427
- class ExpectedServiceError extends Error {
1511
+ class BranchAlreadyExistsError extends Error {
1428
1512
  constructor(body) {
1429
1513
  super(
1430
- `EXPECTED_SERVICE: ${body.message}`
1514
+ `BRANCH_ALREADY_EXISTS: ${body.message}`
1431
1515
  );
1432
1516
  this.body = body;
1433
- this.name = "ExpectedServiceError";
1517
+ this.name = "BranchAlreadyExistsError";
1434
1518
  }
1435
- static code = "EXPECTED_SERVICE";
1436
- static statusCode = 403;
1437
- static description = `Expected 'service' query parameter`;
1519
+ static code = "BRANCH_ALREADY_EXISTS";
1520
+ static statusCode = 409;
1521
+ static description = `Branch already exists: {branch}`;
1438
1522
  }
1439
- class InvalidRangeError extends Error {
1523
+ class ParentNotFoundError extends Error {
1440
1524
  constructor(body) {
1441
1525
  super(
1442
- `INVALID_RANGE: ${body.message}`
1526
+ `PARENT_NOT_FOUND: ${body.message}`
1443
1527
  );
1444
1528
  this.body = body;
1445
- this.name = "InvalidRangeError";
1529
+ this.name = "ParentNotFoundError";
1446
1530
  }
1447
- static code = "INVALID_RANGE";
1448
- static statusCode = 400;
1449
- 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.`;
1531
+ static code = "PARENT_NOT_FOUND";
1532
+ static statusCode = 404;
1533
+ static description = `Parent commit not found: {sha}`;
1450
1534
  }
1451
- class OffsetWithSelectorError extends Error {
1535
+ class GitHubSyncConflictError extends Error {
1452
1536
  constructor(body) {
1453
1537
  super(
1454
- `OFFSET_WITH_SELECTOR: ${body.message}`
1538
+ `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1455
1539
  );
1456
1540
  this.body = body;
1457
- this.name = "OffsetWithSelectorError";
1541
+ this.name = "GitHubSyncConflictError";
1458
1542
  }
1459
- static code = "OFFSET_WITH_SELECTOR";
1460
- static statusCode = 400;
1461
- static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1543
+ static code = "GIT_HUB_SYNC_CONFLICT";
1544
+ static statusCode = 409;
1545
+ static description = `GitHub Sync Conflict: {message}`;
1462
1546
  }
1463
- class CommitNotInBranchError extends Error {
1547
+ class InvalidObjectIdError extends Error {
1464
1548
  constructor(body) {
1465
1549
  super(
1466
- `COMMIT_NOT_IN_BRANCH: ${body.message}`
1550
+ `INVALID_OBJECT_ID: ${body.message}`
1467
1551
  );
1468
1552
  this.body = body;
1469
- this.name = "CommitNotInBranchError";
1553
+ this.name = "InvalidObjectIdError";
1470
1554
  }
1471
- static code = "COMMIT_NOT_IN_BRANCH";
1555
+ static code = "INVALID_OBJECT_ID";
1472
1556
  static statusCode = 400;
1473
- static description = `Commit {sha} is not in the history of branch {branch}`;
1557
+ static description = `Invalid object ID: {hash}`;
1474
1558
  }
1475
- class BlobNotFoundError extends Error {
1559
+ class UnsupportedTransferError extends Error {
1476
1560
  constructor(body) {
1477
1561
  super(
1478
- `BLOB_NOT_FOUND: ${body.message}`
1562
+ `UNSUPPORTED_TRANSFER: ${body.message}`
1479
1563
  );
1480
1564
  this.body = body;
1481
- this.name = "BlobNotFoundError";
1565
+ this.name = "UnsupportedTransferError";
1482
1566
  }
1483
- static code = "BLOB_NOT_FOUND";
1484
- static statusCode = 404;
1485
- static description = `Blob not found: {hash}`;
1567
+ static code = "UNSUPPORTED_TRANSFER";
1568
+ static statusCode = 400;
1569
+ static description = `Unsupported LFS transfer protocol(s)`;
1486
1570
  }
1487
- class InvalidRevisionError extends Error {
1571
+ class PackfileError extends Error {
1488
1572
  constructor(body) {
1489
1573
  super(
1490
- `INVALID_REVISION: ${body.message}`
1574
+ `PACKFILE: ${body.message}`
1491
1575
  );
1492
1576
  this.body = body;
1493
- this.name = "InvalidRevisionError";
1577
+ this.name = "PackfileError";
1494
1578
  }
1495
- static code = "INVALID_REVISION";
1496
- static statusCode = 400;
1497
- static description = `Invalid revision: {revision}`;
1579
+ static code = "PACKFILE";
1580
+ static statusCode = 500;
1581
+ static description = `Error building packfile`;
1498
1582
  }
1499
- class ConflictError extends Error {
1583
+ class SendErrorError extends Error {
1500
1584
  constructor(body) {
1501
1585
  super(
1502
- `CONFLICT: ${body.message}`
1586
+ `SEND_ERROR: ${body.message}`
1503
1587
  );
1504
1588
  this.body = body;
1505
- this.name = "ConflictError";
1589
+ this.name = "SendErrorError";
1506
1590
  }
1507
- static code = "CONFLICT";
1508
- static statusCode = 409;
1509
- static description = `Sync conflict: {message}`;
1591
+ static code = "SEND_ERROR";
1592
+ static statusCode = 500;
1593
+ static description = `Stream receiver dropped`;
1510
1594
  }
1511
1595
  class UnavailableError extends Error {
1512
1596
  constructor(body) {
@@ -1528,21 +1612,9 @@ class DevServerNotFoundError extends Error {
1528
1612
  this.body = body;
1529
1613
  this.name = "DevServerNotFoundError";
1530
1614
  }
1531
- static code = "DEV_SERVER_NOT_FOUND";
1532
- static statusCode = 404;
1533
- static description = `dev server not found`;
1534
- }
1535
- class GitRepoLimitExceededError extends Error {
1536
- constructor(body) {
1537
- super(
1538
- `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
1539
- );
1540
- this.body = body;
1541
- this.name = "GitRepoLimitExceededError";
1542
- }
1543
- static code = "GIT_REPO_LIMIT_EXCEEDED";
1544
- static statusCode = 403;
1545
- static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
1615
+ static code = "DEV_SERVER_NOT_FOUND";
1616
+ static statusCode = 404;
1617
+ static description = `dev server not found`;
1546
1618
  }
1547
1619
  class EmptyTagError extends Error {
1548
1620
  constructor(body) {
@@ -1556,1553 +1628,1565 @@ class EmptyTagError extends Error {
1556
1628
  static statusCode = 400;
1557
1629
  static description = `Invalid request: tag cannot be empty`;
1558
1630
  }
1559
- class BranchNameEmptyError extends Error {
1631
+ class BrowserOperationFailedError extends Error {
1560
1632
  constructor(body) {
1561
1633
  super(
1562
- `BRANCH_NAME_EMPTY: ${body.message}`
1634
+ `BROWSER_OPERATION_FAILED: ${body.message}`
1563
1635
  );
1564
1636
  this.body = body;
1565
- this.name = "BranchNameEmptyError";
1637
+ this.name = "BrowserOperationFailedError";
1566
1638
  }
1567
- static code = "BRANCH_NAME_EMPTY";
1568
- static statusCode = 400;
1569
- static description = `Branch name cannot be empty`;
1639
+ static code = "BROWSER_OPERATION_FAILED";
1640
+ static statusCode = 500;
1641
+ static description = `Browser operation failed: {message}`;
1570
1642
  }
1571
- class VmLimitExceededError extends Error {
1643
+ class WatchFilesFailedError extends Error {
1572
1644
  constructor(body) {
1573
1645
  super(
1574
- `VM_LIMIT_EXCEEDED: ${body.message}`
1646
+ `WATCH_FILES_FAILED: ${body.message}`
1575
1647
  );
1576
1648
  this.body = body;
1577
- this.name = "VmLimitExceededError";
1649
+ this.name = "WatchFilesFailedError";
1578
1650
  }
1579
- static code = "VM_LIMIT_EXCEEDED";
1580
- static statusCode = 403;
1581
- static description = `VM limit exceeded: your plan allows {limit} VMs, you currently have {current}`;
1651
+ static code = "WATCH_FILES_FAILED";
1652
+ static statusCode = 500;
1653
+ static description = `Failed to watch files: {message}`;
1582
1654
  }
1583
- class ScheduleNotFoundError extends Error {
1655
+ class LogsFailedError extends Error {
1584
1656
  constructor(body) {
1585
1657
  super(
1586
- `SCHEDULE_NOT_FOUND: ${body.message}`
1658
+ `LOGS_FAILED: ${body.message}`
1587
1659
  );
1588
1660
  this.body = body;
1589
- this.name = "ScheduleNotFoundError";
1661
+ this.name = "LogsFailedError";
1590
1662
  }
1591
- static code = "SCHEDULE_NOT_FOUND";
1592
- static statusCode = 404;
1593
- static description = `Schedule not found`;
1663
+ static code = "LOGS_FAILED";
1664
+ static statusCode = 500;
1665
+ static description = `Failed to get logs: {message}`;
1594
1666
  }
1595
- class ServiceUnavailableError extends Error {
1667
+ class StatusFailedError extends Error {
1596
1668
  constructor(body) {
1597
1669
  super(
1598
- `SERVICE_UNAVAILABLE: ${body.message}`
1670
+ `STATUS_FAILED: ${body.message}`
1599
1671
  );
1600
1672
  this.body = body;
1601
- this.name = "ServiceUnavailableError";
1673
+ this.name = "StatusFailedError";
1602
1674
  }
1603
- static code = "SERVICE_UNAVAILABLE";
1604
- static statusCode = 503;
1605
- static description = `Cron service not configured`;
1675
+ static code = "STATUS_FAILED";
1676
+ static statusCode = 500;
1677
+ static description = `Failed to get dev server status: {message}`;
1606
1678
  }
1607
- class ExecuteLimitExceededError extends Error {
1679
+ class RestartFailedError extends Error {
1608
1680
  constructor(body) {
1609
1681
  super(
1610
- `EXECUTE_LIMIT_EXCEEDED: ${body.message}`
1682
+ `RESTART_FAILED: ${body.message}`
1611
1683
  );
1612
1684
  this.body = body;
1613
- this.name = "ExecuteLimitExceededError";
1685
+ this.name = "RestartFailedError";
1614
1686
  }
1615
- static code = "EXECUTE_LIMIT_EXCEEDED";
1616
- static statusCode = 403;
1617
- static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
1687
+ static code = "RESTART_FAILED";
1688
+ static statusCode = 500;
1689
+ static description = `Failed to restart dev server: {message}`;
1618
1690
  }
1619
- class TriggerErrorError extends Error {
1691
+ class ShutdownFailedError extends Error {
1620
1692
  constructor(body) {
1621
1693
  super(
1622
- `TRIGGER_ERROR: ${body.message}`
1694
+ `SHUTDOWN_FAILED: ${body.message}`
1623
1695
  );
1624
1696
  this.body = body;
1625
- this.name = "TriggerErrorError";
1697
+ this.name = "ShutdownFailedError";
1626
1698
  }
1627
- static code = "TRIGGER_ERROR";
1699
+ static code = "SHUTDOWN_FAILED";
1628
1700
  static statusCode = 500;
1629
- static description = `Failed to manage triggers: {message}`;
1701
+ static description = `Failed to shutdown dev server: {message}`;
1630
1702
  }
1631
- class TokenErrorError extends Error {
1703
+ class CommitFailedError extends Error {
1632
1704
  constructor(body) {
1633
1705
  super(
1634
- `TOKEN_ERROR: ${body.message}`
1706
+ `COMMIT_FAILED: ${body.message}`
1635
1707
  );
1636
1708
  this.body = body;
1637
- this.name = "TokenErrorError";
1709
+ this.name = "CommitFailedError";
1638
1710
  }
1639
- static code = "TOKEN_ERROR";
1711
+ static code = "COMMIT_FAILED";
1640
1712
  static statusCode = 500;
1641
- static description = `Failed to manage tokens: {message}`;
1713
+ static description = `Failed to commit changes: {message}`;
1642
1714
  }
1643
- class PermissionErrorError extends Error {
1715
+ class WriteFileFailedError extends Error {
1644
1716
  constructor(body) {
1645
1717
  super(
1646
- `PERMISSION_ERROR: ${body.message}`
1718
+ `WRITE_FILE_FAILED: ${body.message}`
1647
1719
  );
1648
1720
  this.body = body;
1649
- this.name = "PermissionErrorError";
1721
+ this.name = "WriteFileFailedError";
1650
1722
  }
1651
- static code = "PERMISSION_ERROR";
1723
+ static code = "WRITE_FILE_FAILED";
1652
1724
  static statusCode = 500;
1653
- static description = `Failed to manage permissions: {message}`;
1725
+ static description = `Failed to write file: {message}`;
1654
1726
  }
1655
- class IdentityErrorError extends Error {
1727
+ class ReadFileFailedError extends Error {
1656
1728
  constructor(body) {
1657
1729
  super(
1658
- `IDENTITY_ERROR: ${body.message}`
1730
+ `READ_FILE_FAILED: ${body.message}`
1659
1731
  );
1660
1732
  this.body = body;
1661
- this.name = "IdentityErrorError";
1733
+ this.name = "ReadFileFailedError";
1662
1734
  }
1663
- static code = "IDENTITY_ERROR";
1735
+ static code = "READ_FILE_FAILED";
1664
1736
  static statusCode = 500;
1665
- static description = `Failed to manage identity: {message}`;
1737
+ static description = `Failed to read file: {message}`;
1666
1738
  }
1667
- class GetContentFailedError extends Error {
1739
+ class ExecutionFailedError extends Error {
1668
1740
  constructor(body) {
1669
1741
  super(
1670
- `GET_CONTENT_FAILED: ${body.message}`
1742
+ `EXECUTION_FAILED: ${body.message}`
1671
1743
  );
1672
1744
  this.body = body;
1673
- this.name = "GetContentFailedError";
1745
+ this.name = "ExecutionFailedError";
1674
1746
  }
1675
- static code = "GET_CONTENT_FAILED";
1747
+ static code = "EXECUTION_FAILED";
1676
1748
  static statusCode = 500;
1677
- static description = `Failed to get content: {message}`;
1749
+ static description = `Failed to execute command: {message}`;
1678
1750
  }
1679
- class ContentNotFoundError extends Error {
1751
+ class RequestFailedError extends Error {
1680
1752
  constructor(body) {
1681
1753
  super(
1682
- `CONTENT_NOT_FOUND: ${body.message}`
1754
+ `REQUEST_FAILED: ${body.message}`
1683
1755
  );
1684
1756
  this.body = body;
1685
- this.name = "ContentNotFoundError";
1757
+ this.name = "RequestFailedError";
1686
1758
  }
1687
- static code = "CONTENT_NOT_FOUND";
1688
- static statusCode = 404;
1689
- static description = `Content not found: {path}`;
1759
+ static code = "REQUEST_FAILED";
1760
+ static statusCode = 500;
1761
+ static description = `Failed to request dev server: {message}`;
1690
1762
  }
1691
- class DownloadFailedError extends Error {
1763
+ class DevServerFileNotFoundError extends Error {
1692
1764
  constructor(body) {
1693
1765
  super(
1694
- `DOWNLOAD_FAILED: ${body.message}`
1766
+ `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
1695
1767
  );
1696
1768
  this.body = body;
1697
- this.name = "DownloadFailedError";
1769
+ this.name = "DevServerFileNotFoundError";
1698
1770
  }
1699
- static code = "DOWNLOAD_FAILED";
1700
- static statusCode = 500;
1701
- static description = `Failed to download repository: {message}`;
1771
+ static code = "DEV_SERVER_FILE_NOT_FOUND";
1772
+ static statusCode = 404;
1773
+ static description = `Dev server file not found: {path}`;
1702
1774
  }
1703
- class GitServerErrorError extends Error {
1775
+ class DevServerInvalidRequestError extends Error {
1704
1776
  constructor(body) {
1705
1777
  super(
1706
- `GIT_SERVER_ERROR: ${body.message}`
1778
+ `DEV_SERVER_INVALID_REQUEST: ${body.message}`
1707
1779
  );
1708
1780
  this.body = body;
1709
- this.name = "GitServerErrorError";
1781
+ this.name = "DevServerInvalidRequestError";
1710
1782
  }
1711
- static code = "GIT_SERVER_ERROR";
1712
- static statusCode = 500;
1713
- static description = `Git server error: {message}`;
1783
+ static code = "DEV_SERVER_INVALID_REQUEST";
1784
+ static statusCode = 400;
1785
+ static description = `Invalid dev server request: {message}`;
1714
1786
  }
1715
- class ParseResponseErrorError extends Error {
1787
+ class CloudstateInternalErrorError extends Error {
1716
1788
  constructor(body) {
1717
1789
  super(
1718
- `PARSE_RESPONSE_ERROR: ${body.message}`
1790
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
1719
1791
  );
1720
1792
  this.body = body;
1721
- this.name = "ParseResponseErrorError";
1793
+ this.name = "CloudstateInternalErrorError";
1722
1794
  }
1723
- static code = "PARSE_RESPONSE_ERROR";
1795
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
1724
1796
  static statusCode = 500;
1725
- static description = `Failed to parse response from Git server: {message}`;
1797
+ static description = `Internal error: {message}`;
1726
1798
  }
1727
- class RepositoryAccessDeniedError extends Error {
1799
+ class CloudstateDatabaseErrorError extends Error {
1728
1800
  constructor(body) {
1729
1801
  super(
1730
- `REPOSITORY_ACCESS_DENIED: ${body.message}`
1802
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
1731
1803
  );
1732
1804
  this.body = body;
1733
- this.name = "RepositoryAccessDeniedError";
1805
+ this.name = "CloudstateDatabaseErrorError";
1734
1806
  }
1735
- static code = "REPOSITORY_ACCESS_DENIED";
1736
- static statusCode = 403;
1737
- static description = `Repository does not belong to account`;
1807
+ static code = "CLOUDSTATE_DATABASE_ERROR";
1808
+ static statusCode = 500;
1809
+ static description = `Database operation failed: {message}`;
1738
1810
  }
1739
- class GitHubSyncFailedError extends Error {
1811
+ class CloudstateAccessDeniedError extends Error {
1740
1812
  constructor(body) {
1741
1813
  super(
1742
- `GIT_HUB_SYNC_FAILED: ${body.message}`
1814
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
1743
1815
  );
1744
1816
  this.body = body;
1745
- this.name = "GitHubSyncFailedError";
1817
+ this.name = "CloudstateAccessDeniedError";
1746
1818
  }
1747
- static code = "GIT_HUB_SYNC_FAILED";
1748
- static statusCode = 500;
1749
- static description = `Failed to configure GitHub sync: {message}`;
1819
+ static code = "CLOUDSTATE_ACCESS_DENIED";
1820
+ static statusCode = 403;
1821
+ static description = `Access denied to project: {project_id}`;
1750
1822
  }
1751
- class UpdateDefaultBranchFailedError extends Error {
1823
+ class RestoreFailedError extends Error {
1752
1824
  constructor(body) {
1753
1825
  super(
1754
- `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
1826
+ `RESTORE_FAILED: ${body.message}`
1755
1827
  );
1756
1828
  this.body = body;
1757
- this.name = "UpdateDefaultBranchFailedError";
1829
+ this.name = "RestoreFailedError";
1758
1830
  }
1759
- static code = "UPDATE_DEFAULT_BRANCH_FAILED";
1831
+ static code = "RESTORE_FAILED";
1760
1832
  static statusCode = 500;
1761
- static description = `Failed to update default branch: {message}`;
1833
+ static description = `Failed to restore from backup: {message}`;
1762
1834
  }
1763
- class GetRepositoryInfoFailedError extends Error {
1835
+ class CreateBackupFailedError extends Error {
1764
1836
  constructor(body) {
1765
1837
  super(
1766
- `GET_REPOSITORY_INFO_FAILED: ${body.message}`
1838
+ `CREATE_BACKUP_FAILED: ${body.message}`
1767
1839
  );
1768
1840
  this.body = body;
1769
- this.name = "GetRepositoryInfoFailedError";
1841
+ this.name = "CreateBackupFailedError";
1770
1842
  }
1771
- static code = "GET_REPOSITORY_INFO_FAILED";
1843
+ static code = "CREATE_BACKUP_FAILED";
1772
1844
  static statusCode = 500;
1773
- static description = `Failed to get repository info: {message}`;
1845
+ static description = `Failed to create backup: {message}`;
1774
1846
  }
1775
- class ListRepositoriesFailedError extends Error {
1847
+ class BackupFailedError extends Error {
1776
1848
  constructor(body) {
1777
1849
  super(
1778
- `LIST_REPOSITORIES_FAILED: ${body.message}`
1850
+ `BACKUP_FAILED: ${body.message}`
1779
1851
  );
1780
1852
  this.body = body;
1781
- this.name = "ListRepositoriesFailedError";
1853
+ this.name = "BackupFailedError";
1782
1854
  }
1783
- static code = "LIST_REPOSITORIES_FAILED";
1855
+ static code = "BACKUP_FAILED";
1784
1856
  static statusCode = 500;
1785
- static description = `Failed to list repositories: {message}`;
1857
+ static description = `Backup failed: {message}`;
1786
1858
  }
1787
- class DeleteRepositoryFailedError extends Error {
1859
+ class DeploymentFailedError extends Error {
1788
1860
  constructor(body) {
1789
1861
  super(
1790
- `DELETE_REPOSITORY_FAILED: ${body.message}`
1862
+ `DEPLOYMENT_FAILED: ${body.message}`
1791
1863
  );
1792
1864
  this.body = body;
1793
- this.name = "DeleteRepositoryFailedError";
1865
+ this.name = "DeploymentFailedError";
1794
1866
  }
1795
- static code = "DELETE_REPOSITORY_FAILED";
1867
+ static code = "DEPLOYMENT_FAILED";
1796
1868
  static statusCode = 500;
1797
- static description = `Failed to delete repository: {message}`;
1869
+ static description = `Deployment failed: {message}`;
1798
1870
  }
1799
- class CreateRepositoryFailedError extends Error {
1871
+ class InvalidDeploymentRequestError extends Error {
1800
1872
  constructor(body) {
1801
1873
  super(
1802
- `CREATE_REPOSITORY_FAILED: ${body.message}`
1874
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
1803
1875
  );
1804
1876
  this.body = body;
1805
- this.name = "CreateRepositoryFailedError";
1877
+ this.name = "InvalidDeploymentRequestError";
1806
1878
  }
1807
- static code = "CREATE_REPOSITORY_FAILED";
1808
- static statusCode = 500;
1809
- static description = `Failed to create repository: {message}`;
1879
+ static code = "INVALID_DEPLOYMENT_REQUEST";
1880
+ static statusCode = 400;
1881
+ static description = `Invalid deployment request: {message}`;
1810
1882
  }
1811
- class SerializationErrorError extends Error {
1883
+ class ProjectNotFoundError extends Error {
1812
1884
  constructor(body) {
1813
1885
  super(
1814
- `SERIALIZATION_ERROR: ${body.message}`
1886
+ `PROJECT_NOT_FOUND: ${body.message}`
1815
1887
  );
1816
1888
  this.body = body;
1817
- this.name = "SerializationErrorError";
1889
+ this.name = "ProjectNotFoundError";
1818
1890
  }
1819
- static code = "SERIALIZATION_ERROR";
1820
- static statusCode = 400;
1821
- static description = `Failed to serialize request: {message}`;
1891
+ static code = "PROJECT_NOT_FOUND";
1892
+ static statusCode = 404;
1893
+ static description = `Project not found: {project_id}`;
1822
1894
  }
1823
- class GitInvalidRequestError extends Error {
1895
+ class BuildFailedError extends Error {
1824
1896
  constructor(body) {
1825
1897
  super(
1826
- `GIT_INVALID_REQUEST: ${body.message}`
1898
+ `BUILD_FAILED: ${body.message}`
1827
1899
  );
1828
1900
  this.body = body;
1829
- this.name = "GitInvalidRequestError";
1830
- }
1831
- static code = "GIT_INVALID_REQUEST";
1832
- static statusCode = 400;
1833
- static description = `Invalid request: {message}`;
1901
+ this.name = "BuildFailedError";
1902
+ }
1903
+ static code = "BUILD_FAILED";
1904
+ static statusCode = 500;
1905
+ static description = `Build failed on VM {vm_id}`;
1834
1906
  }
1835
- class RepositoryNotFoundError extends Error {
1907
+ class ServerDeploymentFailedError extends Error {
1836
1908
  constructor(body) {
1837
1909
  super(
1838
- `REPOSITORY_NOT_FOUND: ${body.message}`
1910
+ `SERVER_DEPLOYMENT_FAILED: ${body.message}`
1839
1911
  );
1840
1912
  this.body = body;
1841
- this.name = "RepositoryNotFoundError";
1913
+ this.name = "ServerDeploymentFailedError";
1842
1914
  }
1843
- static code = "REPOSITORY_NOT_FOUND";
1844
- static statusCode = 404;
1845
- static description = `Repository not found: {repo_id}`;
1915
+ static code = "SERVER_DEPLOYMENT_FAILED";
1916
+ static statusCode = 502;
1917
+ static description = `Failed to deploy to servers`;
1846
1918
  }
1847
- class ExecuteInternalErrorError extends Error {
1919
+ class LockfileErrorError extends Error {
1848
1920
  constructor(body) {
1849
1921
  super(
1850
- `EXECUTE_INTERNAL_ERROR: ${body.message}`
1922
+ `LOCKFILE_ERROR: ${body.message}`
1851
1923
  );
1852
1924
  this.body = body;
1853
- this.name = "ExecuteInternalErrorError";
1925
+ this.name = "LockfileErrorError";
1854
1926
  }
1855
- static code = "EXECUTE_INTERNAL_ERROR";
1927
+ static code = "LOCKFILE_ERROR";
1856
1928
  static statusCode = 500;
1857
- static description = `Internal error: {message}`;
1929
+ static description = `Failed to generate dependency lockfile: {message}`;
1858
1930
  }
1859
- class ExecuteAccessDeniedError extends Error {
1931
+ class UploadErrorError extends Error {
1860
1932
  constructor(body) {
1861
1933
  super(
1862
- `EXECUTE_ACCESS_DENIED: ${body.message}`
1934
+ `UPLOAD_ERROR: ${body.message}`
1863
1935
  );
1864
1936
  this.body = body;
1865
- this.name = "ExecuteAccessDeniedError";
1937
+ this.name = "UploadErrorError";
1866
1938
  }
1867
- static code = "EXECUTE_ACCESS_DENIED";
1868
- static statusCode = 403;
1869
- static description = `Access denied to execute run`;
1939
+ static code = "UPLOAD_ERROR";
1940
+ static statusCode = 500;
1941
+ static description = `Failed to upload deployment to storage`;
1870
1942
  }
1871
- class ListRunsFailedError extends Error {
1943
+ class DomainMappingErrorError extends Error {
1872
1944
  constructor(body) {
1873
1945
  super(
1874
- `LIST_RUNS_FAILED: ${body.message}`
1946
+ `DOMAIN_MAPPING_ERROR: ${body.message}`
1875
1947
  );
1876
1948
  this.body = body;
1877
- this.name = "ListRunsFailedError";
1949
+ this.name = "DomainMappingErrorError";
1878
1950
  }
1879
- static code = "LIST_RUNS_FAILED";
1951
+ static code = "DOMAIN_MAPPING_ERROR";
1880
1952
  static statusCode = 500;
1881
- static description = `Failed to list execute runs: {message}`;
1953
+ static description = `Failed to configure domain mapping for: {domain}`;
1882
1954
  }
1883
- class ExecutionErrorError extends Error {
1955
+ class CertificateProvisioningErrorError extends Error {
1884
1956
  constructor(body) {
1885
1957
  super(
1886
- `EXECUTION_ERROR: ${body.message}`
1958
+ `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
1887
1959
  );
1888
1960
  this.body = body;
1889
- this.name = "ExecutionErrorError";
1961
+ this.name = "CertificateProvisioningErrorError";
1890
1962
  }
1891
- static code = "EXECUTION_ERROR";
1892
- static statusCode = 500;
1893
- static description = `Script execution error: {message}`;
1963
+ static code = "CERTIFICATE_PROVISIONING_ERROR";
1964
+ static statusCode = 502;
1965
+ static description = `Failed to provision certificate for domain: {domain}`;
1894
1966
  }
1895
- class ConnectionFailedError extends Error {
1967
+ class NoEntrypointFoundError extends Error {
1896
1968
  constructor(body) {
1897
1969
  super(
1898
- `CONNECTION_FAILED: ${body.message}`
1970
+ `NO_ENTRYPOINT_FOUND: ${body.message}`
1899
1971
  );
1900
1972
  this.body = body;
1901
- this.name = "ConnectionFailedError";
1973
+ this.name = "NoEntrypointFoundError";
1902
1974
  }
1903
- static code = "CONNECTION_FAILED";
1904
- static statusCode = 500;
1905
- static description = `Failed to connect to execute server: {message}`;
1975
+ static code = "NO_ENTRYPOINT_FOUND";
1976
+ static statusCode = 400;
1977
+ static description = `No entrypoint found in deployment`;
1906
1978
  }
1907
- class MetadataWriteFailedError extends Error {
1979
+ class EntrypointNotFoundError extends Error {
1908
1980
  constructor(body) {
1909
1981
  super(
1910
- `METADATA_WRITE_FAILED: ${body.message}`
1982
+ `ENTRYPOINT_NOT_FOUND: ${body.message}`
1911
1983
  );
1912
1984
  this.body = body;
1913
- this.name = "MetadataWriteFailedError";
1985
+ this.name = "EntrypointNotFoundError";
1914
1986
  }
1915
- static code = "METADATA_WRITE_FAILED";
1916
- static statusCode = 500;
1917
- static description = `Failed to write metadata file: {message}`;
1987
+ static code = "ENTRYPOINT_NOT_FOUND";
1988
+ static statusCode = 400;
1989
+ static description = `Entrypoint not found: {entrypoint}`;
1918
1990
  }
1919
- class NodeModulesInstallFailedError extends Error {
1991
+ class NoDomainOwnershipError extends Error {
1920
1992
  constructor(body) {
1921
1993
  super(
1922
- `NODE_MODULES_INSTALL_FAILED: ${body.message}`
1994
+ `NO_DOMAIN_OWNERSHIP: ${body.message}`
1923
1995
  );
1924
1996
  this.body = body;
1925
- this.name = "NodeModulesInstallFailedError";
1997
+ this.name = "NoDomainOwnershipError";
1926
1998
  }
1927
- static code = "NODE_MODULES_INSTALL_FAILED";
1928
- static statusCode = 500;
1929
- static description = `Failed to install node modules: {message}`;
1999
+ static code = "NO_DOMAIN_OWNERSHIP";
2000
+ static statusCode = 403;
2001
+ static description = `No domain ownership for: {domain}`;
1930
2002
  }
1931
- class NodeModulesDownloadFailedError extends Error {
2003
+ class InvalidDomainsError extends Error {
1932
2004
  constructor(body) {
1933
2005
  super(
1934
- `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
2006
+ `INVALID_DOMAINS: ${body.message}`
1935
2007
  );
1936
2008
  this.body = body;
1937
- this.name = "NodeModulesDownloadFailedError";
2009
+ this.name = "InvalidDomainsError";
1938
2010
  }
1939
- static code = "NODE_MODULES_DOWNLOAD_FAILED";
1940
- static statusCode = 500;
1941
- static description = `Failed to download node modules: {message}`;
2011
+ static code = "INVALID_DOMAINS";
2012
+ static statusCode = 400;
2013
+ static description = `Invalid domains provided`;
1942
2014
  }
1943
- class LockGenerationFailedError extends Error {
2015
+ class WebDeploymentBadRequestError extends Error {
1944
2016
  constructor(body) {
1945
2017
  super(
1946
- `LOCK_GENERATION_FAILED: ${body.message}`
2018
+ `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
1947
2019
  );
1948
2020
  this.body = body;
1949
- this.name = "LockGenerationFailedError";
2021
+ this.name = "WebDeploymentBadRequestError";
1950
2022
  }
1951
- static code = "LOCK_GENERATION_FAILED";
1952
- static statusCode = 500;
1953
- static description = `Failed to generate lock file: {message}`;
2023
+ static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2024
+ static statusCode = 400;
2025
+ static description = `Bad request: {message}`;
1954
2026
  }
1955
- class WriteScriptFailedError extends Error {
2027
+ class DeploymentNotFoundError extends Error {
1956
2028
  constructor(body) {
1957
2029
  super(
1958
- `WRITE_SCRIPT_FAILED: ${body.message}`
2030
+ `DEPLOYMENT_NOT_FOUND: ${body.message}`
1959
2031
  );
1960
2032
  this.body = body;
1961
- this.name = "WriteScriptFailedError";
2033
+ this.name = "DeploymentNotFoundError";
1962
2034
  }
1963
- static code = "WRITE_SCRIPT_FAILED";
1964
- static statusCode = 500;
1965
- static description = `Failed to write script file: {message}`;
2035
+ static code = "DEPLOYMENT_NOT_FOUND";
2036
+ static statusCode = 404;
2037
+ static description = `Deployment not found`;
1966
2038
  }
1967
- class DirectoryCreationFailedError extends Error {
2039
+ class PermissionAlreadyExistsError extends Error {
1968
2040
  constructor(body) {
1969
2041
  super(
1970
- `DIRECTORY_CREATION_FAILED: ${body.message}`
2042
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
1971
2043
  );
1972
2044
  this.body = body;
1973
- this.name = "DirectoryCreationFailedError";
2045
+ this.name = "PermissionAlreadyExistsError";
1974
2046
  }
1975
- static code = "DIRECTORY_CREATION_FAILED";
1976
- static statusCode = 500;
1977
- static description = `Failed to create script directory: {message}`;
2047
+ static code = "PERMISSION_ALREADY_EXISTS";
2048
+ static statusCode = 409;
2049
+ static description = `Permission already exists`;
1978
2050
  }
1979
- class NetworkPermissionsFailedError extends Error {
2051
+ class ListTokensFailedError extends Error {
1980
2052
  constructor(body) {
1981
2053
  super(
1982
- `NETWORK_PERMISSIONS_FAILED: ${body.message}`
2054
+ `LIST_TOKENS_FAILED: ${body.message}`
1983
2055
  );
1984
2056
  this.body = body;
1985
- this.name = "NetworkPermissionsFailedError";
2057
+ this.name = "ListTokensFailedError";
1986
2058
  }
1987
- static code = "NETWORK_PERMISSIONS_FAILED";
2059
+ static code = "LIST_TOKENS_FAILED";
1988
2060
  static statusCode = 500;
1989
- static description = `Failed to insert network permissions: {message}`;
2061
+ static description = `Failed to list tokens: {message}`;
1990
2062
  }
1991
- class LoggingFailedError extends Error {
2063
+ class RevokeTokenFailedError extends Error {
1992
2064
  constructor(body) {
1993
2065
  super(
1994
- `LOGGING_FAILED: ${body.message}`
2066
+ `REVOKE_TOKEN_FAILED: ${body.message}`
1995
2067
  );
1996
2068
  this.body = body;
1997
- this.name = "LoggingFailedError";
2069
+ this.name = "RevokeTokenFailedError";
1998
2070
  }
1999
- static code = "LOGGING_FAILED";
2071
+ static code = "REVOKE_TOKEN_FAILED";
2000
2072
  static statusCode = 500;
2001
- static description = `Failed to log execute run: {message}`;
2073
+ static description = `Failed to revoke token: {message}`;
2002
2074
  }
2003
- class RunNotFoundError extends Error {
2075
+ class CreateTokenFailedError extends Error {
2004
2076
  constructor(body) {
2005
2077
  super(
2006
- `RUN_NOT_FOUND: ${body.message}`
2078
+ `CREATE_TOKEN_FAILED: ${body.message}`
2007
2079
  );
2008
2080
  this.body = body;
2009
- this.name = "RunNotFoundError";
2081
+ this.name = "CreateTokenFailedError";
2010
2082
  }
2011
- static code = "RUN_NOT_FOUND";
2012
- static statusCode = 404;
2013
- static description = `Execute run not found: {run_id}`;
2083
+ static code = "CREATE_TOKEN_FAILED";
2084
+ static statusCode = 500;
2085
+ static description = `Failed to create token: {message}`;
2014
2086
  }
2015
- class FailedToProvisionCertificateError extends Error {
2087
+ class ListPermissionsFailedError extends Error {
2016
2088
  constructor(body) {
2017
2089
  super(
2018
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2090
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
2019
2091
  );
2020
2092
  this.body = body;
2021
- this.name = "FailedToProvisionCertificateError";
2093
+ this.name = "ListPermissionsFailedError";
2022
2094
  }
2023
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
2024
- static statusCode = 422;
2025
- static description = `Failed to provision certificate: {message}`;
2095
+ static code = "LIST_PERMISSIONS_FAILED";
2096
+ static statusCode = 500;
2097
+ static description = `Failed to list permissions: {message}`;
2026
2098
  }
2027
- class FailedToInsertDomainMappingError extends Error {
2099
+ class GetPermissionFailedError extends Error {
2028
2100
  constructor(body) {
2029
2101
  super(
2030
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2102
+ `GET_PERMISSION_FAILED: ${body.message}`
2031
2103
  );
2032
2104
  this.body = body;
2033
- this.name = "FailedToInsertDomainMappingError";
2105
+ this.name = "GetPermissionFailedError";
2034
2106
  }
2035
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2107
+ static code = "GET_PERMISSION_FAILED";
2036
2108
  static statusCode = 500;
2037
- static description = `Failed to insert domain mapping: {message}`;
2109
+ static description = `Failed to get permission: {message}`;
2038
2110
  }
2039
- class PermissionDeniedError extends Error {
2111
+ class UpdatePermissionFailedError extends Error {
2040
2112
  constructor(body) {
2041
2113
  super(
2042
- `PERMISSION_DENIED: ${body.message}`
2114
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
2043
2115
  );
2044
2116
  this.body = body;
2045
- this.name = "PermissionDeniedError";
2117
+ this.name = "UpdatePermissionFailedError";
2046
2118
  }
2047
- static code = "PERMISSION_DENIED";
2048
- static statusCode = 401;
2049
- static description = `Permission denied: {message}`;
2119
+ static code = "UPDATE_PERMISSION_FAILED";
2120
+ static statusCode = 500;
2121
+ static description = `Failed to update permission: {message}`;
2050
2122
  }
2051
- class FailedToCheckPermissionsError extends Error {
2123
+ class RevokePermissionFailedError extends Error {
2052
2124
  constructor(body) {
2053
2125
  super(
2054
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2126
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
2055
2127
  );
2056
2128
  this.body = body;
2057
- this.name = "FailedToCheckPermissionsError";
2129
+ this.name = "RevokePermissionFailedError";
2058
2130
  }
2059
- static code = "FAILED_TO_CHECK_PERMISSIONS";
2060
- static statusCode = 502;
2061
- static description = `Failed to check permissions: {message}`;
2131
+ static code = "REVOKE_PERMISSION_FAILED";
2132
+ static statusCode = 500;
2133
+ static description = `Failed to revoke permission: {message}`;
2062
2134
  }
2063
- class FailedToListDomainsError extends Error {
2135
+ class GrantPermissionFailedError extends Error {
2064
2136
  constructor(body) {
2065
2137
  super(
2066
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
2138
+ `GRANT_PERMISSION_FAILED: ${body.message}`
2067
2139
  );
2068
2140
  this.body = body;
2069
- this.name = "FailedToListDomainsError";
2141
+ this.name = "GrantPermissionFailedError";
2070
2142
  }
2071
- static code = "FAILED_TO_LIST_DOMAINS";
2143
+ static code = "GRANT_PERMISSION_FAILED";
2072
2144
  static statusCode = 500;
2073
- static description = `Failed to list domains: {message}`;
2145
+ static description = `Failed to grant permission: {message}`;
2074
2146
  }
2075
- class FailedToListVerificationsError extends Error {
2147
+ class ListIdentitiesFailedError extends Error {
2076
2148
  constructor(body) {
2077
2149
  super(
2078
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2150
+ `LIST_IDENTITIES_FAILED: ${body.message}`
2079
2151
  );
2080
2152
  this.body = body;
2081
- this.name = "FailedToListVerificationsError";
2153
+ this.name = "ListIdentitiesFailedError";
2082
2154
  }
2083
- static code = "FAILED_TO_LIST_VERIFICATIONS";
2155
+ static code = "LIST_IDENTITIES_FAILED";
2084
2156
  static statusCode = 500;
2085
- static description = `Failed to list verifications: {message}`;
2157
+ static description = `Failed to list identities: {message}`;
2086
2158
  }
2087
- class FailedToVerifyDomainError extends Error {
2159
+ class DeleteIdentityFailedError extends Error {
2088
2160
  constructor(body) {
2089
2161
  super(
2090
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2162
+ `DELETE_IDENTITY_FAILED: ${body.message}`
2091
2163
  );
2092
2164
  this.body = body;
2093
- this.name = "FailedToVerifyDomainError";
2165
+ this.name = "DeleteIdentityFailedError";
2094
2166
  }
2095
- static code = "FAILED_TO_VERIFY_DOMAIN";
2167
+ static code = "DELETE_IDENTITY_FAILED";
2096
2168
  static statusCode = 500;
2097
- static description = `Failed to verify domain: {message}`;
2169
+ static description = `Failed to delete identity: {message}`;
2098
2170
  }
2099
- class VerificationFailedError extends Error {
2171
+ class CreateIdentityFailedError extends Error {
2100
2172
  constructor(body) {
2101
2173
  super(
2102
- `VERIFICATION_FAILED: ${body.message}`
2174
+ `CREATE_IDENTITY_FAILED: ${body.message}`
2103
2175
  );
2104
2176
  this.body = body;
2105
- this.name = "VerificationFailedError";
2177
+ this.name = "CreateIdentityFailedError";
2106
2178
  }
2107
- static code = "VERIFICATION_FAILED";
2108
- static statusCode = 400;
2109
- static description = `Domain verification failed: {message}`;
2179
+ static code = "CREATE_IDENTITY_FAILED";
2180
+ static statusCode = 500;
2181
+ static description = `Failed to create identity: {message}`;
2110
2182
  }
2111
- class FailedToDeleteVerificationError extends Error {
2183
+ class VmPermissionNotFoundError extends Error {
2112
2184
  constructor(body) {
2113
2185
  super(
2114
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2186
+ `VM_PERMISSION_NOT_FOUND: ${body.message}`
2115
2187
  );
2116
2188
  this.body = body;
2117
- this.name = "FailedToDeleteVerificationError";
2189
+ this.name = "VmPermissionNotFoundError";
2118
2190
  }
2119
- static code = "FAILED_TO_DELETE_VERIFICATION";
2120
- static statusCode = 400;
2121
- static description = `Failed to delete verification: {message}`;
2191
+ static code = "VM_PERMISSION_NOT_FOUND";
2192
+ static statusCode = 404;
2193
+ static description = `VM permission not found`;
2122
2194
  }
2123
- class VerificationNotFoundError extends Error {
2195
+ class PermissionNotFoundError extends Error {
2124
2196
  constructor(body) {
2125
2197
  super(
2126
- `VERIFICATION_NOT_FOUND: ${body.message}`
2198
+ `PERMISSION_NOT_FOUND: ${body.message}`
2127
2199
  );
2128
2200
  this.body = body;
2129
- this.name = "VerificationNotFoundError";
2201
+ this.name = "PermissionNotFoundError";
2130
2202
  }
2131
- static code = "VERIFICATION_NOT_FOUND";
2203
+ static code = "PERMISSION_NOT_FOUND";
2132
2204
  static statusCode = 404;
2133
- static description = `Verification request not found for domain: {domain}`;
2205
+ static description = `Permission not found`;
2134
2206
  }
2135
- class FailedToCreateVerificationCodeError extends Error {
2207
+ class GitRepositoryAccessDeniedError extends Error {
2136
2208
  constructor(body) {
2137
2209
  super(
2138
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2210
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2139
2211
  );
2140
2212
  this.body = body;
2141
- this.name = "FailedToCreateVerificationCodeError";
2213
+ this.name = "GitRepositoryAccessDeniedError";
2142
2214
  }
2143
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2144
- static statusCode = 400;
2145
- static description = `Failed to create verification code: {message}`;
2215
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
2216
+ static statusCode = 403;
2217
+ static description = `You are not allowed to access this repository`;
2146
2218
  }
2147
- class InvalidDomainError extends Error {
2219
+ class GitRepositoryNotFoundError extends Error {
2148
2220
  constructor(body) {
2149
2221
  super(
2150
- `INVALID_DOMAIN: ${body.message}`
2222
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
2151
2223
  );
2152
2224
  this.body = body;
2153
- this.name = "InvalidDomainError";
2225
+ this.name = "GitRepositoryNotFoundError";
2154
2226
  }
2155
- static code = "INVALID_DOMAIN";
2156
- static statusCode = 400;
2157
- static description = `Invalid domain: {domain}`;
2227
+ static code = "GIT_REPOSITORY_NOT_FOUND";
2228
+ static statusCode = 404;
2229
+ static description = `Repository not found`;
2158
2230
  }
2159
- class LimitExceededError extends Error {
2231
+ class CannotDeleteManagedIdentityError extends Error {
2160
2232
  constructor(body) {
2161
2233
  super(
2162
- `LIMIT_EXCEEDED: ${body.message}`
2234
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
2163
2235
  );
2164
2236
  this.body = body;
2165
- this.name = "LimitExceededError";
2237
+ this.name = "CannotDeleteManagedIdentityError";
2166
2238
  }
2167
- static code = "LIMIT_EXCEEDED";
2239
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2168
2240
  static statusCode = 403;
2169
- static description = `Domain limit exceeded: your plan allows {limit} domains, you currently have {current}`;
2241
+ static description = `Cannot delete managed identities`;
2170
2242
  }
2171
- class DomainOwnershipNotVerifiedError extends Error {
2243
+ class CannotModifyManagedIdentityError extends Error {
2172
2244
  constructor(body) {
2173
2245
  super(
2174
- `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
2246
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
2175
2247
  );
2176
2248
  this.body = body;
2177
- this.name = "DomainOwnershipNotVerifiedError";
2249
+ this.name = "CannotModifyManagedIdentityError";
2178
2250
  }
2179
- static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
2180
- static statusCode = 401;
2181
- static description = `You have not verified ownership of domain: {domain}`;
2251
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2252
+ static statusCode = 403;
2253
+ static description = `Cannot modify managed identities`;
2182
2254
  }
2183
- class VmAccessDeniedForMappingError extends Error {
2255
+ class IdentityAccessDeniedError extends Error {
2184
2256
  constructor(body) {
2185
2257
  super(
2186
- `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
2258
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
2187
2259
  );
2188
2260
  this.body = body;
2189
- this.name = "VmAccessDeniedForMappingError";
2261
+ this.name = "IdentityAccessDeniedError";
2190
2262
  }
2191
- static code = "VM_ACCESS_DENIED_FOR_MAPPING";
2192
- static statusCode = 401;
2193
- static description = `You do not have permission to map to this VM: {vm_id}`;
2263
+ static code = "IDENTITY_ACCESS_DENIED";
2264
+ static statusCode = 403;
2265
+ static description = `You are not allowed to access this identity`;
2194
2266
  }
2195
- class DeploymentAccessDeniedError extends Error {
2267
+ class IdentityNotFoundError extends Error {
2196
2268
  constructor(body) {
2197
2269
  super(
2198
- `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
2270
+ `IDENTITY_NOT_FOUND: ${body.message}`
2199
2271
  );
2200
2272
  this.body = body;
2201
- this.name = "DeploymentAccessDeniedError";
2273
+ this.name = "IdentityNotFoundError";
2202
2274
  }
2203
- static code = "DEPLOYMENT_ACCESS_DENIED";
2204
- static statusCode = 401;
2205
- static description = `You do not have permission to map to this deployment: {deployment_id}`;
2275
+ static code = "IDENTITY_NOT_FOUND";
2276
+ static statusCode = 404;
2277
+ static description = `Identity not found`;
2206
2278
  }
2207
- class FailedToProvisionCertificateForMappingError extends Error {
2279
+ class ExecuteInternalErrorError extends Error {
2208
2280
  constructor(body) {
2209
2281
  super(
2210
- `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
2282
+ `EXECUTE_INTERNAL_ERROR: ${body.message}`
2211
2283
  );
2212
2284
  this.body = body;
2213
- this.name = "FailedToProvisionCertificateForMappingError";
2285
+ this.name = "ExecuteInternalErrorError";
2214
2286
  }
2215
- static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
2216
- static statusCode = 422;
2217
- static description = `Failed to provision certificate for mapping: {message}`;
2287
+ static code = "EXECUTE_INTERNAL_ERROR";
2288
+ static statusCode = 500;
2289
+ static description = `Internal error: {message}`;
2218
2290
  }
2219
- class FailedInsertDomainMappingError extends Error {
2291
+ class ExecuteAccessDeniedError extends Error {
2220
2292
  constructor(body) {
2221
2293
  super(
2222
- `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
2294
+ `EXECUTE_ACCESS_DENIED: ${body.message}`
2223
2295
  );
2224
2296
  this.body = body;
2225
- this.name = "FailedInsertDomainMappingError";
2297
+ this.name = "ExecuteAccessDeniedError";
2226
2298
  }
2227
- static code = "FAILED_INSERT_DOMAIN_MAPPING";
2228
- static statusCode = 500;
2229
- static description = `Failed to insert domain mapping: {message}`;
2299
+ static code = "EXECUTE_ACCESS_DENIED";
2300
+ static statusCode = 403;
2301
+ static description = `Access denied to execute run`;
2230
2302
  }
2231
- class DomainAlreadyExistsError extends Error {
2303
+ class ListRunsFailedError extends Error {
2232
2304
  constructor(body) {
2233
2305
  super(
2234
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2306
+ `LIST_RUNS_FAILED: ${body.message}`
2235
2307
  );
2236
2308
  this.body = body;
2237
- this.name = "DomainAlreadyExistsError";
2309
+ this.name = "ListRunsFailedError";
2238
2310
  }
2239
- static code = "DOMAIN_ALREADY_EXISTS";
2240
- static statusCode = 400;
2241
- static description = `Domain already exists: {domain}`;
2311
+ static code = "LIST_RUNS_FAILED";
2312
+ static statusCode = 500;
2313
+ static description = `Failed to list execute runs: {message}`;
2242
2314
  }
2243
- class FailedToInsertOwnershipError extends Error {
2315
+ class ExecutionErrorError extends Error {
2244
2316
  constructor(body) {
2245
2317
  super(
2246
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2318
+ `EXECUTION_ERROR: ${body.message}`
2247
2319
  );
2248
2320
  this.body = body;
2249
- this.name = "FailedToInsertOwnershipError";
2321
+ this.name = "ExecutionErrorError";
2250
2322
  }
2251
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2323
+ static code = "EXECUTION_ERROR";
2252
2324
  static statusCode = 500;
2253
- static description = `Failed to insert domain ownership: {message}`;
2325
+ static description = `Script execution error: {message}`;
2254
2326
  }
2255
- class FailedRemoveDomainMappingError extends Error {
2327
+ class ConnectionFailedError extends Error {
2256
2328
  constructor(body) {
2257
2329
  super(
2258
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2330
+ `CONNECTION_FAILED: ${body.message}`
2259
2331
  );
2260
2332
  this.body = body;
2261
- this.name = "FailedRemoveDomainMappingError";
2333
+ this.name = "ConnectionFailedError";
2262
2334
  }
2263
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2335
+ static code = "CONNECTION_FAILED";
2264
2336
  static statusCode = 500;
2265
- static description = `Failed to remove domain mapping: {message}`;
2337
+ static description = `Failed to connect to execute server: {message}`;
2266
2338
  }
2267
- class FailedPermissionsCheckError extends Error {
2339
+ class MetadataWriteFailedError extends Error {
2268
2340
  constructor(body) {
2269
2341
  super(
2270
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2342
+ `METADATA_WRITE_FAILED: ${body.message}`
2271
2343
  );
2272
2344
  this.body = body;
2273
- this.name = "FailedPermissionsCheckError";
2345
+ this.name = "MetadataWriteFailedError";
2274
2346
  }
2275
- static code = "FAILED_PERMISSIONS_CHECK";
2276
- static statusCode = 401;
2277
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2347
+ static code = "METADATA_WRITE_FAILED";
2348
+ static statusCode = 500;
2349
+ static description = `Failed to write metadata file: {message}`;
2278
2350
  }
2279
- class FailedToCheckDomainMappingPermissionsError extends Error {
2351
+ class NodeModulesInstallFailedError extends Error {
2280
2352
  constructor(body) {
2281
2353
  super(
2282
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2354
+ `NODE_MODULES_INSTALL_FAILED: ${body.message}`
2283
2355
  );
2284
2356
  this.body = body;
2285
- this.name = "FailedToCheckDomainMappingPermissionsError";
2357
+ this.name = "NodeModulesInstallFailedError";
2286
2358
  }
2287
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2288
- static statusCode = 502;
2289
- static description = `Failed to check permissions: {message}`;
2359
+ static code = "NODE_MODULES_INSTALL_FAILED";
2360
+ static statusCode = 500;
2361
+ static description = `Failed to install node modules: {message}`;
2290
2362
  }
2291
- class CloudstateInternalErrorError extends Error {
2363
+ class NodeModulesDownloadFailedError extends Error {
2292
2364
  constructor(body) {
2293
2365
  super(
2294
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2366
+ `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
2295
2367
  );
2296
2368
  this.body = body;
2297
- this.name = "CloudstateInternalErrorError";
2369
+ this.name = "NodeModulesDownloadFailedError";
2298
2370
  }
2299
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2371
+ static code = "NODE_MODULES_DOWNLOAD_FAILED";
2300
2372
  static statusCode = 500;
2301
- static description = `Internal error: {message}`;
2373
+ static description = `Failed to download node modules: {message}`;
2302
2374
  }
2303
- class CloudstateDatabaseErrorError extends Error {
2375
+ class LockGenerationFailedError extends Error {
2304
2376
  constructor(body) {
2305
2377
  super(
2306
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2378
+ `LOCK_GENERATION_FAILED: ${body.message}`
2307
2379
  );
2308
2380
  this.body = body;
2309
- this.name = "CloudstateDatabaseErrorError";
2381
+ this.name = "LockGenerationFailedError";
2310
2382
  }
2311
- static code = "CLOUDSTATE_DATABASE_ERROR";
2383
+ static code = "LOCK_GENERATION_FAILED";
2312
2384
  static statusCode = 500;
2313
- static description = `Database operation failed: {message}`;
2385
+ static description = `Failed to generate lock file: {message}`;
2314
2386
  }
2315
- class CloudstateAccessDeniedError extends Error {
2387
+ class WriteScriptFailedError extends Error {
2316
2388
  constructor(body) {
2317
2389
  super(
2318
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2390
+ `WRITE_SCRIPT_FAILED: ${body.message}`
2319
2391
  );
2320
2392
  this.body = body;
2321
- this.name = "CloudstateAccessDeniedError";
2393
+ this.name = "WriteScriptFailedError";
2322
2394
  }
2323
- static code = "CLOUDSTATE_ACCESS_DENIED";
2324
- static statusCode = 403;
2325
- static description = `Access denied to project: {project_id}`;
2395
+ static code = "WRITE_SCRIPT_FAILED";
2396
+ static statusCode = 500;
2397
+ static description = `Failed to write script file: {message}`;
2326
2398
  }
2327
- class RestoreFailedError extends Error {
2399
+ class DirectoryCreationFailedError extends Error {
2328
2400
  constructor(body) {
2329
2401
  super(
2330
- `RESTORE_FAILED: ${body.message}`
2402
+ `DIRECTORY_CREATION_FAILED: ${body.message}`
2331
2403
  );
2332
2404
  this.body = body;
2333
- this.name = "RestoreFailedError";
2405
+ this.name = "DirectoryCreationFailedError";
2334
2406
  }
2335
- static code = "RESTORE_FAILED";
2407
+ static code = "DIRECTORY_CREATION_FAILED";
2336
2408
  static statusCode = 500;
2337
- static description = `Failed to restore from backup: {message}`;
2409
+ static description = `Failed to create script directory: {message}`;
2338
2410
  }
2339
- class CreateBackupFailedError extends Error {
2411
+ class NetworkPermissionsFailedError extends Error {
2340
2412
  constructor(body) {
2341
2413
  super(
2342
- `CREATE_BACKUP_FAILED: ${body.message}`
2414
+ `NETWORK_PERMISSIONS_FAILED: ${body.message}`
2343
2415
  );
2344
2416
  this.body = body;
2345
- this.name = "CreateBackupFailedError";
2417
+ this.name = "NetworkPermissionsFailedError";
2346
2418
  }
2347
- static code = "CREATE_BACKUP_FAILED";
2419
+ static code = "NETWORK_PERMISSIONS_FAILED";
2348
2420
  static statusCode = 500;
2349
- static description = `Failed to create backup: {message}`;
2421
+ static description = `Failed to insert network permissions: {message}`;
2350
2422
  }
2351
- class BackupFailedError extends Error {
2423
+ class LoggingFailedError extends Error {
2352
2424
  constructor(body) {
2353
2425
  super(
2354
- `BACKUP_FAILED: ${body.message}`
2426
+ `LOGGING_FAILED: ${body.message}`
2355
2427
  );
2356
2428
  this.body = body;
2357
- this.name = "BackupFailedError";
2429
+ this.name = "LoggingFailedError";
2358
2430
  }
2359
- static code = "BACKUP_FAILED";
2431
+ static code = "LOGGING_FAILED";
2360
2432
  static statusCode = 500;
2361
- static description = `Backup failed: {message}`;
2433
+ static description = `Failed to log execute run: {message}`;
2362
2434
  }
2363
- class DeploymentFailedError extends Error {
2435
+ class RunNotFoundError extends Error {
2364
2436
  constructor(body) {
2365
2437
  super(
2366
- `DEPLOYMENT_FAILED: ${body.message}`
2438
+ `RUN_NOT_FOUND: ${body.message}`
2367
2439
  );
2368
2440
  this.body = body;
2369
- this.name = "DeploymentFailedError";
2441
+ this.name = "RunNotFoundError";
2370
2442
  }
2371
- static code = "DEPLOYMENT_FAILED";
2372
- static statusCode = 500;
2373
- static description = `Deployment failed: {message}`;
2443
+ static code = "RUN_NOT_FOUND";
2444
+ static statusCode = 404;
2445
+ static description = `Execute run not found: {run_id}`;
2374
2446
  }
2375
- class InvalidDeploymentRequestError extends Error {
2447
+ class FailedToProvisionCertificateError extends Error {
2376
2448
  constructor(body) {
2377
2449
  super(
2378
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2450
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2379
2451
  );
2380
2452
  this.body = body;
2381
- this.name = "InvalidDeploymentRequestError";
2453
+ this.name = "FailedToProvisionCertificateError";
2382
2454
  }
2383
- static code = "INVALID_DEPLOYMENT_REQUEST";
2384
- static statusCode = 400;
2385
- static description = `Invalid deployment request: {message}`;
2455
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
2456
+ static statusCode = 422;
2457
+ static description = `Failed to provision certificate: {message}`;
2386
2458
  }
2387
- class ProjectNotFoundError extends Error {
2459
+ class FailedToInsertDomainMappingError extends Error {
2388
2460
  constructor(body) {
2389
2461
  super(
2390
- `PROJECT_NOT_FOUND: ${body.message}`
2462
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2391
2463
  );
2392
2464
  this.body = body;
2393
- this.name = "ProjectNotFoundError";
2465
+ this.name = "FailedToInsertDomainMappingError";
2394
2466
  }
2395
- static code = "PROJECT_NOT_FOUND";
2396
- static statusCode = 404;
2397
- static description = `Project not found: {project_id}`;
2467
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2468
+ static statusCode = 500;
2469
+ static description = `Failed to insert domain mapping: {message}`;
2398
2470
  }
2399
- class BuildFailedError extends Error {
2471
+ class PermissionDeniedError extends Error {
2400
2472
  constructor(body) {
2401
2473
  super(
2402
- `BUILD_FAILED: ${body.message}`
2474
+ `PERMISSION_DENIED: ${body.message}`
2403
2475
  );
2404
2476
  this.body = body;
2405
- this.name = "BuildFailedError";
2477
+ this.name = "PermissionDeniedError";
2406
2478
  }
2407
- static code = "BUILD_FAILED";
2408
- static statusCode = 500;
2409
- static description = `Build failed on VM {vm_id}`;
2479
+ static code = "PERMISSION_DENIED";
2480
+ static statusCode = 401;
2481
+ static description = `Permission denied: {message}`;
2410
2482
  }
2411
- class ServerDeploymentFailedError extends Error {
2483
+ class FailedToCheckPermissionsError extends Error {
2412
2484
  constructor(body) {
2413
2485
  super(
2414
- `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2486
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2415
2487
  );
2416
2488
  this.body = body;
2417
- this.name = "ServerDeploymentFailedError";
2489
+ this.name = "FailedToCheckPermissionsError";
2418
2490
  }
2419
- static code = "SERVER_DEPLOYMENT_FAILED";
2491
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
2420
2492
  static statusCode = 502;
2421
- static description = `Failed to deploy to servers`;
2493
+ static description = `Failed to check permissions: {message}`;
2422
2494
  }
2423
- class LockfileErrorError extends Error {
2495
+ class FailedToListDomainsError extends Error {
2424
2496
  constructor(body) {
2425
2497
  super(
2426
- `LOCKFILE_ERROR: ${body.message}`
2498
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
2427
2499
  );
2428
2500
  this.body = body;
2429
- this.name = "LockfileErrorError";
2501
+ this.name = "FailedToListDomainsError";
2430
2502
  }
2431
- static code = "LOCKFILE_ERROR";
2503
+ static code = "FAILED_TO_LIST_DOMAINS";
2432
2504
  static statusCode = 500;
2433
- static description = `Failed to generate dependency lockfile: {message}`;
2505
+ static description = `Failed to list domains: {message}`;
2434
2506
  }
2435
- class UploadErrorError extends Error {
2507
+ class FailedToListVerificationsError extends Error {
2436
2508
  constructor(body) {
2437
2509
  super(
2438
- `UPLOAD_ERROR: ${body.message}`
2510
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2439
2511
  );
2440
2512
  this.body = body;
2441
- this.name = "UploadErrorError";
2513
+ this.name = "FailedToListVerificationsError";
2442
2514
  }
2443
- static code = "UPLOAD_ERROR";
2515
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
2444
2516
  static statusCode = 500;
2445
- static description = `Failed to upload deployment to storage`;
2517
+ static description = `Failed to list verifications: {message}`;
2446
2518
  }
2447
- class DomainMappingErrorError extends Error {
2519
+ class FailedToVerifyDomainError extends Error {
2448
2520
  constructor(body) {
2449
2521
  super(
2450
- `DOMAIN_MAPPING_ERROR: ${body.message}`
2522
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2451
2523
  );
2452
2524
  this.body = body;
2453
- this.name = "DomainMappingErrorError";
2525
+ this.name = "FailedToVerifyDomainError";
2454
2526
  }
2455
- static code = "DOMAIN_MAPPING_ERROR";
2527
+ static code = "FAILED_TO_VERIFY_DOMAIN";
2456
2528
  static statusCode = 500;
2457
- static description = `Failed to configure domain mapping for: {domain}`;
2529
+ static description = `Failed to verify domain: {message}`;
2458
2530
  }
2459
- class CertificateProvisioningErrorError extends Error {
2531
+ class VerificationFailedError extends Error {
2460
2532
  constructor(body) {
2461
2533
  super(
2462
- `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2534
+ `VERIFICATION_FAILED: ${body.message}`
2463
2535
  );
2464
2536
  this.body = body;
2465
- this.name = "CertificateProvisioningErrorError";
2537
+ this.name = "VerificationFailedError";
2466
2538
  }
2467
- static code = "CERTIFICATE_PROVISIONING_ERROR";
2468
- static statusCode = 502;
2469
- static description = `Failed to provision certificate for domain: {domain}`;
2539
+ static code = "VERIFICATION_FAILED";
2540
+ static statusCode = 400;
2541
+ static description = `Domain verification failed: {message}`;
2470
2542
  }
2471
- class NoEntrypointFoundError extends Error {
2543
+ class FailedToDeleteVerificationError extends Error {
2472
2544
  constructor(body) {
2473
2545
  super(
2474
- `NO_ENTRYPOINT_FOUND: ${body.message}`
2546
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2475
2547
  );
2476
2548
  this.body = body;
2477
- this.name = "NoEntrypointFoundError";
2549
+ this.name = "FailedToDeleteVerificationError";
2478
2550
  }
2479
- static code = "NO_ENTRYPOINT_FOUND";
2551
+ static code = "FAILED_TO_DELETE_VERIFICATION";
2480
2552
  static statusCode = 400;
2481
- static description = `No entrypoint found in deployment`;
2553
+ static description = `Failed to delete verification: {message}`;
2482
2554
  }
2483
- class EntrypointNotFoundError extends Error {
2555
+ class VerificationNotFoundError extends Error {
2484
2556
  constructor(body) {
2485
2557
  super(
2486
- `ENTRYPOINT_NOT_FOUND: ${body.message}`
2558
+ `VERIFICATION_NOT_FOUND: ${body.message}`
2487
2559
  );
2488
2560
  this.body = body;
2489
- this.name = "EntrypointNotFoundError";
2561
+ this.name = "VerificationNotFoundError";
2490
2562
  }
2491
- static code = "ENTRYPOINT_NOT_FOUND";
2492
- static statusCode = 400;
2493
- static description = `Entrypoint not found: {entrypoint}`;
2563
+ static code = "VERIFICATION_NOT_FOUND";
2564
+ static statusCode = 404;
2565
+ static description = `Verification request not found for domain: {domain}`;
2494
2566
  }
2495
- class NoDomainOwnershipError extends Error {
2567
+ class FailedToCreateVerificationCodeError extends Error {
2496
2568
  constructor(body) {
2497
2569
  super(
2498
- `NO_DOMAIN_OWNERSHIP: ${body.message}`
2570
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2499
2571
  );
2500
2572
  this.body = body;
2501
- this.name = "NoDomainOwnershipError";
2573
+ this.name = "FailedToCreateVerificationCodeError";
2502
2574
  }
2503
- static code = "NO_DOMAIN_OWNERSHIP";
2504
- static statusCode = 403;
2505
- static description = `No domain ownership for: {domain}`;
2575
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2576
+ static statusCode = 400;
2577
+ static description = `Failed to create verification code: {message}`;
2506
2578
  }
2507
- class InvalidDomainsError extends Error {
2579
+ class InvalidDomainError extends Error {
2508
2580
  constructor(body) {
2509
2581
  super(
2510
- `INVALID_DOMAINS: ${body.message}`
2582
+ `INVALID_DOMAIN: ${body.message}`
2511
2583
  );
2512
2584
  this.body = body;
2513
- this.name = "InvalidDomainsError";
2585
+ this.name = "InvalidDomainError";
2514
2586
  }
2515
- static code = "INVALID_DOMAINS";
2587
+ static code = "INVALID_DOMAIN";
2516
2588
  static statusCode = 400;
2517
- static description = `Invalid domains provided`;
2589
+ static description = `Invalid domain: {domain}`;
2518
2590
  }
2519
- class WebDeploymentBadRequestError extends Error {
2591
+ class DomainOwnershipVerificationFailedError extends Error {
2520
2592
  constructor(body) {
2521
2593
  super(
2522
- `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2594
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2523
2595
  );
2524
2596
  this.body = body;
2525
- this.name = "WebDeploymentBadRequestError";
2597
+ this.name = "DomainOwnershipVerificationFailedError";
2526
2598
  }
2527
- static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2528
- static statusCode = 400;
2529
- static description = `Bad request: {message}`;
2599
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2600
+ static statusCode = 403;
2601
+ static description = `Domain ownership verification failed`;
2530
2602
  }
2531
- class DeploymentNotFoundError extends Error {
2603
+ class ErrorDeletingRecordError extends Error {
2532
2604
  constructor(body) {
2533
2605
  super(
2534
- `DEPLOYMENT_NOT_FOUND: ${body.message}`
2606
+ `ERROR_DELETING_RECORD: ${body.message}`
2535
2607
  );
2536
2608
  this.body = body;
2537
- this.name = "DeploymentNotFoundError";
2609
+ this.name = "ErrorDeletingRecordError";
2538
2610
  }
2539
- static code = "DEPLOYMENT_NOT_FOUND";
2540
- static statusCode = 404;
2541
- static description = `Deployment not found`;
2611
+ static code = "ERROR_DELETING_RECORD";
2612
+ static statusCode = 500;
2613
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2542
2614
  }
2543
- class ObservabilityDatabaseErrorError extends Error {
2615
+ class RecordOwnershipErrorError extends Error {
2544
2616
  constructor(body) {
2545
2617
  super(
2546
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2618
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
2547
2619
  );
2548
2620
  this.body = body;
2549
- this.name = "ObservabilityDatabaseErrorError";
2621
+ this.name = "RecordOwnershipErrorError";
2550
2622
  }
2551
- static code = "OBSERVABILITY_DATABASE_ERROR";
2623
+ static code = "RECORD_OWNERSHIP_ERROR";
2624
+ static statusCode = 403;
2625
+ static description = `Account {account_id} does not own record {record_id}`;
2626
+ }
2627
+ class ErrorCreatingRecordError extends Error {
2628
+ constructor(body) {
2629
+ super(
2630
+ `ERROR_CREATING_RECORD: ${body.message}`
2631
+ );
2632
+ this.body = body;
2633
+ this.name = "ErrorCreatingRecordError";
2634
+ }
2635
+ static code = "ERROR_CREATING_RECORD";
2552
2636
  static statusCode = 500;
2553
- static description = `Database operation failed: {message}`;
2637
+ static description = `Error creating DNS record: {message}`;
2554
2638
  }
2555
- class ObservabilityAccessDeniedError extends Error {
2639
+ class DomainOwnershipErrorError extends Error {
2556
2640
  constructor(body) {
2557
2641
  super(
2558
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2642
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2559
2643
  );
2560
2644
  this.body = body;
2561
- this.name = "ObservabilityAccessDeniedError";
2645
+ this.name = "DomainOwnershipErrorError";
2562
2646
  }
2563
- static code = "OBSERVABILITY_ACCESS_DENIED";
2647
+ static code = "DOMAIN_OWNERSHIP_ERROR";
2564
2648
  static statusCode = 403;
2565
- static description = `Access denied to logs for deployment: {deployment_id}`;
2649
+ static description = `Account {account_id} does not own domain {domain}`;
2566
2650
  }
2567
- class ParseLogsFailedError extends Error {
2651
+ class UnauthorizedErrorError extends Error {
2568
2652
  constructor(body) {
2569
2653
  super(
2570
- `PARSE_LOGS_FAILED: ${body.message}`
2654
+ `UNAUTHORIZED_ERROR: ${body.message}`
2571
2655
  );
2572
2656
  this.body = body;
2573
- this.name = "ParseLogsFailedError";
2657
+ this.name = "UnauthorizedErrorError";
2574
2658
  }
2575
- static code = "PARSE_LOGS_FAILED";
2576
- static statusCode = 500;
2577
- static description = `Failed to parse logs: {message}`;
2659
+ static code = "UNAUTHORIZED_ERROR";
2660
+ static statusCode = 401;
2661
+ static description = `Unauthorized request to {route}`;
2578
2662
  }
2579
- class RetrieveLogsFailedError extends Error {
2663
+ class ExecuteLimitExceededError extends Error {
2580
2664
  constructor(body) {
2581
2665
  super(
2582
- `RETRIEVE_LOGS_FAILED: ${body.message}`
2666
+ `EXECUTE_LIMIT_EXCEEDED: ${body.message}`
2583
2667
  );
2584
2668
  this.body = body;
2585
- this.name = "RetrieveLogsFailedError";
2669
+ this.name = "ExecuteLimitExceededError";
2586
2670
  }
2587
- static code = "RETRIEVE_LOGS_FAILED";
2588
- static statusCode = 500;
2589
- static description = `Failed to retrieve logs: {message}`;
2671
+ static code = "EXECUTE_LIMIT_EXCEEDED";
2672
+ static statusCode = 403;
2673
+ static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
2590
2674
  }
2591
- class InvalidQueryError extends Error {
2675
+ class VmLimitExceededError extends Error {
2592
2676
  constructor(body) {
2593
2677
  super(
2594
- `INVALID_QUERY: ${body.message}`
2678
+ `VM_LIMIT_EXCEEDED: ${body.message}`
2595
2679
  );
2596
2680
  this.body = body;
2597
- this.name = "InvalidQueryError";
2681
+ this.name = "VmLimitExceededError";
2598
2682
  }
2599
- static code = "INVALID_QUERY";
2600
- static statusCode = 400;
2601
- static description = `Invalid log query: {message}`;
2683
+ static code = "VM_LIMIT_EXCEEDED";
2684
+ static statusCode = 403;
2685
+ static description = `VM limit exceeded: your plan allows {limit} VMs, you currently have {current}`;
2602
2686
  }
2603
- class LogsNotFoundError extends Error {
2687
+ class ScheduleNotFoundError extends Error {
2604
2688
  constructor(body) {
2605
2689
  super(
2606
- `LOGS_NOT_FOUND: ${body.message}`
2690
+ `SCHEDULE_NOT_FOUND: ${body.message}`
2607
2691
  );
2608
2692
  this.body = body;
2609
- this.name = "LogsNotFoundError";
2693
+ this.name = "ScheduleNotFoundError";
2610
2694
  }
2611
- static code = "LOGS_NOT_FOUND";
2695
+ static code = "SCHEDULE_NOT_FOUND";
2612
2696
  static statusCode = 404;
2613
- static description = `Logs not found for deployment: {deployment_id}`;
2697
+ static description = `Schedule not found`;
2614
2698
  }
2615
- class BrowserOperationFailedError extends Error {
2699
+ class ServiceUnavailableError extends Error {
2616
2700
  constructor(body) {
2617
2701
  super(
2618
- `BROWSER_OPERATION_FAILED: ${body.message}`
2702
+ `SERVICE_UNAVAILABLE: ${body.message}`
2619
2703
  );
2620
2704
  this.body = body;
2621
- this.name = "BrowserOperationFailedError";
2705
+ this.name = "ServiceUnavailableError";
2622
2706
  }
2623
- static code = "BROWSER_OPERATION_FAILED";
2624
- static statusCode = 500;
2625
- static description = `Browser operation failed: {message}`;
2707
+ static code = "SERVICE_UNAVAILABLE";
2708
+ static statusCode = 503;
2709
+ static description = `Cron service not configured`;
2626
2710
  }
2627
- class WatchFilesFailedError extends Error {
2711
+ class ResizeFailedError extends Error {
2628
2712
  constructor(body) {
2629
2713
  super(
2630
- `WATCH_FILES_FAILED: ${body.message}`
2714
+ `RESIZE_FAILED: ${body.message}`
2631
2715
  );
2632
2716
  this.body = body;
2633
- this.name = "WatchFilesFailedError";
2717
+ this.name = "ResizeFailedError";
2634
2718
  }
2635
- static code = "WATCH_FILES_FAILED";
2719
+ static code = "RESIZE_FAILED";
2636
2720
  static statusCode = 500;
2637
- static description = `Failed to watch files: {message}`;
2721
+ static description = `Failed to resize VM: {message}`;
2638
2722
  }
2639
- class LogsFailedError extends Error {
2723
+ class InternalResizeVmNotFoundError extends Error {
2640
2724
  constructor(body) {
2641
2725
  super(
2642
- `LOGS_FAILED: ${body.message}`
2726
+ `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
2643
2727
  );
2644
2728
  this.body = body;
2645
- this.name = "LogsFailedError";
2729
+ this.name = "InternalResizeVmNotFoundError";
2646
2730
  }
2647
- static code = "LOGS_FAILED";
2648
- static statusCode = 500;
2649
- static description = `Failed to get logs: {message}`;
2731
+ static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
2732
+ static statusCode = 404;
2733
+ static description = `VM not found`;
2650
2734
  }
2651
- class StatusFailedError extends Error {
2735
+ class ObservabilityDatabaseErrorError extends Error {
2652
2736
  constructor(body) {
2653
2737
  super(
2654
- `STATUS_FAILED: ${body.message}`
2738
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2655
2739
  );
2656
2740
  this.body = body;
2657
- this.name = "StatusFailedError";
2741
+ this.name = "ObservabilityDatabaseErrorError";
2658
2742
  }
2659
- static code = "STATUS_FAILED";
2743
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2660
2744
  static statusCode = 500;
2661
- static description = `Failed to get dev server status: {message}`;
2745
+ static description = `Database operation failed: {message}`;
2662
2746
  }
2663
- class RestartFailedError extends Error {
2747
+ class ObservabilityAccessDeniedError extends Error {
2664
2748
  constructor(body) {
2665
2749
  super(
2666
- `RESTART_FAILED: ${body.message}`
2750
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2667
2751
  );
2668
2752
  this.body = body;
2669
- this.name = "RestartFailedError";
2753
+ this.name = "ObservabilityAccessDeniedError";
2670
2754
  }
2671
- static code = "RESTART_FAILED";
2672
- static statusCode = 500;
2673
- static description = `Failed to restart dev server: {message}`;
2755
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2756
+ static statusCode = 403;
2757
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2674
2758
  }
2675
- class ShutdownFailedError extends Error {
2759
+ class ParseLogsFailedError extends Error {
2676
2760
  constructor(body) {
2677
2761
  super(
2678
- `SHUTDOWN_FAILED: ${body.message}`
2762
+ `PARSE_LOGS_FAILED: ${body.message}`
2679
2763
  );
2680
2764
  this.body = body;
2681
- this.name = "ShutdownFailedError";
2765
+ this.name = "ParseLogsFailedError";
2682
2766
  }
2683
- static code = "SHUTDOWN_FAILED";
2767
+ static code = "PARSE_LOGS_FAILED";
2684
2768
  static statusCode = 500;
2685
- static description = `Failed to shutdown dev server: {message}`;
2769
+ static description = `Failed to parse logs: {message}`;
2686
2770
  }
2687
- class CommitFailedError extends Error {
2771
+ class RetrieveLogsFailedError extends Error {
2688
2772
  constructor(body) {
2689
2773
  super(
2690
- `COMMIT_FAILED: ${body.message}`
2774
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2691
2775
  );
2692
2776
  this.body = body;
2693
- this.name = "CommitFailedError";
2777
+ this.name = "RetrieveLogsFailedError";
2694
2778
  }
2695
- static code = "COMMIT_FAILED";
2779
+ static code = "RETRIEVE_LOGS_FAILED";
2696
2780
  static statusCode = 500;
2697
- static description = `Failed to commit changes: {message}`;
2781
+ static description = `Failed to retrieve logs: {message}`;
2698
2782
  }
2699
- class WriteFileFailedError extends Error {
2783
+ class InvalidQueryError extends Error {
2700
2784
  constructor(body) {
2701
2785
  super(
2702
- `WRITE_FILE_FAILED: ${body.message}`
2786
+ `INVALID_QUERY: ${body.message}`
2703
2787
  );
2704
2788
  this.body = body;
2705
- this.name = "WriteFileFailedError";
2789
+ this.name = "InvalidQueryError";
2706
2790
  }
2707
- static code = "WRITE_FILE_FAILED";
2708
- static statusCode = 500;
2709
- static description = `Failed to write file: {message}`;
2791
+ static code = "INVALID_QUERY";
2792
+ static statusCode = 400;
2793
+ static description = `Invalid log query: {message}`;
2710
2794
  }
2711
- class ReadFileFailedError extends Error {
2795
+ class LogsNotFoundError extends Error {
2712
2796
  constructor(body) {
2713
2797
  super(
2714
- `READ_FILE_FAILED: ${body.message}`
2798
+ `LOGS_NOT_FOUND: ${body.message}`
2715
2799
  );
2716
2800
  this.body = body;
2717
- this.name = "ReadFileFailedError";
2801
+ this.name = "LogsNotFoundError";
2718
2802
  }
2719
- static code = "READ_FILE_FAILED";
2720
- static statusCode = 500;
2721
- static description = `Failed to read file: {message}`;
2803
+ static code = "LOGS_NOT_FOUND";
2804
+ static statusCode = 404;
2805
+ static description = `Logs not found for deployment: {deployment_id}`;
2722
2806
  }
2723
- class ExecutionFailedError extends Error {
2807
+ class TriggerErrorError extends Error {
2724
2808
  constructor(body) {
2725
2809
  super(
2726
- `EXECUTION_FAILED: ${body.message}`
2810
+ `TRIGGER_ERROR: ${body.message}`
2727
2811
  );
2728
2812
  this.body = body;
2729
- this.name = "ExecutionFailedError";
2813
+ this.name = "TriggerErrorError";
2730
2814
  }
2731
- static code = "EXECUTION_FAILED";
2815
+ static code = "TRIGGER_ERROR";
2732
2816
  static statusCode = 500;
2733
- static description = `Failed to execute command: {message}`;
2817
+ static description = `Failed to manage triggers: {message}`;
2734
2818
  }
2735
- class RequestFailedError extends Error {
2819
+ class TokenErrorError extends Error {
2736
2820
  constructor(body) {
2737
2821
  super(
2738
- `REQUEST_FAILED: ${body.message}`
2822
+ `TOKEN_ERROR: ${body.message}`
2739
2823
  );
2740
2824
  this.body = body;
2741
- this.name = "RequestFailedError";
2825
+ this.name = "TokenErrorError";
2742
2826
  }
2743
- static code = "REQUEST_FAILED";
2827
+ static code = "TOKEN_ERROR";
2744
2828
  static statusCode = 500;
2745
- static description = `Failed to request dev server: {message}`;
2829
+ static description = `Failed to manage tokens: {message}`;
2746
2830
  }
2747
- class DevServerFileNotFoundError extends Error {
2831
+ class PermissionErrorError extends Error {
2748
2832
  constructor(body) {
2749
2833
  super(
2750
- `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
2834
+ `PERMISSION_ERROR: ${body.message}`
2751
2835
  );
2752
2836
  this.body = body;
2753
- this.name = "DevServerFileNotFoundError";
2837
+ this.name = "PermissionErrorError";
2754
2838
  }
2755
- static code = "DEV_SERVER_FILE_NOT_FOUND";
2756
- static statusCode = 404;
2757
- static description = `Dev server file not found: {path}`;
2839
+ static code = "PERMISSION_ERROR";
2840
+ static statusCode = 500;
2841
+ static description = `Failed to manage permissions: {message}`;
2758
2842
  }
2759
- class DevServerInvalidRequestError extends Error {
2843
+ class IdentityErrorError extends Error {
2760
2844
  constructor(body) {
2761
2845
  super(
2762
- `DEV_SERVER_INVALID_REQUEST: ${body.message}`
2846
+ `IDENTITY_ERROR: ${body.message}`
2763
2847
  );
2764
2848
  this.body = body;
2765
- this.name = "DevServerInvalidRequestError";
2849
+ this.name = "IdentityErrorError";
2766
2850
  }
2767
- static code = "DEV_SERVER_INVALID_REQUEST";
2768
- static statusCode = 400;
2769
- static description = `Invalid dev server request: {message}`;
2851
+ static code = "IDENTITY_ERROR";
2852
+ static statusCode = 500;
2853
+ static description = `Failed to manage identity: {message}`;
2770
2854
  }
2771
- class ResizeFailedError extends Error {
2855
+ class GetContentFailedError extends Error {
2772
2856
  constructor(body) {
2773
2857
  super(
2774
- `RESIZE_FAILED: ${body.message}`
2858
+ `GET_CONTENT_FAILED: ${body.message}`
2775
2859
  );
2776
2860
  this.body = body;
2777
- this.name = "ResizeFailedError";
2861
+ this.name = "GetContentFailedError";
2778
2862
  }
2779
- static code = "RESIZE_FAILED";
2863
+ static code = "GET_CONTENT_FAILED";
2780
2864
  static statusCode = 500;
2781
- static description = `Failed to resize VM: {message}`;
2865
+ static description = `Failed to get content: {message}`;
2782
2866
  }
2783
- class InternalResizeVmNotFoundError extends Error {
2867
+ class ContentNotFoundError extends Error {
2784
2868
  constructor(body) {
2785
2869
  super(
2786
- `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
2870
+ `CONTENT_NOT_FOUND: ${body.message}`
2787
2871
  );
2788
2872
  this.body = body;
2789
- this.name = "InternalResizeVmNotFoundError";
2873
+ this.name = "ContentNotFoundError";
2790
2874
  }
2791
- static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
2875
+ static code = "CONTENT_NOT_FOUND";
2792
2876
  static statusCode = 404;
2793
- static description = `VM not found`;
2877
+ static description = `Content not found: {path}`;
2794
2878
  }
2795
- class PermissionAlreadyExistsError extends Error {
2879
+ class DownloadFailedError extends Error {
2796
2880
  constructor(body) {
2797
2881
  super(
2798
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
2882
+ `DOWNLOAD_FAILED: ${body.message}`
2799
2883
  );
2800
2884
  this.body = body;
2801
- this.name = "PermissionAlreadyExistsError";
2885
+ this.name = "DownloadFailedError";
2802
2886
  }
2803
- static code = "PERMISSION_ALREADY_EXISTS";
2804
- static statusCode = 409;
2805
- static description = `Permission already exists`;
2887
+ static code = "DOWNLOAD_FAILED";
2888
+ static statusCode = 500;
2889
+ static description = `Failed to download repository: {message}`;
2806
2890
  }
2807
- class ListTokensFailedError extends Error {
2891
+ class GitServerErrorError extends Error {
2808
2892
  constructor(body) {
2809
2893
  super(
2810
- `LIST_TOKENS_FAILED: ${body.message}`
2894
+ `GIT_SERVER_ERROR: ${body.message}`
2811
2895
  );
2812
2896
  this.body = body;
2813
- this.name = "ListTokensFailedError";
2897
+ this.name = "GitServerErrorError";
2814
2898
  }
2815
- static code = "LIST_TOKENS_FAILED";
2899
+ static code = "GIT_SERVER_ERROR";
2816
2900
  static statusCode = 500;
2817
- static description = `Failed to list tokens: {message}`;
2901
+ static description = `Git server error: {message}`;
2818
2902
  }
2819
- class RevokeTokenFailedError extends Error {
2903
+ class ParseResponseErrorError extends Error {
2820
2904
  constructor(body) {
2821
2905
  super(
2822
- `REVOKE_TOKEN_FAILED: ${body.message}`
2906
+ `PARSE_RESPONSE_ERROR: ${body.message}`
2823
2907
  );
2824
2908
  this.body = body;
2825
- this.name = "RevokeTokenFailedError";
2909
+ this.name = "ParseResponseErrorError";
2826
2910
  }
2827
- static code = "REVOKE_TOKEN_FAILED";
2911
+ static code = "PARSE_RESPONSE_ERROR";
2828
2912
  static statusCode = 500;
2829
- static description = `Failed to revoke token: {message}`;
2913
+ static description = `Failed to parse response from Git server: {message}`;
2830
2914
  }
2831
- class CreateTokenFailedError extends Error {
2915
+ class RepositoryAccessDeniedError extends Error {
2832
2916
  constructor(body) {
2833
2917
  super(
2834
- `CREATE_TOKEN_FAILED: ${body.message}`
2918
+ `REPOSITORY_ACCESS_DENIED: ${body.message}`
2835
2919
  );
2836
2920
  this.body = body;
2837
- this.name = "CreateTokenFailedError";
2921
+ this.name = "RepositoryAccessDeniedError";
2838
2922
  }
2839
- static code = "CREATE_TOKEN_FAILED";
2840
- static statusCode = 500;
2841
- static description = `Failed to create token: {message}`;
2923
+ static code = "REPOSITORY_ACCESS_DENIED";
2924
+ static statusCode = 403;
2925
+ static description = `Repository does not belong to account`;
2842
2926
  }
2843
- class ListPermissionsFailedError extends Error {
2927
+ class GitHubSyncFailedError extends Error {
2844
2928
  constructor(body) {
2845
2929
  super(
2846
- `LIST_PERMISSIONS_FAILED: ${body.message}`
2930
+ `GIT_HUB_SYNC_FAILED: ${body.message}`
2847
2931
  );
2848
2932
  this.body = body;
2849
- this.name = "ListPermissionsFailedError";
2933
+ this.name = "GitHubSyncFailedError";
2850
2934
  }
2851
- static code = "LIST_PERMISSIONS_FAILED";
2935
+ static code = "GIT_HUB_SYNC_FAILED";
2852
2936
  static statusCode = 500;
2853
- static description = `Failed to list permissions: {message}`;
2937
+ static description = `Failed to configure GitHub sync: {message}`;
2854
2938
  }
2855
- class GetPermissionFailedError extends Error {
2939
+ class UpdateDefaultBranchFailedError extends Error {
2856
2940
  constructor(body) {
2857
2941
  super(
2858
- `GET_PERMISSION_FAILED: ${body.message}`
2942
+ `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2859
2943
  );
2860
2944
  this.body = body;
2861
- this.name = "GetPermissionFailedError";
2945
+ this.name = "UpdateDefaultBranchFailedError";
2862
2946
  }
2863
- static code = "GET_PERMISSION_FAILED";
2947
+ static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2864
2948
  static statusCode = 500;
2865
- static description = `Failed to get permission: {message}`;
2949
+ static description = `Failed to update default branch: {message}`;
2866
2950
  }
2867
- class UpdatePermissionFailedError extends Error {
2951
+ class GetRepositoryInfoFailedError extends Error {
2868
2952
  constructor(body) {
2869
2953
  super(
2870
- `UPDATE_PERMISSION_FAILED: ${body.message}`
2954
+ `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2871
2955
  );
2872
2956
  this.body = body;
2873
- this.name = "UpdatePermissionFailedError";
2957
+ this.name = "GetRepositoryInfoFailedError";
2874
2958
  }
2875
- static code = "UPDATE_PERMISSION_FAILED";
2959
+ static code = "GET_REPOSITORY_INFO_FAILED";
2876
2960
  static statusCode = 500;
2877
- static description = `Failed to update permission: {message}`;
2961
+ static description = `Failed to get repository info: {message}`;
2878
2962
  }
2879
- class RevokePermissionFailedError extends Error {
2963
+ class ListRepositoriesFailedError extends Error {
2880
2964
  constructor(body) {
2881
2965
  super(
2882
- `REVOKE_PERMISSION_FAILED: ${body.message}`
2966
+ `LIST_REPOSITORIES_FAILED: ${body.message}`
2883
2967
  );
2884
2968
  this.body = body;
2885
- this.name = "RevokePermissionFailedError";
2969
+ this.name = "ListRepositoriesFailedError";
2886
2970
  }
2887
- static code = "REVOKE_PERMISSION_FAILED";
2971
+ static code = "LIST_REPOSITORIES_FAILED";
2888
2972
  static statusCode = 500;
2889
- static description = `Failed to revoke permission: {message}`;
2973
+ static description = `Failed to list repositories: {message}`;
2890
2974
  }
2891
- class GrantPermissionFailedError extends Error {
2975
+ class DeleteRepositoryFailedError extends Error {
2892
2976
  constructor(body) {
2893
2977
  super(
2894
- `GRANT_PERMISSION_FAILED: ${body.message}`
2978
+ `DELETE_REPOSITORY_FAILED: ${body.message}`
2895
2979
  );
2896
2980
  this.body = body;
2897
- this.name = "GrantPermissionFailedError";
2981
+ this.name = "DeleteRepositoryFailedError";
2898
2982
  }
2899
- static code = "GRANT_PERMISSION_FAILED";
2983
+ static code = "DELETE_REPOSITORY_FAILED";
2900
2984
  static statusCode = 500;
2901
- static description = `Failed to grant permission: {message}`;
2985
+ static description = `Failed to delete repository: {message}`;
2902
2986
  }
2903
- class ListIdentitiesFailedError extends Error {
2987
+ class CreateRepositoryFailedError extends Error {
2904
2988
  constructor(body) {
2905
2989
  super(
2906
- `LIST_IDENTITIES_FAILED: ${body.message}`
2990
+ `CREATE_REPOSITORY_FAILED: ${body.message}`
2907
2991
  );
2908
2992
  this.body = body;
2909
- this.name = "ListIdentitiesFailedError";
2993
+ this.name = "CreateRepositoryFailedError";
2910
2994
  }
2911
- static code = "LIST_IDENTITIES_FAILED";
2995
+ static code = "CREATE_REPOSITORY_FAILED";
2912
2996
  static statusCode = 500;
2913
- static description = `Failed to list identities: {message}`;
2997
+ static description = `Failed to create repository: {message}`;
2914
2998
  }
2915
- class DeleteIdentityFailedError extends Error {
2999
+ class SerializationErrorError extends Error {
2916
3000
  constructor(body) {
2917
3001
  super(
2918
- `DELETE_IDENTITY_FAILED: ${body.message}`
3002
+ `SERIALIZATION_ERROR: ${body.message}`
2919
3003
  );
2920
3004
  this.body = body;
2921
- this.name = "DeleteIdentityFailedError";
3005
+ this.name = "SerializationErrorError";
2922
3006
  }
2923
- static code = "DELETE_IDENTITY_FAILED";
2924
- static statusCode = 500;
2925
- static description = `Failed to delete identity: {message}`;
3007
+ static code = "SERIALIZATION_ERROR";
3008
+ static statusCode = 400;
3009
+ static description = `Failed to serialize request: {message}`;
2926
3010
  }
2927
- class CreateIdentityFailedError extends Error {
3011
+ class GitInvalidRequestError extends Error {
2928
3012
  constructor(body) {
2929
3013
  super(
2930
- `CREATE_IDENTITY_FAILED: ${body.message}`
3014
+ `GIT_INVALID_REQUEST: ${body.message}`
2931
3015
  );
2932
3016
  this.body = body;
2933
- this.name = "CreateIdentityFailedError";
3017
+ this.name = "GitInvalidRequestError";
2934
3018
  }
2935
- static code = "CREATE_IDENTITY_FAILED";
2936
- static statusCode = 500;
2937
- static description = `Failed to create identity: {message}`;
3019
+ static code = "GIT_INVALID_REQUEST";
3020
+ static statusCode = 400;
3021
+ static description = `Invalid request: {message}`;
2938
3022
  }
2939
- class VmPermissionNotFoundError extends Error {
3023
+ class RepositoryNotFoundError extends Error {
2940
3024
  constructor(body) {
2941
3025
  super(
2942
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
3026
+ `REPOSITORY_NOT_FOUND: ${body.message}`
2943
3027
  );
2944
3028
  this.body = body;
2945
- this.name = "VmPermissionNotFoundError";
3029
+ this.name = "RepositoryNotFoundError";
2946
3030
  }
2947
- static code = "VM_PERMISSION_NOT_FOUND";
3031
+ static code = "REPOSITORY_NOT_FOUND";
2948
3032
  static statusCode = 404;
2949
- static description = `VM permission not found`;
3033
+ static description = `Repository not found: {repo_id}`;
2950
3034
  }
2951
- class PermissionNotFoundError extends Error {
3035
+ class LimitExceededError extends Error {
2952
3036
  constructor(body) {
2953
3037
  super(
2954
- `PERMISSION_NOT_FOUND: ${body.message}`
3038
+ `LIMIT_EXCEEDED: ${body.message}`
2955
3039
  );
2956
3040
  this.body = body;
2957
- this.name = "PermissionNotFoundError";
3041
+ this.name = "LimitExceededError";
2958
3042
  }
2959
- static code = "PERMISSION_NOT_FOUND";
2960
- static statusCode = 404;
2961
- static description = `Permission not found`;
3043
+ static code = "LIMIT_EXCEEDED";
3044
+ static statusCode = 403;
3045
+ static description = `Domain limit exceeded: your plan allows {limit} domains, you currently have {current}`;
2962
3046
  }
2963
- class GitRepositoryAccessDeniedError extends Error {
3047
+ class DomainOwnershipNotVerifiedError extends Error {
2964
3048
  constructor(body) {
2965
3049
  super(
2966
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
3050
+ `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
2967
3051
  );
2968
3052
  this.body = body;
2969
- this.name = "GitRepositoryAccessDeniedError";
3053
+ this.name = "DomainOwnershipNotVerifiedError";
2970
3054
  }
2971
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
2972
- static statusCode = 403;
2973
- static description = `You are not allowed to access this repository`;
3055
+ static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
3056
+ static statusCode = 401;
3057
+ static description = `You have not verified ownership of domain: {domain}`;
2974
3058
  }
2975
- class GitRepositoryNotFoundError extends Error {
3059
+ class VmAccessDeniedForMappingError extends Error {
2976
3060
  constructor(body) {
2977
3061
  super(
2978
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
3062
+ `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
2979
3063
  );
2980
3064
  this.body = body;
2981
- this.name = "GitRepositoryNotFoundError";
3065
+ this.name = "VmAccessDeniedForMappingError";
2982
3066
  }
2983
- static code = "GIT_REPOSITORY_NOT_FOUND";
2984
- static statusCode = 404;
2985
- static description = `Repository not found`;
3067
+ static code = "VM_ACCESS_DENIED_FOR_MAPPING";
3068
+ static statusCode = 401;
3069
+ static description = `You do not have permission to map to this VM: {vm_id}`;
2986
3070
  }
2987
- class CannotDeleteManagedIdentityError extends Error {
3071
+ class DeploymentAccessDeniedError extends Error {
2988
3072
  constructor(body) {
2989
3073
  super(
2990
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
3074
+ `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
2991
3075
  );
2992
3076
  this.body = body;
2993
- this.name = "CannotDeleteManagedIdentityError";
3077
+ this.name = "DeploymentAccessDeniedError";
2994
3078
  }
2995
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2996
- static statusCode = 403;
2997
- static description = `Cannot delete managed identities`;
3079
+ static code = "DEPLOYMENT_ACCESS_DENIED";
3080
+ static statusCode = 401;
3081
+ static description = `You do not have permission to map to this deployment: {deployment_id}`;
2998
3082
  }
2999
- class CannotModifyManagedIdentityError extends Error {
3083
+ class FailedToProvisionCertificateForMappingError extends Error {
3000
3084
  constructor(body) {
3001
3085
  super(
3002
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
3086
+ `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
3003
3087
  );
3004
3088
  this.body = body;
3005
- this.name = "CannotModifyManagedIdentityError";
3089
+ this.name = "FailedToProvisionCertificateForMappingError";
3006
3090
  }
3007
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
3008
- static statusCode = 403;
3009
- static description = `Cannot modify managed identities`;
3091
+ static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
3092
+ static statusCode = 422;
3093
+ static description = `Failed to provision certificate for mapping: {message}`;
3010
3094
  }
3011
- class IdentityAccessDeniedError extends Error {
3095
+ class FailedInsertDomainMappingError extends Error {
3012
3096
  constructor(body) {
3013
3097
  super(
3014
- `IDENTITY_ACCESS_DENIED: ${body.message}`
3098
+ `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
3015
3099
  );
3016
3100
  this.body = body;
3017
- this.name = "IdentityAccessDeniedError";
3101
+ this.name = "FailedInsertDomainMappingError";
3018
3102
  }
3019
- static code = "IDENTITY_ACCESS_DENIED";
3020
- static statusCode = 403;
3021
- static description = `You are not allowed to access this identity`;
3103
+ static code = "FAILED_INSERT_DOMAIN_MAPPING";
3104
+ static statusCode = 500;
3105
+ static description = `Failed to insert domain mapping: {message}`;
3022
3106
  }
3023
- class IdentityNotFoundError extends Error {
3107
+ class DomainAlreadyExistsError extends Error {
3024
3108
  constructor(body) {
3025
3109
  super(
3026
- `IDENTITY_NOT_FOUND: ${body.message}`
3110
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
3027
3111
  );
3028
3112
  this.body = body;
3029
- this.name = "IdentityNotFoundError";
3113
+ this.name = "DomainAlreadyExistsError";
3030
3114
  }
3031
- static code = "IDENTITY_NOT_FOUND";
3032
- static statusCode = 404;
3033
- static description = `Identity not found`;
3115
+ static code = "DOMAIN_ALREADY_EXISTS";
3116
+ static statusCode = 400;
3117
+ static description = `Domain already exists: {domain}`;
3034
3118
  }
3035
- class DomainOwnershipVerificationFailedError extends Error {
3119
+ class FailedToInsertOwnershipError extends Error {
3036
3120
  constructor(body) {
3037
3121
  super(
3038
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
3122
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
3039
3123
  );
3040
3124
  this.body = body;
3041
- this.name = "DomainOwnershipVerificationFailedError";
3125
+ this.name = "FailedToInsertOwnershipError";
3042
3126
  }
3043
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
3044
- static statusCode = 403;
3045
- static description = `Domain ownership verification failed`;
3127
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
3128
+ static statusCode = 500;
3129
+ static description = `Failed to insert domain ownership: {message}`;
3046
3130
  }
3047
- class ErrorDeletingRecordError extends Error {
3131
+ class FailedRemoveDomainMappingError extends Error {
3048
3132
  constructor(body) {
3049
3133
  super(
3050
- `ERROR_DELETING_RECORD: ${body.message}`
3134
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
3051
3135
  );
3052
3136
  this.body = body;
3053
- this.name = "ErrorDeletingRecordError";
3137
+ this.name = "FailedRemoveDomainMappingError";
3054
3138
  }
3055
- static code = "ERROR_DELETING_RECORD";
3139
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
3056
3140
  static statusCode = 500;
3057
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
3141
+ static description = `Failed to remove domain mapping: {message}`;
3058
3142
  }
3059
- class RecordOwnershipErrorError extends Error {
3143
+ class FailedPermissionsCheckError extends Error {
3060
3144
  constructor(body) {
3061
3145
  super(
3062
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
3146
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
3063
3147
  );
3064
3148
  this.body = body;
3065
- this.name = "RecordOwnershipErrorError";
3149
+ this.name = "FailedPermissionsCheckError";
3066
3150
  }
3067
- static code = "RECORD_OWNERSHIP_ERROR";
3068
- static statusCode = 403;
3069
- static description = `Account {account_id} does not own record {record_id}`;
3151
+ static code = "FAILED_PERMISSIONS_CHECK";
3152
+ static statusCode = 401;
3153
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
3070
3154
  }
3071
- class ErrorCreatingRecordError extends Error {
3155
+ class FailedToCheckDomainMappingPermissionsError extends Error {
3072
3156
  constructor(body) {
3073
3157
  super(
3074
- `ERROR_CREATING_RECORD: ${body.message}`
3158
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
3075
3159
  );
3076
3160
  this.body = body;
3077
- this.name = "ErrorCreatingRecordError";
3161
+ this.name = "FailedToCheckDomainMappingPermissionsError";
3078
3162
  }
3079
- static code = "ERROR_CREATING_RECORD";
3080
- static statusCode = 500;
3081
- static description = `Error creating DNS record: {message}`;
3163
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
3164
+ static statusCode = 502;
3165
+ static description = `Failed to check permissions: {message}`;
3082
3166
  }
3083
- class DomainOwnershipErrorError extends Error {
3167
+ class GitRepoLimitExceededError extends Error {
3084
3168
  constructor(body) {
3085
3169
  super(
3086
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
3170
+ `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
3087
3171
  );
3088
3172
  this.body = body;
3089
- this.name = "DomainOwnershipErrorError";
3173
+ this.name = "GitRepoLimitExceededError";
3090
3174
  }
3091
- static code = "DOMAIN_OWNERSHIP_ERROR";
3175
+ static code = "GIT_REPO_LIMIT_EXCEEDED";
3092
3176
  static statusCode = 403;
3093
- static description = `Account {account_id} does not own domain {domain}`;
3177
+ static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
3094
3178
  }
3095
- class UnauthorizedErrorError extends Error {
3179
+ class BranchNameEmptyError extends Error {
3096
3180
  constructor(body) {
3097
3181
  super(
3098
- `UNAUTHORIZED_ERROR: ${body.message}`
3182
+ `BRANCH_NAME_EMPTY: ${body.message}`
3099
3183
  );
3100
3184
  this.body = body;
3101
- this.name = "UnauthorizedErrorError";
3185
+ this.name = "BranchNameEmptyError";
3102
3186
  }
3103
- static code = "UNAUTHORIZED_ERROR";
3104
- static statusCode = 401;
3105
- static description = `Unauthorized request to {route}`;
3187
+ static code = "BRANCH_NAME_EMPTY";
3188
+ static statusCode = 400;
3189
+ static description = `Branch name cannot be empty`;
3106
3190
  }
3107
3191
  const FREESTYLE_ERROR_CODE_MAP = {
3108
3192
  "GIT_ERROR": GitErrorError,
@@ -3111,43 +3195,17 @@ const FREESTYLE_ERROR_CODE_MAP = {
3111
3195
  "BAD_SIGNATURE": BadSignatureError,
3112
3196
  "BAD_HEADER": BadHeaderError,
3113
3197
  "BAD_KEY": BadKeyError,
3114
- "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3115
- "INTERNAL_ERROR": InternalErrorError,
3116
- "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3117
- "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3118
- "VM_NOT_RUNNING": VmNotRunningError,
3119
- "VM_NOT_FOUND": VmNotFoundError,
3120
- "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3121
- "BAD_REQUEST": BadRequestError,
3122
- "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
3123
- "SNAPSHOT_SETUP_FAILED": SnapshotSetupFailedError,
3124
- "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3125
- "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3126
- "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3127
- "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3128
- "KERNEL_PANIC": KernelPanicError,
3129
- "VM_DELETED": VmDeletedError,
3130
- "REQWEST": ReqwestError,
3131
- "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3132
- "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
3133
- "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
3134
- "VM_START_TIMEOUT": VmStartTimeoutError,
3135
- "VM_EXIT_DURING_START": VmExitDuringStartError,
3136
- "VM_ACCESS_DENIED": VmAccessDeniedError,
3137
- "STD_IO": StdIoError,
3138
- "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
3139
- "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3140
3198
  "FILE_NOT_FOUND": FileNotFoundError,
3141
3199
  "FILES_BAD_REQUEST": FilesBadRequestError,
3142
- "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
3143
- "ALREADY_HAS_BASE": AlreadyHasBaseError,
3144
- "NOT_FOUND": NotFoundError,
3200
+ "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3145
3201
  "DATABASE_ERROR": DatabaseErrorError,
3146
3202
  "PARTITION_NOT_FOUND": PartitionNotFoundError,
3147
3203
  "INVALID_VM_ID": InvalidVmIdError,
3148
- "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
3149
- "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
3150
- "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
3204
+ "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
3205
+ "ALREADY_HAS_BASE": AlreadyHasBaseError,
3206
+ "NOT_FOUND": NotFoundError,
3207
+ "SNAPSHOT_SETUP_FAILED": SnapshotSetupFailedError,
3208
+ "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3151
3209
  "USER_NOT_FOUND": UserNotFoundError,
3152
3210
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
3153
3211
  "VALIDATION_ERROR": ValidationErrorError,
@@ -3164,9 +3222,35 @@ const FREESTYLE_ERROR_CODE_MAP = {
3164
3222
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
3165
3223
  "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
3166
3224
  "GROUP_NAME_EMPTY": GroupNameEmptyError,
3225
+ "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
3226
+ "INTERNAL_ERROR": InternalErrorError,
3227
+ "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
3228
+ "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
3229
+ "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3230
+ "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3231
+ "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3232
+ "KERNEL_PANIC": KernelPanicError,
3233
+ "VM_DELETED": VmDeletedError,
3234
+ "REQWEST": ReqwestError,
3235
+ "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3236
+ "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
3237
+ "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
3238
+ "VM_START_TIMEOUT": VmStartTimeoutError,
3239
+ "VM_EXIT_DURING_START": VmExitDuringStartError,
3240
+ "VM_ACCESS_DENIED": VmAccessDeniedError,
3241
+ "STD_IO": StdIoError,
3242
+ "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
3243
+ "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3167
3244
  "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
3168
3245
  "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
3169
3246
  "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
3247
+ "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3248
+ "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3249
+ "VM_NOT_RUNNING": VmNotRunningError,
3250
+ "VM_NOT_FOUND": VmNotFoundError,
3251
+ "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3252
+ "BAD_REQUEST": BadRequestError,
3253
+ "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
3170
3254
  "DOCKER_SNAPSHOT_FAILED": DockerSnapshotFailedError,
3171
3255
  "SET_DEFAULT_SNAPSHOT_FAILED": SetDefaultSnapshotFailedError,
3172
3256
  "SNAPSHOT_LAYER_CREATION_FAILED": SnapshotLayerCreationFailedError,
@@ -3201,17 +3285,23 @@ const FREESTYLE_ERROR_CODE_MAP = {
3201
3285
  "INVALID_PARAMETERS": InvalidParametersError,
3202
3286
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
3203
3287
  "EXPIRED": ExpiredError,
3204
- "PACKFILE": PackfileError,
3205
- "TREE_NOT_FOUND": TreeNotFoundError,
3288
+ "INVALID_RANGE": InvalidRangeError,
3289
+ "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
3290
+ "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
3291
+ "COMMIT_NOT_FOUND": CommitNotFoundError,
3206
3292
  "BRANCH_NOT_FOUND": BranchNotFoundError,
3293
+ "NO_DEFAULT_BRANCH": NoDefaultBranchError,
3294
+ "INVALID_BASE64_CONTENT": InvalidBase64ContentError,
3295
+ "INVALID_FILE_CHANGE": InvalidFileChangeError,
3296
+ "INVALID_FILE_PATH": InvalidFilePathError,
3297
+ "CONFLICTING_PARENT": ConflictingParentError,
3298
+ "INVALID_SERVICE": InvalidServiceError,
3299
+ "EXPECTED_SERVICE": ExpectedServiceError,
3300
+ "TAG_NOT_FOUND": TagNotFoundError,
3301
+ "INVALID_REVISION": InvalidRevisionError,
3207
3302
  "FORBIDDEN": ForbiddenError,
3208
- "UNAUTHORIZED": UnauthorizedError,
3209
- "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
3210
- "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
3211
- "INVALID_OBJECT_ID": InvalidObjectIdError,
3212
- "COMMIT_NOT_FOUND": CommitNotFoundError,
3213
- "PATH_NOT_FOUND": PathNotFoundError,
3214
- "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
3303
+ "UNAUTHORIZED": UnauthorizedError,
3304
+ "BLOB_NOT_FOUND": BlobNotFoundError,
3215
3305
  "AMBIGUOUS": AmbiguousError,
3216
3306
  "INVALID": InvalidError,
3217
3307
  "INVALID_ACCOUNT_ID": InvalidAccountIdError,
@@ -3219,82 +3309,34 @@ const FREESTYLE_ERROR_CODE_MAP = {
3219
3309
  "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
3220
3310
  "SOURCE_NOT_FOUND": SourceNotFoundError,
3221
3311
  "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
3222
- "TAG_NOT_FOUND": TagNotFoundError,
3312
+ "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
3313
+ "TREE_NOT_FOUND": TreeNotFoundError,
3314
+ "PATH_NOT_FOUND": PathNotFoundError,
3315
+ "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
3316
+ "CONFLICT": ConflictError,
3317
+ "BRANCH_ALREADY_EXISTS": BranchAlreadyExistsError,
3318
+ "PARENT_NOT_FOUND": ParentNotFoundError,
3319
+ "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
3320
+ "INVALID_OBJECT_ID": InvalidObjectIdError,
3223
3321
  "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3322
+ "PACKFILE": PackfileError,
3224
3323
  "SEND_ERROR": SendErrorError,
3225
- "INVALID_SERVICE": InvalidServiceError,
3226
- "EXPECTED_SERVICE": ExpectedServiceError,
3227
- "INVALID_RANGE": InvalidRangeError,
3228
- "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
3229
- "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
3230
- "BLOB_NOT_FOUND": BlobNotFoundError,
3231
- "INVALID_REVISION": InvalidRevisionError,
3232
- "CONFLICT": ConflictError,
3233
3324
  "UNAVAILABLE": UnavailableError,
3234
3325
  "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
3235
- "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
3236
3326
  "EMPTY_TAG": EmptyTagError,
3237
- "BRANCH_NAME_EMPTY": BranchNameEmptyError,
3238
- "VM_LIMIT_EXCEEDED": VmLimitExceededError,
3239
- "SCHEDULE_NOT_FOUND": ScheduleNotFoundError,
3240
- "SERVICE_UNAVAILABLE": ServiceUnavailableError,
3241
- "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3242
- "TRIGGER_ERROR": TriggerErrorError,
3243
- "TOKEN_ERROR": TokenErrorError,
3244
- "PERMISSION_ERROR": PermissionErrorError,
3245
- "IDENTITY_ERROR": IdentityErrorError,
3246
- "GET_CONTENT_FAILED": GetContentFailedError,
3247
- "CONTENT_NOT_FOUND": ContentNotFoundError,
3248
- "DOWNLOAD_FAILED": DownloadFailedError,
3249
- "GIT_SERVER_ERROR": GitServerErrorError,
3250
- "PARSE_RESPONSE_ERROR": ParseResponseErrorError,
3251
- "REPOSITORY_ACCESS_DENIED": RepositoryAccessDeniedError,
3252
- "GIT_HUB_SYNC_FAILED": GitHubSyncFailedError,
3253
- "UPDATE_DEFAULT_BRANCH_FAILED": UpdateDefaultBranchFailedError,
3254
- "GET_REPOSITORY_INFO_FAILED": GetRepositoryInfoFailedError,
3255
- "LIST_REPOSITORIES_FAILED": ListRepositoriesFailedError,
3256
- "DELETE_REPOSITORY_FAILED": DeleteRepositoryFailedError,
3257
- "CREATE_REPOSITORY_FAILED": CreateRepositoryFailedError,
3258
- "SERIALIZATION_ERROR": SerializationErrorError,
3259
- "GIT_INVALID_REQUEST": GitInvalidRequestError,
3260
- "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
3261
- "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
3262
- "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
3263
- "LIST_RUNS_FAILED": ListRunsFailedError,
3264
- "EXECUTION_ERROR": ExecutionErrorError,
3265
- "CONNECTION_FAILED": ConnectionFailedError,
3266
- "METADATA_WRITE_FAILED": MetadataWriteFailedError,
3267
- "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
3268
- "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
3269
- "LOCK_GENERATION_FAILED": LockGenerationFailedError,
3270
- "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
3271
- "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
3272
- "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3273
- "LOGGING_FAILED": LoggingFailedError,
3274
- "RUN_NOT_FOUND": RunNotFoundError,
3275
- "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
3276
- "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
3277
- "PERMISSION_DENIED": PermissionDeniedError,
3278
- "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
3279
- "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
3280
- "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
3281
- "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
3282
- "VERIFICATION_FAILED": VerificationFailedError,
3283
- "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
3284
- "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
3285
- "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
3286
- "INVALID_DOMAIN": InvalidDomainError,
3287
- "LIMIT_EXCEEDED": LimitExceededError,
3288
- "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3289
- "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3290
- "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3291
- "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3292
- "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3293
- "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3294
- "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3295
- "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3296
- "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3297
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3327
+ "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
3328
+ "WATCH_FILES_FAILED": WatchFilesFailedError,
3329
+ "LOGS_FAILED": LogsFailedError,
3330
+ "STATUS_FAILED": StatusFailedError,
3331
+ "RESTART_FAILED": RestartFailedError,
3332
+ "SHUTDOWN_FAILED": ShutdownFailedError,
3333
+ "COMMIT_FAILED": CommitFailedError,
3334
+ "WRITE_FILE_FAILED": WriteFileFailedError,
3335
+ "READ_FILE_FAILED": ReadFileFailedError,
3336
+ "EXECUTION_FAILED": ExecutionFailedError,
3337
+ "REQUEST_FAILED": RequestFailedError,
3338
+ "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
3339
+ "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
3298
3340
  "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3299
3341
  "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3300
3342
  "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
@@ -3316,27 +3358,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
3316
3358
  "INVALID_DOMAINS": InvalidDomainsError,
3317
3359
  "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
3318
3360
  "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3319
- "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
3320
- "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
3321
- "PARSE_LOGS_FAILED": ParseLogsFailedError,
3322
- "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
3323
- "INVALID_QUERY": InvalidQueryError,
3324
- "LOGS_NOT_FOUND": LogsNotFoundError,
3325
- "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
3326
- "WATCH_FILES_FAILED": WatchFilesFailedError,
3327
- "LOGS_FAILED": LogsFailedError,
3328
- "STATUS_FAILED": StatusFailedError,
3329
- "RESTART_FAILED": RestartFailedError,
3330
- "SHUTDOWN_FAILED": ShutdownFailedError,
3331
- "COMMIT_FAILED": CommitFailedError,
3332
- "WRITE_FILE_FAILED": WriteFileFailedError,
3333
- "READ_FILE_FAILED": ReadFileFailedError,
3334
- "EXECUTION_FAILED": ExecutionFailedError,
3335
- "REQUEST_FAILED": RequestFailedError,
3336
- "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
3337
- "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
3338
- "RESIZE_FAILED": ResizeFailedError,
3339
- "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3340
3361
  "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
3341
3362
  "LIST_TOKENS_FAILED": ListTokensFailedError,
3342
3363
  "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
@@ -3357,12 +3378,82 @@ const FREESTYLE_ERROR_CODE_MAP = {
3357
3378
  "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
3358
3379
  "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
3359
3380
  "IDENTITY_NOT_FOUND": IdentityNotFoundError,
3381
+ "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
3382
+ "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
3383
+ "LIST_RUNS_FAILED": ListRunsFailedError,
3384
+ "EXECUTION_ERROR": ExecutionErrorError,
3385
+ "CONNECTION_FAILED": ConnectionFailedError,
3386
+ "METADATA_WRITE_FAILED": MetadataWriteFailedError,
3387
+ "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
3388
+ "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
3389
+ "LOCK_GENERATION_FAILED": LockGenerationFailedError,
3390
+ "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
3391
+ "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
3392
+ "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3393
+ "LOGGING_FAILED": LoggingFailedError,
3394
+ "RUN_NOT_FOUND": RunNotFoundError,
3395
+ "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
3396
+ "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
3397
+ "PERMISSION_DENIED": PermissionDeniedError,
3398
+ "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
3399
+ "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
3400
+ "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
3401
+ "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
3402
+ "VERIFICATION_FAILED": VerificationFailedError,
3403
+ "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
3404
+ "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
3405
+ "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
3406
+ "INVALID_DOMAIN": InvalidDomainError,
3360
3407
  "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3361
3408
  "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3362
3409
  "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3363
3410
  "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3364
3411
  "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3365
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError
3412
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3413
+ "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3414
+ "VM_LIMIT_EXCEEDED": VmLimitExceededError,
3415
+ "SCHEDULE_NOT_FOUND": ScheduleNotFoundError,
3416
+ "SERVICE_UNAVAILABLE": ServiceUnavailableError,
3417
+ "RESIZE_FAILED": ResizeFailedError,
3418
+ "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3419
+ "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
3420
+ "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
3421
+ "PARSE_LOGS_FAILED": ParseLogsFailedError,
3422
+ "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
3423
+ "INVALID_QUERY": InvalidQueryError,
3424
+ "LOGS_NOT_FOUND": LogsNotFoundError,
3425
+ "TRIGGER_ERROR": TriggerErrorError,
3426
+ "TOKEN_ERROR": TokenErrorError,
3427
+ "PERMISSION_ERROR": PermissionErrorError,
3428
+ "IDENTITY_ERROR": IdentityErrorError,
3429
+ "GET_CONTENT_FAILED": GetContentFailedError,
3430
+ "CONTENT_NOT_FOUND": ContentNotFoundError,
3431
+ "DOWNLOAD_FAILED": DownloadFailedError,
3432
+ "GIT_SERVER_ERROR": GitServerErrorError,
3433
+ "PARSE_RESPONSE_ERROR": ParseResponseErrorError,
3434
+ "REPOSITORY_ACCESS_DENIED": RepositoryAccessDeniedError,
3435
+ "GIT_HUB_SYNC_FAILED": GitHubSyncFailedError,
3436
+ "UPDATE_DEFAULT_BRANCH_FAILED": UpdateDefaultBranchFailedError,
3437
+ "GET_REPOSITORY_INFO_FAILED": GetRepositoryInfoFailedError,
3438
+ "LIST_REPOSITORIES_FAILED": ListRepositoriesFailedError,
3439
+ "DELETE_REPOSITORY_FAILED": DeleteRepositoryFailedError,
3440
+ "CREATE_REPOSITORY_FAILED": CreateRepositoryFailedError,
3441
+ "SERIALIZATION_ERROR": SerializationErrorError,
3442
+ "GIT_INVALID_REQUEST": GitInvalidRequestError,
3443
+ "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
3444
+ "LIMIT_EXCEEDED": LimitExceededError,
3445
+ "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3446
+ "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3447
+ "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3448
+ "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3449
+ "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3450
+ "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3451
+ "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3452
+ "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3453
+ "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3454
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3455
+ "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
3456
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError
3366
3457
  };
3367
3458
 
3368
3459
  var errors = /*#__PURE__*/Object.freeze({
@@ -3379,6 +3470,7 @@ var errors = /*#__PURE__*/Object.freeze({
3379
3470
  BadSignatureError: BadSignatureError,
3380
3471
  BadTimestampError: BadTimestampError,
3381
3472
  BlobNotFoundError: BlobNotFoundError,
3473
+ BranchAlreadyExistsError: BranchAlreadyExistsError,
3382
3474
  BranchNameEmptyError: BranchNameEmptyError,
3383
3475
  BranchNotFoundError: BranchNotFoundError,
3384
3476
  BrowserOperationFailedError: BrowserOperationFailedError,
@@ -3393,6 +3485,7 @@ var errors = /*#__PURE__*/Object.freeze({
3393
3485
  CommitNotFoundError: CommitNotFoundError,
3394
3486
  CommitNotInBranchError: CommitNotInBranchError,
3395
3487
  ConflictError: ConflictError,
3488
+ ConflictingParentError: ConflictingParentError,
3396
3489
  ConnectionFailedError: ConnectionFailedError,
3397
3490
  ContentNotFoundError: ContentNotFoundError,
3398
3491
  CreateBackupFailedError: CreateBackupFailedError,
@@ -3485,10 +3578,13 @@ var errors = /*#__PURE__*/Object.freeze({
3485
3578
  InternalResizeVmNotFoundError: InternalResizeVmNotFoundError,
3486
3579
  InternalVmNotFoundError: InternalVmNotFoundError,
3487
3580
  InvalidAccountIdError: InvalidAccountIdError,
3581
+ InvalidBase64ContentError: InvalidBase64ContentError,
3488
3582
  InvalidDeploymentRequestError: InvalidDeploymentRequestError,
3489
3583
  InvalidDomainError: InvalidDomainError,
3490
3584
  InvalidDomainsError: InvalidDomainsError,
3491
3585
  InvalidError: InvalidError,
3586
+ InvalidFileChangeError: InvalidFileChangeError,
3587
+ InvalidFilePathError: InvalidFilePathError,
3492
3588
  InvalidGitRepoSpecErrorError: InvalidGitRepoSpecErrorError,
3493
3589
  InvalidObjectIdError: InvalidObjectIdError,
3494
3590
  InvalidParametersError: InvalidParametersError,
@@ -3515,6 +3611,7 @@ var errors = /*#__PURE__*/Object.freeze({
3515
3611
  MaxUsesExceededError: MaxUsesExceededError,
3516
3612
  MetadataWriteFailedError: MetadataWriteFailedError,
3517
3613
  NetworkPermissionsFailedError: NetworkPermissionsFailedError,
3614
+ NoDefaultBranchError: NoDefaultBranchError,
3518
3615
  NoDomainOwnershipError: NoDomainOwnershipError,
3519
3616
  NoEntrypointFoundError: NoEntrypointFoundError,
3520
3617
  NodeModulesDownloadFailedError: NodeModulesDownloadFailedError,
@@ -3525,6 +3622,7 @@ var errors = /*#__PURE__*/Object.freeze({
3525
3622
  OffsetWithSelectorError: OffsetWithSelectorError,
3526
3623
  OnFailureArrayContainsEmptyError: OnFailureArrayContainsEmptyError,
3527
3624
  PackfileError: PackfileError,
3625
+ ParentNotFoundError: ParentNotFoundError,
3528
3626
  ParseLogsFailedError: ParseLogsFailedError,
3529
3627
  ParseResponseErrorError: ParseResponseErrorError,
3530
3628
  PartitionNotFoundError: PartitionNotFoundError,
@@ -3907,11 +4005,17 @@ class GitRepoBranchesNamespace {
3907
4005
  body: { defaultBranch }
3908
4006
  });
3909
4007
  }
4008
+ /**
4009
+ * List all branches in this repository.
4010
+ */
3910
4011
  async list() {
3911
4012
  return this.apiClient.get("/git/v1/repo/{repo}/git/refs/heads/", {
3912
4013
  params: { repo: this.repoId }
3913
4014
  });
3914
4015
  }
4016
+ /**
4017
+ * Get a specific branch by name.
4018
+ */
3915
4019
  async get({
3916
4020
  branchName
3917
4021
  }) {
@@ -3919,6 +4023,37 @@ class GitRepoBranchesNamespace {
3919
4023
  params: { repo: this.repoId, branch: branchName }
3920
4024
  });
3921
4025
  }
4026
+ /**
4027
+ * Create a new branch.
4028
+ *
4029
+ * If no SHA is provided, the branch will be created from the default branch.
4030
+ *
4031
+ * @param name - The name of the branch to create
4032
+ * @param sha - Optional commit SHA to branch from. If not provided, branches from the default branch.
4033
+ *
4034
+ * @example
4035
+ * ```ts
4036
+ * // Create a branch from the default branch
4037
+ * const newBranch = await repo.branches.create({
4038
+ * name: "feature/something"
4039
+ * });
4040
+ *
4041
+ * // Create a branch from a specific commit
4042
+ * const newBranch = await repo.branches.create({
4043
+ * name: "feature-xyz",
4044
+ * sha: "abc123..."
4045
+ * });
4046
+ * ```
4047
+ */
4048
+ async create({
4049
+ name,
4050
+ sha
4051
+ }) {
4052
+ return this.apiClient.post("/git/v1/repo/{repo}/git/refs/heads/{*branch}", {
4053
+ params: { repo: this.repoId, branch: name },
4054
+ body: { sha }
4055
+ });
4056
+ }
3922
4057
  }
3923
4058
  class GitRepoGitHubSyncNamespace {
3924
4059
  repoId;
@@ -4119,12 +4254,94 @@ class GitRepoCommitsNamespace {
4119
4254
  });
4120
4255
  }
4121
4256
  /**
4122
- * List commits for this repository.
4257
+ * List commits in this repository with optional filtering.
4123
4258
  */
4124
- async list(params = {}) {
4259
+ async list({
4260
+ branch,
4261
+ limit,
4262
+ order,
4263
+ since,
4264
+ until,
4265
+ offset
4266
+ } = {}) {
4125
4267
  return this.apiClient.get("/git/v1/repo/{repo}/git/commits", {
4126
4268
  params: { repo: this.repoId },
4127
- query: params
4269
+ query: {
4270
+ branch,
4271
+ limit,
4272
+ order,
4273
+ since,
4274
+ until,
4275
+ offset
4276
+ }
4277
+ });
4278
+ }
4279
+ /**
4280
+ * Create a new commit with files.
4281
+ *
4282
+ * Supports text files (UTF-8) and binary files (base64-encoded).
4283
+ * Files can be added, modified, or deleted.
4284
+ * Includes optimistic concurrency control via `expectedSha` to prevent race conditions.
4285
+ *
4286
+ * @example
4287
+ * ```ts
4288
+ * // Create a commit with text files
4289
+ * const { commit } = await repo.commits.create({
4290
+ * message: "Initial commit",
4291
+ * branch: "main",
4292
+ * files: [
4293
+ * { path: "README.md", content: "# My Project" },
4294
+ * { path: "src/index.ts", content: "console.log('Hello!');" }
4295
+ * ],
4296
+ * author: { name: "John Doe", email: "john@example.com" }
4297
+ * });
4298
+ *
4299
+ * // Create a commit with a binary file (base64-encoded)
4300
+ * const imageBuffer = await fs.readFile("image.png");
4301
+ * const base64Image = imageBuffer.toString("base64");
4302
+ * await repo.commits.create({
4303
+ * message: "Add logo",
4304
+ * branch: "main",
4305
+ * files: [
4306
+ * { path: "assets/logo.png", content: base64Image, encoding: "base64" }
4307
+ * ]
4308
+ * });
4309
+ *
4310
+ * // Delete a file
4311
+ * await repo.commits.create({
4312
+ * message: "Remove deprecated file",
4313
+ * branch: "main",
4314
+ * files: [
4315
+ * { path: "old/deprecated.ts", deleted: true }
4316
+ * ]
4317
+ * });
4318
+ *
4319
+ * // Use optimistic concurrency control (CAS)
4320
+ * const branchInfo = await repo.branches.get({ name: "main" });
4321
+ * await repo.commits.create({
4322
+ * message: "Update with CAS",
4323
+ * branch: "main",
4324
+ * files: [{ path: "version.txt", content: "2.0.0" }],
4325
+ * expectedSha: branchInfo.commit.sha // Will fail if branch tip changed
4326
+ * });
4327
+ * ```
4328
+ */
4329
+ async create({
4330
+ message,
4331
+ files,
4332
+ branch,
4333
+ author,
4334
+ expectedSha
4335
+ }) {
4336
+ return this.apiClient.post("/git/v1/repo/{repo}/commits", {
4337
+ params: { repo: this.repoId },
4338
+ body: {
4339
+ message,
4340
+ files,
4341
+ branch,
4342
+ author,
4343
+ expectedSha
4344
+ }
4128
4345
  });
4129
4346
  }
4130
4347
  }
@@ -5042,11 +5259,7 @@ class FileSystem {
5042
5259
  });
5043
5260
  if (response && typeof response === "object" && "content" in response) {
5044
5261
  const content = response.content;
5045
- try {
5046
- return Buffer.from(content, "base64");
5047
- } catch {
5048
- return Buffer.from(content, "utf-8");
5049
- }
5262
+ return Buffer.from(content, "utf-8");
5050
5263
  }
5051
5264
  throw new Error("Unexpected response format from VM file read");
5052
5265
  }
@@ -5056,10 +5269,10 @@ class FileSystem {
5056
5269
  * @param content Buffer containing the content to write
5057
5270
  */
5058
5271
  async writeFile(filepath, content) {
5059
- const base64Content = content.toString("base64");
5272
+ const textContent = content.toString("utf-8");
5060
5273
  await this.client.put("/v1/vms/{vm_id}/files/{filepath}", {
5061
5274
  params: { vm_id: this.vmId, filepath },
5062
- body: { content: base64Content },
5275
+ body: { content: textContent },
5063
5276
  headers: linuxUsernameHeader(this.vm?._linux_username)
5064
5277
  });
5065
5278
  }
@@ -5777,6 +5990,47 @@ function composeVmSpecs(specs) {
5777
5990
  return result;
5778
5991
  }
5779
5992
 
5993
+ function processSystemdServices(services, existingFiles = {}) {
5994
+ const additionalFiles = { ...existingFiles };
5995
+ const processedServices = [];
5996
+ for (const service of services) {
5997
+ const { bash, ...rest } = service;
5998
+ const mode = rest.mode ?? "service";
5999
+ if (bash) {
6000
+ const scriptPath = `/opt/freestyle/scripts/${service.name}.sh`;
6001
+ const scriptContent = bash.startsWith("#!/") ? bash : `#!/bin/bash
6002
+ ${bash}`;
6003
+ additionalFiles[scriptPath] = {
6004
+ content: scriptContent,
6005
+ encoding: "utf-8"
6006
+ };
6007
+ processedServices.push({
6008
+ ...rest,
6009
+ mode,
6010
+ exec: [`/bin/bash ${scriptPath}`]
6011
+ });
6012
+ } else {
6013
+ if (!rest.exec || rest.exec.length === 0) {
6014
+ throw new Error(
6015
+ `Systemd service "${service.name}" must have either 'exec' or 'bash' defined`
6016
+ );
6017
+ }
6018
+ processedServices.push({
6019
+ ...rest,
6020
+ mode,
6021
+ exec: rest.exec
6022
+ });
6023
+ }
6024
+ }
6025
+ return { services: processedServices, additionalFiles };
6026
+ }
6027
+ function normalizeGitOptions(git) {
6028
+ if (!git) return git;
6029
+ return {
6030
+ ...git,
6031
+ config: git.config ?? {}
6032
+ };
6033
+ }
5780
6034
  class VmTerminals {
5781
6035
  vm = null;
5782
6036
  vmId;
@@ -6117,6 +6371,44 @@ class VmsNamespace {
6117
6371
  options.spec = new VmSpec({ snapshot: options.snapshot });
6118
6372
  }
6119
6373
  }
6374
+ if (options.systemd?.services) {
6375
+ const normalizedServices = options.systemd.services.map((service) => {
6376
+ return {
6377
+ ...service,
6378
+ after: service.after?.map(
6379
+ (s) => s.includes(".") ? s : `${s}.service`
6380
+ ),
6381
+ requires: service.requires?.map(
6382
+ (s) => s.includes(".") ? s : `${s}.service`
6383
+ ),
6384
+ wantedBy: service.wantedBy?.map(
6385
+ (s) => s.includes(".") ? s : `${s}.service`
6386
+ )
6387
+ };
6388
+ });
6389
+ const { services: processedServices, additionalFiles: bashFiles } = processSystemdServices(
6390
+ normalizedServices,
6391
+ options.additionalFiles ?? {}
6392
+ );
6393
+ options.systemd.services = processedServices;
6394
+ options.additionalFiles = bashFiles;
6395
+ }
6396
+ if (options.systemd?.patchedServices) {
6397
+ options.systemd.patchedServices = options.systemd.patchedServices.map(
6398
+ (service) => {
6399
+ service.after = service.after?.map(
6400
+ (s) => s.includes(".") ? s : `${s}.service`
6401
+ );
6402
+ service.requires = service.requires?.map(
6403
+ (s) => s.includes(".") ? s : `${s}.service`
6404
+ );
6405
+ service.wantedBy = service.wantedBy?.map(
6406
+ (s) => s.includes(".") ? s : `${s}.service`
6407
+ );
6408
+ return service;
6409
+ }
6410
+ );
6411
+ }
6120
6412
  if ("snapshot" in options) {
6121
6413
  const { snapshot: _snapshot, ...rest } = options;
6122
6414
  options = rest;
@@ -6169,8 +6461,15 @@ class VmsNamespace {
6169
6461
  const response = await this.freestyle._apiClient.post("/v1/vms", {
6170
6462
  body: {
6171
6463
  ...config,
6172
- template: config.template instanceof VmTemplate ? config.template["raw"] : config.template
6464
+ template: config.template instanceof VmTemplate ? config.template["raw"] : config.template,
6465
+ // Cast systemd since we've processed SystemdServiceInput[] to RawSystemdService[]
6466
+ systemd: config.systemd,
6467
+ // Normalize git options - default config to {}
6468
+ git: normalizeGitOptions(config.git)
6173
6469
  }
6470
+ }).catch((e) => {
6471
+ enhanceError(e);
6472
+ throw e;
6174
6473
  });
6175
6474
  const vmId = response.id;
6176
6475
  const vm = new Vm({ vmId, freestyle: this.freestyle });
@@ -6182,8 +6481,9 @@ class VmsNamespace {
6182
6481
  vm[key] = instance;
6183
6482
  }
6184
6483
  }
6484
+ const { consoleUrl: _consoleUrl, ...responseWithoutConsoleUrl } = response;
6185
6485
  return {
6186
- ...response,
6486
+ ...responseWithoutConsoleUrl,
6187
6487
  vmId,
6188
6488
  vm,
6189
6489
  // start to phase out built in domain
@@ -6248,6 +6548,14 @@ class VmsNamespace {
6248
6548
  });
6249
6549
  }
6250
6550
  }
6551
+ function enhanceError(e) {
6552
+ if (e instanceof VmSetupFailedError) {
6553
+ if (!e.message.includes("create --snapshot")) {
6554
+ e.message = `${e.message}. Hint: use \`npx freestyle-sandboxes@latest vm create --snapshot ${e.body.snapshotId} --ssh --delete\` to debug.`;
6555
+ }
6556
+ }
6557
+ return e;
6558
+ }
6251
6559
  class VmSnapshotsNamespace {
6252
6560
  constructor(apiClient) {
6253
6561
  this.apiClient = apiClient;
@@ -6304,10 +6612,36 @@ class VmSnapshotsNamespace {
6304
6612
  ...requestOptions,
6305
6613
  template: requestOptions.template instanceof VmTemplate ? requestOptions.template.raw : requestOptions.template
6306
6614
  }
6615
+ }).catch((e) => {
6616
+ enhanceError(e);
6617
+ throw e;
6307
6618
  });
6308
6619
  }
6309
6620
  }
6310
6621
  async function processTemplateTree(template) {
6622
+ if (template.raw.git) {
6623
+ template.raw.git = normalizeGitOptions(
6624
+ template.raw.git
6625
+ );
6626
+ }
6627
+ if (template.raw.systemd?.services) {
6628
+ const normalizedServices = template.raw.systemd.services.map((service) => ({
6629
+ ...service,
6630
+ after: service.after?.map((s) => s.includes(".") ? s : `${s}.service`),
6631
+ requires: service.requires?.map(
6632
+ (s) => s.includes(".") ? s : `${s}.service`
6633
+ ),
6634
+ wantedBy: service.wantedBy?.map(
6635
+ (s) => s.includes(".") ? s : `${s}.service`
6636
+ )
6637
+ }));
6638
+ const { services: processedServices, additionalFiles: bashFiles } = processSystemdServices(
6639
+ normalizedServices,
6640
+ template.raw.additionalFiles ?? {}
6641
+ );
6642
+ template.raw.systemd.services = processedServices;
6643
+ template.raw.additionalFiles = bashFiles;
6644
+ }
6311
6645
  for (const key in template.with) {
6312
6646
  const builder = template.with[key];
6313
6647
  if (builder) {