freestyle-sandboxes 0.1.3 → 0.1.6

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 (6) hide show
  1. package/README.md +2 -2
  2. package/index.cjs +1485 -916
  3. package/index.d.cts +2316 -866
  4. package/index.d.mts +2316 -866
  5. package/index.mjs +1485 -916
  6. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6,6 +6,18 @@ function errorFromJSON(body) {
6
6
  return new Error(`Unknown error code: ${body.code} - ${body.description}`);
7
7
  }
8
8
  }
9
+ class GitErrorError extends Error {
10
+ constructor(body) {
11
+ super(
12
+ `GIT_ERROR: ${body.message}`
13
+ );
14
+ this.body = body;
15
+ this.name = "GitErrorError";
16
+ }
17
+ static code = "GIT_ERROR";
18
+ static statusCode = 500;
19
+ static description = `{message}`;
20
+ }
9
21
  class InternalErrorError extends Error {
10
22
  constructor(body) {
11
23
  super(
@@ -30,113 +42,41 @@ class DockerImportBadRequestError extends Error {
30
42
  static statusCode = 400;
31
43
  static description = `Bad request: {message}`;
32
44
  }
33
- class VmNotFoundInFsError extends Error {
34
- constructor(body) {
35
- super(
36
- `VM_NOT_FOUND_IN_FS: ${body.message}`
37
- );
38
- this.body = body;
39
- this.name = "VmNotFoundInFsError";
40
- }
41
- static code = "VM_NOT_FOUND_IN_FS";
42
- static statusCode = 406;
43
- static description = `Vm Not found in filesystem`;
44
- }
45
- class VmNotRunningError extends Error {
46
- constructor(body) {
47
- super(
48
- `VM_NOT_RUNNING: ${body.message}`
49
- );
50
- this.body = body;
51
- this.name = "VmNotRunningError";
52
- }
53
- static code = "VM_NOT_RUNNING";
54
- static statusCode = 400;
55
- static description = `VmNotRunning`;
56
- }
57
- class VmNotFoundError extends Error {
58
- constructor(body) {
59
- super(
60
- `VM_NOT_FOUND: ${body.message}`
61
- );
62
- this.body = body;
63
- this.name = "VmNotFoundError";
64
- }
65
- static code = "VM_NOT_FOUND";
66
- static statusCode = 404;
67
- static description = `VmNotFound`;
68
- }
69
- class InternalForkVmNotFoundError extends Error {
70
- constructor(body) {
71
- super(
72
- `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
73
- );
74
- this.body = body;
75
- this.name = "InternalForkVmNotFoundError";
76
- }
77
- static code = "INTERNAL_FORK_VM_NOT_FOUND";
78
- static statusCode = 404;
79
- static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
80
- }
81
- class BadRequestError extends Error {
82
- constructor(body) {
83
- super(
84
- `BAD_REQUEST: ${body.message}`
85
- );
86
- this.body = body;
87
- this.name = "BadRequestError";
88
- }
89
- static code = "BAD_REQUEST";
90
- static statusCode = 400;
91
- static description = `Bad request: {message}`;
92
- }
93
- class InternalVmNotFoundError extends Error {
94
- constructor(body) {
95
- super(
96
- `INTERNAL_VM_NOT_FOUND: ${body.message}`
97
- );
98
- this.body = body;
99
- this.name = "InternalVmNotFoundError";
100
- }
101
- static code = "INTERNAL_VM_NOT_FOUND";
102
- static statusCode = 404;
103
- static description = `VM not found: {vm_id}`;
104
- }
105
- class VmMustBeStoppedError extends Error {
45
+ class VmOperationDeniedDuringTransactionError extends Error {
106
46
  constructor(body) {
107
47
  super(
108
- `VM_MUST_BE_STOPPED: ${body.message}`
48
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
109
49
  );
110
50
  this.body = body;
111
- this.name = "VmMustBeStoppedError";
51
+ this.name = "VmOperationDeniedDuringTransactionError";
112
52
  }
113
- static code = "VM_MUST_BE_STOPPED";
114
- static statusCode = 400;
115
- static description = `VM must be stopped before converting to base`;
53
+ static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
54
+ static statusCode = 409;
55
+ static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
116
56
  }
117
- class AlreadyHasBaseError extends Error {
57
+ class VmTransactionIdMismatchError extends Error {
118
58
  constructor(body) {
119
59
  super(
120
- `ALREADY_HAS_BASE: ${body.message}`
60
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
121
61
  );
122
62
  this.body = body;
123
- this.name = "AlreadyHasBaseError";
63
+ this.name = "VmTransactionIdMismatchError";
124
64
  }
125
- static code = "ALREADY_HAS_BASE";
65
+ static code = "VM_TRANSACTION_ID_MISMATCH";
126
66
  static statusCode = 400;
127
- static description = `VM already has a base rootfs`;
67
+ static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
128
68
  }
129
- class NotFoundError extends Error {
69
+ class VmNotInTransactionError extends Error {
130
70
  constructor(body) {
131
71
  super(
132
- `NOT_FOUND: ${body.message}`
72
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
133
73
  );
134
74
  this.body = body;
135
- this.name = "NotFoundError";
75
+ this.name = "VmNotInTransactionError";
136
76
  }
137
- static code = "NOT_FOUND";
77
+ static code = "VM_NOT_IN_TRANSACTION";
138
78
  static statusCode = 404;
139
- static description = `VM not found`;
79
+ static description = `VM not in a transaction: {vm_id}`;
140
80
  }
141
81
  class ForkVmNotFoundError extends Error {
142
82
  constructor(body) {
@@ -174,30 +114,6 @@ class SnapshotVmBadRequestError extends Error {
174
114
  static statusCode = 400;
175
115
  static description = `Bad request: {message}`;
176
116
  }
177
- class FileNotFoundError extends Error {
178
- constructor(body) {
179
- super(
180
- `FILE_NOT_FOUND: ${body.message}`
181
- );
182
- this.body = body;
183
- this.name = "FileNotFoundError";
184
- }
185
- static code = "FILE_NOT_FOUND";
186
- static statusCode = 404;
187
- static description = `File not found: {path}`;
188
- }
189
- class FilesBadRequestError extends Error {
190
- constructor(body) {
191
- super(
192
- `FILES_BAD_REQUEST: ${body.message}`
193
- );
194
- this.body = body;
195
- this.name = "FilesBadRequestError";
196
- }
197
- static code = "FILES_BAD_REQUEST";
198
- static statusCode = 400;
199
- static description = `Bad request: {message}`;
200
- }
201
117
  class VmDeletedError extends Error {
202
118
  constructor(body) {
203
119
  super(
@@ -306,138 +222,246 @@ class VmSubnetNotFoundError extends Error {
306
222
  static statusCode = 500;
307
223
  static description = `Subnet for VM not found`;
308
224
  }
309
- class VmOperationDeniedDuringTransactionError extends Error {
225
+ class FileNotFoundError extends Error {
310
226
  constructor(body) {
311
227
  super(
312
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
228
+ `FILE_NOT_FOUND: ${body.message}`
313
229
  );
314
230
  this.body = body;
315
- this.name = "VmOperationDeniedDuringTransactionError";
231
+ this.name = "FileNotFoundError";
316
232
  }
317
- static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
318
- static statusCode = 409;
319
- static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
233
+ static code = "FILE_NOT_FOUND";
234
+ static statusCode = 404;
235
+ static description = `File not found: {path}`;
320
236
  }
321
- class VmTransactionIdMismatchError extends Error {
237
+ class FilesBadRequestError extends Error {
322
238
  constructor(body) {
323
239
  super(
324
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
240
+ `FILES_BAD_REQUEST: ${body.message}`
325
241
  );
326
242
  this.body = body;
327
- this.name = "VmTransactionIdMismatchError";
243
+ this.name = "FilesBadRequestError";
328
244
  }
329
- static code = "VM_TRANSACTION_ID_MISMATCH";
245
+ static code = "FILES_BAD_REQUEST";
330
246
  static statusCode = 400;
331
- static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
247
+ static description = `Bad request: {message}`;
332
248
  }
333
- class VmNotInTransactionError extends Error {
249
+ class VmNotFoundInFsError extends Error {
334
250
  constructor(body) {
335
251
  super(
336
- `VM_NOT_IN_TRANSACTION: ${body.message}`
252
+ `VM_NOT_FOUND_IN_FS: ${body.message}`
337
253
  );
338
254
  this.body = body;
339
- this.name = "VmNotInTransactionError";
255
+ this.name = "VmNotFoundInFsError";
340
256
  }
341
- static code = "VM_NOT_IN_TRANSACTION";
342
- static statusCode = 404;
343
- static description = `VM not in a transaction: {vm_id}`;
257
+ static code = "VM_NOT_FOUND_IN_FS";
258
+ static statusCode = 406;
259
+ static description = `Vm Not found in filesystem`;
344
260
  }
345
- class UserNotFoundError extends Error {
261
+ class VmNotRunningError extends Error {
346
262
  constructor(body) {
347
263
  super(
348
- `USER_NOT_FOUND: ${body.message}`
264
+ `VM_NOT_RUNNING: ${body.message}`
349
265
  );
350
266
  this.body = body;
351
- this.name = "UserNotFoundError";
267
+ this.name = "VmNotRunningError";
352
268
  }
353
- static code = "USER_NOT_FOUND";
354
- static statusCode = 404;
355
- static description = `User not found: {user_name}`;
269
+ static code = "VM_NOT_RUNNING";
270
+ static statusCode = 400;
271
+ static description = `VM is not running: {vm_id}`;
356
272
  }
357
- class UserAlreadyExistsError extends Error {
273
+ class VmNotFoundError extends Error {
358
274
  constructor(body) {
359
275
  super(
360
- `USER_ALREADY_EXISTS: ${body.message}`
276
+ `VM_NOT_FOUND: ${body.message}`
361
277
  );
362
278
  this.body = body;
363
- this.name = "UserAlreadyExistsError";
279
+ this.name = "VmNotFoundError";
364
280
  }
365
- static code = "USER_ALREADY_EXISTS";
366
- static statusCode = 409;
367
- static description = `Conflict: User '{user_name}' already exists`;
281
+ static code = "VM_NOT_FOUND";
282
+ static statusCode = 404;
283
+ static description = `VM not found: {vm_id}`;
368
284
  }
369
- class ValidationErrorError extends Error {
285
+ class InternalForkVmNotFoundError extends Error {
370
286
  constructor(body) {
371
287
  super(
372
- `VALIDATION_ERROR: ${body.message}`
288
+ `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
373
289
  );
374
290
  this.body = body;
375
- this.name = "ValidationErrorError";
291
+ this.name = "InternalForkVmNotFoundError";
376
292
  }
377
- static code = "VALIDATION_ERROR";
378
- static statusCode = 400;
379
- static description = `Validation error: {message}`;
293
+ static code = "INTERNAL_FORK_VM_NOT_FOUND";
294
+ static statusCode = 404;
295
+ static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
380
296
  }
381
- class GroupNotFoundError extends Error {
297
+ class BadRequestError extends Error {
382
298
  constructor(body) {
383
299
  super(
384
- `GROUP_NOT_FOUND: ${body.message}`
300
+ `BAD_REQUEST: ${body.message}`
385
301
  );
386
302
  this.body = body;
387
- this.name = "GroupNotFoundError";
303
+ this.name = "BadRequestError";
388
304
  }
389
- static code = "GROUP_NOT_FOUND";
390
- static statusCode = 404;
391
- static description = `Group not found: {group_name}`;
305
+ static code = "BAD_REQUEST";
306
+ static statusCode = 400;
307
+ static description = `Bad request: {message}`;
392
308
  }
393
- class GroupAlreadyExistsError extends Error {
309
+ class InternalVmNotFoundError extends Error {
394
310
  constructor(body) {
395
311
  super(
396
- `GROUP_ALREADY_EXISTS: ${body.message}`
312
+ `INTERNAL_VM_NOT_FOUND: ${body.message}`
397
313
  );
398
314
  this.body = body;
399
- this.name = "GroupAlreadyExistsError";
315
+ this.name = "InternalVmNotFoundError";
400
316
  }
401
- static code = "GROUP_ALREADY_EXISTS";
402
- static statusCode = 409;
403
- static description = `Conflict: Group '{group_name}' already exists`;
317
+ static code = "INTERNAL_VM_NOT_FOUND";
318
+ static statusCode = 404;
319
+ static description = `VM not found: {vm_id}`;
404
320
  }
405
- class DuplicateUserNameError extends Error {
321
+ class VmMustBeStoppedError extends Error {
406
322
  constructor(body) {
407
323
  super(
408
- `DUPLICATE_USER_NAME: ${body.message}`
324
+ `VM_MUST_BE_STOPPED: ${body.message}`
409
325
  );
410
326
  this.body = body;
411
- this.name = "DuplicateUserNameError";
327
+ this.name = "VmMustBeStoppedError";
412
328
  }
413
- static code = "DUPLICATE_USER_NAME";
329
+ static code = "VM_MUST_BE_STOPPED";
414
330
  static statusCode = 400;
415
- static description = `Duplicate user name '{name}' found`;
331
+ static description = `VM must be stopped before converting to base`;
416
332
  }
417
- class UserGroupEmptyError extends Error {
333
+ class AlreadyHasBaseError extends Error {
418
334
  constructor(body) {
419
335
  super(
420
- `USER_GROUP_EMPTY: ${body.message}`
336
+ `ALREADY_HAS_BASE: ${body.message}`
421
337
  );
422
338
  this.body = body;
423
- this.name = "UserGroupEmptyError";
339
+ this.name = "AlreadyHasBaseError";
424
340
  }
425
- static code = "USER_GROUP_EMPTY";
341
+ static code = "ALREADY_HAS_BASE";
426
342
  static statusCode = 400;
427
- static description = `User '{user}' has empty string in groups`;
343
+ static description = `VM already has a base rootfs`;
428
344
  }
429
- class UserSystemFlagMismatchError extends Error {
345
+ class NotFoundError extends Error {
430
346
  constructor(body) {
431
347
  super(
432
- `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
348
+ `NOT_FOUND: ${body.message}`
433
349
  );
434
350
  this.body = body;
435
- this.name = "UserSystemFlagMismatchError";
351
+ this.name = "NotFoundError";
436
352
  }
437
- static code = "USER_SYSTEM_FLAG_MISMATCH";
438
- static statusCode = 400;
439
- static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
440
- }
353
+ static code = "NOT_FOUND";
354
+ static statusCode = 404;
355
+ static description = `VM not found`;
356
+ }
357
+ class CreateVmBadRequestError extends Error {
358
+ constructor(body) {
359
+ super(
360
+ `CREATE_VM_BAD_REQUEST: ${body.message}`
361
+ );
362
+ this.body = body;
363
+ this.name = "CreateVmBadRequestError";
364
+ }
365
+ static code = "CREATE_VM_BAD_REQUEST";
366
+ static statusCode = 400;
367
+ static description = `Bad request: {message}`;
368
+ }
369
+ class UserNotFoundError extends Error {
370
+ constructor(body) {
371
+ super(
372
+ `USER_NOT_FOUND: ${body.message}`
373
+ );
374
+ this.body = body;
375
+ this.name = "UserNotFoundError";
376
+ }
377
+ static code = "USER_NOT_FOUND";
378
+ static statusCode = 404;
379
+ static description = `User not found: {user_name}`;
380
+ }
381
+ class UserAlreadyExistsError extends Error {
382
+ constructor(body) {
383
+ super(
384
+ `USER_ALREADY_EXISTS: ${body.message}`
385
+ );
386
+ this.body = body;
387
+ this.name = "UserAlreadyExistsError";
388
+ }
389
+ static code = "USER_ALREADY_EXISTS";
390
+ static statusCode = 409;
391
+ static description = `Conflict: User '{user_name}' already exists`;
392
+ }
393
+ class ValidationErrorError extends Error {
394
+ constructor(body) {
395
+ super(
396
+ `VALIDATION_ERROR: ${body.message}`
397
+ );
398
+ this.body = body;
399
+ this.name = "ValidationErrorError";
400
+ }
401
+ static code = "VALIDATION_ERROR";
402
+ static statusCode = 400;
403
+ static description = `Validation error: {message}`;
404
+ }
405
+ class GroupNotFoundError extends Error {
406
+ constructor(body) {
407
+ super(
408
+ `GROUP_NOT_FOUND: ${body.message}`
409
+ );
410
+ this.body = body;
411
+ this.name = "GroupNotFoundError";
412
+ }
413
+ static code = "GROUP_NOT_FOUND";
414
+ static statusCode = 404;
415
+ static description = `Group not found: {group_name}`;
416
+ }
417
+ class GroupAlreadyExistsError extends Error {
418
+ constructor(body) {
419
+ super(
420
+ `GROUP_ALREADY_EXISTS: ${body.message}`
421
+ );
422
+ this.body = body;
423
+ this.name = "GroupAlreadyExistsError";
424
+ }
425
+ static code = "GROUP_ALREADY_EXISTS";
426
+ static statusCode = 409;
427
+ static description = `Conflict: Group '{group_name}' already exists`;
428
+ }
429
+ class DuplicateUserNameError extends Error {
430
+ constructor(body) {
431
+ super(
432
+ `DUPLICATE_USER_NAME: ${body.message}`
433
+ );
434
+ this.body = body;
435
+ this.name = "DuplicateUserNameError";
436
+ }
437
+ static code = "DUPLICATE_USER_NAME";
438
+ static statusCode = 400;
439
+ static description = `Duplicate user name '{name}' found`;
440
+ }
441
+ class UserGroupEmptyError extends Error {
442
+ constructor(body) {
443
+ super(
444
+ `USER_GROUP_EMPTY: ${body.message}`
445
+ );
446
+ this.body = body;
447
+ this.name = "UserGroupEmptyError";
448
+ }
449
+ static code = "USER_GROUP_EMPTY";
450
+ static statusCode = 400;
451
+ static description = `User '{user}' has empty string in groups`;
452
+ }
453
+ class UserSystemFlagMismatchError extends Error {
454
+ constructor(body) {
455
+ super(
456
+ `USER_SYSTEM_FLAG_MISMATCH: ${body.message}`
457
+ );
458
+ this.body = body;
459
+ this.name = "UserSystemFlagMismatchError";
460
+ }
461
+ static code = "USER_SYSTEM_FLAG_MISMATCH";
462
+ static statusCode = 400;
463
+ static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
464
+ }
441
465
  class UserUidOutOfRangeError extends Error {
442
466
  constructor(body) {
443
467
  super(
@@ -534,18 +558,6 @@ class GroupNameEmptyError extends Error {
534
558
  static statusCode = 400;
535
559
  static description = `Group name cannot be empty`;
536
560
  }
537
- class CreateVmBadRequestError extends Error {
538
- constructor(body) {
539
- super(
540
- `CREATE_VM_BAD_REQUEST: ${body.message}`
541
- );
542
- this.body = body;
543
- this.name = "CreateVmBadRequestError";
544
- }
545
- static code = "CREATE_VM_BAD_REQUEST";
546
- static statusCode = 400;
547
- static description = `Bad request: {message}`;
548
- }
549
561
  class WantedByEmptyError extends Error {
550
562
  constructor(body) {
551
563
  super(
@@ -736,91 +748,55 @@ class ServiceNotFoundError extends Error {
736
748
  }
737
749
  static code = "SERVICE_NOT_FOUND";
738
750
  static statusCode = 404;
739
- static description = `null`;
740
- }
741
- class WaitTimeoutError extends Error {
742
- constructor(body) {
743
- super(
744
- `WAIT_TIMEOUT: ${body.message}`
745
- );
746
- this.body = body;
747
- this.name = "WaitTimeoutError";
748
- }
749
- static code = "WAIT_TIMEOUT";
750
- static statusCode = 504;
751
- static description = `Timed out waiting for certificate validation`;
752
- }
753
- class PreVerifyChallengeMismatchError extends Error {
754
- constructor(body) {
755
- super(
756
- `PRE_VERIFY_CHALLENGE_MISMATCH: ${body.message}`
757
- );
758
- this.body = body;
759
- this.name = "PreVerifyChallengeMismatchError";
760
- }
761
- static code = "PRE_VERIFY_CHALLENGE_MISMATCH";
762
- static statusCode = 400;
763
- static description = `Certificate challenge verification failed - response did not match`;
764
- }
765
- class PreVerifyFailedParseError extends Error {
766
- constructor(body) {
767
- super(
768
- `PRE_VERIFY_FAILED_PARSE: ${body.message}`
769
- );
770
- this.body = body;
771
- this.name = "PreVerifyFailedParseError";
772
- }
773
- static code = "PRE_VERIFY_FAILED_PARSE";
774
- static statusCode = 400;
775
- static description = `Invalid response from domain during certificate verification`;
751
+ static description = `Service '{service_name}' not found`;
776
752
  }
777
- class PreVerifyFailedFetchError extends Error {
753
+ class InvalidRequestError extends Error {
778
754
  constructor(body) {
779
755
  super(
780
- `PRE_VERIFY_FAILED_FETCH: ${body.message}`
756
+ `INVALID_REQUEST: ${body.message}`
781
757
  );
782
758
  this.body = body;
783
- this.name = "PreVerifyFailedFetchError";
759
+ this.name = "InvalidRequestError";
784
760
  }
785
- static code = "PRE_VERIFY_FAILED_FETCH";
761
+ static code = "INVALID_REQUEST";
786
762
  static statusCode = 400;
787
- static description = `Could not reach domain for certificate verification - check DNS settings`;
763
+ static description = `Invalid request: {message}`;
788
764
  }
789
- class PreVerifyRouteNotFoundError extends Error {
765
+ class RepoNotFoundError extends Error {
790
766
  constructor(body) {
791
767
  super(
792
- `PRE_VERIFY_ROUTE_NOT_FOUND: ${body.message}`
768
+ `REPO_NOT_FOUND: ${body.message}`
793
769
  );
794
770
  this.body = body;
795
- this.name = "PreVerifyRouteNotFoundError";
771
+ this.name = "RepoNotFoundError";
796
772
  }
797
- static code = "PRE_VERIFY_ROUTE_NOT_FOUND";
798
- static statusCode = 400;
799
- static description = `Domain does not resolve to Freestyle servers`;
773
+ static code = "REPO_NOT_FOUND";
774
+ static statusCode = 404;
775
+ static description = `Repository not found: {repo_id}`;
800
776
  }
801
- class AuthorizationNotFoundError extends Error {
777
+ class RuntimeErrorError extends Error {
802
778
  constructor(body) {
803
779
  super(
804
- `AUTHORIZATION_NOT_FOUND: ${body.message}`
780
+ `RUNTIME_ERROR: ${body.message}`
805
781
  );
806
782
  this.body = body;
807
- this.name = "AuthorizationNotFoundError";
783
+ this.name = "RuntimeErrorError";
808
784
  }
809
- static code = "AUTHORIZATION_NOT_FOUND";
810
- static statusCode = 404;
811
- static description = `No authorization found for domain`;
785
+ static code = "RUNTIME_ERROR";
786
+ static statusCode = 500;
787
+ static description = `The script execution resulted in a runtime error: {message}`;
812
788
  }
813
- class OrderNotFoundError extends Error {
789
+ class SyntaxErrorError extends Error {
814
790
  constructor(body) {
815
791
  super(
816
- `ORDER_NOT_FOUND: ${body.message}`
792
+ `SYNTAX_ERROR: ${body.message}`
817
793
  );
818
794
  this.body = body;
819
- this.name = "OrderNotFoundError";
795
+ this.name = "SyntaxErrorError";
820
796
  }
821
- static code = "ORDER_NOT_FOUND";
822
- static statusCode = 404;
823
- static description = `No certificate order found for domain`;
797
+ static code = "SYNTAX_ERROR";
798
+ static statusCode = 503;
799
+ static description = `The provided script has a syntax error: {message}`;
824
800
  }
825
801
  class InternalError extends Error {
826
802
  constructor(body) {
@@ -894,173 +870,233 @@ class ExpiredError extends Error {
894
870
  static statusCode = 403;
895
871
  static description = `Session has expired`;
896
872
  }
897
- class TagNotFoundError extends Error {
873
+ class ForbiddenError extends Error {
898
874
  constructor(body) {
899
875
  super(
900
- `TAG_NOT_FOUND: ${body.message}`
876
+ `FORBIDDEN: ${body.message}`
901
877
  );
902
878
  this.body = body;
903
- this.name = "TagNotFoundError";
879
+ this.name = "ForbiddenError";
904
880
  }
905
- static code = "TAG_NOT_FOUND";
906
- static statusCode = 404;
907
- static description = `Tag not found: {tag}`;
881
+ static code = "FORBIDDEN";
882
+ static statusCode = 403;
883
+ static description = `You do not have permission to push to this repository`;
908
884
  }
909
- class BranchNotFoundError extends Error {
885
+ class UnauthorizedError extends Error {
910
886
  constructor(body) {
911
887
  super(
912
- `BRANCH_NOT_FOUND: ${body.message}`
888
+ `UNAUTHORIZED: ${body.message}`
913
889
  );
914
890
  this.body = body;
915
- this.name = "BranchNotFoundError";
891
+ this.name = "UnauthorizedError";
916
892
  }
917
- static code = "BRANCH_NOT_FOUND";
918
- static statusCode = 404;
919
- static description = `Branch not found: {branch}`;
893
+ static code = "UNAUTHORIZED";
894
+ static statusCode = 401;
895
+ static description = `Unauthorized`;
920
896
  }
921
- class RepoNotFoundError extends Error {
897
+ class InvalidServiceError extends Error {
922
898
  constructor(body) {
923
899
  super(
924
- `REPO_NOT_FOUND: ${body.message}`
900
+ `INVALID_SERVICE: ${body.message}`
925
901
  );
926
902
  this.body = body;
927
- this.name = "RepoNotFoundError";
903
+ this.name = "InvalidServiceError";
928
904
  }
929
- static code = "REPO_NOT_FOUND";
930
- static statusCode = 404;
931
- static description = `Repository not found`;
905
+ static code = "INVALID_SERVICE";
906
+ static statusCode = 403;
907
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
932
908
  }
933
- class InvalidObjectIdError extends Error {
909
+ class ExpectedServiceError extends Error {
934
910
  constructor(body) {
935
911
  super(
936
- `INVALID_OBJECT_ID: ${body.message}`
912
+ `EXPECTED_SERVICE: ${body.message}`
937
913
  );
938
914
  this.body = body;
939
- this.name = "InvalidObjectIdError";
915
+ this.name = "ExpectedServiceError";
940
916
  }
941
- static code = "INVALID_OBJECT_ID";
942
- static statusCode = 400;
943
- static description = `Invalid object ID`;
917
+ static code = "EXPECTED_SERVICE";
918
+ static statusCode = 403;
919
+ static description = `Expected 'service' query parameter`;
944
920
  }
945
- class CommitNotFoundError extends Error {
921
+ class UnsupportedTransferError extends Error {
946
922
  constructor(body) {
947
923
  super(
948
- `COMMIT_NOT_FOUND: ${body.message}`
924
+ `UNSUPPORTED_TRANSFER: ${body.message}`
949
925
  );
950
926
  this.body = body;
951
- this.name = "CommitNotFoundError";
927
+ this.name = "UnsupportedTransferError";
952
928
  }
953
- static code = "COMMIT_NOT_FOUND";
954
- static statusCode = 404;
955
- static description = `Commit not found: {hash}`;
929
+ static code = "UNSUPPORTED_TRANSFER";
930
+ static statusCode = 400;
931
+ static description = `Unsupported LFS transfer protocol(s)`;
956
932
  }
957
- class ReferenceNotFoundError extends Error {
933
+ class ConflictError extends Error {
958
934
  constructor(body) {
959
935
  super(
960
- `REFERENCE_NOT_FOUND: ${body.message}`
936
+ `CONFLICT: ${body.message}`
961
937
  );
962
938
  this.body = body;
963
- this.name = "ReferenceNotFoundError";
939
+ this.name = "ConflictError";
964
940
  }
965
- static code = "REFERENCE_NOT_FOUND";
966
- static statusCode = 404;
967
- static description = `Reference not found: {reference}`;
941
+ static code = "CONFLICT";
942
+ static statusCode = 409;
943
+ static description = `Sync conflict: {message}`;
968
944
  }
969
- class PathNotFoundError extends Error {
945
+ class BranchNotFoundError extends Error {
970
946
  constructor(body) {
971
947
  super(
972
- `PATH_NOT_FOUND: ${body.message}`
948
+ `BRANCH_NOT_FOUND: ${body.message}`
973
949
  );
974
950
  this.body = body;
975
- this.name = "PathNotFoundError";
951
+ this.name = "BranchNotFoundError";
976
952
  }
977
- static code = "PATH_NOT_FOUND";
953
+ static code = "BRANCH_NOT_FOUND";
978
954
  static statusCode = 404;
979
- static description = `Path not found: {path}`;
955
+ static description = `Branch not found: {branch}`;
980
956
  }
981
- class InvalidRequestError extends Error {
957
+ class SourceImportConflictError extends Error {
982
958
  constructor(body) {
983
959
  super(
984
- `INVALID_REQUEST: ${body.message}`
960
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
985
961
  );
986
962
  this.body = body;
987
- this.name = "InvalidRequestError";
963
+ this.name = "SourceImportConflictError";
988
964
  }
989
- static code = "INVALID_REQUEST";
965
+ static code = "SOURCE_IMPORT_CONFLICT";
990
966
  static statusCode = 400;
991
- static description = `null`;
967
+ static description = `Source and import are mutually exclusive`;
992
968
  }
993
- class InvalidRevisionError extends Error {
969
+ class SourceUnauthorizedError extends Error {
994
970
  constructor(body) {
995
971
  super(
996
- `INVALID_REVISION: ${body.message}`
972
+ `SOURCE_UNAUTHORIZED: ${body.message}`
997
973
  );
998
974
  this.body = body;
999
- this.name = "InvalidRevisionError";
975
+ this.name = "SourceUnauthorizedError";
1000
976
  }
1001
- static code = "INVALID_REVISION";
977
+ static code = "SOURCE_UNAUTHORIZED";
1002
978
  static statusCode = 400;
1003
- static description = `null`;
979
+ static description = `Unauthorized to access source repository at {url}`;
1004
980
  }
1005
- class ForbiddenError extends Error {
981
+ class SourceNotFoundError extends Error {
1006
982
  constructor(body) {
1007
983
  super(
1008
- `FORBIDDEN: ${body.message}`
984
+ `SOURCE_NOT_FOUND: ${body.message}`
1009
985
  );
1010
986
  this.body = body;
1011
- this.name = "ForbiddenError";
987
+ this.name = "SourceNotFoundError";
1012
988
  }
1013
- static code = "FORBIDDEN";
1014
- static statusCode = 403;
1015
- static description = `Forbidden`;
989
+ static code = "SOURCE_NOT_FOUND";
990
+ static statusCode = 400;
991
+ static description = `Source repository not found at {url}`;
1016
992
  }
1017
- class UnauthorizedError extends Error {
993
+ class ImportSubdirNotFoundError extends Error {
1018
994
  constructor(body) {
1019
995
  super(
1020
- `UNAUTHORIZED: ${body.message}`
996
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1021
997
  );
1022
998
  this.body = body;
1023
- this.name = "UnauthorizedError";
999
+ this.name = "ImportSubdirNotFoundError";
1024
1000
  }
1025
- static code = "UNAUTHORIZED";
1026
- static statusCode = 401;
1027
- static description = `Unauthorized`;
1001
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1002
+ static statusCode = 400;
1003
+ static description = `Directory not found in {source}: {dir}`;
1028
1004
  }
1029
- class ConflictError extends Error {
1005
+ class RepoAlreadyExistsError extends Error {
1030
1006
  constructor(body) {
1031
1007
  super(
1032
- `CONFLICT: ${body.message}`
1008
+ `REPO_ALREADY_EXISTS: ${body.message}`
1033
1009
  );
1034
1010
  this.body = body;
1035
- this.name = "ConflictError";
1011
+ this.name = "RepoAlreadyExistsError";
1036
1012
  }
1037
- static code = "CONFLICT";
1013
+ static code = "REPO_ALREADY_EXISTS";
1038
1014
  static statusCode = 409;
1039
- static description = `Sync conflict: {message}`;
1015
+ static description = `Repo '{repo_id}' already exists`;
1040
1016
  }
1041
- class UnsupportedTransferError extends Error {
1017
+ class PathNotFoundError extends Error {
1042
1018
  constructor(body) {
1043
1019
  super(
1044
- `UNSUPPORTED_TRANSFER: ${body.message}`
1020
+ `PATH_NOT_FOUND: ${body.message}`
1045
1021
  );
1046
1022
  this.body = body;
1047
- this.name = "UnsupportedTransferError";
1023
+ this.name = "PathNotFoundError";
1048
1024
  }
1049
- static code = "UNSUPPORTED_TRANSFER";
1025
+ static code = "PATH_NOT_FOUND";
1026
+ static statusCode = 404;
1027
+ static description = `Path not found: {path}`;
1028
+ }
1029
+ class ReferenceNotFoundError extends Error {
1030
+ constructor(body) {
1031
+ super(
1032
+ `REFERENCE_NOT_FOUND: ${body.message}`
1033
+ );
1034
+ this.body = body;
1035
+ this.name = "ReferenceNotFoundError";
1036
+ }
1037
+ static code = "REFERENCE_NOT_FOUND";
1038
+ static statusCode = 404;
1039
+ static description = `Reference not found: {reference}`;
1040
+ }
1041
+ class TagNotFoundError extends Error {
1042
+ constructor(body) {
1043
+ super(
1044
+ `TAG_NOT_FOUND: ${body.message}`
1045
+ );
1046
+ this.body = body;
1047
+ this.name = "TagNotFoundError";
1048
+ }
1049
+ static code = "TAG_NOT_FOUND";
1050
+ static statusCode = 404;
1051
+ static description = `Tag not found: {hash}`;
1052
+ }
1053
+ class SendErrorError extends Error {
1054
+ constructor(body) {
1055
+ super(
1056
+ `SEND_ERROR: ${body.message}`
1057
+ );
1058
+ this.body = body;
1059
+ this.name = "SendErrorError";
1060
+ }
1061
+ static code = "SEND_ERROR";
1062
+ static statusCode = 500;
1063
+ static description = `Stream receiver dropped`;
1064
+ }
1065
+ class GitHubSyncConflictError extends Error {
1066
+ constructor(body) {
1067
+ super(
1068
+ `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1069
+ );
1070
+ this.body = body;
1071
+ this.name = "GitHubSyncConflictError";
1072
+ }
1073
+ static code = "GIT_HUB_SYNC_CONFLICT";
1074
+ static statusCode = 409;
1075
+ static description = `GitHub Sync Conflict: {message}`;
1076
+ }
1077
+ class InvalidObjectIdError extends Error {
1078
+ constructor(body) {
1079
+ super(
1080
+ `INVALID_OBJECT_ID: ${body.message}`
1081
+ );
1082
+ this.body = body;
1083
+ this.name = "InvalidObjectIdError";
1084
+ }
1085
+ static code = "INVALID_OBJECT_ID";
1050
1086
  static statusCode = 400;
1051
- static description = `Unsupported LFS transfer protocol(s)`;
1087
+ static description = `Invalid object ID: {hash}`;
1052
1088
  }
1053
- class BlobNotFoundError extends Error {
1089
+ class CommitNotFoundError extends Error {
1054
1090
  constructor(body) {
1055
1091
  super(
1056
- `BLOB_NOT_FOUND: ${body.message}`
1092
+ `COMMIT_NOT_FOUND: ${body.message}`
1057
1093
  );
1058
1094
  this.body = body;
1059
- this.name = "BlobNotFoundError";
1095
+ this.name = "CommitNotFoundError";
1060
1096
  }
1061
- static code = "BLOB_NOT_FOUND";
1097
+ static code = "COMMIT_NOT_FOUND";
1062
1098
  static statusCode = 404;
1063
- static description = `Blob not found: {hash}`;
1099
+ static description = `Commit {commit_hash} not found in repository {repo_id}`;
1064
1100
  }
1065
1101
  class TreeNotFoundError extends Error {
1066
1102
  constructor(body) {
@@ -1074,6 +1110,126 @@ class TreeNotFoundError extends Error {
1074
1110
  static statusCode = 404;
1075
1111
  static description = `Tree not found: {hash}`;
1076
1112
  }
1113
+ class InvalidRevisionError extends Error {
1114
+ constructor(body) {
1115
+ super(
1116
+ `INVALID_REVISION: ${body.message}`
1117
+ );
1118
+ this.body = body;
1119
+ this.name = "InvalidRevisionError";
1120
+ }
1121
+ static code = "INVALID_REVISION";
1122
+ static statusCode = 400;
1123
+ static description = `Invalid revision: {revision}`;
1124
+ }
1125
+ class InvalidRangeError extends Error {
1126
+ constructor(body) {
1127
+ super(
1128
+ `INVALID_RANGE: ${body.message}`
1129
+ );
1130
+ this.body = body;
1131
+ this.name = "InvalidRangeError";
1132
+ }
1133
+ static code = "INVALID_RANGE";
1134
+ static statusCode = 400;
1135
+ static description = `Invalid range: 'until' commit ({until}) must be a descendant of 'since' commit ({since}). In other words, 'until' must be newer than 'since' in the commit graph.`;
1136
+ }
1137
+ class OffsetWithSelectorError extends Error {
1138
+ constructor(body) {
1139
+ super(
1140
+ `OFFSET_WITH_SELECTOR: ${body.message}`
1141
+ );
1142
+ this.body = body;
1143
+ this.name = "OffsetWithSelectorError";
1144
+ }
1145
+ static code = "OFFSET_WITH_SELECTOR";
1146
+ static statusCode = 400;
1147
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1148
+ }
1149
+ class CommitNotInBranchError extends Error {
1150
+ constructor(body) {
1151
+ super(
1152
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1153
+ );
1154
+ this.body = body;
1155
+ this.name = "CommitNotInBranchError";
1156
+ }
1157
+ static code = "COMMIT_NOT_IN_BRANCH";
1158
+ static statusCode = 400;
1159
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1160
+ }
1161
+ class BlobNotFoundError extends Error {
1162
+ constructor(body) {
1163
+ super(
1164
+ `BLOB_NOT_FOUND: ${body.message}`
1165
+ );
1166
+ this.body = body;
1167
+ this.name = "BlobNotFoundError";
1168
+ }
1169
+ static code = "BLOB_NOT_FOUND";
1170
+ static statusCode = 404;
1171
+ static description = `Blob not found: {hash}`;
1172
+ }
1173
+ class AmbiguousError extends Error {
1174
+ constructor(body) {
1175
+ super(
1176
+ `AMBIGUOUS: ${body.message}`
1177
+ );
1178
+ this.body = body;
1179
+ this.name = "AmbiguousError";
1180
+ }
1181
+ static code = "AMBIGUOUS";
1182
+ static statusCode = 400;
1183
+ static description = `rev is ambiguous: {rev}`;
1184
+ }
1185
+ class InvalidError extends Error {
1186
+ constructor(body) {
1187
+ super(
1188
+ `INVALID: ${body.message}`
1189
+ );
1190
+ this.body = body;
1191
+ this.name = "InvalidError";
1192
+ }
1193
+ static code = "INVALID";
1194
+ static statusCode = 400;
1195
+ static description = `invalid rev syntax: {rev}`;
1196
+ }
1197
+ class PackfileError extends Error {
1198
+ constructor(body) {
1199
+ super(
1200
+ `PACKFILE: ${body.message}`
1201
+ );
1202
+ this.body = body;
1203
+ this.name = "PackfileError";
1204
+ }
1205
+ static code = "PACKFILE";
1206
+ static statusCode = 500;
1207
+ static description = `Error building packfile`;
1208
+ }
1209
+ class DatabaseErrorError extends Error {
1210
+ constructor(body) {
1211
+ super(
1212
+ `DATABASE_ERROR: ${body.message}`
1213
+ );
1214
+ this.body = body;
1215
+ this.name = "DatabaseErrorError";
1216
+ }
1217
+ static code = "DATABASE_ERROR";
1218
+ static statusCode = 500;
1219
+ static description = `Database error: {0}`;
1220
+ }
1221
+ class EmptyTagError extends Error {
1222
+ constructor(body) {
1223
+ super(
1224
+ `EMPTY_TAG: ${body.message}`
1225
+ );
1226
+ this.body = body;
1227
+ this.name = "EmptyTagError";
1228
+ }
1229
+ static code = "EMPTY_TAG";
1230
+ static statusCode = 400;
1231
+ static description = `Invalid request: tag cannot be empty`;
1232
+ }
1077
1233
  class ResizeFailedError extends Error {
1078
1234
  constructor(body) {
1079
1235
  super(
@@ -1098,77 +1254,257 @@ class InternalResizeVmNotFoundError extends Error {
1098
1254
  static statusCode = 404;
1099
1255
  static description = `VM not found`;
1100
1256
  }
1101
- class ObservabilityDatabaseErrorError extends Error {
1257
+ class DomainOwnershipVerificationFailedError extends Error {
1102
1258
  constructor(body) {
1103
1259
  super(
1104
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
1260
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1105
1261
  );
1106
1262
  this.body = body;
1107
- this.name = "ObservabilityDatabaseErrorError";
1263
+ this.name = "DomainOwnershipVerificationFailedError";
1108
1264
  }
1109
- static code = "OBSERVABILITY_DATABASE_ERROR";
1265
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1266
+ static statusCode = 403;
1267
+ static description = `Domain ownership verification failed`;
1268
+ }
1269
+ class ErrorDeletingRecordError extends Error {
1270
+ constructor(body) {
1271
+ super(
1272
+ `ERROR_DELETING_RECORD: ${body.message}`
1273
+ );
1274
+ this.body = body;
1275
+ this.name = "ErrorDeletingRecordError";
1276
+ }
1277
+ static code = "ERROR_DELETING_RECORD";
1110
1278
  static statusCode = 500;
1111
- static description = `Database operation failed: {message}`;
1279
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1112
1280
  }
1113
- class ObservabilityAccessDeniedError extends Error {
1281
+ class RecordOwnershipErrorError extends Error {
1114
1282
  constructor(body) {
1115
1283
  super(
1116
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
1284
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
1117
1285
  );
1118
1286
  this.body = body;
1119
- this.name = "ObservabilityAccessDeniedError";
1287
+ this.name = "RecordOwnershipErrorError";
1120
1288
  }
1121
- static code = "OBSERVABILITY_ACCESS_DENIED";
1289
+ static code = "RECORD_OWNERSHIP_ERROR";
1122
1290
  static statusCode = 403;
1123
- static description = `Access denied to logs for deployment: {deployment_id}`;
1291
+ static description = `Account {account_id} does not own record {record_id}`;
1124
1292
  }
1125
- class ParseLogsFailedError extends Error {
1293
+ class ErrorCreatingRecordError extends Error {
1126
1294
  constructor(body) {
1127
1295
  super(
1128
- `PARSE_LOGS_FAILED: ${body.message}`
1296
+ `ERROR_CREATING_RECORD: ${body.message}`
1129
1297
  );
1130
1298
  this.body = body;
1131
- this.name = "ParseLogsFailedError";
1299
+ this.name = "ErrorCreatingRecordError";
1132
1300
  }
1133
- static code = "PARSE_LOGS_FAILED";
1301
+ static code = "ERROR_CREATING_RECORD";
1134
1302
  static statusCode = 500;
1135
- static description = `Failed to parse logs: {message}`;
1303
+ static description = `Error creating DNS record: {message}`;
1136
1304
  }
1137
- class RetrieveLogsFailedError extends Error {
1305
+ class DomainOwnershipErrorError extends Error {
1138
1306
  constructor(body) {
1139
1307
  super(
1140
- `RETRIEVE_LOGS_FAILED: ${body.message}`
1308
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1141
1309
  );
1142
1310
  this.body = body;
1143
- this.name = "RetrieveLogsFailedError";
1311
+ this.name = "DomainOwnershipErrorError";
1144
1312
  }
1145
- static code = "RETRIEVE_LOGS_FAILED";
1313
+ static code = "DOMAIN_OWNERSHIP_ERROR";
1314
+ static statusCode = 403;
1315
+ static description = `Account {account_id} does not own domain {domain}`;
1316
+ }
1317
+ class BrowserOperationFailedError extends Error {
1318
+ constructor(body) {
1319
+ super(
1320
+ `BROWSER_OPERATION_FAILED: ${body.message}`
1321
+ );
1322
+ this.body = body;
1323
+ this.name = "BrowserOperationFailedError";
1324
+ }
1325
+ static code = "BROWSER_OPERATION_FAILED";
1146
1326
  static statusCode = 500;
1147
- static description = `Failed to retrieve logs: {message}`;
1327
+ static description = `Browser operation failed: {message}`;
1148
1328
  }
1149
- class InvalidQueryError extends Error {
1329
+ class WatchFilesFailedError extends Error {
1150
1330
  constructor(body) {
1151
1331
  super(
1152
- `INVALID_QUERY: ${body.message}`
1332
+ `WATCH_FILES_FAILED: ${body.message}`
1153
1333
  );
1154
1334
  this.body = body;
1155
- this.name = "InvalidQueryError";
1335
+ this.name = "WatchFilesFailedError";
1156
1336
  }
1157
- static code = "INVALID_QUERY";
1337
+ static code = "WATCH_FILES_FAILED";
1338
+ static statusCode = 500;
1339
+ static description = `Failed to watch files: {message}`;
1340
+ }
1341
+ class LogsFailedError extends Error {
1342
+ constructor(body) {
1343
+ super(
1344
+ `LOGS_FAILED: ${body.message}`
1345
+ );
1346
+ this.body = body;
1347
+ this.name = "LogsFailedError";
1348
+ }
1349
+ static code = "LOGS_FAILED";
1350
+ static statusCode = 500;
1351
+ static description = `Failed to get logs: {message}`;
1352
+ }
1353
+ class StatusFailedError extends Error {
1354
+ constructor(body) {
1355
+ super(
1356
+ `STATUS_FAILED: ${body.message}`
1357
+ );
1358
+ this.body = body;
1359
+ this.name = "StatusFailedError";
1360
+ }
1361
+ static code = "STATUS_FAILED";
1362
+ static statusCode = 500;
1363
+ static description = `Failed to get dev server status: {message}`;
1364
+ }
1365
+ class RestartFailedError extends Error {
1366
+ constructor(body) {
1367
+ super(
1368
+ `RESTART_FAILED: ${body.message}`
1369
+ );
1370
+ this.body = body;
1371
+ this.name = "RestartFailedError";
1372
+ }
1373
+ static code = "RESTART_FAILED";
1374
+ static statusCode = 500;
1375
+ static description = `Failed to restart dev server: {message}`;
1376
+ }
1377
+ class ShutdownFailedError extends Error {
1378
+ constructor(body) {
1379
+ super(
1380
+ `SHUTDOWN_FAILED: ${body.message}`
1381
+ );
1382
+ this.body = body;
1383
+ this.name = "ShutdownFailedError";
1384
+ }
1385
+ static code = "SHUTDOWN_FAILED";
1386
+ static statusCode = 500;
1387
+ static description = `Failed to shutdown dev server: {message}`;
1388
+ }
1389
+ class CommitFailedError extends Error {
1390
+ constructor(body) {
1391
+ super(
1392
+ `COMMIT_FAILED: ${body.message}`
1393
+ );
1394
+ this.body = body;
1395
+ this.name = "CommitFailedError";
1396
+ }
1397
+ static code = "COMMIT_FAILED";
1398
+ static statusCode = 500;
1399
+ static description = `Failed to commit changes: {message}`;
1400
+ }
1401
+ class WriteFileFailedError extends Error {
1402
+ constructor(body) {
1403
+ super(
1404
+ `WRITE_FILE_FAILED: ${body.message}`
1405
+ );
1406
+ this.body = body;
1407
+ this.name = "WriteFileFailedError";
1408
+ }
1409
+ static code = "WRITE_FILE_FAILED";
1410
+ static statusCode = 500;
1411
+ static description = `Failed to write file: {message}`;
1412
+ }
1413
+ class ReadFileFailedError extends Error {
1414
+ constructor(body) {
1415
+ super(
1416
+ `READ_FILE_FAILED: ${body.message}`
1417
+ );
1418
+ this.body = body;
1419
+ this.name = "ReadFileFailedError";
1420
+ }
1421
+ static code = "READ_FILE_FAILED";
1422
+ static statusCode = 500;
1423
+ static description = `Failed to read file: {message}`;
1424
+ }
1425
+ class ExecutionFailedError extends Error {
1426
+ constructor(body) {
1427
+ super(
1428
+ `EXECUTION_FAILED: ${body.message}`
1429
+ );
1430
+ this.body = body;
1431
+ this.name = "ExecutionFailedError";
1432
+ }
1433
+ static code = "EXECUTION_FAILED";
1434
+ static statusCode = 500;
1435
+ static description = `Failed to execute command: {message}`;
1436
+ }
1437
+ class RequestFailedError extends Error {
1438
+ constructor(body) {
1439
+ super(
1440
+ `REQUEST_FAILED: ${body.message}`
1441
+ );
1442
+ this.body = body;
1443
+ this.name = "RequestFailedError";
1444
+ }
1445
+ static code = "REQUEST_FAILED";
1446
+ static statusCode = 500;
1447
+ static description = `Failed to request dev server: {message}`;
1448
+ }
1449
+ class DevServerFileNotFoundError extends Error {
1450
+ constructor(body) {
1451
+ super(
1452
+ `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
1453
+ );
1454
+ this.body = body;
1455
+ this.name = "DevServerFileNotFoundError";
1456
+ }
1457
+ static code = "DEV_SERVER_FILE_NOT_FOUND";
1458
+ static statusCode = 404;
1459
+ static description = `Dev server file not found: {path}`;
1460
+ }
1461
+ class DevServerInvalidRequestError extends Error {
1462
+ constructor(body) {
1463
+ super(
1464
+ `DEV_SERVER_INVALID_REQUEST: ${body.message}`
1465
+ );
1466
+ this.body = body;
1467
+ this.name = "DevServerInvalidRequestError";
1468
+ }
1469
+ static code = "DEV_SERVER_INVALID_REQUEST";
1158
1470
  static statusCode = 400;
1159
- static description = `Invalid log query: {message}`;
1471
+ static description = `Invalid dev server request: {message}`;
1160
1472
  }
1161
- class LogsNotFoundError extends Error {
1473
+ class DevServerNotFoundError extends Error {
1162
1474
  constructor(body) {
1163
1475
  super(
1164
- `LOGS_NOT_FOUND: ${body.message}`
1476
+ `DEV_SERVER_NOT_FOUND: ${body.message}`
1165
1477
  );
1166
1478
  this.body = body;
1167
- this.name = "LogsNotFoundError";
1479
+ this.name = "DevServerNotFoundError";
1480
+ }
1481
+ static code = "DEV_SERVER_NOT_FOUND";
1482
+ static statusCode = 404;
1483
+ static description = `Dev server not found: {server_id}`;
1484
+ }
1485
+ class AnyhowError extends Error {
1486
+ constructor(body) {
1487
+ super(
1488
+ `ANYHOW: ${body.message}`
1489
+ );
1490
+ this.body = body;
1491
+ this.name = "AnyhowError";
1492
+ }
1493
+ static code = "ANYHOW";
1494
+ static statusCode = 500;
1495
+ static description = `Internal server error: {0}`;
1496
+ }
1497
+ class BranchNameEmptyError extends Error {
1498
+ constructor(body) {
1499
+ super(
1500
+ `BRANCH_NAME_EMPTY: ${body.message}`
1501
+ );
1502
+ this.body = body;
1503
+ this.name = "BranchNameEmptyError";
1168
1504
  }
1169
- static code = "LOGS_NOT_FOUND";
1170
- static statusCode = 404;
1171
- static description = `Logs not found for deployment: {deployment_id}`;
1505
+ static code = "BRANCH_NAME_EMPTY";
1506
+ static statusCode = 400;
1507
+ static description = `Branch name cannot be empty`;
1172
1508
  }
1173
1509
  class PermissionAlreadyExistsError extends Error {
1174
1510
  constructor(body) {
@@ -1572,395 +1908,143 @@ class LoggingFailedError extends Error {
1572
1908
  `LOGGING_FAILED: ${body.message}`
1573
1909
  );
1574
1910
  this.body = body;
1575
- this.name = "LoggingFailedError";
1576
- }
1577
- static code = "LOGGING_FAILED";
1578
- static statusCode = 500;
1579
- static description = `Failed to log execute run: {message}`;
1580
- }
1581
- class RunNotFoundError extends Error {
1582
- constructor(body) {
1583
- super(
1584
- `RUN_NOT_FOUND: ${body.message}`
1585
- );
1586
- this.body = body;
1587
- this.name = "RunNotFoundError";
1588
- }
1589
- static code = "RUN_NOT_FOUND";
1590
- static statusCode = 404;
1591
- static description = `Execute run not found: {run_id}`;
1592
- }
1593
- class FailedToProvisionCertificateError extends Error {
1594
- constructor(body) {
1595
- super(
1596
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
1597
- );
1598
- this.body = body;
1599
- this.name = "FailedToProvisionCertificateError";
1600
- }
1601
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
1602
- static statusCode = 422;
1603
- static description = `Failed to provision certificate: {message}`;
1604
- }
1605
- class FailedToInsertDomainMappingError extends Error {
1606
- constructor(body) {
1607
- super(
1608
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
1609
- );
1610
- this.body = body;
1611
- this.name = "FailedToInsertDomainMappingError";
1612
- }
1613
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
1614
- static statusCode = 500;
1615
- static description = `Failed to insert domain mapping: {message}`;
1616
- }
1617
- class PermissionDeniedError extends Error {
1618
- constructor(body) {
1619
- super(
1620
- `PERMISSION_DENIED: ${body.message}`
1621
- );
1622
- this.body = body;
1623
- this.name = "PermissionDeniedError";
1624
- }
1625
- static code = "PERMISSION_DENIED";
1626
- static statusCode = 401;
1627
- static description = `Permission denied: {message}`;
1628
- }
1629
- class FailedToCheckPermissionsError extends Error {
1630
- constructor(body) {
1631
- super(
1632
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
1633
- );
1634
- this.body = body;
1635
- this.name = "FailedToCheckPermissionsError";
1636
- }
1637
- static code = "FAILED_TO_CHECK_PERMISSIONS";
1638
- static statusCode = 502;
1639
- static description = `Failed to check permissions: {message}`;
1640
- }
1641
- class FailedToListDomainsError extends Error {
1642
- constructor(body) {
1643
- super(
1644
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
1645
- );
1646
- this.body = body;
1647
- this.name = "FailedToListDomainsError";
1648
- }
1649
- static code = "FAILED_TO_LIST_DOMAINS";
1650
- static statusCode = 500;
1651
- static description = `Failed to list domains: {message}`;
1652
- }
1653
- class FailedToListVerificationsError extends Error {
1654
- constructor(body) {
1655
- super(
1656
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
1657
- );
1658
- this.body = body;
1659
- this.name = "FailedToListVerificationsError";
1660
- }
1661
- static code = "FAILED_TO_LIST_VERIFICATIONS";
1662
- static statusCode = 500;
1663
- static description = `Failed to list verifications: {message}`;
1664
- }
1665
- class FailedToVerifyDomainError extends Error {
1666
- constructor(body) {
1667
- super(
1668
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
1669
- );
1670
- this.body = body;
1671
- this.name = "FailedToVerifyDomainError";
1672
- }
1673
- static code = "FAILED_TO_VERIFY_DOMAIN";
1674
- static statusCode = 500;
1675
- static description = `Failed to verify domain: {message}`;
1676
- }
1677
- class VerificationFailedError extends Error {
1678
- constructor(body) {
1679
- super(
1680
- `VERIFICATION_FAILED: ${body.message}`
1681
- );
1682
- this.body = body;
1683
- this.name = "VerificationFailedError";
1684
- }
1685
- static code = "VERIFICATION_FAILED";
1686
- static statusCode = 400;
1687
- static description = `Domain verification failed: {message}`;
1688
- }
1689
- class FailedToDeleteVerificationError extends Error {
1690
- constructor(body) {
1691
- super(
1692
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
1693
- );
1694
- this.body = body;
1695
- this.name = "FailedToDeleteVerificationError";
1696
- }
1697
- static code = "FAILED_TO_DELETE_VERIFICATION";
1698
- static statusCode = 400;
1699
- static description = `Failed to delete verification: {message}`;
1700
- }
1701
- class VerificationNotFoundError extends Error {
1702
- constructor(body) {
1703
- super(
1704
- `VERIFICATION_NOT_FOUND: ${body.message}`
1705
- );
1706
- this.body = body;
1707
- this.name = "VerificationNotFoundError";
1708
- }
1709
- static code = "VERIFICATION_NOT_FOUND";
1710
- static statusCode = 404;
1711
- static description = `Verification request not found for domain: {domain}`;
1712
- }
1713
- class FailedToCreateVerificationCodeError extends Error {
1714
- constructor(body) {
1715
- super(
1716
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
1717
- );
1718
- this.body = body;
1719
- this.name = "FailedToCreateVerificationCodeError";
1720
- }
1721
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
1722
- static statusCode = 400;
1723
- static description = `Failed to create verification code: {message}`;
1724
- }
1725
- class InvalidDomainError extends Error {
1726
- constructor(body) {
1727
- super(
1728
- `INVALID_DOMAIN: ${body.message}`
1729
- );
1730
- this.body = body;
1731
- this.name = "InvalidDomainError";
1732
- }
1733
- static code = "INVALID_DOMAIN";
1734
- static statusCode = 400;
1735
- static description = `Invalid domain: {domain}`;
1736
- }
1737
- class DomainOwnershipVerificationFailedError extends Error {
1738
- constructor(body) {
1739
- super(
1740
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1741
- );
1742
- this.body = body;
1743
- this.name = "DomainOwnershipVerificationFailedError";
1744
- }
1745
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1746
- static statusCode = 403;
1747
- static description = `Domain ownership verification failed`;
1748
- }
1749
- class ErrorDeletingRecordError extends Error {
1750
- constructor(body) {
1751
- super(
1752
- `ERROR_DELETING_RECORD: ${body.message}`
1753
- );
1754
- this.body = body;
1755
- this.name = "ErrorDeletingRecordError";
1756
- }
1757
- static code = "ERROR_DELETING_RECORD";
1758
- static statusCode = 500;
1759
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1760
- }
1761
- class RecordOwnershipErrorError extends Error {
1762
- constructor(body) {
1763
- super(
1764
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
1765
- );
1766
- this.body = body;
1767
- this.name = "RecordOwnershipErrorError";
1768
- }
1769
- static code = "RECORD_OWNERSHIP_ERROR";
1770
- static statusCode = 403;
1771
- static description = `Account {account_id} does not own record {record_id}`;
1772
- }
1773
- class ErrorCreatingRecordError extends Error {
1774
- constructor(body) {
1775
- super(
1776
- `ERROR_CREATING_RECORD: ${body.message}`
1777
- );
1778
- this.body = body;
1779
- this.name = "ErrorCreatingRecordError";
1780
- }
1781
- static code = "ERROR_CREATING_RECORD";
1782
- static statusCode = 500;
1783
- static description = `Error creating DNS record: {message}`;
1784
- }
1785
- class DomainOwnershipErrorError extends Error {
1786
- constructor(body) {
1787
- super(
1788
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1789
- );
1790
- this.body = body;
1791
- this.name = "DomainOwnershipErrorError";
1792
- }
1793
- static code = "DOMAIN_OWNERSHIP_ERROR";
1794
- static statusCode = 403;
1795
- static description = `Account {account_id} does not own domain {domain}`;
1796
- }
1797
- class BrowserOperationFailedError extends Error {
1798
- constructor(body) {
1799
- super(
1800
- `BROWSER_OPERATION_FAILED: ${body.message}`
1801
- );
1802
- this.body = body;
1803
- this.name = "BrowserOperationFailedError";
1804
- }
1805
- static code = "BROWSER_OPERATION_FAILED";
1806
- static statusCode = 500;
1807
- static description = `Browser operation failed: {message}`;
1808
- }
1809
- class WatchFilesFailedError extends Error {
1810
- constructor(body) {
1811
- super(
1812
- `WATCH_FILES_FAILED: ${body.message}`
1813
- );
1814
- this.body = body;
1815
- this.name = "WatchFilesFailedError";
1816
- }
1817
- static code = "WATCH_FILES_FAILED";
1818
- static statusCode = 500;
1819
- static description = `Failed to watch files: {message}`;
1820
- }
1821
- class LogsFailedError extends Error {
1822
- constructor(body) {
1823
- super(
1824
- `LOGS_FAILED: ${body.message}`
1825
- );
1826
- this.body = body;
1827
- this.name = "LogsFailedError";
1911
+ this.name = "LoggingFailedError";
1828
1912
  }
1829
- static code = "LOGS_FAILED";
1913
+ static code = "LOGGING_FAILED";
1830
1914
  static statusCode = 500;
1831
- static description = `Failed to get logs: {message}`;
1915
+ static description = `Failed to log execute run: {message}`;
1832
1916
  }
1833
- class StatusFailedError extends Error {
1917
+ class RunNotFoundError extends Error {
1834
1918
  constructor(body) {
1835
1919
  super(
1836
- `STATUS_FAILED: ${body.message}`
1920
+ `RUN_NOT_FOUND: ${body.message}`
1837
1921
  );
1838
1922
  this.body = body;
1839
- this.name = "StatusFailedError";
1923
+ this.name = "RunNotFoundError";
1840
1924
  }
1841
- static code = "STATUS_FAILED";
1842
- static statusCode = 500;
1843
- static description = `Failed to get dev server status: {message}`;
1925
+ static code = "RUN_NOT_FOUND";
1926
+ static statusCode = 404;
1927
+ static description = `Execute run not found: {run_id}`;
1844
1928
  }
1845
- class RestartFailedError extends Error {
1929
+ class CloudstateInternalErrorError extends Error {
1846
1930
  constructor(body) {
1847
1931
  super(
1848
- `RESTART_FAILED: ${body.message}`
1932
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
1849
1933
  );
1850
1934
  this.body = body;
1851
- this.name = "RestartFailedError";
1935
+ this.name = "CloudstateInternalErrorError";
1852
1936
  }
1853
- static code = "RESTART_FAILED";
1937
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
1854
1938
  static statusCode = 500;
1855
- static description = `Failed to restart dev server: {message}`;
1939
+ static description = `Internal error: {message}`;
1856
1940
  }
1857
- class ShutdownFailedError extends Error {
1941
+ class CloudstateDatabaseErrorError extends Error {
1858
1942
  constructor(body) {
1859
1943
  super(
1860
- `SHUTDOWN_FAILED: ${body.message}`
1944
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
1861
1945
  );
1862
1946
  this.body = body;
1863
- this.name = "ShutdownFailedError";
1947
+ this.name = "CloudstateDatabaseErrorError";
1864
1948
  }
1865
- static code = "SHUTDOWN_FAILED";
1949
+ static code = "CLOUDSTATE_DATABASE_ERROR";
1866
1950
  static statusCode = 500;
1867
- static description = `Failed to shutdown dev server: {message}`;
1951
+ static description = `Database operation failed: {message}`;
1868
1952
  }
1869
- class CommitFailedError extends Error {
1953
+ class CloudstateAccessDeniedError extends Error {
1870
1954
  constructor(body) {
1871
1955
  super(
1872
- `COMMIT_FAILED: ${body.message}`
1956
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
1873
1957
  );
1874
1958
  this.body = body;
1875
- this.name = "CommitFailedError";
1959
+ this.name = "CloudstateAccessDeniedError";
1876
1960
  }
1877
- static code = "COMMIT_FAILED";
1878
- static statusCode = 500;
1879
- static description = `Failed to commit changes: {message}`;
1961
+ static code = "CLOUDSTATE_ACCESS_DENIED";
1962
+ static statusCode = 403;
1963
+ static description = `Access denied to project: {project_id}`;
1880
1964
  }
1881
- class WriteFileFailedError extends Error {
1965
+ class RestoreFailedError extends Error {
1882
1966
  constructor(body) {
1883
1967
  super(
1884
- `WRITE_FILE_FAILED: ${body.message}`
1968
+ `RESTORE_FAILED: ${body.message}`
1885
1969
  );
1886
1970
  this.body = body;
1887
- this.name = "WriteFileFailedError";
1971
+ this.name = "RestoreFailedError";
1888
1972
  }
1889
- static code = "WRITE_FILE_FAILED";
1973
+ static code = "RESTORE_FAILED";
1890
1974
  static statusCode = 500;
1891
- static description = `Failed to write file: {message}`;
1975
+ static description = `Failed to restore from backup: {message}`;
1892
1976
  }
1893
- class ReadFileFailedError extends Error {
1977
+ class CreateBackupFailedError extends Error {
1894
1978
  constructor(body) {
1895
1979
  super(
1896
- `READ_FILE_FAILED: ${body.message}`
1980
+ `CREATE_BACKUP_FAILED: ${body.message}`
1897
1981
  );
1898
1982
  this.body = body;
1899
- this.name = "ReadFileFailedError";
1983
+ this.name = "CreateBackupFailedError";
1900
1984
  }
1901
- static code = "READ_FILE_FAILED";
1985
+ static code = "CREATE_BACKUP_FAILED";
1902
1986
  static statusCode = 500;
1903
- static description = `Failed to read file: {message}`;
1987
+ static description = `Failed to create backup: {message}`;
1904
1988
  }
1905
- class ExecutionFailedError extends Error {
1989
+ class BackupFailedError extends Error {
1906
1990
  constructor(body) {
1907
1991
  super(
1908
- `EXECUTION_FAILED: ${body.message}`
1992
+ `BACKUP_FAILED: ${body.message}`
1909
1993
  );
1910
1994
  this.body = body;
1911
- this.name = "ExecutionFailedError";
1995
+ this.name = "BackupFailedError";
1912
1996
  }
1913
- static code = "EXECUTION_FAILED";
1997
+ static code = "BACKUP_FAILED";
1914
1998
  static statusCode = 500;
1915
- static description = `Failed to execute command: {message}`;
1999
+ static description = `Backup failed: {message}`;
1916
2000
  }
1917
- class RequestFailedError extends Error {
2001
+ class DeploymentFailedError extends Error {
1918
2002
  constructor(body) {
1919
2003
  super(
1920
- `REQUEST_FAILED: ${body.message}`
2004
+ `DEPLOYMENT_FAILED: ${body.message}`
1921
2005
  );
1922
2006
  this.body = body;
1923
- this.name = "RequestFailedError";
2007
+ this.name = "DeploymentFailedError";
1924
2008
  }
1925
- static code = "REQUEST_FAILED";
2009
+ static code = "DEPLOYMENT_FAILED";
1926
2010
  static statusCode = 500;
1927
- static description = `Failed to request dev server: {message}`;
2011
+ static description = `Deployment failed: {message}`;
1928
2012
  }
1929
- class DevServerFileNotFoundError extends Error {
2013
+ class InvalidDeploymentRequestError extends Error {
1930
2014
  constructor(body) {
1931
2015
  super(
1932
- `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
2016
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
1933
2017
  );
1934
2018
  this.body = body;
1935
- this.name = "DevServerFileNotFoundError";
2019
+ this.name = "InvalidDeploymentRequestError";
1936
2020
  }
1937
- static code = "DEV_SERVER_FILE_NOT_FOUND";
1938
- static statusCode = 404;
1939
- static description = `Dev server file not found: {path}`;
2021
+ static code = "INVALID_DEPLOYMENT_REQUEST";
2022
+ static statusCode = 400;
2023
+ static description = `Invalid deployment request: {message}`;
1940
2024
  }
1941
- class DevServerInvalidRequestError extends Error {
2025
+ class ProjectNotFoundError extends Error {
1942
2026
  constructor(body) {
1943
2027
  super(
1944
- `DEV_SERVER_INVALID_REQUEST: ${body.message}`
2028
+ `PROJECT_NOT_FOUND: ${body.message}`
1945
2029
  );
1946
2030
  this.body = body;
1947
- this.name = "DevServerInvalidRequestError";
2031
+ this.name = "ProjectNotFoundError";
1948
2032
  }
1949
- static code = "DEV_SERVER_INVALID_REQUEST";
1950
- static statusCode = 400;
1951
- static description = `Invalid dev server request: {message}`;
2033
+ static code = "PROJECT_NOT_FOUND";
2034
+ static statusCode = 404;
2035
+ static description = `Project not found: {project_id}`;
1952
2036
  }
1953
- class DevServerNotFoundError extends Error {
2037
+ class UnauthorizedErrorError extends Error {
1954
2038
  constructor(body) {
1955
2039
  super(
1956
- `DEV_SERVER_NOT_FOUND: ${body.message}`
2040
+ `UNAUTHORIZED_ERROR: ${body.message}`
1957
2041
  );
1958
2042
  this.body = body;
1959
- this.name = "DevServerNotFoundError";
2043
+ this.name = "UnauthorizedErrorError";
1960
2044
  }
1961
- static code = "DEV_SERVER_NOT_FOUND";
1962
- static statusCode = 404;
1963
- static description = `Dev server not found: {server_id}`;
2045
+ static code = "UNAUTHORIZED_ERROR";
2046
+ static statusCode = 401;
2047
+ static description = `Unauthorized request to {route}`;
1964
2048
  }
1965
2049
  class BuildFailedError extends Error {
1966
2050
  constructor(body) {
@@ -2106,18 +2190,78 @@ class DeploymentNotFoundError extends Error {
2106
2190
  static statusCode = 404;
2107
2191
  static description = `Deployment not found`;
2108
2192
  }
2109
- class DatabaseErrorError extends Error {
2193
+ class ObservabilityDatabaseErrorError extends Error {
2110
2194
  constructor(body) {
2111
2195
  super(
2112
- `DATABASE_ERROR: ${body.message}`
2196
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2113
2197
  );
2114
2198
  this.body = body;
2115
- this.name = "DatabaseErrorError";
2199
+ this.name = "ObservabilityDatabaseErrorError";
2116
2200
  }
2117
- static code = "DATABASE_ERROR";
2201
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2118
2202
  static statusCode = 500;
2119
2203
  static description = `Database operation failed: {message}`;
2120
2204
  }
2205
+ class ObservabilityAccessDeniedError extends Error {
2206
+ constructor(body) {
2207
+ super(
2208
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2209
+ );
2210
+ this.body = body;
2211
+ this.name = "ObservabilityAccessDeniedError";
2212
+ }
2213
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2214
+ static statusCode = 403;
2215
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2216
+ }
2217
+ class ParseLogsFailedError extends Error {
2218
+ constructor(body) {
2219
+ super(
2220
+ `PARSE_LOGS_FAILED: ${body.message}`
2221
+ );
2222
+ this.body = body;
2223
+ this.name = "ParseLogsFailedError";
2224
+ }
2225
+ static code = "PARSE_LOGS_FAILED";
2226
+ static statusCode = 500;
2227
+ static description = `Failed to parse logs: {message}`;
2228
+ }
2229
+ class RetrieveLogsFailedError extends Error {
2230
+ constructor(body) {
2231
+ super(
2232
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2233
+ );
2234
+ this.body = body;
2235
+ this.name = "RetrieveLogsFailedError";
2236
+ }
2237
+ static code = "RETRIEVE_LOGS_FAILED";
2238
+ static statusCode = 500;
2239
+ static description = `Failed to retrieve logs: {message}`;
2240
+ }
2241
+ class InvalidQueryError extends Error {
2242
+ constructor(body) {
2243
+ super(
2244
+ `INVALID_QUERY: ${body.message}`
2245
+ );
2246
+ this.body = body;
2247
+ this.name = "InvalidQueryError";
2248
+ }
2249
+ static code = "INVALID_QUERY";
2250
+ static statusCode = 400;
2251
+ static description = `Invalid log query: {message}`;
2252
+ }
2253
+ class LogsNotFoundError extends Error {
2254
+ constructor(body) {
2255
+ super(
2256
+ `LOGS_NOT_FOUND: ${body.message}`
2257
+ );
2258
+ this.body = body;
2259
+ this.name = "LogsNotFoundError";
2260
+ }
2261
+ static code = "LOGS_NOT_FOUND";
2262
+ static statusCode = 404;
2263
+ static description = `Logs not found for deployment: {deployment_id}`;
2264
+ }
2121
2265
  class TriggerErrorError extends Error {
2122
2266
  constructor(body) {
2123
2267
  super(
@@ -2346,215 +2490,220 @@ class RepositoryNotFoundError extends Error {
2346
2490
  static statusCode = 404;
2347
2491
  static description = `Repository not found: {repo_id}`;
2348
2492
  }
2349
- class DomainAlreadyExistsError extends Error {
2493
+ class FailedToProvisionCertificateError extends Error {
2350
2494
  constructor(body) {
2351
2495
  super(
2352
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2496
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2353
2497
  );
2354
2498
  this.body = body;
2355
- this.name = "DomainAlreadyExistsError";
2499
+ this.name = "FailedToProvisionCertificateError";
2356
2500
  }
2357
- static code = "DOMAIN_ALREADY_EXISTS";
2358
- static statusCode = 400;
2359
- static description = `Domain already exists: {domain}`;
2501
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
2502
+ static statusCode = 422;
2503
+ static description = `Failed to provision certificate: {message}`;
2360
2504
  }
2361
- class FailedToInsertOwnershipError extends Error {
2505
+ class FailedToInsertDomainMappingError extends Error {
2362
2506
  constructor(body) {
2363
2507
  super(
2364
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2508
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2365
2509
  );
2366
2510
  this.body = body;
2367
- this.name = "FailedToInsertOwnershipError";
2511
+ this.name = "FailedToInsertDomainMappingError";
2368
2512
  }
2369
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2513
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2370
2514
  static statusCode = 500;
2371
- static description = `Failed to insert domain ownership: {message}`;
2515
+ static description = `Failed to insert domain mapping: {message}`;
2372
2516
  }
2373
- class FailedRemoveDomainMappingError extends Error {
2517
+ class PermissionDeniedError extends Error {
2374
2518
  constructor(body) {
2375
2519
  super(
2376
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2520
+ `PERMISSION_DENIED: ${body.message}`
2377
2521
  );
2378
2522
  this.body = body;
2379
- this.name = "FailedRemoveDomainMappingError";
2523
+ this.name = "PermissionDeniedError";
2380
2524
  }
2381
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2382
- static statusCode = 500;
2383
- static description = `Failed to remove domain mapping: {message}`;
2525
+ static code = "PERMISSION_DENIED";
2526
+ static statusCode = 401;
2527
+ static description = `Permission denied: {message}`;
2384
2528
  }
2385
- class FailedPermissionsCheckError extends Error {
2529
+ class FailedToCheckPermissionsError extends Error {
2386
2530
  constructor(body) {
2387
2531
  super(
2388
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2532
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2389
2533
  );
2390
2534
  this.body = body;
2391
- this.name = "FailedPermissionsCheckError";
2535
+ this.name = "FailedToCheckPermissionsError";
2392
2536
  }
2393
- static code = "FAILED_PERMISSIONS_CHECK";
2394
- static statusCode = 401;
2395
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2537
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
2538
+ static statusCode = 502;
2539
+ static description = `Failed to check permissions: {message}`;
2396
2540
  }
2397
- class FailedToCheckDomainMappingPermissionsError extends Error {
2541
+ class FailedToListDomainsError extends Error {
2398
2542
  constructor(body) {
2399
2543
  super(
2400
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2544
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
2545
+ );
2546
+ this.body = body;
2547
+ this.name = "FailedToListDomainsError";
2548
+ }
2549
+ static code = "FAILED_TO_LIST_DOMAINS";
2550
+ static statusCode = 500;
2551
+ static description = `Failed to list domains: {message}`;
2552
+ }
2553
+ class FailedToListVerificationsError extends Error {
2554
+ constructor(body) {
2555
+ super(
2556
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2401
2557
  );
2402
2558
  this.body = body;
2403
- this.name = "FailedToCheckDomainMappingPermissionsError";
2559
+ this.name = "FailedToListVerificationsError";
2404
2560
  }
2405
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2406
- static statusCode = 502;
2407
- static description = `Failed to check permissions: {message}`;
2561
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
2562
+ static statusCode = 500;
2563
+ static description = `Failed to list verifications: {message}`;
2408
2564
  }
2409
- class CloudstateInternalErrorError extends Error {
2565
+ class FailedToVerifyDomainError extends Error {
2410
2566
  constructor(body) {
2411
2567
  super(
2412
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2568
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2413
2569
  );
2414
2570
  this.body = body;
2415
- this.name = "CloudstateInternalErrorError";
2571
+ this.name = "FailedToVerifyDomainError";
2416
2572
  }
2417
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2573
+ static code = "FAILED_TO_VERIFY_DOMAIN";
2418
2574
  static statusCode = 500;
2419
- static description = `Internal error: {message}`;
2575
+ static description = `Failed to verify domain: {message}`;
2420
2576
  }
2421
- class CloudstateDatabaseErrorError extends Error {
2577
+ class VerificationFailedError extends Error {
2422
2578
  constructor(body) {
2423
2579
  super(
2424
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2580
+ `VERIFICATION_FAILED: ${body.message}`
2425
2581
  );
2426
2582
  this.body = body;
2427
- this.name = "CloudstateDatabaseErrorError";
2583
+ this.name = "VerificationFailedError";
2428
2584
  }
2429
- static code = "CLOUDSTATE_DATABASE_ERROR";
2430
- static statusCode = 500;
2431
- static description = `Database operation failed: {message}`;
2585
+ static code = "VERIFICATION_FAILED";
2586
+ static statusCode = 400;
2587
+ static description = `Domain verification failed: {message}`;
2432
2588
  }
2433
- class CloudstateAccessDeniedError extends Error {
2589
+ class FailedToDeleteVerificationError extends Error {
2434
2590
  constructor(body) {
2435
2591
  super(
2436
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2592
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2437
2593
  );
2438
2594
  this.body = body;
2439
- this.name = "CloudstateAccessDeniedError";
2595
+ this.name = "FailedToDeleteVerificationError";
2440
2596
  }
2441
- static code = "CLOUDSTATE_ACCESS_DENIED";
2442
- static statusCode = 403;
2443
- static description = `Access denied to project: {project_id}`;
2597
+ static code = "FAILED_TO_DELETE_VERIFICATION";
2598
+ static statusCode = 400;
2599
+ static description = `Failed to delete verification: {message}`;
2444
2600
  }
2445
- class RestoreFailedError extends Error {
2601
+ class VerificationNotFoundError extends Error {
2446
2602
  constructor(body) {
2447
2603
  super(
2448
- `RESTORE_FAILED: ${body.message}`
2604
+ `VERIFICATION_NOT_FOUND: ${body.message}`
2449
2605
  );
2450
2606
  this.body = body;
2451
- this.name = "RestoreFailedError";
2607
+ this.name = "VerificationNotFoundError";
2452
2608
  }
2453
- static code = "RESTORE_FAILED";
2454
- static statusCode = 500;
2455
- static description = `Failed to restore from backup: {message}`;
2609
+ static code = "VERIFICATION_NOT_FOUND";
2610
+ static statusCode = 404;
2611
+ static description = `Verification request not found for domain: {domain}`;
2456
2612
  }
2457
- class CreateBackupFailedError extends Error {
2613
+ class FailedToCreateVerificationCodeError extends Error {
2458
2614
  constructor(body) {
2459
2615
  super(
2460
- `CREATE_BACKUP_FAILED: ${body.message}`
2616
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2461
2617
  );
2462
2618
  this.body = body;
2463
- this.name = "CreateBackupFailedError";
2619
+ this.name = "FailedToCreateVerificationCodeError";
2464
2620
  }
2465
- static code = "CREATE_BACKUP_FAILED";
2466
- static statusCode = 500;
2467
- static description = `Failed to create backup: {message}`;
2621
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2622
+ static statusCode = 400;
2623
+ static description = `Failed to create verification code: {message}`;
2468
2624
  }
2469
- class BackupFailedError extends Error {
2625
+ class InvalidDomainError extends Error {
2470
2626
  constructor(body) {
2471
2627
  super(
2472
- `BACKUP_FAILED: ${body.message}`
2628
+ `INVALID_DOMAIN: ${body.message}`
2473
2629
  );
2474
2630
  this.body = body;
2475
- this.name = "BackupFailedError";
2631
+ this.name = "InvalidDomainError";
2476
2632
  }
2477
- static code = "BACKUP_FAILED";
2478
- static statusCode = 500;
2479
- static description = `Backup failed: {message}`;
2633
+ static code = "INVALID_DOMAIN";
2634
+ static statusCode = 400;
2635
+ static description = `Invalid domain: {domain}`;
2480
2636
  }
2481
- class DeploymentFailedError extends Error {
2637
+ class DomainAlreadyExistsError extends Error {
2482
2638
  constructor(body) {
2483
2639
  super(
2484
- `DEPLOYMENT_FAILED: ${body.message}`
2640
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
2485
2641
  );
2486
2642
  this.body = body;
2487
- this.name = "DeploymentFailedError";
2643
+ this.name = "DomainAlreadyExistsError";
2488
2644
  }
2489
- static code = "DEPLOYMENT_FAILED";
2490
- static statusCode = 500;
2491
- static description = `Deployment failed: {message}`;
2645
+ static code = "DOMAIN_ALREADY_EXISTS";
2646
+ static statusCode = 400;
2647
+ static description = `Domain already exists: {domain}`;
2492
2648
  }
2493
- class InvalidDeploymentRequestError extends Error {
2649
+ class FailedToInsertOwnershipError extends Error {
2494
2650
  constructor(body) {
2495
2651
  super(
2496
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2652
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2497
2653
  );
2498
2654
  this.body = body;
2499
- this.name = "InvalidDeploymentRequestError";
2655
+ this.name = "FailedToInsertOwnershipError";
2500
2656
  }
2501
- static code = "INVALID_DEPLOYMENT_REQUEST";
2502
- static statusCode = 400;
2503
- static description = `Invalid deployment request: {message}`;
2657
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
2658
+ static statusCode = 500;
2659
+ static description = `Failed to insert domain ownership: {message}`;
2504
2660
  }
2505
- class ProjectNotFoundError extends Error {
2661
+ class FailedRemoveDomainMappingError extends Error {
2506
2662
  constructor(body) {
2507
2663
  super(
2508
- `PROJECT_NOT_FOUND: ${body.message}`
2664
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2509
2665
  );
2510
2666
  this.body = body;
2511
- this.name = "ProjectNotFoundError";
2667
+ this.name = "FailedRemoveDomainMappingError";
2512
2668
  }
2513
- static code = "PROJECT_NOT_FOUND";
2514
- static statusCode = 404;
2515
- static description = `Project not found: {project_id}`;
2669
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2670
+ static statusCode = 500;
2671
+ static description = `Failed to remove domain mapping: {message}`;
2516
2672
  }
2517
- class UnauthorizedErrorError extends Error {
2673
+ class FailedPermissionsCheckError extends Error {
2518
2674
  constructor(body) {
2519
2675
  super(
2520
- `UNAUTHORIZED_ERROR: ${body.message}`
2676
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
2521
2677
  );
2522
2678
  this.body = body;
2523
- this.name = "UnauthorizedErrorError";
2679
+ this.name = "FailedPermissionsCheckError";
2524
2680
  }
2525
- static code = "UNAUTHORIZED_ERROR";
2681
+ static code = "FAILED_PERMISSIONS_CHECK";
2526
2682
  static statusCode = 401;
2527
- static description = `Unauthorized request to {route}`;
2683
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
2528
2684
  }
2529
- class AnyhowError extends Error {
2685
+ class FailedToCheckDomainMappingPermissionsError extends Error {
2530
2686
  constructor(body) {
2531
2687
  super(
2532
- `ANYHOW: ${body.message}`
2688
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2533
2689
  );
2534
2690
  this.body = body;
2535
- this.name = "AnyhowError";
2691
+ this.name = "FailedToCheckDomainMappingPermissionsError";
2536
2692
  }
2537
- static code = "ANYHOW";
2538
- static statusCode = 500;
2539
- static description = `null`;
2693
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2694
+ static statusCode = 502;
2695
+ static description = `Failed to check permissions: {message}`;
2540
2696
  }
2541
2697
  const FREESTYLE_ERROR_CODE_MAP = {
2698
+ "GIT_ERROR": GitErrorError,
2542
2699
  "INTERNAL_ERROR": InternalErrorError,
2543
2700
  "DOCKER_IMPORT_BAD_REQUEST": DockerImportBadRequestError,
2544
- "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
2545
- "VM_NOT_RUNNING": VmNotRunningError,
2546
- "VM_NOT_FOUND": VmNotFoundError,
2547
- "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
2548
- "BAD_REQUEST": BadRequestError,
2549
- "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
2550
- "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2551
- "ALREADY_HAS_BASE": AlreadyHasBaseError,
2552
- "NOT_FOUND": NotFoundError,
2701
+ "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
2702
+ "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
2703
+ "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
2553
2704
  "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
2554
2705
  "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
2555
2706
  "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
2556
- "FILE_NOT_FOUND": FileNotFoundError,
2557
- "FILES_BAD_REQUEST": FilesBadRequestError,
2558
2707
  "VM_DELETED": VmDeletedError,
2559
2708
  "REQWEST": ReqwestError,
2560
2709
  "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
@@ -2564,9 +2713,18 @@ const FREESTYLE_ERROR_CODE_MAP = {
2564
2713
  "STD_IO": StdIoError,
2565
2714
  "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
2566
2715
  "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
2567
- "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
2568
- "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
2569
- "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
2716
+ "FILE_NOT_FOUND": FileNotFoundError,
2717
+ "FILES_BAD_REQUEST": FilesBadRequestError,
2718
+ "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
2719
+ "VM_NOT_RUNNING": VmNotRunningError,
2720
+ "VM_NOT_FOUND": VmNotFoundError,
2721
+ "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
2722
+ "BAD_REQUEST": BadRequestError,
2723
+ "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
2724
+ "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2725
+ "ALREADY_HAS_BASE": AlreadyHasBaseError,
2726
+ "NOT_FOUND": NotFoundError,
2727
+ "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2570
2728
  "USER_NOT_FOUND": UserNotFoundError,
2571
2729
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
2572
2730
  "VALIDATION_ERROR": ValidationErrorError,
@@ -2583,7 +2741,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
2583
2741
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
2584
2742
  "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
2585
2743
  "GROUP_NAME_EMPTY": GroupNameEmptyError,
2586
- "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2587
2744
  "WANTED_BY_EMPTY": WantedByEmptyError,
2588
2745
  "WORKDIR_EMPTY": WorkdirEmptyError,
2589
2746
  "GROUP_EMPTY": GroupEmptyError,
@@ -2600,42 +2757,69 @@ const FREESTYLE_ERROR_CODE_MAP = {
2600
2757
  "SERVICE_NAME_EMPTY": ServiceNameEmptyError,
2601
2758
  "SERVICE_ALREADY_EXISTS": ServiceAlreadyExistsError,
2602
2759
  "SERVICE_NOT_FOUND": ServiceNotFoundError,
2603
- "WAIT_TIMEOUT": WaitTimeoutError,
2604
- "PRE_VERIFY_CHALLENGE_MISMATCH": PreVerifyChallengeMismatchError,
2605
- "PRE_VERIFY_FAILED_PARSE": PreVerifyFailedParseError,
2606
- "PRE_VERIFY_FAILED_FETCH": PreVerifyFailedFetchError,
2607
- "PRE_VERIFY_ROUTE_NOT_FOUND": PreVerifyRouteNotFoundError,
2608
- "AUTHORIZATION_NOT_FOUND": AuthorizationNotFoundError,
2609
- "ORDER_NOT_FOUND": OrderNotFoundError,
2760
+ "INVALID_REQUEST": InvalidRequestError,
2761
+ "REPO_NOT_FOUND": RepoNotFoundError,
2762
+ "RUNTIME_ERROR": RuntimeErrorError,
2763
+ "SYNTAX_ERROR": SyntaxErrorError,
2610
2764
  "INTERNAL": InternalError,
2611
2765
  "SIGNING": SigningError,
2612
2766
  "INVALID_SIGNATURE": InvalidSignatureError,
2613
2767
  "INVALID_PARAMETERS": InvalidParametersError,
2614
2768
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
2615
2769
  "EXPIRED": ExpiredError,
2616
- "TAG_NOT_FOUND": TagNotFoundError,
2770
+ "FORBIDDEN": ForbiddenError,
2771
+ "UNAUTHORIZED": UnauthorizedError,
2772
+ "INVALID_SERVICE": InvalidServiceError,
2773
+ "EXPECTED_SERVICE": ExpectedServiceError,
2774
+ "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2775
+ "CONFLICT": ConflictError,
2617
2776
  "BRANCH_NOT_FOUND": BranchNotFoundError,
2618
- "REPO_NOT_FOUND": RepoNotFoundError,
2777
+ "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
2778
+ "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
2779
+ "SOURCE_NOT_FOUND": SourceNotFoundError,
2780
+ "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
2781
+ "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
2782
+ "PATH_NOT_FOUND": PathNotFoundError,
2783
+ "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2784
+ "TAG_NOT_FOUND": TagNotFoundError,
2785
+ "SEND_ERROR": SendErrorError,
2786
+ "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
2619
2787
  "INVALID_OBJECT_ID": InvalidObjectIdError,
2620
2788
  "COMMIT_NOT_FOUND": CommitNotFoundError,
2621
- "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2622
- "PATH_NOT_FOUND": PathNotFoundError,
2623
- "INVALID_REQUEST": InvalidRequestError,
2789
+ "TREE_NOT_FOUND": TreeNotFoundError,
2624
2790
  "INVALID_REVISION": InvalidRevisionError,
2625
- "FORBIDDEN": ForbiddenError,
2626
- "UNAUTHORIZED": UnauthorizedError,
2627
- "CONFLICT": ConflictError,
2628
- "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2791
+ "INVALID_RANGE": InvalidRangeError,
2792
+ "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
2793
+ "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
2629
2794
  "BLOB_NOT_FOUND": BlobNotFoundError,
2630
- "TREE_NOT_FOUND": TreeNotFoundError,
2795
+ "AMBIGUOUS": AmbiguousError,
2796
+ "INVALID": InvalidError,
2797
+ "PACKFILE": PackfileError,
2798
+ "DATABASE_ERROR": DatabaseErrorError,
2799
+ "EMPTY_TAG": EmptyTagError,
2631
2800
  "RESIZE_FAILED": ResizeFailedError,
2632
2801
  "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
2633
- "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2634
- "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2635
- "PARSE_LOGS_FAILED": ParseLogsFailedError,
2636
- "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2637
- "INVALID_QUERY": InvalidQueryError,
2638
- "LOGS_NOT_FOUND": LogsNotFoundError,
2802
+ "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
2803
+ "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
2804
+ "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
2805
+ "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
2806
+ "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
2807
+ "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
2808
+ "WATCH_FILES_FAILED": WatchFilesFailedError,
2809
+ "LOGS_FAILED": LogsFailedError,
2810
+ "STATUS_FAILED": StatusFailedError,
2811
+ "RESTART_FAILED": RestartFailedError,
2812
+ "SHUTDOWN_FAILED": ShutdownFailedError,
2813
+ "COMMIT_FAILED": CommitFailedError,
2814
+ "WRITE_FILE_FAILED": WriteFileFailedError,
2815
+ "READ_FILE_FAILED": ReadFileFailedError,
2816
+ "EXECUTION_FAILED": ExecutionFailedError,
2817
+ "REQUEST_FAILED": RequestFailedError,
2818
+ "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
2819
+ "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
2820
+ "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
2821
+ "ANYHOW": AnyhowError,
2822
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError,
2639
2823
  "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
2640
2824
  "LIST_TOKENS_FAILED": ListTokensFailedError,
2641
2825
  "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
@@ -2671,37 +2855,16 @@ const FREESTYLE_ERROR_CODE_MAP = {
2671
2855
  "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
2672
2856
  "LOGGING_FAILED": LoggingFailedError,
2673
2857
  "RUN_NOT_FOUND": RunNotFoundError,
2674
- "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
2675
- "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
2676
- "PERMISSION_DENIED": PermissionDeniedError,
2677
- "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
2678
- "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
2679
- "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
2680
- "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
2681
- "VERIFICATION_FAILED": VerificationFailedError,
2682
- "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
2683
- "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
2684
- "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
2685
- "INVALID_DOMAIN": InvalidDomainError,
2686
- "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
2687
- "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
2688
- "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
2689
- "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
2690
- "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
2691
- "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
2692
- "WATCH_FILES_FAILED": WatchFilesFailedError,
2693
- "LOGS_FAILED": LogsFailedError,
2694
- "STATUS_FAILED": StatusFailedError,
2695
- "RESTART_FAILED": RestartFailedError,
2696
- "SHUTDOWN_FAILED": ShutdownFailedError,
2697
- "COMMIT_FAILED": CommitFailedError,
2698
- "WRITE_FILE_FAILED": WriteFileFailedError,
2699
- "READ_FILE_FAILED": ReadFileFailedError,
2700
- "EXECUTION_FAILED": ExecutionFailedError,
2701
- "REQUEST_FAILED": RequestFailedError,
2702
- "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
2703
- "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
2704
- "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
2858
+ "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
2859
+ "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
2860
+ "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
2861
+ "RESTORE_FAILED": RestoreFailedError,
2862
+ "CREATE_BACKUP_FAILED": CreateBackupFailedError,
2863
+ "BACKUP_FAILED": BackupFailedError,
2864
+ "DEPLOYMENT_FAILED": DeploymentFailedError,
2865
+ "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
2866
+ "PROJECT_NOT_FOUND": ProjectNotFoundError,
2867
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
2705
2868
  "BUILD_FAILED": BuildFailedError,
2706
2869
  "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
2707
2870
  "LOCKFILE_ERROR": LockfileErrorError,
@@ -2714,7 +2877,12 @@ const FREESTYLE_ERROR_CODE_MAP = {
2714
2877
  "INVALID_DOMAINS": InvalidDomainsError,
2715
2878
  "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
2716
2879
  "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
2717
- "DATABASE_ERROR": DatabaseErrorError,
2880
+ "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2881
+ "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2882
+ "PARSE_LOGS_FAILED": ParseLogsFailedError,
2883
+ "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2884
+ "INVALID_QUERY": InvalidQueryError,
2885
+ "LOGS_NOT_FOUND": LogsNotFoundError,
2718
2886
  "TRIGGER_ERROR": TriggerErrorError,
2719
2887
  "TOKEN_ERROR": TokenErrorError,
2720
2888
  "PERMISSION_ERROR": PermissionErrorError,
@@ -2734,33 +2902,35 @@ const FREESTYLE_ERROR_CODE_MAP = {
2734
2902
  "SERIALIZATION_ERROR": SerializationErrorError,
2735
2903
  "GIT_INVALID_REQUEST": GitInvalidRequestError,
2736
2904
  "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
2905
+ "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
2906
+ "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
2907
+ "PERMISSION_DENIED": PermissionDeniedError,
2908
+ "FAILED_TO_CHECK_PERMISSIONS": FailedToCheckPermissionsError,
2909
+ "FAILED_TO_LIST_DOMAINS": FailedToListDomainsError,
2910
+ "FAILED_TO_LIST_VERIFICATIONS": FailedToListVerificationsError,
2911
+ "FAILED_TO_VERIFY_DOMAIN": FailedToVerifyDomainError,
2912
+ "VERIFICATION_FAILED": VerificationFailedError,
2913
+ "FAILED_TO_DELETE_VERIFICATION": FailedToDeleteVerificationError,
2914
+ "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
2915
+ "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
2916
+ "INVALID_DOMAIN": InvalidDomainError,
2737
2917
  "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
2738
2918
  "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
2739
2919
  "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
2740
2920
  "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
2741
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
2742
- "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
2743
- "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
2744
- "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
2745
- "RESTORE_FAILED": RestoreFailedError,
2746
- "CREATE_BACKUP_FAILED": CreateBackupFailedError,
2747
- "BACKUP_FAILED": BackupFailedError,
2748
- "DEPLOYMENT_FAILED": DeploymentFailedError,
2749
- "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
2750
- "PROJECT_NOT_FOUND": ProjectNotFoundError,
2751
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
2752
- "ANYHOW": AnyhowError
2921
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError
2753
2922
  };
2754
2923
 
2755
2924
  var errors = /*#__PURE__*/Object.freeze({
2756
2925
  __proto__: null,
2757
2926
  AfterArrayContainsEmptyError: AfterArrayContainsEmptyError,
2758
2927
  AlreadyHasBaseError: AlreadyHasBaseError,
2928
+ AmbiguousError: AmbiguousError,
2759
2929
  AnyhowError: AnyhowError,
2760
- AuthorizationNotFoundError: AuthorizationNotFoundError,
2761
2930
  BackupFailedError: BackupFailedError,
2762
2931
  BadRequestError: BadRequestError,
2763
2932
  BlobNotFoundError: BlobNotFoundError,
2933
+ BranchNameEmptyError: BranchNameEmptyError,
2764
2934
  BranchNotFoundError: BranchNotFoundError,
2765
2935
  BrowserOperationFailedError: BrowserOperationFailedError,
2766
2936
  BuildFailedError: BuildFailedError,
@@ -2772,6 +2942,7 @@ var errors = /*#__PURE__*/Object.freeze({
2772
2942
  CloudstateInternalErrorError: CloudstateInternalErrorError,
2773
2943
  CommitFailedError: CommitFailedError,
2774
2944
  CommitNotFoundError: CommitNotFoundError,
2945
+ CommitNotInBranchError: CommitNotInBranchError,
2775
2946
  ConflictError: ConflictError,
2776
2947
  ConnectionFailedError: ConnectionFailedError,
2777
2948
  ContentNotFoundError: ContentNotFoundError,
@@ -2798,6 +2969,7 @@ var errors = /*#__PURE__*/Object.freeze({
2798
2969
  DownloadFailedError: DownloadFailedError,
2799
2970
  DuplicateGroupNameError: DuplicateGroupNameError,
2800
2971
  DuplicateUserNameError: DuplicateUserNameError,
2972
+ EmptyTagError: EmptyTagError,
2801
2973
  EntrypointNotFoundError: EntrypointNotFoundError,
2802
2974
  EnvKeyContainsEqualsError: EnvKeyContainsEqualsError,
2803
2975
  EnvKeyEmptyError: EnvKeyEmptyError,
@@ -2808,6 +2980,7 @@ var errors = /*#__PURE__*/Object.freeze({
2808
2980
  ExecuteInternalErrorError: ExecuteInternalErrorError,
2809
2981
  ExecutionErrorError: ExecutionErrorError,
2810
2982
  ExecutionFailedError: ExecutionFailedError,
2983
+ ExpectedServiceError: ExpectedServiceError,
2811
2984
  ExpiredError: ExpiredError,
2812
2985
  FREESTYLE_ERROR_CODE_MAP: FREESTYLE_ERROR_CODE_MAP,
2813
2986
  FailedPermissionsCheckError: FailedPermissionsCheckError,
@@ -2831,6 +3004,8 @@ var errors = /*#__PURE__*/Object.freeze({
2831
3004
  GetContentFailedError: GetContentFailedError,
2832
3005
  GetPermissionFailedError: GetPermissionFailedError,
2833
3006
  GetRepositoryInfoFailedError: GetRepositoryInfoFailedError,
3007
+ GitErrorError: GitErrorError,
3008
+ GitHubSyncConflictError: GitHubSyncConflictError,
2834
3009
  GitHubSyncFailedError: GitHubSyncFailedError,
2835
3010
  GitInvalidRequestError: GitInvalidRequestError,
2836
3011
  GitRepositoryAccessDeniedError: GitRepositoryAccessDeniedError,
@@ -2847,6 +3022,7 @@ var errors = /*#__PURE__*/Object.freeze({
2847
3022
  IdentityAccessDeniedError: IdentityAccessDeniedError,
2848
3023
  IdentityErrorError: IdentityErrorError,
2849
3024
  IdentityNotFoundError: IdentityNotFoundError,
3025
+ ImportSubdirNotFoundError: ImportSubdirNotFoundError,
2850
3026
  InternalError: InternalError,
2851
3027
  InternalErrorError: InternalErrorError,
2852
3028
  InternalForkVmNotFoundError: InternalForkVmNotFoundError,
@@ -2855,11 +3031,14 @@ var errors = /*#__PURE__*/Object.freeze({
2855
3031
  InvalidDeploymentRequestError: InvalidDeploymentRequestError,
2856
3032
  InvalidDomainError: InvalidDomainError,
2857
3033
  InvalidDomainsError: InvalidDomainsError,
3034
+ InvalidError: InvalidError,
2858
3035
  InvalidObjectIdError: InvalidObjectIdError,
2859
3036
  InvalidParametersError: InvalidParametersError,
2860
3037
  InvalidQueryError: InvalidQueryError,
3038
+ InvalidRangeError: InvalidRangeError,
2861
3039
  InvalidRequestError: InvalidRequestError,
2862
3040
  InvalidRevisionError: InvalidRevisionError,
3041
+ InvalidServiceError: InvalidServiceError,
2863
3042
  InvalidSignatureError: InvalidSignatureError,
2864
3043
  ListIdentitiesFailedError: ListIdentitiesFailedError,
2865
3044
  ListPermissionsFailedError: ListPermissionsFailedError,
@@ -2881,8 +3060,9 @@ var errors = /*#__PURE__*/Object.freeze({
2881
3060
  NotFoundError: NotFoundError,
2882
3061
  ObservabilityAccessDeniedError: ObservabilityAccessDeniedError,
2883
3062
  ObservabilityDatabaseErrorError: ObservabilityDatabaseErrorError,
3063
+ OffsetWithSelectorError: OffsetWithSelectorError,
2884
3064
  OnFailureArrayContainsEmptyError: OnFailureArrayContainsEmptyError,
2885
- OrderNotFoundError: OrderNotFoundError,
3065
+ PackfileError: PackfileError,
2886
3066
  ParseLogsFailedError: ParseLogsFailedError,
2887
3067
  ParseResponseErrorError: ParseResponseErrorError,
2888
3068
  PathNotFoundError: PathNotFoundError,
@@ -2890,14 +3070,11 @@ var errors = /*#__PURE__*/Object.freeze({
2890
3070
  PermissionDeniedError: PermissionDeniedError,
2891
3071
  PermissionErrorError: PermissionErrorError,
2892
3072
  PermissionNotFoundError: PermissionNotFoundError,
2893
- PreVerifyChallengeMismatchError: PreVerifyChallengeMismatchError,
2894
- PreVerifyFailedFetchError: PreVerifyFailedFetchError,
2895
- PreVerifyFailedParseError: PreVerifyFailedParseError,
2896
- PreVerifyRouteNotFoundError: PreVerifyRouteNotFoundError,
2897
3073
  ProjectNotFoundError: ProjectNotFoundError,
2898
3074
  ReadFileFailedError: ReadFileFailedError,
2899
3075
  RecordOwnershipErrorError: RecordOwnershipErrorError,
2900
3076
  ReferenceNotFoundError: ReferenceNotFoundError,
3077
+ RepoAlreadyExistsError: RepoAlreadyExistsError,
2901
3078
  RepoNotFoundError: RepoNotFoundError,
2902
3079
  RepositoryAccessDeniedError: RepositoryAccessDeniedError,
2903
3080
  RepositoryNotFoundError: RepositoryNotFoundError,
@@ -2911,6 +3088,8 @@ var errors = /*#__PURE__*/Object.freeze({
2911
3088
  RevokePermissionFailedError: RevokePermissionFailedError,
2912
3089
  RevokeTokenFailedError: RevokeTokenFailedError,
2913
3090
  RunNotFoundError: RunNotFoundError,
3091
+ RuntimeErrorError: RuntimeErrorError,
3092
+ SendErrorError: SendErrorError,
2914
3093
  SerializationErrorError: SerializationErrorError,
2915
3094
  ServerDeploymentFailedError: ServerDeploymentFailedError,
2916
3095
  ServiceAlreadyExistsError: ServiceAlreadyExistsError,
@@ -2922,8 +3101,12 @@ var errors = /*#__PURE__*/Object.freeze({
2922
3101
  ShutdownFailedError: ShutdownFailedError,
2923
3102
  SigningError: SigningError,
2924
3103
  SnapshotVmBadRequestError: SnapshotVmBadRequestError,
3104
+ SourceImportConflictError: SourceImportConflictError,
3105
+ SourceNotFoundError: SourceNotFoundError,
3106
+ SourceUnauthorizedError: SourceUnauthorizedError,
2925
3107
  StatusFailedError: StatusFailedError,
2926
3108
  StdIoError: StdIoError,
3109
+ SyntaxErrorError: SyntaxErrorError,
2927
3110
  TagNotFoundError: TagNotFoundError,
2928
3111
  TokenErrorError: TokenErrorError,
2929
3112
  TreeNotFoundError: TreeNotFoundError,
@@ -2959,7 +3142,6 @@ var errors = /*#__PURE__*/Object.freeze({
2959
3142
  VmStartTimeoutError: VmStartTimeoutError,
2960
3143
  VmSubnetNotFoundError: VmSubnetNotFoundError,
2961
3144
  VmTransactionIdMismatchError: VmTransactionIdMismatchError,
2962
- WaitTimeoutError: WaitTimeoutError,
2963
3145
  WantedByEmptyError: WantedByEmptyError,
2964
3146
  WatchFilesFailedError: WatchFilesFailedError,
2965
3147
  WebDeploymentBadRequestError: WebDeploymentBadRequestError,
@@ -3016,7 +3198,7 @@ class ApiClient {
3016
3198
  }
3017
3199
  return headers;
3018
3200
  }
3019
- async request(method, url, body) {
3201
+ async requestRaw(method, url, body) {
3020
3202
  const headers = this.getDefaultHeaders();
3021
3203
  if (body) {
3022
3204
  headers["Content-Type"] = "application/json";
@@ -3039,6 +3221,10 @@ class ApiClient {
3039
3221
  }
3040
3222
  throw errorFromJSON(errorData);
3041
3223
  }
3224
+ return response;
3225
+ }
3226
+ async request(method, url, body) {
3227
+ const response = await this.requestRaw(method, url, body);
3042
3228
  return response.json();
3043
3229
  }
3044
3230
  async fetch(url, options) {
@@ -3052,6 +3238,10 @@ class ApiClient {
3052
3238
  };
3053
3239
  return this.fetchFn(url, finalOptions);
3054
3240
  }
3241
+ getRaw(path, options) {
3242
+ const url = this.buildUrl(path, options?.params, options?.query);
3243
+ return this.requestRaw("GET", url);
3244
+ }
3055
3245
  get(path, ...args) {
3056
3246
  const options = args[0];
3057
3247
  const url = this.buildUrl(path, options?.params, options?.query);
@@ -3213,12 +3403,19 @@ class DomainsNamespace {
3213
3403
  }
3214
3404
  }
3215
3405
 
3216
- class GitRepo {
3406
+ class GitRepoBranchesNamespace {
3217
3407
  constructor(repoId, apiClient) {
3218
- this.apiClient = apiClient;
3219
3408
  this.repoId = repoId;
3409
+ this.apiClient = apiClient;
3410
+ }
3411
+ /**
3412
+ * Get the default branch for this repository.
3413
+ */
3414
+ async getDefaultBranch() {
3415
+ return this.apiClient.get("/git/v1/repo/{repo_id}/default-branch", {
3416
+ params: { repo_id: this.repoId }
3417
+ });
3220
3418
  }
3221
- repoId;
3222
3419
  /**
3223
3420
  * Set the default branch for this repository.
3224
3421
  */
@@ -3230,30 +3427,29 @@ class GitRepo {
3230
3427
  body: { defaultBranch }
3231
3428
  });
3232
3429
  }
3233
- /**
3234
- * Get the default branch for this repository.
3235
- */
3236
- async getDefaultBranch() {
3237
- return this.apiClient.get("/git/v1/repo/{repo_id}/default-branch", {
3238
- params: { repo_id: this.repoId }
3430
+ async list() {
3431
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/heads/", {
3432
+ params: { repo: this.repoId }
3239
3433
  });
3240
3434
  }
3241
- /**
3242
- * Get the contents of this repository at the given path.
3243
- */
3244
- async getContents({
3245
- path = "",
3246
- ref
3247
- } = {}) {
3248
- return this.apiClient.get("/git/v1/repo/{repo}/contents/{path}", {
3249
- params: { repo: this.repoId, path },
3250
- query: { ref }
3435
+ async get({
3436
+ branchName
3437
+ }) {
3438
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/heads/{branch}", {
3439
+ params: { repo: this.repoId, branch: branchName }
3251
3440
  });
3252
3441
  }
3442
+ }
3443
+ class GitRepoGitHubSyncNamespace {
3444
+ constructor(repoId, apiClient) {
3445
+ this.repoId = repoId;
3446
+ this.apiClient = apiClient;
3447
+ }
3253
3448
  /**
3254
3449
  * Get the GitHub sync configuration for this repository.
3450
+ * Returns null if GitHub sync is not configured.
3255
3451
  */
3256
- async getGitHubSyncConfig() {
3452
+ async get() {
3257
3453
  try {
3258
3454
  return await this.apiClient.get("/git/v1/repo/{repo_id}/github-sync", {
3259
3455
  params: { repo_id: this.repoId }
@@ -3265,10 +3461,33 @@ class GitRepo {
3265
3461
  throw error;
3266
3462
  }
3267
3463
  }
3464
+ /**
3465
+ * Enable GitHub sync for this repository.
3466
+ */
3467
+ async enable({ githubRepoName }) {
3468
+ await this.apiClient.post("/git/v1/repo/{repo_id}/github-sync", {
3469
+ params: { repo_id: this.repoId },
3470
+ body: { githubRepoName }
3471
+ });
3472
+ }
3473
+ /**
3474
+ * Disable GitHub sync for this repository.
3475
+ */
3476
+ async disable() {
3477
+ await this.apiClient.delete("/git/v1/repo/{repo_id}/github-sync", {
3478
+ params: { repo_id: this.repoId }
3479
+ });
3480
+ }
3481
+ }
3482
+ class GitRepoTriggersNamespace {
3483
+ constructor(repoId, apiClient) {
3484
+ this.repoId = repoId;
3485
+ this.apiClient = apiClient;
3486
+ }
3268
3487
  /**
3269
3488
  * List git triggers for this repository.
3270
3489
  */
3271
- async listTriggers() {
3490
+ async list() {
3272
3491
  return this.apiClient.get("/git/v1/repo/{repo}/trigger", {
3273
3492
  params: { repo: this.repoId }
3274
3493
  });
@@ -3276,7 +3495,7 @@ class GitRepo {
3276
3495
  /**
3277
3496
  * Create a git trigger for this repository.
3278
3497
  */
3279
- async createTrigger({
3498
+ async create({
3280
3499
  trigger,
3281
3500
  action
3282
3501
  }) {
@@ -3291,14 +3510,334 @@ class GitRepo {
3291
3510
  /**
3292
3511
  * Delete a git trigger.
3293
3512
  */
3294
- async deleteTrigger({
3513
+ async delete({
3295
3514
  triggerId
3296
3515
  }) {
3297
3516
  return this.apiClient.delete("/git/v1/repo/{repo}/trigger/{trigger}", {
3298
3517
  params: { repo: this.repoId, trigger: triggerId }
3299
3518
  });
3300
3519
  }
3301
- /**
3520
+ }
3521
+ class GitRepoOdbBlobsNamespace {
3522
+ constructor(repoId, apiClient) {
3523
+ this.repoId = repoId;
3524
+ this.apiClient = apiClient;
3525
+ }
3526
+ async get({
3527
+ sha
3528
+ }) {
3529
+ return this.apiClient.get("/git/v1/repo/{repo}/git/blobs/{hash}", {
3530
+ params: { repo: this.repoId, hash: sha }
3531
+ });
3532
+ }
3533
+ }
3534
+ class GitRepoOdbTreesNamespace {
3535
+ constructor(repoId, apiClient) {
3536
+ this.repoId = repoId;
3537
+ this.apiClient = apiClient;
3538
+ }
3539
+ async get({
3540
+ sha
3541
+ }) {
3542
+ return this.apiClient.get("/git/v1/repo/{repo}/git/trees/{hash}", {
3543
+ params: { repo: this.repoId, hash: sha }
3544
+ });
3545
+ }
3546
+ }
3547
+ class GitRepoContentsNamespace {
3548
+ constructor(repoId, apiClient) {
3549
+ this.repoId = repoId;
3550
+ this.apiClient = apiClient;
3551
+ }
3552
+ /**
3553
+ * Get the contents of a file or directory at a specific path and revision.
3554
+ *
3555
+ * @param path - The path to the file or directory (empty string for root)
3556
+ * @param rev - The revision (branch, tag, or commit SHA) to get contents from
3557
+ * @returns File contents (base64 encoded) or directory listing
3558
+ */
3559
+ async get({
3560
+ path = "",
3561
+ rev
3562
+ } = {}) {
3563
+ return this.apiClient.get("/git/v1/repo/{repo}/contents/{path}", {
3564
+ params: { repo: this.repoId, path },
3565
+ query: { rev }
3566
+ });
3567
+ }
3568
+ /**
3569
+ * Download repository contents as a tarball archive.
3570
+ *
3571
+ * @param rev - The revision (branch, tag, or commit SHA) to download
3572
+ * @returns The tarball as an ArrayBuffer
3573
+ *
3574
+ * @example
3575
+ * ```ts
3576
+ * const tarball = await repo.contents.downloadTarball({ rev: "main" });
3577
+ * await fs.writeFile("repo.tar", Buffer.from(tarball));
3578
+ * ```
3579
+ */
3580
+ async downloadTarball({
3581
+ rev
3582
+ } = {}) {
3583
+ const response = await this.apiClient.getRaw(
3584
+ "/git/v1/repo/{repo}/tarball",
3585
+ {
3586
+ params: { repo: this.repoId },
3587
+ query: { rev }
3588
+ }
3589
+ );
3590
+ return response.arrayBuffer();
3591
+ }
3592
+ /**
3593
+ * Download repository contents as a zip archive.
3594
+ *
3595
+ * @param rev - The revision (branch, tag, or commit SHA) to download
3596
+ * @returns The zip file as an ArrayBuffer
3597
+ *
3598
+ * @example
3599
+ * ```ts
3600
+ * const zip = await repo.contents.downloadZip({ rev: "main" });
3601
+ * await fs.writeFile("repo.zip", Buffer.from(zip));
3602
+ * ```
3603
+ */
3604
+ async downloadZip({
3605
+ rev
3606
+ } = {}) {
3607
+ const response = await this.apiClient.getRaw("/git/v1/repo/{repo}/zip", {
3608
+ params: { repo: this.repoId },
3609
+ query: { rev }
3610
+ });
3611
+ return response.arrayBuffer();
3612
+ }
3613
+ }
3614
+ class GitRepoCommitsNamespace {
3615
+ constructor(repoId, apiClient) {
3616
+ this.repoId = repoId;
3617
+ this.apiClient = apiClient;
3618
+ }
3619
+ /**
3620
+ * Get a specific commit by SHA.
3621
+ */
3622
+ async get({
3623
+ sha
3624
+ }) {
3625
+ return this.apiClient.get("/git/v1/repo/{repo}/git/commits/{hash}", {
3626
+ params: { repo: this.repoId, hash: sha }
3627
+ });
3628
+ }
3629
+ /**
3630
+ * List commits for this repository.
3631
+ */
3632
+ async list(params = {}) {
3633
+ return this.apiClient.get("/git/v1/repo/{repo}/git/commits", {
3634
+ params: { repo: this.repoId },
3635
+ query: params
3636
+ });
3637
+ }
3638
+ }
3639
+ class GitRepoTagsNamespace {
3640
+ constructor(repoId, apiClient) {
3641
+ this.repoId = repoId;
3642
+ this.apiClient = apiClient;
3643
+ }
3644
+ /**
3645
+ * List all tags in this repository.
3646
+ */
3647
+ async list() {
3648
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/tags/", {
3649
+ params: { repo: this.repoId }
3650
+ });
3651
+ }
3652
+ /**
3653
+ * Get a tag by name.
3654
+ */
3655
+ async get({
3656
+ tagName
3657
+ }) {
3658
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/tags/{tag}", {
3659
+ params: { repo: this.repoId, tag: tagName }
3660
+ });
3661
+ }
3662
+ /**
3663
+ * Get an annotated tag object by its SHA.
3664
+ */
3665
+ async getByHash({
3666
+ sha
3667
+ }) {
3668
+ return this.apiClient.get("/git/v1/repo/{repo}/git/tags/{hash}", {
3669
+ params: { repo: this.repoId, hash: sha }
3670
+ });
3671
+ }
3672
+ }
3673
+ class GitRepo {
3674
+ constructor(repoId, apiClient) {
3675
+ this.apiClient = apiClient;
3676
+ this.repoId = repoId;
3677
+ this.branches = new GitRepoBranchesNamespace(repoId, apiClient);
3678
+ this.contents = new GitRepoContentsNamespace(repoId, apiClient);
3679
+ this.commits = new GitRepoCommitsNamespace(repoId, apiClient);
3680
+ this.tags = new GitRepoTagsNamespace(repoId, apiClient);
3681
+ this.triggers = new GitRepoTriggersNamespace(repoId, apiClient);
3682
+ this.githubSync = new GitRepoGitHubSyncNamespace(repoId, apiClient);
3683
+ this.blobs = new GitRepoOdbBlobsNamespace(repoId, apiClient);
3684
+ this.trees = new GitRepoOdbTreesNamespace(repoId, apiClient);
3685
+ }
3686
+ repoId;
3687
+ /**
3688
+ * Manage branches in this repository.
3689
+ *
3690
+ * @example
3691
+ * ```ts
3692
+ * // List all branches
3693
+ * const branches = await repo.branches.list();
3694
+ *
3695
+ * // Get a specific branch
3696
+ * const main = await repo.branches.get({ branchName: "main" });
3697
+ *
3698
+ * // Get/set default branch
3699
+ * const { defaultBranch } = await repo.branches.getDefaultBranch();
3700
+ * await repo.branches.setDefaultBranch({ defaultBranch: "develop" });
3701
+ * ```
3702
+ */
3703
+ branches;
3704
+ /**
3705
+ * Access repository contents (files and directories).
3706
+ *
3707
+ * @example
3708
+ * ```ts
3709
+ * // Get file contents
3710
+ * const file = await repo.contents.get({ path: "README.md" });
3711
+ * const content = atob(file.content);
3712
+ *
3713
+ * // Get contents at a specific commit/branch/tag
3714
+ * const file = await repo.contents.get({
3715
+ * path: "src/index.ts",
3716
+ * rev: "main"
3717
+ * });
3718
+ *
3719
+ * // Get directory listing
3720
+ * const dir = await repo.contents.get({ path: "src" });
3721
+ *
3722
+ * // Download repository as tarball or zip
3723
+ * const tarball = await repo.contents.downloadTarball({ rev: "main" });
3724
+ * const zip = await repo.contents.downloadZip({ rev: "main" });
3725
+ * ```
3726
+ */
3727
+ contents;
3728
+ /**
3729
+ * Access commits in this repository.
3730
+ *
3731
+ * @example
3732
+ * ```ts
3733
+ * // Get a specific commit by SHA
3734
+ * const commit = await repo.commits.get({ sha: "abc123..." });
3735
+ * console.log(commit.message);
3736
+ * console.log(commit.author.name);
3737
+ *
3738
+ * // List recent commits
3739
+ * const commits = await repo.commits.list();
3740
+ * ```
3741
+ */
3742
+ commits;
3743
+ /**
3744
+ * Access tags in this repository.
3745
+ *
3746
+ * @example
3747
+ * ```ts
3748
+ * // List all tags
3749
+ * const tags = await repo.tags.list();
3750
+ *
3751
+ * // Get a tag by name
3752
+ * const tag = await repo.tags.get({ tagName: "v1.0.0" });
3753
+ *
3754
+ * // Get an annotated tag object by SHA
3755
+ * const tagObject = await repo.tags.getByHash({ sha: "abc123..." });
3756
+ * ```
3757
+ */
3758
+ tags;
3759
+ /**
3760
+ * Manage webhook triggers for this repository.
3761
+ *
3762
+ * Triggers send HTTP POST requests to your URL when events occur,
3763
+ * such as pushes to specific branches or changes to specific files.
3764
+ *
3765
+ * @example
3766
+ * ```ts
3767
+ * // Create a trigger for pushes to main
3768
+ * const { triggerId } = await repo.triggers.create({
3769
+ * trigger: { event: "push", branch: ["main"] },
3770
+ * action: { type: "webhook", url: "https://your-server.com/webhook" }
3771
+ * });
3772
+ *
3773
+ * // List all triggers
3774
+ * const triggers = await repo.triggers.list();
3775
+ *
3776
+ * // Delete a trigger
3777
+ * await repo.triggers.delete({ triggerId });
3778
+ * ```
3779
+ */
3780
+ triggers;
3781
+ /**
3782
+ * Manage GitHub synchronization for this repository.
3783
+ *
3784
+ * When enabled, pushes to either your Freestyle repository or the linked
3785
+ * GitHub repository are automatically synced to the other.
3786
+ *
3787
+ * @example
3788
+ * ```ts
3789
+ * // Enable sync with a GitHub repository
3790
+ * await repo.githubSync.enable({ githubRepoName: "owner/repo" });
3791
+ *
3792
+ * // Check sync configuration
3793
+ * const config = await repo.githubSync.get();
3794
+ *
3795
+ * // Disable sync
3796
+ * await repo.githubSync.disable();
3797
+ * ```
3798
+ */
3799
+ githubSync;
3800
+ /**
3801
+ * Access blob objects in the Git object database.
3802
+ *
3803
+ * Blobs represent raw file contents. Content is returned base64-encoded
3804
+ * for binary safety.
3805
+ *
3806
+ * @example
3807
+ * ```ts
3808
+ * // Get a blob by its SHA hash
3809
+ * const blob = await repo.blobs.get({ sha: "abc123..." });
3810
+ *
3811
+ * // Decode the base64 content
3812
+ * const content = atob(blob.content);
3813
+ * console.log(content);
3814
+ * ```
3815
+ */
3816
+ blobs;
3817
+ /**
3818
+ * Access tree objects in the Git object database.
3819
+ *
3820
+ * Trees represent directories in Git. Each tree contains entries
3821
+ * pointing to blobs (files) or other trees (subdirectories).
3822
+ *
3823
+ * @example
3824
+ * ```ts
3825
+ * // Get the root tree from a commit
3826
+ * const commit = await repo.commits.get({ sha: "abc123..." });
3827
+ * const tree = await repo.trees.get({ sha: commit.tree.sha });
3828
+ *
3829
+ * // Iterate over entries
3830
+ * for (const entry of tree.tree) {
3831
+ * if (entry.type === "blob") {
3832
+ * console.log(`File: ${entry.path}`);
3833
+ * } else {
3834
+ * console.log(`Directory: ${entry.path}`);
3835
+ * }
3836
+ * }
3837
+ * ```
3838
+ */
3839
+ trees;
3840
+ /**
3302
3841
  * Compare two revs in this repository.
3303
3842
  *
3304
3843
  * Head and base can be branch names, tags, or commit SHAs.
@@ -3348,7 +3887,7 @@ class GitReposNamespace {
3348
3887
  /**
3349
3888
  * Get a repository instance by ID.
3350
3889
  */
3351
- instance({ repoId }) {
3890
+ ref({ repoId }) {
3352
3891
  return new GitRepo(repoId, this.apiClient);
3353
3892
  }
3354
3893
  /**
@@ -3368,6 +3907,31 @@ class GitNamespace {
3368
3907
  this.freestyle = freestyle;
3369
3908
  this.repos = new GitReposNamespace(apiClient);
3370
3909
  }
3910
+ /**
3911
+ * Manage Git repositories.
3912
+ *
3913
+ * Create, list, delete, and get references to repositories.
3914
+ *
3915
+ * @example
3916
+ * ```ts
3917
+ * // Create a new empty repository
3918
+ * const { repoId, repo } = await freestyle.git.repos.create({});
3919
+ *
3920
+ * // Create from a GitHub URL
3921
+ * const { repo } = await freestyle.git.repos.create({
3922
+ * source: { url: "https://github.com/owner/repo" }
3923
+ * });
3924
+ *
3925
+ * // List repositories
3926
+ * const repos = await freestyle.git.repos.list({ limit: 10 });
3927
+ *
3928
+ * // Get a reference to an existing repository
3929
+ * const repo = freestyle.git.repos.ref({ repoId: "your-repo-id" });
3930
+ *
3931
+ * // Delete a repository
3932
+ * await freestyle.git.repos.delete({ repoId: "your-repo-id" });
3933
+ * ```
3934
+ */
3371
3935
  repos;
3372
3936
  }
3373
3937
 
@@ -3376,13 +3940,21 @@ class Identity {
3376
3940
  this.apiClient = apiClient;
3377
3941
  this.identityId = identityId;
3378
3942
  this.permissions = new IdentityPermissions(identityId, apiClient);
3943
+ this.tokens = new IdentityTokens(identityId, apiClient);
3379
3944
  }
3380
3945
  identityId;
3381
3946
  permissions;
3947
+ tokens;
3948
+ }
3949
+ class IdentityTokens {
3950
+ constructor(identityId, apiClient) {
3951
+ this.identityId = identityId;
3952
+ this.apiClient = apiClient;
3953
+ }
3382
3954
  /**
3383
3955
  * Create a new access token for this identity.
3384
3956
  */
3385
- async createToken() {
3957
+ async create() {
3386
3958
  const response = await this.apiClient.post(
3387
3959
  "/identity/v1/identities/{identity}/tokens",
3388
3960
  {
@@ -3397,7 +3969,7 @@ class Identity {
3397
3969
  /**
3398
3970
  * Revoke an access token.
3399
3971
  */
3400
- async revokeToken({
3972
+ async revoke({
3401
3973
  tokenId
3402
3974
  }) {
3403
3975
  return this.apiClient.delete(
@@ -3410,7 +3982,7 @@ class Identity {
3410
3982
  /**
3411
3983
  * List access tokens for this identity.
3412
3984
  */
3413
- async listTokens() {
3985
+ async list() {
3414
3986
  return this.apiClient.get("/identity/v1/identities/{identity}/tokens", {
3415
3987
  params: { identity: this.identityId }
3416
3988
  });
@@ -3478,7 +4050,7 @@ class GitPermissions {
3478
4050
  /**
3479
4051
  * Grant this identity access to a repository.
3480
4052
  */
3481
- async create({
4053
+ async grant({
3482
4054
  repoId,
3483
4055
  permission
3484
4056
  }) {
@@ -3493,7 +4065,7 @@ class GitPermissions {
3493
4065
  /**
3494
4066
  * Revoke this identity's access to a repository.
3495
4067
  */
3496
- async delete({
4068
+ async revoke({
3497
4069
  repoId
3498
4070
  }) {
3499
4071
  return this.apiClient.delete(
@@ -3556,7 +4128,7 @@ class VmPermissions {
3556
4128
  /**
3557
4129
  * Grant this identity access to a VM.
3558
4130
  */
3559
- async create({
4131
+ async grant({
3560
4132
  vmId,
3561
4133
  allowedUsers
3562
4134
  }) {
@@ -3571,7 +4143,7 @@ class VmPermissions {
3571
4143
  /**
3572
4144
  * Revoke this identity's access to a VM.
3573
4145
  */
3574
- async delete({
4146
+ async revoke({
3575
4147
  vmId
3576
4148
  }) {
3577
4149
  return this.apiClient.delete(
@@ -3696,9 +4268,11 @@ class DeploymentsNamespace {
3696
4268
  this.apiClient = apiClient;
3697
4269
  }
3698
4270
  /**
3699
- * Create a web deployment on the edge.
4271
+ * Create a serverless web deployment
3700
4272
  */
3701
- async create({ ...body }) {
4273
+ async create({
4274
+ ...body
4275
+ }) {
3702
4276
  let source;
3703
4277
  if ("repo" in body) {
3704
4278
  source = {
@@ -3788,30 +4362,13 @@ class RunsNamespace {
3788
4362
  code,
3789
4363
  ...config
3790
4364
  }) {
3791
- const response = await this.apiClient.post("/execute/v1/script", {
4365
+ const response = await this.apiClient.post("/execute/v2/script", {
3792
4366
  body: {
3793
4367
  script: code,
3794
- config: {
3795
- customHeaders: config.customHeaders,
3796
- networkPermissions: config.networkPermissions?.map((np) => ({
3797
- action: np.action,
3798
- query: np.domain,
3799
- behavior: np.behavior
3800
- })),
3801
- envVars: config.envVars,
3802
- nodeModules: config.nodeModules,
3803
- timeout: config.timeoutMs
3804
- // entrypoint: config.entrypointPath,
3805
- }
4368
+ config
3806
4369
  }
3807
4370
  });
3808
- if (!response.result && !response.logs) {
3809
- throw new Error("Execution failed");
3810
- }
3811
- return {
3812
- result: response.result,
3813
- logs: response.logs || []
3814
- };
4371
+ return response;
3815
4372
  }
3816
4373
  /**
3817
4374
  * List execution runs.
@@ -3836,7 +4393,7 @@ class RunsNamespace {
3836
4393
  };
3837
4394
  }
3838
4395
  }
3839
- class EdgeNamespace {
4396
+ class ServerlessNamespace {
3840
4397
  constructor(apiClient) {
3841
4398
  this.apiClient = apiClient;
3842
4399
  this.deployments = new DeploymentsNamespace(apiClient);
@@ -4422,6 +4979,18 @@ class Vm {
4422
4979
  params: { vm_id: this.vmId }
4423
4980
  });
4424
4981
  }
4982
+ /**
4983
+ * Create a snapshot of the VM.
4984
+ *
4985
+ * @param body Optional snapshot configuration
4986
+ * @returns Snapshot ID and Source VM ID
4987
+ */
4988
+ async snapshot(body = {}) {
4989
+ return this.apiClient.post("/v1/vms/{vm_id}/snapshot", {
4990
+ params: { vm_id: this.vmId },
4991
+ body
4992
+ });
4993
+ }
4425
4994
  /**
4426
4995
  * Execute a command in the VM and wait for it to complete.
4427
4996
  * @param command The command to execute
@@ -4619,7 +5188,7 @@ class Freestyle {
4619
5188
  git;
4620
5189
  identities;
4621
5190
  dns;
4622
- edge;
5191
+ serverless;
4623
5192
  vms;
4624
5193
  constructor(options = {}) {
4625
5194
  if (!options.baseUrl) {
@@ -4644,7 +5213,7 @@ class Freestyle {
4644
5213
  this.git = new GitNamespace(this.apiClient, this);
4645
5214
  this.identities = new IdentitiesNamespace(this.apiClient);
4646
5215
  this.dns = new DnsNamespace(this.apiClient);
4647
- this.edge = new EdgeNamespace(this.apiClient);
5216
+ this.serverless = new ServerlessNamespace(this.apiClient);
4648
5217
  this.vms = new VmsNamespace(this.apiClient);
4649
5218
  }
4650
5219
  /**