freestyle 0.1.47 → 0.1.49

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 +51 -0
  2. package/index.cjs +1791 -1475
  3. package/index.d.cts +3943 -2379
  4. package/index.d.mts +3943 -2379
  5. package/index.mjs +1791 -1475
  6. package/package.json +1 -1
  7. package/index.js +0 -391
package/index.mjs CHANGED
@@ -8,6 +8,18 @@ function errorFromJSON(body) {
8
8
  return new Error(`Unknown error code: ${body.code} - ${body.description}`);
9
9
  }
10
10
  }
11
+ class GitErrorError extends Error {
12
+ constructor(body) {
13
+ super(
14
+ `GIT_ERROR: ${body.message}`
15
+ );
16
+ this.body = body;
17
+ this.name = "GitErrorError";
18
+ }
19
+ static code = "GIT_ERROR";
20
+ static statusCode = 500;
21
+ static description = `{message}`;
22
+ }
11
23
  class BadParseError extends Error {
12
24
  constructor(body) {
13
25
  super(
@@ -68,505 +80,313 @@ class BadKeyError extends Error {
68
80
  static statusCode = 400;
69
81
  static description = `invalid key length`;
70
82
  }
71
- class GitErrorError extends Error {
83
+ class SnapshotSetupFailedError extends Error {
72
84
  constructor(body) {
73
85
  super(
74
- `GIT_ERROR: ${body.message}`
86
+ `SNAPSHOT_SETUP_FAILED: ${body.message}`
75
87
  );
76
88
  this.body = body;
77
- this.name = "GitErrorError";
89
+ this.name = "SnapshotSetupFailedError";
78
90
  }
79
- static code = "GIT_ERROR";
91
+ static code = "SNAPSHOT_SETUP_FAILED";
80
92
  static statusCode = 500;
81
- static description = `{message}`;
93
+ static description = `Snapshot setup failed: {failed_reason}`;
82
94
  }
83
- class SuspendFailedAndStopFailedError extends Error {
95
+ class SnapshotVmBadRequestError extends Error {
84
96
  constructor(body) {
85
97
  super(
86
- `SUSPEND_FAILED_AND_STOP_FAILED: ${body.message}`
98
+ `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
87
99
  );
88
100
  this.body = body;
89
- this.name = "SuspendFailedAndStopFailedError";
101
+ this.name = "SnapshotVmBadRequestError";
90
102
  }
91
- static code = "SUSPEND_FAILED_AND_STOP_FAILED";
92
- static statusCode = 500;
93
- static description = `Failed to gracefully suspend or stop VM`;
103
+ static code = "SNAPSHOT_VM_BAD_REQUEST";
104
+ static statusCode = 400;
105
+ static description = `Bad request: {message}`;
94
106
  }
95
- class SuspendFailedAndStoppedError extends Error {
107
+ class ResizeVmMemNotPowerOfTwoError extends Error {
96
108
  constructor(body) {
97
109
  super(
98
- `SUSPEND_FAILED_AND_STOPPED: ${body.message}`
110
+ `RESIZE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
99
111
  );
100
112
  this.body = body;
101
- this.name = "SuspendFailedAndStoppedError";
113
+ this.name = "ResizeVmMemNotPowerOfTwoError";
102
114
  }
103
- static code = "SUSPEND_FAILED_AND_STOPPED";
104
- static statusCode = 500;
105
- static description = `Failed to gracefully suspend, stopped VM`;
115
+ static code = "RESIZE_VM_MEM_NOT_POWER_OF_TWO";
116
+ static statusCode = 400;
117
+ static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
106
118
  }
107
- class InvalidGitRepoSpecErrorError extends Error {
119
+ class ResizeVmVcpuNotPowerOfTwoError extends Error {
108
120
  constructor(body) {
109
121
  super(
110
- `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
122
+ `RESIZE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
111
123
  );
112
124
  this.body = body;
113
- this.name = "InvalidGitRepoSpecErrorError";
125
+ this.name = "ResizeVmVcpuNotPowerOfTwoError";
114
126
  }
115
- static code = "INVALID_GIT_REPO_SPEC_ERROR";
127
+ static code = "RESIZE_VM_VCPU_NOT_POWER_OF_TWO";
116
128
  static statusCode = 400;
117
- static description = `Invalid git repository specification: {message}`;
129
+ static description = `vcpuCount must be a power of two (got {got})`;
118
130
  }
119
- class InternalErrorError extends Error {
131
+ class ResizeVmMemOutOfRangeError extends Error {
120
132
  constructor(body) {
121
133
  super(
122
- `INTERNAL_ERROR: ${body.message}`
134
+ `RESIZE_VM_MEM_OUT_OF_RANGE: ${body.message}`
123
135
  );
124
136
  this.body = body;
125
- this.name = "InternalErrorError";
137
+ this.name = "ResizeVmMemOutOfRangeError";
126
138
  }
127
- static code = "INTERNAL_ERROR";
128
- static statusCode = 500;
129
- static description = `Internal error: {message}`;
139
+ static code = "RESIZE_VM_MEM_OUT_OF_RANGE";
140
+ static statusCode = 400;
141
+ static description = `memSizeMb out of range (got {got}MiB, allowed {min}..={max} MiB)`;
130
142
  }
131
- class ForkVmNotFoundError extends Error {
143
+ class ResizeVmVcpuOutOfRangeError extends Error {
132
144
  constructor(body) {
133
145
  super(
134
- `FORK_VM_NOT_FOUND: ${body.message}`
146
+ `RESIZE_VM_VCPU_OUT_OF_RANGE: ${body.message}`
135
147
  );
136
148
  this.body = body;
137
- this.name = "ForkVmNotFoundError";
149
+ this.name = "ResizeVmVcpuOutOfRangeError";
138
150
  }
139
- static code = "FORK_VM_NOT_FOUND";
140
- static statusCode = 404;
141
- static description = `Fork VM not found: {fork_vm_id}`;
151
+ static code = "RESIZE_VM_VCPU_OUT_OF_RANGE";
152
+ static statusCode = 400;
153
+ static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
142
154
  }
143
- class CreateSnapshotBadRequestError extends Error {
155
+ class ResizeVmRootfsShrinkNotSupportedError extends Error {
144
156
  constructor(body) {
145
157
  super(
146
- `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
158
+ `RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED: ${body.message}`
147
159
  );
148
160
  this.body = body;
149
- this.name = "CreateSnapshotBadRequestError";
161
+ this.name = "ResizeVmRootfsShrinkNotSupportedError";
150
162
  }
151
- static code = "CREATE_SNAPSHOT_BAD_REQUEST";
163
+ static code = "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED";
152
164
  static statusCode = 400;
153
- static description = `Bad request: {message}`;
165
+ static description = `Rootfs shrink is not supported (current={current_mb}MiB, requested={requested_mb}MiB)`;
154
166
  }
155
- class SnapshotNotFoundError extends Error {
167
+ class ResizeVmEmptyRequestError extends Error {
156
168
  constructor(body) {
157
169
  super(
158
- `SNAPSHOT_NOT_FOUND: ${body.message}`
170
+ `RESIZE_VM_EMPTY_REQUEST: ${body.message}`
159
171
  );
160
172
  this.body = body;
161
- this.name = "SnapshotNotFoundError";
173
+ this.name = "ResizeVmEmptyRequestError";
162
174
  }
163
- static code = "SNAPSHOT_NOT_FOUND";
164
- static statusCode = 404;
165
- static description = `Snapshot not found: {snapshot_id}`;
175
+ static code = "RESIZE_VM_EMPTY_REQUEST";
176
+ static statusCode = 400;
177
+ static description = `Resize request must specify at least one of vcpuCount, memSizeMb, or rootfsSizeMb`;
166
178
  }
167
- class ResumedVmNonResponsiveError extends Error {
179
+ class ExecTimedOutError extends Error {
168
180
  constructor(body) {
169
181
  super(
170
- `RESUMED_VM_NON_RESPONSIVE: ${body.message}`
182
+ `EXEC_TIMED_OUT: ${body.message}`
171
183
  );
172
184
  this.body = body;
173
- this.name = "ResumedVmNonResponsiveError";
185
+ this.name = "ExecTimedOutError";
174
186
  }
175
- static code = "RESUMED_VM_NON_RESPONSIVE";
176
- static statusCode = 500;
177
- static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
187
+ static code = "EXEC_TIMED_OUT";
188
+ static statusCode = 408;
189
+ static description = `Command timed out after {timeout_ms}ms`;
178
190
  }
179
- class SnapshotLoadTimeoutError extends Error {
191
+ class NoDefaultSnapshotAvailableError extends Error {
180
192
  constructor(body) {
181
193
  super(
182
- `SNAPSHOT_LOAD_TIMEOUT: ${body.message}`
194
+ `NO_DEFAULT_SNAPSHOT_AVAILABLE: ${body.message}`
183
195
  );
184
196
  this.body = body;
185
- this.name = "SnapshotLoadTimeoutError";
197
+ this.name = "NoDefaultSnapshotAvailableError";
186
198
  }
187
- static code = "SNAPSHOT_LOAD_TIMEOUT";
188
- static statusCode = 500;
189
- static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
199
+ static code = "NO_DEFAULT_SNAPSHOT_AVAILABLE";
200
+ static statusCode = 404;
201
+ static description = `No default snapshot available for account {account_id}`;
190
202
  }
191
- class UffdTimeoutErrorError extends Error {
203
+ class DockerSnapshotFailedError extends Error {
192
204
  constructor(body) {
193
205
  super(
194
- `UFFD_TIMEOUT_ERROR: ${body.message}`
206
+ `DOCKER_SNAPSHOT_FAILED: ${body.message}`
195
207
  );
196
208
  this.body = body;
197
- this.name = "UffdTimeoutErrorError";
209
+ this.name = "DockerSnapshotFailedError";
198
210
  }
199
- static code = "UFFD_TIMEOUT_ERROR";
211
+ static code = "DOCKER_SNAPSHOT_FAILED";
200
212
  static statusCode = 500;
201
- static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
213
+ static description = `Failed to create snapshot from Docker image {docker_image} for account {account_id}: {details}`;
202
214
  }
203
- class KernelPanicError extends Error {
215
+ class SetDefaultSnapshotFailedError extends Error {
204
216
  constructor(body) {
205
217
  super(
206
- `KERNEL_PANIC: ${body.message}`
218
+ `SET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
207
219
  );
208
220
  this.body = body;
209
- this.name = "KernelPanicError";
221
+ this.name = "SetDefaultSnapshotFailedError";
210
222
  }
211
- static code = "KERNEL_PANIC";
223
+ static code = "SET_DEFAULT_SNAPSHOT_FAILED";
212
224
  static statusCode = 500;
213
- static description = `VM kernel panic detected`;
225
+ static description = `Failed to update default snapshot in database for account {account_id}, snapshot {snapshot_id}: {details}`;
214
226
  }
215
- class VmDeletedError extends Error {
227
+ class SnapshotLayerCreationFailedError extends Error {
216
228
  constructor(body) {
217
229
  super(
218
- `VM_DELETED: ${body.message}`
230
+ `SNAPSHOT_LAYER_CREATION_FAILED: ${body.message}`
219
231
  );
220
232
  this.body = body;
221
- this.name = "VmDeletedError";
233
+ this.name = "SnapshotLayerCreationFailedError";
222
234
  }
223
- static code = "VM_DELETED";
224
- static statusCode = 410;
225
- static description = `Cannot start VM: VM files have been deleted. This VM was ephemeral and its files were removed.`;
235
+ static code = "SNAPSHOT_LAYER_CREATION_FAILED";
236
+ static statusCode = 500;
237
+ static description = `Failed to create snapshot layer for account {account_id} from {source_snapshot_dir}: {details}`;
226
238
  }
227
- class ReqwestError extends Error {
239
+ class SnapshotDirNotFoundError extends Error {
228
240
  constructor(body) {
229
241
  super(
230
- `REQWEST: ${body.message}`
242
+ `SNAPSHOT_DIR_NOT_FOUND: ${body.message}`
231
243
  );
232
244
  this.body = body;
233
- this.name = "ReqwestError";
245
+ this.name = "SnapshotDirNotFoundError";
234
246
  }
235
- static code = "REQWEST";
247
+ static code = "SNAPSHOT_DIR_NOT_FOUND";
236
248
  static statusCode = 500;
237
- static description = `Reqwest error: {details}`;
249
+ static description = `Snapshot directory not found at {snapshot_dir} for account {account_id}, snapshot {snapshot_id}`;
238
250
  }
239
- class FirecrackerPidNotFoundError extends Error {
251
+ class SubvolumeCreationFailedError extends Error {
240
252
  constructor(body) {
241
253
  super(
242
- `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
254
+ `SUBVOLUME_CREATION_FAILED: ${body.message}`
243
255
  );
244
256
  this.body = body;
245
- this.name = "FirecrackerPidNotFoundError";
257
+ this.name = "SubvolumeCreationFailedError";
246
258
  }
247
- static code = "FIRECRACKER_PID_NOT_FOUND";
259
+ static code = "SUBVOLUME_CREATION_FAILED";
248
260
  static statusCode = 500;
249
- static description = `Firecracker PID not found`;
261
+ static description = `Failed to create account subvolume for account {account_id}: {details}`;
250
262
  }
251
- class FirecrackerApiSocketNotFoundError extends Error {
263
+ class GetDefaultSnapshotFailedError extends Error {
252
264
  constructor(body) {
253
265
  super(
254
- `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
266
+ `GET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
255
267
  );
256
268
  this.body = body;
257
- this.name = "FirecrackerApiSocketNotFoundError";
269
+ this.name = "GetDefaultSnapshotFailedError";
258
270
  }
259
- static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
271
+ static code = "GET_DEFAULT_SNAPSHOT_FAILED";
260
272
  static statusCode = 500;
261
- static description = `Firecracker API socket not found`;
273
+ static description = `Failed to query account default snapshot for account {account_id}: {details}`;
262
274
  }
263
- class InvalidSnapshotIdError extends Error {
275
+ class VmOperationDeniedDuringTransactionError extends Error {
264
276
  constructor(body) {
265
277
  super(
266
- `INVALID_SNAPSHOT_ID: ${body.message}`
278
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
267
279
  );
268
280
  this.body = body;
269
- this.name = "InvalidSnapshotIdError";
281
+ this.name = "VmOperationDeniedDuringTransactionError";
270
282
  }
271
- static code = "INVALID_SNAPSHOT_ID";
272
- static statusCode = 400;
273
- static description = `Invalid snapshot id: {id}`;
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}`;
274
286
  }
275
- class VmStartTimeoutError extends Error {
287
+ class VmTransactionIdMismatchError extends Error {
276
288
  constructor(body) {
277
289
  super(
278
- `VM_START_TIMEOUT: ${body.message}`
290
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
279
291
  );
280
292
  this.body = body;
281
- this.name = "VmStartTimeoutError";
293
+ this.name = "VmTransactionIdMismatchError";
282
294
  }
283
- static code = "VM_START_TIMEOUT";
284
- static statusCode = 504;
285
- static description = `VM did not become ready within the specified timeout`;
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}`;
286
298
  }
287
- class VmIsSuspendingError extends Error {
299
+ class VmNotInTransactionError extends Error {
288
300
  constructor(body) {
289
301
  super(
290
- `VM_IS_SUSPENDING: ${body.message}`
302
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
291
303
  );
292
304
  this.body = body;
293
- this.name = "VmIsSuspendingError";
305
+ this.name = "VmNotInTransactionError";
294
306
  }
295
- static code = "VM_IS_SUSPENDING";
296
- static statusCode = 409;
297
- static description = `VM is currently being suspended`;
307
+ static code = "VM_NOT_IN_TRANSACTION";
308
+ static statusCode = 404;
309
+ static description = `VM not in a transaction: {vm_id}`;
298
310
  }
299
- class VmExitDuringStartError extends Error {
311
+ class ConflictingSpecSourcesErrorError extends Error {
300
312
  constructor(body) {
301
313
  super(
302
- `VM_EXIT_DURING_START: ${body.message}`
314
+ `CONFLICTING_SPEC_SOURCES_ERROR: ${body.message}`
303
315
  );
304
316
  this.body = body;
305
- this.name = "VmExitDuringStartError";
317
+ this.name = "ConflictingSpecSourcesErrorError";
306
318
  }
307
- static code = "VM_EXIT_DURING_START";
308
- static statusCode = 500;
309
- static description = `VM process exited unexpectedly during start`;
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\``;
310
322
  }
311
- class VmAccessDeniedError extends Error {
323
+ class NonLeafLayerFieldErrorError extends Error {
312
324
  constructor(body) {
313
325
  super(
314
- `VM_ACCESS_DENIED: ${body.message}`
326
+ `NON_LEAF_LAYER_FIELD_ERROR: ${body.message}`
315
327
  );
316
328
  this.body = body;
317
- this.name = "VmAccessDeniedError";
329
+ this.name = "NonLeafLayerFieldErrorError";
318
330
  }
319
- static code = "VM_ACCESS_DENIED";
320
- static statusCode = 403;
321
- static description = `You do not have access to this VM`;
331
+ static code = "NON_LEAF_LAYER_FIELD_ERROR";
332
+ 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)`;
322
334
  }
323
- class FailedToSpawnUffdError extends Error {
335
+ class InvalidGitRepoSpecErrorError extends Error {
324
336
  constructor(body) {
325
337
  super(
326
- `FAILED_TO_SPAWN_UFFD: ${body.message}`
338
+ `INVALID_GIT_REPO_SPEC_ERROR: ${body.message}`
327
339
  );
328
340
  this.body = body;
329
- this.name = "FailedToSpawnUffdError";
341
+ this.name = "InvalidGitRepoSpecErrorError";
330
342
  }
331
- static code = "FAILED_TO_SPAWN_UFFD";
332
- static statusCode = 500;
333
- static description = `Failed to spawn UFFD handler '{daemon_name}'`;
343
+ static code = "INVALID_GIT_REPO_SPEC_ERROR";
344
+ static statusCode = 400;
345
+ static description = `Cannot specify both root-level \`gitRepos\` and \`git.repos\`. Prefer \`git.repos\`.`;
334
346
  }
335
- class VmSpawnProcessError extends Error {
347
+ class InternalErrorError extends Error {
336
348
  constructor(body) {
337
349
  super(
338
- `VM_SPAWN_PROCESS: ${body.message}`
350
+ `INTERNAL_ERROR: ${body.message}`
339
351
  );
340
352
  this.body = body;
341
- this.name = "VmSpawnProcessError";
353
+ this.name = "InternalErrorError";
342
354
  }
343
- static code = "VM_SPAWN_PROCESS";
355
+ static code = "INTERNAL_ERROR";
344
356
  static statusCode = 500;
345
- static description = `Failed to spawn process for VM`;
357
+ static description = `Internal error: {message}`;
346
358
  }
347
- class VmSubnetNotFoundError extends Error {
359
+ class ForkVmNotFoundError extends Error {
348
360
  constructor(body) {
349
361
  super(
350
- `VM_SUBNET_NOT_FOUND: ${body.message}`
362
+ `FORK_VM_NOT_FOUND: ${body.message}`
351
363
  );
352
364
  this.body = body;
353
- this.name = "VmSubnetNotFoundError";
365
+ this.name = "ForkVmNotFoundError";
354
366
  }
355
- static code = "VM_SUBNET_NOT_FOUND";
356
- static statusCode = 500;
357
- static description = `Subnet for VM not found`;
367
+ static code = "FORK_VM_NOT_FOUND";
368
+ static statusCode = 404;
369
+ static description = `Fork VM not found: {fork_vm_id}`;
358
370
  }
359
- class SnapshotSetupFailedError extends Error {
371
+ class CreateSnapshotBadRequestError extends Error {
360
372
  constructor(body) {
361
373
  super(
362
- `SNAPSHOT_SETUP_FAILED: ${body.message}`
374
+ `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
363
375
  );
364
376
  this.body = body;
365
- this.name = "SnapshotSetupFailedError";
377
+ this.name = "CreateSnapshotBadRequestError";
366
378
  }
367
- static code = "SNAPSHOT_SETUP_FAILED";
368
- static statusCode = 500;
369
- static description = `Snapshot setup failed: {failed_reason}`;
379
+ static code = "CREATE_SNAPSHOT_BAD_REQUEST";
380
+ static statusCode = 400;
381
+ static description = `Bad request: {message}`;
370
382
  }
371
- class SnapshotVmBadRequestError extends Error {
383
+ class UserNotFoundError extends Error {
372
384
  constructor(body) {
373
385
  super(
374
- `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
386
+ `USER_NOT_FOUND: ${body.message}`
375
387
  );
376
388
  this.body = body;
377
- this.name = "SnapshotVmBadRequestError";
378
- }
379
- static code = "SNAPSHOT_VM_BAD_REQUEST";
380
- static statusCode = 400;
381
- static description = `Bad request: {message}`;
382
- }
383
- class SnapshotIsAccountDefaultError extends Error {
384
- constructor(body) {
385
- super(
386
- `SNAPSHOT_IS_ACCOUNT_DEFAULT: ${body.message}`
387
- );
388
- this.body = body;
389
- this.name = "SnapshotIsAccountDefaultError";
390
- }
391
- static code = "SNAPSHOT_IS_ACCOUNT_DEFAULT";
392
- static statusCode = 409;
393
- static description = `Snapshot is the account default and cannot be deleted: {snapshot_id}`;
394
- }
395
- class SnapshotAlreadyDeletedError extends Error {
396
- constructor(body) {
397
- super(
398
- `SNAPSHOT_ALREADY_DELETED: ${body.message}`
399
- );
400
- this.body = body;
401
- this.name = "SnapshotAlreadyDeletedError";
402
- }
403
- static code = "SNAPSHOT_ALREADY_DELETED";
404
- static statusCode = 409;
405
- static description = `Snapshot already deleted: {snapshot_id}`;
406
- }
407
- class VmNotFoundInFsError extends Error {
408
- constructor(body) {
409
- super(
410
- `VM_NOT_FOUND_IN_FS: ${body.message}`
411
- );
412
- this.body = body;
413
- this.name = "VmNotFoundInFsError";
414
- }
415
- static code = "VM_NOT_FOUND_IN_FS";
416
- static statusCode = 406;
417
- static description = `Vm Not found in filesystem`;
418
- }
419
- class VmNotRunningError extends Error {
420
- constructor(body) {
421
- super(
422
- `VM_NOT_RUNNING: ${body.message}`
423
- );
424
- this.body = body;
425
- this.name = "VmNotRunningError";
426
- }
427
- static code = "VM_NOT_RUNNING";
428
- static statusCode = 400;
429
- static description = `VM is not running: {vm_id}`;
430
- }
431
- class VmNotFoundError extends Error {
432
- constructor(body) {
433
- super(
434
- `VM_NOT_FOUND: ${body.message}`
435
- );
436
- this.body = body;
437
- this.name = "VmNotFoundError";
438
- }
439
- static code = "VM_NOT_FOUND";
440
- static statusCode = 404;
441
- static description = `VM not found: {vm_id}`;
442
- }
443
- class InternalForkVmNotFoundError extends Error {
444
- constructor(body) {
445
- super(
446
- `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
447
- );
448
- this.body = body;
449
- this.name = "InternalForkVmNotFoundError";
450
- }
451
- static code = "INTERNAL_FORK_VM_NOT_FOUND";
452
- static statusCode = 404;
453
- static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
454
- }
455
- class BadRequestError extends Error {
456
- constructor(body) {
457
- super(
458
- `BAD_REQUEST: ${body.message}`
459
- );
460
- this.body = body;
461
- this.name = "BadRequestError";
462
- }
463
- static code = "BAD_REQUEST";
464
- static statusCode = 400;
465
- static description = `Bad request: {message}`;
466
- }
467
- class InternalVmNotFoundError extends Error {
468
- constructor(body) {
469
- super(
470
- `INTERNAL_VM_NOT_FOUND: ${body.message}`
471
- );
472
- this.body = body;
473
- this.name = "InternalVmNotFoundError";
474
- }
475
- static code = "INTERNAL_VM_NOT_FOUND";
476
- static statusCode = 404;
477
- static description = `VM not found: {vm_id}`;
478
- }
479
- class NoDefaultSnapshotAvailableError extends Error {
480
- constructor(body) {
481
- super(
482
- `NO_DEFAULT_SNAPSHOT_AVAILABLE: ${body.message}`
483
- );
484
- this.body = body;
485
- this.name = "NoDefaultSnapshotAvailableError";
486
- }
487
- static code = "NO_DEFAULT_SNAPSHOT_AVAILABLE";
488
- static statusCode = 404;
489
- static description = `No default snapshot available for account {account_id}`;
490
- }
491
- class DockerSnapshotFailedError extends Error {
492
- constructor(body) {
493
- super(
494
- `DOCKER_SNAPSHOT_FAILED: ${body.message}`
495
- );
496
- this.body = body;
497
- this.name = "DockerSnapshotFailedError";
498
- }
499
- static code = "DOCKER_SNAPSHOT_FAILED";
500
- static statusCode = 500;
501
- static description = `Failed to create snapshot from Docker image {docker_image} for account {account_id}: {details}`;
502
- }
503
- class SetDefaultSnapshotFailedError extends Error {
504
- constructor(body) {
505
- super(
506
- `SET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
507
- );
508
- this.body = body;
509
- this.name = "SetDefaultSnapshotFailedError";
510
- }
511
- static code = "SET_DEFAULT_SNAPSHOT_FAILED";
512
- static statusCode = 500;
513
- static description = `Failed to update default snapshot in database for account {account_id}, snapshot {snapshot_id}: {details}`;
514
- }
515
- class SnapshotLayerCreationFailedError extends Error {
516
- constructor(body) {
517
- super(
518
- `SNAPSHOT_LAYER_CREATION_FAILED: ${body.message}`
519
- );
520
- this.body = body;
521
- this.name = "SnapshotLayerCreationFailedError";
522
- }
523
- static code = "SNAPSHOT_LAYER_CREATION_FAILED";
524
- static statusCode = 500;
525
- static description = `Failed to create snapshot layer for account {account_id} from {source_snapshot_dir}: {details}`;
526
- }
527
- class SnapshotDirNotFoundError extends Error {
528
- constructor(body) {
529
- super(
530
- `SNAPSHOT_DIR_NOT_FOUND: ${body.message}`
531
- );
532
- this.body = body;
533
- this.name = "SnapshotDirNotFoundError";
534
- }
535
- static code = "SNAPSHOT_DIR_NOT_FOUND";
536
- static statusCode = 500;
537
- static description = `Snapshot directory not found at {snapshot_dir} for account {account_id}, snapshot {snapshot_id}`;
538
- }
539
- class SubvolumeCreationFailedError extends Error {
540
- constructor(body) {
541
- super(
542
- `SUBVOLUME_CREATION_FAILED: ${body.message}`
543
- );
544
- this.body = body;
545
- this.name = "SubvolumeCreationFailedError";
546
- }
547
- static code = "SUBVOLUME_CREATION_FAILED";
548
- static statusCode = 500;
549
- static description = `Failed to create account subvolume for account {account_id}: {details}`;
550
- }
551
- class GetDefaultSnapshotFailedError extends Error {
552
- constructor(body) {
553
- super(
554
- `GET_DEFAULT_SNAPSHOT_FAILED: ${body.message}`
555
- );
556
- this.body = body;
557
- this.name = "GetDefaultSnapshotFailedError";
558
- }
559
- static code = "GET_DEFAULT_SNAPSHOT_FAILED";
560
- static statusCode = 500;
561
- static description = `Failed to query account default snapshot for account {account_id}: {details}`;
562
- }
563
- class UserNotFoundError extends Error {
564
- constructor(body) {
565
- super(
566
- `USER_NOT_FOUND: ${body.message}`
567
- );
568
- this.body = body;
569
- this.name = "UserNotFoundError";
389
+ this.name = "UserNotFoundError";
570
390
  }
571
391
  static code = "USER_NOT_FOUND";
572
392
  static statusCode = 404;
@@ -752,82 +572,406 @@ class GroupNameEmptyError extends Error {
752
572
  static statusCode = 400;
753
573
  static description = `Group name cannot be empty`;
754
574
  }
755
- class ActiveTransactionErrorError extends Error {
756
- constructor(body) {
757
- super(
758
- `ACTIVE_TRANSACTION_ERROR: ${body.message}`
759
- );
760
- this.body = body;
761
- this.name = "ActiveTransactionErrorError";
762
- }
763
- static code = "ACTIVE_TRANSACTION_ERROR";
764
- static statusCode = 500;
765
- static description = `Active transaction error: {details}`;
766
- }
767
- class SwapVmTapError extends Error {
575
+ class VmNotFoundInFsError extends Error {
768
576
  constructor(body) {
769
577
  super(
770
- `SWAP_VM_TAP: ${body.message}`
578
+ `VM_NOT_FOUND_IN_FS: ${body.message}`
771
579
  );
772
580
  this.body = body;
773
- this.name = "SwapVmTapError";
581
+ this.name = "VmNotFoundInFsError";
774
582
  }
775
- static code = "SWAP_VM_TAP";
776
- static statusCode = 500;
777
- static description = `Failed to swap tap device: {details}`;
583
+ static code = "VM_NOT_FOUND_IN_FS";
584
+ static statusCode = 406;
585
+ static description = `Vm Not found in filesystem`;
778
586
  }
779
- class RootfsCopyErrorError extends Error {
587
+ class VmNotRunningError extends Error {
780
588
  constructor(body) {
781
589
  super(
782
- `ROOTFS_COPY_ERROR: ${body.message}`
590
+ `VM_NOT_RUNNING: ${body.message}`
783
591
  );
784
592
  this.body = body;
785
- this.name = "RootfsCopyErrorError";
593
+ this.name = "VmNotRunningError";
786
594
  }
787
- static code = "ROOTFS_COPY_ERROR";
788
- static statusCode = 500;
789
- static description = `Failed to copy rootfs from {from} to {to}: {details}`;
595
+ static code = "VM_NOT_RUNNING";
596
+ static statusCode = 400;
597
+ static description = `VM is not running: {vm_id}`;
790
598
  }
791
- class PartitionNotFoundError extends Error {
599
+ class VmNotFoundError extends Error {
792
600
  constructor(body) {
793
601
  super(
794
- `PARTITION_NOT_FOUND: ${body.message}`
602
+ `VM_NOT_FOUND: ${body.message}`
795
603
  );
796
604
  this.body = body;
797
- this.name = "PartitionNotFoundError";
605
+ this.name = "VmNotFoundError";
798
606
  }
799
- static code = "PARTITION_NOT_FOUND";
607
+ static code = "VM_NOT_FOUND";
800
608
  static statusCode = 404;
801
- static description = `Partition not found: {partition_id}`;
609
+ static description = `VM not found: {vm_id}`;
802
610
  }
803
- class FileNotFoundError extends Error {
611
+ class InternalForkVmNotFoundError extends Error {
804
612
  constructor(body) {
805
613
  super(
806
- `FILE_NOT_FOUND: ${body.message}`
614
+ `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
807
615
  );
808
616
  this.body = body;
809
- this.name = "FileNotFoundError";
617
+ this.name = "InternalForkVmNotFoundError";
810
618
  }
811
- static code = "FILE_NOT_FOUND";
619
+ static code = "INTERNAL_FORK_VM_NOT_FOUND";
812
620
  static statusCode = 404;
813
- static description = `File not found: {path}`;
621
+ static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
814
622
  }
815
- class FilesBadRequestError extends Error {
623
+ class BadRequestError extends Error {
816
624
  constructor(body) {
817
625
  super(
818
- `FILES_BAD_REQUEST: ${body.message}`
626
+ `BAD_REQUEST: ${body.message}`
819
627
  );
820
628
  this.body = body;
821
- this.name = "FilesBadRequestError";
629
+ this.name = "BadRequestError";
822
630
  }
823
- static code = "FILES_BAD_REQUEST";
631
+ static code = "BAD_REQUEST";
824
632
  static statusCode = 400;
825
633
  static description = `Bad request: {message}`;
826
634
  }
827
- class DatabaseErrorError extends Error {
635
+ class InternalVmNotFoundError extends Error {
828
636
  constructor(body) {
829
637
  super(
830
- `DATABASE_ERROR: ${body.message}`
638
+ `INTERNAL_VM_NOT_FOUND: ${body.message}`
639
+ );
640
+ this.body = body;
641
+ this.name = "InternalVmNotFoundError";
642
+ }
643
+ static code = "INTERNAL_VM_NOT_FOUND";
644
+ static statusCode = 404;
645
+ static description = `VM not found: {vm_id}`;
646
+ }
647
+ class SnapshotNotFoundError extends Error {
648
+ constructor(body) {
649
+ super(
650
+ `SNAPSHOT_NOT_FOUND: ${body.message}`
651
+ );
652
+ this.body = body;
653
+ this.name = "SnapshotNotFoundError";
654
+ }
655
+ static code = "SNAPSHOT_NOT_FOUND";
656
+ static statusCode = 404;
657
+ static description = `Snapshot not found: {snapshot_id}`;
658
+ }
659
+ class ResumedVmNonResponsiveError extends Error {
660
+ constructor(body) {
661
+ super(
662
+ `RESUMED_VM_NON_RESPONSIVE: ${body.message}`
663
+ );
664
+ this.body = body;
665
+ this.name = "ResumedVmNonResponsiveError";
666
+ }
667
+ static code = "RESUMED_VM_NON_RESPONSIVE";
668
+ static statusCode = 500;
669
+ static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
670
+ }
671
+ class SnapshotLoadTimeoutError extends Error {
672
+ constructor(body) {
673
+ super(
674
+ `SNAPSHOT_LOAD_TIMEOUT: ${body.message}`
675
+ );
676
+ this.body = body;
677
+ this.name = "SnapshotLoadTimeoutError";
678
+ }
679
+ static code = "SNAPSHOT_LOAD_TIMEOUT";
680
+ static statusCode = 500;
681
+ static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
682
+ }
683
+ class UffdTimeoutErrorError extends Error {
684
+ constructor(body) {
685
+ super(
686
+ `UFFD_TIMEOUT_ERROR: ${body.message}`
687
+ );
688
+ this.body = body;
689
+ this.name = "UffdTimeoutErrorError";
690
+ }
691
+ static code = "UFFD_TIMEOUT_ERROR";
692
+ static statusCode = 500;
693
+ static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
694
+ }
695
+ class KernelPanicError extends Error {
696
+ constructor(body) {
697
+ super(
698
+ `KERNEL_PANIC: ${body.message}`
699
+ );
700
+ this.body = body;
701
+ this.name = "KernelPanicError";
702
+ }
703
+ static code = "KERNEL_PANIC";
704
+ static statusCode = 500;
705
+ static description = `VM kernel panic detected`;
706
+ }
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
+ class ReqwestError extends Error {
720
+ constructor(body) {
721
+ super(
722
+ `REQWEST: ${body.message}`
723
+ );
724
+ this.body = body;
725
+ this.name = "ReqwestError";
726
+ }
727
+ static code = "REQWEST";
728
+ static statusCode = 500;
729
+ static description = `Reqwest error: {details}`;
730
+ }
731
+ class FirecrackerPidNotFoundError extends Error {
732
+ constructor(body) {
733
+ super(
734
+ `FIRECRACKER_PID_NOT_FOUND: ${body.message}`
735
+ );
736
+ this.body = body;
737
+ this.name = "FirecrackerPidNotFoundError";
738
+ }
739
+ static code = "FIRECRACKER_PID_NOT_FOUND";
740
+ static statusCode = 500;
741
+ static description = `Firecracker PID not found`;
742
+ }
743
+ class FirecrackerApiSocketNotFoundError extends Error {
744
+ constructor(body) {
745
+ super(
746
+ `FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}`
747
+ );
748
+ this.body = body;
749
+ this.name = "FirecrackerApiSocketNotFoundError";
750
+ }
751
+ static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
752
+ static statusCode = 500;
753
+ static description = `Firecracker API socket not found`;
754
+ }
755
+ class InvalidSnapshotIdError extends Error {
756
+ constructor(body) {
757
+ super(
758
+ `INVALID_SNAPSHOT_ID: ${body.message}`
759
+ );
760
+ this.body = body;
761
+ this.name = "InvalidSnapshotIdError";
762
+ }
763
+ static code = "INVALID_SNAPSHOT_ID";
764
+ static statusCode = 400;
765
+ static description = `Invalid snapshot id: {id}`;
766
+ }
767
+ class VmStartTimeoutError extends Error {
768
+ constructor(body) {
769
+ super(
770
+ `VM_START_TIMEOUT: ${body.message}`
771
+ );
772
+ this.body = body;
773
+ this.name = "VmStartTimeoutError";
774
+ }
775
+ static code = "VM_START_TIMEOUT";
776
+ static statusCode = 504;
777
+ static description = `VM did not become ready within the specified timeout`;
778
+ }
779
+ class VmIsSuspendingError extends Error {
780
+ constructor(body) {
781
+ super(
782
+ `VM_IS_SUSPENDING: ${body.message}`
783
+ );
784
+ this.body = body;
785
+ this.name = "VmIsSuspendingError";
786
+ }
787
+ static code = "VM_IS_SUSPENDING";
788
+ static statusCode = 409;
789
+ static description = `VM is currently being suspended`;
790
+ }
791
+ class VmExitDuringStartError extends Error {
792
+ constructor(body) {
793
+ super(
794
+ `VM_EXIT_DURING_START: ${body.message}`
795
+ );
796
+ this.body = body;
797
+ this.name = "VmExitDuringStartError";
798
+ }
799
+ static code = "VM_EXIT_DURING_START";
800
+ static statusCode = 500;
801
+ static description = `VM process exited unexpectedly during start`;
802
+ }
803
+ class VmAccessDeniedError extends Error {
804
+ constructor(body) {
805
+ super(
806
+ `VM_ACCESS_DENIED: ${body.message}`
807
+ );
808
+ this.body = body;
809
+ this.name = "VmAccessDeniedError";
810
+ }
811
+ static code = "VM_ACCESS_DENIED";
812
+ static statusCode = 403;
813
+ static description = `You do not have access to this VM`;
814
+ }
815
+ class FailedToSpawnUffdError extends Error {
816
+ constructor(body) {
817
+ super(
818
+ `FAILED_TO_SPAWN_UFFD: ${body.message}`
819
+ );
820
+ this.body = body;
821
+ this.name = "FailedToSpawnUffdError";
822
+ }
823
+ static code = "FAILED_TO_SPAWN_UFFD";
824
+ static statusCode = 500;
825
+ static description = `Failed to spawn UFFD handler '{daemon_name}'`;
826
+ }
827
+ class VmSpawnProcessError extends Error {
828
+ constructor(body) {
829
+ super(
830
+ `VM_SPAWN_PROCESS: ${body.message}`
831
+ );
832
+ this.body = body;
833
+ this.name = "VmSpawnProcessError";
834
+ }
835
+ static code = "VM_SPAWN_PROCESS";
836
+ static statusCode = 500;
837
+ static description = `Failed to spawn process for VM`;
838
+ }
839
+ class VmSubnetNotFoundError extends Error {
840
+ constructor(body) {
841
+ super(
842
+ `VM_SUBNET_NOT_FOUND: ${body.message}`
843
+ );
844
+ this.body = body;
845
+ this.name = "VmSubnetNotFoundError";
846
+ }
847
+ static code = "VM_SUBNET_NOT_FOUND";
848
+ static statusCode = 500;
849
+ static description = `Subnet for VM not found`;
850
+ }
851
+ class PartitionNotFoundError extends Error {
852
+ constructor(body) {
853
+ super(
854
+ `PARTITION_NOT_FOUND: ${body.message}`
855
+ );
856
+ this.body = body;
857
+ this.name = "PartitionNotFoundError";
858
+ }
859
+ static code = "PARTITION_NOT_FOUND";
860
+ static statusCode = 404;
861
+ static description = `Partition not found: {partition_id}`;
862
+ }
863
+ class ActiveTransactionErrorError extends Error {
864
+ constructor(body) {
865
+ super(
866
+ `ACTIVE_TRANSACTION_ERROR: ${body.message}`
867
+ );
868
+ this.body = body;
869
+ this.name = "ActiveTransactionErrorError";
870
+ }
871
+ static code = "ACTIVE_TRANSACTION_ERROR";
872
+ static statusCode = 500;
873
+ static description = `Active transaction error: {details}`;
874
+ }
875
+ class SwapVmTapError extends Error {
876
+ constructor(body) {
877
+ super(
878
+ `SWAP_VM_TAP: ${body.message}`
879
+ );
880
+ this.body = body;
881
+ this.name = "SwapVmTapError";
882
+ }
883
+ static code = "SWAP_VM_TAP";
884
+ static statusCode = 500;
885
+ static description = `Failed to swap tap device: {details}`;
886
+ }
887
+ class RootfsCopyErrorError extends Error {
888
+ constructor(body) {
889
+ super(
890
+ `ROOTFS_COPY_ERROR: ${body.message}`
891
+ );
892
+ this.body = body;
893
+ this.name = "RootfsCopyErrorError";
894
+ }
895
+ static code = "ROOTFS_COPY_ERROR";
896
+ static statusCode = 500;
897
+ static description = `Failed to copy rootfs from {from} to {to}: {details}`;
898
+ }
899
+ class FileNotFoundError extends Error {
900
+ constructor(body) {
901
+ super(
902
+ `FILE_NOT_FOUND: ${body.message}`
903
+ );
904
+ this.body = body;
905
+ this.name = "FileNotFoundError";
906
+ }
907
+ static code = "FILE_NOT_FOUND";
908
+ static statusCode = 404;
909
+ static description = `File not found: {path}`;
910
+ }
911
+ class FilesBadRequestError extends Error {
912
+ constructor(body) {
913
+ super(
914
+ `FILES_BAD_REQUEST: ${body.message}`
915
+ );
916
+ this.body = body;
917
+ this.name = "FilesBadRequestError";
918
+ }
919
+ static code = "FILES_BAD_REQUEST";
920
+ static statusCode = 400;
921
+ static description = `Bad request: {message}`;
922
+ }
923
+ class SnapshotIsAccountDefaultError extends Error {
924
+ constructor(body) {
925
+ super(
926
+ `SNAPSHOT_IS_ACCOUNT_DEFAULT: ${body.message}`
927
+ );
928
+ this.body = body;
929
+ this.name = "SnapshotIsAccountDefaultError";
930
+ }
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}`;
934
+ }
935
+ class SnapshotAlreadyDeletedError extends Error {
936
+ constructor(body) {
937
+ super(
938
+ `SNAPSHOT_ALREADY_DELETED: ${body.message}`
939
+ );
940
+ this.body = body;
941
+ this.name = "SnapshotAlreadyDeletedError";
942
+ }
943
+ static code = "SNAPSHOT_ALREADY_DELETED";
944
+ static statusCode = 409;
945
+ static description = `Snapshot already deleted: {snapshot_id}`;
946
+ }
947
+ class SuspendFailedAndStopFailedError extends Error {
948
+ constructor(body) {
949
+ super(
950
+ `SUSPEND_FAILED_AND_STOP_FAILED: ${body.message}`
951
+ );
952
+ this.body = body;
953
+ this.name = "SuspendFailedAndStopFailedError";
954
+ }
955
+ static code = "SUSPEND_FAILED_AND_STOP_FAILED";
956
+ static statusCode = 500;
957
+ static description = `Failed to gracefully suspend or stop VM`;
958
+ }
959
+ class SuspendFailedAndStoppedError extends Error {
960
+ constructor(body) {
961
+ super(
962
+ `SUSPEND_FAILED_AND_STOPPED: ${body.message}`
963
+ );
964
+ this.body = body;
965
+ this.name = "SuspendFailedAndStoppedError";
966
+ }
967
+ static code = "SUSPEND_FAILED_AND_STOPPED";
968
+ static statusCode = 500;
969
+ static description = `Failed to gracefully suspend, stopped VM`;
970
+ }
971
+ class DatabaseErrorError extends Error {
972
+ constructor(body) {
973
+ super(
974
+ `DATABASE_ERROR: ${body.message}`
831
975
  );
832
976
  this.body = body;
833
977
  this.name = "DatabaseErrorError";
@@ -848,41 +992,65 @@ class InvalidVmIdError extends Error {
848
992
  static statusCode = 400;
849
993
  static description = `Invalid VM ID: {vm_id}, details: {details}`;
850
994
  }
851
- class VmOperationDeniedDuringTransactionError extends Error {
995
+ class CreateVmMemNotPowerOfTwoError extends Error {
852
996
  constructor(body) {
853
997
  super(
854
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
998
+ `CREATE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}`
855
999
  );
856
1000
  this.body = body;
857
- this.name = "VmOperationDeniedDuringTransactionError";
1001
+ this.name = "CreateVmMemNotPowerOfTwoError";
858
1002
  }
859
- static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
860
- static statusCode = 409;
861
- static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
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)`;
862
1006
  }
863
- class VmTransactionIdMismatchError extends Error {
1007
+ class CreateVmVcpuNotPowerOfTwoError extends Error {
864
1008
  constructor(body) {
865
1009
  super(
866
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
1010
+ `CREATE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}`
867
1011
  );
868
1012
  this.body = body;
869
- this.name = "VmTransactionIdMismatchError";
1013
+ this.name = "CreateVmVcpuNotPowerOfTwoError";
870
1014
  }
871
- static code = "VM_TRANSACTION_ID_MISMATCH";
1015
+ static code = "CREATE_VM_VCPU_NOT_POWER_OF_TWO";
872
1016
  static statusCode = 400;
873
- static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
1017
+ static description = `vcpuCount must be a power of two (got {got})`;
874
1018
  }
875
- class VmNotInTransactionError extends Error {
1019
+ class CreateVmRootfsOutOfRangeError extends Error {
876
1020
  constructor(body) {
877
1021
  super(
878
- `VM_NOT_IN_TRANSACTION: ${body.message}`
1022
+ `CREATE_VM_ROOTFS_OUT_OF_RANGE: ${body.message}`
879
1023
  );
880
1024
  this.body = body;
881
- this.name = "VmNotInTransactionError";
1025
+ this.name = "CreateVmRootfsOutOfRangeError";
882
1026
  }
883
- static code = "VM_NOT_IN_TRANSACTION";
884
- static statusCode = 404;
885
- static description = `VM not in a transaction: {vm_id}`;
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})`;
886
1054
  }
887
1055
  class CreateVmBadRequestError extends Error {
888
1056
  constructor(body) {
@@ -1220,77 +1388,101 @@ class ExpiredError extends Error {
1220
1388
  static statusCode = 403;
1221
1389
  static description = `Session has expired`;
1222
1390
  }
1223
- class BranchNotFoundError extends Error {
1391
+ class UnauthorizedError extends Error {
1224
1392
  constructor(body) {
1225
1393
  super(
1226
- `BRANCH_NOT_FOUND: ${body.message}`
1394
+ `UNAUTHORIZED: ${body.message}`
1227
1395
  );
1228
1396
  this.body = body;
1229
- this.name = "BranchNotFoundError";
1397
+ this.name = "UnauthorizedError";
1230
1398
  }
1231
- static code = "BRANCH_NOT_FOUND";
1232
- static statusCode = 404;
1233
- static description = `Branch not found: {branch}`;
1399
+ static code = "UNAUTHORIZED";
1400
+ static statusCode = 401;
1401
+ static description = `Unauthorized: admin key and account id are required`;
1234
1402
  }
1235
- class BranchAlreadyExistsError extends Error {
1403
+ class ForbiddenError extends Error {
1236
1404
  constructor(body) {
1237
1405
  super(
1238
- `BRANCH_ALREADY_EXISTS: ${body.message}`
1406
+ `FORBIDDEN: ${body.message}`
1239
1407
  );
1240
1408
  this.body = body;
1241
- this.name = "BranchAlreadyExistsError";
1409
+ this.name = "ForbiddenError";
1242
1410
  }
1243
- static code = "BRANCH_ALREADY_EXISTS";
1244
- static statusCode = 409;
1245
- static description = `Branch already exists: {branch}`;
1411
+ static code = "FORBIDDEN";
1412
+ static statusCode = 403;
1413
+ static description = `Forbidden`;
1246
1414
  }
1247
- class NoDefaultBranchError extends Error {
1415
+ class InvalidAccountIdError extends Error {
1248
1416
  constructor(body) {
1249
1417
  super(
1250
- `NO_DEFAULT_BRANCH: ${body.message}`
1418
+ `INVALID_ACCOUNT_ID: ${body.message}`
1251
1419
  );
1252
1420
  this.body = body;
1253
- this.name = "NoDefaultBranchError";
1421
+ this.name = "InvalidAccountIdError";
1254
1422
  }
1255
- static code = "NO_DEFAULT_BRANCH";
1256
- static statusCode = 404;
1257
- static description = `Repository has no default branch configured`;
1423
+ static code = "INVALID_ACCOUNT_ID";
1424
+ static statusCode = 400;
1425
+ static description = `Invalid account ID: {account_id}`;
1258
1426
  }
1259
- class CommitNotFoundError extends Error {
1427
+ class SourceImportConflictError extends Error {
1260
1428
  constructor(body) {
1261
1429
  super(
1262
- `COMMIT_NOT_FOUND: ${body.message}`
1430
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
1263
1431
  );
1264
1432
  this.body = body;
1265
- this.name = "CommitNotFoundError";
1433
+ this.name = "SourceImportConflictError";
1266
1434
  }
1267
- static code = "COMMIT_NOT_FOUND";
1268
- static statusCode = 404;
1269
- static description = `Commit not found: {sha}`;
1435
+ static code = "SOURCE_IMPORT_CONFLICT";
1436
+ static statusCode = 400;
1437
+ static description = `Source and import are mutually exclusive`;
1270
1438
  }
1271
- class ParentNotFoundError extends Error {
1439
+ class SourceUnauthorizedError extends Error {
1272
1440
  constructor(body) {
1273
1441
  super(
1274
- `PARENT_NOT_FOUND: ${body.message}`
1442
+ `SOURCE_UNAUTHORIZED: ${body.message}`
1275
1443
  );
1276
1444
  this.body = body;
1277
- this.name = "ParentNotFoundError";
1445
+ this.name = "SourceUnauthorizedError";
1278
1446
  }
1279
- static code = "PARENT_NOT_FOUND";
1280
- static statusCode = 404;
1281
- static description = `Parent commit not found: {sha}`;
1447
+ static code = "SOURCE_UNAUTHORIZED";
1448
+ static statusCode = 400;
1449
+ static description = `Unauthorized to access source repository at {url}`;
1282
1450
  }
1283
- class TreeNotFoundError extends Error {
1451
+ class SourceNotFoundError extends Error {
1284
1452
  constructor(body) {
1285
1453
  super(
1286
- `TREE_NOT_FOUND: ${body.message}`
1454
+ `SOURCE_NOT_FOUND: ${body.message}`
1287
1455
  );
1288
1456
  this.body = body;
1289
- this.name = "TreeNotFoundError";
1457
+ this.name = "SourceNotFoundError";
1290
1458
  }
1291
- static code = "TREE_NOT_FOUND";
1292
- static statusCode = 404;
1293
- static description = `Tree not found: {sha}`;
1459
+ static code = "SOURCE_NOT_FOUND";
1460
+ static statusCode = 400;
1461
+ static description = `Source repository not found at {url}`;
1462
+ }
1463
+ class ImportSubdirNotFoundError extends Error {
1464
+ constructor(body) {
1465
+ super(
1466
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1467
+ );
1468
+ this.body = body;
1469
+ this.name = "ImportSubdirNotFoundError";
1470
+ }
1471
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1472
+ static statusCode = 400;
1473
+ static description = `Directory not found in {source}: {dir}`;
1474
+ }
1475
+ class RepoAlreadyExistsError extends Error {
1476
+ constructor(body) {
1477
+ super(
1478
+ `REPO_ALREADY_EXISTS: ${body.message}`
1479
+ );
1480
+ this.body = body;
1481
+ this.name = "RepoAlreadyExistsError";
1482
+ }
1483
+ static code = "REPO_ALREADY_EXISTS";
1484
+ static statusCode = 409;
1485
+ static description = `Repo '{repo_id}' already exists`;
1294
1486
  }
1295
1487
  class PackfileError extends Error {
1296
1488
  constructor(body) {
@@ -1304,41 +1496,77 @@ class PackfileError extends Error {
1304
1496
  static statusCode = 500;
1305
1497
  static description = `Error building packfile`;
1306
1498
  }
1307
- class InvalidRevisionError extends Error {
1499
+ class UnsupportedTransferError extends Error {
1308
1500
  constructor(body) {
1309
1501
  super(
1310
- `INVALID_REVISION: ${body.message}`
1502
+ `UNSUPPORTED_TRANSFER: ${body.message}`
1311
1503
  );
1312
1504
  this.body = body;
1313
- this.name = "InvalidRevisionError";
1505
+ this.name = "UnsupportedTransferError";
1314
1506
  }
1315
- static code = "INVALID_REVISION";
1507
+ static code = "UNSUPPORTED_TRANSFER";
1316
1508
  static statusCode = 400;
1317
- static description = `Invalid revision: {revision}`;
1509
+ static description = `Unsupported LFS transfer protocol(s)`;
1318
1510
  }
1319
- class ForbiddenError extends Error {
1511
+ class BranchNotFoundError extends Error {
1320
1512
  constructor(body) {
1321
1513
  super(
1322
- `FORBIDDEN: ${body.message}`
1514
+ `BRANCH_NOT_FOUND: ${body.message}`
1323
1515
  );
1324
1516
  this.body = body;
1325
- this.name = "ForbiddenError";
1517
+ this.name = "BranchNotFoundError";
1326
1518
  }
1327
- static code = "FORBIDDEN";
1328
- static statusCode = 403;
1329
- static description = `Forbidden`;
1519
+ static code = "BRANCH_NOT_FOUND";
1520
+ static statusCode = 404;
1521
+ static description = `Branch not found: {branch}`;
1330
1522
  }
1331
- class UnauthorizedError extends Error {
1523
+ class NotFoundError extends Error {
1332
1524
  constructor(body) {
1333
1525
  super(
1334
- `UNAUTHORIZED: ${body.message}`
1526
+ `NOT_FOUND: ${body.message}`
1335
1527
  );
1336
1528
  this.body = body;
1337
- this.name = "UnauthorizedError";
1529
+ this.name = "NotFoundError";
1338
1530
  }
1339
- static code = "UNAUTHORIZED";
1340
- static statusCode = 401;
1341
- static description = `Unauthorized`;
1531
+ static code = "NOT_FOUND";
1532
+ static statusCode = 404;
1533
+ static description = `Repository not found`;
1534
+ }
1535
+ class SendErrorError extends Error {
1536
+ constructor(body) {
1537
+ super(
1538
+ `SEND_ERROR: ${body.message}`
1539
+ );
1540
+ this.body = body;
1541
+ this.name = "SendErrorError";
1542
+ }
1543
+ static code = "SEND_ERROR";
1544
+ static statusCode = 500;
1545
+ static description = `Stream receiver dropped`;
1546
+ }
1547
+ class InvalidRevisionError extends Error {
1548
+ constructor(body) {
1549
+ super(
1550
+ `INVALID_REVISION: ${body.message}`
1551
+ );
1552
+ this.body = body;
1553
+ this.name = "InvalidRevisionError";
1554
+ }
1555
+ static code = "INVALID_REVISION";
1556
+ static statusCode = 400;
1557
+ static description = `Invalid revision: {revision}`;
1558
+ }
1559
+ class CommitNotFoundError extends Error {
1560
+ constructor(body) {
1561
+ super(
1562
+ `COMMIT_NOT_FOUND: ${body.message}`
1563
+ );
1564
+ this.body = body;
1565
+ this.name = "CommitNotFoundError";
1566
+ }
1567
+ static code = "COMMIT_NOT_FOUND";
1568
+ static statusCode = 404;
1569
+ static description = `Commit not found: {sha}`;
1342
1570
  }
1343
1571
  class PathNotFoundError extends Error {
1344
1572
  constructor(body) {
@@ -1364,41 +1592,29 @@ class ReferenceNotFoundError extends Error {
1364
1592
  static statusCode = 404;
1365
1593
  static description = `Reference not found: {reference}`;
1366
1594
  }
1367
- class AmbiguousError extends Error {
1368
- constructor(body) {
1369
- super(
1370
- `AMBIGUOUS: ${body.message}`
1371
- );
1372
- this.body = body;
1373
- this.name = "AmbiguousError";
1374
- }
1375
- static code = "AMBIGUOUS";
1376
- static statusCode = 400;
1377
- static description = `rev is ambiguous: {rev}`;
1378
- }
1379
- class NotFoundError extends Error {
1595
+ class InvalidServiceError extends Error {
1380
1596
  constructor(body) {
1381
1597
  super(
1382
- `NOT_FOUND: ${body.message}`
1598
+ `INVALID_SERVICE: ${body.message}`
1383
1599
  );
1384
1600
  this.body = body;
1385
- this.name = "NotFoundError";
1601
+ this.name = "InvalidServiceError";
1386
1602
  }
1387
- static code = "NOT_FOUND";
1388
- static statusCode = 404;
1389
- static description = `rev not found: {rev}`;
1603
+ static code = "INVALID_SERVICE";
1604
+ static statusCode = 403;
1605
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1390
1606
  }
1391
- class InvalidError extends Error {
1607
+ class ExpectedServiceError extends Error {
1392
1608
  constructor(body) {
1393
1609
  super(
1394
- `INVALID: ${body.message}`
1610
+ `EXPECTED_SERVICE: ${body.message}`
1395
1611
  );
1396
1612
  this.body = body;
1397
- this.name = "InvalidError";
1613
+ this.name = "ExpectedServiceError";
1398
1614
  }
1399
- static code = "INVALID";
1400
- static statusCode = 400;
1401
- static description = `invalid rev syntax: {rev}`;
1615
+ static code = "EXPECTED_SERVICE";
1616
+ static statusCode = 403;
1617
+ static description = `Expected 'service' query parameter`;
1402
1618
  }
1403
1619
  class DiffInvalidPathPatternError extends Error {
1404
1620
  constructor(body) {
@@ -1532,6 +1748,18 @@ class ConflictError extends Error {
1532
1748
  static statusCode = 409;
1533
1749
  static description = `Sync conflict: {message}`;
1534
1750
  }
1751
+ class NoDefaultBranchError extends Error {
1752
+ constructor(body) {
1753
+ super(
1754
+ `NO_DEFAULT_BRANCH: ${body.message}`
1755
+ );
1756
+ this.body = body;
1757
+ this.name = "NoDefaultBranchError";
1758
+ }
1759
+ static code = "NO_DEFAULT_BRANCH";
1760
+ static statusCode = 404;
1761
+ static description = `Repository has no default branch configured`;
1762
+ }
1535
1763
  class InvalidBase64ContentError extends Error {
1536
1764
  constructor(body) {
1537
1765
  super(
@@ -1580,89 +1808,53 @@ class ConflictingParentError extends Error {
1580
1808
  static statusCode = 409;
1581
1809
  static description = `Conflict: expected parent SHA {expected} but current is {actual:?}`;
1582
1810
  }
1583
- class InvalidAccountIdError extends Error {
1584
- constructor(body) {
1585
- super(
1586
- `INVALID_ACCOUNT_ID: ${body.message}`
1587
- );
1588
- this.body = body;
1589
- this.name = "InvalidAccountIdError";
1590
- }
1591
- static code = "INVALID_ACCOUNT_ID";
1592
- static statusCode = 400;
1593
- static description = `Invalid account ID: {account_id}`;
1594
- }
1595
- class SourceImportConflictError extends Error {
1596
- constructor(body) {
1597
- super(
1598
- `SOURCE_IMPORT_CONFLICT: ${body.message}`
1599
- );
1600
- this.body = body;
1601
- this.name = "SourceImportConflictError";
1602
- }
1603
- static code = "SOURCE_IMPORT_CONFLICT";
1604
- static statusCode = 400;
1605
- static description = `Source and import are mutually exclusive`;
1606
- }
1607
- class SourceUnauthorizedError extends Error {
1608
- constructor(body) {
1609
- super(
1610
- `SOURCE_UNAUTHORIZED: ${body.message}`
1611
- );
1612
- this.body = body;
1613
- this.name = "SourceUnauthorizedError";
1614
- }
1615
- static code = "SOURCE_UNAUTHORIZED";
1616
- static statusCode = 400;
1617
- static description = `Unauthorized to access source repository at {url}`;
1618
- }
1619
- class SourceNotFoundError extends Error {
1811
+ class TreeNotFoundError extends Error {
1620
1812
  constructor(body) {
1621
1813
  super(
1622
- `SOURCE_NOT_FOUND: ${body.message}`
1814
+ `TREE_NOT_FOUND: ${body.message}`
1623
1815
  );
1624
1816
  this.body = body;
1625
- this.name = "SourceNotFoundError";
1817
+ this.name = "TreeNotFoundError";
1626
1818
  }
1627
- static code = "SOURCE_NOT_FOUND";
1628
- static statusCode = 400;
1629
- static description = `Source repository not found at {url}`;
1819
+ static code = "TREE_NOT_FOUND";
1820
+ static statusCode = 404;
1821
+ static description = `Tree not found: {hash}`;
1630
1822
  }
1631
- class ImportSubdirNotFoundError extends Error {
1823
+ class BranchAlreadyExistsError extends Error {
1632
1824
  constructor(body) {
1633
1825
  super(
1634
- `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1826
+ `BRANCH_ALREADY_EXISTS: ${body.message}`
1635
1827
  );
1636
1828
  this.body = body;
1637
- this.name = "ImportSubdirNotFoundError";
1829
+ this.name = "BranchAlreadyExistsError";
1638
1830
  }
1639
- static code = "IMPORT_SUBDIR_NOT_FOUND";
1640
- static statusCode = 400;
1641
- static description = `Directory not found in {source}: {dir}`;
1831
+ static code = "BRANCH_ALREADY_EXISTS";
1832
+ static statusCode = 409;
1833
+ static description = `Branch already exists: {branch}`;
1642
1834
  }
1643
- class RepoAlreadyExistsError extends Error {
1835
+ class ParentNotFoundError extends Error {
1644
1836
  constructor(body) {
1645
1837
  super(
1646
- `REPO_ALREADY_EXISTS: ${body.message}`
1838
+ `PARENT_NOT_FOUND: ${body.message}`
1647
1839
  );
1648
1840
  this.body = body;
1649
- this.name = "RepoAlreadyExistsError";
1841
+ this.name = "ParentNotFoundError";
1650
1842
  }
1651
- static code = "REPO_ALREADY_EXISTS";
1652
- static statusCode = 409;
1653
- static description = `Repo '{repo_id}' already exists`;
1843
+ static code = "PARENT_NOT_FOUND";
1844
+ static statusCode = 404;
1845
+ static description = `Parent commit not found: {sha}`;
1654
1846
  }
1655
- class SendErrorError extends Error {
1847
+ class TagNotFoundError extends Error {
1656
1848
  constructor(body) {
1657
1849
  super(
1658
- `SEND_ERROR: ${body.message}`
1850
+ `TAG_NOT_FOUND: ${body.message}`
1659
1851
  );
1660
1852
  this.body = body;
1661
- this.name = "SendErrorError";
1853
+ this.name = "TagNotFoundError";
1662
1854
  }
1663
- static code = "SEND_ERROR";
1664
- static statusCode = 500;
1665
- static description = `Stream receiver dropped`;
1855
+ static code = "TAG_NOT_FOUND";
1856
+ static statusCode = 404;
1857
+ static description = `Tag not found: {hash}`;
1666
1858
  }
1667
1859
  class InvalidRangeError extends Error {
1668
1860
  constructor(body) {
@@ -1700,41 +1892,41 @@ class CommitNotInBranchError extends Error {
1700
1892
  static statusCode = 400;
1701
1893
  static description = `Commit {sha} is not in the history of branch {branch}`;
1702
1894
  }
1703
- class TagNotFoundError extends Error {
1895
+ class BlobNotFoundError extends Error {
1704
1896
  constructor(body) {
1705
1897
  super(
1706
- `TAG_NOT_FOUND: ${body.message}`
1898
+ `BLOB_NOT_FOUND: ${body.message}`
1707
1899
  );
1708
1900
  this.body = body;
1709
- this.name = "TagNotFoundError";
1901
+ this.name = "BlobNotFoundError";
1710
1902
  }
1711
- static code = "TAG_NOT_FOUND";
1903
+ static code = "BLOB_NOT_FOUND";
1712
1904
  static statusCode = 404;
1713
- static description = `Tag not found: {hash}`;
1905
+ static description = `Blob not found: {hash}`;
1714
1906
  }
1715
- class InvalidServiceError extends Error {
1907
+ class AmbiguousError extends Error {
1716
1908
  constructor(body) {
1717
1909
  super(
1718
- `INVALID_SERVICE: ${body.message}`
1910
+ `AMBIGUOUS: ${body.message}`
1719
1911
  );
1720
1912
  this.body = body;
1721
- this.name = "InvalidServiceError";
1913
+ this.name = "AmbiguousError";
1722
1914
  }
1723
- static code = "INVALID_SERVICE";
1724
- static statusCode = 403;
1725
- static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1915
+ static code = "AMBIGUOUS";
1916
+ static statusCode = 400;
1917
+ static description = `rev is ambiguous: {rev}`;
1726
1918
  }
1727
- class ExpectedServiceError extends Error {
1919
+ class InvalidError extends Error {
1728
1920
  constructor(body) {
1729
1921
  super(
1730
- `EXPECTED_SERVICE: ${body.message}`
1922
+ `INVALID: ${body.message}`
1731
1923
  );
1732
1924
  this.body = body;
1733
- this.name = "ExpectedServiceError";
1925
+ this.name = "InvalidError";
1734
1926
  }
1735
- static code = "EXPECTED_SERVICE";
1736
- static statusCode = 403;
1737
- static description = `Expected 'service' query parameter`;
1927
+ static code = "INVALID";
1928
+ static statusCode = 400;
1929
+ static description = `invalid rev syntax: {rev}`;
1738
1930
  }
1739
1931
  class GitHubSyncConflictError extends Error {
1740
1932
  constructor(body) {
@@ -1760,30 +1952,6 @@ class InvalidObjectIdError extends Error {
1760
1952
  static statusCode = 400;
1761
1953
  static description = `Invalid object ID: {hash}`;
1762
1954
  }
1763
- class UnsupportedTransferError extends Error {
1764
- constructor(body) {
1765
- super(
1766
- `UNSUPPORTED_TRANSFER: ${body.message}`
1767
- );
1768
- this.body = body;
1769
- this.name = "UnsupportedTransferError";
1770
- }
1771
- static code = "UNSUPPORTED_TRANSFER";
1772
- static statusCode = 400;
1773
- static description = `Unsupported LFS transfer protocol(s)`;
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
1955
  class UnavailableError extends Error {
1788
1956
  constructor(body) {
1789
1957
  super(
@@ -1832,1498 +2000,1546 @@ class ExecuteLimitExceededError extends Error {
1832
2000
  static statusCode = 403;
1833
2001
  static description = `Execute runs limit exceeded: your plan allows {limit} runs per month, you have used {current}`;
1834
2002
  }
1835
- class AccessDeniedError extends Error {
2003
+ class PermissionAlreadyExistsError extends Error {
1836
2004
  constructor(body) {
1837
2005
  super(
1838
- `ACCESS_DENIED: ${body.message}`
2006
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
1839
2007
  );
1840
2008
  this.body = body;
1841
- this.name = "AccessDeniedError";
2009
+ this.name = "PermissionAlreadyExistsError";
1842
2010
  }
1843
- static code = "ACCESS_DENIED";
1844
- static statusCode = 403;
1845
- static description = `VM access denied`;
2011
+ static code = "PERMISSION_ALREADY_EXISTS";
2012
+ static statusCode = 409;
2013
+ static description = `Permission already exists`;
1846
2014
  }
1847
- class CloudstateInternalErrorError extends Error {
2015
+ class ListTokensFailedError extends Error {
1848
2016
  constructor(body) {
1849
2017
  super(
1850
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2018
+ `LIST_TOKENS_FAILED: ${body.message}`
1851
2019
  );
1852
2020
  this.body = body;
1853
- this.name = "CloudstateInternalErrorError";
2021
+ this.name = "ListTokensFailedError";
1854
2022
  }
1855
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2023
+ static code = "LIST_TOKENS_FAILED";
1856
2024
  static statusCode = 500;
1857
- static description = `Internal error: {message}`;
2025
+ static description = `Failed to list tokens: {message}`;
1858
2026
  }
1859
- class CloudstateDatabaseErrorError extends Error {
2027
+ class RevokeTokenFailedError extends Error {
1860
2028
  constructor(body) {
1861
2029
  super(
1862
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2030
+ `REVOKE_TOKEN_FAILED: ${body.message}`
1863
2031
  );
1864
2032
  this.body = body;
1865
- this.name = "CloudstateDatabaseErrorError";
2033
+ this.name = "RevokeTokenFailedError";
1866
2034
  }
1867
- static code = "CLOUDSTATE_DATABASE_ERROR";
2035
+ static code = "REVOKE_TOKEN_FAILED";
1868
2036
  static statusCode = 500;
1869
- static description = `Database operation failed: {message}`;
2037
+ static description = `Failed to revoke token: {message}`;
1870
2038
  }
1871
- class CloudstateAccessDeniedError extends Error {
2039
+ class CreateTokenFailedError extends Error {
1872
2040
  constructor(body) {
1873
2041
  super(
1874
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2042
+ `CREATE_TOKEN_FAILED: ${body.message}`
1875
2043
  );
1876
2044
  this.body = body;
1877
- this.name = "CloudstateAccessDeniedError";
2045
+ this.name = "CreateTokenFailedError";
1878
2046
  }
1879
- static code = "CLOUDSTATE_ACCESS_DENIED";
1880
- static statusCode = 403;
1881
- static description = `Access denied to project: {project_id}`;
2047
+ static code = "CREATE_TOKEN_FAILED";
2048
+ static statusCode = 500;
2049
+ static description = `Failed to create token: {message}`;
1882
2050
  }
1883
- class RestoreFailedError extends Error {
2051
+ class ListPermissionsFailedError extends Error {
1884
2052
  constructor(body) {
1885
2053
  super(
1886
- `RESTORE_FAILED: ${body.message}`
2054
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
1887
2055
  );
1888
2056
  this.body = body;
1889
- this.name = "RestoreFailedError";
2057
+ this.name = "ListPermissionsFailedError";
1890
2058
  }
1891
- static code = "RESTORE_FAILED";
2059
+ static code = "LIST_PERMISSIONS_FAILED";
1892
2060
  static statusCode = 500;
1893
- static description = `Failed to restore from backup: {message}`;
2061
+ static description = `Failed to list permissions: {message}`;
1894
2062
  }
1895
- class CreateBackupFailedError extends Error {
2063
+ class GetPermissionFailedError extends Error {
1896
2064
  constructor(body) {
1897
2065
  super(
1898
- `CREATE_BACKUP_FAILED: ${body.message}`
2066
+ `GET_PERMISSION_FAILED: ${body.message}`
1899
2067
  );
1900
2068
  this.body = body;
1901
- this.name = "CreateBackupFailedError";
2069
+ this.name = "GetPermissionFailedError";
1902
2070
  }
1903
- static code = "CREATE_BACKUP_FAILED";
2071
+ static code = "GET_PERMISSION_FAILED";
1904
2072
  static statusCode = 500;
1905
- static description = `Failed to create backup: {message}`;
2073
+ static description = `Failed to get permission: {message}`;
1906
2074
  }
1907
- class BackupFailedError extends Error {
2075
+ class UpdatePermissionFailedError extends Error {
1908
2076
  constructor(body) {
1909
2077
  super(
1910
- `BACKUP_FAILED: ${body.message}`
2078
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
1911
2079
  );
1912
2080
  this.body = body;
1913
- this.name = "BackupFailedError";
2081
+ this.name = "UpdatePermissionFailedError";
1914
2082
  }
1915
- static code = "BACKUP_FAILED";
2083
+ static code = "UPDATE_PERMISSION_FAILED";
1916
2084
  static statusCode = 500;
1917
- static description = `Backup failed: {message}`;
2085
+ static description = `Failed to update permission: {message}`;
1918
2086
  }
1919
- class DeploymentFailedError extends Error {
2087
+ class RevokePermissionFailedError extends Error {
1920
2088
  constructor(body) {
1921
2089
  super(
1922
- `DEPLOYMENT_FAILED: ${body.message}`
2090
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
1923
2091
  );
1924
2092
  this.body = body;
1925
- this.name = "DeploymentFailedError";
2093
+ this.name = "RevokePermissionFailedError";
1926
2094
  }
1927
- static code = "DEPLOYMENT_FAILED";
2095
+ static code = "REVOKE_PERMISSION_FAILED";
1928
2096
  static statusCode = 500;
1929
- static description = `Deployment failed: {message}`;
2097
+ static description = `Failed to revoke permission: {message}`;
1930
2098
  }
1931
- class InvalidDeploymentRequestError extends Error {
2099
+ class GrantPermissionFailedError extends Error {
1932
2100
  constructor(body) {
1933
2101
  super(
1934
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2102
+ `GRANT_PERMISSION_FAILED: ${body.message}`
1935
2103
  );
1936
2104
  this.body = body;
1937
- this.name = "InvalidDeploymentRequestError";
2105
+ this.name = "GrantPermissionFailedError";
2106
+ }
2107
+ static code = "GRANT_PERMISSION_FAILED";
2108
+ static statusCode = 500;
2109
+ static description = `Failed to grant permission: {message}`;
2110
+ }
2111
+ class ListIdentitiesFailedError extends Error {
2112
+ constructor(body) {
2113
+ super(
2114
+ `LIST_IDENTITIES_FAILED: ${body.message}`
2115
+ );
2116
+ this.body = body;
2117
+ this.name = "ListIdentitiesFailedError";
2118
+ }
2119
+ static code = "LIST_IDENTITIES_FAILED";
2120
+ static statusCode = 500;
2121
+ static description = `Failed to list identities: {message}`;
2122
+ }
2123
+ class DeleteIdentityFailedError extends Error {
2124
+ constructor(body) {
2125
+ super(
2126
+ `DELETE_IDENTITY_FAILED: ${body.message}`
2127
+ );
2128
+ this.body = body;
2129
+ this.name = "DeleteIdentityFailedError";
2130
+ }
2131
+ static code = "DELETE_IDENTITY_FAILED";
2132
+ static statusCode = 500;
2133
+ static description = `Failed to delete identity: {message}`;
2134
+ }
2135
+ class CreateIdentityFailedError extends Error {
2136
+ constructor(body) {
2137
+ super(
2138
+ `CREATE_IDENTITY_FAILED: ${body.message}`
2139
+ );
2140
+ this.body = body;
2141
+ this.name = "CreateIdentityFailedError";
2142
+ }
2143
+ static code = "CREATE_IDENTITY_FAILED";
2144
+ 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`;
2158
+ }
2159
+ class PermissionNotFoundError extends Error {
2160
+ constructor(body) {
2161
+ super(
2162
+ `PERMISSION_NOT_FOUND: ${body.message}`
2163
+ );
2164
+ this.body = body;
2165
+ this.name = "PermissionNotFoundError";
2166
+ }
2167
+ static code = "PERMISSION_NOT_FOUND";
2168
+ static statusCode = 404;
2169
+ static description = `Permission not found`;
2170
+ }
2171
+ class GitRepositoryAccessDeniedError extends Error {
2172
+ constructor(body) {
2173
+ super(
2174
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2175
+ );
2176
+ this.body = body;
2177
+ this.name = "GitRepositoryAccessDeniedError";
1938
2178
  }
1939
- static code = "INVALID_DEPLOYMENT_REQUEST";
1940
- static statusCode = 400;
1941
- static description = `Invalid deployment request: {message}`;
2179
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
2180
+ static statusCode = 403;
2181
+ static description = `You are not allowed to access this repository`;
1942
2182
  }
1943
- class ProjectNotFoundError extends Error {
2183
+ class GitRepositoryNotFoundError extends Error {
1944
2184
  constructor(body) {
1945
2185
  super(
1946
- `PROJECT_NOT_FOUND: ${body.message}`
2186
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
1947
2187
  );
1948
2188
  this.body = body;
1949
- this.name = "ProjectNotFoundError";
2189
+ this.name = "GitRepositoryNotFoundError";
1950
2190
  }
1951
- static code = "PROJECT_NOT_FOUND";
2191
+ static code = "GIT_REPOSITORY_NOT_FOUND";
1952
2192
  static statusCode = 404;
1953
- static description = `Project not found: {project_id}`;
2193
+ static description = `Repository not found`;
1954
2194
  }
1955
- class BuildFailedError extends Error {
2195
+ class CannotDeleteManagedIdentityError extends Error {
1956
2196
  constructor(body) {
1957
2197
  super(
1958
- `BUILD_FAILED: ${body.message}`
2198
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
1959
2199
  );
1960
2200
  this.body = body;
1961
- this.name = "BuildFailedError";
2201
+ this.name = "CannotDeleteManagedIdentityError";
1962
2202
  }
1963
- static code = "BUILD_FAILED";
1964
- static statusCode = 500;
1965
- static description = `Build failed on VM {vm_id}`;
2203
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2204
+ static statusCode = 403;
2205
+ static description = `Cannot delete managed identities`;
1966
2206
  }
1967
- class ServerDeploymentFailedError extends Error {
2207
+ class CannotModifyManagedIdentityError extends Error {
1968
2208
  constructor(body) {
1969
2209
  super(
1970
- `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2210
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
1971
2211
  );
1972
2212
  this.body = body;
1973
- this.name = "ServerDeploymentFailedError";
2213
+ this.name = "CannotModifyManagedIdentityError";
1974
2214
  }
1975
- static code = "SERVER_DEPLOYMENT_FAILED";
1976
- static statusCode = 502;
1977
- static description = `Failed to deploy to servers`;
2215
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2216
+ static statusCode = 403;
2217
+ static description = `Cannot modify managed identities`;
1978
2218
  }
1979
- class LockfileErrorError extends Error {
2219
+ class IdentityAccessDeniedError extends Error {
1980
2220
  constructor(body) {
1981
2221
  super(
1982
- `LOCKFILE_ERROR: ${body.message}`
2222
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
1983
2223
  );
1984
2224
  this.body = body;
1985
- this.name = "LockfileErrorError";
2225
+ this.name = "IdentityAccessDeniedError";
1986
2226
  }
1987
- static code = "LOCKFILE_ERROR";
1988
- static statusCode = 500;
1989
- static description = `Failed to generate dependency lockfile: {message}`;
2227
+ static code = "IDENTITY_ACCESS_DENIED";
2228
+ static statusCode = 403;
2229
+ static description = `You are not allowed to access this identity`;
1990
2230
  }
1991
- class UploadErrorError extends Error {
2231
+ class IdentityNotFoundError extends Error {
1992
2232
  constructor(body) {
1993
2233
  super(
1994
- `UPLOAD_ERROR: ${body.message}`
2234
+ `IDENTITY_NOT_FOUND: ${body.message}`
1995
2235
  );
1996
2236
  this.body = body;
1997
- this.name = "UploadErrorError";
2237
+ this.name = "IdentityNotFoundError";
1998
2238
  }
1999
- static code = "UPLOAD_ERROR";
2000
- static statusCode = 500;
2001
- static description = `Failed to upload deployment to storage`;
2239
+ static code = "IDENTITY_NOT_FOUND";
2240
+ static statusCode = 404;
2241
+ static description = `Identity not found`;
2002
2242
  }
2003
- class DomainMappingErrorError extends Error {
2243
+ class UnauthorizedErrorError extends Error {
2004
2244
  constructor(body) {
2005
2245
  super(
2006
- `DOMAIN_MAPPING_ERROR: ${body.message}`
2246
+ `UNAUTHORIZED_ERROR: ${body.message}`
2007
2247
  );
2008
2248
  this.body = body;
2009
- this.name = "DomainMappingErrorError";
2249
+ this.name = "UnauthorizedErrorError";
2010
2250
  }
2011
- static code = "DOMAIN_MAPPING_ERROR";
2012
- static statusCode = 500;
2013
- static description = `Failed to configure domain mapping for: {domain}`;
2251
+ static code = "UNAUTHORIZED_ERROR";
2252
+ static statusCode = 401;
2253
+ static description = `Unauthorized request to {route}`;
2014
2254
  }
2015
- class CertificateProvisioningErrorError extends Error {
2255
+ class LimitExceededError extends Error {
2016
2256
  constructor(body) {
2017
2257
  super(
2018
- `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2258
+ `LIMIT_EXCEEDED: ${body.message}`
2019
2259
  );
2020
2260
  this.body = body;
2021
- this.name = "CertificateProvisioningErrorError";
2261
+ this.name = "LimitExceededError";
2022
2262
  }
2023
- static code = "CERTIFICATE_PROVISIONING_ERROR";
2024
- static statusCode = 502;
2025
- static description = `Failed to provision certificate for domain: {domain}`;
2263
+ static code = "LIMIT_EXCEEDED";
2264
+ static statusCode = 403;
2265
+ static description = `Managed domains limit exceeded: your plan allows {limit} verified domains, you have {current}`;
2026
2266
  }
2027
- class NoEntrypointFoundError extends Error {
2267
+ class FailedToProvisionCertificateError extends Error {
2028
2268
  constructor(body) {
2029
2269
  super(
2030
- `NO_ENTRYPOINT_FOUND: ${body.message}`
2270
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2031
2271
  );
2032
2272
  this.body = body;
2033
- this.name = "NoEntrypointFoundError";
2273
+ this.name = "FailedToProvisionCertificateError";
2034
2274
  }
2035
- static code = "NO_ENTRYPOINT_FOUND";
2036
- static statusCode = 400;
2037
- static description = `No entrypoint found in deployment`;
2275
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
2276
+ static statusCode = 422;
2277
+ static description = `Failed to provision certificate: {message}`;
2038
2278
  }
2039
- class EntrypointNotFoundError extends Error {
2279
+ class FailedToInsertDomainMappingError extends Error {
2040
2280
  constructor(body) {
2041
2281
  super(
2042
- `ENTRYPOINT_NOT_FOUND: ${body.message}`
2282
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2043
2283
  );
2044
2284
  this.body = body;
2045
- this.name = "EntrypointNotFoundError";
2285
+ this.name = "FailedToInsertDomainMappingError";
2046
2286
  }
2047
- static code = "ENTRYPOINT_NOT_FOUND";
2048
- static statusCode = 400;
2049
- static description = `Entrypoint not found: {entrypoint}`;
2287
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2288
+ static statusCode = 500;
2289
+ static description = `Failed to insert domain mapping: {message}`;
2050
2290
  }
2051
- class NoDomainOwnershipError extends Error {
2291
+ class PermissionDeniedError extends Error {
2052
2292
  constructor(body) {
2053
2293
  super(
2054
- `NO_DOMAIN_OWNERSHIP: ${body.message}`
2294
+ `PERMISSION_DENIED: ${body.message}`
2055
2295
  );
2056
2296
  this.body = body;
2057
- this.name = "NoDomainOwnershipError";
2297
+ this.name = "PermissionDeniedError";
2058
2298
  }
2059
- static code = "NO_DOMAIN_OWNERSHIP";
2060
- static statusCode = 403;
2061
- static description = `No domain ownership for: {domain}`;
2299
+ static code = "PERMISSION_DENIED";
2300
+ static statusCode = 401;
2301
+ static description = `Permission denied: {message}`;
2062
2302
  }
2063
- class InvalidDomainsError extends Error {
2303
+ class FailedToCheckPermissionsError extends Error {
2064
2304
  constructor(body) {
2065
2305
  super(
2066
- `INVALID_DOMAINS: ${body.message}`
2306
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2067
2307
  );
2068
2308
  this.body = body;
2069
- this.name = "InvalidDomainsError";
2309
+ this.name = "FailedToCheckPermissionsError";
2070
2310
  }
2071
- static code = "INVALID_DOMAINS";
2072
- static statusCode = 400;
2073
- static description = `Invalid domains provided`;
2311
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
2312
+ static statusCode = 502;
2313
+ static description = `Failed to check permissions: {message}`;
2074
2314
  }
2075
- class WebDeploymentBadRequestError extends Error {
2315
+ class FailedToListDomainsError extends Error {
2076
2316
  constructor(body) {
2077
2317
  super(
2078
- `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2318
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
2079
2319
  );
2080
2320
  this.body = body;
2081
- this.name = "WebDeploymentBadRequestError";
2321
+ this.name = "FailedToListDomainsError";
2082
2322
  }
2083
- static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2084
- static statusCode = 400;
2085
- static description = `Bad request: {message}`;
2323
+ static code = "FAILED_TO_LIST_DOMAINS";
2324
+ static statusCode = 500;
2325
+ static description = `Failed to list domains: {message}`;
2086
2326
  }
2087
- class TimeoutLimitExceededError extends Error {
2327
+ class FailedToListVerificationsError extends Error {
2088
2328
  constructor(body) {
2089
2329
  super(
2090
- `TIMEOUT_LIMIT_EXCEEDED: ${body.message}`
2330
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2091
2331
  );
2092
2332
  this.body = body;
2093
- this.name = "TimeoutLimitExceededError";
2333
+ this.name = "FailedToListVerificationsError";
2094
2334
  }
2095
- static code = "TIMEOUT_LIMIT_EXCEEDED";
2096
- static statusCode = 403;
2097
- static description = `Timeout exceeds plan limit: requested {requested_ms}ms but your plan allows a maximum of {max_ms}ms`;
2335
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
2336
+ static statusCode = 500;
2337
+ static description = `Failed to list verifications: {message}`;
2098
2338
  }
2099
- class DeploymentLimitExceededError extends Error {
2339
+ class FailedToVerifyDomainError extends Error {
2100
2340
  constructor(body) {
2101
2341
  super(
2102
- `DEPLOYMENT_LIMIT_EXCEEDED: ${body.message}`
2342
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2103
2343
  );
2104
2344
  this.body = body;
2105
- this.name = "DeploymentLimitExceededError";
2345
+ this.name = "FailedToVerifyDomainError";
2106
2346
  }
2107
- static code = "DEPLOYMENT_LIMIT_EXCEEDED";
2108
- static statusCode = 403;
2109
- static description = `Daily deployment limit exceeded: your plan allows {limit} deployments per day, you have created {current} today`;
2347
+ static code = "FAILED_TO_VERIFY_DOMAIN";
2348
+ static statusCode = 500;
2349
+ static description = `Failed to verify domain: {message}`;
2110
2350
  }
2111
- class DeploymentNotFoundError extends Error {
2351
+ class VerificationFailedError extends Error {
2112
2352
  constructor(body) {
2113
2353
  super(
2114
- `DEPLOYMENT_NOT_FOUND: ${body.message}`
2354
+ `VERIFICATION_FAILED: ${body.message}`
2115
2355
  );
2116
2356
  this.body = body;
2117
- this.name = "DeploymentNotFoundError";
2357
+ this.name = "VerificationFailedError";
2118
2358
  }
2119
- static code = "DEPLOYMENT_NOT_FOUND";
2120
- static statusCode = 404;
2121
- static description = `Deployment not found`;
2359
+ static code = "VERIFICATION_FAILED";
2360
+ static statusCode = 400;
2361
+ static description = `Domain verification failed: {message}`;
2122
2362
  }
2123
- class ResizeFailedError extends Error {
2363
+ class FailedToDeleteVerificationError extends Error {
2124
2364
  constructor(body) {
2125
2365
  super(
2126
- `RESIZE_FAILED: ${body.message}`
2366
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2127
2367
  );
2128
2368
  this.body = body;
2129
- this.name = "ResizeFailedError";
2369
+ this.name = "FailedToDeleteVerificationError";
2130
2370
  }
2131
- static code = "RESIZE_FAILED";
2132
- static statusCode = 500;
2133
- static description = `Failed to resize VM: {message}`;
2371
+ static code = "FAILED_TO_DELETE_VERIFICATION";
2372
+ static statusCode = 400;
2373
+ static description = `Failed to delete verification: {message}`;
2134
2374
  }
2135
- class InternalResizeVmNotFoundError extends Error {
2375
+ class VerificationNotFoundError extends Error {
2136
2376
  constructor(body) {
2137
2377
  super(
2138
- `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
2378
+ `VERIFICATION_NOT_FOUND: ${body.message}`
2139
2379
  );
2140
2380
  this.body = body;
2141
- this.name = "InternalResizeVmNotFoundError";
2381
+ this.name = "VerificationNotFoundError";
2142
2382
  }
2143
- static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
2383
+ static code = "VERIFICATION_NOT_FOUND";
2144
2384
  static statusCode = 404;
2145
- static description = `VM not found`;
2385
+ static description = `Verification request not found for domain: {domain}`;
2146
2386
  }
2147
- class BranchNameEmptyError extends Error {
2387
+ class FailedToCreateVerificationCodeError extends Error {
2148
2388
  constructor(body) {
2149
2389
  super(
2150
- `BRANCH_NAME_EMPTY: ${body.message}`
2390
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2151
2391
  );
2152
2392
  this.body = body;
2153
- this.name = "BranchNameEmptyError";
2393
+ this.name = "FailedToCreateVerificationCodeError";
2154
2394
  }
2155
- static code = "BRANCH_NAME_EMPTY";
2395
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2156
2396
  static statusCode = 400;
2157
- static description = `Branch name cannot be empty`;
2397
+ static description = `Failed to create verification code: {message}`;
2158
2398
  }
2159
- class SnapshotLimitExceededError extends Error {
2399
+ class InvalidDomainError extends Error {
2160
2400
  constructor(body) {
2161
2401
  super(
2162
- `SNAPSHOT_LIMIT_EXCEEDED: ${body.message}`
2402
+ `INVALID_DOMAIN: ${body.message}`
2163
2403
  );
2164
2404
  this.body = body;
2165
- this.name = "SnapshotLimitExceededError";
2405
+ this.name = "InvalidDomainError";
2166
2406
  }
2167
- static code = "SNAPSHOT_LIMIT_EXCEEDED";
2168
- static statusCode = 403;
2169
- static description = `Snapshot limit exceeded: your plan allows {limit} total snapshots, you currently have {current}`;
2407
+ static code = "INVALID_DOMAIN";
2408
+ static statusCode = 400;
2409
+ static description = `Invalid domain: {domain}`;
2170
2410
  }
2171
- class PersistentVmsNotAllowedError extends Error {
2411
+ class CloudstateInternalErrorError extends Error {
2172
2412
  constructor(body) {
2173
2413
  super(
2174
- `PERSISTENT_VMS_NOT_ALLOWED: ${body.message}`
2414
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2175
2415
  );
2176
2416
  this.body = body;
2177
- this.name = "PersistentVmsNotAllowedError";
2417
+ this.name = "CloudstateInternalErrorError";
2178
2418
  }
2179
- static code = "PERSISTENT_VMS_NOT_ALLOWED";
2180
- static statusCode = 403;
2181
- static description = `Your plan does not allow persistent VMs. Use sticky or ephemeral persistence instead, or upgrade your plan.`;
2419
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
2420
+ static statusCode = 500;
2421
+ static description = `Internal error: {message}`;
2182
2422
  }
2183
- class TotalVmLimitExceededError extends Error {
2423
+ class CloudstateDatabaseErrorError extends Error {
2184
2424
  constructor(body) {
2185
2425
  super(
2186
- `TOTAL_VM_LIMIT_EXCEEDED: ${body.message}`
2426
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2187
2427
  );
2188
2428
  this.body = body;
2189
- this.name = "TotalVmLimitExceededError";
2429
+ this.name = "CloudstateDatabaseErrorError";
2190
2430
  }
2191
- static code = "TOTAL_VM_LIMIT_EXCEEDED";
2192
- static statusCode = 403;
2193
- static description = `Total VM limit exceeded: your plan allows {limit} total VMs, you currently have {current}`;
2431
+ static code = "CLOUDSTATE_DATABASE_ERROR";
2432
+ static statusCode = 500;
2433
+ static description = `Database operation failed: {message}`;
2194
2434
  }
2195
- class VmLimitExceededError extends Error {
2435
+ class CloudstateAccessDeniedError extends Error {
2196
2436
  constructor(body) {
2197
2437
  super(
2198
- `VM_LIMIT_EXCEEDED: ${body.message}`
2438
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2199
2439
  );
2200
2440
  this.body = body;
2201
- this.name = "VmLimitExceededError";
2441
+ this.name = "CloudstateAccessDeniedError";
2202
2442
  }
2203
- static code = "VM_LIMIT_EXCEEDED";
2443
+ static code = "CLOUDSTATE_ACCESS_DENIED";
2204
2444
  static statusCode = 403;
2205
- static description = `VM limit exceeded: your plan allows {limit} active VMs, you currently have {current}`;
2445
+ static description = `Access denied to project: {project_id}`;
2206
2446
  }
2207
- class ObservabilityDatabaseErrorError extends Error {
2447
+ class RestoreFailedError extends Error {
2208
2448
  constructor(body) {
2209
2449
  super(
2210
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2450
+ `RESTORE_FAILED: ${body.message}`
2211
2451
  );
2212
2452
  this.body = body;
2213
- this.name = "ObservabilityDatabaseErrorError";
2453
+ this.name = "RestoreFailedError";
2214
2454
  }
2215
- static code = "OBSERVABILITY_DATABASE_ERROR";
2455
+ static code = "RESTORE_FAILED";
2216
2456
  static statusCode = 500;
2217
- static description = `Database operation failed: {message}`;
2457
+ static description = `Failed to restore from backup: {message}`;
2218
2458
  }
2219
- class ObservabilityAccessDeniedError extends Error {
2459
+ class CreateBackupFailedError extends Error {
2220
2460
  constructor(body) {
2221
2461
  super(
2222
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2462
+ `CREATE_BACKUP_FAILED: ${body.message}`
2223
2463
  );
2224
2464
  this.body = body;
2225
- this.name = "ObservabilityAccessDeniedError";
2465
+ this.name = "CreateBackupFailedError";
2226
2466
  }
2227
- static code = "OBSERVABILITY_ACCESS_DENIED";
2228
- static statusCode = 403;
2229
- static description = `Access denied to logs for deployment: {deployment_id}`;
2467
+ static code = "CREATE_BACKUP_FAILED";
2468
+ static statusCode = 500;
2469
+ static description = `Failed to create backup: {message}`;
2230
2470
  }
2231
- class ParseLogsFailedError extends Error {
2471
+ class BackupFailedError extends Error {
2232
2472
  constructor(body) {
2233
2473
  super(
2234
- `PARSE_LOGS_FAILED: ${body.message}`
2474
+ `BACKUP_FAILED: ${body.message}`
2235
2475
  );
2236
2476
  this.body = body;
2237
- this.name = "ParseLogsFailedError";
2477
+ this.name = "BackupFailedError";
2238
2478
  }
2239
- static code = "PARSE_LOGS_FAILED";
2479
+ static code = "BACKUP_FAILED";
2240
2480
  static statusCode = 500;
2241
- static description = `Failed to parse logs: {message}`;
2481
+ static description = `Backup failed: {message}`;
2242
2482
  }
2243
- class RetrieveLogsFailedError extends Error {
2483
+ class DeploymentFailedError extends Error {
2244
2484
  constructor(body) {
2245
2485
  super(
2246
- `RETRIEVE_LOGS_FAILED: ${body.message}`
2486
+ `DEPLOYMENT_FAILED: ${body.message}`
2247
2487
  );
2248
2488
  this.body = body;
2249
- this.name = "RetrieveLogsFailedError";
2489
+ this.name = "DeploymentFailedError";
2250
2490
  }
2251
- static code = "RETRIEVE_LOGS_FAILED";
2491
+ static code = "DEPLOYMENT_FAILED";
2252
2492
  static statusCode = 500;
2253
- static description = `Failed to retrieve logs: {message}`;
2493
+ static description = `Deployment failed: {message}`;
2254
2494
  }
2255
- class InvalidQueryError extends Error {
2495
+ class InvalidDeploymentRequestError extends Error {
2256
2496
  constructor(body) {
2257
2497
  super(
2258
- `INVALID_QUERY: ${body.message}`
2498
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2259
2499
  );
2260
2500
  this.body = body;
2261
- this.name = "InvalidQueryError";
2501
+ this.name = "InvalidDeploymentRequestError";
2262
2502
  }
2263
- static code = "INVALID_QUERY";
2503
+ static code = "INVALID_DEPLOYMENT_REQUEST";
2264
2504
  static statusCode = 400;
2265
- static description = `Invalid log query: {message}`;
2505
+ static description = `Invalid deployment request: {message}`;
2266
2506
  }
2267
- class LogsNotFoundError extends Error {
2507
+ class ProjectNotFoundError extends Error {
2268
2508
  constructor(body) {
2269
2509
  super(
2270
- `LOGS_NOT_FOUND: ${body.message}`
2510
+ `PROJECT_NOT_FOUND: ${body.message}`
2271
2511
  );
2272
2512
  this.body = body;
2273
- this.name = "LogsNotFoundError";
2513
+ this.name = "ProjectNotFoundError";
2274
2514
  }
2275
- static code = "LOGS_NOT_FOUND";
2515
+ static code = "PROJECT_NOT_FOUND";
2276
2516
  static statusCode = 404;
2277
- static description = `Logs not found for deployment: {deployment_id}`;
2278
- }
2279
- class DomainOwnershipNotVerifiedError extends Error {
2280
- constructor(body) {
2281
- super(
2282
- `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
2283
- );
2284
- this.body = body;
2285
- this.name = "DomainOwnershipNotVerifiedError";
2286
- }
2287
- static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
2288
- static statusCode = 401;
2289
- static description = `You have not verified ownership of domain: {domain}`;
2517
+ static description = `Project not found: {project_id}`;
2290
2518
  }
2291
- class VmAccessDeniedForMappingError extends Error {
2519
+ class AccessDeniedError extends Error {
2292
2520
  constructor(body) {
2293
2521
  super(
2294
- `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
2522
+ `ACCESS_DENIED: ${body.message}`
2295
2523
  );
2296
2524
  this.body = body;
2297
- this.name = "VmAccessDeniedForMappingError";
2525
+ this.name = "AccessDeniedError";
2298
2526
  }
2299
- static code = "VM_ACCESS_DENIED_FOR_MAPPING";
2300
- static statusCode = 401;
2301
- static description = `You do not have permission to map to this VM: {vm_id}`;
2527
+ static code = "ACCESS_DENIED";
2528
+ static statusCode = 403;
2529
+ static description = `VM access denied`;
2302
2530
  }
2303
- class DeploymentAccessDeniedError extends Error {
2531
+ class BuildFailedError extends Error {
2304
2532
  constructor(body) {
2305
2533
  super(
2306
- `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
2534
+ `BUILD_FAILED: ${body.message}`
2307
2535
  );
2308
2536
  this.body = body;
2309
- this.name = "DeploymentAccessDeniedError";
2537
+ this.name = "BuildFailedError";
2310
2538
  }
2311
- static code = "DEPLOYMENT_ACCESS_DENIED";
2312
- static statusCode = 401;
2313
- static description = `You do not have permission to map to this deployment: {deployment_id}`;
2539
+ static code = "BUILD_FAILED";
2540
+ static statusCode = 500;
2541
+ static description = `Build failed on VM {vm_id}`;
2314
2542
  }
2315
- class FailedToProvisionCertificateForMappingError extends Error {
2543
+ class ServerDeploymentFailedError extends Error {
2316
2544
  constructor(body) {
2317
2545
  super(
2318
- `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
2546
+ `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2319
2547
  );
2320
2548
  this.body = body;
2321
- this.name = "FailedToProvisionCertificateForMappingError";
2549
+ this.name = "ServerDeploymentFailedError";
2322
2550
  }
2323
- static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
2324
- static statusCode = 422;
2325
- static description = `Failed to provision certificate for mapping: {message}`;
2551
+ static code = "SERVER_DEPLOYMENT_FAILED";
2552
+ static statusCode = 502;
2553
+ static description = `Failed to deploy to servers`;
2326
2554
  }
2327
- class FailedInsertDomainMappingError extends Error {
2555
+ class LockfileErrorError extends Error {
2328
2556
  constructor(body) {
2329
2557
  super(
2330
- `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
2558
+ `LOCKFILE_ERROR: ${body.message}`
2331
2559
  );
2332
2560
  this.body = body;
2333
- this.name = "FailedInsertDomainMappingError";
2561
+ this.name = "LockfileErrorError";
2334
2562
  }
2335
- static code = "FAILED_INSERT_DOMAIN_MAPPING";
2563
+ static code = "LOCKFILE_ERROR";
2336
2564
  static statusCode = 500;
2337
- static description = `Failed to insert domain mapping: {message}`;
2565
+ static description = `Failed to generate dependency lockfile: {message}`;
2338
2566
  }
2339
- class DomainAlreadyExistsError extends Error {
2567
+ class UploadErrorError extends Error {
2340
2568
  constructor(body) {
2341
2569
  super(
2342
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2570
+ `UPLOAD_ERROR: ${body.message}`
2343
2571
  );
2344
2572
  this.body = body;
2345
- this.name = "DomainAlreadyExistsError";
2573
+ this.name = "UploadErrorError";
2346
2574
  }
2347
- static code = "DOMAIN_ALREADY_EXISTS";
2348
- static statusCode = 400;
2349
- static description = `Domain already exists: {domain}`;
2575
+ static code = "UPLOAD_ERROR";
2576
+ static statusCode = 500;
2577
+ static description = `Failed to upload deployment to storage`;
2350
2578
  }
2351
- class FailedToInsertOwnershipError extends Error {
2579
+ class DomainMappingErrorError extends Error {
2352
2580
  constructor(body) {
2353
2581
  super(
2354
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2582
+ `DOMAIN_MAPPING_ERROR: ${body.message}`
2355
2583
  );
2356
2584
  this.body = body;
2357
- this.name = "FailedToInsertOwnershipError";
2585
+ this.name = "DomainMappingErrorError";
2358
2586
  }
2359
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2587
+ static code = "DOMAIN_MAPPING_ERROR";
2360
2588
  static statusCode = 500;
2361
- static description = `Failed to insert domain ownership: {message}`;
2589
+ static description = `Failed to configure domain mapping for: {domain}`;
2362
2590
  }
2363
- class FailedRemoveDomainMappingError extends Error {
2591
+ class CertificateProvisioningErrorError extends Error {
2364
2592
  constructor(body) {
2365
2593
  super(
2366
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2594
+ `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2367
2595
  );
2368
2596
  this.body = body;
2369
- this.name = "FailedRemoveDomainMappingError";
2597
+ this.name = "CertificateProvisioningErrorError";
2370
2598
  }
2371
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2372
- static statusCode = 500;
2373
- static description = `Failed to remove domain mapping: {message}`;
2599
+ static code = "CERTIFICATE_PROVISIONING_ERROR";
2600
+ static statusCode = 502;
2601
+ static description = `Failed to provision certificate for domain: {domain}`;
2374
2602
  }
2375
- class FailedPermissionsCheckError extends Error {
2603
+ class NoEntrypointFoundError extends Error {
2376
2604
  constructor(body) {
2377
2605
  super(
2378
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2606
+ `NO_ENTRYPOINT_FOUND: ${body.message}`
2379
2607
  );
2380
2608
  this.body = body;
2381
- this.name = "FailedPermissionsCheckError";
2609
+ this.name = "NoEntrypointFoundError";
2382
2610
  }
2383
- static code = "FAILED_PERMISSIONS_CHECK";
2384
- static statusCode = 401;
2385
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2611
+ static code = "NO_ENTRYPOINT_FOUND";
2612
+ static statusCode = 400;
2613
+ static description = `No entrypoint found in deployment`;
2386
2614
  }
2387
- class FailedToCheckDomainMappingPermissionsError extends Error {
2615
+ class EntrypointNotFoundError extends Error {
2388
2616
  constructor(body) {
2389
2617
  super(
2390
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2618
+ `ENTRYPOINT_NOT_FOUND: ${body.message}`
2391
2619
  );
2392
2620
  this.body = body;
2393
- this.name = "FailedToCheckDomainMappingPermissionsError";
2621
+ this.name = "EntrypointNotFoundError";
2394
2622
  }
2395
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2396
- static statusCode = 502;
2397
- static description = `Failed to check permissions: {message}`;
2623
+ static code = "ENTRYPOINT_NOT_FOUND";
2624
+ static statusCode = 400;
2625
+ static description = `Entrypoint not found: {entrypoint}`;
2398
2626
  }
2399
- class DomainOwnershipVerificationFailedError extends Error {
2627
+ class NoDomainOwnershipError extends Error {
2400
2628
  constructor(body) {
2401
2629
  super(
2402
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2630
+ `NO_DOMAIN_OWNERSHIP: ${body.message}`
2403
2631
  );
2404
2632
  this.body = body;
2405
- this.name = "DomainOwnershipVerificationFailedError";
2633
+ this.name = "NoDomainOwnershipError";
2406
2634
  }
2407
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2635
+ static code = "NO_DOMAIN_OWNERSHIP";
2408
2636
  static statusCode = 403;
2409
- static description = `Domain ownership verification failed`;
2637
+ static description = `No domain ownership for: {domain}`;
2410
2638
  }
2411
- class ErrorDeletingRecordError extends Error {
2639
+ class InvalidDomainsError extends Error {
2412
2640
  constructor(body) {
2413
2641
  super(
2414
- `ERROR_DELETING_RECORD: ${body.message}`
2642
+ `INVALID_DOMAINS: ${body.message}`
2415
2643
  );
2416
2644
  this.body = body;
2417
- this.name = "ErrorDeletingRecordError";
2645
+ this.name = "InvalidDomainsError";
2418
2646
  }
2419
- static code = "ERROR_DELETING_RECORD";
2420
- static statusCode = 500;
2421
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2647
+ static code = "INVALID_DOMAINS";
2648
+ static statusCode = 400;
2649
+ static description = `Invalid domains provided`;
2422
2650
  }
2423
- class RecordOwnershipErrorError extends Error {
2651
+ class WebDeploymentBadRequestError extends Error {
2424
2652
  constructor(body) {
2425
2653
  super(
2426
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
2654
+ `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2427
2655
  );
2428
2656
  this.body = body;
2429
- this.name = "RecordOwnershipErrorError";
2657
+ this.name = "WebDeploymentBadRequestError";
2430
2658
  }
2431
- static code = "RECORD_OWNERSHIP_ERROR";
2432
- static statusCode = 403;
2433
- static description = `Account {account_id} does not own record {record_id}`;
2659
+ static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2660
+ static statusCode = 400;
2661
+ static description = `Bad request: {message}`;
2434
2662
  }
2435
- class ErrorCreatingRecordError extends Error {
2663
+ class TimeoutLimitExceededError extends Error {
2436
2664
  constructor(body) {
2437
2665
  super(
2438
- `ERROR_CREATING_RECORD: ${body.message}`
2666
+ `TIMEOUT_LIMIT_EXCEEDED: ${body.message}`
2439
2667
  );
2440
2668
  this.body = body;
2441
- this.name = "ErrorCreatingRecordError";
2669
+ this.name = "TimeoutLimitExceededError";
2442
2670
  }
2443
- static code = "ERROR_CREATING_RECORD";
2444
- static statusCode = 500;
2445
- static description = `Error creating DNS record: {message}`;
2671
+ static code = "TIMEOUT_LIMIT_EXCEEDED";
2672
+ static statusCode = 403;
2673
+ static description = `Timeout exceeds plan limit: requested {requested_ms}ms but your plan allows a maximum of {max_ms}ms`;
2446
2674
  }
2447
- class DomainOwnershipErrorError extends Error {
2675
+ class DeploymentLimitExceededError extends Error {
2448
2676
  constructor(body) {
2449
2677
  super(
2450
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2678
+ `DEPLOYMENT_LIMIT_EXCEEDED: ${body.message}`
2451
2679
  );
2452
2680
  this.body = body;
2453
- this.name = "DomainOwnershipErrorError";
2681
+ this.name = "DeploymentLimitExceededError";
2454
2682
  }
2455
- static code = "DOMAIN_OWNERSHIP_ERROR";
2683
+ static code = "DEPLOYMENT_LIMIT_EXCEEDED";
2456
2684
  static statusCode = 403;
2457
- static description = `Account {account_id} does not own domain {domain}`;
2685
+ static description = `Daily deployment limit exceeded: your plan allows {limit} deployments per day, you have created {current} today`;
2458
2686
  }
2459
- class TriggerErrorError extends Error {
2687
+ class DeploymentNotFoundError extends Error {
2460
2688
  constructor(body) {
2461
2689
  super(
2462
- `TRIGGER_ERROR: ${body.message}`
2690
+ `DEPLOYMENT_NOT_FOUND: ${body.message}`
2463
2691
  );
2464
2692
  this.body = body;
2465
- this.name = "TriggerErrorError";
2693
+ this.name = "DeploymentNotFoundError";
2466
2694
  }
2467
- static code = "TRIGGER_ERROR";
2468
- static statusCode = 500;
2469
- static description = `Failed to manage triggers: {message}`;
2695
+ static code = "DEPLOYMENT_NOT_FOUND";
2696
+ static statusCode = 404;
2697
+ static description = `Deployment not found`;
2470
2698
  }
2471
- class TokenErrorError extends Error {
2699
+ class ResizeFailedError extends Error {
2472
2700
  constructor(body) {
2473
2701
  super(
2474
- `TOKEN_ERROR: ${body.message}`
2702
+ `RESIZE_FAILED: ${body.message}`
2475
2703
  );
2476
2704
  this.body = body;
2477
- this.name = "TokenErrorError";
2705
+ this.name = "ResizeFailedError";
2478
2706
  }
2479
- static code = "TOKEN_ERROR";
2707
+ static code = "RESIZE_FAILED";
2480
2708
  static statusCode = 500;
2481
- static description = `Failed to manage tokens: {message}`;
2709
+ static description = `Failed to resize VM: {message}`;
2482
2710
  }
2483
- class PermissionErrorError extends Error {
2711
+ class InternalResizeVmNotFoundError extends Error {
2484
2712
  constructor(body) {
2485
2713
  super(
2486
- `PERMISSION_ERROR: ${body.message}`
2714
+ `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
2487
2715
  );
2488
2716
  this.body = body;
2489
- this.name = "PermissionErrorError";
2717
+ this.name = "InternalResizeVmNotFoundError";
2490
2718
  }
2491
- static code = "PERMISSION_ERROR";
2492
- static statusCode = 500;
2493
- static description = `Failed to manage permissions: {message}`;
2719
+ static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
2720
+ static statusCode = 404;
2721
+ static description = `VM not found`;
2494
2722
  }
2495
- class IdentityErrorError extends Error {
2723
+ class DomainOwnershipVerificationFailedError extends Error {
2496
2724
  constructor(body) {
2497
2725
  super(
2498
- `IDENTITY_ERROR: ${body.message}`
2726
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2499
2727
  );
2500
2728
  this.body = body;
2501
- this.name = "IdentityErrorError";
2729
+ this.name = "DomainOwnershipVerificationFailedError";
2502
2730
  }
2503
- static code = "IDENTITY_ERROR";
2504
- static statusCode = 500;
2505
- static description = `Failed to manage identity: {message}`;
2731
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2732
+ static statusCode = 403;
2733
+ static description = `Domain ownership verification failed`;
2506
2734
  }
2507
- class GetContentFailedError extends Error {
2735
+ class ErrorDeletingRecordError extends Error {
2508
2736
  constructor(body) {
2509
2737
  super(
2510
- `GET_CONTENT_FAILED: ${body.message}`
2738
+ `ERROR_DELETING_RECORD: ${body.message}`
2511
2739
  );
2512
2740
  this.body = body;
2513
- this.name = "GetContentFailedError";
2741
+ this.name = "ErrorDeletingRecordError";
2514
2742
  }
2515
- static code = "GET_CONTENT_FAILED";
2743
+ static code = "ERROR_DELETING_RECORD";
2516
2744
  static statusCode = 500;
2517
- static description = `Failed to get content: {message}`;
2745
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2518
2746
  }
2519
- class ContentNotFoundError extends Error {
2747
+ class RecordOwnershipErrorError extends Error {
2520
2748
  constructor(body) {
2521
2749
  super(
2522
- `CONTENT_NOT_FOUND: ${body.message}`
2750
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
2523
2751
  );
2524
2752
  this.body = body;
2525
- this.name = "ContentNotFoundError";
2753
+ this.name = "RecordOwnershipErrorError";
2526
2754
  }
2527
- static code = "CONTENT_NOT_FOUND";
2528
- static statusCode = 404;
2529
- static description = `Content not found: {path}`;
2755
+ static code = "RECORD_OWNERSHIP_ERROR";
2756
+ static statusCode = 403;
2757
+ static description = `Account {account_id} does not own record {record_id}`;
2530
2758
  }
2531
- class DownloadFailedError extends Error {
2759
+ class ErrorCreatingRecordError extends Error {
2532
2760
  constructor(body) {
2533
2761
  super(
2534
- `DOWNLOAD_FAILED: ${body.message}`
2762
+ `ERROR_CREATING_RECORD: ${body.message}`
2535
2763
  );
2536
2764
  this.body = body;
2537
- this.name = "DownloadFailedError";
2765
+ this.name = "ErrorCreatingRecordError";
2538
2766
  }
2539
- static code = "DOWNLOAD_FAILED";
2767
+ static code = "ERROR_CREATING_RECORD";
2540
2768
  static statusCode = 500;
2541
- static description = `Failed to download repository: {message}`;
2769
+ static description = `Error creating DNS record: {message}`;
2542
2770
  }
2543
- class GitServerErrorError extends Error {
2771
+ class DomainOwnershipErrorError extends Error {
2544
2772
  constructor(body) {
2545
2773
  super(
2546
- `GIT_SERVER_ERROR: ${body.message}`
2774
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2547
2775
  );
2548
2776
  this.body = body;
2549
- this.name = "GitServerErrorError";
2777
+ this.name = "DomainOwnershipErrorError";
2550
2778
  }
2551
- static code = "GIT_SERVER_ERROR";
2552
- static statusCode = 500;
2553
- static description = `Git server error: {message}`;
2779
+ static code = "DOMAIN_OWNERSHIP_ERROR";
2780
+ static statusCode = 403;
2781
+ static description = `Account {account_id} does not own domain {domain}`;
2554
2782
  }
2555
- class ParseResponseErrorError extends Error {
2783
+ class GitRepoLimitExceededError extends Error {
2556
2784
  constructor(body) {
2557
2785
  super(
2558
- `PARSE_RESPONSE_ERROR: ${body.message}`
2786
+ `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
2559
2787
  );
2560
2788
  this.body = body;
2561
- this.name = "ParseResponseErrorError";
2789
+ this.name = "GitRepoLimitExceededError";
2562
2790
  }
2563
- static code = "PARSE_RESPONSE_ERROR";
2564
- static statusCode = 500;
2565
- static description = `Failed to parse response from Git server: {message}`;
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}`;
2566
2794
  }
2567
- class RepositoryAccessDeniedError extends Error {
2795
+ class RootfsSizeTooLargeError extends Error {
2568
2796
  constructor(body) {
2569
2797
  super(
2570
- `REPOSITORY_ACCESS_DENIED: ${body.message}`
2798
+ `ROOTFS_SIZE_TOO_LARGE: ${body.message}`
2571
2799
  );
2572
2800
  this.body = body;
2573
- this.name = "RepositoryAccessDeniedError";
2801
+ this.name = "RootfsSizeTooLargeError";
2574
2802
  }
2575
- static code = "REPOSITORY_ACCESS_DENIED";
2576
- static statusCode = 403;
2577
- static description = `Repository does not belong to account`;
2803
+ static code = "ROOTFS_SIZE_TOO_LARGE";
2804
+ static statusCode = 400;
2805
+ static description = `rootfsSizeGb {got_gb} is too large`;
2578
2806
  }
2579
- class GitHubSyncFailedError extends Error {
2807
+ class MemSizeTooLargeError extends Error {
2580
2808
  constructor(body) {
2581
2809
  super(
2582
- `GIT_HUB_SYNC_FAILED: ${body.message}`
2810
+ `MEM_SIZE_TOO_LARGE: ${body.message}`
2583
2811
  );
2584
2812
  this.body = body;
2585
- this.name = "GitHubSyncFailedError";
2813
+ this.name = "MemSizeTooLargeError";
2586
2814
  }
2587
- static code = "GIT_HUB_SYNC_FAILED";
2588
- static statusCode = 500;
2589
- static description = `Failed to configure GitHub sync: {message}`;
2815
+ static code = "MEM_SIZE_TOO_LARGE";
2816
+ static statusCode = 400;
2817
+ static description = `memSizeGb {got_gb} is too large`;
2590
2818
  }
2591
- class UpdateDefaultBranchFailedError extends Error {
2819
+ class RootfsOverPlanLimitError extends Error {
2592
2820
  constructor(body) {
2593
2821
  super(
2594
- `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2822
+ `ROOTFS_OVER_PLAN_LIMIT: ${body.message}`
2595
2823
  );
2596
2824
  this.body = body;
2597
- this.name = "UpdateDefaultBranchFailedError";
2825
+ this.name = "RootfsOverPlanLimitError";
2598
2826
  }
2599
- static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2600
- static statusCode = 500;
2601
- static description = `Failed to update default branch: {message}`;
2827
+ static code = "ROOTFS_OVER_PLAN_LIMIT";
2828
+ static statusCode = 403;
2829
+ static description = `rootfsSizeMb {got} MB exceeds your plan's maximum of {max} MB`;
2602
2830
  }
2603
- class GetRepositoryInfoFailedError extends Error {
2831
+ class MemOverPlanLimitError extends Error {
2604
2832
  constructor(body) {
2605
2833
  super(
2606
- `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2834
+ `MEM_OVER_PLAN_LIMIT: ${body.message}`
2607
2835
  );
2608
2836
  this.body = body;
2609
- this.name = "GetRepositoryInfoFailedError";
2837
+ this.name = "MemOverPlanLimitError";
2610
2838
  }
2611
- static code = "GET_REPOSITORY_INFO_FAILED";
2612
- static statusCode = 500;
2613
- static description = `Failed to get repository info: {message}`;
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`;
2614
2842
  }
2615
- class ListRepositoriesFailedError extends Error {
2843
+ class VcpuOverPlanLimitError extends Error {
2616
2844
  constructor(body) {
2617
2845
  super(
2618
- `LIST_REPOSITORIES_FAILED: ${body.message}`
2846
+ `VCPU_OVER_PLAN_LIMIT: ${body.message}`
2619
2847
  );
2620
2848
  this.body = body;
2621
- this.name = "ListRepositoriesFailedError";
2849
+ this.name = "VcpuOverPlanLimitError";
2622
2850
  }
2623
- static code = "LIST_REPOSITORIES_FAILED";
2624
- static statusCode = 500;
2625
- static description = `Failed to list repositories: {message}`;
2851
+ static code = "VCPU_OVER_PLAN_LIMIT";
2852
+ static statusCode = 403;
2853
+ static description = `vcpuCount {got} exceeds your plan's maximum of {max}`;
2626
2854
  }
2627
- class DeleteRepositoryFailedError extends Error {
2855
+ class CustomSizingNotAllowedError extends Error {
2628
2856
  constructor(body) {
2629
2857
  super(
2630
- `DELETE_REPOSITORY_FAILED: ${body.message}`
2858
+ `CUSTOM_SIZING_NOT_ALLOWED: ${body.message}`
2631
2859
  );
2632
2860
  this.body = body;
2633
- this.name = "DeleteRepositoryFailedError";
2861
+ this.name = "CustomSizingNotAllowedError";
2634
2862
  }
2635
- static code = "DELETE_REPOSITORY_FAILED";
2636
- static statusCode = 500;
2637
- static description = `Failed to delete repository: {message}`;
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.`;
2638
2866
  }
2639
- class CreateRepositoryFailedError extends Error {
2867
+ class SnapshotLimitExceededError extends Error {
2640
2868
  constructor(body) {
2641
2869
  super(
2642
- `CREATE_REPOSITORY_FAILED: ${body.message}`
2870
+ `SNAPSHOT_LIMIT_EXCEEDED: ${body.message}`
2643
2871
  );
2644
2872
  this.body = body;
2645
- this.name = "CreateRepositoryFailedError";
2873
+ this.name = "SnapshotLimitExceededError";
2646
2874
  }
2647
- static code = "CREATE_REPOSITORY_FAILED";
2648
- static statusCode = 500;
2649
- static description = `Failed to create repository: {message}`;
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}`;
2650
2878
  }
2651
- class SerializationErrorError extends Error {
2879
+ class PersistentVmsNotAllowedError extends Error {
2652
2880
  constructor(body) {
2653
2881
  super(
2654
- `SERIALIZATION_ERROR: ${body.message}`
2882
+ `PERSISTENT_VMS_NOT_ALLOWED: ${body.message}`
2655
2883
  );
2656
2884
  this.body = body;
2657
- this.name = "SerializationErrorError";
2885
+ this.name = "PersistentVmsNotAllowedError";
2658
2886
  }
2659
- static code = "SERIALIZATION_ERROR";
2660
- static statusCode = 400;
2661
- static description = `Failed to serialize request: {message}`;
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.`;
2662
2890
  }
2663
- class GitInvalidRequestError extends Error {
2891
+ class TotalVmLimitExceededError extends Error {
2664
2892
  constructor(body) {
2665
2893
  super(
2666
- `GIT_INVALID_REQUEST: ${body.message}`
2894
+ `TOTAL_VM_LIMIT_EXCEEDED: ${body.message}`
2667
2895
  );
2668
2896
  this.body = body;
2669
- this.name = "GitInvalidRequestError";
2897
+ this.name = "TotalVmLimitExceededError";
2670
2898
  }
2671
- static code = "GIT_INVALID_REQUEST";
2672
- static statusCode = 400;
2673
- static description = `Invalid request: {message}`;
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}`;
2674
2902
  }
2675
- class RepositoryNotFoundError extends Error {
2903
+ class VmLimitExceededError extends Error {
2676
2904
  constructor(body) {
2677
2905
  super(
2678
- `REPOSITORY_NOT_FOUND: ${body.message}`
2906
+ `VM_LIMIT_EXCEEDED: ${body.message}`
2679
2907
  );
2680
2908
  this.body = body;
2681
- this.name = "RepositoryNotFoundError";
2909
+ this.name = "VmLimitExceededError";
2682
2910
  }
2683
- static code = "REPOSITORY_NOT_FOUND";
2684
- static statusCode = 404;
2685
- static description = `Repository not found: {repo_id}`;
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}`;
2686
2914
  }
2687
- class ExecuteInternalErrorError extends Error {
2915
+ class ObservabilityDatabaseErrorError extends Error {
2688
2916
  constructor(body) {
2689
2917
  super(
2690
- `EXECUTE_INTERNAL_ERROR: ${body.message}`
2918
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2691
2919
  );
2692
2920
  this.body = body;
2693
- this.name = "ExecuteInternalErrorError";
2921
+ this.name = "ObservabilityDatabaseErrorError";
2694
2922
  }
2695
- static code = "EXECUTE_INTERNAL_ERROR";
2923
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2696
2924
  static statusCode = 500;
2697
- static description = `Internal error: {message}`;
2925
+ static description = `Database operation failed: {message}`;
2698
2926
  }
2699
- class ExecuteAccessDeniedError extends Error {
2927
+ class ObservabilityAccessDeniedError extends Error {
2700
2928
  constructor(body) {
2701
2929
  super(
2702
- `EXECUTE_ACCESS_DENIED: ${body.message}`
2930
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2703
2931
  );
2704
2932
  this.body = body;
2705
- this.name = "ExecuteAccessDeniedError";
2933
+ this.name = "ObservabilityAccessDeniedError";
2706
2934
  }
2707
- static code = "EXECUTE_ACCESS_DENIED";
2935
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2708
2936
  static statusCode = 403;
2709
- static description = `Access denied to execute run`;
2937
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2710
2938
  }
2711
- class ListRunsFailedError extends Error {
2939
+ class ParseLogsFailedError extends Error {
2712
2940
  constructor(body) {
2713
2941
  super(
2714
- `LIST_RUNS_FAILED: ${body.message}`
2942
+ `PARSE_LOGS_FAILED: ${body.message}`
2715
2943
  );
2716
2944
  this.body = body;
2717
- this.name = "ListRunsFailedError";
2945
+ this.name = "ParseLogsFailedError";
2718
2946
  }
2719
- static code = "LIST_RUNS_FAILED";
2947
+ static code = "PARSE_LOGS_FAILED";
2720
2948
  static statusCode = 500;
2721
- static description = `Failed to list execute runs: {message}`;
2949
+ static description = `Failed to parse logs: {message}`;
2722
2950
  }
2723
- class ExecutionErrorError extends Error {
2951
+ class RetrieveLogsFailedError extends Error {
2724
2952
  constructor(body) {
2725
2953
  super(
2726
- `EXECUTION_ERROR: ${body.message}`
2954
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2727
2955
  );
2728
2956
  this.body = body;
2729
- this.name = "ExecutionErrorError";
2957
+ this.name = "RetrieveLogsFailedError";
2730
2958
  }
2731
- static code = "EXECUTION_ERROR";
2959
+ static code = "RETRIEVE_LOGS_FAILED";
2732
2960
  static statusCode = 500;
2733
- static description = `Script execution error: {message}`;
2961
+ static description = `Failed to retrieve logs: {message}`;
2734
2962
  }
2735
- class ConnectionFailedError extends Error {
2963
+ class InvalidQueryError extends Error {
2736
2964
  constructor(body) {
2737
2965
  super(
2738
- `CONNECTION_FAILED: ${body.message}`
2966
+ `INVALID_QUERY: ${body.message}`
2739
2967
  );
2740
2968
  this.body = body;
2741
- this.name = "ConnectionFailedError";
2969
+ this.name = "InvalidQueryError";
2742
2970
  }
2743
- static code = "CONNECTION_FAILED";
2744
- static statusCode = 500;
2745
- static description = `Failed to connect to execute server: {message}`;
2971
+ static code = "INVALID_QUERY";
2972
+ static statusCode = 400;
2973
+ static description = `Invalid log query: {message}`;
2746
2974
  }
2747
- class MetadataWriteFailedError extends Error {
2975
+ class LogsNotFoundError extends Error {
2748
2976
  constructor(body) {
2749
2977
  super(
2750
- `METADATA_WRITE_FAILED: ${body.message}`
2978
+ `LOGS_NOT_FOUND: ${body.message}`
2751
2979
  );
2752
2980
  this.body = body;
2753
- this.name = "MetadataWriteFailedError";
2981
+ this.name = "LogsNotFoundError";
2754
2982
  }
2755
- static code = "METADATA_WRITE_FAILED";
2983
+ static code = "LOGS_NOT_FOUND";
2984
+ static statusCode = 404;
2985
+ static description = `Logs not found for deployment: {deployment_id}`;
2986
+ }
2987
+ class TriggerErrorError extends Error {
2988
+ constructor(body) {
2989
+ super(
2990
+ `TRIGGER_ERROR: ${body.message}`
2991
+ );
2992
+ this.body = body;
2993
+ this.name = "TriggerErrorError";
2994
+ }
2995
+ static code = "TRIGGER_ERROR";
2756
2996
  static statusCode = 500;
2757
- static description = `Failed to write metadata file: {message}`;
2997
+ static description = `Failed to manage triggers: {message}`;
2758
2998
  }
2759
- class NodeModulesInstallFailedError extends Error {
2999
+ class TokenErrorError extends Error {
2760
3000
  constructor(body) {
2761
3001
  super(
2762
- `NODE_MODULES_INSTALL_FAILED: ${body.message}`
3002
+ `TOKEN_ERROR: ${body.message}`
2763
3003
  );
2764
3004
  this.body = body;
2765
- this.name = "NodeModulesInstallFailedError";
3005
+ this.name = "TokenErrorError";
2766
3006
  }
2767
- static code = "NODE_MODULES_INSTALL_FAILED";
3007
+ static code = "TOKEN_ERROR";
2768
3008
  static statusCode = 500;
2769
- static description = `Failed to install node modules: {message}`;
3009
+ static description = `Failed to manage tokens: {message}`;
2770
3010
  }
2771
- class NodeModulesDownloadFailedError extends Error {
3011
+ class PermissionErrorError extends Error {
2772
3012
  constructor(body) {
2773
3013
  super(
2774
- `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
3014
+ `PERMISSION_ERROR: ${body.message}`
2775
3015
  );
2776
3016
  this.body = body;
2777
- this.name = "NodeModulesDownloadFailedError";
3017
+ this.name = "PermissionErrorError";
2778
3018
  }
2779
- static code = "NODE_MODULES_DOWNLOAD_FAILED";
3019
+ static code = "PERMISSION_ERROR";
2780
3020
  static statusCode = 500;
2781
- static description = `Failed to download node modules: {message}`;
3021
+ static description = `Failed to manage permissions: {message}`;
2782
3022
  }
2783
- class LockGenerationFailedError extends Error {
3023
+ class IdentityErrorError extends Error {
2784
3024
  constructor(body) {
2785
3025
  super(
2786
- `LOCK_GENERATION_FAILED: ${body.message}`
3026
+ `IDENTITY_ERROR: ${body.message}`
2787
3027
  );
2788
3028
  this.body = body;
2789
- this.name = "LockGenerationFailedError";
3029
+ this.name = "IdentityErrorError";
2790
3030
  }
2791
- static code = "LOCK_GENERATION_FAILED";
3031
+ static code = "IDENTITY_ERROR";
2792
3032
  static statusCode = 500;
2793
- static description = `Failed to generate lock file: {message}`;
3033
+ static description = `Failed to manage identity: {message}`;
2794
3034
  }
2795
- class WriteScriptFailedError extends Error {
3035
+ class GetContentFailedError extends Error {
2796
3036
  constructor(body) {
2797
3037
  super(
2798
- `WRITE_SCRIPT_FAILED: ${body.message}`
3038
+ `GET_CONTENT_FAILED: ${body.message}`
2799
3039
  );
2800
3040
  this.body = body;
2801
- this.name = "WriteScriptFailedError";
3041
+ this.name = "GetContentFailedError";
2802
3042
  }
2803
- static code = "WRITE_SCRIPT_FAILED";
3043
+ static code = "GET_CONTENT_FAILED";
2804
3044
  static statusCode = 500;
2805
- static description = `Failed to write script file: {message}`;
3045
+ static description = `Failed to get content: {message}`;
2806
3046
  }
2807
- class DirectoryCreationFailedError extends Error {
3047
+ class ContentNotFoundError extends Error {
2808
3048
  constructor(body) {
2809
3049
  super(
2810
- `DIRECTORY_CREATION_FAILED: ${body.message}`
3050
+ `CONTENT_NOT_FOUND: ${body.message}`
2811
3051
  );
2812
3052
  this.body = body;
2813
- this.name = "DirectoryCreationFailedError";
3053
+ this.name = "ContentNotFoundError";
2814
3054
  }
2815
- static code = "DIRECTORY_CREATION_FAILED";
2816
- static statusCode = 500;
2817
- static description = `Failed to create script directory: {message}`;
3055
+ static code = "CONTENT_NOT_FOUND";
3056
+ static statusCode = 404;
3057
+ static description = `Content not found: {path}`;
2818
3058
  }
2819
- class NetworkPermissionsFailedError extends Error {
3059
+ class DownloadFailedError extends Error {
2820
3060
  constructor(body) {
2821
3061
  super(
2822
- `NETWORK_PERMISSIONS_FAILED: ${body.message}`
3062
+ `DOWNLOAD_FAILED: ${body.message}`
2823
3063
  );
2824
3064
  this.body = body;
2825
- this.name = "NetworkPermissionsFailedError";
3065
+ this.name = "DownloadFailedError";
2826
3066
  }
2827
- static code = "NETWORK_PERMISSIONS_FAILED";
3067
+ static code = "DOWNLOAD_FAILED";
2828
3068
  static statusCode = 500;
2829
- static description = `Failed to insert network permissions: {message}`;
3069
+ static description = `Failed to download repository: {message}`;
2830
3070
  }
2831
- class LoggingFailedError extends Error {
3071
+ class GitServerErrorError extends Error {
2832
3072
  constructor(body) {
2833
3073
  super(
2834
- `LOGGING_FAILED: ${body.message}`
3074
+ `GIT_SERVER_ERROR: ${body.message}`
2835
3075
  );
2836
3076
  this.body = body;
2837
- this.name = "LoggingFailedError";
3077
+ this.name = "GitServerErrorError";
2838
3078
  }
2839
- static code = "LOGGING_FAILED";
3079
+ static code = "GIT_SERVER_ERROR";
2840
3080
  static statusCode = 500;
2841
- static description = `Failed to log execute run: {message}`;
3081
+ static description = `Git server error: {message}`;
2842
3082
  }
2843
- class RunNotFoundError extends Error {
3083
+ class ParseResponseErrorError extends Error {
2844
3084
  constructor(body) {
2845
3085
  super(
2846
- `RUN_NOT_FOUND: ${body.message}`
3086
+ `PARSE_RESPONSE_ERROR: ${body.message}`
2847
3087
  );
2848
3088
  this.body = body;
2849
- this.name = "RunNotFoundError";
3089
+ this.name = "ParseResponseErrorError";
2850
3090
  }
2851
- static code = "RUN_NOT_FOUND";
2852
- static statusCode = 404;
2853
- static description = `Execute run not found: {run_id}`;
3091
+ static code = "PARSE_RESPONSE_ERROR";
3092
+ static statusCode = 500;
3093
+ static description = `Failed to parse response from Git server: {message}`;
2854
3094
  }
2855
- class UnauthorizedErrorError extends Error {
3095
+ class RepositoryAccessDeniedError extends Error {
2856
3096
  constructor(body) {
2857
3097
  super(
2858
- `UNAUTHORIZED_ERROR: ${body.message}`
3098
+ `REPOSITORY_ACCESS_DENIED: ${body.message}`
2859
3099
  );
2860
3100
  this.body = body;
2861
- this.name = "UnauthorizedErrorError";
3101
+ this.name = "RepositoryAccessDeniedError";
2862
3102
  }
2863
- static code = "UNAUTHORIZED_ERROR";
2864
- static statusCode = 401;
2865
- static description = `Unauthorized request to {route}`;
3103
+ static code = "REPOSITORY_ACCESS_DENIED";
3104
+ static statusCode = 403;
3105
+ static description = `Repository does not belong to account`;
2866
3106
  }
2867
- class GitRepoLimitExceededError extends Error {
3107
+ class GitHubSyncFailedError extends Error {
2868
3108
  constructor(body) {
2869
3109
  super(
2870
- `GIT_REPO_LIMIT_EXCEEDED: ${body.message}`
3110
+ `GIT_HUB_SYNC_FAILED: ${body.message}`
2871
3111
  );
2872
3112
  this.body = body;
2873
- this.name = "GitRepoLimitExceededError";
3113
+ this.name = "GitHubSyncFailedError";
2874
3114
  }
2875
- static code = "GIT_REPO_LIMIT_EXCEEDED";
2876
- static statusCode = 403;
2877
- static description = `Repository limit exceeded: your plan allows {limit} repositories, you currently have {current}`;
3115
+ static code = "GIT_HUB_SYNC_FAILED";
3116
+ static statusCode = 500;
3117
+ static description = `Failed to configure GitHub sync: {message}`;
2878
3118
  }
2879
- class EmptyTagError extends Error {
3119
+ class UpdateDefaultBranchFailedError extends Error {
2880
3120
  constructor(body) {
2881
3121
  super(
2882
- `EMPTY_TAG: ${body.message}`
3122
+ `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2883
3123
  );
2884
3124
  this.body = body;
2885
- this.name = "EmptyTagError";
3125
+ this.name = "UpdateDefaultBranchFailedError";
2886
3126
  }
2887
- static code = "EMPTY_TAG";
2888
- static statusCode = 400;
2889
- static description = `Invalid request: tag cannot be empty`;
3127
+ static code = "UPDATE_DEFAULT_BRANCH_FAILED";
3128
+ static statusCode = 500;
3129
+ static description = `Failed to update default branch: {message}`;
2890
3130
  }
2891
- class PermissionAlreadyExistsError extends Error {
3131
+ class GetRepositoryInfoFailedError extends Error {
2892
3132
  constructor(body) {
2893
3133
  super(
2894
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
3134
+ `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2895
3135
  );
2896
3136
  this.body = body;
2897
- this.name = "PermissionAlreadyExistsError";
3137
+ this.name = "GetRepositoryInfoFailedError";
2898
3138
  }
2899
- static code = "PERMISSION_ALREADY_EXISTS";
2900
- static statusCode = 409;
2901
- static description = `Permission already exists`;
3139
+ static code = "GET_REPOSITORY_INFO_FAILED";
3140
+ static statusCode = 500;
3141
+ static description = `Failed to get repository info: {message}`;
2902
3142
  }
2903
- class ListTokensFailedError extends Error {
3143
+ class ListRepositoriesFailedError extends Error {
2904
3144
  constructor(body) {
2905
3145
  super(
2906
- `LIST_TOKENS_FAILED: ${body.message}`
3146
+ `LIST_REPOSITORIES_FAILED: ${body.message}`
2907
3147
  );
2908
3148
  this.body = body;
2909
- this.name = "ListTokensFailedError";
3149
+ this.name = "ListRepositoriesFailedError";
2910
3150
  }
2911
- static code = "LIST_TOKENS_FAILED";
3151
+ static code = "LIST_REPOSITORIES_FAILED";
2912
3152
  static statusCode = 500;
2913
- static description = `Failed to list tokens: {message}`;
3153
+ static description = `Failed to list repositories: {message}`;
2914
3154
  }
2915
- class RevokeTokenFailedError extends Error {
3155
+ class DeleteRepositoryFailedError extends Error {
2916
3156
  constructor(body) {
2917
3157
  super(
2918
- `REVOKE_TOKEN_FAILED: ${body.message}`
3158
+ `DELETE_REPOSITORY_FAILED: ${body.message}`
2919
3159
  );
2920
3160
  this.body = body;
2921
- this.name = "RevokeTokenFailedError";
3161
+ this.name = "DeleteRepositoryFailedError";
2922
3162
  }
2923
- static code = "REVOKE_TOKEN_FAILED";
3163
+ static code = "DELETE_REPOSITORY_FAILED";
2924
3164
  static statusCode = 500;
2925
- static description = `Failed to revoke token: {message}`;
3165
+ static description = `Failed to delete repository: {message}`;
2926
3166
  }
2927
- class CreateTokenFailedError extends Error {
3167
+ class CreateRepositoryFailedError extends Error {
2928
3168
  constructor(body) {
2929
3169
  super(
2930
- `CREATE_TOKEN_FAILED: ${body.message}`
3170
+ `CREATE_REPOSITORY_FAILED: ${body.message}`
2931
3171
  );
2932
3172
  this.body = body;
2933
- this.name = "CreateTokenFailedError";
3173
+ this.name = "CreateRepositoryFailedError";
2934
3174
  }
2935
- static code = "CREATE_TOKEN_FAILED";
3175
+ static code = "CREATE_REPOSITORY_FAILED";
2936
3176
  static statusCode = 500;
2937
- static description = `Failed to create token: {message}`;
3177
+ static description = `Failed to create repository: {message}`;
2938
3178
  }
2939
- class ListPermissionsFailedError extends Error {
3179
+ class SerializationErrorError extends Error {
2940
3180
  constructor(body) {
2941
3181
  super(
2942
- `LIST_PERMISSIONS_FAILED: ${body.message}`
3182
+ `SERIALIZATION_ERROR: ${body.message}`
2943
3183
  );
2944
3184
  this.body = body;
2945
- this.name = "ListPermissionsFailedError";
3185
+ this.name = "SerializationErrorError";
2946
3186
  }
2947
- static code = "LIST_PERMISSIONS_FAILED";
2948
- static statusCode = 500;
2949
- static description = `Failed to list permissions: {message}`;
3187
+ static code = "SERIALIZATION_ERROR";
3188
+ static statusCode = 400;
3189
+ static description = `Failed to serialize request: {message}`;
2950
3190
  }
2951
- class GetPermissionFailedError extends Error {
3191
+ class GitInvalidRequestError extends Error {
2952
3192
  constructor(body) {
2953
3193
  super(
2954
- `GET_PERMISSION_FAILED: ${body.message}`
3194
+ `GIT_INVALID_REQUEST: ${body.message}`
2955
3195
  );
2956
3196
  this.body = body;
2957
- this.name = "GetPermissionFailedError";
3197
+ this.name = "GitInvalidRequestError";
2958
3198
  }
2959
- static code = "GET_PERMISSION_FAILED";
2960
- static statusCode = 500;
2961
- static description = `Failed to get permission: {message}`;
3199
+ static code = "GIT_INVALID_REQUEST";
3200
+ static statusCode = 400;
3201
+ static description = `Invalid request: {message}`;
2962
3202
  }
2963
- class UpdatePermissionFailedError extends Error {
3203
+ class RepositoryNotFoundError extends Error {
2964
3204
  constructor(body) {
2965
3205
  super(
2966
- `UPDATE_PERMISSION_FAILED: ${body.message}`
3206
+ `REPOSITORY_NOT_FOUND: ${body.message}`
2967
3207
  );
2968
3208
  this.body = body;
2969
- this.name = "UpdatePermissionFailedError";
3209
+ this.name = "RepositoryNotFoundError";
2970
3210
  }
2971
- static code = "UPDATE_PERMISSION_FAILED";
2972
- static statusCode = 500;
2973
- static description = `Failed to update permission: {message}`;
3211
+ static code = "REPOSITORY_NOT_FOUND";
3212
+ static statusCode = 404;
3213
+ static description = `Repository not found: {repo_id}`;
2974
3214
  }
2975
- class RevokePermissionFailedError extends Error {
3215
+ class ExecuteInternalErrorError extends Error {
2976
3216
  constructor(body) {
2977
3217
  super(
2978
- `REVOKE_PERMISSION_FAILED: ${body.message}`
3218
+ `EXECUTE_INTERNAL_ERROR: ${body.message}`
2979
3219
  );
2980
3220
  this.body = body;
2981
- this.name = "RevokePermissionFailedError";
3221
+ this.name = "ExecuteInternalErrorError";
2982
3222
  }
2983
- static code = "REVOKE_PERMISSION_FAILED";
3223
+ static code = "EXECUTE_INTERNAL_ERROR";
2984
3224
  static statusCode = 500;
2985
- static description = `Failed to revoke permission: {message}`;
3225
+ static description = `Internal error: {message}`;
2986
3226
  }
2987
- class GrantPermissionFailedError extends Error {
3227
+ class ExecuteAccessDeniedError extends Error {
2988
3228
  constructor(body) {
2989
3229
  super(
2990
- `GRANT_PERMISSION_FAILED: ${body.message}`
3230
+ `EXECUTE_ACCESS_DENIED: ${body.message}`
2991
3231
  );
2992
3232
  this.body = body;
2993
- this.name = "GrantPermissionFailedError";
3233
+ this.name = "ExecuteAccessDeniedError";
2994
3234
  }
2995
- static code = "GRANT_PERMISSION_FAILED";
2996
- static statusCode = 500;
2997
- static description = `Failed to grant permission: {message}`;
3235
+ static code = "EXECUTE_ACCESS_DENIED";
3236
+ static statusCode = 403;
3237
+ static description = `Access denied to execute run`;
2998
3238
  }
2999
- class ListIdentitiesFailedError extends Error {
3239
+ class ListRunsFailedError extends Error {
3000
3240
  constructor(body) {
3001
3241
  super(
3002
- `LIST_IDENTITIES_FAILED: ${body.message}`
3242
+ `LIST_RUNS_FAILED: ${body.message}`
3003
3243
  );
3004
3244
  this.body = body;
3005
- this.name = "ListIdentitiesFailedError";
3245
+ this.name = "ListRunsFailedError";
3006
3246
  }
3007
- static code = "LIST_IDENTITIES_FAILED";
3247
+ static code = "LIST_RUNS_FAILED";
3008
3248
  static statusCode = 500;
3009
- static description = `Failed to list identities: {message}`;
3249
+ static description = `Failed to list execute runs: {message}`;
3010
3250
  }
3011
- class DeleteIdentityFailedError extends Error {
3251
+ class ExecutionErrorError extends Error {
3012
3252
  constructor(body) {
3013
3253
  super(
3014
- `DELETE_IDENTITY_FAILED: ${body.message}`
3254
+ `EXECUTION_ERROR: ${body.message}`
3015
3255
  );
3016
3256
  this.body = body;
3017
- this.name = "DeleteIdentityFailedError";
3257
+ this.name = "ExecutionErrorError";
3018
3258
  }
3019
- static code = "DELETE_IDENTITY_FAILED";
3259
+ static code = "EXECUTION_ERROR";
3020
3260
  static statusCode = 500;
3021
- static description = `Failed to delete identity: {message}`;
3261
+ static description = `Script execution error: {message}`;
3022
3262
  }
3023
- class CreateIdentityFailedError extends Error {
3263
+ class ConnectionFailedError extends Error {
3024
3264
  constructor(body) {
3025
3265
  super(
3026
- `CREATE_IDENTITY_FAILED: ${body.message}`
3266
+ `CONNECTION_FAILED: ${body.message}`
3027
3267
  );
3028
3268
  this.body = body;
3029
- this.name = "CreateIdentityFailedError";
3269
+ this.name = "ConnectionFailedError";
3030
3270
  }
3031
- static code = "CREATE_IDENTITY_FAILED";
3271
+ static code = "CONNECTION_FAILED";
3032
3272
  static statusCode = 500;
3033
- static description = `Failed to create identity: {message}`;
3273
+ static description = `Failed to connect to execute server: {message}`;
3034
3274
  }
3035
- class VmPermissionNotFoundError extends Error {
3275
+ class MetadataWriteFailedError extends Error {
3036
3276
  constructor(body) {
3037
3277
  super(
3038
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
3278
+ `METADATA_WRITE_FAILED: ${body.message}`
3039
3279
  );
3040
3280
  this.body = body;
3041
- this.name = "VmPermissionNotFoundError";
3281
+ this.name = "MetadataWriteFailedError";
3042
3282
  }
3043
- static code = "VM_PERMISSION_NOT_FOUND";
3044
- static statusCode = 404;
3045
- static description = `VM permission not found`;
3283
+ static code = "METADATA_WRITE_FAILED";
3284
+ static statusCode = 500;
3285
+ static description = `Failed to write metadata file: {message}`;
3046
3286
  }
3047
- class PermissionNotFoundError extends Error {
3287
+ class NodeModulesInstallFailedError extends Error {
3048
3288
  constructor(body) {
3049
3289
  super(
3050
- `PERMISSION_NOT_FOUND: ${body.message}`
3290
+ `NODE_MODULES_INSTALL_FAILED: ${body.message}`
3051
3291
  );
3052
3292
  this.body = body;
3053
- this.name = "PermissionNotFoundError";
3293
+ this.name = "NodeModulesInstallFailedError";
3054
3294
  }
3055
- static code = "PERMISSION_NOT_FOUND";
3056
- static statusCode = 404;
3057
- static description = `Permission not found`;
3295
+ static code = "NODE_MODULES_INSTALL_FAILED";
3296
+ static statusCode = 500;
3297
+ static description = `Failed to install node modules: {message}`;
3058
3298
  }
3059
- class GitRepositoryAccessDeniedError extends Error {
3299
+ class NodeModulesDownloadFailedError extends Error {
3060
3300
  constructor(body) {
3061
3301
  super(
3062
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
3302
+ `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
3063
3303
  );
3064
3304
  this.body = body;
3065
- this.name = "GitRepositoryAccessDeniedError";
3305
+ this.name = "NodeModulesDownloadFailedError";
3066
3306
  }
3067
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
3068
- static statusCode = 403;
3069
- static description = `You are not allowed to access this repository`;
3307
+ static code = "NODE_MODULES_DOWNLOAD_FAILED";
3308
+ static statusCode = 500;
3309
+ static description = `Failed to download node modules: {message}`;
3070
3310
  }
3071
- class GitRepositoryNotFoundError extends Error {
3311
+ class LockGenerationFailedError extends Error {
3072
3312
  constructor(body) {
3073
3313
  super(
3074
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
3314
+ `LOCK_GENERATION_FAILED: ${body.message}`
3075
3315
  );
3076
3316
  this.body = body;
3077
- this.name = "GitRepositoryNotFoundError";
3317
+ this.name = "LockGenerationFailedError";
3078
3318
  }
3079
- static code = "GIT_REPOSITORY_NOT_FOUND";
3080
- static statusCode = 404;
3081
- static description = `Repository not found`;
3319
+ static code = "LOCK_GENERATION_FAILED";
3320
+ static statusCode = 500;
3321
+ static description = `Failed to generate lock file: {message}`;
3082
3322
  }
3083
- class CannotDeleteManagedIdentityError extends Error {
3323
+ class WriteScriptFailedError extends Error {
3084
3324
  constructor(body) {
3085
3325
  super(
3086
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
3326
+ `WRITE_SCRIPT_FAILED: ${body.message}`
3087
3327
  );
3088
3328
  this.body = body;
3089
- this.name = "CannotDeleteManagedIdentityError";
3329
+ this.name = "WriteScriptFailedError";
3090
3330
  }
3091
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
3092
- static statusCode = 403;
3093
- static description = `Cannot delete managed identities`;
3331
+ static code = "WRITE_SCRIPT_FAILED";
3332
+ static statusCode = 500;
3333
+ static description = `Failed to write script file: {message}`;
3094
3334
  }
3095
- class CannotModifyManagedIdentityError extends Error {
3335
+ class DirectoryCreationFailedError extends Error {
3096
3336
  constructor(body) {
3097
3337
  super(
3098
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
3338
+ `DIRECTORY_CREATION_FAILED: ${body.message}`
3099
3339
  );
3100
3340
  this.body = body;
3101
- this.name = "CannotModifyManagedIdentityError";
3341
+ this.name = "DirectoryCreationFailedError";
3102
3342
  }
3103
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
3104
- static statusCode = 403;
3105
- static description = `Cannot modify managed identities`;
3343
+ static code = "DIRECTORY_CREATION_FAILED";
3344
+ static statusCode = 500;
3345
+ static description = `Failed to create script directory: {message}`;
3106
3346
  }
3107
- class IdentityAccessDeniedError extends Error {
3347
+ class NetworkPermissionsFailedError extends Error {
3108
3348
  constructor(body) {
3109
3349
  super(
3110
- `IDENTITY_ACCESS_DENIED: ${body.message}`
3350
+ `NETWORK_PERMISSIONS_FAILED: ${body.message}`
3111
3351
  );
3112
3352
  this.body = body;
3113
- this.name = "IdentityAccessDeniedError";
3353
+ this.name = "NetworkPermissionsFailedError";
3114
3354
  }
3115
- static code = "IDENTITY_ACCESS_DENIED";
3116
- static statusCode = 403;
3117
- static description = `You are not allowed to access this identity`;
3355
+ static code = "NETWORK_PERMISSIONS_FAILED";
3356
+ static statusCode = 500;
3357
+ static description = `Failed to insert network permissions: {message}`;
3118
3358
  }
3119
- class IdentityNotFoundError extends Error {
3359
+ class LoggingFailedError extends Error {
3120
3360
  constructor(body) {
3121
3361
  super(
3122
- `IDENTITY_NOT_FOUND: ${body.message}`
3362
+ `LOGGING_FAILED: ${body.message}`
3123
3363
  );
3124
3364
  this.body = body;
3125
- this.name = "IdentityNotFoundError";
3365
+ this.name = "LoggingFailedError";
3126
3366
  }
3127
- static code = "IDENTITY_NOT_FOUND";
3128
- static statusCode = 404;
3129
- static description = `Identity not found`;
3367
+ static code = "LOGGING_FAILED";
3368
+ static statusCode = 500;
3369
+ static description = `Failed to log execute run: {message}`;
3130
3370
  }
3131
- class LimitExceededError extends Error {
3371
+ class RunNotFoundError extends Error {
3132
3372
  constructor(body) {
3133
3373
  super(
3134
- `LIMIT_EXCEEDED: ${body.message}`
3374
+ `RUN_NOT_FOUND: ${body.message}`
3135
3375
  );
3136
3376
  this.body = body;
3137
- this.name = "LimitExceededError";
3377
+ this.name = "RunNotFoundError";
3138
3378
  }
3139
- static code = "LIMIT_EXCEEDED";
3140
- static statusCode = 403;
3141
- static description = `Managed domains limit exceeded: your plan allows {limit} verified domains, you have {current}`;
3379
+ static code = "RUN_NOT_FOUND";
3380
+ static statusCode = 404;
3381
+ static description = `Execute run not found: {run_id}`;
3142
3382
  }
3143
- class FailedToProvisionCertificateError extends Error {
3383
+ class DomainOwnershipNotVerifiedError extends Error {
3144
3384
  constructor(body) {
3145
3385
  super(
3146
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
3386
+ `DOMAIN_OWNERSHIP_NOT_VERIFIED: ${body.message}`
3147
3387
  );
3148
3388
  this.body = body;
3149
- this.name = "FailedToProvisionCertificateError";
3389
+ this.name = "DomainOwnershipNotVerifiedError";
3150
3390
  }
3151
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
3152
- static statusCode = 422;
3153
- static description = `Failed to provision certificate: {message}`;
3391
+ static code = "DOMAIN_OWNERSHIP_NOT_VERIFIED";
3392
+ static statusCode = 401;
3393
+ static description = `You have not verified ownership of domain: {domain}`;
3154
3394
  }
3155
- class FailedToInsertDomainMappingError extends Error {
3395
+ class VmAccessDeniedForMappingError extends Error {
3156
3396
  constructor(body) {
3157
3397
  super(
3158
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
3398
+ `VM_ACCESS_DENIED_FOR_MAPPING: ${body.message}`
3159
3399
  );
3160
3400
  this.body = body;
3161
- this.name = "FailedToInsertDomainMappingError";
3401
+ this.name = "VmAccessDeniedForMappingError";
3162
3402
  }
3163
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
3164
- static statusCode = 500;
3165
- static description = `Failed to insert domain mapping: {message}`;
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}`;
3166
3406
  }
3167
- class PermissionDeniedError extends Error {
3407
+ class DeploymentAccessDeniedError extends Error {
3168
3408
  constructor(body) {
3169
3409
  super(
3170
- `PERMISSION_DENIED: ${body.message}`
3410
+ `DEPLOYMENT_ACCESS_DENIED: ${body.message}`
3171
3411
  );
3172
3412
  this.body = body;
3173
- this.name = "PermissionDeniedError";
3413
+ this.name = "DeploymentAccessDeniedError";
3174
3414
  }
3175
- static code = "PERMISSION_DENIED";
3415
+ static code = "DEPLOYMENT_ACCESS_DENIED";
3176
3416
  static statusCode = 401;
3177
- static description = `Permission denied: {message}`;
3417
+ static description = `You do not have permission to map to this deployment: {deployment_id}`;
3178
3418
  }
3179
- class FailedToCheckPermissionsError extends Error {
3419
+ class FailedToProvisionCertificateForMappingError extends Error {
3180
3420
  constructor(body) {
3181
3421
  super(
3182
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
3422
+ `FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING: ${body.message}`
3183
3423
  );
3184
3424
  this.body = body;
3185
- this.name = "FailedToCheckPermissionsError";
3425
+ this.name = "FailedToProvisionCertificateForMappingError";
3186
3426
  }
3187
- static code = "FAILED_TO_CHECK_PERMISSIONS";
3188
- static statusCode = 502;
3189
- static description = `Failed to check permissions: {message}`;
3427
+ static code = "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING";
3428
+ static statusCode = 422;
3429
+ static description = `Failed to provision certificate for mapping: {message}`;
3190
3430
  }
3191
- class FailedToListDomainsError extends Error {
3431
+ class FailedInsertDomainMappingError extends Error {
3192
3432
  constructor(body) {
3193
3433
  super(
3194
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
3434
+ `FAILED_INSERT_DOMAIN_MAPPING: ${body.message}`
3195
3435
  );
3196
3436
  this.body = body;
3197
- this.name = "FailedToListDomainsError";
3437
+ this.name = "FailedInsertDomainMappingError";
3198
3438
  }
3199
- static code = "FAILED_TO_LIST_DOMAINS";
3439
+ static code = "FAILED_INSERT_DOMAIN_MAPPING";
3200
3440
  static statusCode = 500;
3201
- static description = `Failed to list domains: {message}`;
3441
+ static description = `Failed to insert domain mapping: {message}`;
3202
3442
  }
3203
- class FailedToListVerificationsError extends Error {
3443
+ class DomainAlreadyExistsError extends Error {
3204
3444
  constructor(body) {
3205
3445
  super(
3206
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
3446
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
3207
3447
  );
3208
3448
  this.body = body;
3209
- this.name = "FailedToListVerificationsError";
3449
+ this.name = "DomainAlreadyExistsError";
3210
3450
  }
3211
- static code = "FAILED_TO_LIST_VERIFICATIONS";
3212
- static statusCode = 500;
3213
- static description = `Failed to list verifications: {message}`;
3451
+ static code = "DOMAIN_ALREADY_EXISTS";
3452
+ static statusCode = 400;
3453
+ static description = `Domain already exists: {domain}`;
3214
3454
  }
3215
- class FailedToVerifyDomainError extends Error {
3455
+ class FailedToInsertOwnershipError extends Error {
3216
3456
  constructor(body) {
3217
3457
  super(
3218
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
3458
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
3219
3459
  );
3220
3460
  this.body = body;
3221
- this.name = "FailedToVerifyDomainError";
3461
+ this.name = "FailedToInsertOwnershipError";
3222
3462
  }
3223
- static code = "FAILED_TO_VERIFY_DOMAIN";
3463
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
3224
3464
  static statusCode = 500;
3225
- static description = `Failed to verify domain: {message}`;
3465
+ static description = `Failed to insert domain ownership: {message}`;
3226
3466
  }
3227
- class VerificationFailedError extends Error {
3467
+ class FailedRemoveDomainMappingError extends Error {
3228
3468
  constructor(body) {
3229
3469
  super(
3230
- `VERIFICATION_FAILED: ${body.message}`
3470
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
3231
3471
  );
3232
3472
  this.body = body;
3233
- this.name = "VerificationFailedError";
3473
+ this.name = "FailedRemoveDomainMappingError";
3234
3474
  }
3235
- static code = "VERIFICATION_FAILED";
3236
- static statusCode = 400;
3237
- static description = `Domain verification failed: {message}`;
3475
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
3476
+ static statusCode = 500;
3477
+ static description = `Failed to remove domain mapping: {message}`;
3238
3478
  }
3239
- class FailedToDeleteVerificationError extends Error {
3479
+ class FailedPermissionsCheckError extends Error {
3240
3480
  constructor(body) {
3241
3481
  super(
3242
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
3482
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
3243
3483
  );
3244
3484
  this.body = body;
3245
- this.name = "FailedToDeleteVerificationError";
3485
+ this.name = "FailedPermissionsCheckError";
3246
3486
  }
3247
- static code = "FAILED_TO_DELETE_VERIFICATION";
3248
- static statusCode = 400;
3249
- static description = `Failed to delete verification: {message}`;
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}`;
3250
3490
  }
3251
- class VerificationNotFoundError extends Error {
3491
+ class FailedToCheckDomainMappingPermissionsError extends Error {
3252
3492
  constructor(body) {
3253
3493
  super(
3254
- `VERIFICATION_NOT_FOUND: ${body.message}`
3494
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
3255
3495
  );
3256
3496
  this.body = body;
3257
- this.name = "VerificationNotFoundError";
3497
+ this.name = "FailedToCheckDomainMappingPermissionsError";
3258
3498
  }
3259
- static code = "VERIFICATION_NOT_FOUND";
3260
- static statusCode = 404;
3261
- static description = `Verification request not found for domain: {domain}`;
3499
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
3500
+ static statusCode = 502;
3501
+ static description = `Failed to check permissions: {message}`;
3262
3502
  }
3263
- class FailedToCreateVerificationCodeError extends Error {
3503
+ class EmptyTagError extends Error {
3264
3504
  constructor(body) {
3265
3505
  super(
3266
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
3506
+ `EMPTY_TAG: ${body.message}`
3267
3507
  );
3268
3508
  this.body = body;
3269
- this.name = "FailedToCreateVerificationCodeError";
3509
+ this.name = "EmptyTagError";
3270
3510
  }
3271
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
3511
+ static code = "EMPTY_TAG";
3272
3512
  static statusCode = 400;
3273
- static description = `Failed to create verification code: {message}`;
3513
+ static description = `Invalid request: tag cannot be empty`;
3274
3514
  }
3275
- class InvalidDomainError extends Error {
3515
+ class BranchNameEmptyError extends Error {
3276
3516
  constructor(body) {
3277
3517
  super(
3278
- `INVALID_DOMAIN: ${body.message}`
3518
+ `BRANCH_NAME_EMPTY: ${body.message}`
3279
3519
  );
3280
3520
  this.body = body;
3281
- this.name = "InvalidDomainError";
3521
+ this.name = "BranchNameEmptyError";
3282
3522
  }
3283
- static code = "INVALID_DOMAIN";
3523
+ static code = "BRANCH_NAME_EMPTY";
3284
3524
  static statusCode = 400;
3285
- static description = `Invalid domain: {domain}`;
3525
+ static description = `Branch name cannot be empty`;
3286
3526
  }
3287
3527
  const FREESTYLE_ERROR_CODE_MAP = {
3528
+ "GIT_ERROR": GitErrorError,
3288
3529
  "BAD_PARSE": BadParseError,
3289
3530
  "BAD_TIMESTAMP": BadTimestampError,
3290
3531
  "BAD_SIGNATURE": BadSignatureError,
3291
3532
  "BAD_HEADER": BadHeaderError,
3292
3533
  "BAD_KEY": BadKeyError,
3293
- "GIT_ERROR": GitErrorError,
3294
- "SUSPEND_FAILED_AND_STOP_FAILED": SuspendFailedAndStopFailedError,
3295
- "SUSPEND_FAILED_AND_STOPPED": SuspendFailedAndStoppedError,
3296
- "INVALID_GIT_REPO_SPEC_ERROR": InvalidGitRepoSpecErrorError,
3297
- "INTERNAL_ERROR": InternalErrorError,
3298
- "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
3299
- "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
3300
- "SNAPSHOT_NOT_FOUND": SnapshotNotFoundError,
3301
- "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3302
- "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3303
- "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3304
- "KERNEL_PANIC": KernelPanicError,
3305
- "VM_DELETED": VmDeletedError,
3306
- "REQWEST": ReqwestError,
3307
- "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3308
- "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
3309
- "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
3310
- "VM_START_TIMEOUT": VmStartTimeoutError,
3311
- "VM_IS_SUSPENDING": VmIsSuspendingError,
3312
- "VM_EXIT_DURING_START": VmExitDuringStartError,
3313
- "VM_ACCESS_DENIED": VmAccessDeniedError,
3314
- "FAILED_TO_SPAWN_UFFD": FailedToSpawnUffdError,
3315
- "VM_SPAWN_PROCESS": VmSpawnProcessError,
3316
- "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3317
3534
  "SNAPSHOT_SETUP_FAILED": SnapshotSetupFailedError,
3318
3535
  "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
3319
- "SNAPSHOT_IS_ACCOUNT_DEFAULT": SnapshotIsAccountDefaultError,
3320
- "SNAPSHOT_ALREADY_DELETED": SnapshotAlreadyDeletedError,
3321
- "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3322
- "VM_NOT_RUNNING": VmNotRunningError,
3323
- "VM_NOT_FOUND": VmNotFoundError,
3324
- "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3325
- "BAD_REQUEST": BadRequestError,
3326
- "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
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,
3327
3543
  "NO_DEFAULT_SNAPSHOT_AVAILABLE": NoDefaultSnapshotAvailableError,
3328
3544
  "DOCKER_SNAPSHOT_FAILED": DockerSnapshotFailedError,
3329
3545
  "SET_DEFAULT_SNAPSHOT_FAILED": SetDefaultSnapshotFailedError,
@@ -3331,6 +3547,15 @@ const FREESTYLE_ERROR_CODE_MAP = {
3331
3547
  "SNAPSHOT_DIR_NOT_FOUND": SnapshotDirNotFoundError,
3332
3548
  "SUBVOLUME_CREATION_FAILED": SubvolumeCreationFailedError,
3333
3549
  "GET_DEFAULT_SNAPSHOT_FAILED": GetDefaultSnapshotFailedError,
3550
+ "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
3551
+ "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
3552
+ "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,
3334
3559
  "USER_NOT_FOUND": UserNotFoundError,
3335
3560
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
3336
3561
  "VALIDATION_ERROR": ValidationErrorError,
@@ -3347,17 +3572,46 @@ const FREESTYLE_ERROR_CODE_MAP = {
3347
3572
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
3348
3573
  "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
3349
3574
  "GROUP_NAME_EMPTY": GroupNameEmptyError,
3575
+ "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
3576
+ "VM_NOT_RUNNING": VmNotRunningError,
3577
+ "VM_NOT_FOUND": VmNotFoundError,
3578
+ "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
3579
+ "BAD_REQUEST": BadRequestError,
3580
+ "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
3581
+ "SNAPSHOT_NOT_FOUND": SnapshotNotFoundError,
3582
+ "RESUMED_VM_NON_RESPONSIVE": ResumedVmNonResponsiveError,
3583
+ "SNAPSHOT_LOAD_TIMEOUT": SnapshotLoadTimeoutError,
3584
+ "UFFD_TIMEOUT_ERROR": UffdTimeoutErrorError,
3585
+ "KERNEL_PANIC": KernelPanicError,
3586
+ "VM_DELETED": VmDeletedError,
3587
+ "REQWEST": ReqwestError,
3588
+ "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
3589
+ "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
3590
+ "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
3591
+ "VM_START_TIMEOUT": VmStartTimeoutError,
3592
+ "VM_IS_SUSPENDING": VmIsSuspendingError,
3593
+ "VM_EXIT_DURING_START": VmExitDuringStartError,
3594
+ "VM_ACCESS_DENIED": VmAccessDeniedError,
3595
+ "FAILED_TO_SPAWN_UFFD": FailedToSpawnUffdError,
3596
+ "VM_SPAWN_PROCESS": VmSpawnProcessError,
3597
+ "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
3598
+ "PARTITION_NOT_FOUND": PartitionNotFoundError,
3350
3599
  "ACTIVE_TRANSACTION_ERROR": ActiveTransactionErrorError,
3351
3600
  "SWAP_VM_TAP": SwapVmTapError,
3352
3601
  "ROOTFS_COPY_ERROR": RootfsCopyErrorError,
3353
- "PARTITION_NOT_FOUND": PartitionNotFoundError,
3354
3602
  "FILE_NOT_FOUND": FileNotFoundError,
3355
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,
3356
3608
  "DATABASE_ERROR": DatabaseErrorError,
3357
3609
  "INVALID_VM_ID": InvalidVmIdError,
3358
- "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
3359
- "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
3360
- "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
3610
+ "CREATE_VM_MEM_NOT_POWER_OF_TWO": CreateVmMemNotPowerOfTwoError,
3611
+ "CREATE_VM_VCPU_NOT_POWER_OF_TWO": CreateVmVcpuNotPowerOfTwoError,
3612
+ "CREATE_VM_ROOTFS_OUT_OF_RANGE": CreateVmRootfsOutOfRangeError,
3613
+ "CREATE_VM_MEM_OUT_OF_RANGE": CreateVmMemOutOfRangeError,
3614
+ "CREATE_VM_VCPU_OUT_OF_RANGE": CreateVmVcpuOutOfRangeError,
3361
3615
  "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
3362
3616
  "VM_SETUP_FAILED": VmSetupFailedError,
3363
3617
  "WANTED_BY_EMPTY": WantedByEmptyError,
@@ -3386,21 +3640,25 @@ const FREESTYLE_ERROR_CODE_MAP = {
3386
3640
  "INVALID_PARAMETERS": InvalidParametersError,
3387
3641
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
3388
3642
  "EXPIRED": ExpiredError,
3389
- "BRANCH_NOT_FOUND": BranchNotFoundError,
3390
- "BRANCH_ALREADY_EXISTS": BranchAlreadyExistsError,
3391
- "NO_DEFAULT_BRANCH": NoDefaultBranchError,
3392
- "COMMIT_NOT_FOUND": CommitNotFoundError,
3393
- "PARENT_NOT_FOUND": ParentNotFoundError,
3394
- "TREE_NOT_FOUND": TreeNotFoundError,
3643
+ "UNAUTHORIZED": UnauthorizedError,
3644
+ "FORBIDDEN": ForbiddenError,
3645
+ "INVALID_ACCOUNT_ID": InvalidAccountIdError,
3646
+ "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
3647
+ "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
3648
+ "SOURCE_NOT_FOUND": SourceNotFoundError,
3649
+ "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
3650
+ "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
3395
3651
  "PACKFILE": PackfileError,
3652
+ "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3653
+ "BRANCH_NOT_FOUND": BranchNotFoundError,
3654
+ "NOT_FOUND": NotFoundError,
3655
+ "SEND_ERROR": SendErrorError,
3396
3656
  "INVALID_REVISION": InvalidRevisionError,
3397
- "FORBIDDEN": ForbiddenError,
3398
- "UNAUTHORIZED": UnauthorizedError,
3657
+ "COMMIT_NOT_FOUND": CommitNotFoundError,
3399
3658
  "PATH_NOT_FOUND": PathNotFoundError,
3400
3659
  "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
3401
- "AMBIGUOUS": AmbiguousError,
3402
- "NOT_FOUND": NotFoundError,
3403
- "INVALID": InvalidError,
3660
+ "INVALID_SERVICE": InvalidServiceError,
3661
+ "EXPECTED_SERVICE": ExpectedServiceError,
3404
3662
  "DIFF_INVALID_PATH_PATTERN": DiffInvalidPathPatternError,
3405
3663
  "DIFF_INVALID_REGEX": DiffInvalidRegexError,
3406
3664
  "DIFF_EMPTY_QUERY": DiffEmptyQueryError,
@@ -3412,32 +3670,61 @@ const FREESTYLE_ERROR_CODE_MAP = {
3412
3670
  "INVALID_PATH_PATTERN": InvalidPathPatternError,
3413
3671
  "EMPTY_QUERY": EmptyQueryError,
3414
3672
  "CONFLICT": ConflictError,
3673
+ "NO_DEFAULT_BRANCH": NoDefaultBranchError,
3415
3674
  "INVALID_BASE64_CONTENT": InvalidBase64ContentError,
3416
3675
  "INVALID_FILE_CHANGE": InvalidFileChangeError,
3417
3676
  "INVALID_FILE_PATH": InvalidFilePathError,
3418
3677
  "CONFLICTING_PARENT": ConflictingParentError,
3419
- "INVALID_ACCOUNT_ID": InvalidAccountIdError,
3420
- "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
3421
- "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
3422
- "SOURCE_NOT_FOUND": SourceNotFoundError,
3423
- "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
3424
- "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
3425
- "SEND_ERROR": SendErrorError,
3678
+ "TREE_NOT_FOUND": TreeNotFoundError,
3679
+ "BRANCH_ALREADY_EXISTS": BranchAlreadyExistsError,
3680
+ "PARENT_NOT_FOUND": ParentNotFoundError,
3681
+ "TAG_NOT_FOUND": TagNotFoundError,
3426
3682
  "INVALID_RANGE": InvalidRangeError,
3427
3683
  "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
3428
3684
  "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
3429
- "TAG_NOT_FOUND": TagNotFoundError,
3430
- "INVALID_SERVICE": InvalidServiceError,
3431
- "EXPECTED_SERVICE": ExpectedServiceError,
3685
+ "BLOB_NOT_FOUND": BlobNotFoundError,
3686
+ "AMBIGUOUS": AmbiguousError,
3687
+ "INVALID": InvalidError,
3432
3688
  "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
3433
3689
  "INVALID_OBJECT_ID": InvalidObjectIdError,
3434
- "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
3435
- "BLOB_NOT_FOUND": BlobNotFoundError,
3436
3690
  "UNAVAILABLE": UnavailableError,
3437
3691
  "SCHEDULE_NOT_FOUND": ScheduleNotFoundError,
3438
3692
  "SERVICE_UNAVAILABLE": ServiceUnavailableError,
3439
3693
  "EXECUTE_LIMIT_EXCEEDED": ExecuteLimitExceededError,
3440
- "ACCESS_DENIED": AccessDeniedError,
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,
3441
3728
  "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
3442
3729
  "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
3443
3730
  "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
@@ -3447,6 +3734,7 @@ const FREESTYLE_ERROR_CODE_MAP = {
3447
3734
  "DEPLOYMENT_FAILED": DeploymentFailedError,
3448
3735
  "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
3449
3736
  "PROJECT_NOT_FOUND": ProjectNotFoundError,
3737
+ "ACCESS_DENIED": AccessDeniedError,
3450
3738
  "BUILD_FAILED": BuildFailedError,
3451
3739
  "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
3452
3740
  "LOCKFILE_ERROR": LockfileErrorError,
@@ -3463,7 +3751,18 @@ const FREESTYLE_ERROR_CODE_MAP = {
3463
3751
  "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
3464
3752
  "RESIZE_FAILED": ResizeFailedError,
3465
3753
  "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
3466
- "BRANCH_NAME_EMPTY": BranchNameEmptyError,
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,
3760
+ "ROOTFS_SIZE_TOO_LARGE": RootfsSizeTooLargeError,
3761
+ "MEM_SIZE_TOO_LARGE": MemSizeTooLargeError,
3762
+ "ROOTFS_OVER_PLAN_LIMIT": RootfsOverPlanLimitError,
3763
+ "MEM_OVER_PLAN_LIMIT": MemOverPlanLimitError,
3764
+ "VCPU_OVER_PLAN_LIMIT": VcpuOverPlanLimitError,
3765
+ "CUSTOM_SIZING_NOT_ALLOWED": CustomSizingNotAllowedError,
3467
3766
  "SNAPSHOT_LIMIT_EXCEEDED": SnapshotLimitExceededError,
3468
3767
  "PERSISTENT_VMS_NOT_ALLOWED": PersistentVmsNotAllowedError,
3469
3768
  "TOTAL_VM_LIMIT_EXCEEDED": TotalVmLimitExceededError,
@@ -3474,21 +3773,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
3474
3773
  "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
3475
3774
  "INVALID_QUERY": InvalidQueryError,
3476
3775
  "LOGS_NOT_FOUND": LogsNotFoundError,
3477
- "DOMAIN_OWNERSHIP_NOT_VERIFIED": DomainOwnershipNotVerifiedError,
3478
- "VM_ACCESS_DENIED_FOR_MAPPING": VmAccessDeniedForMappingError,
3479
- "DEPLOYMENT_ACCESS_DENIED": DeploymentAccessDeniedError,
3480
- "FAILED_TO_PROVISION_CERTIFICATE_FOR_MAPPING": FailedToProvisionCertificateForMappingError,
3481
- "FAILED_INSERT_DOMAIN_MAPPING": FailedInsertDomainMappingError,
3482
- "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
3483
- "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
3484
- "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
3485
- "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
3486
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
3487
- "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
3488
- "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
3489
- "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
3490
- "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
3491
- "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
3492
3776
  "TRIGGER_ERROR": TriggerErrorError,
3493
3777
  "TOKEN_ERROR": TokenErrorError,
3494
3778
  "PERMISSION_ERROR": PermissionErrorError,
@@ -3522,42 +3806,18 @@ const FREESTYLE_ERROR_CODE_MAP = {
3522
3806
  "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
3523
3807
  "LOGGING_FAILED": LoggingFailedError,
3524
3808
  "RUN_NOT_FOUND": RunNotFoundError,
3525
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
3526
- "GIT_REPO_LIMIT_EXCEEDED": GitRepoLimitExceededError,
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,
3527
3819
  "EMPTY_TAG": EmptyTagError,
3528
- "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
3529
- "LIST_TOKENS_FAILED": ListTokensFailedError,
3530
- "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
3531
- "CREATE_TOKEN_FAILED": CreateTokenFailedError,
3532
- "LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
3533
- "GET_PERMISSION_FAILED": GetPermissionFailedError,
3534
- "UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
3535
- "REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
3536
- "GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
3537
- "LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
3538
- "DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
3539
- "CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
3540
- "VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
3541
- "PERMISSION_NOT_FOUND": PermissionNotFoundError,
3542
- "GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
3543
- "GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
3544
- "CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
3545
- "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
3546
- "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
3547
- "IDENTITY_NOT_FOUND": IdentityNotFoundError,
3548
- "LIMIT_EXCEEDED": LimitExceededError,
3549
- "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
3550
- "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
3551
- "PERMISSION_DENIED": PermissionDeniedError,
3552
- "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
3553
- "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
3554
- "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
3555
- "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
3556
- "VERIFICATION_FAILED": VerificationFailedError,
3557
- "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
3558
- "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
3559
- "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
3560
- "INVALID_DOMAIN": InvalidDomainError
3820
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError
3561
3821
  };
3562
3822
 
3563
3823
  var errors = /*#__PURE__*/Object.freeze({
@@ -3590,6 +3850,7 @@ var errors = /*#__PURE__*/Object.freeze({
3590
3850
  CommitNotInBranchError: CommitNotInBranchError,
3591
3851
  ConflictError: ConflictError,
3592
3852
  ConflictingParentError: ConflictingParentError,
3853
+ ConflictingSpecSourcesErrorError: ConflictingSpecSourcesErrorError,
3593
3854
  ConnectionFailedError: ConnectionFailedError,
3594
3855
  ContentNotFoundError: ContentNotFoundError,
3595
3856
  CreateBackupFailedError: CreateBackupFailedError,
@@ -3598,6 +3859,12 @@ var errors = /*#__PURE__*/Object.freeze({
3598
3859
  CreateSnapshotBadRequestError: CreateSnapshotBadRequestError,
3599
3860
  CreateTokenFailedError: CreateTokenFailedError,
3600
3861
  CreateVmBadRequestError: CreateVmBadRequestError,
3862
+ CreateVmMemNotPowerOfTwoError: CreateVmMemNotPowerOfTwoError,
3863
+ CreateVmMemOutOfRangeError: CreateVmMemOutOfRangeError,
3864
+ CreateVmRootfsOutOfRangeError: CreateVmRootfsOutOfRangeError,
3865
+ CreateVmVcpuNotPowerOfTwoError: CreateVmVcpuNotPowerOfTwoError,
3866
+ CreateVmVcpuOutOfRangeError: CreateVmVcpuOutOfRangeError,
3867
+ CustomSizingNotAllowedError: CustomSizingNotAllowedError,
3601
3868
  DatabaseErrorError: DatabaseErrorError,
3602
3869
  DeleteIdentityFailedError: DeleteIdentityFailedError,
3603
3870
  DeleteRepositoryFailedError: DeleteRepositoryFailedError,
@@ -3626,6 +3893,7 @@ var errors = /*#__PURE__*/Object.freeze({
3626
3893
  ErrorCreatingRecordError: ErrorCreatingRecordError,
3627
3894
  ErrorDeletingRecordError: ErrorDeletingRecordError,
3628
3895
  ExecEmptyError: ExecEmptyError,
3896
+ ExecTimedOutError: ExecTimedOutError,
3629
3897
  ExecuteAccessDeniedError: ExecuteAccessDeniedError,
3630
3898
  ExecuteInternalErrorError: ExecuteInternalErrorError,
3631
3899
  ExecuteLimitExceededError: ExecuteLimitExceededError,
@@ -3718,6 +3986,8 @@ var errors = /*#__PURE__*/Object.freeze({
3718
3986
  LoggingFailedError: LoggingFailedError,
3719
3987
  LogsNotFoundError: LogsNotFoundError,
3720
3988
  MaxUsesExceededError: MaxUsesExceededError,
3989
+ MemOverPlanLimitError: MemOverPlanLimitError,
3990
+ MemSizeTooLargeError: MemSizeTooLargeError,
3721
3991
  MetadataWriteFailedError: MetadataWriteFailedError,
3722
3992
  NetworkPermissionsFailedError: NetworkPermissionsFailedError,
3723
3993
  NoDefaultBranchError: NoDefaultBranchError,
@@ -3726,6 +3996,7 @@ var errors = /*#__PURE__*/Object.freeze({
3726
3996
  NoEntrypointFoundError: NoEntrypointFoundError,
3727
3997
  NodeModulesDownloadFailedError: NodeModulesDownloadFailedError,
3728
3998
  NodeModulesInstallFailedError: NodeModulesInstallFailedError,
3999
+ NonLeafLayerFieldErrorError: NonLeafLayerFieldErrorError,
3729
4000
  NotFoundError: NotFoundError,
3730
4001
  ObservabilityAccessDeniedError: ObservabilityAccessDeniedError,
3731
4002
  ObservabilityDatabaseErrorError: ObservabilityDatabaseErrorError,
@@ -3752,12 +4023,20 @@ var errors = /*#__PURE__*/Object.freeze({
3752
4023
  RequiresArrayContainsEmptyError: RequiresArrayContainsEmptyError,
3753
4024
  ReqwestError: ReqwestError,
3754
4025
  ResizeFailedError: ResizeFailedError,
4026
+ ResizeVmEmptyRequestError: ResizeVmEmptyRequestError,
4027
+ ResizeVmMemNotPowerOfTwoError: ResizeVmMemNotPowerOfTwoError,
4028
+ ResizeVmMemOutOfRangeError: ResizeVmMemOutOfRangeError,
4029
+ ResizeVmRootfsShrinkNotSupportedError: ResizeVmRootfsShrinkNotSupportedError,
4030
+ ResizeVmVcpuNotPowerOfTwoError: ResizeVmVcpuNotPowerOfTwoError,
4031
+ ResizeVmVcpuOutOfRangeError: ResizeVmVcpuOutOfRangeError,
3755
4032
  RestoreFailedError: RestoreFailedError,
3756
4033
  ResumedVmNonResponsiveError: ResumedVmNonResponsiveError,
3757
4034
  RetrieveLogsFailedError: RetrieveLogsFailedError,
3758
4035
  RevokePermissionFailedError: RevokePermissionFailedError,
3759
4036
  RevokeTokenFailedError: RevokeTokenFailedError,
3760
4037
  RootfsCopyErrorError: RootfsCopyErrorError,
4038
+ RootfsOverPlanLimitError: RootfsOverPlanLimitError,
4039
+ RootfsSizeTooLargeError: RootfsSizeTooLargeError,
3761
4040
  RunNotFoundError: RunNotFoundError,
3762
4041
  RuntimeErrorError: RuntimeErrorError,
3763
4042
  ScheduleNotFoundError: ScheduleNotFoundError,
@@ -3813,6 +4092,7 @@ var errors = /*#__PURE__*/Object.freeze({
3813
4092
  UserSystemFlagMismatchError: UserSystemFlagMismatchError,
3814
4093
  UserUidOutOfRangeError: UserUidOutOfRangeError,
3815
4094
  ValidationErrorError: ValidationErrorError,
4095
+ VcpuOverPlanLimitError: VcpuOverPlanLimitError,
3816
4096
  VerificationFailedError: VerificationFailedError,
3817
4097
  VerificationNotFoundError: VerificationNotFoundError,
3818
4098
  VmAccessDeniedError: VmAccessDeniedError,
@@ -5427,35 +5707,38 @@ class DeploymentsNamespace {
5427
5707
  "Invalid deployment source. You must provide repo, code, files, or tarUrl."
5428
5708
  );
5429
5709
  }
5710
+ const deploymentConfig = {
5711
+ name: body.name,
5712
+ await: body.waitForRollout,
5713
+ build: body.build,
5714
+ domains: body.domains,
5715
+ networkPermissions: body.networkPermissions?.map((np) => ({
5716
+ action: np.action,
5717
+ query: np.domain,
5718
+ behavior: np.behavior
5719
+ })),
5720
+ egress: body.egress,
5721
+ envVars: body.envVars,
5722
+ nodeModules: body.nodeModules,
5723
+ timeout: body.timeoutMs,
5724
+ entrypoint: body.entrypointPath,
5725
+ staticDir: body.staticDir,
5726
+ staticPathPrefix: body.staticPathPrefix,
5727
+ publicDir: body.publicDir,
5728
+ prerenderDir: body.prerenderDir,
5729
+ staticOnly: body.staticOnly,
5730
+ redirects: body.redirects,
5731
+ rewrites: body.rewrites,
5732
+ dynamic: body.dynamic,
5733
+ headers: body.headers,
5734
+ cleanUrls: body.cleanUrls,
5735
+ trailingSlash: body.trailingSlash,
5736
+ experimental: body.experimental
5737
+ };
5430
5738
  const response = await this.apiClient.post("/web/v1/deployment", {
5431
5739
  body: {
5432
5740
  source,
5433
- config: {
5434
- await: body.waitForRollout,
5435
- build: body.build,
5436
- domains: body.domains,
5437
- networkPermissions: body.networkPermissions?.map((np) => ({
5438
- action: np.action,
5439
- query: np.domain,
5440
- behavior: np.behavior
5441
- })),
5442
- envVars: body.envVars,
5443
- nodeModules: body.nodeModules,
5444
- timeout: body.timeoutMs,
5445
- entrypoint: body.entrypointPath,
5446
- staticDir: body.staticDir,
5447
- staticPathPrefix: body.staticPathPrefix,
5448
- publicDir: body.publicDir,
5449
- prerenderDir: body.prerenderDir,
5450
- staticOnly: body.staticOnly,
5451
- redirects: body.redirects,
5452
- rewrites: body.rewrites,
5453
- dynamic: body.dynamic,
5454
- headers: body.headers,
5455
- cleanUrls: body.cleanUrls,
5456
- trailingSlash: body.trailingSlash,
5457
- experimental: body.experimental
5458
- }
5741
+ config: deploymentConfig
5459
5742
  }
5460
5743
  });
5461
5744
  return {
@@ -5498,10 +5781,14 @@ class RunsNamespace {
5498
5781
  code,
5499
5782
  ...config
5500
5783
  }) {
5784
+ const runConfig = {
5785
+ ...config,
5786
+ egress: config.egress
5787
+ };
5501
5788
  const response = await this.apiClient.post("/execute/v3/script", {
5502
5789
  body: {
5503
5790
  script: code,
5504
- config
5791
+ config: runConfig
5505
5792
  }
5506
5793
  });
5507
5794
  return response;
@@ -7218,55 +7505,56 @@ function cloneVmValue(value) {
7218
7505
  }
7219
7506
  return value;
7220
7507
  }
7221
- async function convertSpecSnapshotsToTemplates(spec, processBuilders = true) {
7222
- if (!isVmSpecLike$1(spec.raw.snapshot)) {
7223
- return void 0;
7224
- }
7225
- let innerSpec = spec.raw.snapshot;
7226
- if (processBuilders) {
7227
- innerSpec = await processSpecTree(innerSpec);
7228
- }
7229
- const { snapshot: nestedSnapshot, ...innerRaw } = innerSpec.raw;
7230
- let nestedTemplate;
7231
- if (isVmSpecLike$1(nestedSnapshot)) {
7232
- nestedTemplate = await convertSpecSnapshotsToTemplates(innerSpec, false);
7508
+ function serializeSpecLayer(spec) {
7509
+ const {
7510
+ snapshot: _snapshot,
7511
+ template: _template,
7512
+ persistence: _persistence,
7513
+ baseImage,
7514
+ systemd,
7515
+ git,
7516
+ with: _with,
7517
+ __withDiscriminators: _withDiscriminators,
7518
+ ...rest
7519
+ } = spec.raw;
7520
+ const out = { ...rest };
7521
+ const serializedBaseImage = normalizeBaseImage(baseImage)?.toRaw();
7522
+ if (serializedBaseImage) {
7523
+ out.baseImage = serializedBaseImage;
7524
+ }
7525
+ const normalizedGit = normalizeGitOptions(git);
7526
+ if (normalizedGit != null) {
7527
+ out.git = normalizedGit;
7528
+ }
7529
+ if (systemd) {
7530
+ const nextSystemd = { ...systemd };
7531
+ if (systemd.services) {
7532
+ const normalizedServices = normalizeSystemdServices(
7533
+ systemd.services
7534
+ );
7535
+ const existingFiles = out.additionalFiles ?? {};
7536
+ const { services: processedServices, additionalFiles: bashFiles } = processSystemdServices(normalizedServices, existingFiles);
7537
+ nextSystemd.services = processedServices;
7538
+ out.additionalFiles = bashFiles;
7539
+ }
7540
+ if (systemd.patchedServices) {
7541
+ nextSystemd.patchedServices = normalizePatchedServices(
7542
+ systemd.patchedServices
7543
+ );
7544
+ }
7545
+ out.systemd = nextSystemd;
7233
7546
  }
7234
- return new VmTemplate({
7235
- ...innerRaw,
7236
- template: nestedTemplate,
7237
- with: innerSpec.builders
7238
- });
7547
+ return out;
7239
7548
  }
7240
- async function processOuterSpecBuilders(spec) {
7241
- const builders = spec.builders ?? {} ?? {};
7242
- for (const key in builders) {
7243
- const builder = builders[key];
7244
- if (builder) {
7245
- if (builder.configureSpec) {
7246
- spec = await builder.configureSpec(spec);
7247
- }
7248
- if (builder.configureBaseImage) {
7249
- spec.raw.baseImage = await builder.configureBaseImage(
7250
- prepareBaseImageForConfigure(spec.raw.baseImage)
7251
- );
7252
- }
7253
- if (builder.configureSnapshotSpec) {
7254
- let snapshotSpec;
7255
- if (isVmSpecLike$1(spec.raw.snapshot)) {
7256
- snapshotSpec = spec.raw.snapshot;
7257
- } else {
7258
- const inheritedDiscriminator = spec.getBuilderDiscriminator(key) ?? spec.raw.discriminator;
7259
- snapshotSpec = new VmSpec({
7260
- discriminator: inheritedDiscriminator,
7261
- skipCache: spec.raw.skipCache
7262
- });
7263
- spec.raw.snapshot = snapshotSpec;
7264
- }
7265
- spec.raw.snapshot = await builder.configureSnapshotSpec(snapshotSpec);
7266
- }
7549
+ function serializeSpecChain(spec) {
7550
+ const layer = serializeSpecLayer(spec);
7551
+ if (isVmSpecLike$1(spec.raw.snapshot)) {
7552
+ const inner = serializeSpecChain(spec.raw.snapshot);
7553
+ if (inner !== void 0) {
7554
+ layer.snapshot = inner;
7267
7555
  }
7268
7556
  }
7269
- return spec;
7557
+ return Object.keys(layer).length === 0 ? void 0 : layer;
7270
7558
  }
7271
7559
  async function processSpecTree(spec) {
7272
7560
  const builders = spec.builders ?? {} ?? {};
@@ -7386,23 +7674,9 @@ class VmsNamespace {
7386
7674
  options.spec = mergeWithBuildersIntoSpec(options.spec, options.with);
7387
7675
  }
7388
7676
  if (isVmSpecLike$1(options.spec)) {
7389
- let spec = options.spec;
7390
- spec = await processOuterSpecBuilders(spec);
7391
- const { snapshot, ...outerSpecOptions } = spec.raw;
7392
- const innerTemplate = await convertSpecSnapshotsToTemplates(spec);
7393
- if (innerTemplate) {
7394
- options.template = innerTemplate;
7395
- }
7396
- const mergedOptions = composeCreateVmOptions([
7397
- outerSpecOptions,
7398
- options
7399
- ]);
7400
- options = {
7401
- ...options,
7402
- ...mergedOptions
7403
- };
7404
- if (!options.with && spec.builders) {
7405
- options.with = spec.builders;
7677
+ options.spec = await processSpecTree(options.spec);
7678
+ if (!options.with && options.spec.builders) {
7679
+ options.with = options.spec.builders;
7406
7680
  }
7407
7681
  }
7408
7682
  const specBuilders = isVmSpecLike$1(
@@ -7414,6 +7688,7 @@ class VmsNamespace {
7414
7688
  ...specBuilders || {},
7415
7689
  ...options.with || {}
7416
7690
  };
7691
+ const specTree = isVmSpecLike$1(options.spec) ? options.spec : void 0;
7417
7692
  const { with: _, spec: _spec, ...baseConfig } = options;
7418
7693
  let config = baseConfig;
7419
7694
  if (isVmTemplateLike$1(config.template)) {
@@ -7464,13 +7739,20 @@ class VmsNamespace {
7464
7739
  template: _template,
7465
7740
  ...requestConfig
7466
7741
  } = config;
7742
+ const serializedSpecChain = specTree ? serializeSpecChain(specTree) : void 0;
7743
+ const specForBody = serializedSpecChain !== void 0 ? { snapshot: serializedSpecChain, name: options.name ?? null } : void 0;
7467
7744
  const response = await postWithBackgroundLogger(
7468
7745
  this.freestyle._apiClient,
7469
7746
  "/v1/vms",
7470
7747
  {
7471
7748
  body: {
7472
7749
  ...requestConfig,
7473
- template: normalizedRequestTemplate,
7750
+ // Only include `template` when callers passed one directly — the
7751
+ // spec path replaces templates with `body.spec` on the wire.
7752
+ ...specForBody === void 0 ? { template: normalizedRequestTemplate } : {},
7753
+ ...specForBody !== void 0 ? {
7754
+ spec: specForBody
7755
+ } : {},
7474
7756
  // Cast systemd since we've processed SystemdServiceInput[] to RawSystemdService[]
7475
7757
  systemd: config.systemd,
7476
7758
  // Normalize git options - default config to {}
@@ -7654,16 +7936,12 @@ class VmSnapshotsNamespace {
7654
7936
  const { snapshot: _snapshot, ...rest } = requestOptions;
7655
7937
  requestOptions = rest;
7656
7938
  }
7939
+ let serializedSpec;
7657
7940
  if (isVmSpecLike$1(requestOptions.spec)) {
7658
- let spec = requestOptions.spec;
7659
- spec = await processSpecTree(spec);
7660
- const { snapshot: _snapshotSpec, ...outerSpecOptions } = spec.raw;
7661
- const innerTemplate = await convertSpecSnapshotsToTemplates(spec, false);
7662
- requestOptions.template = new VmTemplate({
7663
- ...outerSpecOptions,
7664
- template: innerTemplate,
7665
- with: spec.builders
7666
- });
7941
+ const processedSpec = await processSpecTree(
7942
+ requestOptions.spec
7943
+ );
7944
+ serializedSpec = serializeSpecChain(processedSpec);
7667
7945
  }
7668
7946
  if ("spec" in requestOptions) {
7669
7947
  const { spec: _spec, ...rest } = requestOptions;
@@ -7682,20 +7960,27 @@ class VmSnapshotsNamespace {
7682
7960
  );
7683
7961
  }
7684
7962
  }
7685
- if (!requestOptions.template) {
7963
+ if (!requestOptions.template && serializedSpec === void 0) {
7686
7964
  throw new Error(
7687
7965
  "snapshots.ensure requires a template or spec to build a snapshot"
7688
7966
  );
7689
7967
  }
7968
+ const normalizedTemplate = requestOptions.template !== void 0 ? normalizeTemplateForRequest(
7969
+ isVmTemplateLike$1(requestOptions.template) ? requestOptions.template.raw : requestOptions.template
7970
+ ) : void 0;
7971
+ const { template: _droppedTemplate, ...requestOptionsWithoutTemplate } = requestOptions;
7690
7972
  return postWithBackgroundLogger(
7691
7973
  this.apiClient,
7692
7974
  "/v1/vms/snapshots",
7693
7975
  {
7694
7976
  body: {
7695
- ...requestOptions,
7696
- template: normalizeTemplateForRequest(
7697
- isVmTemplateLike$1(requestOptions.template) ? requestOptions.template.raw : requestOptions.template
7698
- )
7977
+ ...requestOptionsWithoutTemplate,
7978
+ // Only emit `template` when the caller passed one directly —
7979
+ // spec callers use `body.spec` instead.
7980
+ ...serializedSpec === void 0 ? { template: normalizedTemplate } : {},
7981
+ ...serializedSpec !== void 0 ? {
7982
+ spec: serializedSpec
7983
+ } : {}
7699
7984
  }
7700
7985
  },
7701
7986
  logger
@@ -7988,8 +8273,8 @@ async function debugCreateRequests(freestyle, optionsOrSpec = {}) {
7988
8273
  let vmCounter = 0;
7989
8274
  const apiClient = freestyle._apiClient;
7990
8275
  const originalPost = apiClient.post.bind(freestyle._apiClient);
7991
- const mockPost = (async (path, ...args) => {
7992
- const rawBody = args[0] && "body" in args[0] ? args[0].body : void 0;
8276
+ const originalPostRaw = apiClient.postRaw?.bind(freestyle._apiClient);
8277
+ const handleMockedPath = (path, rawBody) => {
7993
8278
  const clonedBody = JSON.parse(JSON.stringify(rawBody ?? null));
7994
8279
  if (path === "/v1/vms/snapshots") {
7995
8280
  requests.push({
@@ -8013,16 +8298,47 @@ async function debugCreateRequests(freestyle, optionsOrSpec = {}) {
8013
8298
  consoleUrl: "https://debug.local/console"
8014
8299
  };
8015
8300
  }
8301
+ return void 0;
8302
+ };
8303
+ const mockPost = (async (path, ...args) => {
8304
+ const rawBody = args[0] && "body" in args[0] ? args[0].body : void 0;
8305
+ const mocked = handleMockedPath(path, rawBody);
8306
+ if (mocked !== void 0) {
8307
+ return mocked;
8308
+ }
8016
8309
  return originalPost(
8017
8310
  path,
8018
8311
  ...args
8019
8312
  );
8020
8313
  });
8314
+ const mockPostRaw = (async (path, ...args) => {
8315
+ const rawBody = args[0] && "body" in args[0] ? args[0].body : void 0;
8316
+ const mocked = handleMockedPath(path, rawBody);
8317
+ if (mocked !== void 0) {
8318
+ return new Response(JSON.stringify(mocked), {
8319
+ status: 200,
8320
+ headers: { "content-type": "application/json" }
8321
+ });
8322
+ }
8323
+ if (!originalPostRaw) {
8324
+ throw new Error(`debugCreateRequests: unexpected POST to ${String(path)}`);
8325
+ }
8326
+ return originalPostRaw(
8327
+ path,
8328
+ ...args
8329
+ );
8330
+ });
8021
8331
  apiClient.post = mockPost;
8332
+ apiClient.postRaw = mockPostRaw;
8022
8333
  try {
8023
8334
  await freestyle.vms.create(options);
8024
8335
  } finally {
8025
8336
  apiClient.post = originalPost;
8337
+ if (originalPostRaw) {
8338
+ apiClient.postRaw = originalPostRaw;
8339
+ } else {
8340
+ delete apiClient.postRaw;
8341
+ }
8026
8342
  }
8027
8343
  return requests;
8028
8344
  }