freestyle 0.1.49 → 0.1.51

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