freestyle-sandboxes 0.1.2 → 0.1.5

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 +1842 -1107
  3. package/index.d.cts +2240 -837
  4. package/index.d.mts +2240 -837
  5. package/index.mjs +1842 -1107
  6. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6,137 +6,41 @@ function errorFromJSON(body) {
6
6
  return new Error(`Unknown error code: ${body.code} - ${body.description}`);
7
7
  }
8
8
  }
9
- class InternalErrorError extends Error {
9
+ class GitErrorError extends Error {
10
10
  constructor(body) {
11
11
  super(
12
- `INTERNAL_ERROR: ${body.message}`
12
+ `GIT_ERROR: ${body.message}`
13
13
  );
14
14
  this.body = body;
15
- this.name = "InternalErrorError";
15
+ this.name = "GitErrorError";
16
16
  }
17
- static code = "INTERNAL_ERROR";
17
+ static code = "GIT_ERROR";
18
18
  static statusCode = 500;
19
- static description = `Internal error: {message}`;
20
- }
21
- class DockerImportBadRequestError extends Error {
22
- constructor(body) {
23
- super(
24
- `DOCKER_IMPORT_BAD_REQUEST: ${body.message}`
25
- );
26
- this.body = body;
27
- this.name = "DockerImportBadRequestError";
28
- }
29
- static code = "DOCKER_IMPORT_BAD_REQUEST";
30
- static statusCode = 400;
31
- static description = `Bad request: {message}`;
32
- }
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}`;
19
+ static description = `{message}`;
80
20
  }
81
- class BadRequestError extends Error {
21
+ class SnapshotVmBadRequestError extends Error {
82
22
  constructor(body) {
83
23
  super(
84
- `BAD_REQUEST: ${body.message}`
24
+ `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
85
25
  );
86
26
  this.body = body;
87
- this.name = "BadRequestError";
27
+ this.name = "SnapshotVmBadRequestError";
88
28
  }
89
- static code = "BAD_REQUEST";
29
+ static code = "SNAPSHOT_VM_BAD_REQUEST";
90
30
  static statusCode = 400;
91
31
  static description = `Bad request: {message}`;
92
32
  }
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 {
106
- constructor(body) {
107
- super(
108
- `VM_MUST_BE_STOPPED: ${body.message}`
109
- );
110
- this.body = body;
111
- this.name = "VmMustBeStoppedError";
112
- }
113
- static code = "VM_MUST_BE_STOPPED";
114
- static statusCode = 400;
115
- static description = `VM must be stopped before converting to base`;
116
- }
117
- class AlreadyHasBaseError extends Error {
118
- constructor(body) {
119
- super(
120
- `ALREADY_HAS_BASE: ${body.message}`
121
- );
122
- this.body = body;
123
- this.name = "AlreadyHasBaseError";
124
- }
125
- static code = "ALREADY_HAS_BASE";
126
- static statusCode = 400;
127
- static description = `VM already has a base rootfs`;
128
- }
129
- class NotFoundError extends Error {
33
+ class InternalErrorError extends Error {
130
34
  constructor(body) {
131
35
  super(
132
- `NOT_FOUND: ${body.message}`
36
+ `INTERNAL_ERROR: ${body.message}`
133
37
  );
134
38
  this.body = body;
135
- this.name = "NotFoundError";
39
+ this.name = "InternalErrorError";
136
40
  }
137
- static code = "NOT_FOUND";
138
- static statusCode = 404;
139
- static description = `VM not found`;
41
+ static code = "INTERNAL_ERROR";
42
+ static statusCode = 500;
43
+ static description = `Internal error: {message}`;
140
44
  }
141
45
  class ForkVmNotFoundError extends Error {
142
46
  constructor(body) {
@@ -162,42 +66,6 @@ class CreateSnapshotBadRequestError extends Error {
162
66
  static statusCode = 400;
163
67
  static description = `Bad request: {message}`;
164
68
  }
165
- class SnapshotVmBadRequestError extends Error {
166
- constructor(body) {
167
- super(
168
- `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
169
- );
170
- this.body = body;
171
- this.name = "SnapshotVmBadRequestError";
172
- }
173
- static code = "SNAPSHOT_VM_BAD_REQUEST";
174
- static statusCode = 400;
175
- static description = `Bad request: {message}`;
176
- }
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
69
  class VmDeletedError extends Error {
202
70
  constructor(body) {
203
71
  super(
@@ -306,112 +174,268 @@ class VmSubnetNotFoundError extends Error {
306
174
  static statusCode = 500;
307
175
  static description = `Subnet for VM not found`;
308
176
  }
309
- class VmOperationDeniedDuringTransactionError extends Error {
177
+ class FileNotFoundError extends Error {
310
178
  constructor(body) {
311
179
  super(
312
- `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
180
+ `FILE_NOT_FOUND: ${body.message}`
313
181
  );
314
182
  this.body = body;
315
- this.name = "VmOperationDeniedDuringTransactionError";
183
+ this.name = "FileNotFoundError";
316
184
  }
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}`;
185
+ static code = "FILE_NOT_FOUND";
186
+ static statusCode = 404;
187
+ static description = `File not found: {path}`;
320
188
  }
321
- class VmTransactionIdMismatchError extends Error {
189
+ class FilesBadRequestError extends Error {
322
190
  constructor(body) {
323
191
  super(
324
- `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
192
+ `FILES_BAD_REQUEST: ${body.message}`
325
193
  );
326
194
  this.body = body;
327
- this.name = "VmTransactionIdMismatchError";
195
+ this.name = "FilesBadRequestError";
328
196
  }
329
- static code = "VM_TRANSACTION_ID_MISMATCH";
197
+ static code = "FILES_BAD_REQUEST";
330
198
  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}`;
199
+ static description = `Bad request: {message}`;
332
200
  }
333
- class VmNotInTransactionError extends Error {
201
+ class VmMustBeStoppedError extends Error {
334
202
  constructor(body) {
335
203
  super(
336
- `VM_NOT_IN_TRANSACTION: ${body.message}`
204
+ `VM_MUST_BE_STOPPED: ${body.message}`
337
205
  );
338
206
  this.body = body;
339
- this.name = "VmNotInTransactionError";
207
+ this.name = "VmMustBeStoppedError";
340
208
  }
341
- static code = "VM_NOT_IN_TRANSACTION";
342
- static statusCode = 404;
343
- static description = `VM not in a transaction: {vm_id}`;
209
+ static code = "VM_MUST_BE_STOPPED";
210
+ static statusCode = 400;
211
+ static description = `VM must be stopped before converting to base`;
344
212
  }
345
- class UserNotFoundError extends Error {
213
+ class AlreadyHasBaseError extends Error {
346
214
  constructor(body) {
347
215
  super(
348
- `USER_NOT_FOUND: ${body.message}`
216
+ `ALREADY_HAS_BASE: ${body.message}`
349
217
  );
350
218
  this.body = body;
351
- this.name = "UserNotFoundError";
219
+ this.name = "AlreadyHasBaseError";
352
220
  }
353
- static code = "USER_NOT_FOUND";
354
- static statusCode = 404;
355
- static description = `User not found: {user_name}`;
221
+ static code = "ALREADY_HAS_BASE";
222
+ static statusCode = 400;
223
+ static description = `VM already has a base rootfs`;
356
224
  }
357
- class UserAlreadyExistsError extends Error {
225
+ class NotFoundError extends Error {
358
226
  constructor(body) {
359
227
  super(
360
- `USER_ALREADY_EXISTS: ${body.message}`
228
+ `NOT_FOUND: ${body.message}`
361
229
  );
362
230
  this.body = body;
363
- this.name = "UserAlreadyExistsError";
231
+ this.name = "NotFoundError";
364
232
  }
365
- static code = "USER_ALREADY_EXISTS";
366
- static statusCode = 409;
367
- static description = `Conflict: User '{user_name}' already exists`;
233
+ static code = "NOT_FOUND";
234
+ static statusCode = 404;
235
+ static description = `VM not found`;
368
236
  }
369
- class ValidationErrorError extends Error {
237
+ class VmNotFoundInFsError extends Error {
370
238
  constructor(body) {
371
239
  super(
372
- `VALIDATION_ERROR: ${body.message}`
240
+ `VM_NOT_FOUND_IN_FS: ${body.message}`
373
241
  );
374
242
  this.body = body;
375
- this.name = "ValidationErrorError";
243
+ this.name = "VmNotFoundInFsError";
376
244
  }
377
- static code = "VALIDATION_ERROR";
378
- static statusCode = 400;
379
- static description = `Validation error: {message}`;
245
+ static code = "VM_NOT_FOUND_IN_FS";
246
+ static statusCode = 406;
247
+ static description = `Vm Not found in filesystem`;
380
248
  }
381
- class GroupNotFoundError extends Error {
249
+ class VmNotRunningError extends Error {
382
250
  constructor(body) {
383
251
  super(
384
- `GROUP_NOT_FOUND: ${body.message}`
252
+ `VM_NOT_RUNNING: ${body.message}`
385
253
  );
386
254
  this.body = body;
387
- this.name = "GroupNotFoundError";
255
+ this.name = "VmNotRunningError";
388
256
  }
389
- static code = "GROUP_NOT_FOUND";
390
- static statusCode = 404;
391
- static description = `Group not found: {group_name}`;
257
+ static code = "VM_NOT_RUNNING";
258
+ static statusCode = 400;
259
+ static description = `VM is not running: {vm_id}`;
392
260
  }
393
- class GroupAlreadyExistsError extends Error {
261
+ class VmNotFoundError extends Error {
394
262
  constructor(body) {
395
263
  super(
396
- `GROUP_ALREADY_EXISTS: ${body.message}`
264
+ `VM_NOT_FOUND: ${body.message}`
397
265
  );
398
266
  this.body = body;
399
- this.name = "GroupAlreadyExistsError";
267
+ this.name = "VmNotFoundError";
400
268
  }
401
- static code = "GROUP_ALREADY_EXISTS";
402
- static statusCode = 409;
403
- static description = `Conflict: Group '{group_name}' already exists`;
269
+ static code = "VM_NOT_FOUND";
270
+ static statusCode = 404;
271
+ static description = `VM not found: {vm_id}`;
404
272
  }
405
- class DuplicateUserNameError extends Error {
273
+ class InternalForkVmNotFoundError extends Error {
406
274
  constructor(body) {
407
275
  super(
408
- `DUPLICATE_USER_NAME: ${body.message}`
276
+ `INTERNAL_FORK_VM_NOT_FOUND: ${body.message}`
409
277
  );
410
278
  this.body = body;
411
- this.name = "DuplicateUserNameError";
279
+ this.name = "InternalForkVmNotFoundError";
412
280
  }
413
- static code = "DUPLICATE_USER_NAME";
414
- static statusCode = 400;
281
+ static code = "INTERNAL_FORK_VM_NOT_FOUND";
282
+ static statusCode = 404;
283
+ static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
284
+ }
285
+ class BadRequestError extends Error {
286
+ constructor(body) {
287
+ super(
288
+ `BAD_REQUEST: ${body.message}`
289
+ );
290
+ this.body = body;
291
+ this.name = "BadRequestError";
292
+ }
293
+ static code = "BAD_REQUEST";
294
+ static statusCode = 400;
295
+ static description = `Bad request: {message}`;
296
+ }
297
+ class InternalVmNotFoundError extends Error {
298
+ constructor(body) {
299
+ super(
300
+ `INTERNAL_VM_NOT_FOUND: ${body.message}`
301
+ );
302
+ this.body = body;
303
+ this.name = "InternalVmNotFoundError";
304
+ }
305
+ static code = "INTERNAL_VM_NOT_FOUND";
306
+ static statusCode = 404;
307
+ static description = `VM not found: {vm_id}`;
308
+ }
309
+ class DockerImportBadRequestError extends Error {
310
+ constructor(body) {
311
+ super(
312
+ `DOCKER_IMPORT_BAD_REQUEST: ${body.message}`
313
+ );
314
+ this.body = body;
315
+ this.name = "DockerImportBadRequestError";
316
+ }
317
+ static code = "DOCKER_IMPORT_BAD_REQUEST";
318
+ static statusCode = 400;
319
+ static description = `Bad request: {message}`;
320
+ }
321
+ class VmOperationDeniedDuringTransactionError extends Error {
322
+ constructor(body) {
323
+ super(
324
+ `VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}`
325
+ );
326
+ this.body = body;
327
+ this.name = "VmOperationDeniedDuringTransactionError";
328
+ }
329
+ static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
330
+ static statusCode = 409;
331
+ static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
332
+ }
333
+ class VmTransactionIdMismatchError extends Error {
334
+ constructor(body) {
335
+ super(
336
+ `VM_TRANSACTION_ID_MISMATCH: ${body.message}`
337
+ );
338
+ this.body = body;
339
+ this.name = "VmTransactionIdMismatchError";
340
+ }
341
+ static code = "VM_TRANSACTION_ID_MISMATCH";
342
+ static statusCode = 400;
343
+ static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
344
+ }
345
+ class VmNotInTransactionError extends Error {
346
+ constructor(body) {
347
+ super(
348
+ `VM_NOT_IN_TRANSACTION: ${body.message}`
349
+ );
350
+ this.body = body;
351
+ this.name = "VmNotInTransactionError";
352
+ }
353
+ static code = "VM_NOT_IN_TRANSACTION";
354
+ static statusCode = 404;
355
+ static description = `VM not in a transaction: {vm_id}`;
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;
415
439
  static description = `Duplicate user name '{name}' found`;
416
440
  }
417
441
  class UserGroupEmptyError extends Error {
@@ -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,31 @@ 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`;
776
- }
777
- class PreVerifyFailedFetchError extends Error {
778
- constructor(body) {
779
- super(
780
- `PRE_VERIFY_FAILED_FETCH: ${body.message}`
781
- );
782
- this.body = body;
783
- this.name = "PreVerifyFailedFetchError";
784
- }
785
- static code = "PRE_VERIFY_FAILED_FETCH";
786
- static statusCode = 400;
787
- static description = `Could not reach domain for certificate verification - check DNS settings`;
751
+ static description = `Service '{service_name}' not found`;
788
752
  }
