freestyle 0.1.46 → 0.1.48

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