freestyle 0.1.49 → 0.1.50

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 +9 -0
  2. package/cli.mjs +830 -12
  3. package/index.cjs +2054 -1497
  4. package/index.d.cts +1960 -1233
  5. package/index.d.mts +1960 -1233
  6. package/index.mjs +2052 -1498
  7. package/package.json +1 -1
package/index.cjs CHANGED
@@ -82,113 +82,245 @@ class BadKeyError extends Error {
82
82
  static statusCode = 400;
83
83
  static description = `invalid key length`;
84
84
  }
85
- class SnapshotSetupFailedError extends Error {
85
+ class VmOperationDeniedDuringTransactionError extends Error {
86
86
  constructor(body) {
87
87
  super(
88
- `SNAPSHOT_SETUP_FAILED: ${body.message}`
88
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
89
89
  );
90
90
  this.body = body;
91
- this.name = "SnapshotSetupFailedError";
91
+ this.name = "VmOperationDeniedDuringTransactionError";
92
92
  }
93
- static code = "SNAPSHOT_SETUP_FAILED";
94
- static statusCode = 500;
95
- static description = `Snapshot setup failed: {failed_reason}`;
93
+ static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
94
+ static statusCode = 409;
95
+ static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
96
96
  }
97
- class SnapshotVmBadRequestError extends Error {
97
+ class VmTransactionIdMismatchError extends Error {
98
98
  constructor(body) {
99
99
  super(
100
- `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
100
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
101
101
  );
102
102
  this.body = body;
103
- this.name = "SnapshotVmBadRequestError";
103
+ this.name = "VmTransactionIdMismatchError";
104
104
  }
105
- static code = "SNAPSHOT_VM_BAD_REQUEST";
105
+ static code = "VM_TRANSACTION_ID_MISMATCH";
106
106
  static statusCode = 400;
107
- static description = `Bad request: {message}`;
107
+ static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
108
108
  }
109
- class ResizeVmMemNotPowerOfTwoError extends Error {
109
+ class VmNotInTransactionError extends Error {
110
110
  constructor(body) {
111
111
  super(
112
- `RESIZE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
112
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
113
113
  );
114
114
  this.body = body;
115
- this.name = "ResizeVmMemNotPowerOfTwoError";
115
+ this.name = "VmNotInTransactionError";
116
116
  }
117
- static code = "RESIZE_VM_MEM_NOT_POWER_OF_TWO";
117
+ static code = "VM_NOT_IN_TRANSACTION";
118
+ static statusCode = 404;
119
+ static description = `VM not in a transaction: {vm_id}`;
120
+ }
121
+ class PartitionNotFoundError extends Error {
122
+ constructor(body) {
123
+ super(
124
+ `PARTITION_NOT_FOUND: ${body.message}`
125
+ );
126
+ this.body = body;
127
+ this.name = "PartitionNotFoundError";
128
+ }
129
+ static code = "PARTITION_NOT_FOUND";
130
+ static statusCode = 404;
131
+ static description = `Partition not found: {partition_id}`;
132
+ }
133
+ class UserNotFoundError extends Error {
134
+ constructor(body) {
135
+ super(
136
+ `USER_NOT_FOUND: ${body.message}`
137
+ );
138
+ this.body = body;
139
+ this.name = "UserNotFoundError";
140
+ }
141
+ static code = "USER_NOT_FOUND";
142
+ static statusCode = 404;
143
+ static description = `User not found: {user_name}`;
144
+ }
145
+ class UserAlreadyExistsError extends Error {
146
+ constructor(body) {
147
+ super(
148
+ `USER_ALREADY_EXISTS: ${body.message}`
149
+ );
150
+ this.body = body;
151
+ this.name = "UserAlreadyExistsError";
152
+ }
153
+ static code = "USER_ALREADY_EXISTS";
154
+ static statusCode = 409;
155
+ static description = `Conflict: User '{user_name}' already exists`;
156
+ }
157
+ class ValidationErrorError extends Error {
158
+ constructor(body) {
159
+ super(
160
+ `VALIDATION_ERROR: ${body.message}`
161
+ );
162
+ this.body = body;
163
+ this.name = "ValidationErrorError";
164
+ }
165
+ static code = "VALIDATION_ERROR";
118
166
  static statusCode = 400;
119
- static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
167
+ static description = `Validation error: {message}`;
120
168
  }
121
- class ResizeVmVcpuNotPowerOfTwoError extends Error {
169
+ class GroupNotFoundError extends Error {
122
170
  constructor(body) {
123
171
  super(
124
- `RESIZE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
172
+ `GROUP_NOT_FOUND: ${body.message}`
125
173
  );
126
174
  this.body = body;
127
- this.name = "ResizeVmVcpuNotPowerOfTwoError";
175
+ this.name = "GroupNotFoundError";
128
176
  }
129
- static code = "RESIZE_VM_VCPU_NOT_POWER_OF_TWO";
177
+ static code = "GROUP_NOT_FOUND";
178
+ static statusCode = 404;
179
+ static description = `Group not found: {group_name}`;
180
+ }
181
+ class GroupAlreadyExistsError extends Error {
182
+ constructor(body) {
183
+ super(
184
+ `GROUP_ALREADY_EXISTS: ${body.message}`
185
+ );
186
+ this.body = body;
187
+ this.name = "GroupAlreadyExistsError";
188
+ }
189
+ static code = "GROUP_ALREADY_EXISTS";
190
+ static statusCode = 409;
191
+ static description = `Conflict: Group '{group_name}' already exists`;
192
+ }
193
+ class DuplicateUserNameError extends Error {
194
+ constructor(body) {
195
+ super(
196
+ `DUPLICATE_USER_NAME: ${body.message}`
197
+ );
198
+ this.body = body;
199
+ this.name = "DuplicateUserNameError";
200
+ }
201
+ static code = "DUPLICATE_USER_NAME";
130
202
  static statusCode = 400;
131
- static description = `vcpuCount must be a power of two (got {got})`;
203
+ static description = `Duplicate user name '{name}' found`;
132
204
  }
133
- class ResizeVmMemOutOfRangeError extends Error {
205
+ class UserGroupEmptyError extends Error {
134
206
  constructor(body) {
135
207
  super(
136
- `RESIZE_VM_MEM_OUT_OF_RANGE: ${body.message}`
208
+ `USER_GROUP_EMPTY: ${body.message}`
137
209
  );
138
210
  this.body = body;
139
- this.name = "ResizeVmMemOutOfRangeError";
211
+ this.name = "UserGroupEmptyError";
140
212
  }
141
- static code = "RESIZE_VM_MEM_OUT_OF_RANGE";
213
+ static code = "USER_GROUP_EMPTY";
142
214
  static statusCode = 400;
143
- static description = `memSizeMb out of range (got {got}MiB, allowed {min}..={max} MiB)`;
215
+ static description = `User '{user}' has empty string in groups`;
144
216
  }
145
- class ResizeVmVcpuOutOfRangeError extends Error {
217
+ class UserSystemFlagMismatchError extends Error {
146
218
  constructor(body) {
147
219
  super(
148
- `RESIZE_VM_VCPU_OUT_OF_RANGE: ${body.message}`
220
+ `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
149
221
  );
150
222
  this.body = body;
151
- this.name = "ResizeVmVcpuOutOfRangeError";
223
+ this.name = "UserSystemFlagMismatchError";
152
224
  }
153
- static code = "RESIZE_VM_VCPU_OUT_OF_RANGE";
225
+ static code = "USER_SYSTEM_FLAG_MISMATCH";
154
226
  static statusCode = 400;
155
- static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
227
+ static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
156
228
  }
157
- class ResizeVmRootfsShrinkNotSupportedError extends Error {
229
+ class UserUidOutOfRangeError extends Error {
158
230
  constructor(body) {
159
231
  super(
160
- `RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED: ${body.message}`
232
+ `USER_UID_OUT_OF_RANGE: ${body.message}`
161
233
  );
162
234
  this.body = body;
163
- this.name = "ResizeVmRootfsShrinkNotSupportedError";
235
+ this.name = "UserUidOutOfRangeError";
164
236
  }
165
- static code = "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED";
237
+ static code = "USER_UID_OUT_OF_RANGE";
166
238
  static statusCode = 400;
167
- static description = `Rootfs shrink is not supported (current={current_mb}MiB, requested={requested_mb}MiB)`;
239
+ static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
168
240
  }
169
- class ResizeVmEmptyRequestError extends Error {
241
+ class UserHomeInvalidError extends Error {
170
242
  constructor(body) {
171
243
  super(
172
- `RESIZE_VM_EMPTY_REQUEST: ${body.message}`
244
+ `USER_HOME_INVALID: ${body.message}`
173
245
  );
174
246
  this.body = body;
175
- this.name = "ResizeVmEmptyRequestError";
247
+ this.name = "UserHomeInvalidError";
176
248
  }
177
- static code = "RESIZE_VM_EMPTY_REQUEST";
249
+ static code = "USER_HOME_INVALID";
178
250
  static statusCode = 400;
179
- static description = `Resize request must specify at least one of vcpuCount, memSizeMb, or rootfsSizeMb`;
251
+ static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
180
252
  }
181
- class ExecTimedOutError extends Error {
253
+ class UserShellInvalidError extends Error {
182
254
  constructor(body) {
183
255
  super(
184
- `EXEC_TIMED_OUT: ${body.message}`
256
+ `USER_SHELL_INVALID: ${body.message}`
185
257
  );
186
258
  this.body = body;
187
- this.name = "ExecTimedOutError";
259
+ this.name = "UserShellInvalidError";
188
260
  }
189
- static code = "EXEC_TIMED_OUT";
190
- static statusCode = 408;
191
- static description = `Command timed out after {timeout_ms}ms`;
261
+ static code = "USER_SHELL_INVALID";
262
+ static statusCode = 400;
263
+ static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
264
+ }
265
+ class DuplicateGroupNameError extends Error {
266
+ constructor(body) {
267
+ super(
268
+ `DUPLICATE_GROUP_NAME: ${body.message}`
269
+ );
270
+ this.body = body;
271
+ this.name = "DuplicateGroupNameError";
272
+ }
273
+ static code = "DUPLICATE_GROUP_NAME";
274
+ static statusCode = 400;
275
+ static description = `Duplicate group name '{name}' found`;
276
+ }
277
+ class GroupNameReservedError extends Error {
278
+ constructor(body) {
279
+ super(
280
+ `GROUP_NAME_RESERVED: ${body.message}`
281
+ );
282
+ this.body = body;
283
+ this.name = "GroupNameReservedError";
284
+ }
285
+ static code = "GROUP_NAME_RESERVED";
286
+ static statusCode = 400;
287
+ static description = `Group name '{name}' is reserved and cannot be used`;
288
+ }
289
+ class GroupNameInvalidCharsError extends Error {
290
+ constructor(body) {
291
+ super(
292
+ `GROUP_NAME_INVALID_CHARS: ${body.message}`
293
+ );
294
+ this.body = body;
295
+ this.name = "GroupNameInvalidCharsError";
296
+ }
297
+ static code = "GROUP_NAME_INVALID_CHARS";
298
+ static statusCode = 400;
299
+ static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
300
+ }
301
+ class GroupNameTooLongError extends Error {
302
+ constructor(body) {
303
+ super(
304
+ `GROUP_NAME_TOO_LONG: ${body.message}`
305
+ );
306
+ this.body = body;
307
+ this.name = "GroupNameTooLongError";
308
+ }
309
+ static code = "GROUP_NAME_TOO_LONG";
310
+ static statusCode = 400;
311
+ static description = `Group name '{name}' is too long (max {max_length} characters)`;
312
+ }
313
+ class GroupNameEmptyError extends Error {
314
+ constructor(body) {
315
+ super(
316
+ `GROUP_NAME_EMPTY: ${body.message}`
317
+ );
318
+ this.body = body;
319
+ this.name = "GroupNameEmptyError";
320
+ }
321
+ static code = "GROUP_NAME_EMPTY";
322
+ static statusCode = 400;
323
+ static description = `Group name cannot be empty`;
192
324
  }
193
325
  class NoDefaultSnapshotAvailableError extends Error {
194
326
  constructor(body) {
@@ -274,77 +406,101 @@ class GetDefaultSnapshotFailedError extends Error {
274
406
  static statusCode = 500;
275
407
  static description = `Failed to query account default snapshot for account {account_id}: {details}`;
276
408
  }
277
- class VmOperationDeniedDuringTransactionError extends Error {
409
+ class VmNotFoundInFsError extends Error {
278
410
  constructor(body) {
279
411
  super(
280
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
412
+ `VM_NOT_FOUND_IN_FS: ${body.message}`
281
413
  );
282
414
  this.body = body;
283
- this.name = "VmOperationDeniedDuringTransactionError";
415
+ this.name = "VmNotFoundInFsError";
284
416
  }
285
- static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
286
- static statusCode = 409;
287
- static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
417
+ static code = "VM_NOT_FOUND_IN_FS";
418
+ static statusCode = 406;
419
+ static description = `Vm Not found in filesystem`;
288
420
  }
289
- class VmTransactionIdMismatchError extends Error {
421
+ class DatabaseErrorError extends Error {
290
422
  constructor(body) {
291
423
  super(
292
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
424
+ `DATABASE_ERROR: ${body.message}`
293
425
  );
294
426
  this.body = body;
295
- this.name = "VmTransactionIdMismatchError";
427
+ this.name = "DatabaseErrorError";
296
428
  }
297
- static code = "VM_TRANSACTION_ID_MISMATCH";
298
- static statusCode = 400;
299
- static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
429
+ static code = "DATABASE_ERROR";
430
+ static statusCode = 500;
431
+ static description = `Database error occurred while constructing VmRecord, details: {details}`;
300
432
  }
301
- class VmNotInTransactionError extends Error {
433
+ class InvalidVmIdError extends Error {
302
434
  constructor(body) {
303
435
  super(
304
- `VM_NOT_IN_TRANSACTION: ${body.message}`
436
+ `INVALID_VM_ID: ${body.message}`
305
437
  );
306
438
  this.body = body;
307
- this.name = "VmNotInTransactionError";
439
+ this.name = "InvalidVmIdError";
308
440
  }
309
- static code = "VM_NOT_IN_TRANSACTION";
310
- static statusCode = 404;
311
- static description = `VM not in a transaction: {vm_id}`;
441
+ static code = "INVALID_VM_ID";
442
+ static statusCode = 400;
443
+ static description = `Invalid VM ID: {vm_id}, details: {details}`;
312
444
  }
313
- class ConflictingSpecSourcesErrorError extends Error {
445
+ class VmDeletedError extends Error {
314
446
  constructor(body) {
315
447
  super(
316
- `CONFLICTING_SPEC_SOURCES_ERROR: ${body.message}`
448
+ `VM_DELETED: ${body.message}`
317
449
  );
318
450
  this.body = body;
319
- this.name = "ConflictingSpecSourcesErrorError";
451
+ this.name = "VmDeletedError";
320
452
  }
321
- static code = "CONFLICTING_SPEC_SOURCES_ERROR";
322
- static statusCode = 400;
323
- static description = `Spec layer at depth {depth} has conflicting base sources \`{field_a}\` and \`{field_b}\`; each layer may set at most one of \`snapshot\`, \`snapshotId\`, \`baseImage\``;
453
+ static code = "VM_DELETED";
454
+ static statusCode = 500;
455
+ static description = `Vm {vm_id} is marked as deleted but still exists in the database`;
324
456
  }
325
- class NonLeafLayerFieldErrorError extends Error {
457
+ class VmNotRunningError extends Error {
326
458
  constructor(body) {
327
459
  super(
328
- `NON_LEAF_LAYER_FIELD_ERROR: ${body.message}`
460
+ `VM_NOT_RUNNING: ${body.message}`
329
461
  );
330
462
  this.body = body;
331
- this.name = "NonLeafLayerFieldErrorError";
463
+ this.name = "VmNotRunningError";
332
464
  }
333
- static code = "NON_LEAF_LAYER_FIELD_ERROR";
465
+ static code = "VM_NOT_RUNNING";
334
466
  static statusCode = 400;
335
- static description = `Field \`{field}\` may only be set on the innermost spec layer; found on a non-leaf layer at depth {depth} (0 = outermost)`;
467
+ static description = `Stopped VM not running`;
336
468
  }
337
- class InvalidGitRepoSpecErrorError extends Error {
469
+ class ActiveTransactionErrorError extends Error {
338
470
  constructor(body) {
339
471
  super(
340
- `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
472
+ `ACTIVE_TRANSACTION_ERROR: ${body.message}`
341
473
  );
342
474
  this.body = body;
343
- this.name = "InvalidGitRepoSpecErrorError";
475
+ this.name = "ActiveTransactionErrorError";
344
476
  }
345
- static code = "INVALID_GIT_REPO_SPEC_ERROR";
477
+ static code = "ACTIVE_TRANSACTION_ERROR";
478
+ static statusCode = 500;
479
+ static description = `Active transaction error: {details}`;
480
+ }
481
+ class SwapVmTapError extends Error {
482
+ constructor(body) {
483
+ super(
484
+ `SWAP_VM_TAP: ${body.message}`
485
+ );
486
+ this.body = body;
487
+ this.name = "SwapVmTapError";
488
+ }
489
+ static code = "SWAP_VM_TAP";
490
+ static statusCode = 500;
491
+ static description = `Failed to swap tap device: {details}`;
492
+ }
493
+ class PreassignedVmIdCountMismatchError extends Error {
494
+ constructor(body) {
495
+ super(
496
+ `PREASSIGNED_VM_ID_COUNT_MISMATCH: ${body.message}`
497
+ );
498
+ this.body = body;
499
+ this.name = "PreassignedVmIdCountMismatchError";
500
+ }
501
+ static code = "PREASSIGNED_VM_ID_COUNT_MISMATCH";
346
502
  static statusCode = 400;
347
- static description = `Cannot specify both root-level \`gitRepos\` and \`git.repos\`. Prefer \`git.repos\`.`;
503
+ static description = `Pre-provisioned vm_ids length ({provided}) must match fork count ({count})`;
348
504
  }
349
505
  class InternalErrorError extends Error {
350
506
  constructor(body) {
@@ -356,307 +512,355 @@ class InternalErrorError extends Error {
356
512
  }
357
513
  static code = "INTERNAL_ERROR";
358
514
  static statusCode = 500;
359
- static description = `Internal error: {message}`;
515
+ static description = `Fork failed: {message}`;
360
516
  }
361
- class ForkVmNotFoundError extends Error {
517
+ class RootfsCopyErrorError extends Error {
362
518
  constructor(body) {
363
519
  super(
364
- `FORK_VM_NOT_FOUND: ${body.message}`
520
+ `ROOTFS_COPY_ERROR: ${body.message}`
365
521
  );
366
522
  this.body = body;
367
- this.name = "ForkVmNotFoundError";
523
+ this.name = "RootfsCopyErrorError";
368
524
  }
369
- static code = "FORK_VM_NOT_FOUND";
525
+ static code = "ROOTFS_COPY_ERROR";
526
+ static statusCode = 500;
527
+ static description = `Failed to copy rootfs from {from} to {to}: {details}`;
528
+ }
529
+ class FileNotFoundError extends Error {
530
+ constructor(body) {
531
+ super(
532
+ `FILE_NOT_FOUND: ${body.message}`
533
+ );
534
+ this.body = body;
535
+ this.name = "FileNotFoundError";
536
+ }
537
+ static code = "FILE_NOT_FOUND";
370
538
  static statusCode = 404;
371
- static description = `Fork VM not found: {fork_vm_id}`;
539
+ static description = `File not found: {path}`;
372
540
  }
373
- class CreateSnapshotBadRequestError extends Error {
541
+ class FilesBadRequestError extends Error {
374
542
  constructor(body) {
375
543
  super(
376
- `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
544
+ `FILES_BAD_REQUEST: ${body.message}`
377
545
  );
378
546
  this.body = body;
379
- this.name = "CreateSnapshotBadRequestError";
547
+ this.name = "FilesBadRequestError";
380
548
  }
381
- static code = "CREATE_SNAPSHOT_BAD_REQUEST";
549
+ static code = "FILES_BAD_REQUEST";
382
550
  static statusCode = 400;
383
551
  static description = `Bad request: {message}`;
384
552
  }
385
- class UserNotFoundError extends Error {
553
+ class VmNotFoundError extends Error {
386
554
  constructor(body) {
387
555
  super(
388
- `USER_NOT_FOUND: ${body.message}`
556
+ `VM_NOT_FOUND: ${body.message}`
389
557
  );
390
558
  this.body = body;
391
- this.name = "UserNotFoundError";
559
+ this.name = "VmNotFoundError";
392
560
  }
393
- static code = "USER_NOT_FOUND";
561
+ static code = "VM_NOT_FOUND";
394
562
  static statusCode = 404;
395
- static description = `User not found: {user_name}`;
563
+ static description = `VM not found: {vm_id}`;
396
564
  }
397
- class UserAlreadyExistsError extends Error {
565
+ class InternalForkVmNotFoundError extends Error {
398
566
  constructor(body) {
399
567
  super(
400
- `USER_ALREADY_EXISTS: ${body.message}`
568
+ `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
401
569
  );
402
570
  this.body = body;
403
- this.name = "UserAlreadyExistsError";
571
+ this.name = "InternalForkVmNotFoundError";
404
572
  }
405
- static code = "USER_ALREADY_EXISTS";
406
- static statusCode = 409;
407
- static description = `Conflict: User '{user_name}' already exists`;
573
+ static code = "INTERNAL_FORK_VM_NOT_FOUND";
574
+ static statusCode = 404;
575
+ static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
408
576
  }
409
- class ValidationErrorError extends Error {
577
+ class BadRequestError extends Error {
410
578
  constructor(body) {
411
579
  super(
412
- `VALIDATION_ERROR: ${body.message}`
580
+ `BAD_REQUEST: ${body.message}`
413
581
  );
414
582
  this.body = body;
415
- this.name = "ValidationErrorError";
583
+ this.name = "BadRequestError";
416
584
  }
417
- static code = "VALIDATION_ERROR";
585
+ static code = "BAD_REQUEST";
418
586
  static statusCode = 400;
419
- static description = `Validation error: {message}`;
587
+ static description = `Bad request: {message}`;
420
588
  }
421
- class GroupNotFoundError extends Error {
589
+ class InternalVmNotFoundError extends Error {
422
590
  constructor(body) {
423
591
  super(
424
- `GROUP_NOT_FOUND: ${body.message}`
592
+ `INTERNAL_VM_NOT_FOUND: ${body.message}`
425
593
  );
426
594
  this.body = body;
427
- this.name = "GroupNotFoundError";
595
+ this.name = "InternalVmNotFoundError";
428
596
  }
429
- static code = "GROUP_NOT_FOUND";
597
+ static code = "INTERNAL_VM_NOT_FOUND";
430
598
  static statusCode = 404;
431
- static description = `Group not found: {group_name}`;
599
+ static description = `VM not found: {vm_id}`;
432
600
  }
433
- class GroupAlreadyExistsError extends Error {
601
+ class SnapshotIsAccountDefaultError extends Error {
434
602
  constructor(body) {
435
603
  super(
436
- `GROUP_ALREADY_EXISTS: ${body.message}`
604
+ `SNAPSHOT_IS_ACCOUNT_DEFAULT: ${body.message}`
437
605
  );
438
606
  this.body = body;
439
- this.name = "GroupAlreadyExistsError";
607
+ this.name = "SnapshotIsAccountDefaultError";
440
608
  }
441
- static code = "GROUP_ALREADY_EXISTS";
609
+ static code = "SNAPSHOT_IS_ACCOUNT_DEFAULT";
442
610
  static statusCode = 409;
443
- static description = `Conflict: Group '{group_name}' already exists`;
611
+ static description = `Snapshot is the account default and cannot be deleted: {snapshot_id}`;
444
612
  }
445
- class DuplicateUserNameError extends Error {
613
+ class SnapshotAlreadyDeletedError extends Error {
446
614
  constructor(body) {
447
615
  super(
448
- `DUPLICATE_USER_NAME: ${body.message}`
616
+ `SNAPSHOT_ALREADY_DELETED: ${body.message}`
449
617
  );
450
618
  this.body = body;
451
- this.name = "DuplicateUserNameError";
619
+ this.name = "SnapshotAlreadyDeletedError";
452
620
  }
453
- static code = "DUPLICATE_USER_NAME";
454
- static statusCode = 400;
455
- static description = `Duplicate user name '{name}' found`;
621
+ static code = "SNAPSHOT_ALREADY_DELETED";
622
+ static statusCode = 409;
623
+ static description = `Snapshot already deleted: {snapshot_id}`;
456
624
  }
457
- class UserGroupEmptyError extends Error {
625
+ class SnapshotNotFoundError extends Error {
458
626
  constructor(body) {
459
627
  super(
460
- `USER_GROUP_EMPTY: ${body.message}`
628
+ `SNAPSHOT_NOT_FOUND: ${body.message}`
461
629
  );
462
630
  this.body = body;
463
- this.name = "UserGroupEmptyError";
631
+ this.name = "SnapshotNotFoundError";
464
632
  }
465
- static code = "USER_GROUP_EMPTY";
466
- static statusCode = 400;
467
- static description = `User '{user}' has empty string in groups`;
633
+ static code = "SNAPSHOT_NOT_FOUND";
634
+ static statusCode = 404;
635
+ static description = `Snapshot not found: {snapshot_id}`;
468
636
  }
469
- class UserSystemFlagMismatchError extends Error {
637
+ class SnapshotSetupFailedError extends Error {
470
638
  constructor(body) {
471
639
  super(
472
- `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
640
+ `SNAPSHOT_SETUP_FAILED: ${body.message}`
473
641
  );
474
642
  this.body = body;
475
- this.name = "UserSystemFlagMismatchError";
643
+ this.name = "SnapshotSetupFailedError";
476
644
  }
477
- static code = "USER_SYSTEM_FLAG_MISMATCH";
478
- static statusCode = 400;
479
- static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
645
+ static code = "SNAPSHOT_SETUP_FAILED";
646
+ static statusCode = 500;
647
+ static description = `Snapshot setup failed: {failed_reason}`;
480
648
  }
481
- class UserUidOutOfRangeError extends Error {
649
+ class SnapshotVmBadRequestError extends Error {
482
650
  constructor(body) {
483
651
  super(
484
- `USER_UID_OUT_OF_RANGE: ${body.message}`
652
+ `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
485
653
  );
486
654
  this.body = body;
487
- this.name = "UserUidOutOfRangeError";
655
+ this.name = "SnapshotVmBadRequestError";
488
656
  }
489
- static code = "USER_UID_OUT_OF_RANGE";
657
+ static code = "SNAPSHOT_VM_BAD_REQUEST";
490
658
  static statusCode = 400;
491
- static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
659
+ static description = `Bad request: {message}`;
492
660
  }
493
- class UserHomeInvalidError extends Error {
661
+ class StartingHandleInstanceIdMismatchError extends Error {
494
662
  constructor(body) {
495
663
  super(
496
- `USER_HOME_INVALID: ${body.message}`
664
+ `STARTING_HANDLE_INSTANCE_ID_MISMATCH: ${body.message}`
497
665
  );
498
666
  this.body = body;
499
- this.name = "UserHomeInvalidError";
667
+ this.name = "StartingHandleInstanceIdMismatchError";
500
668
  }
501
- static code = "USER_HOME_INVALID";
502
- static statusCode = 400;
503
- static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
669
+ static code = "STARTING_HANDLE_INSTANCE_ID_MISMATCH";
670
+ static statusCode = 409;
671
+ static description = `Starting handle for VM {vm_id} is held by instance {actual_instance_id}, not {provided_instance_id}`;
504
672
  }
505
- class UserShellInvalidError extends Error {
673
+ class SuspendFailedAndStopFailedError extends Error {
506
674
  constructor(body) {
507
675
  super(
508
- `USER_SHELL_INVALID: ${body.message}`
676
+ `SUSPEND_FAILED_AND_STOP_FAILED: ${body.message}`
509
677
  );
510
678
  this.body = body;
511
- this.name = "UserShellInvalidError";
679
+ this.name = "SuspendFailedAndStopFailedError";
512
680
  }
513
- static code = "USER_SHELL_INVALID";
514
- static statusCode = 400;
515
- static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
681
+ static code = "SUSPEND_FAILED_AND_STOP_FAILED";
682
+ static statusCode = 500;
683
+ static description = `Failed to gracefully suspend or stop VM`;
516
684
  }
517
- class DuplicateGroupNameError extends Error {
685
+ class SuspendFailedAndStoppedError extends Error {
518
686
  constructor(body) {
519
687
  super(
520
- `DUPLICATE_GROUP_NAME: ${body.message}`
688
+ `SUSPEND_FAILED_AND_STOPPED: ${body.message}`
521
689
  );
522
690
  this.body = body;
523
- this.name = "DuplicateGroupNameError";
691
+ this.name = "SuspendFailedAndStoppedError";
524
692
  }
525
- static code = "DUPLICATE_GROUP_NAME";
526
- static statusCode = 400;
527
- static description = `Duplicate group name '{name}' found`;
693
+ static code = "SUSPEND_FAILED_AND_STOPPED";
694
+ static statusCode = 500;
695
+ static description = `Failed to gracefully suspend, stopped VM`;
528
696
  }
529
- class GroupNameReservedError extends Error {
697
+ class ResizeVmMemNotPowerOfTwoError extends Error {
530
698
  constructor(body) {
531
699
  super(
532
- `GROUP_NAME_RESERVED: ${body.message}`
700
+ `RESIZE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
533
701
  );
534
702
  this.body = body;
535
- this.name = "GroupNameReservedError";
703
+ this.name = "ResizeVmMemNotPowerOfTwoError";
536
704
  }
537
- static code = "GROUP_NAME_RESERVED";
705
+ static code = "RESIZE_VM_MEM_NOT_POWER_OF_TWO";
538
706
  static statusCode = 400;
539
- static description = `Group name '{name}' is reserved and cannot be used`;
707
+ static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
540
708
  }
541
- class GroupNameInvalidCharsError extends Error {
709
+ class ResizeVmVcpuNotPowerOfTwoError extends Error {
542
710
  constructor(body) {
543
711
  super(
544
- `GROUP_NAME_INVALID_CHARS: ${body.message}`
712
+ `RESIZE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
545
713
  );
546
714
  this.body = body;
547
- this.name = "GroupNameInvalidCharsError";
715
+ this.name = "ResizeVmVcpuNotPowerOfTwoError";
548
716
  }
549
- static code = "GROUP_NAME_INVALID_CHARS";
717
+ static code = "RESIZE_VM_VCPU_NOT_POWER_OF_TWO";
550
718
  static statusCode = 400;
551
- static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
719
+ static description = `vcpuCount must be a power of two (got {got})`;
552
720
  }
553
- class GroupNameTooLongError extends Error {
721
+ class ResizeVmMemOutOfRangeError extends Error {
554
722
  constructor(body) {
555
723
  super(
556
- `GROUP_NAME_TOO_LONG: ${body.message}`
724
+ `RESIZE_VM_MEM_OUT_OF_RANGE: ${body.message}`
557
725
  );
558
726
  this.body = body;
559
- this.name = "GroupNameTooLongError";
727
+ this.name = "ResizeVmMemOutOfRangeError";
560
728
  }
561
- static code = "GROUP_NAME_TOO_LONG";
729
+ static code = "RESIZE_VM_MEM_OUT_OF_RANGE";
562
730
  static statusCode = 400;
563
- static description = `Group name '{name}' is too long (max {max_length} characters)`;
731
+ static description = `memSizeMb out of range (got {got}MiB, allowed {min}..={max} MiB)`;
564
732
  }
565
- class GroupNameEmptyError extends Error {
733
+ class ResizeVmVcpuOutOfRangeError extends Error {
566
734
  constructor(body) {
567
735
  super(
568
- `GROUP_NAME_EMPTY: ${body.message}`
736
+ `RESIZE_VM_VCPU_OUT_OF_RANGE: ${body.message}`
569
737
  );
570
738
  this.body = body;
571
- this.name = "GroupNameEmptyError";
739
+ this.name = "ResizeVmVcpuOutOfRangeError";
572
740
  }
573
- static code = "GROUP_NAME_EMPTY";
741
+ static code = "RESIZE_VM_VCPU_OUT_OF_RANGE";
574
742
  static statusCode = 400;
575
- static description = `Group name cannot be empty`;
743
+ static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
576
744
  }
577
- class VmNotFoundInFsError extends Error {
745
+ class ResizeVmRootfsShrinkNotSupportedError extends Error {
578
746
  constructor(body) {
579
747
  super(
580
- `VM_NOT_FOUND_IN_FS: ${body.message}`
748
+ `RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED: ${body.message}`
581
749
  );
582
750
  this.body = body;
583
- this.name = "VmNotFoundInFsError";
751
+ this.name = "ResizeVmRootfsShrinkNotSupportedError";
584
752
  }
585
- static code = "VM_NOT_FOUND_IN_FS";
586
- static statusCode = 406;
587
- static description = `Vm Not found in filesystem`;
753
+ static code = "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED";
754
+ static statusCode = 400;
755
+ static description = `Rootfs shrink is not supported (current={current_mb}MiB, requested={requested_mb}MiB)`;
588
756
  }
589
- class VmNotRunningError extends Error {
757
+ class ResizeVmEmptyRequestError extends Error {
590
758
  constructor(body) {
591
759
  super(
592
- `VM_NOT_RUNNING: ${body.message}`
760
+ `RESIZE_VM_EMPTY_REQUEST: ${body.message}`
593
761
  );
594
762
  this.body = body;
595
- this.name = "VmNotRunningError";
763
+ this.name = "ResizeVmEmptyRequestError";
596
764
  }
597
- static code = "VM_NOT_RUNNING";
765
+ static code = "RESIZE_VM_EMPTY_REQUEST";
598
766
  static statusCode = 400;
599
- static description = `VM is not running: {vm_id}`;
767
+ static description = `Resize request must specify at least one of vcpuCount, memSizeMb, or rootfsSizeMb`;
600
768
  }
601
- class VmNotFoundError extends Error {
769
+ class ExecTimedOutError extends Error {
602
770
  constructor(body) {
603
771
  super(
604
- `VM_NOT_FOUND: ${body.message}`
772
+ `EXEC_TIMED_OUT: ${body.message}`
605
773
  );
606
774
  this.body = body;
607
- this.name = "VmNotFoundError";
775
+ this.name = "ExecTimedOutError";
608
776
  }
609
- static code = "VM_NOT_FOUND";
610
- static statusCode = 404;
611
- static description = `VM not found: {vm_id}`;
777
+ static code = "EXEC_TIMED_OUT";
778
+ static statusCode = 408;
779
+ static description = `Command timed out after {timeout_ms}ms`;
612
780
  }
613
- class InternalForkVmNotFoundError extends Error {
781
+ class ConflictingSpecSourcesErrorError extends Error {
614
782
  constructor(body) {
615
783
  super(
616
- `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
784
+ `CONFLICTING_SPEC_SOURCES_ERROR: ${body.message}`
617
785
  );
618
786
  this.body = body;
619
- this.name = "InternalForkVmNotFoundError";
787
+ this.name = "ConflictingSpecSourcesErrorError";
620
788
  }
621
- static code = "INTERNAL_FORK_VM_NOT_FOUND";
789
+ static code = "CONFLICTING_SPEC_SOURCES_ERROR";
790
+ static statusCode = 400;
791
+ static description = `Spec layer at depth {depth} has conflicting base sources \`{field_a}\` and \`{field_b}\`; each layer may set at most one of \`snapshot\`, \`snapshotId\`, \`baseImage\``;
792
+ }
793
+ class NonLeafLayerFieldErrorError extends Error {
794
+ constructor(body) {
795
+ super(
796
+ `NON_LEAF_LAYER_FIELD_ERROR: ${body.message}`
797
+ );
798
+ this.body = body;
799
+ this.name = "NonLeafLayerFieldErrorError";
800
+ }
801
+ static code = "NON_LEAF_LAYER_FIELD_ERROR";
802
+ static statusCode = 400;
803
+ static description = `Field \`{field}\` may only be set on the innermost spec layer; found on a non-leaf layer at depth {depth} (0 = outermost)`;
804
+ }
805
+ class InvalidGitRepoSpecErrorError extends Error {
806
+ constructor(body) {
807
+ super(
808
+ `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
809
+ );
810
+ this.body = body;
811
+ this.name = "InvalidGitRepoSpecErrorError";
812
+ }
813
+ static code = "INVALID_GIT_REPO_SPEC_ERROR";
814
+ static statusCode = 400;
815
+ static description = `Cannot specify both root-level \`gitRepos\` and \`git.repos\`. Prefer \`git.repos\`.`;
816
+ }
817
+ class ForkVmNotFoundError extends Error {
818
+ constructor(body) {
819
+ super(
820
+ `FORK_VM_NOT_FOUND: ${body.message}`
821
+ );
822
+ this.body = body;
823
+ this.name = "ForkVmNotFoundError";
824
+ }
825
+ static code = "FORK_VM_NOT_FOUND";
622
826
  static statusCode = 404;
623
- static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
827
+ static description = `Fork VM not found: {fork_vm_id}`;
624
828
  }
625
- class BadRequestError extends Error {
829
+ class CreateSnapshotBadRequestError extends Error {
626
830
  constructor(body) {
627
831
  super(
628
- `BAD_REQUEST: ${body.message}`
832
+ `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
629
833
  );
630
834
  this.body = body;
631
- this.name = "BadRequestError";
835
+ this.name = "CreateSnapshotBadRequestError";
632
836
  }
633
- static code = "BAD_REQUEST";
837
+ static code = "CREATE_SNAPSHOT_BAD_REQUEST";
634
838
  static statusCode = 400;
635
839
  static description = `Bad request: {message}`;
636
840
  }
637
- class InternalVmNotFoundError extends Error {
841
+ class UnsupportedOsError extends Error {
638
842
  constructor(body) {
639
843
  super(
640
- `INTERNAL_VM_NOT_FOUND: ${body.message}`
844
+ `UNSUPPORTED_OS: ${body.message}`
641
845
  );
642
846
  this.body = body;
643
- this.name = "InternalVmNotFoundError";
847
+ this.name = "UnsupportedOsError";
644
848
  }
645
- static code = "INTERNAL_VM_NOT_FOUND";
646
- static statusCode = 404;
647
- static description = `VM not found: {vm_id}`;
849
+ static code = "UNSUPPORTED_OS";
850
+ static statusCode = 400;
851
+ static description = `Unsupported base image OS: {os}`;
648
852
  }
649
- class SnapshotNotFoundError extends Error {
853
+ class BuildFailedError extends Error {
650
854
  constructor(body) {
651
855
  super(
652
- `SNAPSHOT_NOT_FOUND: ${body.message}`
856
+ `BUILD_FAILED: ${body.message}`
653
857
  );
654
858
  this.body = body;
655
- this.name = "SnapshotNotFoundError";
859
+ this.name = "BuildFailedError";
656
860
  }
657
- static code = "SNAPSHOT_NOT_FOUND";
658
- static statusCode = 404;
659
- static description = `Snapshot not found: {snapshot_id}`;
861
+ static code = "BUILD_FAILED";
862
+ static statusCode = 400;
863
+ static description = `Dockerfile build failed (exit {exit_code})`;
660
864
  }
661
865
  class ResumedVmNonResponsiveError extends Error {
662
866
  constructor(body) {
@@ -706,18 +910,6 @@ class KernelPanicError extends Error {
706
910
  static statusCode = 500;
707
911
  static description = `VM kernel panic detected`;
708
912
  }
709
- class VmDeletedError extends Error {
710
- constructor(body) {
711
- super(
712
- `VM_DELETED: ${body.message}`
713
- );
714
- this.body = body;
715
- this.name = "VmDeletedError";
716
- }
717
- static code = "VM_DELETED";
718
- static statusCode = 410;
719
- static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
720
- }
721
913
  class ReqwestError extends Error {
722
914
  constructor(body) {
723
915
  super(
@@ -850,298 +1042,154 @@ class VmSubnetNotFoundError extends Error {
850
1042
  static statusCode = 500;
851
1043
  static description = `Subnet for VM not found`;
852
1044
  }
853
- class PartitionNotFoundError extends Error {
1045
+ class CreateVmMemNotPowerOfTwoError extends Error {
854
1046
  constructor(body) {
855
1047
  super(
856
- `PARTITION_NOT_FOUND: ${body.message}`
1048
+ `CREATE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
857
1049
  );
858
1050
  this.body = body;
859
- this.name = "PartitionNotFoundError";
1051
+ this.name = "CreateVmMemNotPowerOfTwoError";
860
1052
  }
861
- static code = "PARTITION_NOT_FOUND";
862
- static statusCode = 404;
863
- static description = `Partition not found: {partition_id}`;
1053
+ static code = "CREATE_VM_MEM_NOT_POWER_OF_TWO";
1054
+ static statusCode = 400;
1055
+ static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
864
1056
  }
865
- class ActiveTransactionErrorError extends Error {
1057
+ class CreateVmVcpuNotPowerOfTwoError extends Error {
866
1058
  constructor(body) {
867
1059
  super(
868
- `ACTIVE_TRANSACTION_ERROR: ${body.message}`
1060
+ `CREATE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
869
1061
  );
870
1062
  this.body = body;
871
- this.name = "ActiveTransactionErrorError";
1063
+ this.name = "CreateVmVcpuNotPowerOfTwoError";
872
1064
  }
873
- static code = "ACTIVE_TRANSACTION_ERROR";
874
- static statusCode = 500;
875
- static description = `Active transaction error: {details}`;
1065
+ static code = "CREATE_VM_VCPU_NOT_POWER_OF_TWO";
1066
+ static statusCode = 400;
1067
+ static description = `vcpuCount must be a power of two (got {got})`;
876
1068
  }
877
- class SwapVmTapError extends Error {
1069
+ class CreateVmRootfsOutOfRangeError extends Error {
878
1070
  constructor(body) {
879
1071
  super(
880
- `SWAP_VM_TAP: ${body.message}`
1072
+ `CREATE_VM_ROOTFS_OUT_OF_RANGE: ${body.message}`
881
1073
  );
882
1074
  this.body = body;
883
- this.name = "SwapVmTapError";
1075
+ this.name = "CreateVmRootfsOutOfRangeError";
884
1076
  }
885
- static code = "SWAP_VM_TAP";
886
- static statusCode = 500;
887
- static description = `Failed to swap tap device: {details}`;
1077
+ static code = "CREATE_VM_ROOTFS_OUT_OF_RANGE";
1078
+ static statusCode = 400;
1079
+ static description = `rootfsSizeMb out of range (got {got} MB, allowed {min}..={max} MB)`;
888
1080
  }
889
- class RootfsCopyErrorError extends Error {
1081
+ class CreateVmMemOutOfRangeError extends Error {
890
1082
  constructor(body) {
891
1083
  super(
892
- `ROOTFS_COPY_ERROR: ${body.message}`
1084
+ `CREATE_VM_MEM_OUT_OF_RANGE: ${body.message}`
893
1085
  );
894
1086
  this.body = body;
895
- this.name = "RootfsCopyErrorError";
1087
+ this.name = "CreateVmMemOutOfRangeError";
896
1088
  }
897
- static code = "ROOTFS_COPY_ERROR";
898
- static statusCode = 500;
899
- static description = `Failed to copy rootfs from {from} to {to}: {details}`;
1089
+ static code = "CREATE_VM_MEM_OUT_OF_RANGE";
1090
+ static statusCode = 400;
1091
+ static description = `memSizeMb out of range (got {got} MiB, allowed {min}..={max} MiB)`;
900
1092
  }
901
- class FileNotFoundError extends Error {
1093
+ class CreateVmVcpuOutOfRangeError extends Error {
902
1094
  constructor(body) {
903
1095
  super(
904
- `FILE_NOT_FOUND: ${body.message}`
1096
+ `CREATE_VM_VCPU_OUT_OF_RANGE: ${body.message}`
905
1097
  );
906
1098
  this.body = body;
907
- this.name = "FileNotFoundError";
1099
+ this.name = "CreateVmVcpuOutOfRangeError";
908
1100
  }
909
- static code = "FILE_NOT_FOUND";
910
- static statusCode = 404;
911
- static description = `File not found: {path}`;
1101
+ static code = "CREATE_VM_VCPU_OUT_OF_RANGE";
1102
+ static statusCode = 400;
1103
+ static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
912
1104
  }
913
- class FilesBadRequestError extends Error {
1105
+ class CreateVmBadRequestError extends Error {
914
1106
  constructor(body) {
915
1107
  super(
916
- `FILES_BAD_REQUEST: ${body.message}`
1108
+ `CREATE_VM_BAD_REQUEST: ${body.message}`
917
1109
  );
918
1110
  this.body = body;
919
- this.name = "FilesBadRequestError";
1111
+ this.name = "CreateVmBadRequestError";
920
1112
  }
921
- static code = "FILES_BAD_REQUEST";
1113
+ static code = "CREATE_VM_BAD_REQUEST";
922
1114
  static statusCode = 400;
923
1115
  static description = `Bad request: {message}`;
924
1116
  }
925
- class SnapshotIsAccountDefaultError extends Error {
1117
+ class VmSetupFailedError extends Error {
926
1118
  constructor(body) {
927
1119
  super(
928
- `SNAPSHOT_IS_ACCOUNT_DEFAULT: ${body.message}`
1120
+ `VM_SETUP_FAILED: ${body.message}`
929
1121
  );
930
1122
  this.body = body;
931
- this.name = "SnapshotIsAccountDefaultError";
1123
+ this.name = "VmSetupFailedError";
932
1124
  }
933
- static code = "SNAPSHOT_IS_ACCOUNT_DEFAULT";
934
- static statusCode = 409;
935
- static description = `Snapshot is the account default and cannot be deleted: {snapshot_id}`;
1125
+ static code = "VM_SETUP_FAILED";
1126
+ static statusCode = 500;
1127
+ static description = `VM setup failed: {failed_reason}`;
936
1128
  }
937
- class SnapshotAlreadyDeletedError extends Error {
1129
+ class WantedByEmptyError extends Error {
938
1130
  constructor(body) {
939
1131
  super(
940
- `SNAPSHOT_ALREADY_DELETED: ${body.message}`
1132
+ `WANTED_BY_EMPTY: ${body.message}`
941
1133
  );
942
1134
  this.body = body;
943
- this.name = "SnapshotAlreadyDeletedError";
1135
+ this.name = "WantedByEmptyError";
944
1136
  }
945
- static code = "SNAPSHOT_ALREADY_DELETED";
946
- static statusCode = 409;
947
- static description = `Snapshot already deleted: {snapshot_id}`;
1137
+ static code = "WANTED_BY_EMPTY";
1138
+ static statusCode = 400;
1139
+ static description = `wanted_by cannot be empty if provided`;
948
1140
  }
949
- class SuspendFailedAndStopFailedError extends Error {
1141
+ class WorkdirEmptyError extends Error {
950
1142
  constructor(body) {
951
1143
  super(
952
- `SUSPEND_FAILED_AND_STOP_FAILED: ${body.message}`
1144
+ `WORKDIR_EMPTY: ${body.message}`
953
1145
  );
954
1146
  this.body = body;
955
- this.name = "SuspendFailedAndStopFailedError";
1147
+ this.name = "WorkdirEmptyError";
956
1148
  }
957
- static code = "SUSPEND_FAILED_AND_STOP_FAILED";
958
- static statusCode = 500;
959
- static description = `Failed to gracefully suspend or stop VM`;
1149
+ static code = "WORKDIR_EMPTY";
1150
+ static statusCode = 400;
1151
+ static description = `Working directory cannot be empty if provided`;
960
1152
  }
961
- class SuspendFailedAndStoppedError extends Error {
1153
+ class GroupEmptyError extends Error {
962
1154
  constructor(body) {
963
1155
  super(
964
- `SUSPEND_FAILED_AND_STOPPED: ${body.message}`
1156
+ `GROUP_EMPTY: ${body.message}`
965
1157
  );
966
1158
  this.body = body;
967
- this.name = "SuspendFailedAndStoppedError";
1159
+ this.name = "GroupEmptyError";
968
1160
  }
969
- static code = "SUSPEND_FAILED_AND_STOPPED";
970
- static statusCode = 500;
971
- static description = `Failed to gracefully suspend, stopped VM`;
1161
+ static code = "GROUP_EMPTY";
1162
+ static statusCode = 400;
1163
+ static description = `Group cannot be empty if provided`;
972
1164
  }
973
- class DatabaseErrorError extends Error {
1165
+ class UserEmptyError extends Error {
974
1166
  constructor(body) {
975
1167
  super(
976
- `DATABASE_ERROR: ${body.message}`
1168
+ `USER_EMPTY: ${body.message}`
977
1169
  );
978
1170
  this.body = body;
979
- this.name = "DatabaseErrorError";
1171
+ this.name = "UserEmptyError";
980
1172
  }
981
- static code = "DATABASE_ERROR";
982
- static statusCode = 500;
983
- static description = `Database error occurred while constructing VmRecord, details: {details}`;
1173
+ static code = "USER_EMPTY";
1174
+ static statusCode = 400;
1175
+ static description = `User cannot be empty if provided`;
984
1176
  }
985
- class InvalidVmIdError extends Error {
1177
+ class OnFailureArrayContainsEmptyError extends Error {
986
1178
  constructor(body) {
987
1179
  super(
988
- `INVALID_VM_ID: ${body.message}`
1180
+ `ON_FAILURE_ARRAY_CONTAINS_EMPTY: ${body.message}`
989
1181
  );
990
1182
  this.body = body;
991
- this.name = "InvalidVmIdError";
1183
+ this.name = "OnFailureArrayContainsEmptyError";
992
1184
  }
993
- static code = "INVALID_VM_ID";
1185
+ static code = "ON_FAILURE_ARRAY_CONTAINS_EMPTY";
994
1186
  static statusCode = 400;
995
- static description = `Invalid VM ID: {vm_id}, details: {details}`;
1187
+ static description = `'onFailure' array cannot contain empty strings`;
996
1188
  }
997
- class CreateVmMemNotPowerOfTwoError extends Error {
1189
+ class RequiresArrayContainsEmptyError extends Error {
998
1190
  constructor(body) {
999
1191
  super(
1000
- `CREATE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
1001
- );
1002
- this.body = body;
1003
- this.name = "CreateVmMemNotPowerOfTwoError";
1004
- }
1005
- static code = "CREATE_VM_MEM_NOT_POWER_OF_TWO";
1006
- static statusCode = 400;
1007
- static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
1008
- }
1009
- class CreateVmVcpuNotPowerOfTwoError extends Error {
1010
- constructor(body) {
1011
- super(
1012
- `CREATE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
1013
- );
1014
- this.body = body;
1015
- this.name = "CreateVmVcpuNotPowerOfTwoError";
1016
- }
1017
- static code = "CREATE_VM_VCPU_NOT_POWER_OF_TWO";
1018
- static statusCode = 400;
1019
- static description = `vcpuCount must be a power of two (got {got})`;
1020
- }
1021
- class CreateVmRootfsOutOfRangeError extends Error {
1022
- constructor(body) {
1023
- super(
1024
- `CREATE_VM_ROOTFS_OUT_OF_RANGE: ${body.message}`
1025
- );
1026
- this.body = body;
1027
- this.name = "CreateVmRootfsOutOfRangeError";
1028
- }
1029
- static code = "CREATE_VM_ROOTFS_OUT_OF_RANGE";
1030
- static statusCode = 400;
1031
- static description = `rootfsSizeMb out of range (got {got} MB, allowed {min}..={max} MB)`;
1032
- }
1033
- class CreateVmMemOutOfRangeError extends Error {
1034
- constructor(body) {
1035
- super(
1036
- `CREATE_VM_MEM_OUT_OF_RANGE: ${body.message}`
1037
- );
1038
- this.body = body;
1039
- this.name = "CreateVmMemOutOfRangeError";
1040
- }
1041
- static code = "CREATE_VM_MEM_OUT_OF_RANGE";
1042
- static statusCode = 400;
1043
- static description = `memSizeMb out of range (got {got} MiB, allowed {min}..={max} MiB)`;
1044
- }
1045
- class CreateVmVcpuOutOfRangeError extends Error {
1046
- constructor(body) {
1047
- super(
1048
- `CREATE_VM_VCPU_OUT_OF_RANGE: ${body.message}`
1049
- );
1050
- this.body = body;
1051
- this.name = "CreateVmVcpuOutOfRangeError";
1052
- }
1053
- static code = "CREATE_VM_VCPU_OUT_OF_RANGE";
1054
- static statusCode = 400;
1055
- static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
1056
- }
1057
- class CreateVmBadRequestError extends Error {
1058
- constructor(body) {
1059
- super(
1060
- `CREATE_VM_BAD_REQUEST: ${body.message}`
1061
- );
1062
- this.body = body;
1063
- this.name = "CreateVmBadRequestError";
1064
- }
1065
- static code = "CREATE_VM_BAD_REQUEST";
1066
- static statusCode = 400;
1067
- static description = `Bad request: {message}`;
1068
- }
1069
- class VmSetupFailedError extends Error {
1070
- constructor(body) {
1071
- super(
1072
- `VM_SETUP_FAILED: ${body.message}`
1073
- );
1074
- this.body = body;
1075
- this.name = "VmSetupFailedError";
1076
- }
1077
- static code = "VM_SETUP_FAILED";
1078
- static statusCode = 500;
1079
- static description = `VM setup failed: {failed_reason}`;
1080
- }
1081
- class WantedByEmptyError extends Error {
1082
- constructor(body) {
1083
- super(
1084
- `WANTED_BY_EMPTY: ${body.message}`
1085
- );
1086
- this.body = body;
1087
- this.name = "WantedByEmptyError";
1088
- }
1089
- static code = "WANTED_BY_EMPTY";
1090
- static statusCode = 400;
1091
- static description = `wanted_by cannot be empty if provided`;
1092
- }
1093
- class WorkdirEmptyError extends Error {
1094
- constructor(body) {
1095
- super(
1096
- `WORKDIR_EMPTY: ${body.message}`
1097
- );
1098
- this.body = body;
1099
- this.name = "WorkdirEmptyError";
1100
- }
1101
- static code = "WORKDIR_EMPTY";
1102
- static statusCode = 400;
1103
- static description = `Working directory cannot be empty if provided`;
1104
- }
1105
- class GroupEmptyError extends Error {
1106
- constructor(body) {
1107
- super(
1108
- `GROUP_EMPTY: ${body.message}`
1109
- );
1110
- this.body = body;
1111
- this.name = "GroupEmptyError";
1112
- }
1113
- static code = "GROUP_EMPTY";
1114
- static statusCode = 400;
1115
- static description = `Group cannot be empty if provided`;
1116
- }
1117
- class UserEmptyError extends Error {
1118
- constructor(body) {
1119
- super(
1120
- `USER_EMPTY: ${body.message}`
1121
- );
1122
- this.body = body;
1123
- this.name = "UserEmptyError";
1124
- }
1125
- static code = "USER_EMPTY";
1126
- static statusCode = 400;
1127
- static description = `User cannot be empty if provided`;
1128
- }
1129
- class OnFailureArrayContainsEmptyError extends Error {
1130
- constructor(body) {
1131
- super(
1132
- `ON_FAILURE_ARRAY_CONTAINS_EMPTY: ${body.message}`
1133
- );
1134
- this.body = body;
1135
- this.name = "OnFailureArrayContainsEmptyError";
1136
- }
1137
- static code = "ON_FAILURE_ARRAY_CONTAINS_EMPTY";
1138
- static statusCode = 400;
1139
- static description = `'onFailure' array cannot contain empty strings`;
1140
- }
1141
- class RequiresArrayContainsEmptyError extends Error {
1142
- constructor(body) {
1143
- super(
1144
- `REQUIRES_ARRAY_CONTAINS_EMPTY: ${body.message}`
1192
+ `REQUIRES_ARRAY_CONTAINS_EMPTY: ${body.message}`
1145
1193
  );
1146
1194
  this.body = body;
1147
1195
  this.name = "RequiresArrayContainsEmptyError";
@@ -1390,185 +1438,173 @@ class ExpiredError extends Error {
1390
1438
  static statusCode = 403;
1391
1439
  static description = `Session has expired`;
1392
1440
  }
1393
- class UnauthorizedError extends Error {
1441
+ class NotFoundError extends Error {
1394
1442
  constructor(body) {
1395
1443
  super(
1396
- `UNAUTHORIZED: ${body.message}`
1444
+ `NOT_FOUND: ${body.message}`
1397
1445
  );
1398
1446
  this.body = body;
1399
- this.name = "UnauthorizedError";
1447
+ this.name = "NotFoundError";
1400
1448
  }
1401
- static code = "UNAUTHORIZED";
1402
- static statusCode = 401;
1403
- static description = `Unauthorized: admin key and account id are required`;
1449
+ static code = "NOT_FOUND";
1450
+ static statusCode = 404;
1451
+ static description = `Repository not found`;
1404
1452
  }
1405
- class ForbiddenError extends Error {
1453
+ class TreeNotFoundError extends Error {
1406
1454
  constructor(body) {
1407
1455
  super(
1408
- `FORBIDDEN: ${body.message}`
1456
+ `TREE_NOT_FOUND: ${body.message}`
1409
1457
  );
1410
1458
  this.body = body;
1411
- this.name = "ForbiddenError";
1459
+ this.name = "TreeNotFoundError";
1412
1460
  }
1413
- static code = "FORBIDDEN";
1414
- static statusCode = 403;
1415
- static description = `Forbidden`;
1461
+ static code = "TREE_NOT_FOUND";
1462
+ static statusCode = 404;
1463
+ static description = `Tree not found: {hash}`;
1416
1464
  }
1417
- class InvalidAccountIdError extends Error {
1465
+ class BranchNotFoundError extends Error {
1418
1466
  constructor(body) {
1419
1467
  super(
1420
- `INVALID_ACCOUNT_ID: ${body.message}`
1468
+ `BRANCH_NOT_FOUND: ${body.message}`
1421
1469
  );
1422
1470
  this.body = body;
1423
- this.name = "InvalidAccountIdError";
1471
+ this.name = "BranchNotFoundError";
1424
1472
  }
1425
- static code = "INVALID_ACCOUNT_ID";
1426
- static statusCode = 400;
1427
- static description = `Invalid account ID: {account_id}`;
1473
+ static code = "BRANCH_NOT_FOUND";
1474
+ static statusCode = 404;
1475
+ static description = `Branch not found: {branch}`;
1428
1476
  }
1429
- class SourceImportConflictError extends Error {
1477
+ class CommitNotFoundError extends Error {
1430
1478
  constructor(body) {
1431
1479
  super(
1432
- `SOURCE_IMPORT_CONFLICT: ${body.message}`
1480
+ `COMMIT_NOT_FOUND: ${body.message}`
1433
1481
  );
1434
1482
  this.body = body;
1435
- this.name = "SourceImportConflictError";
1483
+ this.name = "CommitNotFoundError";
1436
1484
  }
1437
- static code = "SOURCE_IMPORT_CONFLICT";
1438
- static statusCode = 400;
1439
- static description = `Source and import are mutually exclusive`;
1485
+ static code = "COMMIT_NOT_FOUND";
1486
+ static statusCode = 404;
1487
+ static description = `Commit not found: {hash}`;
1440
1488
  }
1441
- class SourceUnauthorizedError extends Error {
1489
+ class ParentNotFoundError extends Error {
1442
1490
  constructor(body) {
1443
1491
  super(
1444
- `SOURCE_UNAUTHORIZED: ${body.message}`
1492
+ `PARENT_NOT_FOUND: ${body.message}`
1445
1493
  );
1446
1494
  this.body = body;
1447
- this.name = "SourceUnauthorizedError";
1495
+ this.name = "ParentNotFoundError";
1448
1496
  }
1449
- static code = "SOURCE_UNAUTHORIZED";
1450
- static statusCode = 400;
1451
- static description = `Unauthorized to access source repository at {url}`;
1497
+ static code = "PARENT_NOT_FOUND";
1498
+ static statusCode = 404;
1499
+ static description = `Parent commit not found: {sha}`;
1452
1500
  }
1453
- class SourceNotFoundError extends Error {
1501
+ class NoDefaultBranchError extends Error {
1454
1502
  constructor(body) {
1455
1503
  super(
1456
- `SOURCE_NOT_FOUND: ${body.message}`
1504
+ `NO_DEFAULT_BRANCH: ${body.message}`
1457
1505
  );
1458
1506
  this.body = body;
1459
- this.name = "SourceNotFoundError";
1507
+ this.name = "NoDefaultBranchError";
1460
1508
  }
1461
- static code = "SOURCE_NOT_FOUND";
1462
- static statusCode = 400;
1463
- static description = `Source repository not found at {url}`;
1509
+ static code = "NO_DEFAULT_BRANCH";
1510
+ static statusCode = 404;
1511
+ static description = `Repository has no default branch configured`;
1464
1512
  }
1465
- class ImportSubdirNotFoundError extends Error {
1513
+ class InvalidBase64ContentError extends Error {
1466
1514
  constructor(body) {
1467
1515
  super(
1468
- `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1516
+ `INVALID_BASE64_CONTENT: ${body.message}`
1469
1517
  );
1470
1518
  this.body = body;
1471
- this.name = "ImportSubdirNotFoundError";
1519
+ this.name = "InvalidBase64ContentError";
1472
1520
  }
1473
- static code = "IMPORT_SUBDIR_NOT_FOUND";
1521
+ static code = "INVALID_BASE64_CONTENT";
1474
1522
  static statusCode = 400;
1475
- static description = `Directory not found in {source}: {dir}`;
1523
+ static description = `Invalid base64 content for file: {path}`;
1476
1524
  }
1477
- class RepoAlreadyExistsError extends Error {
1525
+ class InvalidFileChangeError extends Error {
1478
1526
  constructor(body) {
1479
1527
  super(
1480
- `REPO_ALREADY_EXISTS: ${body.message}`
1528
+ `INVALID_FILE_CHANGE: ${body.message}`
1481
1529
  );
1482
1530
  this.body = body;
1483
- this.name = "RepoAlreadyExistsError";
1531
+ this.name = "InvalidFileChangeError";
1484
1532
  }
1485
- static code = "REPO_ALREADY_EXISTS";
1486
- static statusCode = 409;
1487
- static description = `Repo '{repo_id}' already exists`;
1533
+ static code = "INVALID_FILE_CHANGE";
1534
+ static statusCode = 400;
1535
+ static description = `File change must have either content or deleted flag, not both: {path}`;
1488
1536
  }
1489
- class PackfileError extends Error {
1537
+ class InvalidFilePathError extends Error {
1490
1538
  constructor(body) {
1491
1539
  super(
1492
- `PACKFILE: ${body.message}`
1540
+ `INVALID_FILE_PATH: ${body.message}`
1493
1541
  );
1494
1542
  this.body = body;
1495
- this.name = "PackfileError";
1543
+ this.name = "InvalidFilePathError";
1496
1544
  }
1497
- static code = "PACKFILE";
1498
- static statusCode = 500;
1499
- static description = `Error building packfile`;
1545
+ static code = "INVALID_FILE_PATH";
1546
+ static statusCode = 400;
1547
+ static description = `Invalid file path: {path}`;
1500
1548
  }
1501
- class UnsupportedTransferError extends Error {
1549
+ class ConflictingParentError extends Error {
1502
1550
  constructor(body) {
1503
1551
  super(
1504
- `UNSUPPORTED_TRANSFER: ${body.message}`
1552
+ `CONFLICTING_PARENT: ${body.message}`
1505
1553
  );
1506
1554
  this.body = body;
1507
- this.name = "UnsupportedTransferError";
1555
+ this.name = "ConflictingParentError";
1508
1556
  }
1509
- static code = "UNSUPPORTED_TRANSFER";
1510
- static statusCode = 400;
1511
- static description = `Unsupported LFS transfer protocol(s)`;
1512
- }
1513
- class BranchNotFoundError extends Error {
1514
- constructor(body) {
1515
- super(
1516
- `BRANCH_NOT_FOUND: ${body.message}`
1517
- );
1518
- this.body = body;
1519
- this.name = "BranchNotFoundError";
1520
- }
1521
- static code = "BRANCH_NOT_FOUND";
1522
- static statusCode = 404;
1523
- static description = `Branch not found: {branch}`;
1557
+ static code = "CONFLICTING_PARENT";
1558
+ static statusCode = 409;
1559
+ static description = `Conflict: expected parent SHA {expected} but current is {actual:?}`;
1524
1560
  }
1525
- class NotFoundError extends Error {
1561
+ class AmbiguousError extends Error {
1526
1562
  constructor(body) {
1527
1563
  super(
1528
- `NOT_FOUND: ${body.message}`
1564
+ `AMBIGUOUS: ${body.message}`
1529
1565
  );
1530
1566
  this.body = body;
1531
- this.name = "NotFoundError";
1567
+ this.name = "AmbiguousError";
1532
1568
  }
1533
- static code = "NOT_FOUND";
1534
- static statusCode = 404;
1535
- static description = `Repository not found`;
1569
+ static code = "AMBIGUOUS";
1570
+ static statusCode = 400;
1571
+ static description = `rev is ambiguous: {rev}`;
1536
1572
  }
1537
- class SendErrorError extends Error {
1573
+ class InvalidError extends Error {
1538
1574
  constructor(body) {
1539
1575
  super(
1540
- `SEND_ERROR: ${body.message}`
1576
+ `INVALID: ${body.message}`
1541
1577
  );
1542
1578
  this.body = body;
1543
- this.name = "SendErrorError";
1579
+ this.name = "InvalidError";
1544
1580
  }
1545
- static code = "SEND_ERROR";
1546
- static statusCode = 500;
1547
- static description = `Stream receiver dropped`;
1581
+ static code = "INVALID";
1582
+ static statusCode = 400;
1583
+ static description = `invalid rev syntax: {rev}`;
1548
1584
  }
1549
- class InvalidRevisionError extends Error {
1585
+ class ConflictError extends Error {
1550
1586
  constructor(body) {
1551
1587
  super(
1552
- `INVALID_REVISION: ${body.message}`
1588
+ `CONFLICT: ${body.message}`
1553
1589
  );
1554
1590
  this.body = body;
1555
- this.name = "InvalidRevisionError";
1591
+ this.name = "ConflictError";
1556
1592
  }
1557
- static code = "INVALID_REVISION";
1558
- static statusCode = 400;
1559
- static description = `Invalid revision: {revision}`;
1593
+ static code = "CONFLICT";
1594
+ static statusCode = 409;
1595
+ static description = `Sync conflict: {message}`;
1560
1596
  }
1561
- class CommitNotFoundError extends Error {
1597
+ class BranchAlreadyExistsError extends Error {
1562
1598
  constructor(body) {
1563
1599
  super(
1564
- `COMMIT_NOT_FOUND: ${body.message}`
1600
+ `BRANCH_ALREADY_EXISTS: ${body.message}`
1565
1601
  );
1566
1602
  this.body = body;
1567
- this.name = "CommitNotFoundError";
1603
+ this.name = "BranchAlreadyExistsError";
1568
1604
  }
1569
- static code = "COMMIT_NOT_FOUND";
1570
- static statusCode = 404;
1571
- static description = `Commit not found: {sha}`;
1605
+ static code = "BRANCH_ALREADY_EXISTS";
1606
+ static statusCode = 409;
1607
+ static description = `Branch already exists: {branch}`;
1572
1608
  }
1573
1609
  class PathNotFoundError extends Error {
1574
1610
  constructor(body) {
@@ -1618,6 +1654,162 @@ class ExpectedServiceError extends Error {
1618
1654
  static statusCode = 403;
1619
1655
  static description = `Expected 'service' query parameter`;
1620
1656
  }
1657
+ class UnauthorizedError extends Error {
1658
+ constructor(body) {
1659
+ super(
1660
+ `UNAUTHORIZED: ${body.message}`
1661
+ );
1662
+ this.body = body;
1663
+ this.name = "UnauthorizedError";
1664
+ }
1665
+ static code = "UNAUTHORIZED";
1666
+ static statusCode = 401;
1667
+ static description = `Unauthorized: admin key and account id are required`;
1668
+ }
1669
+ class ForbiddenError extends Error {
1670
+ constructor(body) {
1671
+ super(
1672
+ `FORBIDDEN: ${body.message}`
1673
+ );
1674
+ this.body = body;
1675
+ this.name = "ForbiddenError";
1676
+ }
1677
+ static code = "FORBIDDEN";
1678
+ static statusCode = 403;
1679
+ static description = `Forbidden`;
1680
+ }
1681
+ class InvalidAccountIdError extends Error {
1682
+ constructor(body) {
1683
+ super(
1684
+ `INVALID_ACCOUNT_ID: ${body.message}`
1685
+ );
1686
+ this.body = body;
1687
+ this.name = "InvalidAccountIdError";
1688
+ }
1689
+ static code = "INVALID_ACCOUNT_ID";
1690
+ static statusCode = 400;
1691
+ static description = `Invalid account ID: {account_id}`;
1692
+ }
1693
+ class SourceImportConflictError extends Error {
1694
+ constructor(body) {
1695
+ super(
1696
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
1697
+ );
1698
+ this.body = body;
1699
+ this.name = "SourceImportConflictError";
1700
+ }
1701
+ static code = "SOURCE_IMPORT_CONFLICT";
1702
+ static statusCode = 400;
1703
+ static description = `Source and import are mutually exclusive`;
1704
+ }
1705
+ class SourceUnauthorizedError extends Error {
1706
+ constructor(body) {
1707
+ super(
1708
+ `SOURCE_UNAUTHORIZED: ${body.message}`
1709
+ );
1710
+ this.body = body;
1711
+ this.name = "SourceUnauthorizedError";
1712
+ }
1713
+ static code = "SOURCE_UNAUTHORIZED";
1714
+ static statusCode = 400;
1715
+ static description = `Unauthorized to access source repository at {url}`;
1716
+ }
1717
+ class SourceNotFoundError extends Error {
1718
+ constructor(body) {
1719
+ super(
1720
+ `SOURCE_NOT_FOUND: ${body.message}`
1721
+ );
1722
+ this.body = body;
1723
+ this.name = "SourceNotFoundError";
1724
+ }
1725
+ static code = "SOURCE_NOT_FOUND";
1726
+ static statusCode = 400;
1727
+ static description = `Source repository not found at {url}`;
1728
+ }
1729
+ class ImportSubdirNotFoundError extends Error {
1730
+ constructor(body) {
1731
+ super(
1732
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1733
+ );
1734
+ this.body = body;
1735
+ this.name = "ImportSubdirNotFoundError";
1736
+ }
1737
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1738
+ static statusCode = 400;
1739
+ static description = `Directory not found in {source}: {dir}`;
1740
+ }
1741
+ class RepoAlreadyExistsError extends Error {
1742
+ constructor(body) {
1743
+ super(
1744
+ `REPO_ALREADY_EXISTS: ${body.message}`
1745
+ );
1746
+ this.body = body;
1747
+ this.name = "RepoAlreadyExistsError";
1748
+ }
1749
+ static code = "REPO_ALREADY_EXISTS";
1750
+ static statusCode = 409;
1751
+ static description = `Repo '{repo_id}' already exists`;
1752
+ }
1753
+ class TagNotFoundError extends Error {
1754
+ constructor(body) {
1755
+ super(
1756
+ `TAG_NOT_FOUND: ${body.message}`
1757
+ );
1758
+ this.body = body;
1759
+ this.name = "TagNotFoundError";
1760
+ }
1761
+ static code = "TAG_NOT_FOUND";
1762
+ static statusCode = 404;
1763
+ static description = `Tag not found: {hash}`;
1764
+ }
1765
+ class InvalidRevisionError extends Error {
1766
+ constructor(body) {
1767
+ super(
1768
+ `INVALID_REVISION: ${body.message}`
1769
+ );
1770
+ this.body = body;
1771
+ this.name = "InvalidRevisionError";
1772
+ }
1773
+ static code = "INVALID_REVISION";
1774
+ static statusCode = 400;
1775
+ static description = `Invalid revision: {revision}`;
1776
+ }
1777
+ class BlobNotFoundError extends Error {
1778
+ constructor(body) {
1779
+ super(
1780
+ `BLOB_NOT_FOUND: ${body.message}`
1781
+ );
1782
+ this.body = body;
1783
+ this.name = "BlobNotFoundError";
1784
+ }
1785
+ static code = "BLOB_NOT_FOUND";
1786
+ static statusCode = 404;
1787
+ static description = `Blob not found: {hash}`;
1788
+ }
1789
+ class SendErrorError extends Error {
1790
+ constructor(body) {
1791
+ super(
1792
+ `SEND_ERROR: ${body.message}`
1793
+ );
1794
+ this.body = body;
1795
+ this.name = "SendErrorError";
1796
+ }
1797
+ static code = "SEND_ERROR";
1798
+ static statusCode = 500;
1799
+ static description = `Stream receiver dropped`;
1800
+ }
1801
+ class UnsupportedTransferError extends Error {
1802
+ constructor(body) {
1803
+ super(
1804
+ `UNSUPPORTED_TRANSFER: ${body.message}`
1805
+ );
1806
+ this.body = body;
1807
+ this.name = "UnsupportedTransferError";
1808
+ }
1809
+ static code = "UNSUPPORTED_TRANSFER";
1810
+ static statusCode = 400;
1811
+ static description = `Unsupported LFS transfer protocol(s)`;
1812
+ }
1621
1813
  class DiffInvalidPathPatternError extends Error {
1622
1814
  constructor(body) {
1623
1815
  super(
@@ -1738,809 +1930,689 @@ class EmptyQueryError extends Error {
1738
1930
  static statusCode = 400;
1739
1931
  static description = `Query must not be empty`;
1740
1932
  }
1741
- class ConflictError extends Error {
1933
+ class PackfileError extends Error {
1742
1934
  constructor(body) {
1743
1935
  super(
1744
- `CONFLICT: ${body.message}`
1936
+ `PACKFILE: ${body.message}`
1745
1937
  );
1746
1938
  this.body = body;
1747
- this.name = "ConflictError";
1939
+ this.name = "PackfileError";
1748
1940
  }
1749
- static code = "CONFLICT";
1750
- static statusCode = 409;
1751
- static description = `Sync conflict: {message}`;
1941
+ static code = "PACKFILE";
1942
+ static statusCode = 500;
1943
+ static description = `Error building packfile`;
1752
1944
  }
1753
- class NoDefaultBranchError extends Error {
1945
+ class InvalidRangeError extends Error {
1754
1946
  constructor(body) {
1755
1947
  super(
1756
- `NO_DEFAULT_BRANCH: ${body.message}`
1948
+ `INVALID_RANGE: ${body.message}`
1757
1949
  );
1758
1950
  this.body = body;
1759
- this.name = "NoDefaultBranchError";
1951
+ this.name = "InvalidRangeError";
1760
1952
  }
1761
- static code = "NO_DEFAULT_BRANCH";
1762
- static statusCode = 404;
1763
- static description = `Repository has no default branch configured`;
1953
+ static code = "INVALID_RANGE";
1954
+ static statusCode = 400;
1955
+ 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.`;
1764
1956
  }
1765
- class InvalidBase64ContentError extends Error {
1957
+ class OffsetWithSelectorError extends Error {
1766
1958
  constructor(body) {
1767
1959
  super(
1768
- `INVALID_BASE64_CONTENT: ${body.message}`
1960
+ `OFFSET_WITH_SELECTOR: ${body.message}`
1769
1961
  );
1770
1962
  this.body = body;
1771
- this.name = "InvalidBase64ContentError";
1963
+ this.name = "OffsetWithSelectorError";
1772
1964
  }
1773
- static code = "INVALID_BASE64_CONTENT";
1965
+ static code = "OFFSET_WITH_SELECTOR";
1774
1966
  static statusCode = 400;
1775
- static description = `Invalid base64 content for file: {path}`;
1967
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1776
1968
  }
1777
- class InvalidFileChangeError extends Error {
1969
+ class CommitNotInBranchError extends Error {
1778
1970
  constructor(body) {
1779
1971
  super(
1780
- `INVALID_FILE_CHANGE: ${body.message}`
1972
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1781
1973
  );
1782
1974
  this.body = body;
1783
- this.name = "InvalidFileChangeError";
1975
+ this.name = "CommitNotInBranchError";
1784
1976
  }
1785
- static code = "INVALID_FILE_CHANGE";
1977
+ static code = "COMMIT_NOT_IN_BRANCH";
1786
1978
  static statusCode = 400;
1787
- static description = `File change must have either content or deleted flag, not both: {path}`;
1979
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1788
1980
  }
1789
- class InvalidFilePathError extends Error {
1981
+ class GitHubSyncConflictError extends Error {
1790
1982
  constructor(body) {
1791
1983
  super(
1792
- `INVALID_FILE_PATH: ${body.message}`
1984
+ `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1793
1985
  );
1794
1986
  this.body = body;
1795
- this.name = "InvalidFilePathError";
1987
+ this.name = "GitHubSyncConflictError";
1796
1988
  }
1797
- static code = "INVALID_FILE_PATH";
1798
- static statusCode = 400;
1799
- static description = `Invalid file path: {path}`;
1989
+ static code = "GIT_HUB_SYNC_CONFLICT";
1990
+ static statusCode = 409;
1991
+ static description = `GitHub Sync Conflict: {message}`;
1800
1992
  }
1801
- class ConflictingParentError extends Error {
1993
+ class InvalidObjectIdError extends Error {
1802
1994
  constructor(body) {
1803
1995
  super(
1804
- `CONFLICTING_PARENT: ${body.message}`
1996
+ `INVALID_OBJECT_ID: ${body.message}`
1805
1997
  );
1806
1998
  this.body = body;
1807
- this.name = "ConflictingParentError";
1999
+ this.name = "InvalidObjectIdError";
1808
2000
  }
1809
- static code = "CONFLICTING_PARENT";
1810
- static statusCode = 409;
1811
- static description = `Conflict: expected parent SHA {expected} but current is {actual:?}`;
2001
+ static code = "INVALID_OBJECT_ID";
2002
+ static statusCode = 400;
2003
+ static description = `Invalid object ID: {hash}`;
1812
2004
  }
1813
- class TreeNotFoundError extends Error {
2005
+ class TooManyConcurrentRepairsError extends Error {
1814
2006
  constructor(body) {
1815
2007
  super(
1816
- `TREE_NOT_FOUND: ${body.message}`
2008
+ `TOO_MANY_CONCURRENT_REPAIRS: ${body.message}`
1817
2009
  );
1818
2010
  this.body = body;
1819
- this.name = "TreeNotFoundError";
2011
+ this.name = "TooManyConcurrentRepairsError";
1820
2012
  }
1821
- static code = "TREE_NOT_FOUND";
1822
- static statusCode = 404;
1823
- static description = `Tree not found: {hash}`;
2013
+ static code = "TOO_MANY_CONCURRENT_REPAIRS";
2014
+ static statusCode = 429;
2015
+ static description = `Account already has {current} concurrent repo-repair jobs in flight (per-account limit: {limit}); wait for one to finish or cancel it before starting another`;
1824
2016
  }
1825
- class BranchAlreadyExistsError extends Error {
2017
+ class AlreadyInProgressError extends Error {
1826
2018
  constructor(body) {
1827
2019
  super(
1828
- `BRANCH_ALREADY_EXISTS: ${body.message}`
2020
+ `ALREADY_IN_PROGRESS: ${body.message}`
1829
2021
  );
1830
2022
  this.body = body;
1831
- this.name = "BranchAlreadyExistsError";
2023
+ this.name = "AlreadyInProgressError";
1832
2024
  }
1833
- static code = "BRANCH_ALREADY_EXISTS";
2025
+ static code = "ALREADY_IN_PROGRESS";
1834
2026
  static statusCode = 409;
1835
- static description = `Branch already exists: {branch}`;
2027
+ static description = `A repair job is already in progress for this repository: {existing_job_id}`;
1836
2028
  }
1837
- class ParentNotFoundError extends Error {
2029
+ class JobNotFoundError extends Error {
1838
2030
  constructor(body) {
1839
2031
  super(
1840
- `PARENT_NOT_FOUND: ${body.message}`
2032
+ `JOB_NOT_FOUND: ${body.message}`
1841
2033
  );
1842
2034
  this.body = body;
1843
- this.name = "ParentNotFoundError";
2035
+ this.name = "JobNotFoundError";
1844
2036
  }
1845
- static code = "PARENT_NOT_FOUND";
2037
+ static code = "JOB_NOT_FOUND";
1846
2038
  static statusCode = 404;
1847
- static description = `Parent commit not found: {sha}`;
2039
+ static description = `Repair job not found: {job_id}`;
1848
2040
  }
1849
- class TagNotFoundError extends Error {
2041
+ class UnavailableError extends Error {
1850
2042
  constructor(body) {
1851
2043
  super(
1852
- `TAG_NOT_FOUND: ${body.message}`
2044
+ `UNAVAILABLE: ${body.message}`
1853
2045
  );
1854
2046
  this.body = body;
1855
- this.name = "TagNotFoundError";
2047
+ this.name = "UnavailableError";
1856
2048
  }
1857
- static code = "TAG_NOT_FOUND";
1858
- static statusCode = 404;
1859
- static description = `Tag not found: {hash}`;
2049
+ static code = "UNAVAILABLE";
2050
+ static statusCode = 503;
2051
+ static description = `Cron service unavailable`;
1860
2052
  }
1861
- class InvalidRangeError extends Error {
2053
+ class ScheduleNotFoundError extends Error {
1862
2054
  constructor(body) {
1863
2055
  super(
1864
- `INVALID_RANGE: ${body.message}`
2056
+ `SCHEDULE_NOT_FOUND: ${body.message}`
1865
2057
  );
1866
2058
  this.body = body;
1867
- this.name = "InvalidRangeError";
2059
+ this.name = "ScheduleNotFoundError";
1868
2060
  }
1869
- static code = "INVALID_RANGE";
1870
- static statusCode = 400;
1871
- 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.`;
2061
+ static code = "SCHEDULE_NOT_FOUND";
2062
+ static statusCode = 404;
2063
+ static description = `Schedule not found`;
1872
2064
  }
1873
- class OffsetWithSelectorError extends Error {
2065
+ class ServiceUnavailableError extends Error {
1874
2066
  constructor(body) {
1875
2067
  super(
1876
- `OFFSET_WITH_SELECTOR: ${body.message}`
2068
+ `SERVICE_UNAVAILABLE: ${body.message}`
1877
2069
  );
1878
2070
  this.body = body;
1879
- this.name = "OffsetWithSelectorError";
2071
+ this.name = "ServiceUnavailableError";
1880
2072
  }
1881
- static code = "OFFSET_WITH_SELECTOR";
1882
- static statusCode = 400;
1883
- static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
2073
+ static code = "SERVICE_UNAVAILABLE";
2074
+ static statusCode = 503;
2075
+ static description = `Cron service not configured`;
1884
2076
  }
1885
- class CommitNotInBranchError extends Error {
2077
+ class RepairAlreadyInProgressError extends Error {
1886
2078
  constructor(body) {
1887
2079
  super(
1888
- `COMMIT_NOT_IN_BRANCH: ${body.message}`
2080
+ `REPAIR_ALREADY_IN_PROGRESS: ${body.message}`
1889
2081
  );
1890
2082
  this.body = body;
1891
- this.name = "CommitNotInBranchError";
2083
+ this.name = "RepairAlreadyInProgressError";
1892
2084
  }
1893
- static code = "COMMIT_NOT_IN_BRANCH";
1894
- static statusCode = 400;
1895
- static description = `Commit {sha} is not in the history of branch {branch}`;
2085
+ static code = "REPAIR_ALREADY_IN_PROGRESS";
2086
+ static statusCode = 409;
2087
+ static description = `A repair job is already in progress for this repository: {existing_job_id}`;
1896
2088
  }
1897
- class BlobNotFoundError extends Error {
2089
+ class MemoryStorageQuotaExceededError extends Error {
1898
2090
  constructor(body) {
1899
2091
  super(
1900
- `BLOB_NOT_FOUND: ${body.message}`
2092
+ `MEMORY_STORAGE_QUOTA_EXCEEDED: ${body.message}`
1901
2093
  );
1902
2094
  this.body = body;
1903
- this.name = "BlobNotFoundError";
2095
+ this.name = "MemoryStorageQuotaExceededError";
1904
2096
  }
1905
- static code = "BLOB_NOT_FOUND";
1906
- static statusCode = 404;
1907
- static description = `Blob not found: {hash}`;
2097
+ static code = "MEMORY_STORAGE_QUOTA_EXCEEDED";
2098
+ static statusCode = 403;
2099
+ static description = `VM memory storage quota exceeded: your plan allows {limit} MB total VM memory storage, you currently use {current} MB and this snapshot would add {requested} MB`;
1908
2100
  }
1909
- class AmbiguousError extends Error {
2101
+ class RootfsStorageQuotaExceededError extends Error {
1910
2102
  constructor(body) {
1911
2103
  super(
1912
- `AMBIGUOUS: ${body.message}`
2104
+ `ROOTFS_STORAGE_QUOTA_EXCEEDED: ${body.message}`
1913
2105
  );
1914
2106
  this.body = body;
1915
- this.name = "AmbiguousError";
2107
+ this.name = "RootfsStorageQuotaExceededError";
1916
2108
  }
1917
- static code = "AMBIGUOUS";
1918
- static statusCode = 400;
1919
- static description = `rev is ambiguous: {rev}`;
2109
+ static code = "ROOTFS_STORAGE_QUOTA_EXCEEDED";
2110
+ static statusCode = 403;
2111
+ static description = `Rootfs storage quota exceeded: your plan allows {limit} MB total VM rootfs storage, you currently use {current} MB and this VM would add {requested} MB`;
1920
2112
  }
1921
- class InvalidError extends Error {
2113
+ class RootfsSizeTooLargeError extends Error {
1922
2114
  constructor(body) {
1923
2115
  super(
1924
- `INVALID: ${body.message}`
2116
+ `ROOTFS_SIZE_TOO_LARGE: ${body.message}`
1925
2117
  );
1926
2118
  this.body = body;
1927
- this.name = "InvalidError";
2119
+ this.name = "RootfsSizeTooLargeError";
1928
2120
  }
1929
- static code = "INVALID";
2121
+ static code = "ROOTFS_SIZE_TOO_LARGE";
1930
2122
  static statusCode = 400;
1931
- static description = `invalid rev syntax: {rev}`;
2123
+ static description = `rootfsSizeGb {got_gb} is too large`;
1932
2124
  }
1933
- class GitHubSyncConflictError extends Error {
2125
+ class MemSizeTooLargeError extends Error {
1934
2126
  constructor(body) {
1935
2127
  super(
1936
- `GIT_HUB_SYNC_CONFLICT: ${body.message}`
2128
+ `MEM_SIZE_TOO_LARGE: ${body.message}`
1937
2129
  );
1938
2130
  this.body = body;
1939
- this.name = "GitHubSyncConflictError";
2131
+ this.name = "MemSizeTooLargeError";
1940
2132
  }
1941
- static code = "GIT_HUB_SYNC_CONFLICT";
1942
- static statusCode = 409;
1943
- static description = `GitHub Sync Conflict: {message}`;
2133
+ static code = "MEM_SIZE_TOO_LARGE";
2134
+ static statusCode = 400;
2135
+ static description = `memSizeGb {got_gb} is too large`;
1944
2136
  }
1945
- class InvalidObjectIdError extends Error {
2137
+ class RootfsOverPlanLimitError extends Error {
1946
2138
  constructor(body) {
1947
2139
  super(
1948
- `INVALID_OBJECT_ID: ${body.message}`
2140
+ `ROOTFS_OVER_PLAN_LIMIT: ${body.message}`
1949
2141
  );
1950
2142
  this.body = body;
1951
- this.name = "InvalidObjectIdError";
2143
+ this.name = "RootfsOverPlanLimitError";
1952
2144
  }
1953
- static code = "INVALID_OBJECT_ID";
1954
- static statusCode = 400;
1955
- static description = `Invalid object ID: {hash}`;
2145
+ static code = "ROOTFS_OVER_PLAN_LIMIT";
2146
+ static statusCode = 403;
2147
+ static description = `rootfsSizeMb {got} MB exceeds your plan's maximum of {max} MB`;
1956
2148
  }
1957
- class UnavailableError extends Error {
2149
+ class MemOverPlanLimitError extends Error {
1958
2150
  constructor(body) {
1959
2151
  super(
1960
- `UNAVAILABLE: ${body.message}`
2152
+ `MEM_OVER_PLAN_LIMIT: ${body.message}`
1961
2153
  );
1962
2154
  this.body = body;
1963
- this.name = "UnavailableError";
2155
+ this.name = "MemOverPlanLimitError";
1964
2156
  }
1965
- static code = "UNAVAILABLE";
1966
- static statusCode = 503;
1967
- static description = `Cron service unavailable`;
2157
+ static code = "MEM_OVER_PLAN_LIMIT";
2158
+ static statusCode = 403;
2159
+ static description = `memSizeMb {got} MiB exceeds your plan's maximum of {max} MiB`;
1968
2160
  }
1969
- class ScheduleNotFoundError extends Error {
2161
+ class VcpuOverPlanLimitError extends Error {
1970
2162
  constructor(body) {
1971
2163
  super(
1972
- `SCHEDULE_NOT_FOUND: ${body.message}`
2164
+ `VCPU_OVER_PLAN_LIMIT: ${body.message}`
1973
2165
  );
1974
2166
  this.body = body;
1975
- this.name = "ScheduleNotFoundError";
2167
+ this.name = "VcpuOverPlanLimitError";
1976
2168
  }
1977
- static code = "SCHEDULE_NOT_FOUND";
1978
- static statusCode = 404;
1979
- static description = `Schedule not found`;
2169
+ static code = "VCPU_OVER_PLAN_LIMIT";
2170
+ static statusCode = 403;
2171
+ static description = `vcpuCount {got} exceeds your plan's maximum of {max}`;
1980
2172
  }
1981
- class ServiceUnavailableError extends Error {
2173
+ class CustomSizingNotAllowedError extends Error {
1982
2174
  constructor(body) {
1983
2175
  super(
1984
- `SERVICE_UNAVAILABLE: ${body.message}`
2176
+ `CUSTOM_SIZING_NOT_ALLOWED: ${body.message}`
1985
2177
  );
1986
2178
  this.body = body;
1987
- this.name = "ServiceUnavailableError";
2179
+ this.name = "CustomSizingNotAllowedError";
1988
2180
  }
1989
- static code = "SERVICE_UNAVAILABLE";
1990
- static statusCode = 503;
1991
- static description = `Cron service not configured`;
2181
+ static code = "CUSTOM_SIZING_NOT_ALLOWED";
2182
+ static statusCode = 403;
2183
+ static description = `Your plan does not allow custom VM sizing (vcpu/memory/rootfs). Upgrade your plan or omit these fields to use the plan defaults.`;
1992
2184
  }
1993
- class ExecuteLimitExceededError extends Error {
2185
+ class SnapshotLimitExceededError extends Error {
1994
2186
  constructor(body) {
1995
2187
  super(
1996
- `EXECUTE_LIMIT_EXCEEDED: ${body.message}`
2188
+ `SNAPSHOT_LIMIT_EXCEEDED: ${body.message}`
1997
2189
  );
1998
2190
  this.body = body;
1999
- this.name = "ExecuteLimitExceededError";
2191
+ this.name = "SnapshotLimitExceededError";
2000
2192
  }
2001
- static code = "EXECUTE_LIMIT_EXCEEDED";
2193
+ static code = "SNAPSHOT_LIMIT_EXCEEDED";
2002
2194
  static statusCode = 403;
2003
- static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
2195
+ static description = `Snapshot limit exceeded: your plan allows {limit} total snapshots, you currently have {current}`;
2004
2196
  }
2005
- class PermissionAlreadyExistsError extends Error {
2197
+ class PersistentVmsNotAllowedError extends Error {
2006
2198
  constructor(body) {
2007
2199
  super(
2008
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
2200
+ `PERSISTENT_VMS_NOT_ALLOWED: ${body.message}`
2009
2201
  );
2010
2202
  this.body = body;
2011
- this.name = "PermissionAlreadyExistsError";
2203
+ this.name = "PersistentVmsNotAllowedError";
2012
2204
  }
2013
- static code = "PERMISSION_ALREADY_EXISTS";
2014
- static statusCode = 409;
2015
- static description = `Permission already exists`;
2205
+ static code = "PERSISTENT_VMS_NOT_ALLOWED";
2206
+ static statusCode = 403;
2207
+ static description = `Your plan does not allow persistent VMs. Use sticky or ephemeral persistence instead, or upgrade your plan.`;
2016
2208
  }
2017
- class ListTokensFailedError extends Error {
2209
+ class TotalVmLimitExceededError extends Error {
2018
2210
  constructor(body) {
2019
2211
  super(
2020
- `LIST_TOKENS_FAILED: ${body.message}`
2212
+ `TOTAL_VM_LIMIT_EXCEEDED: ${body.message}`
2021
2213
  );
2022
2214
  this.body = body;
2023
- this.name = "ListTokensFailedError";
2215
+ this.name = "TotalVmLimitExceededError";
2024
2216
  }
2025
- static code = "LIST_TOKENS_FAILED";
2026
- static statusCode = 500;
2027
- static description = `Failed to list tokens: {message}`;
2217
+ static code = "TOTAL_VM_LIMIT_EXCEEDED";
2218
+ static statusCode = 403;
2219
+ static description = `Total VM limit exceeded: your plan allows {limit} total VMs, you currently have {current}`;
2028
2220
  }
2029
- class RevokeTokenFailedError extends Error {
2221
+ class VmLimitExceededError extends Error {
2030
2222
  constructor(body) {
2031
2223
  super(
2032
- `REVOKE_TOKEN_FAILED: ${body.message}`
2224
+ `VM_LIMIT_EXCEEDED: ${body.message}`
2033
2225
  );
2034
2226
  this.body = body;
2035
- this.name = "RevokeTokenFailedError";
2227
+ this.name = "VmLimitExceededError";
2036
2228
  }
2037
- static code = "REVOKE_TOKEN_FAILED";
2038
- static statusCode = 500;
2039
- static description = `Failed to revoke token: {message}`;
2229
+ static code = "VM_LIMIT_EXCEEDED";
2230
+ static statusCode = 403;
2231
+ static description = `VM limit exceeded: your plan allows {limit} active VMs, you currently have {current}`;
2040
2232
  }
2041
- class CreateTokenFailedError extends Error {
2233
+ class ObservabilityDatabaseErrorError extends Error {
2042
2234
  constructor(body) {
2043
2235
  super(
2044
- `CREATE_TOKEN_FAILED: ${body.message}`
2236
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2045
2237
  );
2046
2238
  this.body = body;
2047
- this.name = "CreateTokenFailedError";
2239
+ this.name = "ObservabilityDatabaseErrorError";
2048
2240
  }
2049
- static code = "CREATE_TOKEN_FAILED";
2241
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2050
2242
  static statusCode = 500;
2051
- static description = `Failed to create token: {message}`;
2243
+ static description = `Database operation failed: {message}`;
2052
2244
  }
2053
- class ListPermissionsFailedError extends Error {
2245
+ class ObservabilityAccessDeniedError extends Error {
2054
2246
  constructor(body) {
2055
2247
  super(
2056
- `LIST_PERMISSIONS_FAILED: ${body.message}`
2248
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2057
2249
  );
2058
2250
  this.body = body;
2059
- this.name = "ListPermissionsFailedError";
2251
+ this.name = "ObservabilityAccessDeniedError";
2060
2252
  }
2061
- static code = "LIST_PERMISSIONS_FAILED";
2062
- static statusCode = 500;
2063
- static description = `Failed to list permissions: {message}`;
2253
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2254
+ static statusCode = 403;
2255
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2064
2256
  }
2065
- class GetPermissionFailedError extends Error {
2257
+ class ParseLogsFailedError extends Error {
2066
2258
  constructor(body) {
2067
2259
  super(
2068
- `GET_PERMISSION_FAILED: ${body.message}`
2260
+ `PARSE_LOGS_FAILED: ${body.message}`
2069
2261
  );
2070
2262
  this.body = body;
2071
- this.name = "GetPermissionFailedError";
2263
+ this.name = "ParseLogsFailedError";
2072
2264
  }
2073
- static code = "GET_PERMISSION_FAILED";
2265
+ static code = "PARSE_LOGS_FAILED";
2074
2266
  static statusCode = 500;
2075
- static description = `Failed to get permission: {message}`;
2267
+ static description = `Failed to parse logs: {message}`;
2076
2268
  }
2077
- class UpdatePermissionFailedError extends Error {
2269
+ class RetrieveLogsFailedError extends Error {
2078
2270
  constructor(body) {
2079
2271
  super(
2080
- `UPDATE_PERMISSION_FAILED: ${body.message}`
2272
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2081
2273
  );
2082
2274
  this.body = body;
2083
- this.name = "UpdatePermissionFailedError";
2275
+ this.name = "RetrieveLogsFailedError";
2084
2276
  }
2085
- static code = "UPDATE_PERMISSION_FAILED";
2277
+ static code = "RETRIEVE_LOGS_FAILED";
2086
2278
  static statusCode = 500;
2087
- static description = `Failed to update permission: {message}`;
2279
+ static description = `Failed to retrieve logs: {message}`;
2088
2280
  }
2089
- class RevokePermissionFailedError extends Error {
2281
+ class InvalidQueryError extends Error {
2090
2282
  constructor(body) {
2091
2283
  super(
2092
- `REVOKE_PERMISSION_FAILED: ${body.message}`
2284
+ `INVALID_QUERY: ${body.message}`
2093
2285
  );
2094
2286
  this.body = body;
2095
- this.name = "RevokePermissionFailedError";
2287
+ this.name = "InvalidQueryError";
2096
2288
  }
2097
- static code = "REVOKE_PERMISSION_FAILED";
2098
- static statusCode = 500;
2099
- static description = `Failed to revoke permission: {message}`;
2289
+ static code = "INVALID_QUERY";
2290
+ static statusCode = 400;
2291
+ static description = `Invalid log query: {message}`;
2100
2292
  }
2101
- class GrantPermissionFailedError extends Error {
2293
+ class LogsNotFoundError extends Error {
2102
2294
  constructor(body) {
2103
2295
  super(
2104
- `GRANT_PERMISSION_FAILED: ${body.message}`
2296
+ `LOGS_NOT_FOUND: ${body.message}`
2105
2297
  );
2106
2298
  this.body = body;
2107
- this.name = "GrantPermissionFailedError";
2299
+ this.name = "LogsNotFoundError";
2108
2300
  }
2109
- static code = "GRANT_PERMISSION_FAILED";
2110
- static statusCode = 500;
2111
- static description = `Failed to grant permission: {message}`;
2301
+ static code = "LOGS_NOT_FOUND";
2302
+ static statusCode = 404;
2303
+ static description = `Logs not found for deployment: {deployment_id}`;
2112
2304
  }
2113
- class ListIdentitiesFailedError extends Error {
2305
+ class TriggerErrorError extends Error {
2114
2306
  constructor(body) {
2115
2307
  super(
2116
- `LIST_IDENTITIES_FAILED: ${body.message}`
2308
+ `TRIGGER_ERROR: ${body.message}`
2117
2309
  );
2118
2310
  this.body = body;
2119
- this.name = "ListIdentitiesFailedError";
2311
+ this.name = "TriggerErrorError";
2120
2312
  }
2121
- static code = "LIST_IDENTITIES_FAILED";
2313
+ static code = "TRIGGER_ERROR";
2122
2314
  static statusCode = 500;
2123
- static description = `Failed to list identities: {message}`;
2315
+ static description = `Failed to manage triggers: {message}`;
2124
2316
  }
2125
- class DeleteIdentityFailedError extends Error {
2317
+ class TokenErrorError extends Error {
2126
2318
  constructor(body) {
2127
2319
  super(
2128
- `DELETE_IDENTITY_FAILED: ${body.message}`
2320
+ `TOKEN_ERROR: ${body.message}`
2129
2321
  );
2130
2322
  this.body = body;
2131
- this.name = "DeleteIdentityFailedError";
2323
+ this.name = "TokenErrorError";
2132
2324
  }
2133
- static code = "DELETE_IDENTITY_FAILED";
2325
+ static code = "TOKEN_ERROR";
2134
2326
  static statusCode = 500;
2135
- static description = `Failed to delete identity: {message}`;
2327
+ static description = `Failed to manage tokens: {message}`;
2136
2328
  }
2137
- class CreateIdentityFailedError extends Error {
2329
+ class PermissionErrorError extends Error {
2138
2330
  constructor(body) {
2139
2331
  super(
2140
- `CREATE_IDENTITY_FAILED: ${body.message}`
2332
+ `PERMISSION_ERROR: ${body.message}`
2141
2333
  );
2142
2334
  this.body = body;
2143
- this.name = "CreateIdentityFailedError";
2335
+ this.name = "PermissionErrorError";
2144
2336
  }
2145
- static code = "CREATE_IDENTITY_FAILED";
2337
+ static code = "PERMISSION_ERROR";
2146
2338
  static statusCode = 500;
2147
- static description = `Failed to create identity: {message}`;
2148
- }
2149
- class VmPermissionNotFoundError extends Error {
2150
- constructor(body) {
2151
- super(
2152
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
2153
- );
2154
- this.body = body;
2155
- this.name = "VmPermissionNotFoundError";
2156
- }
2157
- static code = "VM_PERMISSION_NOT_FOUND";
2158
- static statusCode = 404;
2159
- static description = `VM permission not found`;
2339
+ static description = `Failed to manage permissions: {message}`;
2160
2340
  }
2161
- class PermissionNotFoundError extends Error {
2341
+ class IdentityErrorError extends Error {
2162
2342
  constructor(body) {
2163
2343
  super(
2164
- `PERMISSION_NOT_FOUND: ${body.message}`
2344
+ `IDENTITY_ERROR: ${body.message}`
2165
2345
  );
2166
2346
  this.body = body;
2167
- this.name = "PermissionNotFoundError";
2347
+ this.name = "IdentityErrorError";
2168
2348
  }
2169
- static code = "PERMISSION_NOT_FOUND";
2170
- static statusCode = 404;
2171
- static description = `Permission not found`;
2349
+ static code = "IDENTITY_ERROR";
2350
+ static statusCode = 500;
2351
+ static description = `Failed to manage identity: {message}`;
2172
2352
  }
2173
- class GitRepositoryAccessDeniedError extends Error {
2353
+ class GetContentFailedError extends Error {
2174
2354
  constructor(body) {
2175
2355
  super(
2176
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2356
+ `GET_CONTENT_FAILED: ${body.message}`
2177
2357
  );
2178
2358
  this.body = body;
2179
- this.name = "GitRepositoryAccessDeniedError";
2359
+ this.name = "GetContentFailedError";
2180
2360
  }
2181
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
2182
- static statusCode = 403;
2183
- static description = `You are not allowed to access this repository`;
2361
+ static code = "GET_CONTENT_FAILED";
2362
+ static statusCode = 500;
2363
+ static description = `Failed to get content: {message}`;
2184
2364
  }
2185
- class GitRepositoryNotFoundError extends Error {
2365
+ class ContentNotFoundError extends Error {
2186
2366
  constructor(body) {
2187
2367
  super(
2188
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
2368
+ `CONTENT_NOT_FOUND: ${body.message}`
2189
2369
  );
2190
2370
  this.body = body;
2191
- this.name = "GitRepositoryNotFoundError";
2371
+ this.name = "ContentNotFoundError";
2192
2372
  }
2193
- static code = "GIT_REPOSITORY_NOT_FOUND";
2373
+ static code = "CONTENT_NOT_FOUND";
2194
2374
  static statusCode = 404;
2195
- static description = `Repository not found`;
2196
- }
2197
- class CannotDeleteManagedIdentityError extends Error {
2198
- constructor(body) {
2199
- super(
2200
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
2201
- );
2202
- this.body = body;
2203
- this.name = "CannotDeleteManagedIdentityError";
2204
- }
2205
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2206
- static statusCode = 403;
2207
- static description = `Cannot delete managed identities`;
2208
- }
2209
- class CannotModifyManagedIdentityError extends Error {
2210
- constructor(body) {
2211
- super(
2212
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
2213
- );
2214
- this.body = body;
2215
- this.name = "CannotModifyManagedIdentityError";
2216
- }
2217
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2218
- static statusCode = 403;
2219
- static description = `Cannot modify managed identities`;
2375
+ static description = `Content not found: {path}`;
2220
2376
  }
2221
- class IdentityAccessDeniedError extends Error {
2377
+ class DownloadFailedError extends Error {
2222
2378
  constructor(body) {
2223
2379
  super(
2224
- `IDENTITY_ACCESS_DENIED: ${body.message}`
2380
+ `DOWNLOAD_FAILED: ${body.message}`
2225
2381
  );
2226
2382
  this.body = body;
2227
- this.name = "IdentityAccessDeniedError";
2383
+ this.name = "DownloadFailedError";
2228
2384
  }
2229
- static code = "IDENTITY_ACCESS_DENIED";
2230
- static statusCode = 403;
2231
- static description = `You are not allowed to access this identity`;
2385
+ static code = "DOWNLOAD_FAILED";
2386
+ static statusCode = 500;
2387
+ static description = `Failed to download repository: {message}`;
2232
2388
  }
2233
- class IdentityNotFoundError extends Error {
2389
+ class GitServerErrorError extends Error {
2234
2390
  constructor(body) {
2235
2391
  super(
2236
- `IDENTITY_NOT_FOUND: ${body.message}`
2392
+ `GIT_SERVER_ERROR: ${body.message}`
2237
2393
  );
2238
2394
  this.body = body;
2239
- this.name = "IdentityNotFoundError";
2395
+ this.name = "GitServerErrorError";
2240
2396
  }
2241
- static code = "IDENTITY_NOT_FOUND";
2242
- static statusCode = 404;
2243
- static description = `Identity not found`;
2397
+ static code = "GIT_SERVER_ERROR";
2398
+ static statusCode = 500;
2399
+ static description = `Git server error: {message}`;
2244
2400
  }
2245
- class UnauthorizedErrorError extends Error {
2401
+ class ParseResponseErrorError extends Error {
2246
2402
  constructor(body) {
2247
2403
  super(
2248
- `UNAUTHORIZED_ERROR: ${body.message}`
2404
+ `PARSE_RESPONSE_ERROR: ${body.message}`
2249
2405
  );
2250
2406
  this.body = body;
2251
- this.name = "UnauthorizedErrorError";
2407
+ this.name = "ParseResponseErrorError";
2252
2408
  }
2253
- static code = "UNAUTHORIZED_ERROR";
2254
- static statusCode = 401;
2255
- static description = `Unauthorized request to {route}`;
2409
+ static code = "PARSE_RESPONSE_ERROR";
2410
+ static statusCode = 500;
2411
+ static description = `Failed to parse response from Git server: {message}`;
2256
2412
  }
2257
- class LimitExceededError extends Error {
2413
+ class RepositoryAccessDeniedError extends Error {
2258
2414
  constructor(body) {
2259
2415
  super(
2260
- `LIMIT_EXCEEDED: ${body.message}`
2416
+ `REPOSITORY_ACCESS_DENIED: ${body.message}`
2261
2417
  );
2262
2418
  this.body = body;
2263
- this.name = "LimitExceededError";
2419
+ this.name = "RepositoryAccessDeniedError";
2264
2420
  }
2265
- static code = "LIMIT_EXCEEDED";
2421
+ static code = "REPOSITORY_ACCESS_DENIED";
2266
2422
  static statusCode = 403;
2267
- static description = `Managed domains limit exceeded: your plan allows {limit} verified domains, you have {current}`;
2268
- }
2269
- class FailedToProvisionCertificateError extends Error {
2270
- constructor(body) {
2271
- super(
2272
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2273
- );
2274
- this.body = body;
2275
- this.name = "FailedToProvisionCertificateError";
2276
- }
2277
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
2278
- static statusCode = 422;
2279
- static description = `Failed to provision certificate: {message}`;
2423
+ static description = `Repository does not belong to account`;
2280
2424
  }
2281
- class FailedToInsertDomainMappingError extends Error {
2425
+ class GitHubSyncFailedError extends Error {
2282
2426
  constructor(body) {
2283
2427
  super(
2284
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2428
+ `GIT_HUB_SYNC_FAILED: ${body.message}`
2285
2429
  );
2286
2430
  this.body = body;
2287
- this.name = "FailedToInsertDomainMappingError";
2431
+ this.name = "GitHubSyncFailedError";
2288
2432
  }
2289
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2433
+ static code = "GIT_HUB_SYNC_FAILED";
2290
2434
  static statusCode = 500;
2291
- static description = `Failed to insert domain mapping: {message}`;
2292
- }
2293
- class PermissionDeniedError extends Error {
2294
- constructor(body) {
2295
- super(
2296
- `PERMISSION_DENIED: ${body.message}`
2297
- );
2298
- this.body = body;
2299
- this.name = "PermissionDeniedError";
2300
- }
2301
- static code = "PERMISSION_DENIED";
2302
- static statusCode = 401;
2303
- static description = `Permission denied: {message}`;
2304
- }
2305
- class FailedToCheckPermissionsError extends Error {
2306
- constructor(body) {
2307
- super(
2308
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2309
- );
2310
- this.body = body;
2311
- this.name = "FailedToCheckPermissionsError";
2312
- }
2313
- static code = "FAILED_TO_CHECK_PERMISSIONS";
2314
- static statusCode = 502;
2315
- static description = `Failed to check permissions: {message}`;
2435
+ static description = `Failed to configure GitHub sync: {message}`;
2316
2436
  }
2317
- class FailedToListDomainsError extends Error {
2437
+ class UpdateDefaultBranchFailedError extends Error {
2318
2438
  constructor(body) {
2319
2439
  super(
2320
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
2440
+ `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2321
2441
  );
2322
2442
  this.body = body;
2323
- this.name = "FailedToListDomainsError";
2443
+ this.name = "UpdateDefaultBranchFailedError";
2324
2444
  }
2325
- static code = "FAILED_TO_LIST_DOMAINS";
2445
+ static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2326
2446
  static statusCode = 500;
2327
- static description = `Failed to list domains: {message}`;
2447
+ static description = `Failed to update default branch: {message}`;
2328
2448
  }
2329
- class FailedToListVerificationsError extends Error {
2449
+ class GetRepositoryInfoFailedError extends Error {
2330
2450
  constructor(body) {
2331
2451
  super(
2332
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2452
+ `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2333
2453
  );
2334
2454
  this.body = body;
2335
- this.name = "FailedToListVerificationsError";
2455
+ this.name = "GetRepositoryInfoFailedError";
2336
2456
  }
2337
- static code = "FAILED_TO_LIST_VERIFICATIONS";
2457
+ static code = "GET_REPOSITORY_INFO_FAILED";
2338
2458
  static statusCode = 500;
2339
- static description = `Failed to list verifications: {message}`;
2459
+ static description = `Failed to get repository info: {message}`;
2340
2460
  }
2341
- class FailedToVerifyDomainError extends Error {
2461
+ class ListRepositoriesFailedError extends Error {
2342
2462
  constructor(body) {
2343
2463
  super(
2344
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2464
+ `LIST_REPOSITORIES_FAILED: ${body.message}`
2345
2465
  );
2346
2466
  this.body = body;
2347
- this.name = "FailedToVerifyDomainError";
2467
+ this.name = "ListRepositoriesFailedError";
2348
2468
  }
2349
- static code = "FAILED_TO_VERIFY_DOMAIN";
2469
+ static code = "LIST_REPOSITORIES_FAILED";
2350
2470
  static statusCode = 500;
2351
- static description = `Failed to verify domain: {message}`;
2352
- }
2353
- class VerificationFailedError extends Error {
2354
- constructor(body) {
2355
- super(
2356
- `VERIFICATION_FAILED: ${body.message}`
2357
- );
2358
- this.body = body;
2359
- this.name = "VerificationFailedError";
2360
- }
2361
- static code = "VERIFICATION_FAILED";
2362
- static statusCode = 400;
2363
- static description = `Domain verification failed: {message}`;
2471
+ static description = `Failed to list repositories: {message}`;
2364
2472
  }
2365
- class FailedToDeleteVerificationError extends Error {
2473
+ class DeleteRepositoryFailedError extends Error {
2366
2474
  constructor(body) {
2367
2475
  super(
2368
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2476
+ `DELETE_REPOSITORY_FAILED: ${body.message}`
2369
2477
  );
2370
2478
  this.body = body;
2371
- this.name = "FailedToDeleteVerificationError";
2479
+ this.name = "DeleteRepositoryFailedError";
2372
2480
  }
2373
- static code = "FAILED_TO_DELETE_VERIFICATION";
2374
- static statusCode = 400;
2375
- static description = `Failed to delete verification: {message}`;
2481
+ static code = "DELETE_REPOSITORY_FAILED";
2482
+ static statusCode = 500;
2483
+ static description = `Failed to delete repository: {message}`;
2376
2484
  }
2377
- class VerificationNotFoundError extends Error {
2485
+ class CreateRepositoryFailedError extends Error {
2378
2486
  constructor(body) {
2379
2487
  super(
2380
- `VERIFICATION_NOT_FOUND: ${body.message}`
2488
+ `CREATE_REPOSITORY_FAILED: ${body.message}`
2381
2489
  );
2382
2490
  this.body = body;
2383
- this.name = "VerificationNotFoundError";
2491
+ this.name = "CreateRepositoryFailedError";
2384
2492
  }
2385
- static code = "VERIFICATION_NOT_FOUND";
2386
- static statusCode = 404;
2387
- static description = `Verification request not found for domain: {domain}`;
2493
+ static code = "CREATE_REPOSITORY_FAILED";
2494
+ static statusCode = 500;
2495
+ static description = `Failed to create repository: {message}`;
2388
2496
  }
2389
- class FailedToCreateVerificationCodeError extends Error {
2497
+ class SerializationErrorError extends Error {
2390
2498
  constructor(body) {
2391
2499
  super(
2392
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2500
+ `SERIALIZATION_ERROR: ${body.message}`
2393
2501
  );
2394
2502
  this.body = body;
2395
- this.name = "FailedToCreateVerificationCodeError";
2503
+ this.name = "SerializationErrorError";
2396
2504
  }
2397
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2505
+ static code = "SERIALIZATION_ERROR";
2398
2506
  static statusCode = 400;
2399
- static description = `Failed to create verification code: {message}`;
2507
+ static description = `Failed to serialize request: {message}`;
2400
2508
  }
2401
- class InvalidDomainError extends Error {
2509
+ class GitInvalidRequestError extends Error {
2402
2510
  constructor(body) {
2403
2511
  super(
2404
- `INVALID_DOMAIN: ${body.message}`
2512
+ `GIT_INVALID_REQUEST: ${body.message}`
2405
2513
  );
2406
2514
  this.body = body;
2407
- this.name = "InvalidDomainError";
2515
+ this.name = "GitInvalidRequestError";
2408
2516
  }
2409
- static code = "INVALID_DOMAIN";
2517
+ static code = "GIT_INVALID_REQUEST";
2410
2518
  static statusCode = 400;
2411
- static description = `Invalid domain: {domain}`;
2412
- }
2413
- class CloudstateInternalErrorError extends Error {
2414
- constructor(body) {
2415
- super(
2416
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2417
- );
2418
- this.body = body;
2419
- this.name = "CloudstateInternalErrorError";
2420
- }
2421
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2422
- static statusCode = 500;
2423
- static description = `Internal error: {message}`;
2424
- }
2425
- class CloudstateDatabaseErrorError extends Error {
2426
- constructor(body) {
2427
- super(
2428
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2429
- );
2430
- this.body = body;
2431
- this.name = "CloudstateDatabaseErrorError";
2432
- }
2433
- static code = "CLOUDSTATE_DATABASE_ERROR";
2434
- static statusCode = 500;
2435
- static description = `Database operation failed: {message}`;
2436
- }
2437
- class CloudstateAccessDeniedError extends Error {
2438
- constructor(body) {
2439
- super(
2440
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2441
- );
2442
- this.body = body;
2443
- this.name = "CloudstateAccessDeniedError";
2444
- }
2445
- static code = "CLOUDSTATE_ACCESS_DENIED";
2446
- static statusCode = 403;
2447
- static description = `Access denied to project: {project_id}`;
2519
+ static description = `Invalid request: {message}`;
2448
2520
  }
2449
- class RestoreFailedError extends Error {
2521
+ class RepositoryNotFoundError extends Error {
2450
2522
  constructor(body) {
2451
2523
  super(
2452
- `RESTORE_FAILED: ${body.message}`
2524
+ `REPOSITORY_NOT_FOUND: ${body.message}`
2453
2525
  );
2454
2526
  this.body = body;
2455
- this.name = "RestoreFailedError";
2456
- }
2457
- static code = "RESTORE_FAILED";
2458
- static statusCode = 500;
2459
- static description = `Failed to restore from backup: {message}`;
2527
+ this.name = "RepositoryNotFoundError";
2528
+ }
2529
+ static code = "REPOSITORY_NOT_FOUND";
2530
+ static statusCode = 404;
2531
+ static description = `Repository not found: {repo_id}`;
2460
2532
  }
2461
- class CreateBackupFailedError extends Error {
2533
+ class DomainOwnershipVerificationFailedError extends Error {
2462
2534
  constructor(body) {
2463
2535
  super(
2464
- `CREATE_BACKUP_FAILED: ${body.message}`
2536
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2465
2537
  );
2466
2538
  this.body = body;
2467
- this.name = "CreateBackupFailedError";
2539
+ this.name = "DomainOwnershipVerificationFailedError";
2468
2540
  }
2469
- static code = "CREATE_BACKUP_FAILED";
2470
- static statusCode = 500;
2471
- static description = `Failed to create backup: {message}`;
2541
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2542
+ static statusCode = 403;
2543
+ static description = `Domain ownership verification failed`;
2472
2544
  }
2473
- class BackupFailedError extends Error {
2545
+ class ErrorDeletingRecordError extends Error {
2474
2546
  constructor(body) {
2475
2547
  super(
2476
- `BACKUP_FAILED: ${body.message}`
2548
+ `ERROR_DELETING_RECORD: ${body.message}`
2477
2549
  );
2478
2550
  this.body = body;
2479
- this.name = "BackupFailedError";
2551
+ this.name = "ErrorDeletingRecordError";
2480
2552
  }
2481
- static code = "BACKUP_FAILED";
2553
+ static code = "ERROR_DELETING_RECORD";
2482
2554
  static statusCode = 500;
2483
- static description = `Backup failed: {message}`;
2555
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2484
2556
  }
2485
- class DeploymentFailedError extends Error {
2557
+ class RecordOwnershipErrorError extends Error {
2486
2558
  constructor(body) {
2487
2559
  super(
2488
- `DEPLOYMENT_FAILED: ${body.message}`
2560
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
2489
2561
  );
2490
2562
  this.body = body;
2491
- this.name = "DeploymentFailedError";
2563
+ this.name = "RecordOwnershipErrorError";
2492
2564
  }
2493
- static code = "DEPLOYMENT_FAILED";
2494
- static statusCode = 500;
2495
- static description = `Deployment failed: {message}`;
2565
+ static code = "RECORD_OWNERSHIP_ERROR";
2566
+ static statusCode = 403;
2567
+ static description = `Account {account_id} does not own record {record_id}`;
2496
2568
  }
2497
- class InvalidDeploymentRequestError extends Error {
2569
+ class ErrorCreatingRecordError extends Error {
2498
2570
  constructor(body) {
2499
2571
  super(
2500
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2572
+ `ERROR_CREATING_RECORD: ${body.message}`
2501
2573
  );
2502
2574
  this.body = body;
2503
- this.name = "InvalidDeploymentRequestError";
2575
+ this.name = "ErrorCreatingRecordError";
2504
2576
  }
2505
- static code = "INVALID_DEPLOYMENT_REQUEST";
2506
- static statusCode = 400;
2507
- static description = `Invalid deployment request: {message}`;
2577
+ static code = "ERROR_CREATING_RECORD";
2578
+ static statusCode = 500;
2579
+ static description = `Error creating DNS record: {message}`;
2508
2580
  }
2509
- class ProjectNotFoundError extends Error {
2581
+ class DomainOwnershipErrorError extends Error {
2510
2582
  constructor(body) {
2511
2583
  super(
2512
- `PROJECT_NOT_FOUND: ${body.message}`
2584
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2513
2585
  );
2514
2586
  this.body = body;
2515
- this.name = "ProjectNotFoundError";
2587
+ this.name = "DomainOwnershipErrorError";
2516
2588
  }
2517
- static code = "PROJECT_NOT_FOUND";
2518
- static statusCode = 404;
2519
- static description = `Project not found: {project_id}`;
2589
+ static code = "DOMAIN_OWNERSHIP_ERROR";
2590
+ static statusCode = 403;
2591
+ static description = `Account {account_id} does not own domain {domain}`;
2520
2592
  }
2521
- class AccessDeniedError extends Error {
2593
+ class UnauthorizedErrorError extends Error {
2522
2594
  constructor(body) {
2523
2595
  super(
2524
- `ACCESS_DENIED: ${body.message}`
2596
+ `UNAUTHORIZED_ERROR: ${body.message}`
2525
2597
  );
2526
2598
  this.body = body;
2527
- this.name = "AccessDeniedError";
2599
+ this.name = "UnauthorizedErrorError";
2528
2600
  }
2529
- static code = "ACCESS_DENIED";
2530
- static statusCode = 403;
2531
- static description = `VM access denied`;
2601
+ static code = "UNAUTHORIZED_ERROR";
2602
+ static statusCode = 401;
2603
+ static description = `Unauthorized request to {route}`;
2532
2604
  }
2533
- class BuildFailedError extends Error {
2605
+ class BranchNameEmptyError extends Error {
2534
2606
  constructor(body) {
2535
2607
  super(
2536
- `BUILD_FAILED: ${body.message}`
2608
+ `BRANCH_NAME_EMPTY: ${body.message}`
2537
2609
  );
2538
2610
  this.body = body;
2539
- this.name = "BuildFailedError";
2611
+ this.name = "BranchNameEmptyError";
2540
2612
  }
2541
- static code = "BUILD_FAILED";
2542
- static statusCode = 500;
2543
- static description = `Build failed on VM {vm_id}`;
2613
+ static code = "BRANCH_NAME_EMPTY";
2614
+ static statusCode = 400;
2615
+ static description = `Branch name cannot be empty`;
2544
2616
  }
2545
2617
  class ServerDeploymentFailedError extends Error {
2546
2618
  constructor(body) {
@@ -2722,497 +2794,401 @@ class InternalResizeVmNotFoundError extends Error {
2722
2794
  static statusCode = 404;
2723
2795
  static description = `VM not found`;
2724
2796
  }
2725
- class DomainOwnershipVerificationFailedError extends Error {
2726
- constructor(body) {
2727
- super(
2728
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2729
- );
2730
- this.body = body;
2731
- this.name = "DomainOwnershipVerificationFailedError";
2732
- }
2733
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2734
- static statusCode = 403;
2735
- static description = `Domain ownership verification failed`;
2736
- }
2737
- class ErrorDeletingRecordError extends Error {
2738
- constructor(body) {
2739
- super(
2740
- `ERROR_DELETING_RECORD: ${body.message}`
2741
- );
2742
- this.body = body;
2743
- this.name = "ErrorDeletingRecordError";
2744
- }
2745
- static code = "ERROR_DELETING_RECORD";
2746
- static statusCode = 500;
2747
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2748
- }
2749
- class RecordOwnershipErrorError extends Error {
2750
- constructor(body) {
2751
- super(
2752
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
2753
- );
2754
- this.body = body;
2755
- this.name = "RecordOwnershipErrorError";
2756
- }
2757
- static code = "RECORD_OWNERSHIP_ERROR";
2758
- static statusCode = 403;
2759
- static description = `Account {account_id} does not own record {record_id}`;
2760
- }
2761
- class ErrorCreatingRecordError extends Error {
2762
- constructor(body) {
2763
- super(
2764
- `ERROR_CREATING_RECORD: ${body.message}`
2765
- );
2766
- this.body = body;
2767
- this.name = "ErrorCreatingRecordError";
2768
- }
2769
- static code = "ERROR_CREATING_RECORD";
2770
- static statusCode = 500;
2771
- static description = `Error creating DNS record: {message}`;
2772
- }
2773
- class DomainOwnershipErrorError extends Error {
2774
- constructor(body) {
2775
- super(
2776
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2777
- );
2778
- this.body = body;
2779
- this.name = "DomainOwnershipErrorError";
2780
- }
2781
- static code = "DOMAIN_OWNERSHIP_ERROR";
2782
- static statusCode = 403;
2783
- static description = `Account {account_id} does not own domain {domain}`;
2784
- }
2785
- class GitRepoLimitExceededError extends Error {
2786
- constructor(body) {
2787
- super(
2788
- `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
2789
- );
2790
- this.body = body;
2791
- this.name = "GitRepoLimitExceededError";
2792
- }
2793
- static code = "GIT_REPO_LIMIT_EXCEEDED";
2794
- static statusCode = 403;
2795
- static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
2796
- }
2797
- class RootfsSizeTooLargeError extends Error {
2798
- constructor(body) {
2799
- super(
2800
- `ROOTFS_SIZE_TOO_LARGE: ${body.message}`
2801
- );
2802
- this.body = body;
2803
- this.name = "RootfsSizeTooLargeError";
2804
- }
2805
- static code = "ROOTFS_SIZE_TOO_LARGE";
2806
- static statusCode = 400;
2807
- static description = `rootfsSizeGb {got_gb} is too large`;
2808
- }
2809
- class MemSizeTooLargeError extends Error {
2810
- constructor(body) {
2811
- super(
2812
- `MEM_SIZE_TOO_LARGE: ${body.message}`
2813
- );
2814
- this.body = body;
2815
- this.name = "MemSizeTooLargeError";
2816
- }
2817
- static code = "MEM_SIZE_TOO_LARGE";
2818
- static statusCode = 400;
2819
- static description = `memSizeGb {got_gb} is too large`;
2820
- }
2821
- class RootfsOverPlanLimitError extends Error {
2797
+ class ExecuteLimitExceededError extends Error {
2822
2798
  constructor(body) {
2823
2799
  super(
2824
- `ROOTFS_OVER_PLAN_LIMIT: ${body.message}`
2800
+ `EXECUTE_LIMIT_EXCEEDED: ${body.message}`
2825
2801
  );
2826
2802
  this.body = body;
2827
- this.name = "RootfsOverPlanLimitError";
2803
+ this.name = "ExecuteLimitExceededError";
2828
2804
  }
2829
- static code = "ROOTFS_OVER_PLAN_LIMIT";
2805
+ static code = "EXECUTE_LIMIT_EXCEEDED";
2830
2806
  static statusCode = 403;
2831
- static description = `rootfsSizeMb {got} MB exceeds your plan's maximum of {max} MB`;
2807
+ static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
2832
2808
  }
2833
- class MemOverPlanLimitError extends Error {
2809
+ class DomainOwnershipNotVerifiedError extends Error {
2834
2810
  constructor(body) {
2835
2811
  super(
2836
- `MEM_OVER_PLAN_LIMIT: ${body.message}`
2812
+ `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
2837
2813
  );
2838
2814
  this.body = body;
2839
- this.name = "MemOverPlanLimitError";
2815
+ this.name = "DomainOwnershipNotVerifiedError";
2840
2816
  }
2841
- static code = "MEM_OVER_PLAN_LIMIT";
2842
- static statusCode = 403;
2843
- static description = `memSizeMb {got} MiB exceeds your plan's maximum of {max} MiB`;
2817
+ static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
2818
+ static statusCode = 401;
2819
+ static description = `You have not verified ownership of domain: {domain}`;
2844
2820
  }
2845
- class VcpuOverPlanLimitError extends Error {
2821
+ class VmAccessDeniedForMappingError extends Error {
2846
2822
  constructor(body) {
2847
2823
  super(
2848
- `VCPU_OVER_PLAN_LIMIT: ${body.message}`
2824
+ `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
2849
2825
  );
2850
2826
  this.body = body;
2851
- this.name = "VcpuOverPlanLimitError";
2827
+ this.name = "VmAccessDeniedForMappingError";
2852
2828
  }
2853
- static code = "VCPU_OVER_PLAN_LIMIT";
2854
- static statusCode = 403;
2855
- static description = `vcpuCount {got} exceeds your plan's maximum of {max}`;
2829
+ static code = "VM_ACCESS_DENIED_FOR_MAPPING";
2830
+ static statusCode = 401;
2831
+ static description = `You do not have permission to map to this VM: {vm_id}`;
2856
2832
  }
2857
- class CustomSizingNotAllowedError extends Error {
2833
+ class DeploymentAccessDeniedError extends Error {
2858
2834
  constructor(body) {
2859
2835
  super(
2860
- `CUSTOM_SIZING_NOT_ALLOWED: ${body.message}`
2836
+ `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
2861
2837
  );
2862
2838
  this.body = body;
2863
- this.name = "CustomSizingNotAllowedError";
2839
+ this.name = "DeploymentAccessDeniedError";
2864
2840
  }
2865
- static code = "CUSTOM_SIZING_NOT_ALLOWED";
2866
- static statusCode = 403;
2867
- static description = `Your plan does not allow custom VM sizing (vcpu/memory/rootfs). Upgrade your plan or omit these fields to use the plan defaults.`;
2841
+ static code = "DEPLOYMENT_ACCESS_DENIED";
2842
+ static statusCode = 401;
2843
+ static description = `You do not have permission to map to this deployment: {deployment_id}`;
2868
2844
  }
2869
- class SnapshotLimitExceededError extends Error {
2845
+ class FailedToProvisionCertificateForMappingError extends Error {
2870
2846
  constructor(body) {
2871
2847
  super(
2872
- `SNAPSHOT_LIMIT_EXCEEDED: ${body.message}`
2848
+ `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
2873
2849
  );
2874
2850
  this.body = body;
2875
- this.name = "SnapshotLimitExceededError";
2851
+ this.name = "FailedToProvisionCertificateForMappingError";
2876
2852
  }
2877
- static code = "SNAPSHOT_LIMIT_EXCEEDED";
2878
- static statusCode = 403;
2879
- static description = `Snapshot limit exceeded: your plan allows {limit} total snapshots, you currently have {current}`;
2853
+ static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
2854
+ static statusCode = 422;
2855
+ static description = `Failed to provision certificate for mapping: {message}`;
2880
2856
  }
2881
- class PersistentVmsNotAllowedError extends Error {
2857
+ class FailedInsertDomainMappingError extends Error {
2882
2858
  constructor(body) {
2883
2859
  super(
2884
- `PERSISTENT_VMS_NOT_ALLOWED: ${body.message}`
2860
+ `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
2885
2861
  );
2886
2862
  this.body = body;
2887
- this.name = "PersistentVmsNotAllowedError";
2863
+ this.name = "FailedInsertDomainMappingError";
2888
2864
  }
2889
- static code = "PERSISTENT_VMS_NOT_ALLOWED";
2890
- static statusCode = 403;
2891
- static description = `Your plan does not allow persistent VMs. Use sticky or ephemeral persistence instead, or upgrade your plan.`;
2865
+ static code = "FAILED_INSERT_DOMAIN_MAPPING";
2866
+ static statusCode = 500;
2867
+ static description = `Failed to insert domain mapping: {message}`;
2892
2868
  }
2893
- class TotalVmLimitExceededError extends Error {
2869
+ class DomainAlreadyExistsError extends Error {
2894
2870
  constructor(body) {
2895
2871
  super(
2896
- `TOTAL_VM_LIMIT_EXCEEDED: ${body.message}`
2872
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
2897
2873
  );
2898
2874
  this.body = body;
2899
- this.name = "TotalVmLimitExceededError";
2875
+ this.name = "DomainAlreadyExistsError";
2900
2876
  }
2901
- static code = "TOTAL_VM_LIMIT_EXCEEDED";
2902
- static statusCode = 403;
2903
- static description = `Total VM limit exceeded: your plan allows {limit} total VMs, you currently have {current}`;
2877
+ static code = "DOMAIN_ALREADY_EXISTS";
2878
+ static statusCode = 400;
2879
+ static description = `Domain already exists: {domain}`;
2904
2880
  }
2905
- class VmLimitExceededError extends Error {
2881
+ class FailedToInsertOwnershipError extends Error {
2906
2882
  constructor(body) {
2907
2883
  super(
2908
- `VM_LIMIT_EXCEEDED: ${body.message}`
2884
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2909
2885
  );
2910
2886
  this.body = body;
2911
- this.name = "VmLimitExceededError";
2887
+ this.name = "FailedToInsertOwnershipError";
2912
2888
  }
2913
- static code = "VM_LIMIT_EXCEEDED";
2914
- static statusCode = 403;
2915
- static description = `VM limit exceeded: your plan allows {limit} active VMs, you currently have {current}`;
2889
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
2890
+ static statusCode = 500;
2891
+ static description = `Failed to insert domain ownership: {message}`;
2916
2892
  }
2917
- class ObservabilityDatabaseErrorError extends Error {
2893
+ class FailedRemoveDomainMappingError extends Error {
2918
2894
  constructor(body) {
2919
2895
  super(
2920
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2896
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2921
2897
  );
2922
2898
  this.body = body;
2923
- this.name = "ObservabilityDatabaseErrorError";
2899
+ this.name = "FailedRemoveDomainMappingError";
2924
2900
  }
2925
- static code = "OBSERVABILITY_DATABASE_ERROR";
2901
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2926
2902
  static statusCode = 500;
2927
- static description = `Database operation failed: {message}`;
2903
+ static description = `Failed to remove domain mapping: {message}`;
2928
2904
  }
2929
- class ObservabilityAccessDeniedError extends Error {
2905
+ class FailedPermissionsCheckError extends Error {
2930
2906
  constructor(body) {
2931
2907
  super(
2932
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2908
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
2933
2909
  );
2934
2910
  this.body = body;
2935
- this.name = "ObservabilityAccessDeniedError";
2911
+ this.name = "FailedPermissionsCheckError";
2936
2912
  }
2937
- static code = "OBSERVABILITY_ACCESS_DENIED";
2938
- static statusCode = 403;
2939
- static description = `Access denied to logs for deployment: {deployment_id}`;
2913
+ static code = "FAILED_PERMISSIONS_CHECK";
2914
+ static statusCode = 401;
2915
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
2940
2916
  }
2941
- class ParseLogsFailedError extends Error {
2917
+ class FailedToCheckDomainMappingPermissionsError extends Error {
2942
2918
  constructor(body) {
2943
2919
  super(
2944
- `PARSE_LOGS_FAILED: ${body.message}`
2920
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2945
2921
  );
2946
2922
  this.body = body;
2947
- this.name = "ParseLogsFailedError";
2923
+ this.name = "FailedToCheckDomainMappingPermissionsError";
2948
2924
  }
2949
- static code = "PARSE_LOGS_FAILED";
2950
- static statusCode = 500;
2951
- static description = `Failed to parse logs: {message}`;
2925
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2926
+ static statusCode = 502;
2927
+ static description = `Failed to check permissions: {message}`;
2952
2928
  }
2953
- class RetrieveLogsFailedError extends Error {
2929
+ class FailedToPreRegisterError extends Error {
2954
2930
  constructor(body) {
2955
2931
  super(
2956
- `RETRIEVE_LOGS_FAILED: ${body.message}`
2932
+ `FAILED_TO_PRE_REGISTER: ${body.message}`
2957
2933
  );
2958
2934
  this.body = body;
2959
- this.name = "RetrieveLogsFailedError";
2935
+ this.name = "FailedToPreRegisterError";
2960
2936
  }
2961
- static code = "RETRIEVE_LOGS_FAILED";
2937
+ static code = "FAILED_TO_PRE_REGISTER";
2962
2938
  static statusCode = 500;
2963
- static description = `Failed to retrieve logs: {message}`;
2939
+ static description = `Failed to pre-register fork ownership for vm {vm_id}: {details}`;
2964
2940
  }
2965
- class InvalidQueryError extends Error {
2941
+ class AccessDeniedError extends Error {
2966
2942
  constructor(body) {
2967
2943
  super(
2968
- `INVALID_QUERY: ${body.message}`
2944
+ `ACCESS_DENIED: ${body.message}`
2969
2945
  );
2970
2946
  this.body = body;
2971
- this.name = "InvalidQueryError";
2947
+ this.name = "AccessDeniedError";
2972
2948
  }
2973
- static code = "INVALID_QUERY";
2974
- static statusCode = 400;
2975
- static description = `Invalid log query: {message}`;
2949
+ static code = "ACCESS_DENIED";
2950
+ static statusCode = 403;
2951
+ static description = `VM access denied`;
2976
2952
  }
2977
- class LogsNotFoundError extends Error {
2953
+ class PermissionAlreadyExistsError extends Error {
2978
2954
  constructor(body) {
2979
2955
  super(
2980
- `LOGS_NOT_FOUND: ${body.message}`
2956
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
2981
2957
  );
2982
2958
  this.body = body;
2983
- this.name = "LogsNotFoundError";
2959
+ this.name = "PermissionAlreadyExistsError";
2984
2960
  }
2985
- static code = "LOGS_NOT_FOUND";
2986
- static statusCode = 404;
2987
- static description = `Logs not found for deployment: {deployment_id}`;
2961
+ static code = "PERMISSION_ALREADY_EXISTS";
2962
+ static statusCode = 409;
2963
+ static description = `Permission already exists`;
2988
2964
  }
2989
- class TriggerErrorError extends Error {
2965
+ class ListTokensFailedError extends Error {
2990
2966
  constructor(body) {
2991
2967
  super(
2992
- `TRIGGER_ERROR: ${body.message}`
2968
+ `LIST_TOKENS_FAILED: ${body.message}`
2993
2969
  );
2994
2970
  this.body = body;
2995
- this.name = "TriggerErrorError";
2971
+ this.name = "ListTokensFailedError";
2996
2972
  }
2997
- static code = "TRIGGER_ERROR";
2973
+ static code = "LIST_TOKENS_FAILED";
2998
2974
  static statusCode = 500;
2999
- static description = `Failed to manage triggers: {message}`;
2975
+ static description = `Failed to list tokens: {message}`;
3000
2976
  }
3001
- class TokenErrorError extends Error {
2977
+ class RevokeTokenFailedError extends Error {
3002
2978
  constructor(body) {
3003
2979
  super(
3004
- `TOKEN_ERROR: ${body.message}`
2980
+ `REVOKE_TOKEN_FAILED: ${body.message}`
3005
2981
  );
3006
2982
  this.body = body;
3007
- this.name = "TokenErrorError";
2983
+ this.name = "RevokeTokenFailedError";
3008
2984
  }
3009
- static code = "TOKEN_ERROR";
2985
+ static code = "REVOKE_TOKEN_FAILED";
3010
2986
  static statusCode = 500;
3011
- static description = `Failed to manage tokens: {message}`;
2987
+ static description = `Failed to revoke token: {message}`;
3012
2988
  }
3013
- class PermissionErrorError extends Error {
2989
+ class CreateTokenFailedError extends Error {
3014
2990
  constructor(body) {
3015
2991
  super(
3016
- `PERMISSION_ERROR: ${body.message}`
2992
+ `CREATE_TOKEN_FAILED: ${body.message}`
3017
2993
  );
3018
2994
  this.body = body;
3019
- this.name = "PermissionErrorError";
2995
+ this.name = "CreateTokenFailedError";
3020
2996
  }
3021
- static code = "PERMISSION_ERROR";
2997
+ static code = "CREATE_TOKEN_FAILED";
3022
2998
  static statusCode = 500;
3023
- static description = `Failed to manage permissions: {message}`;
2999
+ static description = `Failed to create token: {message}`;
3024
3000
  }
3025
- class IdentityErrorError extends Error {
3001
+ class ListPermissionsFailedError extends Error {
3026
3002
  constructor(body) {
3027
3003
  super(
3028
- `IDENTITY_ERROR: ${body.message}`
3004
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
3029
3005
  );
3030
3006
  this.body = body;
3031
- this.name = "IdentityErrorError";
3007
+ this.name = "ListPermissionsFailedError";
3032
3008
  }
3033
- static code = "IDENTITY_ERROR";
3009
+ static code = "LIST_PERMISSIONS_FAILED";
3034
3010
  static statusCode = 500;
3035
- static description = `Failed to manage identity: {message}`;
3011
+ static description = `Failed to list permissions: {message}`;
3036
3012
  }
3037
- class GetContentFailedError extends Error {
3013
+ class GetPermissionFailedError extends Error {
3038
3014
  constructor(body) {
3039
3015
  super(
3040
- `GET_CONTENT_FAILED: ${body.message}`
3016
+ `GET_PERMISSION_FAILED: ${body.message}`
3041
3017
  );
3042
3018
  this.body = body;
3043
- this.name = "GetContentFailedError";
3019
+ this.name = "GetPermissionFailedError";
3044
3020
  }
3045
- static code = "GET_CONTENT_FAILED";
3021
+ static code = "GET_PERMISSION_FAILED";
3046
3022
  static statusCode = 500;
3047
- static description = `Failed to get content: {message}`;
3023
+ static description = `Failed to get permission: {message}`;
3048
3024
  }
3049
- class ContentNotFoundError extends Error {
3025
+ class UpdatePermissionFailedError extends Error {
3050
3026
  constructor(body) {
3051
3027
  super(
3052
- `CONTENT_NOT_FOUND: ${body.message}`
3028
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
3053
3029
  );
3054
3030
  this.body = body;
3055
- this.name = "ContentNotFoundError";
3031
+ this.name = "UpdatePermissionFailedError";
3056
3032
  }
3057
- static code = "CONTENT_NOT_FOUND";
3058
- static statusCode = 404;
3059
- static description = `Content not found: {path}`;
3033
+ static code = "UPDATE_PERMISSION_FAILED";
3034
+ static statusCode = 500;
3035
+ static description = `Failed to update permission: {message}`;
3060
3036
  }
3061
- class DownloadFailedError extends Error {
3037
+ class RevokePermissionFailedError extends Error {
3062
3038
  constructor(body) {
3063
3039
  super(
3064
- `DOWNLOAD_FAILED: ${body.message}`
3040
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
3065
3041
  );
3066
3042
  this.body = body;
3067
- this.name = "DownloadFailedError";
3043
+ this.name = "RevokePermissionFailedError";
3068
3044
  }
3069
- static code = "DOWNLOAD_FAILED";
3045
+ static code = "REVOKE_PERMISSION_FAILED";
3070
3046
  static statusCode = 500;
3071
- static description = `Failed to download repository: {message}`;
3047
+ static description = `Failed to revoke permission: {message}`;
3072
3048
  }
3073
- class GitServerErrorError extends Error {
3049
+ class GrantPermissionFailedError extends Error {
3074
3050
  constructor(body) {
3075
3051
  super(
3076
- `GIT_SERVER_ERROR: ${body.message}`
3052
+ `GRANT_PERMISSION_FAILED: ${body.message}`
3077
3053
  );
3078
3054
  this.body = body;
3079
- this.name = "GitServerErrorError";
3055
+ this.name = "GrantPermissionFailedError";
3080
3056
  }
3081
- static code = "GIT_SERVER_ERROR";
3057
+ static code = "GRANT_PERMISSION_FAILED";
3082
3058
  static statusCode = 500;
3083
- static description = `Git server error: {message}`;
3059
+ static description = `Failed to grant permission: {message}`;
3084
3060
  }
3085
- class ParseResponseErrorError extends Error {
3061
+ class ListIdentitiesFailedError extends Error {
3086
3062
  constructor(body) {
3087
3063
  super(
3088
- `PARSE_RESPONSE_ERROR: ${body.message}`
3064
+ `LIST_IDENTITIES_FAILED: ${body.message}`
3089
3065
  );
3090
3066
  this.body = body;
3091
- this.name = "ParseResponseErrorError";
3067
+ this.name = "ListIdentitiesFailedError";
3092
3068
  }
3093
- static code = "PARSE_RESPONSE_ERROR";
3069
+ static code = "LIST_IDENTITIES_FAILED";
3094
3070
  static statusCode = 500;
3095
- static description = `Failed to parse response from Git server: {message}`;
3071
+ static description = `Failed to list identities: {message}`;
3096
3072
  }
3097
- class RepositoryAccessDeniedError extends Error {
3073
+ class DeleteIdentityFailedError extends Error {
3098
3074
  constructor(body) {
3099
3075
  super(
3100
- `REPOSITORY_ACCESS_DENIED: ${body.message}`
3076
+ `DELETE_IDENTITY_FAILED: ${body.message}`
3101
3077
  );
3102
3078
  this.body = body;
3103
- this.name = "RepositoryAccessDeniedError";
3079
+ this.name = "DeleteIdentityFailedError";
3104
3080
  }
3105
- static code = "REPOSITORY_ACCESS_DENIED";
3106
- static statusCode = 403;
3107
- static description = `Repository does not belong to account`;
3081
+ static code = "DELETE_IDENTITY_FAILED";
3082
+ static statusCode = 500;
3083
+ static description = `Failed to delete identity: {message}`;
3108
3084
  }
3109
- class GitHubSyncFailedError extends Error {
3085
+ class CreateIdentityFailedError extends Error {
3110
3086
  constructor(body) {
3111
3087
  super(
3112
- `GIT_HUB_SYNC_FAILED: ${body.message}`
3088
+ `CREATE_IDENTITY_FAILED: ${body.message}`
3113
3089
  );
3114
3090
  this.body = body;
3115
- this.name = "GitHubSyncFailedError";
3091
+ this.name = "CreateIdentityFailedError";
3116
3092
  }
3117
- static code = "GIT_HUB_SYNC_FAILED";
3093
+ static code = "CREATE_IDENTITY_FAILED";
3118
3094
  static statusCode = 500;
3119
- static description = `Failed to configure GitHub sync: {message}`;
3095
+ static description = `Failed to create identity: {message}`;
3120
3096
  }
3121
- class UpdateDefaultBranchFailedError extends Error {
3097
+ class VmPermissionNotFoundError extends Error {
3122
3098
  constructor(body) {
3123
3099
  super(
3124
- `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
3100
+ `VM_PERMISSION_NOT_FOUND: ${body.message}`
3125
3101
  );
3126
3102
  this.body = body;
3127
- this.name = "UpdateDefaultBranchFailedError";
3103
+ this.name = "VmPermissionNotFoundError";
3128
3104
  }
3129
- static code = "UPDATE_DEFAULT_BRANCH_FAILED";
3130
- static statusCode = 500;
3131
- static description = `Failed to update default branch: {message}`;
3105
+ static code = "VM_PERMISSION_NOT_FOUND";
3106
+ static statusCode = 404;
3107
+ static description = `VM permission not found`;
3132
3108
  }
3133
- class GetRepositoryInfoFailedError extends Error {
3109
+ class PermissionNotFoundError extends Error {
3134
3110
  constructor(body) {
3135
3111
  super(
3136
- `GET_REPOSITORY_INFO_FAILED: ${body.message}`
3112
+ `PERMISSION_NOT_FOUND: ${body.message}`
3137
3113
  );
3138
3114
  this.body = body;
3139
- this.name = "GetRepositoryInfoFailedError";
3115
+ this.name = "PermissionNotFoundError";
3140
3116
  }
3141
- static code = "GET_REPOSITORY_INFO_FAILED";
3142
- static statusCode = 500;
3143
- static description = `Failed to get repository info: {message}`;
3117
+ static code = "PERMISSION_NOT_FOUND";
3118
+ static statusCode = 404;
3119
+ static description = `Permission not found`;
3144
3120
  }
3145
- class ListRepositoriesFailedError extends Error {
3121
+ class GitRepositoryAccessDeniedError extends Error {
3146
3122
  constructor(body) {
3147
3123
  super(
3148
- `LIST_REPOSITORIES_FAILED: ${body.message}`
3124
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
3149
3125
  );
3150
3126
  this.body = body;
3151
- this.name = "ListRepositoriesFailedError";
3127
+ this.name = "GitRepositoryAccessDeniedError";
3152
3128
  }
3153
- static code = "LIST_REPOSITORIES_FAILED";
3154
- static statusCode = 500;
3155
- static description = `Failed to list repositories: {message}`;
3129
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
3130
+ static statusCode = 403;
3131
+ static description = `You are not allowed to access this repository`;
3156
3132
  }
3157
- class DeleteRepositoryFailedError extends Error {
3133
+ class GitRepositoryNotFoundError extends Error {
3158
3134
  constructor(body) {
3159
3135
  super(
3160
- `DELETE_REPOSITORY_FAILED: ${body.message}`
3136
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
3161
3137
  );
3162
3138
  this.body = body;
3163
- this.name = "DeleteRepositoryFailedError";
3139
+ this.name = "GitRepositoryNotFoundError";
3164
3140
  }
3165
- static code = "DELETE_REPOSITORY_FAILED";
3166
- static statusCode = 500;
3167
- static description = `Failed to delete repository: {message}`;
3141
+ static code = "GIT_REPOSITORY_NOT_FOUND";
3142
+ static statusCode = 404;
3143
+ static description = `Repository not found`;
3168
3144
  }
3169
- class CreateRepositoryFailedError extends Error {
3145
+ class CannotDeleteManagedIdentityError extends Error {
3170
3146
  constructor(body) {
3171
3147
  super(
3172
- `CREATE_REPOSITORY_FAILED: ${body.message}`
3148
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
3173
3149
  );
3174
3150
  this.body = body;
3175
- this.name = "CreateRepositoryFailedError";
3151
+ this.name = "CannotDeleteManagedIdentityError";
3176
3152
  }
3177
- static code = "CREATE_REPOSITORY_FAILED";
3178
- static statusCode = 500;
3179
- static description = `Failed to create repository: {message}`;
3153
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
3154
+ static statusCode = 403;
3155
+ static description = `Cannot delete managed identities`;
3180
3156
  }
3181
- class SerializationErrorError extends Error {
3157
+ class CannotModifyManagedIdentityError extends Error {
3182
3158
  constructor(body) {
3183
3159
  super(
3184
- `SERIALIZATION_ERROR: ${body.message}`
3160
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
3185
3161
  );
3186
3162
  this.body = body;
3187
- this.name = "SerializationErrorError";
3163
+ this.name = "CannotModifyManagedIdentityError";
3188
3164
  }
3189
- static code = "SERIALIZATION_ERROR";
3190
- static statusCode = 400;
3191
- static description = `Failed to serialize request: {message}`;
3165
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
3166
+ static statusCode = 403;
3167
+ static description = `Cannot modify managed identities`;
3192
3168
  }
3193
- class GitInvalidRequestError extends Error {
3169
+ class IdentityAccessDeniedError extends Error {
3194
3170
  constructor(body) {
3195
3171
  super(
3196
- `GIT_INVALID_REQUEST: ${body.message}`
3172
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
3197
3173
  );
3198
3174
  this.body = body;
3199
- this.name = "GitInvalidRequestError";
3175
+ this.name = "IdentityAccessDeniedError";
3200
3176
  }
3201
- static code = "GIT_INVALID_REQUEST";
3202
- static statusCode = 400;
3203
- static description = `Invalid request: {message}`;
3177
+ static code = "IDENTITY_ACCESS_DENIED";
3178
+ static statusCode = 403;
3179
+ static description = `You are not allowed to access this identity`;
3204
3180
  }
3205
- class RepositoryNotFoundError extends Error {
3181
+ class IdentityNotFoundError extends Error {
3206
3182
  constructor(body) {
3207
3183
  super(
3208
- `REPOSITORY_NOT_FOUND: ${body.message}`
3184
+ `IDENTITY_NOT_FOUND: ${body.message}`
3209
3185
  );
3210
3186
  this.body = body;
3211
- this.name = "RepositoryNotFoundError";
3187
+ this.name = "IdentityNotFoundError";
3212
3188
  }
3213
- static code = "REPOSITORY_NOT_FOUND";
3189
+ static code = "IDENTITY_NOT_FOUND";
3214
3190
  static statusCode = 404;
3215
- static description = `Repository not found: {repo_id}`;
3191
+ static description = `Identity not found`;
3216
3192
  }
3217
3193
  class ExecuteInternalErrorError extends Error {
3218
3194
  constructor(body) {
@@ -3382,125 +3358,281 @@ class RunNotFoundError extends Error {
3382
3358
  static statusCode = 404;
3383
3359
  static description = `Execute run not found: {run_id}`;
3384
3360
  }
3385
- class DomainOwnershipNotVerifiedError extends Error {
3361
+ class LimitExceededError extends Error {
3386
3362
  constructor(body) {
3387
3363
  super(
3388
- `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
3364
+ `LIMIT_EXCEEDED: ${body.message}`
3389
3365
  );
3390
3366
  this.body = body;
3391
- this.name = "DomainOwnershipNotVerifiedError";
3367
+ this.name = "LimitExceededError";
3392
3368
  }
3393
- static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
3394
- static statusCode = 401;
3395
- static description = `You have not verified ownership of domain: {domain}`;
3369
+ static code = "LIMIT_EXCEEDED";
3370
+ static statusCode = 403;
3371
+ static description = `Managed domains limit exceeded: your plan allows {limit} verified domains, you have {current}`;
3396
3372
  }
3397
- class VmAccessDeniedForMappingError extends Error {
3373
+ class FailedToProvisionCertificateError extends Error {
3398
3374
  constructor(body) {
3399
3375
  super(
3400
- `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
3376
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
3401
3377
  );
3402
3378
  this.body = body;
3403
- this.name = "VmAccessDeniedForMappingError";
3379
+ this.name = "FailedToProvisionCertificateError";
3404
3380
  }
3405
- static code = "VM_ACCESS_DENIED_FOR_MAPPING";
3406
- static statusCode = 401;
3407
- static description = `You do not have permission to map to this VM: {vm_id}`;
3381
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
3382
+ static statusCode = 422;
3383
+ static description = `Failed to provision certificate: {message}`;
3408
3384
  }
3409
- class DeploymentAccessDeniedError extends Error {
3385
+ class FailedToInsertDomainMappingError extends Error {
3410
3386
  constructor(body) {
3411
3387
  super(
3412
- `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
3388
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
3413
3389
  );
3414
3390
  this.body = body;
3415
- this.name = "DeploymentAccessDeniedError";
3391
+ this.name = "FailedToInsertDomainMappingError";
3416
3392
  }
3417
- static code = "DEPLOYMENT_ACCESS_DENIED";
3393
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
3394
+ static statusCode = 500;
3395
+ static description = `Failed to insert domain mapping: {message}`;
3396
+ }
3397
+ class PermissionDeniedError extends Error {
3398
+ constructor(body) {
3399
+ super(
3400
+ `PERMISSION_DENIED: ${body.message}`
3401
+ );
3402
+ this.body = body;
3403
+ this.name = "PermissionDeniedError";
3404
+ }
3405
+ static code = "PERMISSION_DENIED";
3418
3406
  static statusCode = 401;
3419
- static description = `You do not have permission to map to this deployment: {deployment_id}`;
3407
+ static description = `Permission denied: {message}`;
3420
3408
  }
3421
- class FailedToProvisionCertificateForMappingError extends Error {
3409
+ class FailedToCheckPermissionsError extends Error {
3422
3410
  constructor(body) {
3423
3411
  super(
3424
- `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
3412
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
3425
3413
  );
3426
3414
  this.body = body;
3427
- this.name = "FailedToProvisionCertificateForMappingError";
3415
+ this.name = "FailedToCheckPermissionsError";
3428
3416
  }
3429
- static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
3430
- static statusCode = 422;
3431
- static description = `Failed to provision certificate for mapping: {message}`;
3417
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
3418
+ static statusCode = 502;
3419
+ static description = `Failed to check permissions: {message}`;
3432
3420
  }
3433
- class FailedInsertDomainMappingError extends Error {
3421
+ class FailedToListDomainsError extends Error {
3434
3422
  constructor(body) {
3435
3423
  super(
3436
- `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
3424
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
3437
3425
  );
3438
3426
  this.body = body;
3439
- this.name = "FailedInsertDomainMappingError";
3427
+ this.name = "FailedToListDomainsError";
3440
3428
  }
3441
- static code = "FAILED_INSERT_DOMAIN_MAPPING";
3429
+ static code = "FAILED_TO_LIST_DOMAINS";
3442
3430
  static statusCode = 500;
3443
- static description = `Failed to insert domain mapping: {message}`;
3431
+ static description = `Failed to list domains: {message}`;
3444
3432
  }
3445
- class DomainAlreadyExistsError extends Error {
3433
+ class FailedToListVerificationsError extends Error {
3446
3434
  constructor(body) {
3447
3435
  super(
3448
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
3436
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
3449
3437
  );
3450
3438
  this.body = body;
3451
- this.name = "DomainAlreadyExistsError";
3439
+ this.name = "FailedToListVerificationsError";
3452
3440
  }
3453
- static code = "DOMAIN_ALREADY_EXISTS";
3441
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
3442
+ static statusCode = 500;
3443
+ static description = `Failed to list verifications: {message}`;
3444
+ }
3445
+ class FailedToVerifyDomainError extends Error {
3446
+ constructor(body) {
3447
+ super(
3448
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
3449
+ );
3450
+ this.body = body;
3451
+ this.name = "FailedToVerifyDomainError";
3452
+ }
3453
+ static code = "FAILED_TO_VERIFY_DOMAIN";
3454
+ static statusCode = 500;
3455
+ static description = `Failed to verify domain: {message}`;
3456
+ }
3457
+ class VerificationFailedError extends Error {
3458
+ constructor(body) {
3459
+ super(
3460
+ `VERIFICATION_FAILED: ${body.message}`
3461
+ );
3462
+ this.body = body;
3463
+ this.name = "VerificationFailedError";
3464
+ }
3465
+ static code = "VERIFICATION_FAILED";
3454
3466
  static statusCode = 400;
3455
- static description = `Domain already exists: {domain}`;
3467
+ static description = `Domain verification failed: {message}`;
3468
+ }
3469
+ class FailedToDeleteVerificationError extends Error {
3470
+ constructor(body) {
3471
+ super(
3472
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
3473
+ );
3474
+ this.body = body;
3475
+ this.name = "FailedToDeleteVerificationError";
3476
+ }
3477
+ static code = "FAILED_TO_DELETE_VERIFICATION";
3478
+ static statusCode = 400;
3479
+ static description = `Failed to delete verification: {message}`;
3480
+ }
3481
+ class VerificationNotFoundError extends Error {
3482
+ constructor(body) {
3483
+ super(
3484
+ `VERIFICATION_NOT_FOUND: ${body.message}`
3485
+ );
3486
+ this.body = body;
3487
+ this.name = "VerificationNotFoundError";
3488
+ }
3489
+ static code = "VERIFICATION_NOT_FOUND";
3490
+ static statusCode = 404;
3491
+ static description = `Verification request not found for domain: {domain}`;
3492
+ }
3493
+ class FailedToCreateVerificationCodeError extends Error {
3494
+ constructor(body) {
3495
+ super(
3496
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
3497
+ );
3498
+ this.body = body;
3499
+ this.name = "FailedToCreateVerificationCodeError";
3500
+ }
3501
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
3502
+ static statusCode = 400;
3503
+ static description = `Failed to create verification code: {message}`;
3504
+ }
3505
+ class InvalidDomainError extends Error {
3506
+ constructor(body) {
3507
+ super(
3508
+ `INVALID_DOMAIN: ${body.message}`
3509
+ );
3510
+ this.body = body;
3511
+ this.name = "InvalidDomainError";
3512
+ }
3513
+ static code = "INVALID_DOMAIN";
3514
+ static statusCode = 400;
3515
+ static description = `Invalid domain: {domain}`;
3516
+ }
3517
+ class CloudstateInternalErrorError extends Error {
3518
+ constructor(body) {
3519
+ super(
3520
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
3521
+ );
3522
+ this.body = body;
3523
+ this.name = "CloudstateInternalErrorError";
3524
+ }
3525
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
3526
+ static statusCode = 500;
3527
+ static description = `Internal error: {message}`;
3528
+ }
3529
+ class CloudstateDatabaseErrorError extends Error {
3530
+ constructor(body) {
3531
+ super(
3532
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
3533
+ );
3534
+ this.body = body;
3535
+ this.name = "CloudstateDatabaseErrorError";
3536
+ }
3537
+ static code = "CLOUDSTATE_DATABASE_ERROR";
3538
+ static statusCode = 500;
3539
+ static description = `Database operation failed: {message}`;
3540
+ }
3541
+ class CloudstateAccessDeniedError extends Error {
3542
+ constructor(body) {
3543
+ super(
3544
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
3545
+ );
3546
+ this.body = body;
3547
+ this.name = "CloudstateAccessDeniedError";
3548
+ }
3549
+ static code = "CLOUDSTATE_ACCESS_DENIED";
3550
+ static statusCode = 403;
3551
+ static description = `Access denied to project: {project_id}`;
3552
+ }
3553
+ class RestoreFailedError extends Error {
3554
+ constructor(body) {
3555
+ super(
3556
+ `RESTORE_FAILED: ${body.message}`
3557
+ );
3558
+ this.body = body;
3559
+ this.name = "RestoreFailedError";
3560
+ }
3561
+ static code = "RESTORE_FAILED";
3562
+ static statusCode = 500;
3563
+ static description = `Failed to restore from backup: {message}`;
3564
+ }
3565
+ class CreateBackupFailedError extends Error {
3566
+ constructor(body) {
3567
+ super(
3568
+ `CREATE_BACKUP_FAILED: ${body.message}`
3569
+ );
3570
+ this.body = body;
3571
+ this.name = "CreateBackupFailedError";
3572
+ }
3573
+ static code = "CREATE_BACKUP_FAILED";
3574
+ static statusCode = 500;
3575
+ static description = `Failed to create backup: {message}`;
3576
+ }
3577
+ class BackupFailedError extends Error {
3578
+ constructor(body) {
3579
+ super(
3580
+ `BACKUP_FAILED: ${body.message}`
3581
+ );
3582
+ this.body = body;
3583
+ this.name = "BackupFailedError";
3584
+ }
3585
+ static code = "BACKUP_FAILED";
3586
+ static statusCode = 500;
3587
+ static description = `Backup failed: {message}`;
3456
3588
  }
3457
- class FailedToInsertOwnershipError extends Error {
3589
+ class DeploymentFailedError extends Error {
3458
3590
  constructor(body) {
3459
3591
  super(
3460
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
3592
+ `DEPLOYMENT_FAILED: ${body.message}`
3461
3593
  );
3462
3594
  this.body = body;
3463
- this.name = "FailedToInsertOwnershipError";
3595
+ this.name = "DeploymentFailedError";
3464
3596
  }
3465
- static code = "FAILED_TO_INSERT_OWNERSHIP";
3597
+ static code = "DEPLOYMENT_FAILED";
3466
3598
  static statusCode = 500;
3467
- static description = `Failed to insert domain ownership: {message}`;
3599
+ static description = `Deployment failed: {message}`;
3468
3600
  }
3469
- class FailedRemoveDomainMappingError extends Error {
3601
+ class InvalidDeploymentRequestError extends Error {
3470
3602
  constructor(body) {
3471
3603
  super(
3472
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
3604
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
3473
3605
  );
3474
3606
  this.body = body;
3475
- this.name = "FailedRemoveDomainMappingError";
3607
+ this.name = "InvalidDeploymentRequestError";
3476
3608
  }
3477
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
3478
- static statusCode = 500;
3479
- static description = `Failed to remove domain mapping: {message}`;
3609
+ static code = "INVALID_DEPLOYMENT_REQUEST";
3610
+ static statusCode = 400;
3611
+ static description = `Invalid deployment request: {message}`;
3480
3612
  }
3481
- class FailedPermissionsCheckError extends Error {
3613
+ class ProjectNotFoundError extends Error {
3482
3614
  constructor(body) {
3483
3615
  super(
3484
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
3616
+ `PROJECT_NOT_FOUND: ${body.message}`
3485
3617
  );
3486
3618
  this.body = body;
3487
- this.name = "FailedPermissionsCheckError";
3619
+ this.name = "ProjectNotFoundError";
3488
3620
  }
3489
- static code = "FAILED_PERMISSIONS_CHECK";
3490
- static statusCode = 401;
3491
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
3621
+ static code = "PROJECT_NOT_FOUND";
3622
+ static statusCode = 404;
3623
+ static description = `Project not found: {project_id}`;
3492
3624
  }
3493
- class FailedToCheckDomainMappingPermissionsError extends Error {
3625
+ class GitRepoLimitExceededError extends Error {
3494
3626
  constructor(body) {
3495
3627
  super(
3496
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
3628
+ `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
3497
3629
  );
3498
3630
  this.body = body;
3499
- this.name = "FailedToCheckDomainMappingPermissionsError";
3631
+ this.name = "GitRepoLimitExceededError";
3500
3632
  }
3501
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
3502
- static statusCode = 502;
3503
- static description = `Failed to check permissions: {message}`;
3633
+ static code = "GIT_REPO_LIMIT_EXCEEDED";
3634
+ static statusCode = 403;
3635
+ static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
3504
3636
  }
3505
3637
  class EmptyTagError extends Error {
3506
3638
  constructor(body) {
@@ -3514,18 +3646,6 @@ class EmptyTagError extends Error {
3514
3646
  static statusCode = 400;
3515
3647
  static description = `Invalid request: tag cannot be empty`;
3516
3648
  }
3517
- class BranchNameEmptyError extends Error {
3518
- constructor(body) {
3519
- super(
3520
- `BRANCH_NAME_EMPTY: ${body.message}`
3521
- );
3522
- this.body = body;
3523
- this.name = "BranchNameEmptyError";
3524
- }
3525
- static code = "BRANCH_NAME_EMPTY";
3526
- static statusCode = 400;
3527
- static description = `Branch name cannot be empty`;
3528
- }
3529
3649
  const FREESTYLE_ERROR_CODE_MAP = {
3530
3650
  "GIT_ERROR": GitErrorError,
3531
3651
  "BAD_PARSE": BadParseError,
@@ -3533,31 +3653,10 @@ const FREESTYLE_ERROR_CODE_MAP = {
3533
3653
  "BAD_SIGNATURE": BadSignatureError,
3534
3654
  "BAD_HEADER": BadHeaderError,
3535
3655
  "BAD_KEY": BadKeyError,
3536
- "SNAPSHOT_SETUP_FAILED": SnapshotSetupFailedError,
3537
- "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3538
- "RESIZE_VM_MEM_NOT_POWER_OF_TWO": ResizeVmMemNotPowerOfTwoError,
3539
- "RESIZE_VM_VCPU_NOT_POWER_OF_TWO": ResizeVmVcpuNotPowerOfTwoError,
3540
- "RESIZE_VM_MEM_OUT_OF_RANGE": ResizeVmMemOutOfRangeError,
3541
- "RESIZE_VM_VCPU_OUT_OF_RANGE": ResizeVmVcpuOutOfRangeError,
3542
- "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED": ResizeVmRootfsShrinkNotSupportedError,
3543
- "RESIZE_VM_EMPTY_REQUEST": ResizeVmEmptyRequestError,
3544
- "EXEC_TIMED_OUT": ExecTimedOutError,
3545
- "NO_DEFAULT_SNAPSHOT_AVAILABLE": NoDefaultSnapshotAvailableError,
3546
- "DOCKER_SNAPSHOT_FAILED": DockerSnapshotFailedError,
3547
- "SET_DEFAULT_SNAPSHOT_FAILED": SetDefaultSnapshotFailedError,
3548
- "SNAPSHOT_LAYER_CREATION_FAILED": SnapshotLayerCreationFailedError,
3549
- "SNAPSHOT_DIR_NOT_FOUND": SnapshotDirNotFoundError,
3550
- "SUBVOLUME_CREATION_FAILED": SubvolumeCreationFailedError,
3551
- "GET_DEFAULT_SNAPSHOT_FAILED": GetDefaultSnapshotFailedError,
3552
3656
  "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
3553
3657
  "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
3554
3658
  "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
3555
- "CONFLICTING_SPEC_SOURCES_ERROR": ConflictingSpecSourcesErrorError,
3556
- "NON_LEAF_LAYER_FIELD_ERROR": NonLeafLayerFieldErrorError,
3557
- "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
3558
- "INTERNAL_ERROR": InternalErrorError,
3559
- "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
3560
- "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
3659
+ "PARTITION_NOT_FOUND": PartitionNotFoundError,
3561
3660
  "USER_NOT_FOUND": UserNotFoundError,
3562
3661
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
3563
3662
  "VALIDATION_ERROR": ValidationErrorError,
@@ -3574,18 +3673,55 @@ const FREESTYLE_ERROR_CODE_MAP = {
3574
3673
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
3575
3674
  "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
3576
3675
  "GROUP_NAME_EMPTY": GroupNameEmptyError,
3676
+ "NO_DEFAULT_SNAPSHOT_AVAILABLE": NoDefaultSnapshotAvailableError,
3677
+ "DOCKER_SNAPSHOT_FAILED": DockerSnapshotFailedError,
3678
+ "SET_DEFAULT_SNAPSHOT_FAILED": SetDefaultSnapshotFailedError,
3679
+ "SNAPSHOT_LAYER_CREATION_FAILED": SnapshotLayerCreationFailedError,
3680
+ "SNAPSHOT_DIR_NOT_FOUND": SnapshotDirNotFoundError,
3681
+ "SUBVOLUME_CREATION_FAILED": SubvolumeCreationFailedError,
3682
+ "GET_DEFAULT_SNAPSHOT_FAILED": GetDefaultSnapshotFailedError,
3577
3683
  "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3684
+ "DATABASE_ERROR": DatabaseErrorError,
3685
+ "INVALID_VM_ID": InvalidVmIdError,
3686
+ "VM_DELETED": VmDeletedError,
3578
3687
  "VM_NOT_RUNNING": VmNotRunningError,
3688
+ "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3689
+ "SWAP_VM_TAP": SwapVmTapError,
3690
+ "PREASSIGNED_VM_ID_COUNT_MISMATCH": PreassignedVmIdCountMismatchError,
3691
+ "INTERNAL_ERROR": InternalErrorError,
3692
+ "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3693
+ "FILE_NOT_FOUND": FileNotFoundError,
3694
+ "FILES_BAD_REQUEST": FilesBadRequestError,
3579
3695
  "VM_NOT_FOUND": VmNotFoundError,
3580
3696
  "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3581
3697
  "BAD_REQUEST": BadRequestError,
3582
3698
  "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
3699
+ "SNAPSHOT_IS_ACCOUNT_DEFAULT": SnapshotIsAccountDefaultError,
3700
+ "SNAPSHOT_ALREADY_DELETED": SnapshotAlreadyDeletedError,
3583
3701
  "SNAPSHOT_NOT_FOUND": SnapshotNotFoundError,
3702
+ "SNAPSHOT_SETUP_FAILED": SnapshotSetupFailedError,
3703
+ "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3704
+ "STARTING_HANDLE_INSTANCE_ID_MISMATCH": StartingHandleInstanceIdMismatchError,
3705
+ "SUSPEND_FAILED_AND_STOP_FAILED": SuspendFailedAndStopFailedError,
3706
+ "SUSPEND_FAILED_AND_STOPPED": SuspendFailedAndStoppedError,
3707
+ "RESIZE_VM_MEM_NOT_POWER_OF_TWO": ResizeVmMemNotPowerOfTwoError,
3708
+ "RESIZE_VM_VCPU_NOT_POWER_OF_TWO": ResizeVmVcpuNotPowerOfTwoError,
3709
+ "RESIZE_VM_MEM_OUT_OF_RANGE": ResizeVmMemOutOfRangeError,
3710
+ "RESIZE_VM_VCPU_OUT_OF_RANGE": ResizeVmVcpuOutOfRangeError,
3711
+ "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED": ResizeVmRootfsShrinkNotSupportedError,
3712
+ "RESIZE_VM_EMPTY_REQUEST": ResizeVmEmptyRequestError,
3713
+ "EXEC_TIMED_OUT": ExecTimedOutError,
3714
+ "CONFLICTING_SPEC_SOURCES_ERROR": ConflictingSpecSourcesErrorError,
3715
+ "NON_LEAF_LAYER_FIELD_ERROR": NonLeafLayerFieldErrorError,
3716
+ "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
3717
+ "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
3718
+ "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
3719
+ "UNSUPPORTED_OS": UnsupportedOsError,
3720
+ "BUILD_FAILED": BuildFailedError,
3584
3721
  "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3585
3722
  "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3586
3723
  "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3587
3724
  "KERNEL_PANIC": KernelPanicError,
3588
- "VM_DELETED": VmDeletedError,
3589
3725
  "REQWEST": ReqwestError,
3590
3726
  "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3591
3727
  "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
@@ -3597,18 +3733,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
3597
3733
  "FAILED_TO_SPAWN_UFFD": FailedToSpawnUffdError,
3598
3734
  "VM_SPAWN_PROCESS": VmSpawnProcessError,
3599
3735
  "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3600
- "PARTITION_NOT_FOUND": PartitionNotFoundError,
3601
- "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3602
- "SWAP_VM_TAP": SwapVmTapError,
3603
- "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3604
- "FILE_NOT_FOUND": FileNotFoundError,
3605
- "FILES_BAD_REQUEST": FilesBadRequestError,
3606
- "SNAPSHOT_IS_ACCOUNT_DEFAULT": SnapshotIsAccountDefaultError,
3607
- "SNAPSHOT_ALREADY_DELETED": SnapshotAlreadyDeletedError,
3608
- "SUSPEND_FAILED_AND_STOP_FAILED": SuspendFailedAndStopFailedError,
3609
- "SUSPEND_FAILED_AND_STOPPED": SuspendFailedAndStoppedError,
3610
- "DATABASE_ERROR": DatabaseErrorError,
3611
- "INVALID_VM_ID": InvalidVmIdError,
3612
3736
  "CREATE_VM_MEM_NOT_POWER_OF_TWO": CreateVmMemNotPowerOfTwoError,
3613
3737
  "CREATE_VM_VCPU_NOT_POWER_OF_TWO": CreateVmVcpuNotPowerOfTwoError,
3614
3738
  "CREATE_VM_ROOTFS_OUT_OF_RANGE": CreateVmRootfsOutOfRangeError,
@@ -3642,6 +3766,24 @@ const FREESTYLE_ERROR_CODE_MAP = {
3642
3766
  "INVALID_PARAMETERS": InvalidParametersError,
3643
3767
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
3644
3768
  "EXPIRED": ExpiredError,
3769
+ "NOT_FOUND": NotFoundError,
3770
+ "TREE_NOT_FOUND": TreeNotFoundError,
3771
+ "BRANCH_NOT_FOUND": BranchNotFoundError,
3772
+ "COMMIT_NOT_FOUND": CommitNotFoundError,
3773
+ "PARENT_NOT_FOUND": ParentNotFoundError,
3774
+ "NO_DEFAULT_BRANCH": NoDefaultBranchError,
3775
+ "INVALID_BASE64_CONTENT": InvalidBase64ContentError,
3776
+ "INVALID_FILE_CHANGE": InvalidFileChangeError,
3777
+ "INVALID_FILE_PATH": InvalidFilePathError,
3778
+ "CONFLICTING_PARENT": ConflictingParentError,
3779
+ "AMBIGUOUS": AmbiguousError,
3780
+ "INVALID": InvalidError,
3781
+ "CONFLICT": ConflictError,
3782
+ "BRANCH_ALREADY_EXISTS": BranchAlreadyExistsError,
3783
+ "PATH_NOT_FOUND": PathNotFoundError,
3784
+ "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
3785
+ "INVALID_SERVICE": InvalidServiceError,
3786
+ "EXPECTED_SERVICE": ExpectedServiceError,
3645
3787
  "UNAUTHORIZED": UnauthorizedError,
3646
3788
  "FORBIDDEN": ForbiddenError,
3647
3789
  "INVALID_ACCOUNT_ID": InvalidAccountIdError,
@@ -3650,17 +3792,11 @@ const FREESTYLE_ERROR_CODE_MAP = {
3650
3792
  "SOURCE_NOT_FOUND": SourceNotFoundError,
3651
3793
  "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
3652
3794
  "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
3653
- "PACKFILE": PackfileError,
3654
- "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3655
- "BRANCH_NOT_FOUND": BranchNotFoundError,
3656
- "NOT_FOUND": NotFoundError,
3657
- "SEND_ERROR": SendErrorError,
3795
+ "TAG_NOT_FOUND": TagNotFoundError,
3658
3796
  "INVALID_REVISION": InvalidRevisionError,
3659
- "COMMIT_NOT_FOUND": CommitNotFoundError,
3660
- "PATH_NOT_FOUND": PathNotFoundError,
3661
- "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
3662
- "INVALID_SERVICE": InvalidServiceError,
3663
- "EXPECTED_SERVICE": ExpectedServiceError,
3797
+ "BLOB_NOT_FOUND": BlobNotFoundError,
3798
+ "SEND_ERROR": SendErrorError,
3799
+ "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3664
3800
  "DIFF_INVALID_PATH_PATTERN": DiffInvalidPathPatternError,
3665
3801
  "DIFF_INVALID_REGEX": DiffInvalidRegexError,
3666
3802
  "DIFF_EMPTY_QUERY": DiffEmptyQueryError,
@@ -3671,94 +3807,21 @@ const FREESTYLE_ERROR_CODE_MAP = {
3671
3807
  "INVALID_REGEX": InvalidRegexError,
3672
3808
  "INVALID_PATH_PATTERN": InvalidPathPatternError,
3673
3809
  "EMPTY_QUERY": EmptyQueryError,
3674
- "CONFLICT": ConflictError,
3675
- "NO_DEFAULT_BRANCH": NoDefaultBranchError,
3676
- "INVALID_BASE64_CONTENT": InvalidBase64ContentError,
3677
- "INVALID_FILE_CHANGE": InvalidFileChangeError,
3678
- "INVALID_FILE_PATH": InvalidFilePathError,
3679
- "CONFLICTING_PARENT": ConflictingParentError,
3680
- "TREE_NOT_FOUND": TreeNotFoundError,
3681
- "BRANCH_ALREADY_EXISTS": BranchAlreadyExistsError,
3682
- "PARENT_NOT_FOUND": ParentNotFoundError,
3683
- "TAG_NOT_FOUND": TagNotFoundError,
3810
+ "PACKFILE": PackfileError,
3684
3811
  "INVALID_RANGE": InvalidRangeError,
3685
3812
  "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
3686
3813
  "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
3687
- "BLOB_NOT_FOUND": BlobNotFoundError,
3688
- "AMBIGUOUS": AmbiguousError,
3689
- "INVALID": InvalidError,
3690
3814
  "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
3691
3815
  "INVALID_OBJECT_ID": InvalidObjectIdError,
3816
+ "TOO_MANY_CONCURRENT_REPAIRS": TooManyConcurrentRepairsError,
3817
+ "ALREADY_IN_PROGRESS": AlreadyInProgressError,
3818
+ "JOB_NOT_FOUND": JobNotFoundError,
3692
3819
  "UNAVAILABLE": UnavailableError,
3693
3820
  "SCHEDULE_NOT_FOUND": ScheduleNotFoundError,
3694
3821
  "SERVICE_UNAVAILABLE": ServiceUnavailableError,
3695
- "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3696
- "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
3697
- "LIST_TOKENS_FAILED": ListTokensFailedError,
3698
- "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
3699
- "CREATE_TOKEN_FAILED": CreateTokenFailedError,
3700
- "LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
3701
- "GET_PERMISSION_FAILED": GetPermissionFailedError,
3702
- "UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
3703
- "REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
3704
- "GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
3705
- "LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
3706
- "DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
3707
- "CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
3708
- "VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
3709
- "PERMISSION_NOT_FOUND": PermissionNotFoundError,
3710
- "GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
3711
- "GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
3712
- "CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
3713
- "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
3714
- "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
3715
- "IDENTITY_NOT_FOUND": IdentityNotFoundError,
3716
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3717
- "LIMIT_EXCEEDED": LimitExceededError,
3718
- "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
3719
- "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
3720
- "PERMISSION_DENIED": PermissionDeniedError,
3721
- "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
3722
- "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
3723
- "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
3724
- "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
3725
- "VERIFICATION_FAILED": VerificationFailedError,
3726
- "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
3727
- "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
3728
- "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
3729
- "INVALID_DOMAIN": InvalidDomainError,
3730
- "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3731
- "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3732
- "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
3733
- "RESTORE_FAILED": RestoreFailedError,
3734
- "CREATE_BACKUP_FAILED": CreateBackupFailedError,
3735
- "BACKUP_FAILED": BackupFailedError,
3736
- "DEPLOYMENT_FAILED": DeploymentFailedError,
3737
- "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
3738
- "PROJECT_NOT_FOUND": ProjectNotFoundError,
3739
- "ACCESS_DENIED": AccessDeniedError,
3740
- "BUILD_FAILED": BuildFailedError,
3741
- "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
3742
- "LOCKFILE_ERROR": LockfileErrorError,
3743
- "UPLOAD_ERROR": UploadErrorError,
3744
- "DOMAIN_MAPPING_ERROR": DomainMappingErrorError,
3745
- "CERTIFICATE_PROVISIONING_ERROR": CertificateProvisioningErrorError,
3746
- "NO_ENTRYPOINT_FOUND": NoEntrypointFoundError,
3747
- "ENTRYPOINT_NOT_FOUND": EntrypointNotFoundError,
3748
- "NO_DOMAIN_OWNERSHIP": NoDomainOwnershipError,
3749
- "INVALID_DOMAINS": InvalidDomainsError,
3750
- "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
3751
- "TIMEOUT_LIMIT_EXCEEDED": TimeoutLimitExceededError,
3752
- "DEPLOYMENT_LIMIT_EXCEEDED": DeploymentLimitExceededError,
3753
- "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3754
- "RESIZE_FAILED": ResizeFailedError,
3755
- "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3756
- "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3757
- "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3758
- "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3759
- "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3760
- "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3761
- "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
3822
+ "REPAIR_ALREADY_IN_PROGRESS": RepairAlreadyInProgressError,
3823
+ "MEMORY_STORAGE_QUOTA_EXCEEDED": MemoryStorageQuotaExceededError,
3824
+ "ROOTFS_STORAGE_QUOTA_EXCEEDED": RootfsStorageQuotaExceededError,
3762
3825
  "ROOTFS_SIZE_TOO_LARGE": RootfsSizeTooLargeError,
3763
3826
  "MEM_SIZE_TOO_LARGE": MemSizeTooLargeError,
3764
3827
  "ROOTFS_OVER_PLAN_LIMIT": RootfsOverPlanLimitError,
@@ -3794,6 +3857,61 @@ const FREESTYLE_ERROR_CODE_MAP = {
3794
3857
  "SERIALIZATION_ERROR": SerializationErrorError,
3795
3858
  "GIT_INVALID_REQUEST": GitInvalidRequestError,
3796
3859
  "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
3860
+ "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3861
+ "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3862
+ "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3863
+ "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3864
+ "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3865
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3866
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError,
3867
+ "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
3868
+ "LOCKFILE_ERROR": LockfileErrorError,
3869
+ "UPLOAD_ERROR": UploadErrorError,
3870
+ "DOMAIN_MAPPING_ERROR": DomainMappingErrorError,
3871
+ "CERTIFICATE_PROVISIONING_ERROR": CertificateProvisioningErrorError,
3872
+ "NO_ENTRYPOINT_FOUND": NoEntrypointFoundError,
3873
+ "ENTRYPOINT_NOT_FOUND": EntrypointNotFoundError,
3874
+ "NO_DOMAIN_OWNERSHIP": NoDomainOwnershipError,
3875
+ "INVALID_DOMAINS": InvalidDomainsError,
3876
+ "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
3877
+ "TIMEOUT_LIMIT_EXCEEDED": TimeoutLimitExceededError,
3878
+ "DEPLOYMENT_LIMIT_EXCEEDED": DeploymentLimitExceededError,
3879
+ "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3880
+ "RESIZE_FAILED": ResizeFailedError,
3881
+ "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3882
+ "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3883
+ "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3884
+ "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3885
+ "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3886
+ "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3887
+ "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3888
+ "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3889
+ "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3890
+ "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3891
+ "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3892
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3893
+ "FAILED_TO_PRE_REGISTER": FailedToPreRegisterError,
3894
+ "ACCESS_DENIED": AccessDeniedError,
3895
+ "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
3896
+ "LIST_TOKENS_FAILED": ListTokensFailedError,
3897
+ "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
3898
+ "CREATE_TOKEN_FAILED": CreateTokenFailedError,
3899
+ "LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
3900
+ "GET_PERMISSION_FAILED": GetPermissionFailedError,
3901
+ "UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
3902
+ "REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
3903
+ "GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
3904
+ "LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
3905
+ "DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
3906
+ "CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
3907
+ "VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
3908
+ "PERMISSION_NOT_FOUND": PermissionNotFoundError,
3909
+ "GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
3910
+ "GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
3911
+ "CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
3912
+ "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
3913
+ "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
3914
+ "IDENTITY_NOT_FOUND": IdentityNotFoundError,
3797
3915
  "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
3798
3916
  "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
3799
3917
  "LIST_RUNS_FAILED": ListRunsFailedError,
@@ -3808,18 +3926,30 @@ const FREESTYLE_ERROR_CODE_MAP = {
3808
3926
  "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3809
3927
  "LOGGING_FAILED": LoggingFailedError,
3810
3928
  "RUN_NOT_FOUND": RunNotFoundError,
3811
- "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3812
- "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3813
- "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3814
- "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3815
- "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3816
- "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3817
- "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3818
- "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3819
- "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3820
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3821
- "EMPTY_TAG": EmptyTagError,
3822
- "BRANCH_NAME_EMPTY": BranchNameEmptyError
3929
+ "LIMIT_EXCEEDED": LimitExceededError,
3930
+ "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
3931
+ "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
3932
+ "PERMISSION_DENIED": PermissionDeniedError,
3933
+ "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
3934
+ "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
3935
+ "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
3936
+ "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
3937
+ "VERIFICATION_FAILED": VerificationFailedError,
3938
+ "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
3939
+ "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
3940
+ "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
3941
+ "INVALID_DOMAIN": InvalidDomainError,
3942
+ "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3943
+ "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3944
+ "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
3945
+ "RESTORE_FAILED": RestoreFailedError,
3946
+ "CREATE_BACKUP_FAILED": CreateBackupFailedError,
3947
+ "BACKUP_FAILED": BackupFailedError,
3948
+ "DEPLOYMENT_FAILED": DeploymentFailedError,
3949
+ "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
3950
+ "PROJECT_NOT_FOUND": ProjectNotFoundError,
3951
+ "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
3952
+ "EMPTY_TAG": EmptyTagError
3823
3953
  };
3824
3954
 
3825
3955
  var errors = /*#__PURE__*/Object.freeze({
@@ -3827,6 +3957,7 @@ var errors = /*#__PURE__*/Object.freeze({
3827
3957
  AccessDeniedError: AccessDeniedError,
3828
3958
  ActiveTransactionErrorError: ActiveTransactionErrorError,
3829
3959
  AfterArrayContainsEmptyError: AfterArrayContainsEmptyError,
3960
+ AlreadyInProgressError: AlreadyInProgressError,
3830
3961
  AmbiguousError: AmbiguousError,
3831
3962
  BackupFailedError: BackupFailedError,
3832
3963
  BadHeaderError: BadHeaderError,
@@ -3914,6 +4045,7 @@ var errors = /*#__PURE__*/Object.freeze({
3914
4045
  FailedToInsertOwnershipError: FailedToInsertOwnershipError,
3915
4046
  FailedToListDomainsError: FailedToListDomainsError,
3916
4047
  FailedToListVerificationsError: FailedToListVerificationsError,
4048
+ FailedToPreRegisterError: FailedToPreRegisterError,
3917
4049
  FailedToProvisionCertificateError: FailedToProvisionCertificateError,
3918
4050
  FailedToProvisionCertificateForMappingError: FailedToProvisionCertificateForMappingError,
3919
4051
  FailedToSpawnUffdError: FailedToSpawnUffdError,
@@ -3976,6 +4108,7 @@ var errors = /*#__PURE__*/Object.freeze({
3976
4108
  InvalidSignatureError: InvalidSignatureError,
3977
4109
  InvalidSnapshotIdError: InvalidSnapshotIdError,
3978
4110
  InvalidVmIdError: InvalidVmIdError,
4111
+ JobNotFoundError: JobNotFoundError,
3979
4112
  KernelPanicError: KernelPanicError,
3980
4113
  LimitExceededError: LimitExceededError,
3981
4114
  ListIdentitiesFailedError: ListIdentitiesFailedError,
@@ -3990,6 +4123,7 @@ var errors = /*#__PURE__*/Object.freeze({
3990
4123
  MaxUsesExceededError: MaxUsesExceededError,
3991
4124
  MemOverPlanLimitError: MemOverPlanLimitError,
3992
4125
  MemSizeTooLargeError: MemSizeTooLargeError,
4126
+ MemoryStorageQuotaExceededError: MemoryStorageQuotaExceededError,
3993
4127
  MetadataWriteFailedError: MetadataWriteFailedError,
3994
4128
  NetworkPermissionsFailedError: NetworkPermissionsFailedError,
3995
4129
  NoDefaultBranchError: NoDefaultBranchError,
@@ -4015,9 +4149,11 @@ var errors = /*#__PURE__*/Object.freeze({
4015
4149
  PermissionErrorError: PermissionErrorError,
4016
4150
  PermissionNotFoundError: PermissionNotFoundError,
4017
4151
  PersistentVmsNotAllowedError: PersistentVmsNotAllowedError,
4152
+ PreassignedVmIdCountMismatchError: PreassignedVmIdCountMismatchError,
4018
4153
  ProjectNotFoundError: ProjectNotFoundError,
4019
4154
  RecordOwnershipErrorError: RecordOwnershipErrorError,
4020
4155
  ReferenceNotFoundError: ReferenceNotFoundError,
4156
+ RepairAlreadyInProgressError: RepairAlreadyInProgressError,
4021
4157
  RepoAlreadyExistsError: RepoAlreadyExistsError,
4022
4158
  RepoNotFoundError: RepoNotFoundError,
4023
4159
  RepositoryAccessDeniedError: RepositoryAccessDeniedError,
@@ -4039,6 +4175,7 @@ var errors = /*#__PURE__*/Object.freeze({
4039
4175
  RootfsCopyErrorError: RootfsCopyErrorError,
4040
4176
  RootfsOverPlanLimitError: RootfsOverPlanLimitError,
4041
4177
  RootfsSizeTooLargeError: RootfsSizeTooLargeError,
4178
+ RootfsStorageQuotaExceededError: RootfsStorageQuotaExceededError,
4042
4179
  RunNotFoundError: RunNotFoundError,
4043
4180
  RuntimeErrorError: RuntimeErrorError,
4044
4181
  ScheduleNotFoundError: ScheduleNotFoundError,
@@ -4066,6 +4203,7 @@ var errors = /*#__PURE__*/Object.freeze({
4066
4203
  SourceImportConflictError: SourceImportConflictError,
4067
4204
  SourceNotFoundError: SourceNotFoundError,
4068
4205
  SourceUnauthorizedError: SourceUnauthorizedError,
4206
+ StartingHandleInstanceIdMismatchError: StartingHandleInstanceIdMismatchError,
4069
4207
  SubvolumeCreationFailedError: SubvolumeCreationFailedError,
4070
4208
  SuspendFailedAndStopFailedError: SuspendFailedAndStopFailedError,
4071
4209
  SuspendFailedAndStoppedError: SuspendFailedAndStoppedError,
@@ -4074,6 +4212,7 @@ var errors = /*#__PURE__*/Object.freeze({
4074
4212
  TagNotFoundError: TagNotFoundError,
4075
4213
  TimeoutLimitExceededError: TimeoutLimitExceededError,
4076
4214
  TokenErrorError: TokenErrorError,
4215
+ TooManyConcurrentRepairsError: TooManyConcurrentRepairsError,
4077
4216
  TotalVmLimitExceededError: TotalVmLimitExceededError,
4078
4217
  TreeNotFoundError: TreeNotFoundError,
4079
4218
  TriggerErrorError: TriggerErrorError,
@@ -4081,6 +4220,7 @@ var errors = /*#__PURE__*/Object.freeze({
4081
4220
  UnauthorizedError: UnauthorizedError,
4082
4221
  UnauthorizedErrorError: UnauthorizedErrorError,
4083
4222
  UnavailableError: UnavailableError,
4223
+ UnsupportedOsError: UnsupportedOsError,
4084
4224
  UnsupportedTransferError: UnsupportedTransferError,
4085
4225
  UpdateDefaultBranchFailedError: UpdateDefaultBranchFailedError,
4086
4226
  UpdatePermissionFailedError: UpdatePermissionFailedError,
@@ -4201,6 +4341,7 @@ class ApiClient {
4201
4341
  return response.json();
4202
4342
  }
4203
4343
  async fetch(url, options) {
4344
+ const resolvedUrl = /^[a-zA-Z][a-zA-Zd+-.]*:/.test(url) ? url : this.buildUrl(url);
4204
4345
  const headers = this.getDefaultHeaders();
4205
4346
  const finalOptions = {
4206
4347
  ...options,
@@ -4209,7 +4350,7 @@ class ApiClient {
4209
4350
  ...options?.headers || {}
4210
4351
  }
4211
4352
  };
4212
- return this.fetchFn(url, finalOptions);
4353
+ return this.fetchFn(resolvedUrl, finalOptions);
4213
4354
  }
4214
4355
  resolveUrl(path, params, query) {
4215
4356
  return this.buildUrl(path, params, query);
@@ -5585,9 +5726,9 @@ class Deployment {
5585
5726
  /**
5586
5727
  * Get logs for this deployment.
5587
5728
  */
5588
- async getLogs(options) {
5729
+ async getLogs(options = {}) {
5589
5730
  return this.apiClient.get("/observability/v1/logs", {
5590
- query: { deploymentId: this.deploymentId, ...options }
5731
+ query: { ...options, deploymentId: this.deploymentId }
5591
5732
  });
5592
5733
  }
5593
5734
  /**
@@ -5795,6 +5936,17 @@ class RunsNamespace {
5795
5936
  });
5796
5937
  return response;
5797
5938
  }
5939
+ /**
5940
+ * Get observability logs for a script run.
5941
+ */
5942
+ async getLogs({
5943
+ runId,
5944
+ ...options
5945
+ }) {
5946
+ return this.apiClient.get("/observability/v1/logs", {
5947
+ query: { ...options, runId }
5948
+ });
5949
+ }
5798
5950
  /**
5799
5951
  * List execution runs.
5800
5952
  */
@@ -6659,6 +6811,85 @@ function composeVmSpecs(specs) {
6659
6811
  return result;
6660
6812
  }
6661
6813
 
6814
+ class Build {
6815
+ /** @internal */
6816
+ _apiClient;
6817
+ buildId;
6818
+ /** @internal */
6819
+ constructor({
6820
+ buildId,
6821
+ apiClient
6822
+ }) {
6823
+ this.buildId = buildId;
6824
+ this._apiClient = apiClient;
6825
+ }
6826
+ /** Fetch the latest build record. */
6827
+ async get() {
6828
+ const url = this._apiClient.resolveUrl(
6829
+ "/v1/vms/builds/{build_id}",
6830
+ { build_id: this.buildId }
6831
+ );
6832
+ const res = await this._apiClient.fetch(url, { method: "GET" });
6833
+ if (!res.ok) {
6834
+ throw new Error(
6835
+ `GET /v1/vms/builds/${this.buildId} failed: ${res.status} ${res.statusText}`
6836
+ );
6837
+ }
6838
+ return await res.json();
6839
+ }
6840
+ /** List the phases that have run so far for this build. */
6841
+ async phases() {
6842
+ const url = this._apiClient.resolveUrl(
6843
+ "/v1/vms/builds/{build_id}/phases",
6844
+ { build_id: this.buildId }
6845
+ );
6846
+ const res = await this._apiClient.fetch(url, { method: "GET" });
6847
+ if (!res.ok) {
6848
+ throw new Error(
6849
+ `GET /v1/vms/builds/${this.buildId}/phases failed: ${res.status} ${res.statusText}`
6850
+ );
6851
+ }
6852
+ const body = await res.json();
6853
+ return body.phases;
6854
+ }
6855
+ /**
6856
+ * Poll until the build reaches a terminal state.
6857
+ * @param opts.intervalMs poll interval (default 2000)
6858
+ * @param opts.timeoutMs absolute timeout (default 10 minutes)
6859
+ */
6860
+ async wait(opts = {}) {
6861
+ const interval = opts.intervalMs ?? 2e3;
6862
+ const deadline = Date.now() + (opts.timeoutMs ?? 10 * 6e4);
6863
+ while (true) {
6864
+ const record = await this.get();
6865
+ if (record.state === "succeeded" || record.state === "failed") {
6866
+ return record;
6867
+ }
6868
+ if (Date.now() > deadline) {
6869
+ throw new Error(
6870
+ `Build ${this.buildId} did not finish before timeout (state=${record.state})`
6871
+ );
6872
+ }
6873
+ await new Promise((r) => setTimeout(r, interval));
6874
+ }
6875
+ }
6876
+ /**
6877
+ * Find the phase whose snapshot is the failed/debug snapshot, if the build
6878
+ * has failed. Returns the phase + its snapshotId, or null when the build
6879
+ * either succeeded or has no failed-state snapshot pinned to a phase.
6880
+ */
6881
+ async failedPhase() {
6882
+ const phases = await this.phases();
6883
+ for (let i = phases.length - 1; i >= 0; i--) {
6884
+ const p = phases[i];
6885
+ if (p?.snapshotId) {
6886
+ return p;
6887
+ }
6888
+ }
6889
+ return null;
6890
+ }
6891
+ }
6892
+
6662
6893
  const DEFAULT_CONFIGURE_BASE_IMAGE = "FROM debian:trixie-slim";
6663
6894
  const RUN_COMMANDS_SYSTEMD_SERVICE_PREFIX = "freestyle-run-command";
6664
6895
  const WAIT_FOR_SYSTEMD_SERVICE_PREFIX = "freestyle-wait-for";
@@ -6676,34 +6907,50 @@ function extractBackgroundRequestId(response, body) {
6676
6907
  async function parseJsonResponse(response) {
6677
6908
  return await response.json();
6678
6909
  }
6679
- async function readResponseError(response, fallbackMessage) {
6680
- const responseText = await response.text();
6681
- if (!responseText) {
6682
- return fallbackMessage;
6683
- }
6910
+ async function emitBackgroundLogs(apiClient, requestId, logger, seenLogs) {
6911
+ let response;
6684
6912
  try {
6685
- const errorBody = JSON.parse(responseText);
6686
- return errorBody.message ?? errorBody.error ?? responseText;
6687
- } catch {
6688
- return responseText;
6913
+ response = await apiClient.fetch(
6914
+ apiClient.resolveUrl("/observability/v1/logs", void 0, { requestId }),
6915
+ { method: "GET" }
6916
+ );
6917
+ } catch (error) {
6918
+ console.warn(
6919
+ `[freestyle] background log fetch failed for request ${requestId}:`,
6920
+ error
6921
+ );
6922
+ return;
6689
6923
  }
6690
- }
6691
- async function emitBackgroundLogs(apiClient, requestId, logger, seenLogs) {
6692
- const response = await apiClient.fetch(
6693
- apiClient.resolveUrl("/observability/v1/logs", void 0, { requestId }),
6694
- { method: "GET" }
6695
- );
6696
6924
  if (!response.ok) {
6925
+ console.warn(
6926
+ `[freestyle] background log fetch returned ${response.status} for request ${requestId}`
6927
+ );
6928
+ return;
6929
+ }
6930
+ let payload;
6931
+ try {
6932
+ payload = await response.json();
6933
+ } catch (error) {
6934
+ console.warn(
6935
+ `[freestyle] background log payload parse failed for request ${requestId}:`,
6936
+ error
6937
+ );
6697
6938
  return;
6698
6939
  }
6699
- const payload = await response.json();
6700
6940
  for (const entry of payload.logs ?? []) {
6701
6941
  const key = `${entry.timestamp} ${entry.message}`;
6702
6942
  if (seenLogs.has(key)) {
6703
6943
  continue;
6704
6944
  }
6705
6945
  seenLogs.add(key);
6706
- logger(`[${entry.timestamp}] ${entry.message}`);
6946
+ try {
6947
+ logger(`[${entry.timestamp}] ${entry.message}`);
6948
+ } catch (error) {
6949
+ console.warn(
6950
+ `[freestyle] background logger callback threw for request ${requestId}:`,
6951
+ error
6952
+ );
6953
+ }
6707
6954
  }
6708
6955
  }
6709
6956
  async function waitForBackgroundRequest(apiClient, requestId, logger) {
@@ -6713,29 +6960,64 @@ async function waitForBackgroundRequest(apiClient, requestId, logger) {
6713
6960
  );
6714
6961
  while (true) {
6715
6962
  await emitBackgroundLogs(apiClient, requestId, logger, seenLogs);
6716
- const response = await apiClient.fetch(resultUrl, { method: "GET" });
6717
- if (response.status === 202) {
6963
+ let response;
6964
+ try {
6965
+ response = await apiClient.fetch(resultUrl, { method: "GET" });
6966
+ } catch {
6718
6967
  await delay(DEFAULT_BACKGROUND_POLL_INTERVAL_MS);
6719
6968
  continue;
6720
6969
  }
6721
6970
  if (!response.ok) {
6722
- const message = await readResponseError(
6723
- response,
6724
- `Background request ${requestId} failed`
6725
- );
6726
- throw new Error(message);
6971
+ const responseText = await response.text().catch(() => "");
6972
+ let parsedBody;
6973
+ try {
6974
+ parsedBody = JSON.parse(responseText);
6975
+ } catch {
6976
+ await delay(DEFAULT_BACKGROUND_POLL_INTERVAL_MS);
6977
+ continue;
6978
+ }
6979
+ const hasErrorCode = typeof parsedBody === "object" && parsedBody !== null && typeof parsedBody.code === "string";
6980
+ if (!hasErrorCode) {
6981
+ await delay(DEFAULT_BACKGROUND_POLL_INTERVAL_MS);
6982
+ continue;
6983
+ }
6984
+ try {
6985
+ throw errorFromJSON(parsedBody);
6986
+ } catch (error) {
6987
+ if (error instanceof Error) {
6988
+ throw error;
6989
+ }
6990
+ throw new Error(responseText);
6991
+ }
6992
+ }
6993
+ if (response.status === 202) {
6994
+ await delay(DEFAULT_BACKGROUND_POLL_INTERVAL_MS);
6995
+ continue;
6727
6996
  }
6728
6997
  return parseJsonResponse(response);
6729
6998
  }
6730
6999
  }
6731
7000
  async function postWithBackgroundLogger(apiClient, path, options, logger) {
6732
- const response = await apiClient.postRaw(path, {
7001
+ const postOptions = {
6733
7002
  ...options,
6734
7003
  headers: logger ? {
6735
7004
  ...options.headers ?? {},
6736
7005
  [BACKGROUND_AFTER_SECS_HEADER]: String(DEFAULT_BACKGROUND_AFTER_SECS)
6737
7006
  } : options.headers
6738
- });
7007
+ };
7008
+ let response;
7009
+ while (true) {
7010
+ try {
7011
+ response = await apiClient.postRaw(path, postOptions);
7012
+ break;
7013
+ } catch (error) {
7014
+ console.warn(
7015
+ `[freestyle] POST ${path} threw, retrying:`,
7016
+ error
7017
+ );
7018
+ await delay(DEFAULT_BACKGROUND_POLL_INTERVAL_MS);
7019
+ }
7020
+ }
6739
7021
  if (response.status !== 202 || !logger) {
6740
7022
  return parseJsonResponse(response);
6741
7023
  }
@@ -6987,6 +7269,32 @@ class Vm {
6987
7269
  params: { vm_id: this.vmId }
6988
7270
  });
6989
7271
  }
7272
+ /**
7273
+ * Get observability logs for this VM.
7274
+ */
7275
+ async getLogs(options = {}) {
7276
+ return this._freestyle.observability.getLogs({
7277
+ ...options,
7278
+ vmId: this.vmId
7279
+ });
7280
+ }
7281
+ /**
7282
+ * Fetch the build record that produced this VM. Returns a `Build` handle —
7283
+ * call `.get()` for the record, `.phases()` for the per-phase breakdown.
7284
+ */
7285
+ async getBuild() {
7286
+ const url = this.apiClient.resolveUrl("/v1/vms/{vm_id}/build", {
7287
+ vm_id: this.vmId
7288
+ });
7289
+ const res = await this.apiClient.fetch(url, { method: "GET" });
7290
+ if (!res.ok) {
7291
+ throw new Error(
7292
+ `GET /v1/vms/${this.vmId}/build failed: ${res.status} ${res.statusText}`
7293
+ );
7294
+ }
7295
+ const record = await res.json();
7296
+ return new Build({ buildId: record.buildId, apiClient: this.apiClient });
7297
+ }
6990
7298
  user({ username }) {
6991
7299
  let vm = new Vm({ vmId: this.vmId, freestyle: this._freestyle });
6992
7300
  vm._linux_username = username;
@@ -7426,10 +7734,22 @@ class VmSpec {
7426
7734
  }
7427
7735
  systemdService(service) {
7428
7736
  const existingSystemd = this.raw.systemd ?? {};
7429
- const services = existingSystemd.services ?? [];
7737
+ const services = [...existingSystemd.services ?? []];
7738
+ const { lastGeneratedServiceName } = getGeneratedServiceState(
7739
+ services,
7740
+ RUN_COMMANDS_SYSTEMD_SERVICE_PREFIX
7741
+ );
7742
+ const normalizedService = {
7743
+ ...service,
7744
+ after: appendServiceDependency(service.after, lastGeneratedServiceName),
7745
+ requires: appendServiceDependency(
7746
+ service.requires,
7747
+ lastGeneratedServiceName
7748
+ )
7749
+ };
7430
7750
  this.raw.systemd = {
7431
7751
  ...existingSystemd,
7432
- services: [...services, service]
7752
+ services: [...services, normalizedService]
7433
7753
  };
7434
7754
  return this;
7435
7755
  }
@@ -8011,6 +8331,115 @@ class VmSnapshotsNamespace {
8011
8331
  }
8012
8332
  return await response.json();
8013
8333
  }
8334
+ /**
8335
+ * List snapshots. By default omits deleted, includes failed/building.
8336
+ */
8337
+ async list(opts = {}) {
8338
+ const query = {};
8339
+ if (opts.includeDeleted != null)
8340
+ query.includeDeleted = String(opts.includeDeleted);
8341
+ if (opts.includeFailed != null)
8342
+ query.includeFailed = String(opts.includeFailed);
8343
+ if (opts.includeBuilding != null)
8344
+ query.includeBuilding = String(opts.includeBuilding);
8345
+ if (opts.includeCancelled != null)
8346
+ query.includeCancelled = String(opts.includeCancelled);
8347
+ if (opts.includeLost != null)
8348
+ query.includeLost = String(opts.includeLost);
8349
+ const url = this.apiClient.resolveUrl("/v1/vms/snapshots", void 0, query);
8350
+ const res = await this.apiClient.fetch(url, { method: "GET" });
8351
+ if (!res.ok) {
8352
+ throw new Error(
8353
+ `GET /v1/vms/snapshots failed: ${res.status} ${res.statusText}`
8354
+ );
8355
+ }
8356
+ return await res.json();
8357
+ }
8358
+ /** Construct a `Snapshot` handle from a known snapshot ID. */
8359
+ ref({ snapshotId }) {
8360
+ return new Snapshot({ snapshotId, apiClient: this.apiClient });
8361
+ }
8362
+ /** Convenience: fetch the snapshot record. Equivalent to `ref(...).get()`. */
8363
+ async get({ snapshotId }) {
8364
+ return this.ref({ snapshotId }).get();
8365
+ }
8366
+ }
8367
+ class Snapshot {
8368
+ /** @internal */
8369
+ _apiClient;
8370
+ snapshotId;
8371
+ /** @internal */
8372
+ constructor({
8373
+ snapshotId,
8374
+ apiClient
8375
+ }) {
8376
+ this.snapshotId = snapshotId;
8377
+ this._apiClient = apiClient;
8378
+ }
8379
+ /** Fetch the latest snapshot record. */
8380
+ async get() {
8381
+ const url = this._apiClient.resolveUrl(
8382
+ "/v1/vms/snapshots/{snapshot_id}",
8383
+ { snapshot_id: this.snapshotId }
8384
+ );
8385
+ const res = await this._apiClient.fetch(url, { method: "GET" });
8386
+ if (!res.ok) {
8387
+ throw new Error(
8388
+ `GET /v1/vms/snapshots/${this.snapshotId} failed: ${res.status} ${res.statusText}`
8389
+ );
8390
+ }
8391
+ return await res.json();
8392
+ }
8393
+ /** Rename the snapshot. */
8394
+ async update({ name }) {
8395
+ const url = this._apiClient.resolveUrl(
8396
+ "/v1/vms/snapshots/{snapshot_id}",
8397
+ { snapshot_id: this.snapshotId }
8398
+ );
8399
+ const res = await this._apiClient.fetch(url, {
8400
+ method: "PATCH",
8401
+ body: JSON.stringify({ name }),
8402
+ headers: { "Content-Type": "application/json" }
8403
+ });
8404
+ if (!res.ok) {
8405
+ throw new Error(
8406
+ `PATCH /v1/vms/snapshots/${this.snapshotId} failed: ${res.status} ${res.statusText}`
8407
+ );
8408
+ }
8409
+ }
8410
+ /** Delete the snapshot. */
8411
+ async delete() {
8412
+ const url = this._apiClient.resolveUrl(
8413
+ "/v1/vms/snapshots/{snapshot_id}",
8414
+ { snapshot_id: this.snapshotId }
8415
+ );
8416
+ const res = await this._apiClient.fetch(url, { method: "DELETE" });
8417
+ if (!res.ok) {
8418
+ const errorBody = await res.json().catch(() => null);
8419
+ if (errorBody?.code) {
8420
+ throw errorFromJSON(errorBody);
8421
+ }
8422
+ throw new Error(
8423
+ `DELETE /v1/vms/snapshots/${this.snapshotId} failed: ${res.status} ${res.statusText}`
8424
+ );
8425
+ }
8426
+ return await res.json();
8427
+ }
8428
+ /**
8429
+ * Fetch the build record that produced this snapshot. Returns a `Build`
8430
+ * handle. Throws if the snapshot has no `buildId` (legacy rows or
8431
+ * snapshots that pre-date the build-tracking feature).
8432
+ */
8433
+ async getBuild() {
8434
+ const info = await this.get();
8435
+ const buildId = info.buildId;
8436
+ if (!buildId) {
8437
+ throw new Error(
8438
+ `Snapshot ${this.snapshotId} has no associated build (legacy snapshot or build record missing).`
8439
+ );
8440
+ }
8441
+ return new Build({ buildId, apiClient: this._apiClient });
8442
+ }
8014
8443
  }
8015
8444
  async function processTemplateTree(template) {
8016
8445
  if (template.raw.baseImage) {
@@ -8118,16 +8547,27 @@ class CronNamespace {
8118
8547
  */
8119
8548
  async schedule({
8120
8549
  deploymentId,
8550
+ run,
8551
+ name,
8121
8552
  cron,
8122
8553
  timezone,
8554
+ retries,
8123
8555
  payload,
8124
8556
  path
8125
8557
  }) {
8558
+ if (!deploymentId && !run || deploymentId && run) {
8559
+ throw new Error(
8560
+ "Exactly one of deploymentId or run must be provided when creating a cron schedule."
8561
+ );
8562
+ }
8126
8563
  const response = await this.apiClient.post("/v1/cron/schedules", {
8127
8564
  body: {
8128
8565
  deploymentId,
8566
+ run,
8567
+ name,
8129
8568
  cron,
8130
8569
  timezone: timezone ?? "UTC",
8570
+ retries,
8131
8571
  payload: payload ?? {},
8132
8572
  path
8133
8573
  }
@@ -8165,6 +8605,28 @@ class CronJob {
8165
8605
  this.#apiClient = apiClient;
8166
8606
  this.schedule = schedule;
8167
8607
  }
8608
+ /**
8609
+ * Update this cron schedule.
8610
+ */
8611
+ async update(params) {
8612
+ if (params.deploymentId && params.run) {
8613
+ throw new Error("Only one of deploymentId or run may be provided.");
8614
+ }
8615
+ await this.#apiClient.patch("/v1/cron/schedules/{id}", {
8616
+ params: { id: this.schedule.id },
8617
+ body: {
8618
+ deploymentId: params.deploymentId,
8619
+ run: params.run,
8620
+ name: params.name,
8621
+ cron: params.cron,
8622
+ timezone: params.timezone,
8623
+ retries: params.retries,
8624
+ payload: params.payload,
8625
+ path: params.path,
8626
+ active: params.active
8627
+ }
8628
+ });
8629
+ }
8168
8630
  /**
8169
8631
  * Enable this cron schedule.
8170
8632
  */
@@ -8231,6 +8693,96 @@ class CronJob {
8231
8693
  }
8232
8694
  }
8233
8695
 
8696
+ const DEFAULT_LOG_STREAM_INTERVAL_MS = 2e3;
8697
+ function logEntryKey(entry) {
8698
+ return [
8699
+ entry.timestamp,
8700
+ entry.resourceType ?? "",
8701
+ entry.resourceId ?? "",
8702
+ entry.instanceId ?? "",
8703
+ entry.vmService ?? "",
8704
+ entry.source ?? "",
8705
+ entry.message
8706
+ ].join(" ");
8707
+ }
8708
+ function sortLogsAscending(logs) {
8709
+ return [...logs].sort((left, right) => {
8710
+ const leftTime = Date.parse(left.timestamp);
8711
+ const rightTime = Date.parse(right.timestamp);
8712
+ if (!Number.isNaN(leftTime) && !Number.isNaN(rightTime)) {
8713
+ return leftTime - rightTime;
8714
+ }
8715
+ return left.timestamp.localeCompare(right.timestamp);
8716
+ });
8717
+ }
8718
+ function waitForInterval(ms, signal) {
8719
+ if (signal?.aborted) {
8720
+ return Promise.resolve();
8721
+ }
8722
+ return new Promise((resolve) => {
8723
+ const timeout = setTimeout(resolve, ms);
8724
+ signal?.addEventListener(
8725
+ "abort",
8726
+ () => {
8727
+ clearTimeout(timeout);
8728
+ resolve();
8729
+ },
8730
+ { once: true }
8731
+ );
8732
+ });
8733
+ }
8734
+ class ObservabilityNamespace {
8735
+ constructor(apiClient) {
8736
+ this.apiClient = apiClient;
8737
+ }
8738
+ async getLogs(options = {}) {
8739
+ return this.apiClient.get("/observability/v1/logs", {
8740
+ query: options
8741
+ });
8742
+ }
8743
+ logs(options = {}) {
8744
+ return this.getLogs(options);
8745
+ }
8746
+ async *streamLogs({
8747
+ intervalMs = DEFAULT_LOG_STREAM_INTERVAL_MS,
8748
+ signal,
8749
+ includeExisting = false,
8750
+ ...query
8751
+ } = {}) {
8752
+ const seenLogs = /* @__PURE__ */ new Set();
8753
+ let startTime = query.startTime;
8754
+ if (!includeExisting && !startTime) {
8755
+ startTime = (/* @__PURE__ */ new Date()).toISOString();
8756
+ }
8757
+ while (!signal?.aborted) {
8758
+ const response = await this.getLogs({
8759
+ ...query,
8760
+ startTime
8761
+ });
8762
+ if (signal?.aborted) {
8763
+ break;
8764
+ }
8765
+ let newestTimestampMs;
8766
+ for (const entry of sortLogsAscending(response.logs ?? [])) {
8767
+ const key = logEntryKey(entry);
8768
+ if (seenLogs.has(key)) {
8769
+ continue;
8770
+ }
8771
+ seenLogs.add(key);
8772
+ const timestampMs = Date.parse(entry.timestamp);
8773
+ if (!Number.isNaN(timestampMs) && (newestTimestampMs === void 0 || timestampMs > newestTimestampMs)) {
8774
+ newestTimestampMs = timestampMs;
8775
+ }
8776
+ yield entry;
8777
+ }
8778
+ if (newestTimestampMs !== void 0) {
8779
+ startTime = new Date(newestTimestampMs).toISOString();
8780
+ }
8781
+ await waitForInterval(intervalMs, signal);
8782
+ }
8783
+ }
8784
+ }
8785
+
8234
8786
  async function readFiles(directory) {
8235
8787
  let fs;
8236
8788
  let glob;
@@ -8435,6 +8987,7 @@ class Freestyle {
8435
8987
  serverless;
8436
8988
  vms;
8437
8989
  cron;
8990
+ observability;
8438
8991
  constructor(options = {}) {
8439
8992
  if (!options.baseUrl) {
8440
8993
  options.baseUrl = process.env.FREESTYLE_API_URL;
@@ -8461,6 +9014,7 @@ class Freestyle {
8461
9014
  this.serverless = new ServerlessNamespace(this._apiClient);
8462
9015
  this.vms = new VmsNamespace(this);
8463
9016
  this.cron = new CronNamespace(this._apiClient);
9017
+ this.observability = new ObservabilityNamespace(this._apiClient);
8464
9018
  }
8465
9019
  /**
8466
9020
  * Returns information about the currently authenticated user or identity.
@@ -8502,6 +9056,7 @@ function createLazyFreestyle(options = {}) {
8502
9056
  }
8503
9057
  const freestyle = createLazyFreestyle();
8504
9058
 
9059
+ exports.Build = Build;
8505
9060
  exports.CronNamespace = CronNamespace;
8506
9061
  exports.Deployment = Deployment;
8507
9062
  exports.Errors = errors;
@@ -8509,6 +9064,8 @@ exports.FileSystem = FileSystem;
8509
9064
  exports.Freestyle = Freestyle;
8510
9065
  exports.GitRepo = GitRepo;
8511
9066
  exports.Identity = Identity;
9067
+ exports.ObservabilityNamespace = ObservabilityNamespace;
9068
+ exports.Snapshot = Snapshot;
8512
9069
  exports.Systemd = Systemd;
8513
9070
  exports.SystemdService = SystemdService;
8514
9071
  exports.Vm = Vm;