789
- class PreVerifyRouteNotFoundError extends Error {
753
+ class InvalidRequestError extends Error {
790
754
  constructor(body) {
791
755
  super(
792
- `PRE_VERIFY_ROUTE_NOT_FOUND: ${body.message}`
756
+ `INVALID_REQUEST: ${body.message}`
793
757
  );
794
758
  this.body = body;
795
- this.name = "PreVerifyRouteNotFoundError";
759
+ this.name = "InvalidRequestError";
796
760
  }
797
- static code = "PRE_VERIFY_ROUTE_NOT_FOUND";
761
+ static code = "INVALID_REQUEST";
798
762
  static statusCode = 400;
799
- static description = `Domain does not resolve to Freestyle servers`;
800
- }
801
- class AuthorizationNotFoundError extends Error {
802
- constructor(body) {
803
- super(
804
- `AUTHORIZATION_NOT_FOUND: ${body.message}`
805
- );
806
- this.body = body;
807
- this.name = "AuthorizationNotFoundError";
808
- }
809
- static code = "AUTHORIZATION_NOT_FOUND";
810
- static statusCode = 404;
811
- static description = `No authorization found for domain`;
763
+ static description = `Invalid request: {message}`;
812
764
  }
813
- class OrderNotFoundError extends Error {
765
+ class RepoNotFoundError extends Error {
814
766
  constructor(body) {
815
767
  super(
816
- `ORDER_NOT_FOUND: ${body.message}`
768
+ `REPO_NOT_FOUND: ${body.message}`
817
769
  );
818
770
  this.body = body;
819
- this.name = "OrderNotFoundError";
771
+ this.name = "RepoNotFoundError";
820
772
  }
821
- static code = "ORDER_NOT_FOUND";
773
+ static code = "REPO_NOT_FOUND";
822
774
  static statusCode = 404;
823
- static description = `No certificate order found for domain`;
775
+ static description = `Repository not found: {repo_id}`;
824
776
  }
825
777
  class InternalError extends Error {
826
778
  constructor(body) {
@@ -894,17 +846,17 @@ class ExpiredError extends Error {
894
846
  static statusCode = 403;
895
847
  static description = `Session has expired`;
896
848
  }
897
- class TagNotFoundError extends Error {
849
+ class ConflictError extends Error {
898
850
  constructor(body) {
899
851
  super(
900
- `TAG_NOT_FOUND: ${body.message}`
852
+ `CONFLICT: ${body.message}`
901
853
  );
902
854
  this.body = body;
903
- this.name = "TagNotFoundError";
855
+ this.name = "ConflictError";
904
856
  }
905
- static code = "TAG_NOT_FOUND";
906
- static statusCode = 404;
907
- static description = `Tag not found: {tag}`;
857
+ static code = "CONFLICT";
858
+ static statusCode = 409;
859
+ static description = `Sync conflict: {message}`;
908
860
  }
909
861
  class BranchNotFoundError extends Error {
910
862
  constructor(body) {
@@ -918,41 +870,41 @@ class BranchNotFoundError extends Error {
918
870
  static statusCode = 404;
919
871
  static description = `Branch not found: {branch}`;
920
872
  }
921
- class RepoNotFoundError extends Error {
873
+ class SendErrorError extends Error {
922
874
  constructor(body) {
923
875
  super(
924
- `REPO_NOT_FOUND: ${body.message}`
876
+ `SEND_ERROR: ${body.message}`
925
877
  );
926
878
  this.body = body;
927
- this.name = "RepoNotFoundError";
879
+ this.name = "SendErrorError";
928
880
  }
929
- static code = "REPO_NOT_FOUND";
930
- static statusCode = 404;
931
- static description = `Repository not found`;
881
+ static code = "SEND_ERROR";
882
+ static statusCode = 500;
883
+ static description = `Stream receiver dropped`;
932
884
  }
933
- class InvalidObjectIdError extends Error {
885
+ class ForbiddenError extends Error {
934
886
  constructor(body) {
935
887
  super(
936
- `INVALID_OBJECT_ID: ${body.message}`
888
+ `FORBIDDEN: ${body.message}`
937
889
  );
938
890
  this.body = body;
939
- this.name = "InvalidObjectIdError";
891
+ this.name = "ForbiddenError";
940
892
  }
941
- static code = "INVALID_OBJECT_ID";
942
- static statusCode = 400;
943
- static description = `Invalid object ID`;
893
+ static code = "FORBIDDEN";
894
+ static statusCode = 403;
895
+ static description = `Forbidden: {message}`;
944
896
  }
945
- class CommitNotFoundError extends Error {
897
+ class UnsupportedTransferError extends Error {
946
898
  constructor(body) {
947
899
  super(
948
- `COMMIT_NOT_FOUND: ${body.message}`
900
+ `UNSUPPORTED_TRANSFER: ${body.message}`
949
901
  );
950
902
  this.body = body;
951
- this.name = "CommitNotFoundError";
903
+ this.name = "UnsupportedTransferError";
952
904
  }
953
- static code = "COMMIT_NOT_FOUND";
954
- static statusCode = 404;
955
- static description = `Commit not found: {hash}`;
905
+ static code = "UNSUPPORTED_TRANSFER";
906
+ static statusCode = 400;
907
+ static description = `Unsupported LFS transfer protocol(s)`;
956
908
  }
957
909
  class ReferenceNotFoundError extends Error {
958
910
  constructor(body) {
@@ -966,89 +918,53 @@ class ReferenceNotFoundError extends Error {
966
918
  static statusCode = 404;
967
919
  static description = `Reference not found: {reference}`;
968
920
  }
969
- class PathNotFoundError extends Error {
970
- constructor(body) {
971
- super(
972
- `PATH_NOT_FOUND: ${body.message}`
973
- );
974
- this.body = body;
975
- this.name = "PathNotFoundError";
976
- }
977
- static code = "PATH_NOT_FOUND";
978
- static statusCode = 404;
979
- static description = `Path not found: {path}`;
980
- }
981
- class InvalidRequestError extends Error {
921
+ class InvalidRangeError extends Error {
982
922
  constructor(body) {
983
923
  super(
984
- `INVALID_REQUEST: ${body.message}`
924
+ `INVALID_RANGE: ${body.message}`
985
925
  );
986
926
  this.body = body;
987
- this.name = "InvalidRequestError";
927
+ this.name = "InvalidRangeError";
988
928
  }
989
- static code = "INVALID_REQUEST";
929
+ static code = "INVALID_RANGE";
990
930
  static statusCode = 400;
991
- static description = `null`;
931
+ 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.`;
992
932
  }
993
- class InvalidRevisionError extends Error {
933
+ class OffsetWithSelectorError extends Error {
994
934
  constructor(body) {
995
935
  super(
996
- `INVALID_REVISION: ${body.message}`
936
+ `OFFSET_WITH_SELECTOR: ${body.message}`
997
937
  );
998
938
  this.body = body;
999
- this.name = "InvalidRevisionError";
939
+ this.name = "OffsetWithSelectorError";
1000
940
  }
1001
- static code = "INVALID_REVISION";
941
+ static code = "OFFSET_WITH_SELECTOR";
1002
942
  static statusCode = 400;
1003
- static description = `null`;
1004
- }
1005
- class ForbiddenError extends Error {
1006
- constructor(body) {
1007
- super(
1008
- `FORBIDDEN: ${body.message}`
1009
- );
1010
- this.body = body;
1011
- this.name = "ForbiddenError";
1012
- }
1013
- static code = "FORBIDDEN";
1014
- static statusCode = 403;
1015
- static description = `Forbidden`;
1016
- }
1017
- class UnauthorizedError extends Error {
1018
- constructor(body) {
1019
- super(
1020
- `UNAUTHORIZED: ${body.message}`
1021
- );
1022
- this.body = body;
1023
- this.name = "UnauthorizedError";
1024
- }
1025
- static code = "UNAUTHORIZED";
1026
- static statusCode = 401;
1027
- static description = `Unauthorized`;
943
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1028
944
  }
1029
- class ConflictError extends Error {
945
+ class CommitNotInBranchError extends Error {
1030
946
  constructor(body) {
1031
947
  super(
1032
- `CONFLICT: ${body.message}`
948
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1033
949
  );
1034
950
  this.body = body;
1035
- this.name = "ConflictError";
951
+ this.name = "CommitNotInBranchError";
1036
952
  }
1037
- static code = "CONFLICT";
1038
- static statusCode = 409;
1039
- static description = `Sync conflict: {message}`;
953
+ static code = "COMMIT_NOT_IN_BRANCH";
954
+ static statusCode = 400;
955
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1040
956
  }
1041
- class UnsupportedTransferError extends Error {
957
+ class CommitNotFoundError extends Error {
1042
958
  constructor(body) {
1043
959
  super(
1044
- `UNSUPPORTED_TRANSFER: ${body.message}`
960
+ `COMMIT_NOT_FOUND: ${body.message}`
1045
961
  );
1046
962
  this.body = body;
1047
- this.name = "UnsupportedTransferError";
963
+ this.name = "CommitNotFoundError";
1048
964
  }
1049
- static code = "UNSUPPORTED_TRANSFER";
965
+ static code = "COMMIT_NOT_FOUND";
1050
966
  static statusCode = 400;
1051
- static description = `Unsupported LFS transfer protocol(s)`;
967
+ static description = `Commit not found: {sha}`;
1052
968
  }
1053
969
  class BlobNotFoundError extends Error {
1054
970
  constructor(body) {
@@ -1074,1061 +990,1181 @@ class TreeNotFoundError extends Error {
1074
990
  static statusCode = 404;
1075
991
  static description = `Tree not found: {hash}`;
1076
992
  }
1077
- class ResizeFailedError extends Error {
993
+ class InvalidRevisionError extends Error {
1078
994
  constructor(body) {
1079
995
  super(
1080
- `RESIZE_FAILED: ${body.message}`
996
+ `INVALID_REVISION: ${body.message}`
1081
997
  );
1082
998
  this.body = body;
1083
- this.name = "ResizeFailedError";
999
+ this.name = "InvalidRevisionError";
1084
1000
  }
1085
- static code = "RESIZE_FAILED";
1086
- static statusCode = 500;
1087
- static description = `Failed to resize VM: {message}`;
1001
+ static code = "INVALID_REVISION";
1002
+ static statusCode = 400;
1003
+ static description = `Invalid revision: {revision}`;
1088
1004
  }
1089
- class InternalResizeVmNotFoundError extends Error {
1005
+ class UnauthorizedError extends Error {
1090
1006
  constructor(body) {
1091
1007
  super(
1092
- `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
1008
+ `UNAUTHORIZED: ${body.message}`
1093
1009
  );
1094
1010
  this.body = body;
1095
- this.name = "InternalResizeVmNotFoundError";
1011
+ this.name = "UnauthorizedError";
1096
1012
  }
1097
- static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
1098
- static statusCode = 404;
1099
- static description = `VM not found`;
1013
+ static code = "UNAUTHORIZED";
1014
+ static statusCode = 401;
1015
+ static description = `Unauthorized`;
1100
1016
  }
1101
- class ObservabilityDatabaseErrorError extends Error {
1017
+ class TagNotFoundError extends Error {
1102
1018
  constructor(body) {
1103
1019
  super(
1104
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
1020
+ `TAG_NOT_FOUND: ${body.message}`
1105
1021
  );
1106
1022
  this.body = body;
1107
- this.name = "ObservabilityDatabaseErrorError";
1023
+ this.name = "TagNotFoundError";
1108
1024
  }
1109
- static code = "OBSERVABILITY_DATABASE_ERROR";
1110
- static statusCode = 500;
1111
- static description = `Database operation failed: {message}`;
1025
+ static code = "TAG_NOT_FOUND";
1026
+ static statusCode = 404;
1027
+ static description = `Tag not found: {tag}`;
1112
1028
  }
1113
- class ObservabilityAccessDeniedError extends Error {
1029
+ class RepoAlreadyExistsError extends Error {
1114
1030
  constructor(body) {
1115
1031
  super(
1116
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
1032
+ `REPO_ALREADY_EXISTS: ${body.message}`
1117
1033
  );
1118
1034
  this.body = body;
1119
- this.name = "ObservabilityAccessDeniedError";
1035
+ this.name = "RepoAlreadyExistsError";
1120
1036
  }
1121
- static code = "OBSERVABILITY_ACCESS_DENIED";
1122
- static statusCode = 403;
1123
- static description = `Access denied to logs for deployment: {deployment_id}`;
1037
+ static code = "REPO_ALREADY_EXISTS";
1038
+ static statusCode = 409;
1039
+ static description = `Repository {repo_id} already exists`;
1124
1040
  }
1125
- class ParseLogsFailedError extends Error {
1041
+ class GitHubSyncConflictError extends Error {
1126
1042
  constructor(body) {
1127
1043
  super(
1128
- `PARSE_LOGS_FAILED: ${body.message}`
1044
+ `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1129
1045
  );
1130
1046
  this.body = body;
1131
- this.name = "ParseLogsFailedError";
1047
+ this.name = "GitHubSyncConflictError";
1132
1048
  }
1133
- static code = "PARSE_LOGS_FAILED";
1134
- static statusCode = 500;
1135
- static description = `Failed to parse logs: {message}`;
1049
+ static code = "GIT_HUB_SYNC_CONFLICT";
1050
+ static statusCode = 409;
1051
+ static description = `GitHub Sync Conflict: {message}`;
1136
1052
  }
1137
- class RetrieveLogsFailedError extends Error {
1053
+ class InvalidObjectIdError extends Error {
1138
1054
  constructor(body) {
1139
1055
  super(
1140
- `RETRIEVE_LOGS_FAILED: ${body.message}`
1056
+ `INVALID_OBJECT_ID: ${body.message}`
1141
1057
  );
1142
1058
  this.body = body;
1143
- this.name = "RetrieveLogsFailedError";
1059
+ this.name = "InvalidObjectIdError";
1144
1060
  }
1145
- static code = "RETRIEVE_LOGS_FAILED";
1146
- static statusCode = 500;
1147
- static description = `Failed to retrieve logs: {message}`;
1061
+ static code = "INVALID_OBJECT_ID";
1062
+ static statusCode = 400;
1063
+ static description = `Invalid object ID: {hash}`;
1148
1064
  }
1149
- class InvalidQueryError extends Error {
1065
+ class SourceImportConflictError extends Error {
1150
1066
  constructor(body) {
1151
1067
  super(
1152
- `INVALID_QUERY: ${body.message}`
1068
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
1153
1069
  );
1154
1070
  this.body = body;
1155
- this.name = "InvalidQueryError";
1071
+ this.name = "SourceImportConflictError";
1156
1072
  }
1157
- static code = "INVALID_QUERY";
1073
+ static code = "SOURCE_IMPORT_CONFLICT";
1158
1074
  static statusCode = 400;
1159
- static description = `Invalid log query: {message}`;
1075
+ static description = `Source and import are mutually exclusive`;
1160
1076
  }
1161
- class LogsNotFoundError extends Error {
1077
+ class SourceUnauthorizedError extends Error {
1162
1078
  constructor(body) {
1163
1079
  super(
1164
- `LOGS_NOT_FOUND: ${body.message}`
1080
+ `SOURCE_UNAUTHORIZED: ${body.message}`
1165
1081
  );
1166
1082
  this.body = body;
1167
- this.name = "LogsNotFoundError";
1083
+ this.name = "SourceUnauthorizedError";
1168
1084
  }
1169
- static code = "LOGS_NOT_FOUND";
1170
- static statusCode = 404;
1171
- static description = `Logs not found for deployment: {deployment_id}`;
1085
+ static code = "SOURCE_UNAUTHORIZED";
1086
+ static statusCode = 400;
1087
+ static description = `Unauthorized to access source repository at {url}`;
1172
1088
  }
1173
- class PermissionAlreadyExistsError extends Error {
1089
+ class SourceNotFoundError extends Error {
1174
1090
  constructor(body) {
1175
1091
  super(
1176
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
1092
+ `SOURCE_NOT_FOUND: ${body.message}`
1177
1093
  );
1178
1094
  this.body = body;
1179
- this.name = "PermissionAlreadyExistsError";
1095
+ this.name = "SourceNotFoundError";
1180
1096
  }
1181
- static code = "PERMISSION_ALREADY_EXISTS";
1182
- static statusCode = 409;
1183
- static description = `Permission already exists`;
1097
+ static code = "SOURCE_NOT_FOUND";
1098
+ static statusCode = 400;
1099
+ static description = `Source repository not found at {url}`;
1184
1100
  }
1185
- class ListTokensFailedError extends Error {
1101
+ class ImportSubdirNotFoundError extends Error {
1186
1102
  constructor(body) {
1187
1103
  super(
1188
- `LIST_TOKENS_FAILED: ${body.message}`
1104
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1189
1105
  );
1190
1106
  this.body = body;
1191
- this.name = "ListTokensFailedError";
1107
+ this.name = "ImportSubdirNotFoundError";
1192
1108
  }
1193
- static code = "LIST_TOKENS_FAILED";
1194
- static statusCode = 500;
1195
- static description = `Failed to list tokens: {message}`;
1109
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1110
+ static statusCode = 400;
1111
+ static description = `Directory not found in {source}: {dir}`;
1196
1112
  }
1197
- class RevokeTokenFailedError extends Error {
1113
+ class PackfileError extends Error {
1198
1114
  constructor(body) {
1199
1115
  super(
1200
- `REVOKE_TOKEN_FAILED: ${body.message}`
1116
+ `PACKFILE: ${body.message}`
1201
1117
  );
1202
1118
  this.body = body;
1203
- this.name = "RevokeTokenFailedError";
1119
+ this.name = "PackfileError";
1204
1120
  }
1205
- static code = "REVOKE_TOKEN_FAILED";
1121
+ static code = "PACKFILE";
1206
1122
  static statusCode = 500;
1207
- static description = `Failed to revoke token: {message}`;
1123
+ static description = `Error building packfile`;
1208
1124
  }
1209
- class CreateTokenFailedError extends Error {
1125
+ class PathNotFoundError extends Error {
1210
1126
  constructor(body) {
1211
1127
  super(
1212
- `CREATE_TOKEN_FAILED: ${body.message}`
1128
+ `PATH_NOT_FOUND: ${body.message}`
1213
1129
  );
1214
1130
  this.body = body;
1215
- this.name = "CreateTokenFailedError";
1131
+ this.name = "PathNotFoundError";
1216
1132
  }
1217
- static code = "CREATE_TOKEN_FAILED";
1218
- static statusCode = 500;
1219
- static description = `Failed to create token: {message}`;
1133
+ static code = "PATH_NOT_FOUND";
1134
+ static statusCode = 404;
1135
+ static description = `Path not found: {path}`;
1220
1136
  }
1221
- class ListPermissionsFailedError extends Error {
1137
+ class InvalidServiceError extends Error {
1222
1138
  constructor(body) {
1223
1139
  super(
1224
- `LIST_PERMISSIONS_FAILED: ${body.message}`
1140
+ `INVALID_SERVICE: ${body.message}`
1225
1141
  );
1226
1142
  this.body = body;
1227
- this.name = "ListPermissionsFailedError";
1143
+ this.name = "InvalidServiceError";
1228
1144
  }
1229
- static code = "LIST_PERMISSIONS_FAILED";
1230
- static statusCode = 500;
1231
- static description = `Failed to list permissions: {message}`;
1145
+ static code = "INVALID_SERVICE";
1146
+ static statusCode = 403;
1147
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1232
1148
  }
1233
- class GetPermissionFailedError extends Error {
1149
+ class ExpectedServiceError extends Error {
1234
1150
  constructor(body) {
1235
1151
  super(
1236
- `GET_PERMISSION_FAILED: ${body.message}`
1152
+ `EXPECTED_SERVICE: ${body.message}`
1237
1153
  );
1238
1154
  this.body = body;
1239
- this.name = "GetPermissionFailedError";
1155
+ this.name = "ExpectedServiceError";
1240
1156
  }
1241
- static code = "GET_PERMISSION_FAILED";
1242
- static statusCode = 500;
1243
- static description = `Failed to get permission: {message}`;
1157
+ static code = "EXPECTED_SERVICE";
1158
+ static statusCode = 403;
1159
+ static description = `Expected 'service' query parameter`;
1244
1160
  }
1245
- class UpdatePermissionFailedError extends Error {
1161
+ class DatabaseErrorError extends Error {
1246
1162
  constructor(body) {
1247
1163
  super(
1248
- `UPDATE_PERMISSION_FAILED: ${body.message}`
1164
+ `DATABASE_ERROR: ${body.message}`
1249
1165
  );
1250
1166
  this.body = body;
1251
- this.name = "UpdatePermissionFailedError";
1167
+ this.name = "DatabaseErrorError";
1252
1168
  }
1253
- static code = "UPDATE_PERMISSION_FAILED";
1169
+ static code = "DATABASE_ERROR";
1254
1170
  static statusCode = 500;
1255
- static description = `Failed to update permission: {message}`;
1171
+ static description = `Database error: {0}`;
1256
1172
  }
1257
- class RevokePermissionFailedError extends Error {
1173
+ class WaitTimeoutError extends Error {
1258
1174
  constructor(body) {
1259
1175
  super(
1260
- `REVOKE_PERMISSION_FAILED: ${body.message}`
1176
+ `WAIT_TIMEOUT: ${body.message}`
1261
1177
  );
1262
1178
  this.body = body;
1263
- this.name = "RevokePermissionFailedError";
1179
+ this.name = "WaitTimeoutError";
1264
1180
  }
1265
- static code = "REVOKE_PERMISSION_FAILED";
1266
- static statusCode = 500;
1267
- static description = `Failed to revoke permission: {message}`;
1181
+ static code = "WAIT_TIMEOUT";
1182
+ static statusCode = 504;
1183
+ static description = `Timed out waiting for certificate validation`;
1268
1184
  }
1269
- class GrantPermissionFailedError extends Error {
1185
+ class PreVerifyChallengeMismatchError extends Error {
1270
1186
  constructor(body) {
1271
1187
  super(
1272
- `GRANT_PERMISSION_FAILED: ${body.message}`
1188
+ `PRE_VERIFY_CHALLENGE_MISMATCH: ${body.message}`
1273
1189
  );
1274
1190
  this.body = body;
1275
- this.name = "GrantPermissionFailedError";
1191
+ this.name = "PreVerifyChallengeMismatchError";
1276
1192
  }
1277
- static code = "GRANT_PERMISSION_FAILED";
1278
- static statusCode = 500;
1279
- static description = `Failed to grant permission: {message}`;
1193
+ static code = "PRE_VERIFY_CHALLENGE_MISMATCH";
1194
+ static statusCode = 400;
1195
+ static description = `Certificate challenge verification failed - response did not match`;
1280
1196
  }
1281
- class ListIdentitiesFailedError extends Error {
1197
+ class PreVerifyFailedParseError extends Error {
1282
1198
  constructor(body) {
1283
1199
  super(
1284
- `LIST_IDENTITIES_FAILED: ${body.message}`
1200
+ `PRE_VERIFY_FAILED_PARSE: ${body.message}`
1285
1201
  );
1286
1202
  this.body = body;
1287
- this.name = "ListIdentitiesFailedError";
1203
+ this.name = "PreVerifyFailedParseError";
1288
1204
  }
1289
- static code = "LIST_IDENTITIES_FAILED";
1290
- static statusCode = 500;
1291
- static description = `Failed to list identities: {message}`;
1205
+ static code = "PRE_VERIFY_FAILED_PARSE";
1206
+ static statusCode = 400;
1207
+ static description = `Invalid response from domain during certificate verification`;
1292
1208
  }
1293
- class DeleteIdentityFailedError extends Error {
1209
+ class PreVerifyFailedFetchError extends Error {
1294
1210
  constructor(body) {
1295
1211
  super(
1296
- `DELETE_IDENTITY_FAILED: ${body.message}`
1212
+ `PRE_VERIFY_FAILED_FETCH: ${body.message}`
1297
1213
  );
1298
1214
  this.body = body;
1299
- this.name = "DeleteIdentityFailedError";
1215
+ this.name = "PreVerifyFailedFetchError";
1300
1216
  }
1301
- static code = "DELETE_IDENTITY_FAILED";
1302
- static statusCode = 500;
1303
- static description = `Failed to delete identity: {message}`;
1217
+ static code = "PRE_VERIFY_FAILED_FETCH";
1218
+ static statusCode = 400;
1219
+ static description = `Could not reach domain for certificate verification - check DNS settings`;
1304
1220
  }
1305
- class CreateIdentityFailedError extends Error {
1221
+ class PreVerifyRouteNotFoundError extends Error {
1306
1222
  constructor(body) {
1307
1223
  super(
1308
- `CREATE_IDENTITY_FAILED: ${body.message}`
1224
+ `PRE_VERIFY_ROUTE_NOT_FOUND: ${body.message}`
1309
1225
  );
1310
1226
  this.body = body;
1311
- this.name = "CreateIdentityFailedError";
1227
+ this.name = "PreVerifyRouteNotFoundError";
1312
1228
  }
1313
- static code = "CREATE_IDENTITY_FAILED";
1314
- static statusCode = 500;
1315
- static description = `Failed to create identity: {message}`;
1229
+ static code = "PRE_VERIFY_ROUTE_NOT_FOUND";
1230
+ static statusCode = 400;
1231
+ static description = `Domain does not resolve to Freestyle servers`;
1316
1232
  }
1317
- class VmPermissionNotFoundError extends Error {
1233
+ class AuthorizationNotFoundError extends Error {
1318
1234
  constructor(body) {
1319
1235
  super(
1320
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
1236
+ `AUTHORIZATION_NOT_FOUND: ${body.message}`
1321
1237
  );
1322
1238
  this.body = body;
1323
- this.name = "VmPermissionNotFoundError";
1239
+ this.name = "AuthorizationNotFoundError";
1324
1240
  }
1325
- static code = "VM_PERMISSION_NOT_FOUND";
1241
+ static code = "AUTHORIZATION_NOT_FOUND";
1326
1242
  static statusCode = 404;
1327
- static description = `VM permission not found`;
1243
+ static description = `No authorization found for domain`;
1328
1244
  }
1329
- class PermissionNotFoundError extends Error {
1245
+ class OrderNotFoundError extends Error {
1330
1246
  constructor(body) {
1331
1247
  super(
1332
- `PERMISSION_NOT_FOUND: ${body.message}`
1248
+ `ORDER_NOT_FOUND: ${body.message}`
1333
1249
  );
1334
1250
  this.body = body;
1335
- this.name = "PermissionNotFoundError";
1251
+ this.name = "OrderNotFoundError";
1336
1252
  }
1337
- static code = "PERMISSION_NOT_FOUND";
1253
+ static code = "ORDER_NOT_FOUND";
1338
1254
  static statusCode = 404;
1339
- static description = `Permission not found`;
1255
+ static description = `No certificate order found for domain`;
1340
1256
  }
1341
- class VmAccessDeniedError extends Error {
1257
+ class ResizeFailedError extends Error {
1342
1258
  constructor(body) {
1343
1259
  super(
1344
- `VM_ACCESS_DENIED: ${body.message}`
1260
+ `RESIZE_FAILED: ${body.message}`
1345
1261
  );
1346
1262
  this.body = body;
1347
- this.name = "VmAccessDeniedError";
1263
+ this.name = "ResizeFailedError";
1348
1264
  }
1349
- static code = "VM_ACCESS_DENIED";
1350
- static statusCode = 403;
1351
- static description = `You are not allowed to access this VM`;
1265
+ static code = "RESIZE_FAILED";
1266
+ static statusCode = 500;
1267
+ static description = `Failed to resize VM: {message}`;
1352
1268
  }
1353
- class GitRepositoryAccessDeniedError extends Error {
1269
+ class InternalResizeVmNotFoundError extends Error {
1354
1270
  constructor(body) {
1355
1271
  super(
1356
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
1272
+ `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
1357
1273
  );
1358
1274
  this.body = body;
1359
- this.name = "GitRepositoryAccessDeniedError";
1275
+ this.name = "InternalResizeVmNotFoundError";
1360
1276
  }
1361
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
1362
- static statusCode = 403;
1363
- static description = `You are not allowed to access this repository`;
1277
+ static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
1278
+ static statusCode = 404;
1279
+ static description = `VM not found`;
1364
1280
  }
1365
- class GitRepositoryNotFoundError extends Error {
1281
+ class DomainOwnershipVerificationFailedError extends Error {
1366
1282
  constructor(body) {
1367
1283
  super(
1368
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
1284
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1369
1285
  );
1370
1286
  this.body = body;
1371
- this.name = "GitRepositoryNotFoundError";
1287
+ this.name = "DomainOwnershipVerificationFailedError";
1372
1288
  }
1373
- static code = "GIT_REPOSITORY_NOT_FOUND";
1374
- static statusCode = 404;
1375
- static description = `Repository not found`;
1289
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1290
+ static statusCode = 403;
1291
+ static description = `Domain ownership verification failed`;
1376
1292
  }
1377
- class CannotDeleteManagedIdentityError extends Error {
1293
+ class ErrorDeletingRecordError extends Error {
1378
1294
  constructor(body) {
1379
1295
  super(
1380
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
1296
+ `ERROR_DELETING_RECORD: ${body.message}`
1381
1297
  );
1382
1298
  this.body = body;
1383
- this.name = "CannotDeleteManagedIdentityError";
1299
+ this.name = "ErrorDeletingRecordError";
1384
1300
  }
1385
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
1386
- static statusCode = 403;
1387
- static description = `Cannot delete managed identities`;
1301
+ static code = "ERROR_DELETING_RECORD";
1302
+ static statusCode = 500;
1303
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1388
1304
  }
1389
- class CannotModifyManagedIdentityError extends Error {
1305
+ class RecordOwnershipErrorError extends Error {
1390
1306
  constructor(body) {
1391
1307
  super(
1392
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
1308
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
1393
1309
  );
1394
1310
  this.body = body;
1395
- this.name = "CannotModifyManagedIdentityError";
1311
+ this.name = "RecordOwnershipErrorError";
1396
1312
  }
1397
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
1313
+ static code = "RECORD_OWNERSHIP_ERROR";
1398
1314
  static statusCode = 403;
1399
- static description = `Cannot modify managed identities`;
1315
+ static description = `Account {account_id} does not own record {record_id}`;
1400
1316
  }
1401
- class IdentityAccessDeniedError extends Error {
1317
+ class ErrorCreatingRecordError extends Error {
1402
1318
  constructor(body) {
1403
1319
  super(
1404
- `IDENTITY_ACCESS_DENIED: ${body.message}`
1320
+ `ERROR_CREATING_RECORD: ${body.message}`
1405
1321
  );
1406
1322
  this.body = body;
1407
- this.name = "IdentityAccessDeniedError";
1323
+ this.name = "ErrorCreatingRecordError";
1408
1324
  }
1409
- static code = "IDENTITY_ACCESS_DENIED";
1410
- static statusCode = 403;
1411
- static description = `You are not allowed to access this identity`;
1325
+ static code = "ERROR_CREATING_RECORD";
1326
+ static statusCode = 500;
1327
+ static description = `Error creating DNS record: {message}`;
1412
1328
  }
1413
- class IdentityNotFoundError extends Error {
1329
+ class DomainOwnershipErrorError extends Error {
1414
1330
  constructor(body) {
1415
1331
  super(
1416
- `IDENTITY_NOT_FOUND: ${body.message}`
1332
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1417
1333
  );
1418
1334
  this.body = body;
1419
- this.name = "IdentityNotFoundError";
1335
+ this.name = "DomainOwnershipErrorError";
1420
1336
  }
1421
- static code = "IDENTITY_NOT_FOUND";
1422
- static statusCode = 404;
1423
- static description = `Identity not found`;
1337
+ static code = "DOMAIN_OWNERSHIP_ERROR";
1338
+ static statusCode = 403;
1339
+ static description = `Account {account_id} does not own domain {domain}`;
1424
1340
  }
1425
- class ExecuteInternalErrorError extends Error {
1341
+ class BrowserOperationFailedError extends Error {
1426
1342
  constructor(body) {
1427
1343
  super(
1428
- `EXECUTE_INTERNAL_ERROR: ${body.message}`
1344
+ `BROWSER_OPERATION_FAILED: ${body.message}`
1429
1345
  );
1430
1346
  this.body = body;
1431
- this.name = "ExecuteInternalErrorError";
1347
+ this.name = "BrowserOperationFailedError";
1432
1348
  }
1433
- static code = "EXECUTE_INTERNAL_ERROR";
1349
+ static code = "BROWSER_OPERATION_FAILED";
1434
1350
  static statusCode = 500;
1435
- static description = `Internal error: {message}`;
1351
+ static description = `Browser operation failed: {message}`;
1436
1352
  }
1437
- class ExecuteAccessDeniedError extends Error {
1353
+ class WatchFilesFailedError extends Error {
1438
1354
  constructor(body) {
1439
1355
  super(
1440
- `EXECUTE_ACCESS_DENIED: ${body.message}`
1356
+ `WATCH_FILES_FAILED: ${body.message}`
1441
1357
  );
1442
1358
  this.body = body;
1443
- this.name = "ExecuteAccessDeniedError";
1359
+ this.name = "WatchFilesFailedError";
1444
1360
  }
1445
- static code = "EXECUTE_ACCESS_DENIED";
1446
- static statusCode = 403;
1447
- static description = `Access denied to execute run`;
1361
+ static code = "WATCH_FILES_FAILED";
1362
+ static statusCode = 500;
1363
+ static description = `Failed to watch files: {message}`;
1448
1364
  }
1449
- class ListRunsFailedError extends Error {
1365
+ class LogsFailedError extends Error {
1450
1366
  constructor(body) {
1451
1367
  super(
1452
- `LIST_RUNS_FAILED: ${body.message}`
1368
+ `LOGS_FAILED: ${body.message}`
1453
1369
  );
1454
1370
  this.body = body;
1455
- this.name = "ListRunsFailedError";
1371
+ this.name = "LogsFailedError";
1456
1372
  }
1457
- static code = "LIST_RUNS_FAILED";
1373
+ static code = "LOGS_FAILED";
1458
1374
  static statusCode = 500;
1459
- static description = `Failed to list execute runs: {message}`;
1375
+ static description = `Failed to get logs: {message}`;
1460
1376
  }
1461
- class ExecutionErrorError extends Error {
1377
+ class StatusFailedError extends Error {
1462
1378
  constructor(body) {
1463
1379
  super(
1464
- `EXECUTION_ERROR: ${body.message}`
1380
+ `STATUS_FAILED: ${body.message}`
1465
1381
  );
1466
1382
  this.body = body;
1467
- this.name = "ExecutionErrorError";
1383
+ this.name = "StatusFailedError";
1468
1384
  }
1469
- static code = "EXECUTION_ERROR";
1385
+ static code = "STATUS_FAILED";
1470
1386
  static statusCode = 500;
1471
- static description = `Script execution error: {message}`;
1387
+ static description = `Failed to get dev server status: {message}`;
1472
1388
  }
1473
- class ConnectionFailedError extends Error {
1389
+ class RestartFailedError extends Error {
1474
1390
  constructor(body) {
1475
1391
  super(
1476
- `CONNECTION_FAILED: ${body.message}`
1392
+ `RESTART_FAILED: ${body.message}`
1477
1393
  );
1478
1394
  this.body = body;
1479
- this.name = "ConnectionFailedError";
1395
+ this.name = "RestartFailedError";
1480
1396
  }
1481
- static code = "CONNECTION_FAILED";
1397
+ static code = "RESTART_FAILED";
1482
1398
  static statusCode = 500;
1483
- static description = `Failed to connect to execute server: {message}`;
1399
+ static description = `Failed to restart dev server: {message}`;
1484
1400
  }
1485
- class MetadataWriteFailedError extends Error {
1401
+ class ShutdownFailedError extends Error {
1486
1402
  constructor(body) {
1487
1403
  super(
1488
- `METADATA_WRITE_FAILED: ${body.message}`
1404
+ `SHUTDOWN_FAILED: ${body.message}`
1489
1405
  );
1490
1406
  this.body = body;
1491
- this.name = "MetadataWriteFailedError";
1407
+ this.name = "ShutdownFailedError";
1492
1408
  }
1493
- static code = "METADATA_WRITE_FAILED";
1409
+ static code = "SHUTDOWN_FAILED";
1494
1410
  static statusCode = 500;
1495
- static description = `Failed to write metadata file: {message}`;
1411
+ static description = `Failed to shutdown dev server: {message}`;
1496
1412
  }
1497
- class NodeModulesInstallFailedError extends Error {
1413
+ class CommitFailedError extends Error {
1498
1414
  constructor(body) {
1499
1415
  super(
1500
- `NODE_MODULES_INSTALL_FAILED: ${body.message}`
1416
+ `COMMIT_FAILED: ${body.message}`
1501
1417
  );
1502
1418
  this.body = body;
1503
- this.name = "NodeModulesInstallFailedError";
1419
+ this.name = "CommitFailedError";
1504
1420
  }
1505
- static code = "NODE_MODULES_INSTALL_FAILED";
1421
+ static code = "COMMIT_FAILED";
1506
1422
  static statusCode = 500;
1507
- static description = `Failed to install node modules: {message}`;
1423
+ static description = `Failed to commit changes: {message}`;
1508
1424
  }
1509
- class NodeModulesDownloadFailedError extends Error {
1425
+ class WriteFileFailedError extends Error {
1510
1426
  constructor(body) {
1511
1427
  super(
1512
- `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
1428
+ `WRITE_FILE_FAILED: ${body.message}`
1513
1429
  );
1514
1430
  this.body = body;
1515
- this.name = "NodeModulesDownloadFailedError";
1431
+ this.name = "WriteFileFailedError";
1516
1432
  }
1517
- static code = "NODE_MODULES_DOWNLOAD_FAILED";
1433
+ static code = "WRITE_FILE_FAILED";
1518
1434
  static statusCode = 500;
1519
- static description = `Failed to download node modules: {message}`;
1435
+ static description = `Failed to write file: {message}`;
1520
1436
  }
1521
- class LockGenerationFailedError extends Error {
1437
+ class ReadFileFailedError extends Error {
1522
1438
  constructor(body) {
1523
1439
  super(
1524
- `LOCK_GENERATION_FAILED: ${body.message}`
1440
+ `READ_FILE_FAILED: ${body.message}`
1525
1441
  );
1526
1442
  this.body = body;
1527
- this.name = "LockGenerationFailedError";
1443
+ this.name = "ReadFileFailedError";
1528
1444
  }
1529
- static code = "LOCK_GENERATION_FAILED";
1445
+ static code = "READ_FILE_FAILED";
1530
1446
  static statusCode = 500;
1531
- static description = `Failed to generate lock file: {message}`;
1447
+ static description = `Failed to read file: {message}`;
1532
1448
  }
1533
- class WriteScriptFailedError extends Error {
1449
+ class ExecutionFailedError extends Error {
1534
1450
  constructor(body) {
1535
1451
  super(
1536
- `WRITE_SCRIPT_FAILED: ${body.message}`
1452
+ `EXECUTION_FAILED: ${body.message}`
1537
1453
  );
1538
1454
  this.body = body;
1539
- this.name = "WriteScriptFailedError";
1455
+ this.name = "ExecutionFailedError";
1540
1456
  }
1541
- static code = "WRITE_SCRIPT_FAILED";
1457
+ static code = "EXECUTION_FAILED";
1542
1458
  static statusCode = 500;
1543
- static description = `Failed to write script file: {message}`;
1459
+ static description = `Failed to execute command: {message}`;
1544
1460
  }
1545
- class DirectoryCreationFailedError extends Error {
1461
+ class RequestFailedError extends Error {
1546
1462
  constructor(body) {
1547
1463
  super(
1548
- `DIRECTORY_CREATION_FAILED: ${body.message}`
1464
+ `REQUEST_FAILED: ${body.message}`
1549
1465
  );
1550
1466
  this.body = body;
1551
- this.name = "DirectoryCreationFailedError";
1467
+ this.name = "RequestFailedError";
1552
1468
  }
1553
- static code = "DIRECTORY_CREATION_FAILED";
1469
+ static code = "REQUEST_FAILED";
1554
1470
  static statusCode = 500;
1555
- static description = `Failed to create script directory: {message}`;
1471
+ static description = `Failed to request dev server: {message}`;
1556
1472
  }
1557
- class NetworkPermissionsFailedError extends Error {
1473
+ class DevServerFileNotFoundError extends Error {
1558
1474
  constructor(body) {
1559
1475
  super(
1560
- `NETWORK_PERMISSIONS_FAILED: ${body.message}`
1476
+ `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
1561
1477
  );
1562
1478
  this.body = body;
1563
- this.name = "NetworkPermissionsFailedError";
1479
+ this.name = "DevServerFileNotFoundError";
1564
1480
  }
1565
- static code = "NETWORK_PERMISSIONS_FAILED";
1566
- static statusCode = 500;
1567
- static description = `Failed to insert network permissions: {message}`;
1481
+ static code = "DEV_SERVER_FILE_NOT_FOUND";
1482
+ static statusCode = 404;
1483
+ static description = `Dev server file not found: {path}`;
1568
1484
  }
1569
- class LoggingFailedError extends Error {
1485
+ class DevServerInvalidRequestError extends Error {
1570
1486
  constructor(body) {
1571
1487
  super(
1572
- `LOGGING_FAILED: ${body.message}`
1488
+ `DEV_SERVER_INVALID_REQUEST: ${body.message}`
1573
1489
  );
1574
1490
  this.body = body;
1575
- this.name = "LoggingFailedError";
1491
+ this.name = "DevServerInvalidRequestError";
1576
1492
  }
1577
- static code = "LOGGING_FAILED";
1578
- static statusCode = 500;
1579
- static description = `Failed to log execute run: {message}`;
1493
+ static code = "DEV_SERVER_INVALID_REQUEST";
1494
+ static statusCode = 400;
1495
+ static description = `Invalid dev server request: {message}`;
1580
1496
  }
1581
- class RunNotFoundError extends Error {
1497
+ class DevServerNotFoundError extends Error {
1582
1498
  constructor(body) {
1583
1499
  super(
1584
- `RUN_NOT_FOUND: ${body.message}`
1500
+ `DEV_SERVER_NOT_FOUND: ${body.message}`
1585
1501
  );
1586
1502
  this.body = body;
1587
- this.name = "RunNotFoundError";
1503
+ this.name = "DevServerNotFoundError";
1588
1504
  }
1589
- static code = "RUN_NOT_FOUND";
1505
+ static code = "DEV_SERVER_NOT_FOUND";
1590
1506
  static statusCode = 404;
1591
- static description = `Execute run not found: {run_id}`;
1507
+ static description = `Dev server not found: {server_id}`;
1592
1508
  }
1593
- class FailedToProvisionCertificateError extends Error {
1509
+ class ExecuteInternalErrorError extends Error {
1594
1510
  constructor(body) {
1595
1511
  super(
1596
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
1512
+ `EXECUTE_INTERNAL_ERROR: ${body.message}`
1597
1513
  );
1598
1514
  this.body = body;
1599
- this.name = "FailedToProvisionCertificateError";
1515
+ this.name = "ExecuteInternalErrorError";
1600
1516
  }
1601
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
1602
- static statusCode = 422;
1603
- static description = `Failed to provision certificate: {message}`;
1517
+ static code = "EXECUTE_INTERNAL_ERROR";
1518
+ static statusCode = 500;
1519
+ static description = `Internal error: {message}`;
1604
1520
  }
1605
- class FailedToInsertDomainMappingError extends Error {
1521
+ class ExecuteAccessDeniedError extends Error {
1606
1522
  constructor(body) {
1607
1523
  super(
1608
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
1524
+ `EXECUTE_ACCESS_DENIED: ${body.message}`
1609
1525
  );
1610
1526
  this.body = body;
1611
- this.name = "FailedToInsertDomainMappingError";
1527
+ this.name = "ExecuteAccessDeniedError";
1612
1528
  }
1613
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
1614
- static statusCode = 500;
1615
- static description = `Failed to insert domain mapping: {message}`;
1529
+ static code = "EXECUTE_ACCESS_DENIED";
1530
+ static statusCode = 403;
1531
+ static description = `Access denied to execute run`;
1616
1532
  }
1617
- class PermissionDeniedError extends Error {
1533
+ class ListRunsFailedError extends Error {
1618
1534
  constructor(body) {
1619
1535
  super(
1620
- `PERMISSION_DENIED: ${body.message}`
1536
+ `LIST_RUNS_FAILED: ${body.message}`
1621
1537
  );
1622
1538
  this.body = body;
1623
- this.name = "PermissionDeniedError";
1539
+ this.name = "ListRunsFailedError";
1624
1540
  }
1625
- static code = "PERMISSION_DENIED";
1626
- static statusCode = 401;
1627
- static description = `Permission denied: {message}`;
1541
+ static code = "LIST_RUNS_FAILED";
1542
+ static statusCode = 500;
1543
+ static description = `Failed to list execute runs: {message}`;
1628
1544
  }
1629
- class FailedToCheckPermissionsError extends Error {
1545
+ class ExecutionErrorError extends Error {
1630
1546
  constructor(body) {
1631
1547
  super(
1632
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
1548
+ `EXECUTION_ERROR: ${body.message}`
1633
1549
  );
1634
1550
  this.body = body;
1635
- this.name = "FailedToCheckPermissionsError";
1551
+ this.name = "ExecutionErrorError";
1636
1552
  }
1637
- static code = "FAILED_TO_CHECK_PERMISSIONS";
1638
- static statusCode = 502;
1639
- static description = `Failed to check permissions: {message}`;
1553
+ static code = "EXECUTION_ERROR";
1554
+ static statusCode = 500;
1555
+ static description = `Script execution error: {message}`;
1640
1556
  }
1641
- class FailedToListDomainsError extends Error {
1557
+ class ConnectionFailedError extends Error {
1642
1558
  constructor(body) {
1643
1559
  super(
1644
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
1560
+ `CONNECTION_FAILED: ${body.message}`
1645
1561
  );
1646
1562
  this.body = body;
1647
- this.name = "FailedToListDomainsError";
1563
+ this.name = "ConnectionFailedError";
1648
1564
  }
1649
- static code = "FAILED_TO_LIST_DOMAINS";
1565
+ static code = "CONNECTION_FAILED";
1650
1566
  static statusCode = 500;
1651
- static description = `Failed to list domains: {message}`;
1567
+ static description = `Failed to connect to execute server: {message}`;
1652
1568
  }
1653
- class FailedToListVerificationsError extends Error {
1569
+ class MetadataWriteFailedError extends Error {
1654
1570
  constructor(body) {
1655
1571
  super(
1656
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
1572
+ `METADATA_WRITE_FAILED: ${body.message}`
1657
1573
  );
1658
1574
  this.body = body;
1659
- this.name = "FailedToListVerificationsError";
1575
+ this.name = "MetadataWriteFailedError";
1660
1576
  }
1661
- static code = "FAILED_TO_LIST_VERIFICATIONS";
1577
+ static code = "METADATA_WRITE_FAILED";
1662
1578
  static statusCode = 500;
1663
- static description = `Failed to list verifications: {message}`;
1579
+ static description = `Failed to write metadata file: {message}`;
1664
1580
  }
1665
- class FailedToVerifyDomainError extends Error {
1581
+ class NodeModulesInstallFailedError extends Error {
1666
1582
  constructor(body) {
1667
1583
  super(
1668
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
1584
+ `NODE_MODULES_INSTALL_FAILED: ${body.message}`
1669
1585
  );
1670
1586
  this.body = body;
1671
- this.name = "FailedToVerifyDomainError";
1587
+ this.name = "NodeModulesInstallFailedError";
1672
1588
  }
1673
- static code = "FAILED_TO_VERIFY_DOMAIN";
1589
+ static code = "NODE_MODULES_INSTALL_FAILED";
1674
1590
  static statusCode = 500;
1675
- static description = `Failed to verify domain: {message}`;
1591
+ static description = `Failed to install node modules: {message}`;
1676
1592
  }
1677
- class VerificationFailedError extends Error {
1593
+ class NodeModulesDownloadFailedError extends Error {
1678
1594
  constructor(body) {
1679
1595
  super(
1680
- `VERIFICATION_FAILED: ${body.message}`
1596
+ `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
1681
1597
  );
1682
1598
  this.body = body;
1683
- this.name = "VerificationFailedError";
1599
+ this.name = "NodeModulesDownloadFailedError";
1684
1600
  }
1685
- static code = "VERIFICATION_FAILED";
1686
- static statusCode = 400;
1687
- static description = `Domain verification failed: {message}`;
1601
+ static code = "NODE_MODULES_DOWNLOAD_FAILED";
1602
+ static statusCode = 500;
1603
+ static description = `Failed to download node modules: {message}`;
1688
1604
  }
1689
- class FailedToDeleteVerificationError extends Error {
1605
+ class LockGenerationFailedError extends Error {
1690
1606
  constructor(body) {
1691
1607
  super(
1692
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
1608
+ `LOCK_GENERATION_FAILED: ${body.message}`
1693
1609
  );
1694
1610
  this.body = body;
1695
- this.name = "FailedToDeleteVerificationError";
1611
+ this.name = "LockGenerationFailedError";
1696
1612
  }
1697
- static code = "FAILED_TO_DELETE_VERIFICATION";
1698
- static statusCode = 400;
1699
- static description = `Failed to delete verification: {message}`;
1613
+ static code = "LOCK_GENERATION_FAILED";
1614
+ static statusCode = 500;
1615
+ static description = `Failed to generate lock file: {message}`;
1700
1616
  }
1701
- class VerificationNotFoundError extends Error {
1617
+ class WriteScriptFailedError extends Error {
1702
1618
  constructor(body) {
1703
1619
  super(
1704
- `VERIFICATION_NOT_FOUND: ${body.message}`
1620
+ `WRITE_SCRIPT_FAILED: ${body.message}`
1705
1621
  );
1706
1622
  this.body = body;
1707
- this.name = "VerificationNotFoundError";
1623
+ this.name = "WriteScriptFailedError";
1708
1624
  }
1709
- static code = "VERIFICATION_NOT_FOUND";
1710
- static statusCode = 404;
1711
- static description = `Verification request not found for domain: {domain}`;
1625
+ static code = "WRITE_SCRIPT_FAILED";
1626
+ static statusCode = 500;
1627
+ static description = `Failed to write script file: {message}`;
1712
1628
  }
1713
- class FailedToCreateVerificationCodeError extends Error {
1629
+ class DirectoryCreationFailedError extends Error {
1714
1630
  constructor(body) {
1715
1631
  super(
1716
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
1632
+ `DIRECTORY_CREATION_FAILED: ${body.message}`
1717
1633
  );
1718
1634
  this.body = body;
1719
- this.name = "FailedToCreateVerificationCodeError";
1635
+ this.name = "DirectoryCreationFailedError";
1720
1636
  }
1721
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
1722
- static statusCode = 400;
1723
- static description = `Failed to create verification code: {message}`;
1637
+ static code = "DIRECTORY_CREATION_FAILED";
1638
+ static statusCode = 500;
1639
+ static description = `Failed to create script directory: {message}`;
1724
1640
  }
1725
- class InvalidDomainError extends Error {
1641
+ class NetworkPermissionsFailedError extends Error {
1726
1642
  constructor(body) {
1727
1643
  super(
1728
- `INVALID_DOMAIN: ${body.message}`
1644
+ `NETWORK_PERMISSIONS_FAILED: ${body.message}`
1729
1645
  );
1730
1646
  this.body = body;
1731
- this.name = "InvalidDomainError";
1647
+ this.name = "NetworkPermissionsFailedError";
1732
1648
  }
1733
- static code = "INVALID_DOMAIN";
1734
- static statusCode = 400;
1735
- static description = `Invalid domain: {domain}`;
1649
+ static code = "NETWORK_PERMISSIONS_FAILED";
1650
+ static statusCode = 500;
1651
+ static description = `Failed to insert network permissions: {message}`;
1736
1652
  }
1737
- class DomainOwnershipVerificationFailedError extends Error {
1653
+ class LoggingFailedError extends Error {
1738
1654
  constructor(body) {
1739
1655
  super(
1740
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1656
+ `LOGGING_FAILED: ${body.message}`
1741
1657
  );
1742
1658
  this.body = body;
1743
- this.name = "DomainOwnershipVerificationFailedError";
1659
+ this.name = "LoggingFailedError";
1744
1660
  }
1745
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1746
- static statusCode = 403;
1747
- static description = `Domain ownership verification failed`;
1661
+ static code = "LOGGING_FAILED";
1662
+ static statusCode = 500;
1663
+ static description = `Failed to log execute run: {message}`;
1748
1664
  }
1749
- class ErrorDeletingRecordError extends Error {
1665
+ class RunNotFoundError extends Error {
1750
1666
  constructor(body) {
1751
1667
  super(
1752
- `ERROR_DELETING_RECORD: ${body.message}`
1668
+ `RUN_NOT_FOUND: ${body.message}`
1753
1669
  );
1754
1670
  this.body = body;
1755
- this.name = "ErrorDeletingRecordError";
1671
+ this.name = "RunNotFoundError";
1756
1672
  }
1757
- static code = "ERROR_DELETING_RECORD";
1758
- static statusCode = 500;
1759
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1673
+ static code = "RUN_NOT_FOUND";
1674
+ static statusCode = 404;
1675
+ static description = `Execute run not found: {run_id}`;
1760
1676
  }
1761
- class RecordOwnershipErrorError extends Error {
1677
+ class EmptyTagError extends Error {
1762
1678
  constructor(body) {
1763
1679
  super(
1764
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
1680
+ `EMPTY_TAG: ${body.message}`
1765
1681
  );
1766
1682
  this.body = body;
1767
- this.name = "RecordOwnershipErrorError";
1683
+ this.name = "EmptyTagError";
1768
1684
  }
1769
- static code = "RECORD_OWNERSHIP_ERROR";
1770
- static statusCode = 403;
1771
- static description = `Account {account_id} does not own record {record_id}`;
1685
+ static code = "EMPTY_TAG";
1686
+ static statusCode = 400;
1687
+ static description = `Invalid request: tag cannot be empty`;
1772
1688
  }
1773
- class ErrorCreatingRecordError extends Error {
1689
+ class AnyhowError extends Error {
1774
1690
  constructor(body) {
1775
1691
  super(
1776
- `ERROR_CREATING_RECORD: ${body.message}`
1692
+ `ANYHOW: ${body.message}`
1777
1693
  );
1778
1694
  this.body = body;
1779
- this.name = "ErrorCreatingRecordError";
1695
+ this.name = "AnyhowError";
1780
1696
  }
1781
- static code = "ERROR_CREATING_RECORD";
1697
+ static code = "ANYHOW";
1782
1698
  static statusCode = 500;
1783
- static description = `Error creating DNS record: {message}`;
1699
+ static description = `Internal server error: {0}`;
1784
1700
  }
1785
- class DomainOwnershipErrorError extends Error {
1701
+ class BranchNameEmptyError extends Error {
1786
1702
  constructor(body) {
1787
1703
  super(
1788
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1704
+ `BRANCH_NAME_EMPTY: ${body.message}`
1789
1705
  );
1790
1706
  this.body = body;
1791
- this.name = "DomainOwnershipErrorError";
1707
+ this.name = "BranchNameEmptyError";
1792
1708
  }
1793
- static code = "DOMAIN_OWNERSHIP_ERROR";
1794
- static statusCode = 403;
1795
- static description = `Account {account_id} does not own domain {domain}`;
1709
+ static code = "BRANCH_NAME_EMPTY";
1710
+ static statusCode = 400;
1711
+ static description = `Branch name cannot be empty`;
1796
1712
  }
1797
- class BrowserOperationFailedError extends Error {
1713
+ class CloudstateInternalErrorError extends Error {
1798
1714
  constructor(body) {
1799
1715
  super(
1800
- `BROWSER_OPERATION_FAILED: ${body.message}`
1716
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
1801
1717
  );
1802
1718
  this.body = body;
1803
- this.name = "BrowserOperationFailedError";
1719
+ this.name = "CloudstateInternalErrorError";
1804
1720
  }
1805
- static code = "BROWSER_OPERATION_FAILED";
1721
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
1806
1722
  static statusCode = 500;
1807
- static description = `Browser operation failed: {message}`;
1723
+ static description = `Internal error: {message}`;
1808
1724
  }
1809
- class WatchFilesFailedError extends Error {
1725
+ class CloudstateDatabaseErrorError extends Error {
1810
1726
  constructor(body) {
1811
1727
  super(
1812
- `WATCH_FILES_FAILED: ${body.message}`
1728
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
1813
1729
  );
1814
1730
  this.body = body;
1815
- this.name = "WatchFilesFailedError";
1731
+ this.name = "CloudstateDatabaseErrorError";
1816
1732
  }
1817
- static code = "WATCH_FILES_FAILED";
1733
+ static code = "CLOUDSTATE_DATABASE_ERROR";
1818
1734
  static statusCode = 500;
1819
- static description = `Failed to watch files: {message}`;
1735
+ static description = `Database operation failed: {message}`;
1820
1736
  }
1821
- class LogsFailedError extends Error {
1737
+ class CloudstateAccessDeniedError extends Error {
1822
1738
  constructor(body) {
1823
1739
  super(
1824
- `LOGS_FAILED: ${body.message}`
1740
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
1825
1741
  );
1826
1742
  this.body = body;
1827
- this.name = "LogsFailedError";
1743
+ this.name = "CloudstateAccessDeniedError";
1828
1744
  }
1829
- static code = "LOGS_FAILED";
1830
- static statusCode = 500;
1831
- static description = `Failed to get logs: {message}`;
1745
+ static code = "CLOUDSTATE_ACCESS_DENIED";
1746
+ static statusCode = 403;
1747
+ static description = `Access denied to project: {project_id}`;
1832
1748
  }
1833
- class StatusFailedError extends Error {
1749
+ class RestoreFailedError extends Error {
1834
1750
  constructor(body) {
1835
1751
  super(
1836
- `STATUS_FAILED: ${body.message}`
1752
+ `RESTORE_FAILED: ${body.message}`
1837
1753
  );
1838
1754
  this.body = body;
1839
- this.name = "StatusFailedError";
1755
+ this.name = "RestoreFailedError";
1840
1756
  }
1841
- static code = "STATUS_FAILED";
1757
+ static code = "RESTORE_FAILED";
1842
1758
  static statusCode = 500;
1843
- static description = `Failed to get dev server status: {message}`;
1759
+ static description = `Failed to restore from backup: {message}`;
1844
1760
  }
1845
- class RestartFailedError extends Error {
1761
+ class CreateBackupFailedError extends Error {
1846
1762
  constructor(body) {
1847
1763
  super(
1848
- `RESTART_FAILED: ${body.message}`
1764
+ `CREATE_BACKUP_FAILED: ${body.message}`
1849
1765
  );
1850
1766
  this.body = body;
1851
- this.name = "RestartFailedError";
1767
+ this.name = "CreateBackupFailedError";
1852
1768
  }
1853
- static code = "RESTART_FAILED";
1769
+ static code = "CREATE_BACKUP_FAILED";
1854
1770
  static statusCode = 500;
1855
- static description = `Failed to restart dev server: {message}`;
1771
+ static description = `Failed to create backup: {message}`;
1856
1772
  }
1857
- class ShutdownFailedError extends Error {
1773
+ class BackupFailedError extends Error {
1858
1774
  constructor(body) {
1859
1775
  super(
1860
- `SHUTDOWN_FAILED: ${body.message}`
1776
+ `BACKUP_FAILED: ${body.message}`
1861
1777
  );
1862
1778
  this.body = body;
1863
- this.name = "ShutdownFailedError";
1779
+ this.name = "BackupFailedError";
1864
1780
  }
1865
- static code = "SHUTDOWN_FAILED";
1781
+ static code = "BACKUP_FAILED";
1866
1782
  static statusCode = 500;
1867
- static description = `Failed to shutdown dev server: {message}`;
1783
+ static description = `Backup failed: {message}`;
1868
1784
  }
1869
- class CommitFailedError extends Error {
1785
+ class DeploymentFailedError extends Error {
1870
1786
  constructor(body) {
1871
1787
  super(
1872
- `COMMIT_FAILED: ${body.message}`
1788
+ `DEPLOYMENT_FAILED: ${body.message}`
1873
1789
  );
1874
1790
  this.body = body;
1875
- this.name = "CommitFailedError";
1791
+ this.name = "DeploymentFailedError";
1876
1792
  }
1877
- static code = "COMMIT_FAILED";
1793
+ static code = "DEPLOYMENT_FAILED";
1878
1794
  static statusCode = 500;
1879
- static description = `Failed to commit changes: {message}`;
1795
+ static description = `Deployment failed: {message}`;
1880
1796
  }
1881
- class WriteFileFailedError extends Error {
1797
+ class InvalidDeploymentRequestError extends Error {
1882
1798
  constructor(body) {
1883
1799
  super(
1884
- `WRITE_FILE_FAILED: ${body.message}`
1800
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
1885
1801
  );
1886
1802
  this.body = body;
1887
- this.name = "WriteFileFailedError";
1803
+ this.name = "InvalidDeploymentRequestError";
1888
1804
  }
1889
- static code = "WRITE_FILE_FAILED";
1890
- static statusCode = 500;
1891
- static description = `Failed to write file: {message}`;
1805
+ static code = "INVALID_DEPLOYMENT_REQUEST";
1806
+ static statusCode = 400;
1807
+ static description = `Invalid deployment request: {message}`;
1892
1808
  }
1893
- class ReadFileFailedError extends Error {
1809
+ class ProjectNotFoundError extends Error {
1894
1810
  constructor(body) {
1895
1811
  super(
1896
- `READ_FILE_FAILED: ${body.message}`
1812
+ `PROJECT_NOT_FOUND: ${body.message}`
1897
1813
  );
1898
1814
  this.body = body;
1899
- this.name = "ReadFileFailedError";
1815
+ this.name = "ProjectNotFoundError";
1900
1816
  }
1901
- static code = "READ_FILE_FAILED";
1902
- static statusCode = 500;
1903
- static description = `Failed to read file: {message}`;
1817
+ static code = "PROJECT_NOT_FOUND";
1818
+ static statusCode = 404;
1819
+ static description = `Project not found: {project_id}`;
1904
1820
  }
1905
- class ExecutionFailedError extends Error {
1821
+ class PermissionAlreadyExistsError extends Error {
1906
1822
  constructor(body) {
1907
1823
  super(
1908
- `EXECUTION_FAILED: ${body.message}`
1824
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
1909
1825
  );
1910
1826
  this.body = body;
1911
- this.name = "ExecutionFailedError";
1827
+ this.name = "PermissionAlreadyExistsError";
1912
1828
  }
1913
- static code = "EXECUTION_FAILED";
1914
- static statusCode = 500;
1915
- static description = `Failed to execute command: {message}`;
1829
+ static code = "PERMISSION_ALREADY_EXISTS";
1830
+ static statusCode = 409;
1831
+ static description = `Permission already exists`;
1916
1832
  }
1917
- class RequestFailedError extends Error {
1833
+ class ListTokensFailedError extends Error {
1918
1834
  constructor(body) {
1919
1835
  super(
1920
- `REQUEST_FAILED: ${body.message}`
1836
+ `LIST_TOKENS_FAILED: ${body.message}`
1921
1837
  );
1922
1838
  this.body = body;
1923
- this.name = "RequestFailedError";
1839
+ this.name = "ListTokensFailedError";
1924
1840
  }
1925
- static code = "REQUEST_FAILED";
1841
+ static code = "LIST_TOKENS_FAILED";
1926
1842
  static statusCode = 500;
1927
- static description = `Failed to request dev server: {message}`;
1843
+ static description = `Failed to list tokens: {message}`;
1928
1844
  }
1929
- class DevServerFileNotFoundError extends Error {
1845
+ class RevokeTokenFailedError extends Error {
1930
1846
  constructor(body) {
1931
1847
  super(
1932
- `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
1848
+ `REVOKE_TOKEN_FAILED: ${body.message}`
1933
1849
  );
1934
1850
  this.body = body;
1935
- this.name = "DevServerFileNotFoundError";
1851
+ this.name = "RevokeTokenFailedError";
1936
1852
  }
1937
- static code = "DEV_SERVER_FILE_NOT_FOUND";
1938
- static statusCode = 404;
1939
- static description = `Dev server file not found: {path}`;
1853
+ static code = "REVOKE_TOKEN_FAILED";
1854
+ static statusCode = 500;
1855
+ static description = `Failed to revoke token: {message}`;
1940
1856
  }
1941
- class DevServerInvalidRequestError extends Error {
1857
+ class CreateTokenFailedError extends Error {
1942
1858
  constructor(body) {
1943
1859
  super(
1944
- `DEV_SERVER_INVALID_REQUEST: ${body.message}`
1860
+ `CREATE_TOKEN_FAILED: ${body.message}`
1945
1861
  );
1946
1862
  this.body = body;
1947
- this.name = "DevServerInvalidRequestError";
1863
+ this.name = "CreateTokenFailedError";
1948
1864
  }
1949
- static code = "DEV_SERVER_INVALID_REQUEST";
1950
- static statusCode = 400;
1951
- static description = `Invalid dev server request: {message}`;
1865
+ static code = "CREATE_TOKEN_FAILED";
1866
+ static statusCode = 500;
1867
+ static description = `Failed to create token: {message}`;
1952
1868
  }
1953
- class DevServerNotFoundError extends Error {
1869
+ class ListPermissionsFailedError extends Error {
1954
1870
  constructor(body) {
1955
1871
  super(
1956
- `DEV_SERVER_NOT_FOUND: ${body.message}`
1872
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
1957
1873
  );
1958
1874
  this.body = body;
1959
- this.name = "DevServerNotFoundError";
1875
+ this.name = "ListPermissionsFailedError";
1960
1876
  }
1961
- static code = "DEV_SERVER_NOT_FOUND";
1962
- static statusCode = 404;
1963
- static description = `Dev server not found: {server_id}`;
1877
+ static code = "LIST_PERMISSIONS_FAILED";
1878
+ static statusCode = 500;
1879
+ static description = `Failed to list permissions: {message}`;
1964
1880
  }
1965
- class BuildFailedError extends Error {
1881
+ class GetPermissionFailedError extends Error {
1966
1882
  constructor(body) {
1967
1883
  super(
1968
- `BUILD_FAILED: ${body.message}`
1884
+ `GET_PERMISSION_FAILED: ${body.message}`
1969
1885
  );
1970
1886
  this.body = body;
1971
- this.name = "BuildFailedError";
1887
+ this.name = "GetPermissionFailedError";
1972
1888
  }
1973
- static code = "BUILD_FAILED";
1889
+ static code = "GET_PERMISSION_FAILED";
1974
1890
  static statusCode = 500;
1975
- static description = `Build failed on VM {vm_id}`;
1891
+ static description = `Failed to get permission: {message}`;
1976
1892
  }
1977
- class ServerDeploymentFailedError extends Error {
1893
+ class UpdatePermissionFailedError extends Error {
1978
1894
  constructor(body) {
1979
1895
  super(
1980
- `SERVER_DEPLOYMENT_FAILED: ${body.message}`
1896
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
1981
1897
  );
1982
1898
  this.body = body;
1983
- this.name = "ServerDeploymentFailedError";
1899
+ this.name = "UpdatePermissionFailedError";
1984
1900
  }
1985
- static code = "SERVER_DEPLOYMENT_FAILED";
1986
- static statusCode = 502;
1987
- static description = `Failed to deploy to servers`;
1901
+ static code = "UPDATE_PERMISSION_FAILED";
1902
+ static statusCode = 500;
1903
+ static description = `Failed to update permission: {message}`;
1988
1904
  }
1989
- class LockfileErrorError extends Error {
1905
+ class RevokePermissionFailedError extends Error {
1990
1906
  constructor(body) {
1991
1907
  super(
1992
- `LOCKFILE_ERROR: ${body.message}`
1908
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
1993
1909
  );
1994
1910
  this.body = body;
1995
- this.name = "LockfileErrorError";
1911
+ this.name = "RevokePermissionFailedError";
1996
1912
  }
1997
- static code = "LOCKFILE_ERROR";
1913
+ static code = "REVOKE_PERMISSION_FAILED";
1998
1914
  static statusCode = 500;
1999
- static description = `Failed to generate dependency lockfile: {message}`;
1915
+ static description = `Failed to revoke permission: {message}`;
2000
1916
  }
2001
- class UploadErrorError extends Error {
1917
+ class GrantPermissionFailedError extends Error {
2002
1918
  constructor(body) {
2003
1919
  super(
2004
- `UPLOAD_ERROR: ${body.message}`
1920
+ `GRANT_PERMISSION_FAILED: ${body.message}`
2005
1921
  );
2006
1922
  this.body = body;
2007
- this.name = "UploadErrorError";
1923
+ this.name = "GrantPermissionFailedError";
2008
1924
  }
2009
- static code = "UPLOAD_ERROR";
1925
+ static code = "GRANT_PERMISSION_FAILED";
2010
1926
  static statusCode = 500;
2011
- static description = `Failed to upload deployment to storage`;
1927
+ static description = `Failed to grant permission: {message}`;
2012
1928
  }
2013
- class DomainMappingErrorError extends Error {
1929
+ class ListIdentitiesFailedError extends Error {
2014
1930
  constructor(body) {
2015
1931
  super(
2016
- `DOMAIN_MAPPING_ERROR: ${body.message}`
1932
+ `LIST_IDENTITIES_FAILED: ${body.message}`
2017
1933
  );
2018
1934
  this.body = body;
2019
- this.name = "DomainMappingErrorError";
1935
+ this.name = "ListIdentitiesFailedError";
2020
1936
  }
2021
- static code = "DOMAIN_MAPPING_ERROR";
1937
+ static code = "LIST_IDENTITIES_FAILED";
2022
1938
  static statusCode = 500;
2023
- static description = `Failed to configure domain mapping for: {domain}`;
1939
+ static description = `Failed to list identities: {message}`;
2024
1940
  }
2025
- class CertificateProvisioningErrorError extends Error {
1941
+ class DeleteIdentityFailedError extends Error {
2026
1942
  constructor(body) {
2027
1943
  super(
2028
- `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
1944
+ `DELETE_IDENTITY_FAILED: ${body.message}`
2029
1945
  );
2030
1946
  this.body = body;
2031
- this.name = "CertificateProvisioningErrorError";
1947
+ this.name = "DeleteIdentityFailedError";
2032
1948
  }
2033
- static code = "CERTIFICATE_PROVISIONING_ERROR";
2034
- static statusCode = 502;
2035
- static description = `Failed to provision certificate for domain: {domain}`;
1949
+ static code = "DELETE_IDENTITY_FAILED";
1950
+ static statusCode = 500;
1951
+ static description = `Failed to delete identity: {message}`;
2036
1952
  }
2037
- class NoEntrypointFoundError extends Error {
1953
+ class CreateIdentityFailedError extends Error {
2038
1954
  constructor(body) {
2039
1955
  super(
2040
- `NO_ENTRYPOINT_FOUND: ${body.message}`
1956
+ `CREATE_IDENTITY_FAILED: ${body.message}`
2041
1957
  );
2042
1958
  this.body = body;
2043
- this.name = "NoEntrypointFoundError";
1959
+ this.name = "CreateIdentityFailedError";
2044
1960
  }
2045
- static code = "NO_ENTRYPOINT_FOUND";
2046
- static statusCode = 400;
2047
- static description = `No entrypoint found in deployment`;
1961
+ static code = "CREATE_IDENTITY_FAILED";
1962
+ static statusCode = 500;
1963
+ static description = `Failed to create identity: {message}`;
2048
1964
  }
2049
- class EntrypointNotFoundError extends Error {
1965
+ class VmPermissionNotFoundError extends Error {
2050
1966
  constructor(body) {
2051
1967
  super(
2052
- `ENTRYPOINT_NOT_FOUND: ${body.message}`
1968
+ `VM_PERMISSION_NOT_FOUND: ${body.message}`
2053
1969
  );
2054
1970
  this.body = body;
2055
- this.name = "EntrypointNotFoundError";
1971
+ this.name = "VmPermissionNotFoundError";
2056
1972
  }
2057
- static code = "ENTRYPOINT_NOT_FOUND";
2058
- static statusCode = 400;
2059
- static description = `Entrypoint not found: {entrypoint}`;
1973
+ static code = "VM_PERMISSION_NOT_FOUND";
1974
+ static statusCode = 404;
1975
+ static description = `VM permission not found`;
2060
1976
  }
2061
- class NoDomainOwnershipError extends Error {
1977
+ class PermissionNotFoundError extends Error {
2062
1978
  constructor(body) {
2063
1979
  super(
2064
- `NO_DOMAIN_OWNERSHIP: ${body.message}`
1980
+ `PERMISSION_NOT_FOUND: ${body.message}`
2065
1981
  );
2066
1982
  this.body = body;
2067
- this.name = "NoDomainOwnershipError";
1983
+ this.name = "PermissionNotFoundError";
2068
1984
  }
2069
- static code = "NO_DOMAIN_OWNERSHIP";
2070
- static statusCode = 403;
2071
- static description = `No domain ownership for: {domain}`;
1985
+ static code = "PERMISSION_NOT_FOUND";
1986
+ static statusCode = 404;
1987
+ static description = `Permission not found`;
2072
1988
  }
2073
- class InvalidDomainsError extends Error {
1989
+ class VmAccessDeniedError extends Error {
2074
1990
  constructor(body) {
2075
1991
  super(
2076
- `INVALID_DOMAINS: ${body.message}`
1992
+ `VM_ACCESS_DENIED: ${body.message}`
2077
1993
  );
2078
1994
  this.body = body;
2079
- this.name = "InvalidDomainsError";
1995
+ this.name = "VmAccessDeniedError";
2080
1996
  }
2081
- static code = "INVALID_DOMAINS";
2082
- static statusCode = 400;
2083
- static description = `Invalid domains provided`;
1997
+ static code = "VM_ACCESS_DENIED";
1998
+ static statusCode = 403;
1999
+ static description = `You are not allowed to access this VM`;
2084
2000
  }
2085
- class WebDeploymentBadRequestError extends Error {
2001
+ class GitRepositoryAccessDeniedError extends Error {
2086
2002
  constructor(body) {
2087
2003
  super(
2088
- `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2004
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2089
2005
  );
2090
2006
  this.body = body;
2091
- this.name = "WebDeploymentBadRequestError";
2007
+ this.name = "GitRepositoryAccessDeniedError";
2092
2008
  }
2093
- static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2094
- static statusCode = 400;
2095
- static description = `Bad request: {message}`;
2009
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
2010
+ static statusCode = 403;
2011
+ static description = `You are not allowed to access this repository`;
2096
2012
  }
2097
- class DeploymentNotFoundError extends Error {
2013
+ class GitRepositoryNotFoundError extends Error {
2098
2014
  constructor(body) {
2099
2015
  super(
2100
- `DEPLOYMENT_NOT_FOUND: ${body.message}`
2016
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
2101
2017
  );
2102
2018
  this.body = body;
2103
- this.name = "DeploymentNotFoundError";
2019
+ this.name = "GitRepositoryNotFoundError";
2104
2020
  }
2105
- static code = "DEPLOYMENT_NOT_FOUND";
2021
+ static code = "GIT_REPOSITORY_NOT_FOUND";
2106
2022
  static statusCode = 404;
2107
- static description = `Deployment not found`;
2023
+ static description = `Repository not found`;
2108
2024
  }
2109
- class DatabaseErrorError extends Error {
2025
+ class CannotDeleteManagedIdentityError extends Error {
2110
2026
  constructor(body) {
2111
2027
  super(
2112
- `DATABASE_ERROR: ${body.message}`
2028
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
2113
2029
  );
2114
2030
  this.body = body;
2115
- this.name = "DatabaseErrorError";
2031
+ this.name = "CannotDeleteManagedIdentityError";
2116
2032
  }
2117
- static code = "DATABASE_ERROR";
2118
- static statusCode = 500;
2119
- static description = `Database operation failed: {message}`;
2033
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2034
+ static statusCode = 403;
2035
+ static description = `Cannot delete managed identities`;
2120
2036
  }
2121
- class TriggerErrorError extends Error {
2037
+ class CannotModifyManagedIdentityError extends Error {
2122
2038
  constructor(body) {
2123
2039
  super(
2124
- `TRIGGER_ERROR: ${body.message}`
2040
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
2125
2041
  );
2126
2042
  this.body = body;
2127
- this.name = "TriggerErrorError";
2043
+ this.name = "CannotModifyManagedIdentityError";
2128
2044
  }
2129
- static code = "TRIGGER_ERROR";
2130
- static statusCode = 500;
2131
- static description = `Failed to manage triggers: {message}`;
2045
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2046
+ static statusCode = 403;
2047
+ static description = `Cannot modify managed identities`;
2048
+ }
2049
+ class IdentityAccessDeniedError extends Error {
2050
+ constructor(body) {
2051
+ super(
2052
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
2053
+ );
2054
+ this.body = body;
2055
+ this.name = "IdentityAccessDeniedError";
2056
+ }
2057
+ static code = "IDENTITY_ACCESS_DENIED";
2058
+ static statusCode = 403;
2059
+ static description = `You are not allowed to access this identity`;
2060
+ }
2061
+ class IdentityNotFoundError extends Error {
2062
+ constructor(body) {
2063
+ super(
2064
+ `IDENTITY_NOT_FOUND: ${body.message}`
2065
+ );
2066
+ this.body = body;
2067
+ this.name = "IdentityNotFoundError";
2068
+ }
2069
+ static code = "IDENTITY_NOT_FOUND";
2070
+ static statusCode = 404;
2071
+ static description = `Identity not found`;
2072
+ }
2073
+ class UnauthorizedErrorError extends Error {
2074
+ constructor(body) {
2075
+ super(
2076
+ `UNAUTHORIZED_ERROR: ${body.message}`
2077
+ );
2078
+ this.body = body;
2079
+ this.name = "UnauthorizedErrorError";
2080
+ }
2081
+ static code = "UNAUTHORIZED_ERROR";
2082
+ static statusCode = 401;
2083
+ static description = `Unauthorized request to {route}`;
2084
+ }
2085
+ class ObservabilityDatabaseErrorError extends Error {
2086
+ constructor(body) {
2087
+ super(
2088
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2089
+ );
2090
+ this.body = body;
2091
+ this.name = "ObservabilityDatabaseErrorError";
2092
+ }
2093
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2094
+ static statusCode = 500;
2095
+ static description = `Database operation failed: {message}`;
2096
+ }
2097
+ class ObservabilityAccessDeniedError extends Error {
2098
+ constructor(body) {
2099
+ super(
2100
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2101
+ );
2102
+ this.body = body;
2103
+ this.name = "ObservabilityAccessDeniedError";
2104
+ }
2105
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2106
+ static statusCode = 403;
2107
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2108
+ }
2109
+ class ParseLogsFailedError extends Error {
2110
+ constructor(body) {
2111
+ super(
2112
+ `PARSE_LOGS_FAILED: ${body.message}`
2113
+ );
2114
+ this.body = body;
2115
+ this.name = "ParseLogsFailedError";
2116
+ }
2117
+ static code = "PARSE_LOGS_FAILED";
2118
+ static statusCode = 500;
2119
+ static description = `Failed to parse logs: {message}`;
2120
+ }
2121
+ class RetrieveLogsFailedError extends Error {
2122
+ constructor(body) {
2123
+ super(
2124
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2125
+ );
2126
+ this.body = body;
2127
+ this.name = "RetrieveLogsFailedError";
2128
+ }
2129
+ static code = "RETRIEVE_LOGS_FAILED";
2130
+ static statusCode = 500;
2131
+ static description = `Failed to retrieve logs: {message}`;
2132
+ }
2133
+ class InvalidQueryError extends Error {
2134
+ constructor(body) {
2135
+ super(
2136
+ `INVALID_QUERY: ${body.message}`
2137
+ );
2138
+ this.body = body;
2139
+ this.name = "InvalidQueryError";
2140
+ }
2141
+ static code = "INVALID_QUERY";
2142
+ static statusCode = 400;
2143
+ static description = `Invalid log query: {message}`;
2144
+ }
2145
+ class LogsNotFoundError extends Error {
2146
+ constructor(body) {
2147
+ super(
2148
+ `LOGS_NOT_FOUND: ${body.message}`
2149
+ );
2150
+ this.body = body;
2151
+ this.name = "LogsNotFoundError";
2152
+ }
2153
+ static code = "LOGS_NOT_FOUND";
2154
+ static statusCode = 404;
2155
+ static description = `Logs not found for deployment: {deployment_id}`;
2156
+ }
2157
+ class TriggerErrorError extends Error {
2158
+ constructor(body) {
2159
+ super(
2160
+ `TRIGGER_ERROR: ${body.message}`
2161
+ );
2162
+ this.body = body;
2163
+ this.name = "TriggerErrorError";
2164
+ }
2165
+ static code = "TRIGGER_ERROR";
2166
+ static statusCode = 500;
2167
+ static description = `Failed to manage triggers: {message}`;
2132
2168
  }
2133
2169
  class TokenErrorError extends Error {
2134
2170
  constructor(body) {
@@ -2346,215 +2382,360 @@ class RepositoryNotFoundError extends Error {
2346
2382
  static statusCode = 404;
2347
2383
  static description = `Repository not found: {repo_id}`;
2348
2384
  }
2349
- class DomainAlreadyExistsError extends Error {
2350
- constructor(body) {
2351
- super(
2352
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2353
- );
2354
- this.body = body;
2355
- this.name = "DomainAlreadyExistsError";
2356
- }
2357
- static code = "DOMAIN_ALREADY_EXISTS";
2358
- static statusCode = 400;
2359
- static description = `Domain already exists: {domain}`;
2360
- }
2361
- class FailedToInsertOwnershipError extends Error {
2385
+ class FailedToProvisionCertificateError extends Error {
2362
2386
  constructor(body) {
2363
2387
  super(
2364
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2388
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2365
2389
  );
2366
2390
  this.body = body;
2367
- this.name = "FailedToInsertOwnershipError";
2391
+ this.name = "FailedToProvisionCertificateError";
2368
2392
  }
2369
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2370
- static statusCode = 500;
2371
- static description = `Failed to insert domain ownership: {message}`;
2393
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
2394
+ static statusCode = 422;
2395
+ static description = `Failed to provision certificate: {message}`;
2372
2396
  }
2373
- class FailedRemoveDomainMappingError extends Error {
2397
+ class FailedToInsertDomainMappingError extends Error {
2374
2398
  constructor(body) {
2375
2399
  super(
2376
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2400
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2377
2401
  );
2378
2402
  this.body = body;
2379
- this.name = "FailedRemoveDomainMappingError";
2403
+ this.name = "FailedToInsertDomainMappingError";
2380
2404
  }
2381
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2405
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2382
2406
  static statusCode = 500;
2383
- static description = `Failed to remove domain mapping: {message}`;
2407
+ static description = `Failed to insert domain mapping: {message}`;
2384
2408
  }
2385
- class FailedPermissionsCheckError extends Error {
2409
+ class PermissionDeniedError extends Error {
2386
2410
  constructor(body) {
2387
2411
  super(
2388
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2412
+ `PERMISSION_DENIED: ${body.message}`
2389
2413
  );
2390
2414
  this.body = body;
2391
- this.name = "FailedPermissionsCheckError";
2415
+ this.name = "PermissionDeniedError";
2392
2416
  }
2393
- static code = "FAILED_PERMISSIONS_CHECK";
2417
+ static code = "PERMISSION_DENIED";
2394
2418
  static statusCode = 401;
2395
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2419
+ static description = `Permission denied: {message}`;
2396
2420
  }
2397
- class FailedToCheckDomainMappingPermissionsError extends Error {
2421
+ class FailedToCheckPermissionsError extends Error {
2398
2422
  constructor(body) {
2399
2423
  super(
2400
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2424
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2401
2425
  );
2402
2426
  this.body = body;
2403
- this.name = "FailedToCheckDomainMappingPermissionsError";
2427
+ this.name = "FailedToCheckPermissionsError";
2404
2428
  }
2405
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2429
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
2406
2430
  static statusCode = 502;
2407
2431
  static description = `Failed to check permissions: {message}`;
2408
2432
  }
2409
- class CloudstateInternalErrorError extends Error {
2433
+ class FailedToListDomainsError extends Error {
2410
2434
  constructor(body) {
2411
2435
  super(
2412
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2436
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
2413
2437
  );
2414
2438
  this.body = body;
2415
- this.name = "CloudstateInternalErrorError";
2439
+ this.name = "FailedToListDomainsError";
2416
2440
  }
2417
- static code = "CLOUDSTATE_INTERNAL_ERROR";
2441
+ static code = "FAILED_TO_LIST_DOMAINS";
2418
2442
  static statusCode = 500;
2419
- static description = `Internal error: {message}`;
2443
+ static description = `Failed to list domains: {message}`;
2420
2444
  }
2421
- class CloudstateDatabaseErrorError extends Error {
2445
+ class FailedToListVerificationsError extends Error {
2422
2446
  constructor(body) {
2423
2447
  super(
2424
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2448
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2425
2449
  );
2426
2450
  this.body = body;
2427
- this.name = "CloudstateDatabaseErrorError";
2451
+ this.name = "FailedToListVerificationsError";
2428
2452
  }
2429
- static code = "CLOUDSTATE_DATABASE_ERROR";
2453
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
2430
2454
  static statusCode = 500;
2431
- static description = `Database operation failed: {message}`;
2455
+ static description = `Failed to list verifications: {message}`;
2432
2456
  }
2433
- class CloudstateAccessDeniedError extends Error {
2457
+ class FailedToVerifyDomainError extends Error {
2434
2458
  constructor(body) {
2435
2459
  super(
2436
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2460
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2437
2461
  );
2438
2462
  this.body = body;
2439
- this.name = "CloudstateAccessDeniedError";
2463
+ this.name = "FailedToVerifyDomainError";
2440
2464
  }
2441
- static code = "CLOUDSTATE_ACCESS_DENIED";
2442
- static statusCode = 403;
2443
- static description = `Access denied to project: {project_id}`;
2465
+ static code = "FAILED_TO_VERIFY_DOMAIN";
2466
+ static statusCode = 500;
2467
+ static description = `Failed to verify domain: {message}`;
2444
2468
  }
2445
- class RestoreFailedError extends Error {
2469
+ class VerificationFailedError extends Error {
2446
2470
  constructor(body) {
2447
2471
  super(
2448
- `RESTORE_FAILED: ${body.message}`
2472
+ `VERIFICATION_FAILED: ${body.message}`
2449
2473
  );
2450
2474
  this.body = body;
2451
- this.name = "RestoreFailedError";
2475
+ this.name = "VerificationFailedError";
2452
2476
  }
2453
- static code = "RESTORE_FAILED";
2454
- static statusCode = 500;
2455
- static description = `Failed to restore from backup: {message}`;
2477
+ static code = "VERIFICATION_FAILED";
2478
+ static statusCode = 400;
2479
+ static description = `Domain verification failed: {message}`;
2456
2480
  }
2457
- class CreateBackupFailedError extends Error {
2481
+ class FailedToDeleteVerificationError extends Error {
2458
2482
  constructor(body) {
2459
2483
  super(
2460
- `CREATE_BACKUP_FAILED: ${body.message}`
2484
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2461
2485
  );
2462
2486
  this.body = body;
2463
- this.name = "CreateBackupFailedError";
2487
+ this.name = "FailedToDeleteVerificationError";
2464
2488
  }
2465
- static code = "CREATE_BACKUP_FAILED";
2466
- static statusCode = 500;
2467
- static description = `Failed to create backup: {message}`;
2489
+ static code = "FAILED_TO_DELETE_VERIFICATION";
2490
+ static statusCode = 400;
2491
+ static description = `Failed to delete verification: {message}`;
2468
2492
  }
2469
- class BackupFailedError extends Error {
2493
+ class VerificationNotFoundError extends Error {
2470
2494
  constructor(body) {
2471
2495
  super(
2472
- `BACKUP_FAILED: ${body.message}`
2496
+ `VERIFICATION_NOT_FOUND: ${body.message}`
2473
2497
  );
2474
2498
  this.body = body;
2475
- this.name = "BackupFailedError";
2499
+ this.name = "VerificationNotFoundError";
2476
2500
  }
2477
- static code = "BACKUP_FAILED";
2478
- static statusCode = 500;
2479
- static description = `Backup failed: {message}`;
2501
+ static code = "VERIFICATION_NOT_FOUND";
2502
+ static statusCode = 404;
2503
+ static description = `Verification request not found for domain: {domain}`;
2480
2504
  }
2481
- class DeploymentFailedError extends Error {
2505
+ class FailedToCreateVerificationCodeError extends Error {
2482
2506
  constructor(body) {
2483
2507
  super(
2484
- `DEPLOYMENT_FAILED: ${body.message}`
2508
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2485
2509
  );
2486
2510
  this.body = body;
2487
- this.name = "DeploymentFailedError";
2511
+ this.name = "FailedToCreateVerificationCodeError";
2488
2512
  }
2489
- static code = "DEPLOYMENT_FAILED";
2490
- static statusCode = 500;
2491
- static description = `Deployment failed: {message}`;
2513
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2514
+ static statusCode = 400;
2515
+ static description = `Failed to create verification code: {message}`;
2492
2516
  }
2493
- class InvalidDeploymentRequestError extends Error {
2517
+ class InvalidDomainError extends Error {
2494
2518
  constructor(body) {
2495
2519
  super(
2496
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2520
+ `INVALID_DOMAIN: ${body.message}`
2497
2521
  );
2498
2522
  this.body = body;
2499
- this.name = "InvalidDeploymentRequestError";
2523
+ this.name = "InvalidDomainError";
2500
2524
  }
2501
- static code = "INVALID_DEPLOYMENT_REQUEST";
2525
+ static code = "INVALID_DOMAIN";
2502
2526
  static statusCode = 400;
2503
- static description = `Invalid deployment request: {message}`;
2527
+ static description = `Invalid domain: {domain}`;
2504
2528
  }
2505
- class ProjectNotFoundError extends Error {
2529
+ class BuildFailedError extends Error {
2506
2530
  constructor(body) {
2507
2531
  super(
2508
- `PROJECT_NOT_FOUND: ${body.message}`
2532
+ `BUILD_FAILED: ${body.message}`
2509
2533
  );
2510
2534
  this.body = body;
2511
- this.name = "ProjectNotFoundError";
2535
+ this.name = "BuildFailedError";
2512
2536
  }
2513
- static code = "PROJECT_NOT_FOUND";
2537
+ static code = "BUILD_FAILED";
2538
+ static statusCode = 500;
2539
+ static description = `Build failed on VM {vm_id}`;
2540
+ }
2541
+ class ServerDeploymentFailedError extends Error {
2542
+ constructor(body) {
2543
+ super(
2544
+ `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2545
+ );
2546
+ this.body = body;
2547
+ this.name = "ServerDeploymentFailedError";
2548
+ }
2549
+ static code = "SERVER_DEPLOYMENT_FAILED";
2550
+ static statusCode = 502;
2551
+ static description = `Failed to deploy to servers`;
2552
+ }
2553
+ class LockfileErrorError extends Error {
2554
+ constructor(body) {
2555
+ super(
2556
+ `LOCKFILE_ERROR: ${body.message}`
2557
+ );
2558
+ this.body = body;
2559
+ this.name = "LockfileErrorError";
2560
+ }
2561
+ static code = "LOCKFILE_ERROR";
2562
+ static statusCode = 500;
2563
+ static description = `Failed to generate dependency lockfile: {message}`;
2564
+ }
2565
+ class UploadErrorError extends Error {
2566
+ constructor(body) {
2567
+ super(
2568
+ `UPLOAD_ERROR: ${body.message}`
2569
+ );
2570
+ this.body = body;
2571
+ this.name = "UploadErrorError";
2572
+ }
2573
+ static code = "UPLOAD_ERROR";
2574
+ static statusCode = 500;
2575
+ static description = `Failed to upload deployment to storage`;
2576
+ }
2577
+ class DomainMappingErrorError extends Error {
2578
+ constructor(body) {
2579
+ super(
2580
+ `DOMAIN_MAPPING_ERROR: ${body.message}`
2581
+ );
2582
+ this.body = body;
2583
+ this.name = "DomainMappingErrorError";
2584
+ }
2585
+ static code = "DOMAIN_MAPPING_ERROR";
2586
+ static statusCode = 500;
2587
+ static description = `Failed to configure domain mapping for: {domain}`;
2588
+ }
2589
+ class CertificateProvisioningErrorError extends Error {
2590
+ constructor(body) {
2591
+ super(
2592
+ `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2593
+ );
2594
+ this.body = body;
2595
+ this.name = "CertificateProvisioningErrorError";
2596
+ }
2597
+ static code = "CERTIFICATE_PROVISIONING_ERROR";
2598
+ static statusCode = 502;
2599
+ static description = `Failed to provision certificate for domain: {domain}`;
2600
+ }
2601
+ class NoEntrypointFoundError extends Error {
2602
+ constructor(body) {
2603
+ super(
2604
+ `NO_ENTRYPOINT_FOUND: ${body.message}`
2605
+ );
2606
+ this.body = body;
2607
+ this.name = "NoEntrypointFoundError";
2608
+ }
2609
+ static code = "NO_ENTRYPOINT_FOUND";
2610
+ static statusCode = 400;
2611
+ static description = `No entrypoint found in deployment`;
2612
+ }
2613
+ class EntrypointNotFoundError extends Error {
2614
+ constructor(body) {
2615
+ super(
2616
+ `ENTRYPOINT_NOT_FOUND: ${body.message}`
2617
+ );
2618
+ this.body = body;
2619
+ this.name = "EntrypointNotFoundError";
2620
+ }
2621
+ static code = "ENTRYPOINT_NOT_FOUND";
2622
+ static statusCode = 400;
2623
+ static description = `Entrypoint not found: {entrypoint}`;
2624
+ }
2625
+ class NoDomainOwnershipError extends Error {
2626
+ constructor(body) {
2627
+ super(
2628
+ `NO_DOMAIN_OWNERSHIP: ${body.message}`
2629
+ );
2630
+ this.body = body;
2631
+ this.name = "NoDomainOwnershipError";
2632
+ }
2633
+ static code = "NO_DOMAIN_OWNERSHIP";
2634
+ static statusCode = 403;
2635
+ static description = `No domain ownership for: {domain}`;
2636
+ }
2637
+ class InvalidDomainsError extends Error {
2638
+ constructor(body) {
2639
+ super(
2640
+ `INVALID_DOMAINS: ${body.message}`
2641
+ );
2642
+ this.body = body;
2643
+ this.name = "InvalidDomainsError";
2644
+ }
2645
+ static code = "INVALID_DOMAINS";
2646
+ static statusCode = 400;
2647
+ static description = `Invalid domains provided`;
2648
+ }
2649
+ class WebDeploymentBadRequestError extends Error {
2650
+ constructor(body) {
2651
+ super(
2652
+ `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2653
+ );
2654
+ this.body = body;
2655
+ this.name = "WebDeploymentBadRequestError";
2656
+ }
2657
+ static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2658
+ static statusCode = 400;
2659
+ static description = `Bad request: {message}`;
2660
+ }
2661
+ class DeploymentNotFoundError extends Error {
2662
+ constructor(body) {
2663
+ super(
2664
+ `DEPLOYMENT_NOT_FOUND: ${body.message}`
2665
+ );
2666
+ this.body = body;
2667
+ this.name = "DeploymentNotFoundError";
2668
+ }
2669
+ static code = "DEPLOYMENT_NOT_FOUND";
2514
2670
  static statusCode = 404;
2515
- static description = `Project not found: {project_id}`;
2671
+ static description = `Deployment not found`;
2516
2672
  }
2517
- class UnauthorizedErrorError extends Error {
2673
+ class DomainAlreadyExistsError extends Error {
2518
2674
  constructor(body) {
2519
2675
  super(
2520
- `UNAUTHORIZED_ERROR: ${body.message}`
2676
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
2521
2677
  );
2522
2678
  this.body = body;
2523
- this.name = "UnauthorizedErrorError";
2679
+ this.name = "DomainAlreadyExistsError";
2524
2680
  }
2525
- static code = "UNAUTHORIZED_ERROR";
2526
- static statusCode = 401;
2527
- static description = `Unauthorized request to {route}`;
2681
+ static code = "DOMAIN_ALREADY_EXISTS";
2682
+ static statusCode = 400;
2683
+ static description = `Domain already exists: {domain}`;
2528
2684
  }
2529
- class AnyhowError extends Error {
2685
+ class FailedToInsertOwnershipError extends Error {
2530
2686
  constructor(body) {
2531
2687
  super(
2532
- `ANYHOW: ${body.message}`
2688
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2533
2689
  );
2534
2690
  this.body = body;
2535
- this.name = "AnyhowError";
2691
+ this.name = "FailedToInsertOwnershipError";
2536
2692
  }
2537
- static code = "ANYHOW";
2693
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
2694
+ static statusCode = 500;
2695
+ static description = `Failed to insert domain ownership: {message}`;
2696
+ }
2697
+ class FailedRemoveDomainMappingError extends Error {
2698
+ constructor(body) {
2699
+ super(
2700
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2701
+ );
2702
+ this.body = body;
2703
+ this.name = "FailedRemoveDomainMappingError";
2704
+ }
2705
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2538
2706
  static statusCode = 500;
2539
- static description = `null`;
2707
+ static description = `Failed to remove domain mapping: {message}`;
2708
+ }
2709
+ class FailedPermissionsCheckError extends Error {
2710
+ constructor(body) {
2711
+ super(
2712
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
2713
+ );
2714
+ this.body = body;
2715
+ this.name = "FailedPermissionsCheckError";
2716
+ }
2717
+ static code = "FAILED_PERMISSIONS_CHECK";
2718
+ static statusCode = 401;
2719
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
2720
+ }
2721
+ class FailedToCheckDomainMappingPermissionsError extends Error {
2722
+ constructor(body) {
2723
+ super(
2724
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2725
+ );
2726
+ this.body = body;
2727
+ this.name = "FailedToCheckDomainMappingPermissionsError";
2728
+ }
2729
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2730
+ static statusCode = 502;
2731
+ static description = `Failed to check permissions: {message}`;
2540
2732
  }
2541
2733
  const FREESTYLE_ERROR_CODE_MAP = {
2734
+ "GIT_ERROR": GitErrorError,
2735
+ "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
2542
2736
  "INTERNAL_ERROR": InternalErrorError,
2543
- "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,
2553
2737
  "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
2554
2738
  "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
2555
- "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
2556
- "FILE_NOT_FOUND": FileNotFoundError,
2557
- "FILES_BAD_REQUEST": FilesBadRequestError,
2558
2739
  "VM_DELETED": VmDeletedError,
2559
2740
  "REQWEST": ReqwestError,
2560
2741
  "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
@@ -2564,9 +2745,22 @@ const FREESTYLE_ERROR_CODE_MAP = {
2564
2745
  "STD_IO": StdIoError,
2565
2746
  "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
2566
2747
  "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
2748
+ "FILE_NOT_FOUND": FileNotFoundError,
2749
+ "FILES_BAD_REQUEST": FilesBadRequestError,
2750
+ "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2751
+ "ALREADY_HAS_BASE": AlreadyHasBaseError,
2752
+ "NOT_FOUND": NotFoundError,
2753
+ "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
2754
+ "VM_NOT_RUNNING": VmNotRunningError,
2755
+ "VM_NOT_FOUND": VmNotFoundError,
2756
+ "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
2757
+ "BAD_REQUEST": BadRequestError,
2758
+ "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
2759
+ "DOCKER_IMPORT_BAD_REQUEST": DockerImportBadRequestError,
2567
2760
  "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
2568
2761
  "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
2569
2762
  "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
2763
+ "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2570
2764
  "USER_NOT_FOUND": UserNotFoundError,
2571
2765
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
2572
2766
  "VALIDATION_ERROR": ValidationErrorError,
@@ -2583,7 +2777,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
2583
2777
  "GROUP_NAME_INVALID_CHARS": GroupNameInvalidCharsError,
2584
2778
  "GROUP_NAME_TOO_LONG": GroupNameTooLongError,
2585
2779
  "GROUP_NAME_EMPTY": GroupNameEmptyError,
2586
- "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2587
2780
  "WANTED_BY_EMPTY": WantedByEmptyError,
2588
2781
  "WORKDIR_EMPTY": WorkdirEmptyError,
2589
2782
  "GROUP_EMPTY": GroupEmptyError,
@@ -2600,42 +2793,95 @@ const FREESTYLE_ERROR_CODE_MAP = {
2600
2793
  "SERVICE_NAME_EMPTY": ServiceNameEmptyError,
2601
2794
  "SERVICE_ALREADY_EXISTS": ServiceAlreadyExistsError,
2602
2795
  "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,
2796
+ "INVALID_REQUEST": InvalidRequestError,
2797
+ "REPO_NOT_FOUND": RepoNotFoundError,
2610
2798
  "INTERNAL": InternalError,
2611
2799
  "SIGNING": SigningError,
2612
2800
  "INVALID_SIGNATURE": InvalidSignatureError,
2613
2801
  "INVALID_PARAMETERS": InvalidParametersError,
2614
2802
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
2615
2803
  "EXPIRED": ExpiredError,
2616
- "TAG_NOT_FOUND": TagNotFoundError,
2804
+ "CONFLICT": ConflictError,
2617
2805
  "BRANCH_NOT_FOUND": BranchNotFoundError,
2618
- "REPO_NOT_FOUND": RepoNotFoundError,
2619
- "INVALID_OBJECT_ID": InvalidObjectIdError,
2620
- "COMMIT_NOT_FOUND": CommitNotFoundError,
2621
- "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2622
- "PATH_NOT_FOUND": PathNotFoundError,
2623
- "INVALID_REQUEST": InvalidRequestError,
2624
- "INVALID_REVISION": InvalidRevisionError,
2806
+ "SEND_ERROR": SendErrorError,
2625
2807
  "FORBIDDEN": ForbiddenError,
2626
- "UNAUTHORIZED": UnauthorizedError,
2627
- "CONFLICT": ConflictError,
2628
2808
  "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2809
+ "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2810
+ "INVALID_RANGE": InvalidRangeError,
2811
+ "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
2812
+ "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
2813
+ "COMMIT_NOT_FOUND": CommitNotFoundError,
2629
2814
  "BLOB_NOT_FOUND": BlobNotFoundError,
2630
2815
  "TREE_NOT_FOUND": TreeNotFoundError,
2816
+ "INVALID_REVISION": InvalidRevisionError,
2817
+ "UNAUTHORIZED": UnauthorizedError,
2818
+ "TAG_NOT_FOUND": TagNotFoundError,
2819
+ "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
2820
+ "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
2821
+ "INVALID_OBJECT_ID": InvalidObjectIdError,
2822
+ "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
2823
+ "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
2824
+ "SOURCE_NOT_FOUND": SourceNotFoundError,
2825
+ "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
2826
+ "PACKFILE": PackfileError,
2827
+ "PATH_NOT_FOUND": PathNotFoundError,
2828
+ "INVALID_SERVICE": InvalidServiceError,
2829
+ "EXPECTED_SERVICE": ExpectedServiceError,
2830
+ "DATABASE_ERROR": DatabaseErrorError,
2831
+ "WAIT_TIMEOUT": WaitTimeoutError,
2832
+ "PRE_VERIFY_CHALLENGE_MISMATCH": PreVerifyChallengeMismatchError,
2833
+ "PRE_VERIFY_FAILED_PARSE": PreVerifyFailedParseError,
2834
+ "PRE_VERIFY_FAILED_FETCH": PreVerifyFailedFetchError,
2835
+ "PRE_VERIFY_ROUTE_NOT_FOUND": PreVerifyRouteNotFoundError,
2836
+ "AUTHORIZATION_NOT_FOUND": AuthorizationNotFoundError,
2837
+ "ORDER_NOT_FOUND": OrderNotFoundError,
2631
2838
  "RESIZE_FAILED": ResizeFailedError,
2632
2839
  "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,
2840
+ "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
2841
+ "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
2842
+ "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
2843
+ "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
2844
+ "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
2845
+ "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
2846
+ "WATCH_FILES_FAILED": WatchFilesFailedError,
2847
+ "LOGS_FAILED": LogsFailedError,
2848
+ "STATUS_FAILED": StatusFailedError,
2849
+ "RESTART_FAILED": RestartFailedError,
2850
+ "SHUTDOWN_FAILED": ShutdownFailedError,
2851
+ "COMMIT_FAILED": CommitFailedError,
2852
+ "WRITE_FILE_FAILED": WriteFileFailedError,
2853
+ "READ_FILE_FAILED": ReadFileFailedError,
2854
+ "EXECUTION_FAILED": ExecutionFailedError,
2855
+ "REQUEST_FAILED": RequestFailedError,
2856
+ "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
2857
+ "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
2858
+ "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
2859
+ "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
2860
+ "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
2861
+ "LIST_RUNS_FAILED": ListRunsFailedError,
2862
+ "EXECUTION_ERROR": ExecutionErrorError,
2863
+ "CONNECTION_FAILED": ConnectionFailedError,
2864
+ "METADATA_WRITE_FAILED": MetadataWriteFailedError,
2865
+ "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
2866
+ "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
2867
+ "LOCK_GENERATION_FAILED": LockGenerationFailedError,
2868
+ "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
2869
+ "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
2870
+ "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
2871
+ "LOGGING_FAILED": LoggingFailedError,
2872
+ "RUN_NOT_FOUND": RunNotFoundError,
2873
+ "EMPTY_TAG": EmptyTagError,
2874
+ "ANYHOW": AnyhowError,
2875
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError,
2876
+ "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
2877
+ "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
2878
+ "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
2879
+ "RESTORE_FAILED": RestoreFailedError,
2880
+ "CREATE_BACKUP_FAILED": CreateBackupFailedError,
2881
+ "BACKUP_FAILED": BackupFailedError,
2882
+ "DEPLOYMENT_FAILED": DeploymentFailedError,
2883
+ "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
2884
+ "PROJECT_NOT_FOUND": ProjectNotFoundError,
2639
2885
  "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
2640
2886
  "LIST_TOKENS_FAILED": ListTokensFailedError,
2641
2887
  "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
@@ -2657,20 +2903,32 @@ const FREESTYLE_ERROR_CODE_MAP = {
2657
2903
  "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
2658
2904
  "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
2659
2905
  "IDENTITY_NOT_FOUND": IdentityNotFoundError,
2660
- "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
2661
- "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
2662
- "LIST_RUNS_FAILED": ListRunsFailedError,
2663
- "EXECUTION_ERROR": ExecutionErrorError,
2664
- "CONNECTION_FAILED": ConnectionFailedError,
2665
- "METADATA_WRITE_FAILED": MetadataWriteFailedError,
2666
- "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
2667
- "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
2668
- "LOCK_GENERATION_FAILED": LockGenerationFailedError,
2669
- "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
2670
- "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
2671
- "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
2672
- "LOGGING_FAILED": LoggingFailedError,
2673
- "RUN_NOT_FOUND": RunNotFoundError,
2906
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
2907
+ "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2908
+ "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2909
+ "PARSE_LOGS_FAILED": ParseLogsFailedError,
2910
+ "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2911
+ "INVALID_QUERY": InvalidQueryError,
2912
+ "LOGS_NOT_FOUND": LogsNotFoundError,
2913
+ "TRIGGER_ERROR": TriggerErrorError,
2914
+ "TOKEN_ERROR": TokenErrorError,
2915
+ "PERMISSION_ERROR": PermissionErrorError,
2916
+ "IDENTITY_ERROR": IdentityErrorError,
2917
+ "GET_CONTENT_FAILED": GetContentFailedError,
2918
+ "CONTENT_NOT_FOUND": ContentNotFoundError,
2919
+ "DOWNLOAD_FAILED": DownloadFailedError,
2920
+ "GIT_SERVER_ERROR": GitServerErrorError,
2921
+ "PARSE_RESPONSE_ERROR": ParseResponseErrorError,
2922
+ "REPOSITORY_ACCESS_DENIED": RepositoryAccessDeniedError,
2923
+ "GIT_HUB_SYNC_FAILED": GitHubSyncFailedError,
2924
+ "UPDATE_DEFAULT_BRANCH_FAILED": UpdateDefaultBranchFailedError,
2925
+ "GET_REPOSITORY_INFO_FAILED": GetRepositoryInfoFailedError,
2926
+ "LIST_REPOSITORIES_FAILED": ListRepositoriesFailedError,
2927
+ "DELETE_REPOSITORY_FAILED": DeleteRepositoryFailedError,
2928
+ "CREATE_REPOSITORY_FAILED": CreateRepositoryFailedError,
2929
+ "SERIALIZATION_ERROR": SerializationErrorError,
2930
+ "GIT_INVALID_REQUEST": GitInvalidRequestError,
2931
+ "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
2674
2932
  "FAILED_TO_PROVISION_CERTIFICATE": FailedToProvisionCertificateError,
2675
2933
  "FAILED_TO_INSERT_DOMAIN_MAPPING": FailedToInsertDomainMappingError,
2676
2934
  "PERMISSION_DENIED": PermissionDeniedError,
@@ -2683,25 +2941,6 @@ const FREESTYLE_ERROR_CODE_MAP = {
2683
2941
  "VERIFICATION_NOT_FOUND": VerificationNotFoundError,
2684
2942
  "FAILED_TO_CREATE_VERIFICATION_CODE": FailedToCreateVerificationCodeError,
2685
2943
  "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,
2705
2944
  "BUILD_FAILED": BuildFailedError,
2706
2945
  "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
2707
2946
  "LOCKFILE_ERROR": LockfileErrorError,
@@ -2714,42 +2953,11 @@ const FREESTYLE_ERROR_CODE_MAP = {
2714
2953
  "INVALID_DOMAINS": InvalidDomainsError,
2715
2954
  "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
2716
2955
  "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
2717
- "DATABASE_ERROR": DatabaseErrorError,
2718
- "TRIGGER_ERROR": TriggerErrorError,
2719
- "TOKEN_ERROR": TokenErrorError,
2720
- "PERMISSION_ERROR": PermissionErrorError,
2721
- "IDENTITY_ERROR": IdentityErrorError,
2722
- "GET_CONTENT_FAILED": GetContentFailedError,
2723
- "CONTENT_NOT_FOUND": ContentNotFoundError,
2724
- "DOWNLOAD_FAILED": DownloadFailedError,
2725
- "GIT_SERVER_ERROR": GitServerErrorError,
2726
- "PARSE_RESPONSE_ERROR": ParseResponseErrorError,
2727
- "REPOSITORY_ACCESS_DENIED": RepositoryAccessDeniedError,
2728
- "GIT_HUB_SYNC_FAILED": GitHubSyncFailedError,
2729
- "UPDATE_DEFAULT_BRANCH_FAILED": UpdateDefaultBranchFailedError,
2730
- "GET_REPOSITORY_INFO_FAILED": GetRepositoryInfoFailedError,
2731
- "LIST_REPOSITORIES_FAILED": ListRepositoriesFailedError,
2732
- "DELETE_REPOSITORY_FAILED": DeleteRepositoryFailedError,
2733
- "CREATE_REPOSITORY_FAILED": CreateRepositoryFailedError,
2734
- "SERIALIZATION_ERROR": SerializationErrorError,
2735
- "GIT_INVALID_REQUEST": GitInvalidRequestError,
2736
- "REPOSITORY_NOT_FOUND": RepositoryNotFoundError,
2737
2956
  "DOMAIN_ALREADY_EXISTS": DomainAlreadyExistsError,
2738
2957
  "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
2739
2958
  "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
2740
- "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
2959
+ "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
2960
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError
2753
2961
  };
2754
2962
 
2755
2963
  var errors = /*#__PURE__*/Object.freeze({
@@ -2761,6 +2969,7 @@ var errors = /*#__PURE__*/Object.freeze({
2761
2969
  BackupFailedError: BackupFailedError,
2762
2970
  BadRequestError: BadRequestError,
2763
2971
  BlobNotFoundError: BlobNotFoundError,
2972
+ BranchNameEmptyError: BranchNameEmptyError,
2764
2973
  BranchNotFoundError: BranchNotFoundError,
2765
2974
  BrowserOperationFailedError: BrowserOperationFailedError,
2766
2975
  BuildFailedError: BuildFailedError,
@@ -2772,6 +2981,7 @@ var errors = /*#__PURE__*/Object.freeze({
2772
2981
  CloudstateInternalErrorError: CloudstateInternalErrorError,
2773
2982
  CommitFailedError: CommitFailedError,
2774
2983
  CommitNotFoundError: CommitNotFoundError,
2984
+ CommitNotInBranchError: CommitNotInBranchError,
2775
2985
  ConflictError: ConflictError,
2776
2986
  ConnectionFailedError: ConnectionFailedError,
2777
2987
  ContentNotFoundError: ContentNotFoundError,
@@ -2798,6 +3008,7 @@ var errors = /*#__PURE__*/Object.freeze({
2798
3008
  DownloadFailedError: DownloadFailedError,
2799
3009
  DuplicateGroupNameError: DuplicateGroupNameError,
2800
3010
  DuplicateUserNameError: DuplicateUserNameError,
3011
+ EmptyTagError: EmptyTagError,
2801
3012
  EntrypointNotFoundError: EntrypointNotFoundError,
2802
3013
  EnvKeyContainsEqualsError: EnvKeyContainsEqualsError,
2803
3014
  EnvKeyEmptyError: EnvKeyEmptyError,
@@ -2808,6 +3019,7 @@ var errors = /*#__PURE__*/Object.freeze({
2808
3019
  ExecuteInternalErrorError: ExecuteInternalErrorError,
2809
3020
  ExecutionErrorError: ExecutionErrorError,
2810
3021
  ExecutionFailedError: ExecutionFailedError,
3022
+ ExpectedServiceError: ExpectedServiceError,
2811
3023
  ExpiredError: ExpiredError,
2812
3024
  FREESTYLE_ERROR_CODE_MAP: FREESTYLE_ERROR_CODE_MAP,
2813
3025
  FailedPermissionsCheckError: FailedPermissionsCheckError,
@@ -2831,6 +3043,8 @@ var errors = /*#__PURE__*/Object.freeze({
2831
3043
  GetContentFailedError: GetContentFailedError,
2832
3044
  GetPermissionFailedError: GetPermissionFailedError,
2833
3045
  GetRepositoryInfoFailedError: GetRepositoryInfoFailedError,
3046
+ GitErrorError: GitErrorError,
3047
+ GitHubSyncConflictError: GitHubSyncConflictError,
2834
3048
  GitHubSyncFailedError: GitHubSyncFailedError,
2835
3049
  GitInvalidRequestError: GitInvalidRequestError,
2836
3050
  GitRepositoryAccessDeniedError: GitRepositoryAccessDeniedError,
@@ -2847,6 +3061,7 @@ var errors = /*#__PURE__*/Object.freeze({
2847
3061
  IdentityAccessDeniedError: IdentityAccessDeniedError,
2848
3062
  IdentityErrorError: IdentityErrorError,
2849
3063
  IdentityNotFoundError: IdentityNotFoundError,
3064
+ ImportSubdirNotFoundError: ImportSubdirNotFoundError,
2850
3065
  InternalError: InternalError,
2851
3066
  InternalErrorError: InternalErrorError,
2852
3067
  InternalForkVmNotFoundError: InternalForkVmNotFoundError,
@@ -2858,8 +3073,10 @@ var errors = /*#__PURE__*/Object.freeze({
2858
3073
  InvalidObjectIdError: InvalidObjectIdError,
2859
3074
  InvalidParametersError: InvalidParametersError,
2860
3075
  InvalidQueryError: InvalidQueryError,
3076
+ InvalidRangeError: InvalidRangeError,
2861
3077
  InvalidRequestError: InvalidRequestError,
2862
3078
  InvalidRevisionError: InvalidRevisionError,
3079
+ InvalidServiceError: InvalidServiceError,
2863
3080
  InvalidSignatureError: InvalidSignatureError,
2864
3081
  ListIdentitiesFailedError: ListIdentitiesFailedError,
2865
3082
  ListPermissionsFailedError: ListPermissionsFailedError,
@@ -2881,8 +3098,10 @@ var errors = /*#__PURE__*/Object.freeze({
2881
3098
  NotFoundError: NotFoundError,
2882
3099
  ObservabilityAccessDeniedError: ObservabilityAccessDeniedError,
2883
3100
  ObservabilityDatabaseErrorError: ObservabilityDatabaseErrorError,
3101
+ OffsetWithSelectorError: OffsetWithSelectorError,
2884
3102
  OnFailureArrayContainsEmptyError: OnFailureArrayContainsEmptyError,
2885
3103
  OrderNotFoundError: OrderNotFoundError,
3104
+ PackfileError: PackfileError,
2886
3105
  ParseLogsFailedError: ParseLogsFailedError,
2887
3106
  ParseResponseErrorError: ParseResponseErrorError,
2888
3107
  PathNotFoundError: PathNotFoundError,
@@ -2898,6 +3117,7 @@ var errors = /*#__PURE__*/Object.freeze({
2898
3117
  ReadFileFailedError: ReadFileFailedError,
2899
3118
  RecordOwnershipErrorError: RecordOwnershipErrorError,
2900
3119
  ReferenceNotFoundError: ReferenceNotFoundError,
3120
+ RepoAlreadyExistsError: RepoAlreadyExistsError,
2901
3121
  RepoNotFoundError: RepoNotFoundError,
2902
3122
  RepositoryAccessDeniedError: RepositoryAccessDeniedError,
2903
3123
  RepositoryNotFoundError: RepositoryNotFoundError,
@@ -2911,6 +3131,7 @@ var errors = /*#__PURE__*/Object.freeze({
2911
3131
  RevokePermissionFailedError: RevokePermissionFailedError,
2912
3132
  RevokeTokenFailedError: RevokeTokenFailedError,
2913
3133
  RunNotFoundError: RunNotFoundError,
3134
+ SendErrorError: SendErrorError,
2914
3135
  SerializationErrorError: SerializationErrorError,
2915
3136
  ServerDeploymentFailedError: ServerDeploymentFailedError,
2916
3137
  ServiceAlreadyExistsError: ServiceAlreadyExistsError,
@@ -2922,6 +3143,9 @@ var errors = /*#__PURE__*/Object.freeze({
2922
3143
  ShutdownFailedError: ShutdownFailedError,
2923
3144
  SigningError: SigningError,
2924
3145
  SnapshotVmBadRequestError: SnapshotVmBadRequestError,
3146
+ SourceImportConflictError: SourceImportConflictError,
3147
+ SourceNotFoundError: SourceNotFoundError,
3148
+ SourceUnauthorizedError: SourceUnauthorizedError,
2925
3149
  StatusFailedError: StatusFailedError,
2926
3150
  StdIoError: StdIoError,
2927
3151
  TagNotFoundError: TagNotFoundError,
@@ -3016,7 +3240,7 @@ class ApiClient {
3016
3240
  }
3017
3241
  return headers;
3018
3242
  }
3019
- async request(method, url, body) {
3243
+ async requestRaw(method, url, body) {
3020
3244
  const headers = this.getDefaultHeaders();
3021
3245
  if (body) {
3022
3246
  headers["Content-Type"] = "application/json";
@@ -3039,6 +3263,10 @@ class ApiClient {
3039
3263
  }
3040
3264
  throw errorFromJSON(errorData);
3041
3265
  }
3266
+ return response;
3267
+ }
3268
+ async request(method, url, body) {
3269
+ const response = await this.requestRaw(method, url, body);
3042
3270
  return response.json();
3043
3271
  }
3044
3272
  async fetch(url, options) {
@@ -3052,6 +3280,10 @@ class ApiClient {
3052
3280
  };
3053
3281
  return this.fetchFn(url, finalOptions);
3054
3282
  }
3283
+ getRaw(path, options) {
3284
+ const url = this.buildUrl(path, options?.params, options?.query);
3285
+ return this.requestRaw("GET", url);
3286
+ }
3055
3287
  get(path, ...args) {
3056
3288
  const options = args[0];
3057
3289
  const url = this.buildUrl(path, options?.params, options?.query);
@@ -3213,12 +3445,19 @@ class DomainsNamespace {
3213
3445
  }
3214
3446
  }
3215
3447
 
3216
- class GitRepo {
3448
+ class GitRepoBranchesNamespace {
3217
3449
  constructor(repoId, apiClient) {
3218
- this.apiClient = apiClient;
3219
3450
  this.repoId = repoId;
3451
+ this.apiClient = apiClient;
3452
+ }
3453
+ /**
3454
+ * Get the default branch for this repository.
3455
+ */
3456
+ async getDefaultBranch() {
3457
+ return this.apiClient.get("/git/v1/repo/{repo_id}/default-branch", {
3458
+ params: { repo_id: this.repoId }
3459
+ });
3220
3460
  }
3221
- repoId;
3222
3461
  /**
3223
3462
  * Set the default branch for this repository.
3224
3463
  */
@@ -3230,30 +3469,29 @@ class GitRepo {
3230
3469
  body: { defaultBranch }
3231
3470
  });
3232
3471
  }
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 }
3472
+ async list() {
3473
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/heads/", {
3474
+ params: { repo: this.repoId }
3239
3475
  });
3240
3476
  }
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 }
3477
+ async get({
3478
+ branchName
3479
+ }) {
3480
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/heads/{branch}", {
3481
+ params: { repo: this.repoId, branch: branchName }
3251
3482
  });
3252
3483
  }
3484
+ }
3485
+ class GitRepoGitHubSyncNamespace {
3486
+ constructor(repoId, apiClient) {
3487
+ this.repoId = repoId;
3488
+ this.apiClient = apiClient;
3489
+ }
3253
3490
  /**
3254
3491
  * Get the GitHub sync configuration for this repository.
3492
+ * Returns null if GitHub sync is not configured.
3255
3493
  */
3256
- async getGitHubSyncConfig() {
3494
+ async get() {
3257
3495
  try {
3258
3496
  return await this.apiClient.get("/git/v1/repo/{repo_id}/github-sync", {
3259
3497
  params: { repo_id: this.repoId }
@@ -3265,10 +3503,33 @@ class GitRepo {
3265
3503
  throw error;
3266
3504
  }
3267
3505
  }
3506
+ /**
3507
+ * Enable GitHub sync for this repository.
3508
+ */
3509
+ async enable({ githubRepoName }) {
3510
+ await this.apiClient.post("/git/v1/repo/{repo_id}/github-sync", {
3511
+ params: { repo_id: this.repoId },
3512
+ body: { githubRepoName }
3513
+ });
3514
+ }
3515
+ /**
3516
+ * Disable GitHub sync for this repository.
3517
+ */
3518
+ async disable() {
3519
+ await this.apiClient.delete("/git/v1/repo/{repo_id}/github-sync", {
3520
+ params: { repo_id: this.repoId }
3521
+ });
3522
+ }
3523
+ }
3524
+ class GitRepoTriggersNamespace {
3525
+ constructor(repoId, apiClient) {
3526
+ this.repoId = repoId;
3527
+ this.apiClient = apiClient;
3528
+ }
3268
3529
  /**
3269
3530
  * List git triggers for this repository.
3270
3531
  */
3271
- async listTriggers() {
3532
+ async list() {
3272
3533
  return this.apiClient.get("/git/v1/repo/{repo}/trigger", {
3273
3534
  params: { repo: this.repoId }
3274
3535
  });
@@ -3276,7 +3537,7 @@ class GitRepo {
3276
3537
  /**
3277
3538
  * Create a git trigger for this repository.
3278
3539
  */
3279
- async createTrigger({
3540
+ async create({
3280
3541
  trigger,
3281
3542
  action
3282
3543
  }) {
@@ -3291,14 +3552,334 @@ class GitRepo {
3291
3552
  /**
3292
3553
  * Delete a git trigger.
3293
3554
  */
3294
- async deleteTrigger({
3555
+ async delete({
3295
3556
  triggerId
3296
3557
  }) {
3297
3558
  return this.apiClient.delete("/git/v1/repo/{repo}/trigger/{trigger}", {
3298
3559
  params: { repo: this.repoId, trigger: triggerId }
3299
3560
  });
3300
3561
  }
3301
- /**
3562
+ }
3563
+ class GitRepoOdbBlobsNamespace {
3564
+ constructor(repoId, apiClient) {
3565
+ this.repoId = repoId;
3566
+ this.apiClient = apiClient;
3567
+ }
3568
+ async get({
3569
+ sha
3570
+ }) {
3571
+ return this.apiClient.get("/git/v1/repo/{repo}/git/blobs/{hash}", {
3572
+ params: { repo: this.repoId, hash: sha }
3573
+ });
3574
+ }
3575
+ }
3576
+ class GitRepoOdbTreesNamespace {
3577
+ constructor(repoId, apiClient) {
3578
+ this.repoId = repoId;
3579
+ this.apiClient = apiClient;
3580
+ }
3581
+ async get({
3582
+ sha
3583
+ }) {
3584
+ return this.apiClient.get("/git/v1/repo/{repo}/git/trees/{hash}", {
3585
+ params: { repo: this.repoId, hash: sha }
3586
+ });
3587
+ }
3588
+ }
3589
+ class GitRepoContentsNamespace {
3590
+ constructor(repoId, apiClient) {
3591
+ this.repoId = repoId;
3592
+ this.apiClient = apiClient;
3593
+ }
3594
+ /**
3595
+ * Get the contents of a file or directory at a specific path and revision.
3596
+ *
3597
+ * @param path - The path to the file or directory (empty string for root)
3598
+ * @param rev - The revision (branch, tag, or commit SHA) to get contents from
3599
+ * @returns File contents (base64 encoded) or directory listing
3600
+ */
3601
+ async get({
3602
+ path = "",
3603
+ rev
3604
+ } = {}) {
3605
+ return this.apiClient.get("/git/v1/repo/{repo}/contents/{path}", {
3606
+ params: { repo: this.repoId, path },
3607
+ query: { rev }
3608
+ });
3609
+ }
3610
+ /**
3611
+ * Download repository contents as a tarball archive.
3612
+ *
3613
+ * @param rev - The revision (branch, tag, or commit SHA) to download
3614
+ * @returns The tarball as an ArrayBuffer
3615
+ *
3616
+ * @example
3617
+ * ```ts
3618
+ * const tarball = await repo.contents.downloadTarball({ rev: "main" });
3619
+ * await fs.writeFile("repo.tar", Buffer.from(tarball));
3620
+ * ```
3621
+ */
3622
+ async downloadTarball({
3623
+ rev
3624
+ } = {}) {
3625
+ const response = await this.apiClient.getRaw(
3626
+ "/git/v1/repo/{repo}/tarball",
3627
+ {
3628
+ params: { repo: this.repoId },
3629
+ query: { rev }
3630
+ }
3631
+ );
3632
+ return response.arrayBuffer();
3633
+ }
3634
+ /**
3635
+ * Download repository contents as a zip archive.
3636
+ *
3637
+ * @param rev - The revision (branch, tag, or commit SHA) to download
3638
+ * @returns The zip file as an ArrayBuffer
3639
+ *
3640
+ * @example
3641
+ * ```ts
3642
+ * const zip = await repo.contents.downloadZip({ rev: "main" });
3643
+ * await fs.writeFile("repo.zip", Buffer.from(zip));
3644
+ * ```
3645
+ */
3646
+ async downloadZip({
3647
+ rev
3648
+ } = {}) {
3649
+ const response = await this.apiClient.getRaw("/git/v1/repo/{repo}/zip", {
3650
+ params: { repo: this.repoId },
3651
+ query: { rev }
3652
+ });
3653
+ return response.arrayBuffer();
3654
+ }
3655
+ }
3656
+ class GitRepoCommitsNamespace {
3657
+ constructor(repoId, apiClient) {
3658
+ this.repoId = repoId;
3659
+ this.apiClient = apiClient;
3660
+ }
3661
+ /**
3662
+ * Get a specific commit by SHA.
3663
+ */
3664
+ async get({
3665
+ sha
3666
+ }) {
3667
+ return this.apiClient.get("/git/v1/repo/{repo}/git/commits/{hash}", {
3668
+ params: { repo: this.repoId, hash: sha }
3669
+ });
3670
+ }
3671
+ /**
3672
+ * List commits for this repository.
3673
+ */
3674
+ async list(params = {}) {
3675
+ return this.apiClient.get("/git/v1/repo/{repo}/git/commits", {
3676
+ params: { repo: this.repoId },
3677
+ query: params
3678
+ });
3679
+ }
3680
+ }
3681
+ class GitRepoTagsNamespace {
3682
+ constructor(repoId, apiClient) {
3683
+ this.repoId = repoId;
3684
+ this.apiClient = apiClient;
3685
+ }
3686
+ /**
3687
+ * List all tags in this repository.
3688
+ */
3689
+ async list() {
3690
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/tags/", {
3691
+ params: { repo: this.repoId }
3692
+ });
3693
+ }
3694
+ /**
3695
+ * Get a tag by name.
3696
+ */
3697
+ async get({
3698
+ tagName
3699
+ }) {
3700
+ return this.apiClient.get("/git/v1/repo/{repo}/git/refs/tags/{tag}", {
3701
+ params: { repo: this.repoId, tag: tagName }
3702
+ });
3703
+ }
3704
+ /**
3705
+ * Get an annotated tag object by its SHA.
3706
+ */
3707
+ async getByHash({
3708
+ sha
3709
+ }) {
3710
+ return this.apiClient.get("/git/v1/repo/{repo}/git/tags/{hash}", {
3711
+ params: { repo: this.repoId, hash: sha }
3712
+ });
3713
+ }
3714
+ }
3715
+ class GitRepo {
3716
+ constructor(repoId, apiClient) {
3717
+ this.apiClient = apiClient;
3718
+ this.repoId = repoId;
3719
+ this.branches = new GitRepoBranchesNamespace(repoId, apiClient);
3720
+ this.contents = new GitRepoContentsNamespace(repoId, apiClient);
3721
+ this.commits = new GitRepoCommitsNamespace(repoId, apiClient);
3722
+ this.tags = new GitRepoTagsNamespace(repoId, apiClient);
3723
+ this.triggers = new GitRepoTriggersNamespace(repoId, apiClient);
3724
+ this.githubSync = new GitRepoGitHubSyncNamespace(repoId, apiClient);
3725
+ this.blobs = new GitRepoOdbBlobsNamespace(repoId, apiClient);
3726
+ this.trees = new GitRepoOdbTreesNamespace(repoId, apiClient);
3727
+ }
3728
+ repoId;
3729
+ /**
3730
+ * Manage branches in this repository.
3731
+ *
3732
+ * @example
3733
+ * ```ts
3734
+ * // List all branches
3735
+ * const branches = await repo.branches.list();
3736
+ *
3737
+ * // Get a specific branch
3738
+ * const main = await repo.branches.get({ branchName: "main" });
3739
+ *
3740
+ * // Get/set default branch
3741
+ * const { defaultBranch } = await repo.branches.getDefaultBranch();
3742
+ * await repo.branches.setDefaultBranch({ defaultBranch: "develop" });
3743
+ * ```
3744
+ */
3745
+ branches;
3746
+ /**
3747
+ * Access repository contents (files and directories).
3748
+ *
3749
+ * @example
3750
+ * ```ts
3751
+ * // Get file contents
3752
+ * const file = await repo.contents.get({ path: "README.md" });
3753
+ * const content = atob(file.content);
3754
+ *
3755
+ * // Get contents at a specific commit/branch/tag
3756
+ * const file = await repo.contents.get({
3757
+ * path: "src/index.ts",
3758
+ * rev: "main"
3759
+ * });
3760
+ *
3761
+ * // Get directory listing
3762
+ * const dir = await repo.contents.get({ path: "src" });
3763
+ *
3764
+ * // Download repository as tarball or zip
3765
+ * const tarball = await repo.contents.downloadTarball({ rev: "main" });
3766
+ * const zip = await repo.contents.downloadZip({ rev: "main" });
3767
+ * ```
3768
+ */
3769
+ contents;
3770
+ /**
3771
+ * Access commits in this repository.
3772
+ *
3773
+ * @example
3774
+ * ```ts
3775
+ * // Get a specific commit by SHA
3776
+ * const commit = await repo.commits.get({ sha: "abc123..." });
3777
+ * console.log(commit.message);
3778
+ * console.log(commit.author.name);
3779
+ *
3780
+ * // List recent commits
3781
+ * const commits = await repo.commits.list();
3782
+ * ```
3783
+ */
3784
+ commits;
3785
+ /**
3786
+ * Access tags in this repository.
3787
+ *
3788
+ * @example
3789
+ * ```ts
3790
+ * // List all tags
3791
+ * const tags = await repo.tags.list();
3792
+ *
3793
+ * // Get a tag by name
3794
+ * const tag = await repo.tags.get({ tagName: "v1.0.0" });
3795
+ *
3796
+ * // Get an annotated tag object by SHA
3797
+ * const tagObject = await repo.tags.getByHash({ sha: "abc123..." });
3798
+ * ```
3799
+ */
3800
+ tags;
3801
+ /**
3802
+ * Manage webhook triggers for this repository.
3803
+ *
3804
+ * Triggers send HTTP POST requests to your URL when events occur,
3805
+ * such as pushes to specific branches or changes to specific files.
3806
+ *
3807
+ * @example
3808
+ * ```ts
3809
+ * // Create a trigger for pushes to main
3810
+ * const { triggerId } = await repo.triggers.create({
3811
+ * trigger: { event: "push", branch: ["main"] },
3812
+ * action: { type: "webhook", url: "https://your-server.com/webhook" }
3813
+ * });
3814
+ *
3815
+ * // List all triggers
3816
+ * const triggers = await repo.triggers.list();
3817
+ *
3818
+ * // Delete a trigger
3819
+ * await repo.triggers.delete({ triggerId });
3820
+ * ```
3821
+ */
3822
+ triggers;
3823
+ /**
3824
+ * Manage GitHub synchronization for this repository.
3825
+ *
3826
+ * When enabled, pushes to either your Freestyle repository or the linked
3827
+ * GitHub repository are automatically synced to the other.
3828
+ *
3829
+ * @example
3830
+ * ```ts
3831
+ * // Enable sync with a GitHub repository
3832
+ * await repo.githubSync.enable({ githubRepoName: "owner/repo" });
3833
+ *
3834
+ * // Check sync configuration
3835
+ * const config = await repo.githubSync.get();
3836
+ *
3837
+ * // Disable sync
3838
+ * await repo.githubSync.disable();
3839
+ * ```
3840
+ */
3841
+ githubSync;
3842
+ /**
3843
+ * Access blob objects in the Git object database.
3844
+ *
3845
+ * Blobs represent raw file contents. Content is returned base64-encoded
3846
+ * for binary safety.
3847
+ *
3848
+ * @example
3849
+ * ```ts
3850
+ * // Get a blob by its SHA hash
3851
+ * const blob = await repo.blobs.get({ sha: "abc123..." });
3852
+ *
3853
+ * // Decode the base64 content
3854
+ * const content = atob(blob.content);
3855
+ * console.log(content);
3856
+ * ```
3857
+ */
3858
+ blobs;
3859
+ /**
3860
+ * Access tree objects in the Git object database.
3861
+ *
3862
+ * Trees represent directories in Git. Each tree contains entries
3863
+ * pointing to blobs (files) or other trees (subdirectories).
3864
+ *
3865
+ * @example
3866
+ * ```ts
3867
+ * // Get the root tree from a commit
3868
+ * const commit = await repo.commits.get({ sha: "abc123..." });
3869
+ * const tree = await repo.trees.get({ sha: commit.tree.sha });
3870
+ *
3871
+ * // Iterate over entries
3872
+ * for (const entry of tree.tree) {
3873
+ * if (entry.type === "blob") {
3874
+ * console.log(`File: ${entry.path}`);
3875
+ * } else {
3876
+ * console.log(`Directory: ${entry.path}`);
3877
+ * }
3878
+ * }
3879
+ * ```
3880
+ */
3881
+ trees;
3882
+ /**
3302
3883
  * Compare two revs in this repository.
3303
3884
  *
3304
3885
  * Head and base can be branch names, tags, or commit SHAs.
@@ -3348,7 +3929,7 @@ class GitReposNamespace {
3348
3929
  /**
3349
3930
  * Get a repository instance by ID.
3350
3931
  */
3351
- instance({ repoId }) {
3932
+ ref({ repoId }) {
3352
3933
  return new GitRepo(repoId, this.apiClient);
3353
3934
  }
3354
3935
  /**
@@ -3368,6 +3949,31 @@ class GitNamespace {
3368
3949
  this.freestyle = freestyle;
3369
3950
  this.repos = new GitReposNamespace(apiClient);
3370
3951
  }
3952
+ /**
3953
+ * Manage Git repositories.
3954
+ *
3955
+ * Create, list, delete, and get references to repositories.
3956
+ *
3957
+ * @example
3958
+ * ```ts
3959
+ * // Create a new empty repository
3960
+ * const { repoId, repo } = await freestyle.git.repos.create({});
3961
+ *
3962
+ * // Create from a GitHub URL
3963
+ * const { repo } = await freestyle.git.repos.create({
3964
+ * source: { url: "https://github.com/owner/repo" }
3965
+ * });
3966
+ *
3967
+ * // List repositories
3968
+ * const repos = await freestyle.git.repos.list({ limit: 10 });
3969
+ *
3970
+ * // Get a reference to an existing repository
3971
+ * const repo = freestyle.git.repos.ref({ repoId: "your-repo-id" });
3972
+ *
3973
+ * // Delete a repository
3974
+ * await freestyle.git.repos.delete({ repoId: "your-repo-id" });
3975
+ * ```
3976
+ */
3371
3977
  repos;
3372
3978
  }
3373
3979
 
@@ -3376,13 +3982,21 @@ class Identity {
3376
3982
  this.apiClient = apiClient;
3377
3983
  this.identityId = identityId;
3378
3984
  this.permissions = new IdentityPermissions(identityId, apiClient);
3985
+ this.tokens = new IdentityTokens(identityId, apiClient);
3379
3986
  }
3380
3987
  identityId;
3381
3988
  permissions;
3989
+ tokens;
3990
+ }
3991
+ class IdentityTokens {
3992
+ constructor(identityId, apiClient) {
3993
+ this.identityId = identityId;
3994
+ this.apiClient = apiClient;
3995
+ }
3382
3996
  /**
3383
3997
  * Create a new access token for this identity.
3384
3998
  */
3385
- async createToken() {
3999
+ async create() {
3386
4000
  const response = await this.apiClient.post(
3387
4001
  "/identity/v1/identities/{identity}/tokens",
3388
4002
  {
@@ -3397,7 +4011,7 @@ class Identity {
3397
4011
  /**
3398
4012
  * Revoke an access token.
3399
4013
  */
3400
- async revokeToken({
4014
+ async revoke({
3401
4015
  tokenId
3402
4016
  }) {
3403
4017
  return this.apiClient.delete(
@@ -3410,7 +4024,7 @@ class Identity {
3410
4024
  /**
3411
4025
  * List access tokens for this identity.
3412
4026
  */
3413
- async listTokens() {
4027
+ async list() {
3414
4028
  return this.apiClient.get("/identity/v1/identities/{identity}/tokens", {
3415
4029
  params: { identity: this.identityId }
3416
4030
  });
@@ -3478,7 +4092,7 @@ class GitPermissions {
3478
4092
  /**
3479
4093
  * Grant this identity access to a repository.
3480
4094
  */
3481
- async create({
4095
+ async grant({
3482
4096
  repoId,
3483
4097
  permission
3484
4098
  }) {
@@ -3493,7 +4107,7 @@ class GitPermissions {
3493
4107
  /**
3494
4108
  * Revoke this identity's access to a repository.
3495
4109
  */
3496
- async delete({
4110
+ async revoke({
3497
4111
  repoId
3498
4112
  }) {
3499
4113
  return this.apiClient.delete(
@@ -3556,7 +4170,7 @@ class VmPermissions {
3556
4170
  /**
3557
4171
  * Grant this identity access to a VM.
3558
4172
  */
3559
- async create({
4173
+ async grant({
3560
4174
  vmId,
3561
4175
  allowedUsers
3562
4176
  }) {
@@ -3571,7 +4185,7 @@ class VmPermissions {
3571
4185
  /**
3572
4186
  * Revoke this identity's access to a VM.
3573
4187
  */
3574
- async delete({
4188
+ async revoke({
3575
4189
  vmId
3576
4190
  }) {
3577
4191
  return this.apiClient.delete(
@@ -3696,9 +4310,11 @@ class DeploymentsNamespace {
3696
4310
  this.apiClient = apiClient;
3697
4311
  }
3698
4312
  /**
3699
- * Create a web deployment on the edge.
4313
+ * Create a serverless web deployment
3700
4314
  */
3701
- async create({ ...body }) {
4315
+ async create({
4316
+ ...body
4317
+ }) {
3702
4318
  let source;
3703
4319
  if ("repo" in body) {
3704
4320
  source = {
@@ -3786,13 +4402,16 @@ class RunsNamespace {
3786
4402
  */
3787
4403
  async create({
3788
4404
  code,
3789
- ...config
4405
+ config,
4406
+ outgoingHeaders,
4407
+ outgoingProxy
3790
4408
  }) {
3791
4409
  const response = await this.apiClient.post("/execute/v1/script", {
3792
4410
  body: {
3793
4411
  script: code,
3794
4412
  config: {
3795
- customHeaders: config.customHeaders,
4413
+ proxy: outgoingProxy,
4414
+ customHeaders: outgoingHeaders,
3796
4415
  networkPermissions: config.networkPermissions?.map((np) => ({
3797
4416
  action: np.action,
3798
4417
  query: np.domain,
@@ -3836,7 +4455,7 @@ class RunsNamespace {
3836
4455
  };
3837
4456
  }
3838
4457
  }
3839
- class EdgeNamespace {
4458
+ class ServerlessNamespace {
3840
4459
  constructor(apiClient) {
3841
4460
  this.apiClient = apiClient;
3842
4461
  this.deployments = new DeploymentsNamespace(apiClient);
@@ -3851,6 +4470,14 @@ class FileSystem {
3851
4470
  this.vmId = vmId;
3852
4471
  this.client = client;
3853
4472
  }
4473
+ vm = null;
4474
+ /**
4475
+ * @internal
4476
+ * Set the parent VM instance for exec operations
4477
+ */
4478
+ _setVm(vm) {
4479
+ this.vm = vm;
4480
+ }
3854
4481
  /**
3855
4482
  * Read a file from the VM as a buffer.
3856
4483
  * @param filepath The path to the file in the VM
@@ -3908,21 +4535,47 @@ class FileSystem {
3908
4535
  * @returns Array of file/directory names
3909
4536
  */
3910
4537
  async readDir(path) {
3911
- throw new Error("Not implemented");
4538
+ const response = await this.client.get("/v1/vms/{vm_id}/files/{filepath}", {
4539
+ params: { vm_id: this.vmId, filepath: path }
4540
+ });
4541
+ if ("files" in response && response.files) {
4542
+ return response.files;
4543
+ }
4544
+ throw new Error("Path is not a directory");
3912
4545
  }
3913
4546
  /**
3914
4547
  * Create a directory in the VM.
3915
4548
  * @param path The path to create
4549
+ * @param recursive Create parent directories if needed (default: false)
3916
4550
  */
3917
- async mkdir(path) {
3918
- throw new Error("Not implemented");
4551
+ async mkdir(path, recursive = false) {
4552
+ if (!this.vm) {
4553
+ throw new Error("FileSystem not properly initialized");
4554
+ }
4555
+ const flag = recursive ? "-p" : "";
4556
+ const result = await this.vm.exec(`mkdir ${flag} "${path}"`);
4557
+ if (result.statusCode !== 0) {
4558
+ throw new Error(
4559
+ `Failed to create directory: ${result.stderr || "Unknown error"}`
4560
+ );
4561
+ }
3919
4562
  }
3920
4563
  /**
3921
4564
  * Remove a file or directory from the VM.
3922
4565
  * @param path The path to remove
4566
+ * @param recursive Remove directories and their contents recursively (default: false)
3923
4567
  */
3924
- async remove(path) {
3925
- throw new Error("Not implemented");
4568
+ async remove(path, recursive = false) {
4569
+ if (!this.vm) {
4570
+ throw new Error("FileSystem not properly initialized");
4571
+ }
4572
+ const flag = recursive ? "-rf" : "-f";
4573
+ const result = await this.vm.exec(`rm ${flag} "${path}"`);
4574
+ if (result.statusCode !== 0) {
4575
+ throw new Error(
4576
+ `Failed to remove path: ${result.stderr || "Unknown error"}`
4577
+ );
4578
+ }
3926
4579
  }
3927
4580
  /**
3928
4581
  * Check if a file or directory exists in the VM.
@@ -3930,7 +4583,11 @@ class FileSystem {
3930
4583
  * @returns True if exists, false otherwise
3931
4584
  */
3932
4585
  async exists(path) {
3933
- throw new Error("Not implemented");
4586
+ if (!this.vm) {
4587
+ throw new Error("FileSystem not properly initialized");
4588
+ }
4589
+ const result = await this.vm.exec(`test -e "${path}"`);
4590
+ return result.statusCode === 0;
3934
4591
  }
3935
4592
  /**
3936
4593
  * Get file/directory stats.
@@ -3938,7 +4595,37 @@ class FileSystem {
3938
4595
  * @returns File/directory stats
3939
4596
  */
3940
4597
  async stat(path) {
3941
- throw new Error("Not implemented");
4598
+ if (!this.vm) {
4599
+ throw new Error("FileSystem not properly initialized");
4600
+ }
4601
+ const result = await this.vm.exec(
4602
+ `stat -c '%s|%F|%a|%U|%G|%y' "${path}" 2>/dev/null || stat -f '%z|%HT|%p|%Su|%Sg|%Sm' "${path}"`
4603
+ );
4604
+ if (result.statusCode !== 0 || !result.stdout) {
4605
+ throw new Error(
4606
+ `Failed to stat path: ${result.stderr || "Unknown error"}`
4607
+ );
4608
+ }
4609
+ const parts = result.stdout.trim().split("|");
4610
+ if (parts.length < 6) {
4611
+ throw new Error(`Invalid stat output: ${result.stdout}`);
4612
+ }
4613
+ const size = parseInt(parts[0] || "0");
4614
+ const fileType = parts[1] || "";
4615
+ const permissions = parts[2] || "";
4616
+ const owner = parts[3] || "";
4617
+ const group = parts[4] || "";
4618
+ const modified = parts[5] || "";
4619
+ return {
4620
+ size,
4621
+ isFile: fileType.includes("regular file") || fileType.includes("Regular File"),
4622
+ isDirectory: fileType.includes("directory") || fileType.includes("Directory"),
4623
+ isSymlink: fileType.includes("symbolic link") || fileType.includes("Symbolic Link"),
4624
+ permissions,
4625
+ owner,
4626
+ group,
4627
+ modified
4628
+ };
3942
4629
  }
3943
4630
  /**
3944
4631
  * Watch for file changes in the VM.
@@ -4123,8 +4810,8 @@ function composeCreateVmOptions(arr) {
4123
4810
  if (!result.template) {
4124
4811
  result.template = options.template;
4125
4812
  } else if (options.template !== null) {
4126
- const baseTemplate = result.template instanceof VmTemplate ? result.template["template"] : result.template;
4127
- const newTemplate = options.template instanceof VmTemplate ? options.template["template"] : options.template;
4813
+ const baseTemplate = result.template instanceof VmTemplate ? result.template["raw"] : result.template;
4814
+ const newTemplate = options.template instanceof VmTemplate ? options.template["raw"] : options.template;
4128
4815
  result.template = {
4129
4816
  // Simple overrides - start with base, override with new
4130
4817
  snapshotId: newTemplate.snapshotId !== void 0 ? newTemplate.snapshotId : baseTemplate.snapshotId,
@@ -4292,6 +4979,7 @@ class Vm {
4292
4979
  this.apiClient = apiClient;
4293
4980
  this.vmId = vmId;
4294
4981
  this.fs = new FileSystem(vmId, apiClient);
4982
+ this.fs._setVm(this);
4295
4983
  this.terminals = new VmTerminals(vmId, apiClient);
4296
4984
  }
4297
4985
  vmId;
@@ -4353,6 +5041,18 @@ class Vm {
4353
5041
  params: { vm_id: this.vmId }
4354
5042
  });
4355
5043
  }
5044
+ /**
5045
+ * Create a snapshot of the VM.
5046
+ *
5047
+ * @param body Optional snapshot configuration
5048
+ * @returns Snapshot ID and Source VM ID
5049
+ */
5050
+ async snapshot(body = {}) {
5051
+ return this.apiClient.post("/v1/vms/{vm_id}/snapshot", {
5052
+ params: { vm_id: this.vmId },
5053
+ body
5054
+ });
5055
+ }
4356
5056
  /**
4357
5057
  * Execute a command in the VM and wait for it to complete.
4358
5058
  * @param command The command to execute
@@ -4422,15 +5122,44 @@ class VmSnapshotsNamespace {
4422
5122
  this.apiClient = apiClient;
4423
5123
  }
4424
5124
  async ensure(options) {
5125
+ if (options.template.raw.template instanceof VmTemplate) {
5126
+ options.template = await ensureNestedTemplates(options.template, this);
5127
+ }
4425
5128
  return this.apiClient.post("/v1/vms/snapshots", {
4426
5129
  body: {
4427
5130
  ...options,
4428
5131
  // @ts-ignore
4429
- template: options.template?.template
5132
+ template: options.template?.raw
4430
5133
  }
4431
5134
  });
4432
5135
  }
4433
5136
  }
5137
+ async function ensureNestedTemplates(template, snapshots) {
5138
+ let templates = [template];
5139
+ while (templates.at(-1)?.raw.template instanceof VmTemplate) {
5140
+ let innerTemplate = templates.at(-1).raw.template;
5141
+ templates.at(-1).raw.template = void 0;
5142
+ templates.push(innerTemplate);
5143
+ }
5144
+ return await layerTemplates(templates, snapshots);
5145
+ }
5146
+ async function layerTemplates(templates, snapshots) {
5147
+ let lastTemplate = templates.pop();
5148
+ const { snapshotId } = await snapshots.ensure({
5149
+ template: lastTemplate
5150
+ });
5151
+ let lastSnapshotId = snapshotId;
5152
+ while (templates.length > 0) {
5153
+ const template = templates.pop();
5154
+ template.raw.snapshotId = lastSnapshotId;
5155
+ const { snapshotId: snapshotId2 } = await snapshots.ensure({
5156
+ template
5157
+ });
5158
+ lastSnapshotId = snapshotId2;
5159
+ lastTemplate = template;
5160
+ }
5161
+ return lastTemplate;
5162
+ }
4434
5163
  class VmsNamespace {
4435
5164
  constructor(apiClient) {
4436
5165
  this.apiClient = apiClient;
@@ -4446,6 +5175,12 @@ class VmsNamespace {
4446
5175
  const builders = options.with || {};
4447
5176
  const { with: _, ...baseConfig } = options;
4448
5177
  let config = baseConfig;
5178
+ if (config.template instanceof VmTemplate) {
5179
+ config.template = await ensureNestedTemplates(
5180
+ config.template,
5181
+ this.snapshots
5182
+ );
5183
+ }
4449
5184
  const keys = Object.keys(builders);
4450
5185
  for (const key of keys) {
4451
5186
  const builder = builders[key];
@@ -4456,7 +5191,7 @@ class VmsNamespace {
4456
5191
  const response = await this.apiClient.post("/v1/vms", {
4457
5192
  body: {
4458
5193
  ...config,
4459
- template: config.template instanceof VmTemplate ? config.template["template"] : config.template
5194
+ template: config.template instanceof VmTemplate ? config.template["raw"] : config.template
4460
5195
  }
4461
5196
  });
4462
5197
  const vmId = response.id;
@@ -4502,9 +5237,9 @@ class VmsNamespace {
4502
5237
  }
4503
5238
  }
4504
5239
  class VmTemplate {
4505
- template;
5240
+ raw;
4506
5241
  constructor(template) {
4507
- this.template = template;
5242
+ this.raw = template;
4508
5243
  }
4509
5244
  }
4510
5245
 
@@ -4515,7 +5250,7 @@ class Freestyle {
4515
5250
  git;
4516
5251
  identities;
4517
5252
  dns;
4518
- edge;
5253
+ serverless;
4519
5254
  vms;
4520
5255
  constructor(options = {}) {
4521
5256
  if (!options.baseUrl) {
@@ -4540,7 +5275,7 @@ class Freestyle {
4540
5275
  this.git = new GitNamespace(this.apiClient, this);
4541
5276
  this.identities = new IdentitiesNamespace(this.apiClient);
4542
5277
  this.dns = new DnsNamespace(this.apiClient);
4543
- this.edge = new EdgeNamespace(this.apiClient);
5278
+ this.serverless = new ServerlessNamespace(this.apiClient);
4544
5279
  this.vms = new VmsNamespace(this.apiClient);
4545
5280
  }
4546
5281
  /**