freestyle-sandboxes 0.1.8 → 0.1.9

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 (5) hide show
  1. package/index.cjs +1175 -1062
  2. package/index.d.cts +1045 -852
  3. package/index.d.mts +1045 -852
  4. package/index.mjs +1175 -1062
  5. package/package.json +1 -1
package/index.mjs CHANGED
@@ -18,30 +18,6 @@ class GitErrorError extends Error {
18
18
  static statusCode = 500;
19
19
  static description = `{message}`;
20
20
  }
21
- class InternalErrorError extends Error {
22
- constructor(body) {
23
- super(
24
- `INTERNAL_ERROR: ${body.message}`
25
- );
26
- this.body = body;
27
- this.name = "InternalErrorError";
28
- }
29
- static code = "INTERNAL_ERROR";
30
- static statusCode = 500;
31
- static description = `Internal error: {message}`;
32
- }
33
- class DockerImportBadRequestError extends Error {
34
- constructor(body) {
35
- super(
36
- `DOCKER_IMPORT_BAD_REQUEST: ${body.message}`
37
- );
38
- this.body = body;
39
- this.name = "DockerImportBadRequestError";
40
- }
41
- static code = "DOCKER_IMPORT_BAD_REQUEST";
42
- static statusCode = 400;
43
- static description = `Bad request: {message}`;
44
- }
45
21
  class VmOperationDeniedDuringTransactionError extends Error {
46
22
  constructor(body) {
47
23
  super(
@@ -78,41 +54,29 @@ class VmNotInTransactionError extends Error {
78
54
  static statusCode = 404;
79
55
  static description = `VM not in a transaction: {vm_id}`;
80
56
  }
81
- class ForkVmNotFoundError extends Error {
82
- constructor(body) {
83
- super(
84
- `FORK_VM_NOT_FOUND: ${body.message}`
85
- );
86
- this.body = body;
87
- this.name = "ForkVmNotFoundError";
88
- }
89
- static code = "FORK_VM_NOT_FOUND";
90
- static statusCode = 404;
91
- static description = `Fork VM not found: {fork_vm_id}`;
92
- }
93
- class CreateSnapshotBadRequestError extends Error {
57
+ class SnapshotVmBadRequestError extends Error {
94
58
  constructor(body) {
95
59
  super(
96
- `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
60
+ `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
97
61
  );
98
62
  this.body = body;
99
- this.name = "CreateSnapshotBadRequestError";
63
+ this.name = "SnapshotVmBadRequestError";
100
64
  }
101
- static code = "CREATE_SNAPSHOT_BAD_REQUEST";
65
+ static code = "SNAPSHOT_VM_BAD_REQUEST";
102
66
  static statusCode = 400;
103
67
  static description = `Bad request: {message}`;
104
68
  }
105
- class SnapshotVmBadRequestError extends Error {
69
+ class KernelPanicError extends Error {
106
70
  constructor(body) {
107
71
  super(
108
- `SNAPSHOT_VM_BAD_REQUEST: ${body.message}`
72
+ `KERNEL_PANIC: ${body.message}`
109
73
  );
110
74
  this.body = body;
111
- this.name = "SnapshotVmBadRequestError";
75
+ this.name = "KernelPanicError";
112
76
  }
113
- static code = "SNAPSHOT_VM_BAD_REQUEST";
114
- static statusCode = 400;
115
- static description = `Bad request: {message}`;
77
+ static code = "KERNEL_PANIC";
78
+ static statusCode = 500;
79
+ static description = `VM kernel panic detected`;
116
80
  }
117
81
  class VmDeletedError extends Error {
118
82
  constructor(body) {
@@ -136,7 +100,7 @@ class ReqwestError extends Error {
136
100
  }
137
101
  static code = "REQWEST";
138
102
  static statusCode = 500;
139
- static description = `Reqwest error`;
103
+ static description = `Reqwest error: {details}`;
140
104
  }
141
105
  class FirecrackerPidNotFoundError extends Error {
142
106
  constructor(body) {
@@ -162,6 +126,18 @@ class FirecrackerApiSocketNotFoundError extends Error {
162
126
  static statusCode = 500;
163
127
  static description = `Firecracker API socket not found`;
164
128
  }
129
+ class InvalidSnapshotIdError extends Error {
130
+ constructor(body) {
131
+ super(
132
+ `INVALID_SNAPSHOT_ID: ${body.message}`
133
+ );
134
+ this.body = body;
135
+ this.name = "InvalidSnapshotIdError";
136
+ }
137
+ static code = "INVALID_SNAPSHOT_ID";
138
+ static statusCode = 400;
139
+ static description = `Invalid snapshot id: {id}`;
140
+ }
165
141
  class VmStartTimeoutError extends Error {
166
142
  constructor(body) {
167
143
  super(
@@ -186,6 +162,18 @@ class VmExitDuringStartError extends Error {
186
162
  static statusCode = 500;
187
163
  static description = `VM process exited unexpectedly during start`;
188
164
  }
165
+ class VmAccessDeniedError extends Error {
166
+ constructor(body) {
167
+ super(
168
+ `VM_ACCESS_DENIED: ${body.message}`
169
+ );
170
+ this.body = body;
171
+ this.name = "VmAccessDeniedError";
172
+ }
173
+ static code = "VM_ACCESS_DENIED";
174
+ static statusCode = 403;
175
+ static description = `You do not have access to this VM`;
176
+ }
189
177
  class StdIoError extends Error {
190
178
  constructor(body) {
191
179
  super(
@@ -222,6 +210,42 @@ class VmSubnetNotFoundError extends Error {
222
210
  static statusCode = 500;
223
211
  static description = `Subnet for VM not found`;
224
212
  }
213
+ class InternalErrorError extends Error {
214
+ constructor(body) {
215
+ super(
216
+ `INTERNAL_ERROR: ${body.message}`
217
+ );
218
+ this.body = body;
219
+ this.name = "InternalErrorError";
220
+ }
221
+ static code = "INTERNAL_ERROR";
222
+ static statusCode = 500;
223
+ static description = `Internal error: {message}`;
224
+ }
225
+ class ForkVmNotFoundError extends Error {
226
+ constructor(body) {
227
+ super(
228
+ `FORK_VM_NOT_FOUND: ${body.message}`
229
+ );
230
+ this.body = body;
231
+ this.name = "ForkVmNotFoundError";
232
+ }
233
+ static code = "FORK_VM_NOT_FOUND";
234
+ static statusCode = 404;
235
+ static description = `Fork VM not found: {fork_vm_id}`;
236
+ }
237
+ class CreateSnapshotBadRequestError extends Error {
238
+ constructor(body) {
239
+ super(
240
+ `CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}`
241
+ );
242
+ this.body = body;
243
+ this.name = "CreateSnapshotBadRequestError";
244
+ }
245
+ static code = "CREATE_SNAPSHOT_BAD_REQUEST";
246
+ static statusCode = 400;
247
+ static description = `Bad request: {message}`;
248
+ }
225
249
  class FileNotFoundError extends Error {
226
250
  constructor(body) {
227
251
  super(
@@ -246,6 +270,54 @@ class FilesBadRequestError extends Error {
246
270
  static statusCode = 400;
247
271
  static description = `Bad request: {message}`;
248
272
  }
273
+ class DockerImportBadRequestError extends Error {
274
+ constructor(body) {
275
+ super(
276
+ `DOCKER_IMPORT_BAD_REQUEST: ${body.message}`
277
+ );
278
+ this.body = body;
279
+ this.name = "DockerImportBadRequestError";
280
+ }
281
+ static code = "DOCKER_IMPORT_BAD_REQUEST";
282
+ static statusCode = 400;
283
+ static description = `Bad request: {message}`;
284
+ }
285
+ class VmMustBeStoppedError extends Error {
286
+ constructor(body) {
287
+ super(
288
+ `VM_MUST_BE_STOPPED: ${body.message}`
289
+ );
290
+ this.body = body;
291
+ this.name = "VmMustBeStoppedError";
292
+ }
293
+ static code = "VM_MUST_BE_STOPPED";
294
+ static statusCode = 400;
295
+ static description = `VM must be stopped before converting to base`;
296
+ }
297
+ class AlreadyHasBaseError extends Error {
298
+ constructor(body) {
299
+ super(
300
+ `ALREADY_HAS_BASE: ${body.message}`
301
+ );
302
+ this.body = body;
303
+ this.name = "AlreadyHasBaseError";
304
+ }
305
+ static code = "ALREADY_HAS_BASE";
306
+ static statusCode = 400;
307
+ static description = `VM already has a base rootfs`;
308
+ }
309
+ class NotFoundError extends Error {
310
+ constructor(body) {
311
+ super(
312
+ `NOT_FOUND: ${body.message}`
313
+ );
314
+ this.body = body;
315
+ this.name = "NotFoundError";
316
+ }
317
+ static code = "NOT_FOUND";
318
+ static statusCode = 404;
319
+ static description = `VM not found`;
320
+ }
249
321
  class VmNotFoundInFsError extends Error {
250
322
  constructor(body) {
251
323
  super(
@@ -318,42 +390,6 @@ class InternalVmNotFoundError extends Error {
318
390
  static statusCode = 404;
319
391
  static description = `VM not found: {vm_id}`;
320
392
  }
321
- class VmMustBeStoppedError extends Error {
322
- constructor(body) {
323
- super(
324
- `VM_MUST_BE_STOPPED: ${body.message}`
325
- );
326
- this.body = body;
327
- this.name = "VmMustBeStoppedError";
328
- }
329
- static code = "VM_MUST_BE_STOPPED";
330
- static statusCode = 400;
331
- static description = `VM must be stopped before converting to base`;
332
- }
333
- class AlreadyHasBaseError extends Error {
334
- constructor(body) {
335
- super(
336
- `ALREADY_HAS_BASE: ${body.message}`
337
- );
338
- this.body = body;
339
- this.name = "AlreadyHasBaseError";
340
- }
341
- static code = "ALREADY_HAS_BASE";
342
- static statusCode = 400;
343
- static description = `VM already has a base rootfs`;
344
- }
345
- class NotFoundError extends Error {
346
- constructor(body) {
347
- super(
348
- `NOT_FOUND: ${body.message}`
349
- );
350
- this.body = body;
351
- this.name = "NotFoundError";
352
- }
353
- static code = "NOT_FOUND";
354
- static statusCode = 404;
355
- static description = `VM not found`;
356
- }
357
393
  class CreateVmBadRequestError extends Error {
358
394
  constructor(body) {
359
395
  super(
@@ -870,341 +906,353 @@ class ExpiredError extends Error {
870
906
  static statusCode = 403;
871
907
  static description = `Session has expired`;
872
908
  }
873
- class ForbiddenError extends Error {
909
+ class TagNotFoundError extends Error {
874
910
  constructor(body) {
875
911
  super(
876
- `FORBIDDEN: ${body.message}`
912
+ `TAG_NOT_FOUND: ${body.message}`
877
913
  );
878
914
  this.body = body;
879
- this.name = "ForbiddenError";
915
+ this.name = "TagNotFoundError";
880
916
  }
881
- static code = "FORBIDDEN";
882
- static statusCode = 403;
883
- static description = `You do not have permission to push to this repository`;
917
+ static code = "TAG_NOT_FOUND";
918
+ static statusCode = 404;
919
+ static description = `Tag not found: {tag}`;
884
920
  }
885
- class UnauthorizedError extends Error {
921
+ class TreeNotFoundError extends Error {
886
922
  constructor(body) {
887
923
  super(
888
- `UNAUTHORIZED: ${body.message}`
924
+ `TREE_NOT_FOUND: ${body.message}`
889
925
  );
890
926
  this.body = body;
891
- this.name = "UnauthorizedError";
927
+ this.name = "TreeNotFoundError";
892
928
  }
893
- static code = "UNAUTHORIZED";
894
- static statusCode = 401;
895
- static description = `Unauthorized`;
929
+ static code = "TREE_NOT_FOUND";
930
+ static statusCode = 404;
931
+ static description = `Tree not found: {hash}`;
896
932
  }
897
- class InvalidServiceError extends Error {
933
+ class BranchNotFoundError extends Error {
898
934
  constructor(body) {
899
935
  super(
900
- `INVALID_SERVICE: ${body.message}`
936
+ `BRANCH_NOT_FOUND: ${body.message}`
901
937
  );
902
938
  this.body = body;
903
- this.name = "InvalidServiceError";
939
+ this.name = "BranchNotFoundError";
904
940
  }
905
- static code = "INVALID_SERVICE";
906
- static statusCode = 403;
907
- static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
941
+ static code = "BRANCH_NOT_FOUND";
942
+ static statusCode = 404;
943
+ static description = `Branch not found: {branch}`;
908
944
  }
909
- class ExpectedServiceError extends Error {
945
+ class ForbiddenError extends Error {
910
946
  constructor(body) {
911
947
  super(
912
- `EXPECTED_SERVICE: ${body.message}`
948
+ `FORBIDDEN: ${body.message}`
913
949
  );
914
950
  this.body = body;
915
- this.name = "ExpectedServiceError";
951
+ this.name = "ForbiddenError";
916
952
  }
917
- static code = "EXPECTED_SERVICE";
953
+ static code = "FORBIDDEN";
918
954
  static statusCode = 403;
919
- static description = `Expected 'service' query parameter`;
955
+ static description = `Forbidden: {message}`;
920
956
  }
921
- class UnsupportedTransferError extends Error {
957
+ class UnauthorizedError extends Error {
922
958
  constructor(body) {
923
959
  super(
924
- `UNSUPPORTED_TRANSFER: ${body.message}`
960
+ `UNAUTHORIZED: ${body.message}`
925
961
  );
926
962
  this.body = body;
927
- this.name = "UnsupportedTransferError";
963
+ this.name = "UnauthorizedError";
928
964
  }
929
- static code = "UNSUPPORTED_TRANSFER";
930
- static statusCode = 400;
931
- static description = `Unsupported LFS transfer protocol(s)`;
965
+ static code = "UNAUTHORIZED";
966
+ static statusCode = 401;
967
+ static description = `Unauthorized: {message}`;
932
968
  }
933
- class ConflictError extends Error {
969
+ class RepoAlreadyExistsError extends Error {
934
970
  constructor(body) {
935
971
  super(
936
- `CONFLICT: ${body.message}`
972
+ `REPO_ALREADY_EXISTS: ${body.message}`
937
973
  );
938
974
  this.body = body;
939
- this.name = "ConflictError";
975
+ this.name = "RepoAlreadyExistsError";
940
976
  }
941
- static code = "CONFLICT";
977
+ static code = "REPO_ALREADY_EXISTS";
942
978
  static statusCode = 409;
943
- static description = `Sync conflict: {message}`;
979
+ static description = `Repository {repo_id} already exists`;
944
980
  }
945
- class BranchNotFoundError extends Error {
981
+ class GitHubSyncConflictError extends Error {
946
982
  constructor(body) {
947
983
  super(
948
- `BRANCH_NOT_FOUND: ${body.message}`
984
+ `GIT_HUB_SYNC_CONFLICT: ${body.message}`
949
985
  );
950
986
  this.body = body;
951
- this.name = "BranchNotFoundError";
987
+ this.name = "GitHubSyncConflictError";
952
988
  }
953
- static code = "BRANCH_NOT_FOUND";
954
- static statusCode = 404;
955
- static description = `Branch not found: {branch}`;
989
+ static code = "GIT_HUB_SYNC_CONFLICT";
990
+ static statusCode = 409;
991
+ static description = `GitHub Sync Conflict: {message}`;
956
992
  }
957
- class SourceImportConflictError extends Error {
993
+ class InvalidObjectIdError extends Error {
958
994
  constructor(body) {
959
995
  super(
960
- `SOURCE_IMPORT_CONFLICT: ${body.message}`
996
+ `INVALID_OBJECT_ID: ${body.message}`
961
997
  );
962
998
  this.body = body;
963
- this.name = "SourceImportConflictError";
999
+ this.name = "InvalidObjectIdError";
964
1000
  }
965
- static code = "SOURCE_IMPORT_CONFLICT";
1001
+ static code = "INVALID_OBJECT_ID";
966
1002
  static statusCode = 400;
967
- static description = `Source and import are mutually exclusive`;
1003
+ static description = `Invalid object ID: {hash}`;
968
1004
  }
969
- class SourceUnauthorizedError extends Error {
1005
+ class CommitNotFoundError extends Error {
970
1006
  constructor(body) {
971
1007
  super(
972
- `SOURCE_UNAUTHORIZED: ${body.message}`
1008
+ `COMMIT_NOT_FOUND: ${body.message}`
973
1009
  );
974
1010
  this.body = body;
975
- this.name = "SourceUnauthorizedError";
1011
+ this.name = "CommitNotFoundError";
976
1012
  }
977
- static code = "SOURCE_UNAUTHORIZED";
978
- static statusCode = 400;
979
- static description = `Unauthorized to access source repository at {url}`;
1013
+ static code = "COMMIT_NOT_FOUND";
1014
+ static statusCode = 404;
1015
+ static description = `Commit {commit_hash} not found in repository {repo_id}`;
980
1016
  }
981
- class SourceNotFoundError extends Error {
1017
+ class PackfileError extends Error {
982
1018
  constructor(body) {
983
1019
  super(
984
- `SOURCE_NOT_FOUND: ${body.message}`
1020
+ `PACKFILE: ${body.message}`
985
1021
  );
986
1022
  this.body = body;
987
- this.name = "SourceNotFoundError";
1023
+ this.name = "PackfileError";
988
1024
  }
989
- static code = "SOURCE_NOT_FOUND";
990
- static statusCode = 400;
991
- static description = `Source repository not found at {url}`;
1025
+ static code = "PACKFILE";
1026
+ static statusCode = 500;
1027
+ static description = `Error building packfile`;
992
1028
  }
993
- class ImportSubdirNotFoundError extends Error {
1029
+ class SendErrorError extends Error {
994
1030
  constructor(body) {
995
1031
  super(
996
- `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1032
+ `SEND_ERROR: ${body.message}`
997
1033
  );
998
1034
  this.body = body;
999
- this.name = "ImportSubdirNotFoundError";
1035
+ this.name = "SendErrorError";
1000
1036
  }
1001
- static code = "IMPORT_SUBDIR_NOT_FOUND";
1002
- static statusCode = 400;
1003
- static description = `Directory not found in {source}: {dir}`;
1037
+ static code = "SEND_ERROR";
1038
+ static statusCode = 500;
1039
+ static description = `Stream receiver dropped`;
1004
1040
  }
1005
- class RepoAlreadyExistsError extends Error {
1041
+ class UnsupportedTransferError extends Error {
1006
1042
  constructor(body) {
1007
1043
  super(
1008
- `REPO_ALREADY_EXISTS: ${body.message}`
1044
+ `UNSUPPORTED_TRANSFER: ${body.message}`
1009
1045
  );
1010
1046
  this.body = body;
1011
- this.name = "RepoAlreadyExistsError";
1047
+ this.name = "UnsupportedTransferError";
1012
1048
  }
1013
- static code = "REPO_ALREADY_EXISTS";
1014
- static statusCode = 409;
1015
- static description = `Repo '{repo_id}' already exists`;
1049
+ static code = "UNSUPPORTED_TRANSFER";
1050
+ static statusCode = 400;
1051
+ static description = `Unsupported LFS transfer protocol(s)`;
1016
1052
  }
1017
- class PathNotFoundError extends Error {
1053
+ class InvalidRangeError extends Error {
1018
1054
  constructor(body) {
1019
1055
  super(
1020
- `PATH_NOT_FOUND: ${body.message}`
1056
+ `INVALID_RANGE: ${body.message}`
1021
1057
  );
1022
1058
  this.body = body;
1023
- this.name = "PathNotFoundError";
1059
+ this.name = "InvalidRangeError";
1024
1060
  }
1025
- static code = "PATH_NOT_FOUND";
1026
- static statusCode = 404;
1027
- static description = `Path not found: {path}`;
1061
+ static code = "INVALID_RANGE";
1062
+ static statusCode = 400;
1063
+ 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.`;
1028
1064
  }
1029
- class ReferenceNotFoundError extends Error {
1065
+ class OffsetWithSelectorError extends Error {
1030
1066
  constructor(body) {
1031
1067
  super(
1032
- `REFERENCE_NOT_FOUND: ${body.message}`
1068
+ `OFFSET_WITH_SELECTOR: ${body.message}`
1033
1069
  );
1034
1070
  this.body = body;
1035
- this.name = "ReferenceNotFoundError";
1071
+ this.name = "OffsetWithSelectorError";
1036
1072
  }
1037
- static code = "REFERENCE_NOT_FOUND";
1038
- static statusCode = 404;
1039
- static description = `Reference not found: {reference}`;
1073
+ static code = "OFFSET_WITH_SELECTOR";
1074
+ static statusCode = 400;
1075
+ static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1040
1076
  }
1041
- class TagNotFoundError extends Error {
1077
+ class CommitNotInBranchError extends Error {
1042
1078
  constructor(body) {
1043
1079
  super(
1044
- `TAG_NOT_FOUND: ${body.message}`
1080
+ `COMMIT_NOT_IN_BRANCH: ${body.message}`
1045
1081
  );
1046
1082
  this.body = body;
1047
- this.name = "TagNotFoundError";
1083
+ this.name = "CommitNotInBranchError";
1048
1084
  }
1049
- static code = "TAG_NOT_FOUND";
1050
- static statusCode = 404;
1051
- static description = `Tag not found: {hash}`;
1085
+ static code = "COMMIT_NOT_IN_BRANCH";
1086
+ static statusCode = 400;
1087
+ static description = `Commit {sha} is not in the history of branch {branch}`;
1052
1088
  }
1053
- class SendErrorError extends Error {
1089
+ class BlobNotFoundError extends Error {
1054
1090
  constructor(body) {
1055
1091
  super(
1056
- `SEND_ERROR: ${body.message}`
1092
+ `BLOB_NOT_FOUND: ${body.message}`
1057
1093
  );
1058
1094
  this.body = body;
1059
- this.name = "SendErrorError";
1095
+ this.name = "BlobNotFoundError";
1060
1096
  }
1061
- static code = "SEND_ERROR";
1062
- static statusCode = 500;
1063
- static description = `Stream receiver dropped`;
1097
+ static code = "BLOB_NOT_FOUND";
1098
+ static statusCode = 404;
1099
+ static description = `Blob not found: {hash}`;
1064
1100
  }
1065
- class GitHubSyncConflictError extends Error {
1101
+ class InvalidServiceError extends Error {
1066
1102
  constructor(body) {
1067
1103
  super(
1068
- `GIT_HUB_SYNC_CONFLICT: ${body.message}`
1104
+ `INVALID_SERVICE: ${body.message}`
1069
1105
  );
1070
1106
  this.body = body;
1071
- this.name = "GitHubSyncConflictError";
1107
+ this.name = "InvalidServiceError";
1072
1108
  }
1073
- static code = "GIT_HUB_SYNC_CONFLICT";
1074
- static statusCode = 409;
1075
- static description = `GitHub Sync Conflict: {message}`;
1109
+ static code = "INVALID_SERVICE";
1110
+ static statusCode = 403;
1111
+ static description = `Invalid service '{invalid}', expected 'git-upload-pack' or 'git-receive-pack'`;
1076
1112
  }
1077
- class InvalidObjectIdError extends Error {
1113
+ class ExpectedServiceError extends Error {
1078
1114
  constructor(body) {
1079
1115
  super(
1080
- `INVALID_OBJECT_ID: ${body.message}`
1116
+ `EXPECTED_SERVICE: ${body.message}`
1081
1117
  );
1082
1118
  this.body = body;
1083
- this.name = "InvalidObjectIdError";
1119
+ this.name = "ExpectedServiceError";
1084
1120
  }
1085
- static code = "INVALID_OBJECT_ID";
1086
- static statusCode = 400;
1087
- static description = `Invalid object ID: {hash}`;
1121
+ static code = "EXPECTED_SERVICE";
1122
+ static statusCode = 403;
1123
+ static description = `Expected 'service' query parameter`;
1088
1124
  }
1089
- class CommitNotFoundError extends Error {
1125
+ class PathNotFoundError extends Error {
1090
1126
  constructor(body) {
1091
1127
  super(
1092
- `COMMIT_NOT_FOUND: ${body.message}`
1128
+ `PATH_NOT_FOUND: ${body.message}`
1093
1129
  );
1094
1130
  this.body = body;
1095
- this.name = "CommitNotFoundError";
1131
+ this.name = "PathNotFoundError";
1096
1132
  }
1097
- static code = "COMMIT_NOT_FOUND";
1133
+ static code = "PATH_NOT_FOUND";
1098
1134
  static statusCode = 404;
1099
- static description = `Commit {commit_hash} not found in repository {repo_id}`;
1135
+ static description = `Path not found: {path}`;
1100
1136
  }
1101
- class TreeNotFoundError extends Error {
1137
+ class ReferenceNotFoundError extends Error {
1102
1138
  constructor(body) {
1103
1139
  super(
1104
- `TREE_NOT_FOUND: ${body.message}`
1140
+ `REFERENCE_NOT_FOUND: ${body.message}`
1105
1141
  );
1106
1142
  this.body = body;
1107
- this.name = "TreeNotFoundError";
1143
+ this.name = "ReferenceNotFoundError";
1108
1144
  }
1109
- static code = "TREE_NOT_FOUND";
1145
+ static code = "REFERENCE_NOT_FOUND";
1110
1146
  static statusCode = 404;
1111
- static description = `Tree not found: {hash}`;
1147
+ static description = `Reference not found: {reference}`;
1112
1148
  }
1113
- class InvalidRevisionError extends Error {
1149
+ class AmbiguousError extends Error {
1114
1150
  constructor(body) {
1115
1151
  super(
1116
- `INVALID_REVISION: ${body.message}`
1152
+ `AMBIGUOUS: ${body.message}`
1117
1153
  );
1118
1154
  this.body = body;
1119
- this.name = "InvalidRevisionError";
1155
+ this.name = "AmbiguousError";
1120
1156
  }
1121
- static code = "INVALID_REVISION";
1157
+ static code = "AMBIGUOUS";
1122
1158
  static statusCode = 400;
1123
- static description = `Invalid revision: {revision}`;
1159
+ static description = `rev is ambiguous: {rev}`;
1124
1160
  }
1125
- class InvalidRangeError extends Error {
1161
+ class InvalidError extends Error {
1126
1162
  constructor(body) {
1127
1163
  super(
1128
- `INVALID_RANGE: ${body.message}`
1164
+ `INVALID: ${body.message}`
1129
1165
  );
1130
1166
  this.body = body;
1131
- this.name = "InvalidRangeError";
1167
+ this.name = "InvalidError";
1132
1168
  }
1133
- static code = "INVALID_RANGE";
1169
+ static code = "INVALID";
1134
1170
  static statusCode = 400;
1135
- static description = `Invalid range: 'until' commit ({until}) must be a descendant of 'since' commit ({since}). In other words, 'until' must be newer than 'since' in the commit graph.`;
1171
+ static description = `invalid rev syntax: {rev}`;
1136
1172
  }
1137
- class OffsetWithSelectorError extends Error {
1173
+ class InvalidAccountIdError extends Error {
1138
1174
  constructor(body) {
1139
1175
  super(
1140
- `OFFSET_WITH_SELECTOR: ${body.message}`
1176
+ `INVALID_ACCOUNT_ID: ${body.message}`
1141
1177
  );
1142
1178
  this.body = body;
1143
- this.name = "OffsetWithSelectorError";
1179
+ this.name = "InvalidAccountIdError";
1144
1180
  }
1145
- static code = "OFFSET_WITH_SELECTOR";
1181
+ static code = "INVALID_ACCOUNT_ID";
1146
1182
  static statusCode = 400;
1147
- static description = `Cannot use 'offset' parameter together with 'since' or 'until'. Use 'since' for cursor-based pagination.`;
1183
+ static description = `Invalid account ID: {account_id}`;
1148
1184
  }
1149
- class CommitNotInBranchError extends Error {
1185
+ class SourceImportConflictError extends Error {
1150
1186
  constructor(body) {
1151
1187
  super(
1152
- `COMMIT_NOT_IN_BRANCH: ${body.message}`
1188
+ `SOURCE_IMPORT_CONFLICT: ${body.message}`
1153
1189
  );
1154
1190
  this.body = body;
1155
- this.name = "CommitNotInBranchError";
1191
+ this.name = "SourceImportConflictError";
1156
1192
  }
1157
- static code = "COMMIT_NOT_IN_BRANCH";
1193
+ static code = "SOURCE_IMPORT_CONFLICT";
1158
1194
  static statusCode = 400;
1159
- static description = `Commit {sha} is not in the history of branch {branch}`;
1195
+ static description = `Source and import are mutually exclusive`;
1160
1196
  }
1161
- class BlobNotFoundError extends Error {
1197
+ class SourceUnauthorizedError extends Error {
1162
1198
  constructor(body) {
1163
1199
  super(
1164
- `BLOB_NOT_FOUND: ${body.message}`
1200
+ `SOURCE_UNAUTHORIZED: ${body.message}`
1165
1201
  );
1166
1202
  this.body = body;
1167
- this.name = "BlobNotFoundError";
1203
+ this.name = "SourceUnauthorizedError";
1168
1204
  }
1169
- static code = "BLOB_NOT_FOUND";
1170
- static statusCode = 404;
1171
- static description = `Blob not found: {hash}`;
1205
+ static code = "SOURCE_UNAUTHORIZED";
1206
+ static statusCode = 400;
1207
+ static description = `Unauthorized to access source repository at {url}`;
1172
1208
  }
1173
- class AmbiguousError extends Error {
1209
+ class SourceNotFoundError extends Error {
1174
1210
  constructor(body) {
1175
1211
  super(
1176
- `AMBIGUOUS: ${body.message}`
1212
+ `SOURCE_NOT_FOUND: ${body.message}`
1177
1213
  );
1178
1214
  this.body = body;
1179
- this.name = "AmbiguousError";
1215
+ this.name = "SourceNotFoundError";
1180
1216
  }
1181
- static code = "AMBIGUOUS";
1217
+ static code = "SOURCE_NOT_FOUND";
1182
1218
  static statusCode = 400;
1183
- static description = `rev is ambiguous: {rev}`;
1219
+ static description = `Source repository not found at {url}`;
1184
1220
  }
1185
- class InvalidError extends Error {
1221
+ class ImportSubdirNotFoundError extends Error {
1186
1222
  constructor(body) {
1187
1223
  super(
1188
- `INVALID: ${body.message}`
1224
+ `IMPORT_SUBDIR_NOT_FOUND: ${body.message}`
1189
1225
  );
1190
1226
  this.body = body;
1191
- this.name = "InvalidError";
1227
+ this.name = "ImportSubdirNotFoundError";
1192
1228
  }
1193
- static code = "INVALID";
1229
+ static code = "IMPORT_SUBDIR_NOT_FOUND";
1194
1230
  static statusCode = 400;
1195
- static description = `invalid rev syntax: {rev}`;
1231
+ static description = `Directory not found in {source}: {dir}`;
1196
1232
  }
1197
- class PackfileError extends Error {
1233
+ class ConflictError extends Error {
1198
1234
  constructor(body) {
1199
1235
  super(
1200
- `PACKFILE: ${body.message}`
1236
+ `CONFLICT: ${body.message}`
1201
1237
  );
1202
1238
  this.body = body;
1203
- this.name = "PackfileError";
1239
+ this.name = "ConflictError";
1204
1240
  }
1205
- static code = "PACKFILE";
1206
- static statusCode = 500;
1207
- static description = `Error building packfile`;
1241
+ static code = "CONFLICT";
1242
+ static statusCode = 409;
1243
+ static description = `Sync conflict: {message}`;
1244
+ }
1245
+ class InvalidRevisionError extends Error {
1246
+ constructor(body) {
1247
+ super(
1248
+ `INVALID_REVISION: ${body.message}`
1249
+ );
1250
+ this.body = body;
1251
+ this.name = "InvalidRevisionError";
1252
+ }
1253
+ static code = "INVALID_REVISION";
1254
+ static statusCode = 400;
1255
+ static description = `Invalid revision: {revision}`;
1208
1256
  }
1209
1257
  class DatabaseErrorError extends Error {
1210
1258
  constructor(body) {
@@ -1218,1512 +1266,1503 @@ class DatabaseErrorError extends Error {
1218
1266
  static statusCode = 500;
1219
1267
  static description = `Database error: {0}`;
1220
1268
  }
1221
- class EmptyTagError extends Error {
1269
+ class DevServerNotFoundError extends Error {
1222
1270
  constructor(body) {
1223
1271
  super(
1224
- `EMPTY_TAG: ${body.message}`
1272
+ `DEV_SERVER_NOT_FOUND: ${body.message}`
1225
1273
  );
1226
1274
  this.body = body;
1227
- this.name = "EmptyTagError";
1275
+ this.name = "DevServerNotFoundError";
1228
1276
  }
1229
- static code = "EMPTY_TAG";
1230
- static statusCode = 400;
1231
- static description = `Invalid request: tag cannot be empty`;
1232
- }
1233
- class ResizeFailedError extends Error {
1277
+ static code = "DEV_SERVER_NOT_FOUND";
1278
+ static statusCode = 404;
1279
+ static description = `dev server not found`;
1280
+ }
1281
+ class EmptyTagError extends Error {
1234
1282
  constructor(body) {
1235
1283
  super(
1236
- `RESIZE_FAILED: ${body.message}`
1284
+ `EMPTY_TAG: ${body.message}`
1237
1285
  );
1238
1286
  this.body = body;
1239
- this.name = "ResizeFailedError";
1287
+ this.name = "EmptyTagError";
1240
1288
  }
1241
- static code = "RESIZE_FAILED";
1242
- static statusCode = 500;
1243
- static description = `Failed to resize VM: {message}`;
1289
+ static code = "EMPTY_TAG";
1290
+ static statusCode = 400;
1291
+ static description = `Invalid request: tag cannot be empty`;
1244
1292
  }
1245
- class InternalResizeVmNotFoundError extends Error {
1293
+ class BuildFailedError extends Error {
1246
1294
  constructor(body) {
1247
1295
  super(
1248
- `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
1296
+ `BUILD_FAILED: ${body.message}`
1249
1297
  );
1250
1298
  this.body = body;
1251
- this.name = "InternalResizeVmNotFoundError";
1299
+ this.name = "BuildFailedError";
1252
1300
  }
1253
- static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
1254
- static statusCode = 404;
1255
- static description = `VM not found`;
1301
+ static code = "BUILD_FAILED";
1302
+ static statusCode = 500;
1303
+ static description = `Build failed on VM {vm_id}`;
1256
1304
  }
1257
- class DomainOwnershipVerificationFailedError extends Error {
1305
+ class ServerDeploymentFailedError extends Error {
1258
1306
  constructor(body) {
1259
1307
  super(
1260
- `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
1308
+ `SERVER_DEPLOYMENT_FAILED: ${body.message}`
1261
1309
  );
1262
1310
  this.body = body;
1263
- this.name = "DomainOwnershipVerificationFailedError";
1311
+ this.name = "ServerDeploymentFailedError";
1264
1312
  }
1265
- static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
1266
- static statusCode = 403;
1267
- static description = `Domain ownership verification failed`;
1313
+ static code = "SERVER_DEPLOYMENT_FAILED";
1314
+ static statusCode = 502;
1315
+ static description = `Failed to deploy to servers`;
1268
1316
  }
1269
- class ErrorDeletingRecordError extends Error {
1317
+ class LockfileErrorError extends Error {
1270
1318
  constructor(body) {
1271
1319
  super(
1272
- `ERROR_DELETING_RECORD: ${body.message}`
1320
+ `LOCKFILE_ERROR: ${body.message}`
1273
1321
  );
1274
1322
  this.body = body;
1275
- this.name = "ErrorDeletingRecordError";
1323
+ this.name = "LockfileErrorError";
1276
1324
  }
1277
- static code = "ERROR_DELETING_RECORD";
1325
+ static code = "LOCKFILE_ERROR";
1278
1326
  static statusCode = 500;
1279
- static description = `Error deleting DNS record for {domain}/{name}: {message}`;
1327
+ static description = `Failed to generate dependency lockfile: {message}`;
1280
1328
  }
1281
- class RecordOwnershipErrorError extends Error {
1329
+ class UploadErrorError extends Error {
1282
1330
  constructor(body) {
1283
1331
  super(
1284
- `RECORD_OWNERSHIP_ERROR: ${body.message}`
1332
+ `UPLOAD_ERROR: ${body.message}`
1285
1333
  );
1286
1334
  this.body = body;
1287
- this.name = "RecordOwnershipErrorError";
1335
+ this.name = "UploadErrorError";
1288
1336
  }
1289
- static code = "RECORD_OWNERSHIP_ERROR";
1290
- static statusCode = 403;
1291
- static description = `Account {account_id} does not own record {record_id}`;
1337
+ static code = "UPLOAD_ERROR";
1338
+ static statusCode = 500;
1339
+ static description = `Failed to upload deployment to storage`;
1292
1340
  }
1293
- class ErrorCreatingRecordError extends Error {
1341
+ class DomainMappingErrorError extends Error {
1294
1342
  constructor(body) {
1295
1343
  super(
1296
- `ERROR_CREATING_RECORD: ${body.message}`
1344
+ `DOMAIN_MAPPING_ERROR: ${body.message}`
1297
1345
  );
1298
1346
  this.body = body;
1299
- this.name = "ErrorCreatingRecordError";
1347
+ this.name = "DomainMappingErrorError";
1300
1348
  }
1301
- static code = "ERROR_CREATING_RECORD";
1349
+ static code = "DOMAIN_MAPPING_ERROR";
1302
1350
  static statusCode = 500;
1303
- static description = `Error creating DNS record: {message}`;
1351
+ static description = `Failed to configure domain mapping for: {domain}`;
1304
1352
  }
1305
- class DomainOwnershipErrorError extends Error {
1353
+ class CertificateProvisioningErrorError extends Error {
1306
1354
  constructor(body) {
1307
1355
  super(
1308
- `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
1356
+ `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
1309
1357
  );
1310
1358
  this.body = body;
1311
- this.name = "DomainOwnershipErrorError";
1359
+ this.name = "CertificateProvisioningErrorError";
1312
1360
  }
1313
- static code = "DOMAIN_OWNERSHIP_ERROR";
1314
- static statusCode = 403;
1315
- static description = `Account {account_id} does not own domain {domain}`;
1361
+ static code = "CERTIFICATE_PROVISIONING_ERROR";
1362
+ static statusCode = 502;
1363
+ static description = `Failed to provision certificate for domain: {domain}`;
1316
1364
  }
1317
- class BrowserOperationFailedError extends Error {
1365
+ class NoEntrypointFoundError extends Error {
1318
1366
  constructor(body) {
1319
1367
  super(
1320
- `BROWSER_OPERATION_FAILED: ${body.message}`
1368
+ `NO_ENTRYPOINT_FOUND: ${body.message}`
1321
1369
  );
1322
1370
  this.body = body;
1323
- this.name = "BrowserOperationFailedError";
1371
+ this.name = "NoEntrypointFoundError";
1324
1372
  }
1325
- static code = "BROWSER_OPERATION_FAILED";
1326
- static statusCode = 500;
1327
- static description = `Browser operation failed: {message}`;
1373
+ static code = "NO_ENTRYPOINT_FOUND";
1374
+ static statusCode = 400;
1375
+ static description = `No entrypoint found in deployment`;
1328
1376
  }
1329
- class WatchFilesFailedError extends Error {
1377
+ class EntrypointNotFoundError extends Error {
1330
1378
  constructor(body) {
1331
1379
  super(
1332
- `WATCH_FILES_FAILED: ${body.message}`
1380
+ `ENTRYPOINT_NOT_FOUND: ${body.message}`
1333
1381
  );
1334
1382
  this.body = body;
1335
- this.name = "WatchFilesFailedError";
1383
+ this.name = "EntrypointNotFoundError";
1336
1384
  }
1337
- static code = "WATCH_FILES_FAILED";
1338
- static statusCode = 500;
1339
- static description = `Failed to watch files: {message}`;
1385
+ static code = "ENTRYPOINT_NOT_FOUND";
1386
+ static statusCode = 400;
1387
+ static description = `Entrypoint not found: {entrypoint}`;
1340
1388
  }
1341
- class LogsFailedError extends Error {
1389
+ class NoDomainOwnershipError extends Error {
1342
1390
  constructor(body) {
1343
1391
  super(
1344
- `LOGS_FAILED: ${body.message}`
1392
+ `NO_DOMAIN_OWNERSHIP: ${body.message}`
1345
1393
  );
1346
1394
  this.body = body;
1347
- this.name = "LogsFailedError";
1395
+ this.name = "NoDomainOwnershipError";
1348
1396
  }
1349
- static code = "LOGS_FAILED";
1350
- static statusCode = 500;
1351
- static description = `Failed to get logs: {message}`;
1397
+ static code = "NO_DOMAIN_OWNERSHIP";
1398
+ static statusCode = 403;
1399
+ static description = `No domain ownership for: {domain}`;
1352
1400
  }
1353
- class StatusFailedError extends Error {
1401
+ class InvalidDomainsError extends Error {
1354
1402
  constructor(body) {
1355
1403
  super(
1356
- `STATUS_FAILED: ${body.message}`
1404
+ `INVALID_DOMAINS: ${body.message}`
1357
1405
  );
1358
1406
  this.body = body;
1359
- this.name = "StatusFailedError";
1407
+ this.name = "InvalidDomainsError";
1360
1408
  }
1361
- static code = "STATUS_FAILED";
1362
- static statusCode = 500;
1363
- static description = `Failed to get dev server status: {message}`;
1409
+ static code = "INVALID_DOMAINS";
1410
+ static statusCode = 400;
1411
+ static description = `Invalid domains provided`;
1364
1412
  }
1365
- class RestartFailedError extends Error {
1413
+ class WebDeploymentBadRequestError extends Error {
1366
1414
  constructor(body) {
1367
1415
  super(
1368
- `RESTART_FAILED: ${body.message}`
1416
+ `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
1369
1417
  );
1370
1418
  this.body = body;
1371
- this.name = "RestartFailedError";
1419
+ this.name = "WebDeploymentBadRequestError";
1372
1420
  }
1373
- static code = "RESTART_FAILED";
1374
- static statusCode = 500;
1375
- static description = `Failed to restart dev server: {message}`;
1421
+ static code = "WEB_DEPLOYMENT_BAD_REQUEST";
1422
+ static statusCode = 400;
1423
+ static description = `Bad request: {message}`;
1376
1424
  }
1377
- class ShutdownFailedError extends Error {
1425
+ class DeploymentNotFoundError extends Error {
1378
1426
  constructor(body) {
1379
1427
  super(
1380
- `SHUTDOWN_FAILED: ${body.message}`
1428
+ `DEPLOYMENT_NOT_FOUND: ${body.message}`
1381
1429
  );
1382
1430
  this.body = body;
1383
- this.name = "ShutdownFailedError";
1431
+ this.name = "DeploymentNotFoundError";
1384
1432
  }
1385
- static code = "SHUTDOWN_FAILED";
1386
- static statusCode = 500;
1387
- static description = `Failed to shutdown dev server: {message}`;
1433
+ static code = "DEPLOYMENT_NOT_FOUND";
1434
+ static statusCode = 404;
1435
+ static description = `Deployment not found`;
1388
1436
  }
1389
- class CommitFailedError extends Error {
1437
+ class ResizeFailedError extends Error {
1390
1438
  constructor(body) {
1391
1439
  super(
1392
- `COMMIT_FAILED: ${body.message}`
1440
+ `RESIZE_FAILED: ${body.message}`
1393
1441
  );
1394
1442
  this.body = body;
1395
- this.name = "CommitFailedError";
1443
+ this.name = "ResizeFailedError";
1396
1444
  }
1397
- static code = "COMMIT_FAILED";
1445
+ static code = "RESIZE_FAILED";
1398
1446
  static statusCode = 500;
1399
- static description = `Failed to commit changes: {message}`;
1447
+ static description = `Failed to resize VM: {message}`;
1400
1448
  }
1401
- class WriteFileFailedError extends Error {
1449
+ class InternalResizeVmNotFoundError extends Error {
1402
1450
  constructor(body) {
1403
1451
  super(
1404
- `WRITE_FILE_FAILED: ${body.message}`
1452
+ `INTERNAL_RESIZE_VM_NOT_FOUND: ${body.message}`
1405
1453
  );
1406
1454
  this.body = body;
1407
- this.name = "WriteFileFailedError";
1455
+ this.name = "InternalResizeVmNotFoundError";
1408
1456
  }
1409
- static code = "WRITE_FILE_FAILED";
1410
- static statusCode = 500;
1411
- static description = `Failed to write file: {message}`;
1457
+ static code = "INTERNAL_RESIZE_VM_NOT_FOUND";
1458
+ static statusCode = 404;
1459
+ static description = `VM not found`;
1412
1460
  }
1413
- class ReadFileFailedError extends Error {
1461
+ class TriggerErrorError extends Error {
1414
1462
  constructor(body) {
1415
1463
  super(
1416
- `READ_FILE_FAILED: ${body.message}`
1464
+ `TRIGGER_ERROR: ${body.message}`
1417
1465
  );
1418
1466
  this.body = body;
1419
- this.name = "ReadFileFailedError";
1467
+ this.name = "TriggerErrorError";
1420
1468
  }
1421
- static code = "READ_FILE_FAILED";
1469
+ static code = "TRIGGER_ERROR";
1422
1470
  static statusCode = 500;
1423
- static description = `Failed to read file: {message}`;
1471
+ static description = `Failed to manage triggers: {message}`;
1424
1472
  }
1425
- class ExecutionFailedError extends Error {
1473
+ class TokenErrorError extends Error {
1426
1474
  constructor(body) {
1427
1475
  super(
1428
- `EXECUTION_FAILED: ${body.message}`
1476
+ `TOKEN_ERROR: ${body.message}`
1429
1477
  );
1430
1478
  this.body = body;
1431
- this.name = "ExecutionFailedError";
1479
+ this.name = "TokenErrorError";
1432
1480
  }
1433
- static code = "EXECUTION_FAILED";
1481
+ static code = "TOKEN_ERROR";
1434
1482
  static statusCode = 500;
1435
- static description = `Failed to execute command: {message}`;
1483
+ static description = `Failed to manage tokens: {message}`;
1436
1484
  }
1437
- class RequestFailedError extends Error {
1485
+ class PermissionErrorError extends Error {
1438
1486
  constructor(body) {
1439
1487
  super(
1440
- `REQUEST_FAILED: ${body.message}`
1488
+ `PERMISSION_ERROR: ${body.message}`
1441
1489
  );
1442
1490
  this.body = body;
1443
- this.name = "RequestFailedError";
1491
+ this.name = "PermissionErrorError";
1444
1492
  }
1445
- static code = "REQUEST_FAILED";
1493
+ static code = "PERMISSION_ERROR";
1446
1494
  static statusCode = 500;
1447
- static description = `Failed to request dev server: {message}`;
1495
+ static description = `Failed to manage permissions: {message}`;
1448
1496
  }
1449
- class DevServerFileNotFoundError extends Error {
1497
+ class IdentityErrorError extends Error {
1450
1498
  constructor(body) {
1451
1499
  super(
1452
- `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
1500
+ `IDENTITY_ERROR: ${body.message}`
1453
1501
  );
1454
1502
  this.body = body;
1455
- this.name = "DevServerFileNotFoundError";
1503
+ this.name = "IdentityErrorError";
1456
1504
  }
1457
- static code = "DEV_SERVER_FILE_NOT_FOUND";
1458
- static statusCode = 404;
1459
- static description = `Dev server file not found: {path}`;
1505
+ static code = "IDENTITY_ERROR";
1506
+ static statusCode = 500;
1507
+ static description = `Failed to manage identity: {message}`;
1460
1508
  }
1461
- class DevServerInvalidRequestError extends Error {
1509
+ class GetContentFailedError extends Error {
1462
1510
  constructor(body) {
1463
1511
  super(
1464
- `DEV_SERVER_INVALID_REQUEST: ${body.message}`
1512
+ `GET_CONTENT_FAILED: ${body.message}`
1465
1513
  );
1466
1514
  this.body = body;
1467
- this.name = "DevServerInvalidRequestError";
1515
+ this.name = "GetContentFailedError";
1468
1516
  }
1469
- static code = "DEV_SERVER_INVALID_REQUEST";
1470
- static statusCode = 400;
1471
- static description = `Invalid dev server request: {message}`;
1517
+ static code = "GET_CONTENT_FAILED";
1518
+ static statusCode = 500;
1519
+ static description = `Failed to get content: {message}`;
1472
1520
  }
1473
- class DevServerNotFoundError extends Error {
1521
+ class ContentNotFoundError extends Error {
1474
1522
  constructor(body) {
1475
1523
  super(
1476
- `DEV_SERVER_NOT_FOUND: ${body.message}`
1524
+ `CONTENT_NOT_FOUND: ${body.message}`
1477
1525
  );
1478
1526
  this.body = body;
1479
- this.name = "DevServerNotFoundError";
1527
+ this.name = "ContentNotFoundError";
1480
1528
  }
1481
- static code = "DEV_SERVER_NOT_FOUND";
1529
+ static code = "CONTENT_NOT_FOUND";
1482
1530
  static statusCode = 404;
1483
- static description = `Dev server not found: {server_id}`;
1531
+ static description = `Content not found: {path}`;
1484
1532
  }
1485
- class AnyhowError extends Error {
1533
+ class DownloadFailedError extends Error {
1486
1534
  constructor(body) {
1487
1535
  super(
1488
- `ANYHOW: ${body.message}`
1536
+ `DOWNLOAD_FAILED: ${body.message}`
1489
1537
  );
1490
1538
  this.body = body;
1491
- this.name = "AnyhowError";
1539
+ this.name = "DownloadFailedError";
1492
1540
  }
1493
- static code = "ANYHOW";
1541
+ static code = "DOWNLOAD_FAILED";
1494
1542
  static statusCode = 500;
1495
- static description = `Internal server error: {0}`;
1543
+ static description = `Failed to download repository: {message}`;
1496
1544
  }
1497
- class BranchNameEmptyError extends Error {
1545
+ class GitServerErrorError extends Error {
1498
1546
  constructor(body) {
1499
1547
  super(
1500
- `BRANCH_NAME_EMPTY: ${body.message}`
1548
+ `GIT_SERVER_ERROR: ${body.message}`
1501
1549
  );
1502
1550
  this.body = body;
1503
- this.name = "BranchNameEmptyError";
1551
+ this.name = "GitServerErrorError";
1504
1552
  }
1505
- static code = "BRANCH_NAME_EMPTY";
1506
- static statusCode = 400;
1507
- static description = `Branch name cannot be empty`;
1508
- }
1509
- class PermissionAlreadyExistsError extends Error {
1510
- constructor(body) {
1511
- super(
1512
- `PERMISSION_ALREADY_EXISTS: ${body.message}`
1513
- );
1514
- this.body = body;
1515
- this.name = "PermissionAlreadyExistsError";
1516
- }
1517
- static code = "PERMISSION_ALREADY_EXISTS";
1518
- static statusCode = 409;
1519
- static description = `Permission already exists`;
1553
+ static code = "GIT_SERVER_ERROR";
1554
+ static statusCode = 500;
1555
+ static description = `Git server error: {message}`;
1520
1556
  }
1521
- class ListTokensFailedError extends Error {
1557
+ class ParseResponseErrorError extends Error {
1522
1558
  constructor(body) {
1523
1559
  super(
1524
- `LIST_TOKENS_FAILED: ${body.message}`
1560
+ `PARSE_RESPONSE_ERROR: ${body.message}`
1525
1561
  );
1526
1562
  this.body = body;
1527
- this.name = "ListTokensFailedError";
1563
+ this.name = "ParseResponseErrorError";
1528
1564
  }
1529
- static code = "LIST_TOKENS_FAILED";
1565
+ static code = "PARSE_RESPONSE_ERROR";
1530
1566
  static statusCode = 500;
1531
- static description = `Failed to list tokens: {message}`;
1567
+ static description = `Failed to parse response from Git server: {message}`;
1532
1568
  }
1533
- class RevokeTokenFailedError extends Error {
1569
+ class RepositoryAccessDeniedError extends Error {
1534
1570
  constructor(body) {
1535
1571
  super(
1536
- `REVOKE_TOKEN_FAILED: ${body.message}`
1572
+ `REPOSITORY_ACCESS_DENIED: ${body.message}`
1537
1573
  );
1538
1574
  this.body = body;
1539
- this.name = "RevokeTokenFailedError";
1575
+ this.name = "RepositoryAccessDeniedError";
1540
1576
  }
1541
- static code = "REVOKE_TOKEN_FAILED";
1542
- static statusCode = 500;
1543
- static description = `Failed to revoke token: {message}`;
1577
+ static code = "REPOSITORY_ACCESS_DENIED";
1578
+ static statusCode = 403;
1579
+ static description = `Repository does not belong to account`;
1544
1580
  }
1545
- class CreateTokenFailedError extends Error {
1581
+ class GitHubSyncFailedError extends Error {
1546
1582
  constructor(body) {
1547
1583
  super(
1548
- `CREATE_TOKEN_FAILED: ${body.message}`
1584
+ `GIT_HUB_SYNC_FAILED: ${body.message}`
1549
1585
  );
1550
1586
  this.body = body;
1551
- this.name = "CreateTokenFailedError";
1587
+ this.name = "GitHubSyncFailedError";
1552
1588
  }
1553
- static code = "CREATE_TOKEN_FAILED";
1589
+ static code = "GIT_HUB_SYNC_FAILED";
1554
1590
  static statusCode = 500;
1555
- static description = `Failed to create token: {message}`;
1591
+ static description = `Failed to configure GitHub sync: {message}`;
1556
1592
  }
1557
- class ListPermissionsFailedError extends Error {
1593
+ class UpdateDefaultBranchFailedError extends Error {
1558
1594
  constructor(body) {
1559
1595
  super(
1560
- `LIST_PERMISSIONS_FAILED: ${body.message}`
1596
+ `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
1561
1597
  );
1562
1598
  this.body = body;
1563
- this.name = "ListPermissionsFailedError";
1599
+ this.name = "UpdateDefaultBranchFailedError";
1564
1600
  }
1565
- static code = "LIST_PERMISSIONS_FAILED";
1601
+ static code = "UPDATE_DEFAULT_BRANCH_FAILED";
1566
1602
  static statusCode = 500;
1567
- static description = `Failed to list permissions: {message}`;
1603
+ static description = `Failed to update default branch: {message}`;
1568
1604
  }
1569
- class GetPermissionFailedError extends Error {
1605
+ class GetRepositoryInfoFailedError extends Error {
1570
1606
  constructor(body) {
1571
1607
  super(
1572
- `GET_PERMISSION_FAILED: ${body.message}`
1608
+ `GET_REPOSITORY_INFO_FAILED: ${body.message}`
1573
1609
  );
1574
1610
  this.body = body;
1575
- this.name = "GetPermissionFailedError";
1611
+ this.name = "GetRepositoryInfoFailedError";
1576
1612
  }
1577
- static code = "GET_PERMISSION_FAILED";
1613
+ static code = "GET_REPOSITORY_INFO_FAILED";
1578
1614
  static statusCode = 500;
1579
- static description = `Failed to get permission: {message}`;
1615
+ static description = `Failed to get repository info: {message}`;
1580
1616
  }
1581
- class UpdatePermissionFailedError extends Error {
1617
+ class ListRepositoriesFailedError extends Error {
1582
1618
  constructor(body) {
1583
1619
  super(
1584
- `UPDATE_PERMISSION_FAILED: ${body.message}`
1620
+ `LIST_REPOSITORIES_FAILED: ${body.message}`
1585
1621
  );
1586
1622
  this.body = body;
1587
- this.name = "UpdatePermissionFailedError";
1623
+ this.name = "ListRepositoriesFailedError";
1588
1624
  }
1589
- static code = "UPDATE_PERMISSION_FAILED";
1625
+ static code = "LIST_REPOSITORIES_FAILED";
1590
1626
  static statusCode = 500;
1591
- static description = `Failed to update permission: {message}`;
1627
+ static description = `Failed to list repositories: {message}`;
1592
1628
  }
1593
- class RevokePermissionFailedError extends Error {
1629
+ class DeleteRepositoryFailedError extends Error {
1594
1630
  constructor(body) {
1595
1631
  super(
1596
- `REVOKE_PERMISSION_FAILED: ${body.message}`
1632
+ `DELETE_REPOSITORY_FAILED: ${body.message}`
1597
1633
  );
1598
1634
  this.body = body;
1599
- this.name = "RevokePermissionFailedError";
1635
+ this.name = "DeleteRepositoryFailedError";
1600
1636
  }
1601
- static code = "REVOKE_PERMISSION_FAILED";
1637
+ static code = "DELETE_REPOSITORY_FAILED";
1602
1638
  static statusCode = 500;
1603
- static description = `Failed to revoke permission: {message}`;
1639
+ static description = `Failed to delete repository: {message}`;
1604
1640
  }
1605
- class GrantPermissionFailedError extends Error {
1641
+ class CreateRepositoryFailedError extends Error {
1606
1642
  constructor(body) {
1607
1643
  super(
1608
- `GRANT_PERMISSION_FAILED: ${body.message}`
1644
+ `CREATE_REPOSITORY_FAILED: ${body.message}`
1609
1645
  );
1610
1646
  this.body = body;
1611
- this.name = "GrantPermissionFailedError";
1647
+ this.name = "CreateRepositoryFailedError";
1612
1648
  }
1613
- static code = "GRANT_PERMISSION_FAILED";
1649
+ static code = "CREATE_REPOSITORY_FAILED";
1614
1650
  static statusCode = 500;
1615
- static description = `Failed to grant permission: {message}`;
1651
+ static description = `Failed to create repository: {message}`;
1616
1652
  }
1617
- class ListIdentitiesFailedError extends Error {
1653
+ class SerializationErrorError extends Error {
1618
1654
  constructor(body) {
1619
1655
  super(
1620
- `LIST_IDENTITIES_FAILED: ${body.message}`
1656
+ `SERIALIZATION_ERROR: ${body.message}`
1621
1657
  );
1622
1658
  this.body = body;
1623
- this.name = "ListIdentitiesFailedError";
1659
+ this.name = "SerializationErrorError";
1624
1660
  }
1625
- static code = "LIST_IDENTITIES_FAILED";
1626
- static statusCode = 500;
1627
- static description = `Failed to list identities: {message}`;
1661
+ static code = "SERIALIZATION_ERROR";
1662
+ static statusCode = 400;
1663
+ static description = `Failed to serialize request: {message}`;
1628
1664
  }
1629
- class DeleteIdentityFailedError extends Error {
1665
+ class GitInvalidRequestError extends Error {
1630
1666
  constructor(body) {
1631
1667
  super(
1632
- `DELETE_IDENTITY_FAILED: ${body.message}`
1668
+ `GIT_INVALID_REQUEST: ${body.message}`
1633
1669
  );
1634
1670
  this.body = body;
1635
- this.name = "DeleteIdentityFailedError";
1671
+ this.name = "GitInvalidRequestError";
1636
1672
  }
1637
- static code = "DELETE_IDENTITY_FAILED";
1638
- static statusCode = 500;
1639
- static description = `Failed to delete identity: {message}`;
1673
+ static code = "GIT_INVALID_REQUEST";
1674
+ static statusCode = 400;
1675
+ static description = `Invalid request: {message}`;
1640
1676
  }
1641
- class CreateIdentityFailedError extends Error {
1677
+ class RepositoryNotFoundError extends Error {
1642
1678
  constructor(body) {
1643
1679
  super(
1644
- `CREATE_IDENTITY_FAILED: ${body.message}`
1680
+ `REPOSITORY_NOT_FOUND: ${body.message}`
1645
1681
  );
1646
1682
  this.body = body;
1647
- this.name = "CreateIdentityFailedError";
1683
+ this.name = "RepositoryNotFoundError";
1648
1684
  }
1649
- static code = "CREATE_IDENTITY_FAILED";
1650
- static statusCode = 500;
1651
- static description = `Failed to create identity: {message}`;
1685
+ static code = "REPOSITORY_NOT_FOUND";
1686
+ static statusCode = 404;
1687
+ static description = `Repository not found: {repo_id}`;
1652
1688
  }
1653
- class VmPermissionNotFoundError extends Error {
1689
+ class FailedToProvisionCertificateError extends Error {
1654
1690
  constructor(body) {
1655
1691
  super(
1656
- `VM_PERMISSION_NOT_FOUND: ${body.message}`
1692
+ `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
1657
1693
  );
1658
1694
  this.body = body;
1659
- this.name = "VmPermissionNotFoundError";
1695
+ this.name = "FailedToProvisionCertificateError";
1660
1696
  }
1661
- static code = "VM_PERMISSION_NOT_FOUND";
1662
- static statusCode = 404;
1663
- static description = `VM permission not found`;
1697
+ static code = "FAILED_TO_PROVISION_CERTIFICATE";
1698
+ static statusCode = 422;
1699
+ static description = `Failed to provision certificate: {message}`;
1664
1700
  }
1665
- class PermissionNotFoundError extends Error {
1701
+ class FailedToInsertDomainMappingError extends Error {
1666
1702
  constructor(body) {
1667
1703
  super(
1668
- `PERMISSION_NOT_FOUND: ${body.message}`
1704
+ `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
1669
1705
  );
1670
1706
  this.body = body;
1671
- this.name = "PermissionNotFoundError";
1707
+ this.name = "FailedToInsertDomainMappingError";
1672
1708
  }
1673
- static code = "PERMISSION_NOT_FOUND";
1674
- static statusCode = 404;
1675
- static description = `Permission not found`;
1709
+ static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
1710
+ static statusCode = 500;
1711
+ static description = `Failed to insert domain mapping: {message}`;
1676
1712
  }
1677
- class VmAccessDeniedError extends Error {
1713
+ class PermissionDeniedError extends Error {
1678
1714
  constructor(body) {
1679
1715
  super(
1680
- `VM_ACCESS_DENIED: ${body.message}`
1716
+ `PERMISSION_DENIED: ${body.message}`
1681
1717
  );
1682
1718
  this.body = body;
1683
- this.name = "VmAccessDeniedError";
1719
+ this.name = "PermissionDeniedError";
1684
1720
  }
1685
- static code = "VM_ACCESS_DENIED";
1686
- static statusCode = 403;
1687
- static description = `You are not allowed to access this VM`;
1721
+ static code = "PERMISSION_DENIED";
1722
+ static statusCode = 401;
1723
+ static description = `Permission denied: {message}`;
1688
1724
  }
1689
- class GitRepositoryAccessDeniedError extends Error {
1725
+ class FailedToCheckPermissionsError extends Error {
1690
1726
  constructor(body) {
1691
1727
  super(
1692
- `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
1728
+ `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
1693
1729
  );
1694
1730
  this.body = body;
1695
- this.name = "GitRepositoryAccessDeniedError";
1731
+ this.name = "FailedToCheckPermissionsError";
1696
1732
  }
1697
- static code = "GIT_REPOSITORY_ACCESS_DENIED";
1698
- static statusCode = 403;
1699
- static description = `You are not allowed to access this repository`;
1733
+ static code = "FAILED_TO_CHECK_PERMISSIONS";
1734
+ static statusCode = 502;
1735
+ static description = `Failed to check permissions: {message}`;
1700
1736
  }
1701
- class GitRepositoryNotFoundError extends Error {
1737
+ class FailedToListDomainsError extends Error {
1702
1738
  constructor(body) {
1703
1739
  super(
1704
- `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
1740
+ `FAILED_TO_LIST_DOMAINS: ${body.message}`
1705
1741
  );
1706
1742
  this.body = body;
1707
- this.name = "GitRepositoryNotFoundError";
1743
+ this.name = "FailedToListDomainsError";
1708
1744
  }
1709
- static code = "GIT_REPOSITORY_NOT_FOUND";
1710
- static statusCode = 404;
1711
- static description = `Repository not found`;
1745
+ static code = "FAILED_TO_LIST_DOMAINS";
1746
+ static statusCode = 500;
1747
+ static description = `Failed to list domains: {message}`;
1712
1748
  }
1713
- class CannotDeleteManagedIdentityError extends Error {
1749
+ class FailedToListVerificationsError extends Error {
1714
1750
  constructor(body) {
1715
1751
  super(
1716
- `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
1752
+ `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
1717
1753
  );
1718
1754
  this.body = body;
1719
- this.name = "CannotDeleteManagedIdentityError";
1755
+ this.name = "FailedToListVerificationsError";
1720
1756
  }
1721
- static code = "CANNOT_DELETE_MANAGED_IDENTITY";
1722
- static statusCode = 403;
1723
- static description = `Cannot delete managed identities`;
1757
+ static code = "FAILED_TO_LIST_VERIFICATIONS";
1758
+ static statusCode = 500;
1759
+ static description = `Failed to list verifications: {message}`;
1724
1760
  }
1725
- class CannotModifyManagedIdentityError extends Error {
1761
+ class FailedToVerifyDomainError extends Error {
1726
1762
  constructor(body) {
1727
1763
  super(
1728
- `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
1764
+ `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
1729
1765
  );
1730
1766
  this.body = body;
1731
- this.name = "CannotModifyManagedIdentityError";
1767
+ this.name = "FailedToVerifyDomainError";
1732
1768
  }
1733
- static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
1734
- static statusCode = 403;
1735
- static description = `Cannot modify managed identities`;
1769
+ static code = "FAILED_TO_VERIFY_DOMAIN";
1770
+ static statusCode = 500;
1771
+ static description = `Failed to verify domain: {message}`;
1736
1772
  }
1737
- class IdentityAccessDeniedError extends Error {
1773
+ class VerificationFailedError extends Error {
1738
1774
  constructor(body) {
1739
1775
  super(
1740
- `IDENTITY_ACCESS_DENIED: ${body.message}`
1776
+ `VERIFICATION_FAILED: ${body.message}`
1741
1777
  );
1742
1778
  this.body = body;
1743
- this.name = "IdentityAccessDeniedError";
1779
+ this.name = "VerificationFailedError";
1744
1780
  }
1745
- static code = "IDENTITY_ACCESS_DENIED";
1746
- static statusCode = 403;
1747
- static description = `You are not allowed to access this identity`;
1781
+ static code = "VERIFICATION_FAILED";
1782
+ static statusCode = 400;
1783
+ static description = `Domain verification failed: {message}`;
1748
1784
  }
1749
- class IdentityNotFoundError extends Error {
1785
+ class FailedToDeleteVerificationError extends Error {
1750
1786
  constructor(body) {
1751
1787
  super(
1752
- `IDENTITY_NOT_FOUND: ${body.message}`
1788
+ `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
1753
1789
  );
1754
1790
  this.body = body;
1755
- this.name = "IdentityNotFoundError";
1791
+ this.name = "FailedToDeleteVerificationError";
1756
1792
  }
1757
- static code = "IDENTITY_NOT_FOUND";
1758
- static statusCode = 404;
1759
- static description = `Identity not found`;
1793
+ static code = "FAILED_TO_DELETE_VERIFICATION";
1794
+ static statusCode = 400;
1795
+ static description = `Failed to delete verification: {message}`;
1760
1796
  }
1761
- class ExecuteInternalErrorError extends Error {
1797
+ class VerificationNotFoundError extends Error {
1762
1798
  constructor(body) {
1763
1799
  super(
1764
- `EXECUTE_INTERNAL_ERROR: ${body.message}`
1800
+ `VERIFICATION_NOT_FOUND: ${body.message}`
1765
1801
  );
1766
1802
  this.body = body;
1767
- this.name = "ExecuteInternalErrorError";
1803
+ this.name = "VerificationNotFoundError";
1768
1804
  }
1769
- static code = "EXECUTE_INTERNAL_ERROR";
1770
- static statusCode = 500;
1771
- static description = `Internal error: {message}`;
1805
+ static code = "VERIFICATION_NOT_FOUND";
1806
+ static statusCode = 404;
1807
+ static description = `Verification request not found for domain: {domain}`;
1772
1808
  }
1773
- class ExecuteAccessDeniedError extends Error {
1809
+ class FailedToCreateVerificationCodeError extends Error {
1774
1810
  constructor(body) {
1775
1811
  super(
1776
- `EXECUTE_ACCESS_DENIED: ${body.message}`
1812
+ `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
1777
1813
  );
1778
1814
  this.body = body;
1779
- this.name = "ExecuteAccessDeniedError";
1815
+ this.name = "FailedToCreateVerificationCodeError";
1780
1816
  }
1781
- static code = "EXECUTE_ACCESS_DENIED";
1782
- static statusCode = 403;
1783
- static description = `Access denied to execute run`;
1817
+ static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
1818
+ static statusCode = 400;
1819
+ static description = `Failed to create verification code: {message}`;
1784
1820
  }
1785
- class ListRunsFailedError extends Error {
1821
+ class InvalidDomainError extends Error {
1786
1822
  constructor(body) {
1787
1823
  super(
1788
- `LIST_RUNS_FAILED: ${body.message}`
1824
+ `INVALID_DOMAIN: ${body.message}`
1789
1825
  );
1790
1826
  this.body = body;
1791
- this.name = "ListRunsFailedError";
1827
+ this.name = "InvalidDomainError";
1792
1828
  }
1793
- static code = "LIST_RUNS_FAILED";
1794
- static statusCode = 500;
1795
- static description = `Failed to list execute runs: {message}`;
1829
+ static code = "INVALID_DOMAIN";
1830
+ static statusCode = 400;
1831
+ static description = `Invalid domain: {domain}`;
1796
1832
  }
1797
- class ExecutionErrorError extends Error {
1833
+ class DomainAlreadyExistsError extends Error {
1798
1834
  constructor(body) {
1799
1835
  super(
1800
- `EXECUTION_ERROR: ${body.message}`
1836
+ `DOMAIN_ALREADY_EXISTS: ${body.message}`
1801
1837
  );
1802
1838
  this.body = body;
1803
- this.name = "ExecutionErrorError";
1839
+ this.name = "DomainAlreadyExistsError";
1804
1840
  }
1805
- static code = "EXECUTION_ERROR";
1806
- static statusCode = 500;
1807
- static description = `Script execution error: {message}`;
1841
+ static code = "DOMAIN_ALREADY_EXISTS";
1842
+ static statusCode = 400;
1843
+ static description = `Domain already exists: {domain}`;
1808
1844
  }
1809
- class ConnectionFailedError extends Error {
1845
+ class FailedToInsertOwnershipError extends Error {
1810
1846
  constructor(body) {
1811
1847
  super(
1812
- `CONNECTION_FAILED: ${body.message}`
1848
+ `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
1813
1849
  );
1814
1850
  this.body = body;
1815
- this.name = "ConnectionFailedError";
1851
+ this.name = "FailedToInsertOwnershipError";
1816
1852
  }
1817
- static code = "CONNECTION_FAILED";
1853
+ static code = "FAILED_TO_INSERT_OWNERSHIP";
1818
1854
  static statusCode = 500;
1819
- static description = `Failed to connect to execute server: {message}`;
1855
+ static description = `Failed to insert domain ownership: {message}`;
1820
1856
  }
1821
- class MetadataWriteFailedError extends Error {
1857
+ class FailedRemoveDomainMappingError extends Error {
1822
1858
  constructor(body) {
1823
1859
  super(
1824
- `METADATA_WRITE_FAILED: ${body.message}`
1860
+ `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
1825
1861
  );
1826
1862
  this.body = body;
1827
- this.name = "MetadataWriteFailedError";
1863
+ this.name = "FailedRemoveDomainMappingError";
1828
1864
  }
1829
- static code = "METADATA_WRITE_FAILED";
1865
+ static code = "FAILED_REMOVE_DOMAIN_MAPPING";
1830
1866
  static statusCode = 500;
1831
- static description = `Failed to write metadata file: {message}`;
1867
+ static description = `Failed to remove domain mapping: {message}`;
1832
1868
  }
1833
- class NodeModulesInstallFailedError extends Error {
1869
+ class FailedPermissionsCheckError extends Error {
1834
1870
  constructor(body) {
1835
1871
  super(
1836
- `NODE_MODULES_INSTALL_FAILED: ${body.message}`
1872
+ `FAILED_PERMISSIONS_CHECK: ${body.message}`
1837
1873
  );
1838
1874
  this.body = body;
1839
- this.name = "NodeModulesInstallFailedError";
1875
+ this.name = "FailedPermissionsCheckError";
1840
1876
  }
1841
- static code = "NODE_MODULES_INSTALL_FAILED";
1842
- static statusCode = 500;
1843
- static description = `Failed to install node modules: {message}`;
1877
+ static code = "FAILED_PERMISSIONS_CHECK";
1878
+ static statusCode = 401;
1879
+ static description = `You do not have permission to delete the domain mapping for: {domain}`;
1844
1880
  }
1845
- class NodeModulesDownloadFailedError extends Error {
1881
+ class FailedToCheckDomainMappingPermissionsError extends Error {
1846
1882
  constructor(body) {
1847
1883
  super(
1848
- `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
1884
+ `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
1849
1885
  );
1850
1886
  this.body = body;
1851
- this.name = "NodeModulesDownloadFailedError";
1887
+ this.name = "FailedToCheckDomainMappingPermissionsError";
1852
1888
  }
1853
- static code = "NODE_MODULES_DOWNLOAD_FAILED";
1854
- static statusCode = 500;
1855
- static description = `Failed to download node modules: {message}`;
1889
+ static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
1890
+ static statusCode = 502;
1891
+ static description = `Failed to check permissions: {message}`;
1856
1892
  }
1857
- class LockGenerationFailedError extends Error {
1893
+ class BranchNameEmptyError extends Error {
1858
1894
  constructor(body) {
1859
1895
  super(
1860
- `LOCK_GENERATION_FAILED: ${body.message}`
1896
+ `BRANCH_NAME_EMPTY: ${body.message}`
1861
1897
  );
1862
1898
  this.body = body;
1863
- this.name = "LockGenerationFailedError";
1899
+ this.name = "BranchNameEmptyError";
1864
1900
  }
1865
- static code = "LOCK_GENERATION_FAILED";
1866
- static statusCode = 500;
1867
- static description = `Failed to generate lock file: {message}`;
1901
+ static code = "BRANCH_NAME_EMPTY";
1902
+ static statusCode = 400;
1903
+ static description = `Branch name cannot be empty`;
1868
1904
  }
1869
- class WriteScriptFailedError extends Error {
1905
+ class AnyhowError extends Error {
1870
1906
  constructor(body) {
1871
1907
  super(
1872
- `WRITE_SCRIPT_FAILED: ${body.message}`
1908
+ `ANYHOW: ${body.message}`
1873
1909
  );
1874
1910
  this.body = body;
1875
- this.name = "WriteScriptFailedError";
1911
+ this.name = "AnyhowError";
1876
1912
  }
1877
- static code = "WRITE_SCRIPT_FAILED";
1913
+ static code = "ANYHOW";
1878
1914
  static statusCode = 500;
1879
- static description = `Failed to write script file: {message}`;
1915
+ static description = `Internal server error: {0}`;
1880
1916
  }
1881
- class DirectoryCreationFailedError extends Error {
1917
+ class PermissionAlreadyExistsError extends Error {
1882
1918
  constructor(body) {
1883
1919
  super(
1884
- `DIRECTORY_CREATION_FAILED: ${body.message}`
1920
+ `PERMISSION_ALREADY_EXISTS: ${body.message}`
1885
1921
  );
1886
1922
  this.body = body;
1887
- this.name = "DirectoryCreationFailedError";
1923
+ this.name = "PermissionAlreadyExistsError";
1888
1924
  }
1889
- static code = "DIRECTORY_CREATION_FAILED";
1890
- static statusCode = 500;
1891
- static description = `Failed to create script directory: {message}`;
1925
+ static code = "PERMISSION_ALREADY_EXISTS";
1926
+ static statusCode = 409;
1927
+ static description = `Permission already exists`;
1892
1928
  }
1893
- class NetworkPermissionsFailedError extends Error {
1929
+ class ListTokensFailedError extends Error {
1894
1930
  constructor(body) {
1895
1931
  super(
1896
- `NETWORK_PERMISSIONS_FAILED: ${body.message}`
1932
+ `LIST_TOKENS_FAILED: ${body.message}`
1897
1933
  );
1898
1934
  this.body = body;
1899
- this.name = "NetworkPermissionsFailedError";
1935
+ this.name = "ListTokensFailedError";
1900
1936
  }
1901
- static code = "NETWORK_PERMISSIONS_FAILED";
1937
+ static code = "LIST_TOKENS_FAILED";
1902
1938
  static statusCode = 500;
1903
- static description = `Failed to insert network permissions: {message}`;
1939
+ static description = `Failed to list tokens: {message}`;
1904
1940
  }
1905
- class LoggingFailedError extends Error {
1941
+ class RevokeTokenFailedError extends Error {
1906
1942
  constructor(body) {
1907
1943
  super(
1908
- `LOGGING_FAILED: ${body.message}`
1944
+ `REVOKE_TOKEN_FAILED: ${body.message}`
1909
1945
  );
1910
1946
  this.body = body;
1911
- this.name = "LoggingFailedError";
1947
+ this.name = "RevokeTokenFailedError";
1912
1948
  }
1913
- static code = "LOGGING_FAILED";
1949
+ static code = "REVOKE_TOKEN_FAILED";
1914
1950
  static statusCode = 500;
1915
- static description = `Failed to log execute run: {message}`;
1951
+ static description = `Failed to revoke token: {message}`;
1916
1952
  }
1917
- class RunNotFoundError extends Error {
1953
+ class CreateTokenFailedError extends Error {
1918
1954
  constructor(body) {
1919
1955
  super(
1920
- `RUN_NOT_FOUND: ${body.message}`
1956
+ `CREATE_TOKEN_FAILED: ${body.message}`
1921
1957
  );
1922
1958
  this.body = body;
1923
- this.name = "RunNotFoundError";
1959
+ this.name = "CreateTokenFailedError";
1924
1960
  }
1925
- static code = "RUN_NOT_FOUND";
1926
- static statusCode = 404;
1927
- static description = `Execute run not found: {run_id}`;
1961
+ static code = "CREATE_TOKEN_FAILED";
1962
+ static statusCode = 500;
1963
+ static description = `Failed to create token: {message}`;
1928
1964
  }
1929
- class CloudstateInternalErrorError extends Error {
1965
+ class ListPermissionsFailedError extends Error {
1930
1966
  constructor(body) {
1931
1967
  super(
1932
- `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
1968
+ `LIST_PERMISSIONS_FAILED: ${body.message}`
1933
1969
  );
1934
1970
  this.body = body;
1935
- this.name = "CloudstateInternalErrorError";
1971
+ this.name = "ListPermissionsFailedError";
1936
1972
  }
1937
- static code = "CLOUDSTATE_INTERNAL_ERROR";
1973
+ static code = "LIST_PERMISSIONS_FAILED";
1938
1974
  static statusCode = 500;
1939
- static description = `Internal error: {message}`;
1975
+ static description = `Failed to list permissions: {message}`;
1940
1976
  }
1941
- class CloudstateDatabaseErrorError extends Error {
1977
+ class GetPermissionFailedError extends Error {
1942
1978
  constructor(body) {
1943
1979
  super(
1944
- `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
1980
+ `GET_PERMISSION_FAILED: ${body.message}`
1945
1981
  );
1946
1982
  this.body = body;
1947
- this.name = "CloudstateDatabaseErrorError";
1983
+ this.name = "GetPermissionFailedError";
1948
1984
  }
1949
- static code = "CLOUDSTATE_DATABASE_ERROR";
1985
+ static code = "GET_PERMISSION_FAILED";
1950
1986
  static statusCode = 500;
1951
- static description = `Database operation failed: {message}`;
1987
+ static description = `Failed to get permission: {message}`;
1952
1988
  }
1953
- class CloudstateAccessDeniedError extends Error {
1989
+ class UpdatePermissionFailedError extends Error {
1954
1990
  constructor(body) {
1955
1991
  super(
1956
- `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
1992
+ `UPDATE_PERMISSION_FAILED: ${body.message}`
1957
1993
  );
1958
1994
  this.body = body;
1959
- this.name = "CloudstateAccessDeniedError";
1995
+ this.name = "UpdatePermissionFailedError";
1960
1996
  }
1961
- static code = "CLOUDSTATE_ACCESS_DENIED";
1962
- static statusCode = 403;
1963
- static description = `Access denied to project: {project_id}`;
1997
+ static code = "UPDATE_PERMISSION_FAILED";
1998
+ static statusCode = 500;
1999
+ static description = `Failed to update permission: {message}`;
1964
2000
  }
1965
- class RestoreFailedError extends Error {
2001
+ class RevokePermissionFailedError extends Error {
1966
2002
  constructor(body) {
1967
2003
  super(
1968
- `RESTORE_FAILED: ${body.message}`
2004
+ `REVOKE_PERMISSION_FAILED: ${body.message}`
1969
2005
  );
1970
2006
  this.body = body;
1971
- this.name = "RestoreFailedError";
2007
+ this.name = "RevokePermissionFailedError";
1972
2008
  }
1973
- static code = "RESTORE_FAILED";
2009
+ static code = "REVOKE_PERMISSION_FAILED";
1974
2010
  static statusCode = 500;
1975
- static description = `Failed to restore from backup: {message}`;
2011
+ static description = `Failed to revoke permission: {message}`;
1976
2012
  }
1977
- class CreateBackupFailedError extends Error {
2013
+ class GrantPermissionFailedError extends Error {
1978
2014
  constructor(body) {
1979
2015
  super(
1980
- `CREATE_BACKUP_FAILED: ${body.message}`
2016
+ `GRANT_PERMISSION_FAILED: ${body.message}`
1981
2017
  );
1982
2018
  this.body = body;
1983
- this.name = "CreateBackupFailedError";
2019
+ this.name = "GrantPermissionFailedError";
1984
2020
  }
1985
- static code = "CREATE_BACKUP_FAILED";
2021
+ static code = "GRANT_PERMISSION_FAILED";
1986
2022
  static statusCode = 500;
1987
- static description = `Failed to create backup: {message}`;
2023
+ static description = `Failed to grant permission: {message}`;
1988
2024
  }
1989
- class BackupFailedError extends Error {
2025
+ class ListIdentitiesFailedError extends Error {
1990
2026
  constructor(body) {
1991
2027
  super(
1992
- `BACKUP_FAILED: ${body.message}`
2028
+ `LIST_IDENTITIES_FAILED: ${body.message}`
1993
2029
  );
1994
2030
  this.body = body;
1995
- this.name = "BackupFailedError";
2031
+ this.name = "ListIdentitiesFailedError";
1996
2032
  }
1997
- static code = "BACKUP_FAILED";
2033
+ static code = "LIST_IDENTITIES_FAILED";
1998
2034
  static statusCode = 500;
1999
- static description = `Backup failed: {message}`;
2035
+ static description = `Failed to list identities: {message}`;
2000
2036
  }
2001
- class DeploymentFailedError extends Error {
2037
+ class DeleteIdentityFailedError extends Error {
2002
2038
  constructor(body) {
2003
2039
  super(
2004
- `DEPLOYMENT_FAILED: ${body.message}`
2040
+ `DELETE_IDENTITY_FAILED: ${body.message}`
2005
2041
  );
2006
2042
  this.body = body;
2007
- this.name = "DeploymentFailedError";
2043
+ this.name = "DeleteIdentityFailedError";
2008
2044
  }
2009
- static code = "DEPLOYMENT_FAILED";
2045
+ static code = "DELETE_IDENTITY_FAILED";
2010
2046
  static statusCode = 500;
2011
- static description = `Deployment failed: {message}`;
2047
+ static description = `Failed to delete identity: {message}`;
2012
2048
  }
2013
- class InvalidDeploymentRequestError extends Error {
2049
+ class CreateIdentityFailedError extends Error {
2014
2050
  constructor(body) {
2015
2051
  super(
2016
- `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2052
+ `CREATE_IDENTITY_FAILED: ${body.message}`
2017
2053
  );
2018
2054
  this.body = body;
2019
- this.name = "InvalidDeploymentRequestError";
2055
+ this.name = "CreateIdentityFailedError";
2020
2056
  }
2021
- static code = "INVALID_DEPLOYMENT_REQUEST";
2022
- static statusCode = 400;
2023
- static description = `Invalid deployment request: {message}`;
2057
+ static code = "CREATE_IDENTITY_FAILED";
2058
+ static statusCode = 500;
2059
+ static description = `Failed to create identity: {message}`;
2024
2060
  }
2025
- class ProjectNotFoundError extends Error {
2061
+ class VmPermissionNotFoundError extends Error {
2026
2062
  constructor(body) {
2027
2063
  super(
2028
- `PROJECT_NOT_FOUND: ${body.message}`
2064
+ `VM_PERMISSION_NOT_FOUND: ${body.message}`
2029
2065
  );
2030
2066
  this.body = body;
2031
- this.name = "ProjectNotFoundError";
2067
+ this.name = "VmPermissionNotFoundError";
2032
2068
  }
2033
- static code = "PROJECT_NOT_FOUND";
2069
+ static code = "VM_PERMISSION_NOT_FOUND";
2034
2070
  static statusCode = 404;
2035
- static description = `Project not found: {project_id}`;
2071
+ static description = `VM permission not found`;
2036
2072
  }
2037
- class UnauthorizedErrorError extends Error {
2073
+ class PermissionNotFoundError extends Error {
2038
2074
  constructor(body) {
2039
2075
  super(
2040
- `UNAUTHORIZED_ERROR: ${body.message}`
2076
+ `PERMISSION_NOT_FOUND: ${body.message}`
2041
2077
  );
2042
2078
  this.body = body;
2043
- this.name = "UnauthorizedErrorError";
2079
+ this.name = "PermissionNotFoundError";
2044
2080
  }
2045
- static code = "UNAUTHORIZED_ERROR";
2046
- static statusCode = 401;
2047
- static description = `Unauthorized request to {route}`;
2081
+ static code = "PERMISSION_NOT_FOUND";
2082
+ static statusCode = 404;
2083
+ static description = `Permission not found`;
2048
2084
  }
2049
- class BuildFailedError extends Error {
2085
+ class GitRepositoryAccessDeniedError extends Error {
2050
2086
  constructor(body) {
2051
2087
  super(
2052
- `BUILD_FAILED: ${body.message}`
2088
+ `GIT_REPOSITORY_ACCESS_DENIED: ${body.message}`
2053
2089
  );
2054
2090
  this.body = body;
2055
- this.name = "BuildFailedError";
2091
+ this.name = "GitRepositoryAccessDeniedError";
2056
2092
  }
2057
- static code = "BUILD_FAILED";
2058
- static statusCode = 500;
2059
- static description = `Build failed on VM {vm_id}`;
2093
+ static code = "GIT_REPOSITORY_ACCESS_DENIED";
2094
+ static statusCode = 403;
2095
+ static description = `You are not allowed to access this repository`;
2060
2096
  }
2061
- class ServerDeploymentFailedError extends Error {
2097
+ class GitRepositoryNotFoundError extends Error {
2062
2098
  constructor(body) {
2063
2099
  super(
2064
- `SERVER_DEPLOYMENT_FAILED: ${body.message}`
2100
+ `GIT_REPOSITORY_NOT_FOUND: ${body.message}`
2065
2101
  );
2066
2102
  this.body = body;
2067
- this.name = "ServerDeploymentFailedError";
2103
+ this.name = "GitRepositoryNotFoundError";
2068
2104
  }
2069
- static code = "SERVER_DEPLOYMENT_FAILED";
2070
- static statusCode = 502;
2071
- static description = `Failed to deploy to servers`;
2105
+ static code = "GIT_REPOSITORY_NOT_FOUND";
2106
+ static statusCode = 404;
2107
+ static description = `Repository not found`;
2072
2108
  }
2073
- class LockfileErrorError extends Error {
2109
+ class CannotDeleteManagedIdentityError extends Error {
2074
2110
  constructor(body) {
2075
2111
  super(
2076
- `LOCKFILE_ERROR: ${body.message}`
2112
+ `CANNOT_DELETE_MANAGED_IDENTITY: ${body.message}`
2077
2113
  );
2078
2114
  this.body = body;
2079
- this.name = "LockfileErrorError";
2115
+ this.name = "CannotDeleteManagedIdentityError";
2080
2116
  }
2081
- static code = "LOCKFILE_ERROR";
2082
- static statusCode = 500;
2083
- static description = `Failed to generate dependency lockfile: {message}`;
2117
+ static code = "CANNOT_DELETE_MANAGED_IDENTITY";
2118
+ static statusCode = 403;
2119
+ static description = `Cannot delete managed identities`;
2084
2120
  }
2085
- class UploadErrorError extends Error {
2121
+ class CannotModifyManagedIdentityError extends Error {
2086
2122
  constructor(body) {
2087
2123
  super(
2088
- `UPLOAD_ERROR: ${body.message}`
2124
+ `CANNOT_MODIFY_MANAGED_IDENTITY: ${body.message}`
2089
2125
  );
2090
2126
  this.body = body;
2091
- this.name = "UploadErrorError";
2127
+ this.name = "CannotModifyManagedIdentityError";
2092
2128
  }
2093
- static code = "UPLOAD_ERROR";
2094
- static statusCode = 500;
2095
- static description = `Failed to upload deployment to storage`;
2129
+ static code = "CANNOT_MODIFY_MANAGED_IDENTITY";
2130
+ static statusCode = 403;
2131
+ static description = `Cannot modify managed identities`;
2096
2132
  }
2097
- class DomainMappingErrorError extends Error {
2133
+ class IdentityAccessDeniedError extends Error {
2098
2134
  constructor(body) {
2099
2135
  super(
2100
- `DOMAIN_MAPPING_ERROR: ${body.message}`
2136
+ `IDENTITY_ACCESS_DENIED: ${body.message}`
2101
2137
  );
2102
2138
  this.body = body;
2103
- this.name = "DomainMappingErrorError";
2139
+ this.name = "IdentityAccessDeniedError";
2104
2140
  }
2105
- static code = "DOMAIN_MAPPING_ERROR";
2106
- static statusCode = 500;
2107
- static description = `Failed to configure domain mapping for: {domain}`;
2141
+ static code = "IDENTITY_ACCESS_DENIED";
2142
+ static statusCode = 403;
2143
+ static description = `You are not allowed to access this identity`;
2108
2144
  }
2109
- class CertificateProvisioningErrorError extends Error {
2145
+ class IdentityNotFoundError extends Error {
2110
2146
  constructor(body) {
2111
2147
  super(
2112
- `CERTIFICATE_PROVISIONING_ERROR: ${body.message}`
2148
+ `IDENTITY_NOT_FOUND: ${body.message}`
2113
2149
  );
2114
2150
  this.body = body;
2115
- this.name = "CertificateProvisioningErrorError";
2151
+ this.name = "IdentityNotFoundError";
2116
2152
  }
2117
- static code = "CERTIFICATE_PROVISIONING_ERROR";
2118
- static statusCode = 502;
2119
- static description = `Failed to provision certificate for domain: {domain}`;
2153
+ static code = "IDENTITY_NOT_FOUND";
2154
+ static statusCode = 404;
2155
+ static description = `Identity not found`;
2120
2156
  }
2121
- class NoEntrypointFoundError extends Error {
2157
+ class DomainOwnershipVerificationFailedError extends Error {
2122
2158
  constructor(body) {
2123
2159
  super(
2124
- `NO_ENTRYPOINT_FOUND: ${body.message}`
2160
+ `DOMAIN_OWNERSHIP_VERIFICATION_FAILED: ${body.message}`
2125
2161
  );
2126
2162
  this.body = body;
2127
- this.name = "NoEntrypointFoundError";
2163
+ this.name = "DomainOwnershipVerificationFailedError";
2128
2164
  }
2129
- static code = "NO_ENTRYPOINT_FOUND";
2130
- static statusCode = 400;
2131
- static description = `No entrypoint found in deployment`;
2165
+ static code = "DOMAIN_OWNERSHIP_VERIFICATION_FAILED";
2166
+ static statusCode = 403;
2167
+ static description = `Domain ownership verification failed`;
2132
2168
  }
2133
- class EntrypointNotFoundError extends Error {
2169
+ class ErrorDeletingRecordError extends Error {
2134
2170
  constructor(body) {
2135
2171
  super(
2136
- `ENTRYPOINT_NOT_FOUND: ${body.message}`
2172
+ `ERROR_DELETING_RECORD: ${body.message}`
2137
2173
  );
2138
2174
  this.body = body;
2139
- this.name = "EntrypointNotFoundError";
2175
+ this.name = "ErrorDeletingRecordError";
2140
2176
  }
2141
- static code = "ENTRYPOINT_NOT_FOUND";
2142
- static statusCode = 400;
2143
- static description = `Entrypoint not found: {entrypoint}`;
2177
+ static code = "ERROR_DELETING_RECORD";
2178
+ static statusCode = 500;
2179
+ static description = `Error deleting DNS record for {domain}/{name}: {message}`;
2144
2180
  }
2145
- class NoDomainOwnershipError extends Error {
2181
+ class RecordOwnershipErrorError extends Error {
2146
2182
  constructor(body) {
2147
2183
  super(
2148
- `NO_DOMAIN_OWNERSHIP: ${body.message}`
2184
+ `RECORD_OWNERSHIP_ERROR: ${body.message}`
2149
2185
  );
2150
2186
  this.body = body;
2151
- this.name = "NoDomainOwnershipError";
2187
+ this.name = "RecordOwnershipErrorError";
2152
2188
  }
2153
- static code = "NO_DOMAIN_OWNERSHIP";
2189
+ static code = "RECORD_OWNERSHIP_ERROR";
2154
2190
  static statusCode = 403;
2155
- static description = `No domain ownership for: {domain}`;
2191
+ static description = `Account {account_id} does not own record {record_id}`;
2156
2192
  }
2157
- class InvalidDomainsError extends Error {
2193
+ class ErrorCreatingRecordError extends Error {
2158
2194
  constructor(body) {
2159
2195
  super(
2160
- `INVALID_DOMAINS: ${body.message}`
2196
+ `ERROR_CREATING_RECORD: ${body.message}`
2161
2197
  );
2162
2198
  this.body = body;
2163
- this.name = "InvalidDomainsError";
2199
+ this.name = "ErrorCreatingRecordError";
2164
2200
  }
2165
- static code = "INVALID_DOMAINS";
2166
- static statusCode = 400;
2167
- static description = `Invalid domains provided`;
2201
+ static code = "ERROR_CREATING_RECORD";
2202
+ static statusCode = 500;
2203
+ static description = `Error creating DNS record: {message}`;
2168
2204
  }
2169
- class WebDeploymentBadRequestError extends Error {
2205
+ class DomainOwnershipErrorError extends Error {
2170
2206
  constructor(body) {
2171
2207
  super(
2172
- `WEB_DEPLOYMENT_BAD_REQUEST: ${body.message}`
2208
+ `DOMAIN_OWNERSHIP_ERROR: ${body.message}`
2173
2209
  );
2174
2210
  this.body = body;
2175
- this.name = "WebDeploymentBadRequestError";
2211
+ this.name = "DomainOwnershipErrorError";
2176
2212
  }
2177
- static code = "WEB_DEPLOYMENT_BAD_REQUEST";
2178
- static statusCode = 400;
2179
- static description = `Bad request: {message}`;
2213
+ static code = "DOMAIN_OWNERSHIP_ERROR";
2214
+ static statusCode = 403;
2215
+ static description = `Account {account_id} does not own domain {domain}`;
2180
2216
  }
2181
- class DeploymentNotFoundError extends Error {
2217
+ class BrowserOperationFailedError extends Error {
2182
2218
  constructor(body) {
2183
2219
  super(
2184
- `DEPLOYMENT_NOT_FOUND: ${body.message}`
2220
+ `BROWSER_OPERATION_FAILED: ${body.message}`
2185
2221
  );
2186
2222
  this.body = body;
2187
- this.name = "DeploymentNotFoundError";
2223
+ this.name = "BrowserOperationFailedError";
2188
2224
  }
2189
- static code = "DEPLOYMENT_NOT_FOUND";
2190
- static statusCode = 404;
2191
- static description = `Deployment not found`;
2225
+ static code = "BROWSER_OPERATION_FAILED";
2226
+ static statusCode = 500;
2227
+ static description = `Browser operation failed: {message}`;
2192
2228
  }
2193
- class ObservabilityDatabaseErrorError extends Error {
2229
+ class WatchFilesFailedError extends Error {
2194
2230
  constructor(body) {
2195
2231
  super(
2196
- `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2232
+ `WATCH_FILES_FAILED: ${body.message}`
2197
2233
  );
2198
2234
  this.body = body;
2199
- this.name = "ObservabilityDatabaseErrorError";
2235
+ this.name = "WatchFilesFailedError";
2200
2236
  }
2201
- static code = "OBSERVABILITY_DATABASE_ERROR";
2237
+ static code = "WATCH_FILES_FAILED";
2202
2238
  static statusCode = 500;
2203
- static description = `Database operation failed: {message}`;
2239
+ static description = `Failed to watch files: {message}`;
2204
2240
  }
2205
- class ObservabilityAccessDeniedError extends Error {
2241
+ class LogsFailedError extends Error {
2206
2242
  constructor(body) {
2207
2243
  super(
2208
- `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2244
+ `LOGS_FAILED: ${body.message}`
2209
2245
  );
2210
2246
  this.body = body;
2211
- this.name = "ObservabilityAccessDeniedError";
2247
+ this.name = "LogsFailedError";
2212
2248
  }
2213
- static code = "OBSERVABILITY_ACCESS_DENIED";
2214
- static statusCode = 403;
2215
- static description = `Access denied to logs for deployment: {deployment_id}`;
2249
+ static code = "LOGS_FAILED";
2250
+ static statusCode = 500;
2251
+ static description = `Failed to get logs: {message}`;
2216
2252
  }
2217
- class ParseLogsFailedError extends Error {
2253
+ class StatusFailedError extends Error {
2218
2254
  constructor(body) {
2219
2255
  super(
2220
- `PARSE_LOGS_FAILED: ${body.message}`
2256
+ `STATUS_FAILED: ${body.message}`
2221
2257
  );
2222
2258
  this.body = body;
2223
- this.name = "ParseLogsFailedError";
2259
+ this.name = "StatusFailedError";
2224
2260
  }
2225
- static code = "PARSE_LOGS_FAILED";
2261
+ static code = "STATUS_FAILED";
2226
2262
  static statusCode = 500;
2227
- static description = `Failed to parse logs: {message}`;
2263
+ static description = `Failed to get dev server status: {message}`;
2228
2264
  }
2229
- class RetrieveLogsFailedError extends Error {
2265
+ class RestartFailedError extends Error {
2230
2266
  constructor(body) {
2231
2267
  super(
2232
- `RETRIEVE_LOGS_FAILED: ${body.message}`
2268
+ `RESTART_FAILED: ${body.message}`
2233
2269
  );
2234
2270
  this.body = body;
2235
- this.name = "RetrieveLogsFailedError";
2271
+ this.name = "RestartFailedError";
2236
2272
  }
2237
- static code = "RETRIEVE_LOGS_FAILED";
2273
+ static code = "RESTART_FAILED";
2238
2274
  static statusCode = 500;
2239
- static description = `Failed to retrieve logs: {message}`;
2275
+ static description = `Failed to restart dev server: {message}`;
2240
2276
  }
2241
- class InvalidQueryError extends Error {
2277
+ class ShutdownFailedError extends Error {
2242
2278
  constructor(body) {
2243
2279
  super(
2244
- `INVALID_QUERY: ${body.message}`
2280
+ `SHUTDOWN_FAILED: ${body.message}`
2245
2281
  );
2246
2282
  this.body = body;
2247
- this.name = "InvalidQueryError";
2283
+ this.name = "ShutdownFailedError";
2248
2284
  }
2249
- static code = "INVALID_QUERY";
2250
- static statusCode = 400;
2251
- static description = `Invalid log query: {message}`;
2285
+ static code = "SHUTDOWN_FAILED";
2286
+ static statusCode = 500;
2287
+ static description = `Failed to shutdown dev server: {message}`;
2252
2288
  }
2253
- class LogsNotFoundError extends Error {
2289
+ class CommitFailedError extends Error {
2254
2290
  constructor(body) {
2255
2291
  super(
2256
- `LOGS_NOT_FOUND: ${body.message}`
2292
+ `COMMIT_FAILED: ${body.message}`
2257
2293
  );
2258
2294
  this.body = body;
2259
- this.name = "LogsNotFoundError";
2295
+ this.name = "CommitFailedError";
2260
2296
  }
2261
- static code = "LOGS_NOT_FOUND";
2262
- static statusCode = 404;
2263
- static description = `Logs not found for deployment: {deployment_id}`;
2297
+ static code = "COMMIT_FAILED";
2298
+ static statusCode = 500;
2299
+ static description = `Failed to commit changes: {message}`;
2264
2300
  }
2265
- class TriggerErrorError extends Error {
2301
+ class WriteFileFailedError extends Error {
2266
2302
  constructor(body) {
2267
2303
  super(
2268
- `TRIGGER_ERROR: ${body.message}`
2304
+ `WRITE_FILE_FAILED: ${body.message}`
2269
2305
  );
2270
2306
  this.body = body;
2271
- this.name = "TriggerErrorError";
2307
+ this.name = "WriteFileFailedError";
2272
2308
  }
2273
- static code = "TRIGGER_ERROR";
2309
+ static code = "WRITE_FILE_FAILED";
2274
2310
  static statusCode = 500;
2275
- static description = `Failed to manage triggers: {message}`;
2311
+ static description = `Failed to write file: {message}`;
2276
2312
  }
2277
- class TokenErrorError extends Error {
2313
+ class ReadFileFailedError extends Error {
2278
2314
  constructor(body) {
2279
2315
  super(
2280
- `TOKEN_ERROR: ${body.message}`
2316
+ `READ_FILE_FAILED: ${body.message}`
2281
2317
  );
2282
2318
  this.body = body;
2283
- this.name = "TokenErrorError";
2319
+ this.name = "ReadFileFailedError";
2284
2320
  }
2285
- static code = "TOKEN_ERROR";
2321
+ static code = "READ_FILE_FAILED";
2286
2322
  static statusCode = 500;
2287
- static description = `Failed to manage tokens: {message}`;
2323
+ static description = `Failed to read file: {message}`;
2288
2324
  }
2289
- class PermissionErrorError extends Error {
2325
+ class ExecutionFailedError extends Error {
2290
2326
  constructor(body) {
2291
2327
  super(
2292
- `PERMISSION_ERROR: ${body.message}`
2328
+ `EXECUTION_FAILED: ${body.message}`
2293
2329
  );
2294
2330
  this.body = body;
2295
- this.name = "PermissionErrorError";
2331
+ this.name = "ExecutionFailedError";
2296
2332
  }
2297
- static code = "PERMISSION_ERROR";
2333
+ static code = "EXECUTION_FAILED";
2298
2334
  static statusCode = 500;
2299
- static description = `Failed to manage permissions: {message}`;
2335
+ static description = `Failed to execute command: {message}`;
2300
2336
  }
2301
- class IdentityErrorError extends Error {
2337
+ class RequestFailedError extends Error {
2302
2338
  constructor(body) {
2303
2339
  super(
2304
- `IDENTITY_ERROR: ${body.message}`
2340
+ `REQUEST_FAILED: ${body.message}`
2305
2341
  );
2306
2342
  this.body = body;
2307
- this.name = "IdentityErrorError";
2343
+ this.name = "RequestFailedError";
2308
2344
  }
2309
- static code = "IDENTITY_ERROR";
2345
+ static code = "REQUEST_FAILED";
2310
2346
  static statusCode = 500;
2311
- static description = `Failed to manage identity: {message}`;
2347
+ static description = `Failed to request dev server: {message}`;
2312
2348
  }
2313
- class GetContentFailedError extends Error {
2349
+ class DevServerFileNotFoundError extends Error {
2314
2350
  constructor(body) {
2315
2351
  super(
2316
- `GET_CONTENT_FAILED: ${body.message}`
2352
+ `DEV_SERVER_FILE_NOT_FOUND: ${body.message}`
2317
2353
  );
2318
2354
  this.body = body;
2319
- this.name = "GetContentFailedError";
2355
+ this.name = "DevServerFileNotFoundError";
2320
2356
  }
2321
- static code = "GET_CONTENT_FAILED";
2322
- static statusCode = 500;
2323
- static description = `Failed to get content: {message}`;
2357
+ static code = "DEV_SERVER_FILE_NOT_FOUND";
2358
+ static statusCode = 404;
2359
+ static description = `Dev server file not found: {path}`;
2324
2360
  }
2325
- class ContentNotFoundError extends Error {
2361
+ class DevServerInvalidRequestError extends Error {
2326
2362
  constructor(body) {
2327
2363
  super(
2328
- `CONTENT_NOT_FOUND: ${body.message}`
2364
+ `DEV_SERVER_INVALID_REQUEST: ${body.message}`
2329
2365
  );
2330
2366
  this.body = body;
2331
- this.name = "ContentNotFoundError";
2367
+ this.name = "DevServerInvalidRequestError";
2332
2368
  }
2333
- static code = "CONTENT_NOT_FOUND";
2334
- static statusCode = 404;
2335
- static description = `Content not found: {path}`;
2369
+ static code = "DEV_SERVER_INVALID_REQUEST";
2370
+ static statusCode = 400;
2371
+ static description = `Invalid dev server request: {message}`;
2336
2372
  }
2337
- class DownloadFailedError extends Error {
2373
+ class UnauthorizedErrorError extends Error {
2338
2374
  constructor(body) {
2339
2375
  super(
2340
- `DOWNLOAD_FAILED: ${body.message}`
2376
+ `UNAUTHORIZED_ERROR: ${body.message}`
2341
2377
  );
2342
2378
  this.body = body;
2343
- this.name = "DownloadFailedError";
2379
+ this.name = "UnauthorizedErrorError";
2344
2380
  }
2345
- static code = "DOWNLOAD_FAILED";
2346
- static statusCode = 500;
2347
- static description = `Failed to download repository: {message}`;
2381
+ static code = "UNAUTHORIZED_ERROR";
2382
+ static statusCode = 401;
2383
+ static description = `Unauthorized request to {route}`;
2348
2384
  }
2349
- class GitServerErrorError extends Error {
2385
+ class ExecuteInternalErrorError extends Error {
2350
2386
  constructor(body) {
2351
2387
  super(
2352
- `GIT_SERVER_ERROR: ${body.message}`
2388
+ `EXECUTE_INTERNAL_ERROR: ${body.message}`
2353
2389
  );
2354
2390
  this.body = body;
2355
- this.name = "GitServerErrorError";
2391
+ this.name = "ExecuteInternalErrorError";
2356
2392
  }
2357
- static code = "GIT_SERVER_ERROR";
2393
+ static code = "EXECUTE_INTERNAL_ERROR";
2358
2394
  static statusCode = 500;
2359
- static description = `Git server error: {message}`;
2395
+ static description = `Internal error: {message}`;
2360
2396
  }
2361
- class ParseResponseErrorError extends Error {
2397
+ class ExecuteAccessDeniedError extends Error {
2362
2398
  constructor(body) {
2363
2399
  super(
2364
- `PARSE_RESPONSE_ERROR: ${body.message}`
2400
+ `EXECUTE_ACCESS_DENIED: ${body.message}`
2365
2401
  );
2366
2402
  this.body = body;
2367
- this.name = "ParseResponseErrorError";
2403
+ this.name = "ExecuteAccessDeniedError";
2368
2404
  }
2369
- static code = "PARSE_RESPONSE_ERROR";
2370
- static statusCode = 500;
2371
- static description = `Failed to parse response from Git server: {message}`;
2405
+ static code = "EXECUTE_ACCESS_DENIED";
2406
+ static statusCode = 403;
2407
+ static description = `Access denied to execute run`;
2372
2408
  }
2373
- class RepositoryAccessDeniedError extends Error {
2409
+ class ListRunsFailedError extends Error {
2374
2410
  constructor(body) {
2375
2411
  super(
2376
- `REPOSITORY_ACCESS_DENIED: ${body.message}`
2412
+ `LIST_RUNS_FAILED: ${body.message}`
2377
2413
  );
2378
2414
  this.body = body;
2379
- this.name = "RepositoryAccessDeniedError";
2415
+ this.name = "ListRunsFailedError";
2380
2416
  }
2381
- static code = "REPOSITORY_ACCESS_DENIED";
2382
- static statusCode = 403;
2383
- static description = `Repository does not belong to account`;
2417
+ static code = "LIST_RUNS_FAILED";
2418
+ static statusCode = 500;
2419
+ static description = `Failed to list execute runs: {message}`;
2384
2420
  }
2385
- class GitHubSyncFailedError extends Error {
2421
+ class ExecutionErrorError extends Error {
2386
2422
  constructor(body) {
2387
2423
  super(
2388
- `GIT_HUB_SYNC_FAILED: ${body.message}`
2424
+ `EXECUTION_ERROR: ${body.message}`
2389
2425
  );
2390
2426
  this.body = body;
2391
- this.name = "GitHubSyncFailedError";
2427
+ this.name = "ExecutionErrorError";
2392
2428
  }
2393
- static code = "GIT_HUB_SYNC_FAILED";
2429
+ static code = "EXECUTION_ERROR";
2394
2430
  static statusCode = 500;
2395
- static description = `Failed to configure GitHub sync: {message}`;
2431
+ static description = `Script execution error: {message}`;
2396
2432
  }
2397
- class UpdateDefaultBranchFailedError extends Error {
2433
+ class ConnectionFailedError extends Error {
2398
2434
  constructor(body) {
2399
2435
  super(
2400
- `UPDATE_DEFAULT_BRANCH_FAILED: ${body.message}`
2436
+ `CONNECTION_FAILED: ${body.message}`
2401
2437
  );
2402
2438
  this.body = body;
2403
- this.name = "UpdateDefaultBranchFailedError";
2439
+ this.name = "ConnectionFailedError";
2404
2440
  }
2405
- static code = "UPDATE_DEFAULT_BRANCH_FAILED";
2441
+ static code = "CONNECTION_FAILED";
2406
2442
  static statusCode = 500;
2407
- static description = `Failed to update default branch: {message}`;
2443
+ static description = `Failed to connect to execute server: {message}`;
2408
2444
  }
2409
- class GetRepositoryInfoFailedError extends Error {
2445
+ class MetadataWriteFailedError extends Error {
2410
2446
  constructor(body) {
2411
2447
  super(
2412
- `GET_REPOSITORY_INFO_FAILED: ${body.message}`
2448
+ `METADATA_WRITE_FAILED: ${body.message}`
2413
2449
  );
2414
2450
  this.body = body;
2415
- this.name = "GetRepositoryInfoFailedError";
2451
+ this.name = "MetadataWriteFailedError";
2416
2452
  }
2417
- static code = "GET_REPOSITORY_INFO_FAILED";
2453
+ static code = "METADATA_WRITE_FAILED";
2418
2454
  static statusCode = 500;
2419
- static description = `Failed to get repository info: {message}`;
2455
+ static description = `Failed to write metadata file: {message}`;
2420
2456
  }
2421
- class ListRepositoriesFailedError extends Error {
2457
+ class NodeModulesInstallFailedError extends Error {
2422
2458
  constructor(body) {
2423
2459
  super(
2424
- `LIST_REPOSITORIES_FAILED: ${body.message}`
2460
+ `NODE_MODULES_INSTALL_FAILED: ${body.message}`
2425
2461
  );
2426
2462
  this.body = body;
2427
- this.name = "ListRepositoriesFailedError";
2463
+ this.name = "NodeModulesInstallFailedError";
2428
2464
  }
2429
- static code = "LIST_REPOSITORIES_FAILED";
2465
+ static code = "NODE_MODULES_INSTALL_FAILED";
2430
2466
  static statusCode = 500;
2431
- static description = `Failed to list repositories: {message}`;
2467
+ static description = `Failed to install node modules: {message}`;
2432
2468
  }
2433
- class DeleteRepositoryFailedError extends Error {
2469
+ class NodeModulesDownloadFailedError extends Error {
2434
2470
  constructor(body) {
2435
2471
  super(
2436
- `DELETE_REPOSITORY_FAILED: ${body.message}`
2472
+ `NODE_MODULES_DOWNLOAD_FAILED: ${body.message}`
2437
2473
  );
2438
2474
  this.body = body;
2439
- this.name = "DeleteRepositoryFailedError";
2475
+ this.name = "NodeModulesDownloadFailedError";
2440
2476
  }
2441
- static code = "DELETE_REPOSITORY_FAILED";
2477
+ static code = "NODE_MODULES_DOWNLOAD_FAILED";
2442
2478
  static statusCode = 500;
2443
- static description = `Failed to delete repository: {message}`;
2479
+ static description = `Failed to download node modules: {message}`;
2444
2480
  }
2445
- class CreateRepositoryFailedError extends Error {
2481
+ class LockGenerationFailedError extends Error {
2446
2482
  constructor(body) {
2447
2483
  super(
2448
- `CREATE_REPOSITORY_FAILED: ${body.message}`
2484
+ `LOCK_GENERATION_FAILED: ${body.message}`
2449
2485
  );
2450
2486
  this.body = body;
2451
- this.name = "CreateRepositoryFailedError";
2487
+ this.name = "LockGenerationFailedError";
2452
2488
  }
2453
- static code = "CREATE_REPOSITORY_FAILED";
2489
+ static code = "LOCK_GENERATION_FAILED";
2454
2490
  static statusCode = 500;
2455
- static description = `Failed to create repository: {message}`;
2491
+ static description = `Failed to generate lock file: {message}`;
2456
2492
  }
2457
- class SerializationErrorError extends Error {
2493
+ class WriteScriptFailedError extends Error {
2458
2494
  constructor(body) {
2459
2495
  super(
2460
- `SERIALIZATION_ERROR: ${body.message}`
2496
+ `WRITE_SCRIPT_FAILED: ${body.message}`
2461
2497
  );
2462
2498
  this.body = body;
2463
- this.name = "SerializationErrorError";
2499
+ this.name = "WriteScriptFailedError";
2464
2500
  }
2465
- static code = "SERIALIZATION_ERROR";
2466
- static statusCode = 400;
2467
- static description = `Failed to serialize request: {message}`;
2501
+ static code = "WRITE_SCRIPT_FAILED";
2502
+ static statusCode = 500;
2503
+ static description = `Failed to write script file: {message}`;
2468
2504
  }
2469
- class GitInvalidRequestError extends Error {
2505
+ class DirectoryCreationFailedError extends Error {
2470
2506
  constructor(body) {
2471
2507
  super(
2472
- `GIT_INVALID_REQUEST: ${body.message}`
2508
+ `DIRECTORY_CREATION_FAILED: ${body.message}`
2473
2509
  );
2474
2510
  this.body = body;
2475
- this.name = "GitInvalidRequestError";
2511
+ this.name = "DirectoryCreationFailedError";
2476
2512
  }
2477
- static code = "GIT_INVALID_REQUEST";
2478
- static statusCode = 400;
2479
- static description = `Invalid request: {message}`;
2513
+ static code = "DIRECTORY_CREATION_FAILED";
2514
+ static statusCode = 500;
2515
+ static description = `Failed to create script directory: {message}`;
2480
2516
  }
2481
- class RepositoryNotFoundError extends Error {
2517
+ class NetworkPermissionsFailedError extends Error {
2482
2518
  constructor(body) {
2483
2519
  super(
2484
- `REPOSITORY_NOT_FOUND: ${body.message}`
2520
+ `NETWORK_PERMISSIONS_FAILED: ${body.message}`
2485
2521
  );
2486
2522
  this.body = body;
2487
- this.name = "RepositoryNotFoundError";
2523
+ this.name = "NetworkPermissionsFailedError";
2488
2524
  }
2489
- static code = "REPOSITORY_NOT_FOUND";
2490
- static statusCode = 404;
2491
- static description = `Repository not found: {repo_id}`;
2525
+ static code = "NETWORK_PERMISSIONS_FAILED";
2526
+ static statusCode = 500;
2527
+ static description = `Failed to insert network permissions: {message}`;
2492
2528
  }
2493
- class FailedToProvisionCertificateError extends Error {
2529
+ class LoggingFailedError extends Error {
2494
2530
  constructor(body) {
2495
2531
  super(
2496
- `FAILED_TO_PROVISION_CERTIFICATE: ${body.message}`
2532
+ `LOGGING_FAILED: ${body.message}`
2497
2533
  );
2498
2534
  this.body = body;
2499
- this.name = "FailedToProvisionCertificateError";
2535
+ this.name = "LoggingFailedError";
2500
2536
  }
2501
- static code = "FAILED_TO_PROVISION_CERTIFICATE";
2502
- static statusCode = 422;
2503
- static description = `Failed to provision certificate: {message}`;
2537
+ static code = "LOGGING_FAILED";
2538
+ static statusCode = 500;
2539
+ static description = `Failed to log execute run: {message}`;
2504
2540
  }
2505
- class FailedToInsertDomainMappingError extends Error {
2541
+ class RunNotFoundError extends Error {
2506
2542
  constructor(body) {
2507
2543
  super(
2508
- `FAILED_TO_INSERT_DOMAIN_MAPPING: ${body.message}`
2544
+ `RUN_NOT_FOUND: ${body.message}`
2509
2545
  );
2510
2546
  this.body = body;
2511
- this.name = "FailedToInsertDomainMappingError";
2547
+ this.name = "RunNotFoundError";
2512
2548
  }
2513
- static code = "FAILED_TO_INSERT_DOMAIN_MAPPING";
2514
- static statusCode = 500;
2515
- static description = `Failed to insert domain mapping: {message}`;
2549
+ static code = "RUN_NOT_FOUND";
2550
+ static statusCode = 404;
2551
+ static description = `Execute run not found: {run_id}`;
2516
2552
  }
2517
- class PermissionDeniedError extends Error {
2553
+ class ObservabilityDatabaseErrorError extends Error {
2518
2554
  constructor(body) {
2519
2555
  super(
2520
- `PERMISSION_DENIED: ${body.message}`
2556
+ `OBSERVABILITY_DATABASE_ERROR: ${body.message}`
2521
2557
  );
2522
2558
  this.body = body;
2523
- this.name = "PermissionDeniedError";
2559
+ this.name = "ObservabilityDatabaseErrorError";
2524
2560
  }
2525
- static code = "PERMISSION_DENIED";
2526
- static statusCode = 401;
2527
- static description = `Permission denied: {message}`;
2561
+ static code = "OBSERVABILITY_DATABASE_ERROR";
2562
+ static statusCode = 500;
2563
+ static description = `Database operation failed: {message}`;
2528
2564
  }
2529
- class FailedToCheckPermissionsError extends Error {
2565
+ class ObservabilityAccessDeniedError extends Error {
2530
2566
  constructor(body) {
2531
2567
  super(
2532
- `FAILED_TO_CHECK_PERMISSIONS: ${body.message}`
2568
+ `OBSERVABILITY_ACCESS_DENIED: ${body.message}`
2533
2569
  );
2534
2570
  this.body = body;
2535
- this.name = "FailedToCheckPermissionsError";
2571
+ this.name = "ObservabilityAccessDeniedError";
2536
2572
  }
2537
- static code = "FAILED_TO_CHECK_PERMISSIONS";
2538
- static statusCode = 502;
2539
- static description = `Failed to check permissions: {message}`;
2573
+ static code = "OBSERVABILITY_ACCESS_DENIED";
2574
+ static statusCode = 403;
2575
+ static description = `Access denied to logs for deployment: {deployment_id}`;
2540
2576
  }
2541
- class FailedToListDomainsError extends Error {
2577
+ class ParseLogsFailedError extends Error {
2542
2578
  constructor(body) {
2543
2579
  super(
2544
- `FAILED_TO_LIST_DOMAINS: ${body.message}`
2580
+ `PARSE_LOGS_FAILED: ${body.message}`
2545
2581
  );
2546
2582
  this.body = body;
2547
- this.name = "FailedToListDomainsError";
2583
+ this.name = "ParseLogsFailedError";
2548
2584
  }
2549
- static code = "FAILED_TO_LIST_DOMAINS";
2585
+ static code = "PARSE_LOGS_FAILED";
2550
2586
  static statusCode = 500;
2551
- static description = `Failed to list domains: {message}`;
2587
+ static description = `Failed to parse logs: {message}`;
2552
2588
  }
2553
- class FailedToListVerificationsError extends Error {
2589
+ class RetrieveLogsFailedError extends Error {
2554
2590
  constructor(body) {
2555
2591
  super(
2556
- `FAILED_TO_LIST_VERIFICATIONS: ${body.message}`
2592
+ `RETRIEVE_LOGS_FAILED: ${body.message}`
2557
2593
  );
2558
2594
  this.body = body;
2559
- this.name = "FailedToListVerificationsError";
2595
+ this.name = "RetrieveLogsFailedError";
2560
2596
  }
2561
- static code = "FAILED_TO_LIST_VERIFICATIONS";
2597
+ static code = "RETRIEVE_LOGS_FAILED";
2562
2598
  static statusCode = 500;
2563
- static description = `Failed to list verifications: {message}`;
2599
+ static description = `Failed to retrieve logs: {message}`;
2564
2600
  }
2565
- class FailedToVerifyDomainError extends Error {
2601
+ class InvalidQueryError extends Error {
2566
2602
  constructor(body) {
2567
2603
  super(
2568
- `FAILED_TO_VERIFY_DOMAIN: ${body.message}`
2604
+ `INVALID_QUERY: ${body.message}`
2569
2605
  );
2570
2606
  this.body = body;
2571
- this.name = "FailedToVerifyDomainError";
2607
+ this.name = "InvalidQueryError";
2572
2608
  }
2573
- static code = "FAILED_TO_VERIFY_DOMAIN";
2574
- static statusCode = 500;
2575
- static description = `Failed to verify domain: {message}`;
2609
+ static code = "INVALID_QUERY";
2610
+ static statusCode = 400;
2611
+ static description = `Invalid log query: {message}`;
2576
2612
  }
2577
- class VerificationFailedError extends Error {
2613
+ class LogsNotFoundError extends Error {
2578
2614
  constructor(body) {
2579
2615
  super(
2580
- `VERIFICATION_FAILED: ${body.message}`
2616
+ `LOGS_NOT_FOUND: ${body.message}`
2581
2617
  );
2582
2618
  this.body = body;
2583
- this.name = "VerificationFailedError";
2619
+ this.name = "LogsNotFoundError";
2584
2620
  }
2585
- static code = "VERIFICATION_FAILED";
2586
- static statusCode = 400;
2587
- static description = `Domain verification failed: {message}`;
2621
+ static code = "LOGS_NOT_FOUND";
2622
+ static statusCode = 404;
2623
+ static description = `Logs not found for deployment: {deployment_id}`;
2588
2624
  }
2589
- class FailedToDeleteVerificationError extends Error {
2625
+ class CloudstateInternalErrorError extends Error {
2590
2626
  constructor(body) {
2591
2627
  super(
2592
- `FAILED_TO_DELETE_VERIFICATION: ${body.message}`
2628
+ `CLOUDSTATE_INTERNAL_ERROR: ${body.message}`
2593
2629
  );
2594
2630
  this.body = body;
2595
- this.name = "FailedToDeleteVerificationError";
2631
+ this.name = "CloudstateInternalErrorError";
2596
2632
  }
2597
- static code = "FAILED_TO_DELETE_VERIFICATION";
2598
- static statusCode = 400;
2599
- static description = `Failed to delete verification: {message}`;
2633
+ static code = "CLOUDSTATE_INTERNAL_ERROR";
2634
+ static statusCode = 500;
2635
+ static description = `Internal error: {message}`;
2600
2636
  }
2601
- class VerificationNotFoundError extends Error {
2637
+ class CloudstateDatabaseErrorError extends Error {
2602
2638
  constructor(body) {
2603
2639
  super(
2604
- `VERIFICATION_NOT_FOUND: ${body.message}`
2640
+ `CLOUDSTATE_DATABASE_ERROR: ${body.message}`
2605
2641
  );
2606
2642
  this.body = body;
2607
- this.name = "VerificationNotFoundError";
2643
+ this.name = "CloudstateDatabaseErrorError";
2608
2644
  }
2609
- static code = "VERIFICATION_NOT_FOUND";
2610
- static statusCode = 404;
2611
- static description = `Verification request not found for domain: {domain}`;
2645
+ static code = "CLOUDSTATE_DATABASE_ERROR";
2646
+ static statusCode = 500;
2647
+ static description = `Database operation failed: {message}`;
2612
2648
  }
2613
- class FailedToCreateVerificationCodeError extends Error {
2649
+ class CloudstateAccessDeniedError extends Error {
2614
2650
  constructor(body) {
2615
2651
  super(
2616
- `FAILED_TO_CREATE_VERIFICATION_CODE: ${body.message}`
2652
+ `CLOUDSTATE_ACCESS_DENIED: ${body.message}`
2617
2653
  );
2618
2654
  this.body = body;
2619
- this.name = "FailedToCreateVerificationCodeError";
2655
+ this.name = "CloudstateAccessDeniedError";
2620
2656
  }
2621
- static code = "FAILED_TO_CREATE_VERIFICATION_CODE";
2622
- static statusCode = 400;
2623
- static description = `Failed to create verification code: {message}`;
2657
+ static code = "CLOUDSTATE_ACCESS_DENIED";
2658
+ static statusCode = 403;
2659
+ static description = `Access denied to project: {project_id}`;
2624
2660
  }
2625
- class InvalidDomainError extends Error {
2661
+ class RestoreFailedError extends Error {
2626
2662
  constructor(body) {
2627
2663
  super(
2628
- `INVALID_DOMAIN: ${body.message}`
2664
+ `RESTORE_FAILED: ${body.message}`
2629
2665
  );
2630
2666
  this.body = body;
2631
- this.name = "InvalidDomainError";
2667
+ this.name = "RestoreFailedError";
2632
2668
  }
2633
- static code = "INVALID_DOMAIN";
2634
- static statusCode = 400;
2635
- static description = `Invalid domain: {domain}`;
2669
+ static code = "RESTORE_FAILED";
2670
+ static statusCode = 500;
2671
+ static description = `Failed to restore from backup: {message}`;
2636
2672
  }
2637
- class DomainAlreadyExistsError extends Error {
2673
+ class CreateBackupFailedError extends Error {
2638
2674
  constructor(body) {
2639
2675
  super(
2640
- `DOMAIN_ALREADY_EXISTS: ${body.message}`
2676
+ `CREATE_BACKUP_FAILED: ${body.message}`
2641
2677
  );
2642
2678
  this.body = body;
2643
- this.name = "DomainAlreadyExistsError";
2679
+ this.name = "CreateBackupFailedError";
2644
2680
  }
2645
- static code = "DOMAIN_ALREADY_EXISTS";
2646
- static statusCode = 400;
2647
- static description = `Domain already exists: {domain}`;
2681
+ static code = "CREATE_BACKUP_FAILED";
2682
+ static statusCode = 500;
2683
+ static description = `Failed to create backup: {message}`;
2648
2684
  }
2649
- class FailedToInsertOwnershipError extends Error {
2685
+ class BackupFailedError extends Error {
2650
2686
  constructor(body) {
2651
2687
  super(
2652
- `FAILED_TO_INSERT_OWNERSHIP: ${body.message}`
2688
+ `BACKUP_FAILED: ${body.message}`
2653
2689
  );
2654
2690
  this.body = body;
2655
- this.name = "FailedToInsertOwnershipError";
2691
+ this.name = "BackupFailedError";
2656
2692
  }
2657
- static code = "FAILED_TO_INSERT_OWNERSHIP";
2693
+ static code = "BACKUP_FAILED";
2658
2694
  static statusCode = 500;
2659
- static description = `Failed to insert domain ownership: {message}`;
2695
+ static description = `Backup failed: {message}`;
2660
2696
  }
2661
- class FailedRemoveDomainMappingError extends Error {
2697
+ class DeploymentFailedError extends Error {
2662
2698
  constructor(body) {
2663
2699
  super(
2664
- `FAILED_REMOVE_DOMAIN_MAPPING: ${body.message}`
2700
+ `DEPLOYMENT_FAILED: ${body.message}`
2665
2701
  );
2666
2702
  this.body = body;
2667
- this.name = "FailedRemoveDomainMappingError";
2703
+ this.name = "DeploymentFailedError";
2668
2704
  }
2669
- static code = "FAILED_REMOVE_DOMAIN_MAPPING";
2705
+ static code = "DEPLOYMENT_FAILED";
2670
2706
  static statusCode = 500;
2671
- static description = `Failed to remove domain mapping: {message}`;
2707
+ static description = `Deployment failed: {message}`;
2672
2708
  }
2673
- class FailedPermissionsCheckError extends Error {
2709
+ class InvalidDeploymentRequestError extends Error {
2674
2710
  constructor(body) {
2675
2711
  super(
2676
- `FAILED_PERMISSIONS_CHECK: ${body.message}`
2712
+ `INVALID_DEPLOYMENT_REQUEST: ${body.message}`
2677
2713
  );
2678
2714
  this.body = body;
2679
- this.name = "FailedPermissionsCheckError";
2715
+ this.name = "InvalidDeploymentRequestError";
2680
2716
  }
2681
- static code = "FAILED_PERMISSIONS_CHECK";
2682
- static statusCode = 401;
2683
- static description = `You do not have permission to delete the domain mapping for: {domain}`;
2717
+ static code = "INVALID_DEPLOYMENT_REQUEST";
2718
+ static statusCode = 400;
2719
+ static description = `Invalid deployment request: {message}`;
2684
2720
  }
2685
- class FailedToCheckDomainMappingPermissionsError extends Error {
2721
+ class ProjectNotFoundError extends Error {
2686
2722
  constructor(body) {
2687
2723
  super(
2688
- `FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS: ${body.message}`
2724
+ `PROJECT_NOT_FOUND: ${body.message}`
2689
2725
  );
2690
2726
  this.body = body;
2691
- this.name = "FailedToCheckDomainMappingPermissionsError";
2727
+ this.name = "ProjectNotFoundError";
2692
2728
  }
2693
- static code = "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS";
2694
- static statusCode = 502;
2695
- static description = `Failed to check permissions: {message}`;
2729
+ static code = "PROJECT_NOT_FOUND";
2730
+ static statusCode = 404;
2731
+ static description = `Project not found: {project_id}`;
2696
2732
  }
2697
2733
  const FREESTYLE_ERROR_CODE_MAP = {
2698
2734
  "GIT_ERROR": GitErrorError,
2699
- "INTERNAL_ERROR": InternalErrorError,
2700
- "DOCKER_IMPORT_BAD_REQUEST": DockerImportBadRequestError,
2701
2735
  "VM_OPERATION_DENIED_DURING_TRANSACTION": VmOperationDeniedDuringTransactionError,
2702
2736
  "VM_TRANSACTION_ID_MISMATCH": VmTransactionIdMismatchError,
2703
2737
  "VM_NOT_IN_TRANSACTION": VmNotInTransactionError,
2704
- "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
2705
- "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
2706
2738
  "SNAPSHOT_VM_BAD_REQUEST": SnapshotVmBadRequestError,
2739
+ "KERNEL_PANIC": KernelPanicError,
2707
2740
  "VM_DELETED": VmDeletedError,
2708
2741
  "REQWEST": ReqwestError,
2709
2742
  "FIRECRACKER_PID_NOT_FOUND": FirecrackerPidNotFoundError,
2710
2743
  "FIRECRACKER_API_SOCKET_NOT_FOUND": FirecrackerApiSocketNotFoundError,
2744
+ "INVALID_SNAPSHOT_ID": InvalidSnapshotIdError,
2711
2745
  "VM_START_TIMEOUT": VmStartTimeoutError,
2712
2746
  "VM_EXIT_DURING_START": VmExitDuringStartError,
2747
+ "VM_ACCESS_DENIED": VmAccessDeniedError,
2713
2748
  "STD_IO": StdIoError,
2714
2749
  "VM_CREATE_TMUX_SESSION": VmCreateTmuxSessionError,
2715
2750
  "VM_SUBNET_NOT_FOUND": VmSubnetNotFoundError,
2751
+ "INTERNAL_ERROR": InternalErrorError,
2752
+ "FORK_VM_NOT_FOUND": ForkVmNotFoundError,
2753
+ "CREATE_SNAPSHOT_BAD_REQUEST": CreateSnapshotBadRequestError,
2716
2754
  "FILE_NOT_FOUND": FileNotFoundError,
2717
2755
  "FILES_BAD_REQUEST": FilesBadRequestError,
2756
+ "DOCKER_IMPORT_BAD_REQUEST": DockerImportBadRequestError,
2757
+ "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2758
+ "ALREADY_HAS_BASE": AlreadyHasBaseError,
2759
+ "NOT_FOUND": NotFoundError,
2718
2760
  "VM_NOT_FOUND_IN_FS": VmNotFoundInFsError,
2719
2761
  "VM_NOT_RUNNING": VmNotRunningError,
2720
2762
  "VM_NOT_FOUND": VmNotFoundError,
2721
2763
  "INTERNAL_FORK_VM_NOT_FOUND": InternalForkVmNotFoundError,
2722
2764
  "BAD_REQUEST": BadRequestError,
2723
2765
  "INTERNAL_VM_NOT_FOUND": InternalVmNotFoundError,
2724
- "VM_MUST_BE_STOPPED": VmMustBeStoppedError,
2725
- "ALREADY_HAS_BASE": AlreadyHasBaseError,
2726
- "NOT_FOUND": NotFoundError,
2727
2766
  "CREATE_VM_BAD_REQUEST": CreateVmBadRequestError,
2728
2767
  "USER_NOT_FOUND": UserNotFoundError,
2729
2768
  "USER_ALREADY_EXISTS": UserAlreadyExistsError,
@@ -2767,104 +2806,38 @@ const FREESTYLE_ERROR_CODE_MAP = {
2767
2806
  "INVALID_PARAMETERS": InvalidParametersError,
2768
2807
  "MAX_USES_EXCEEDED": MaxUsesExceededError,
2769
2808
  "EXPIRED": ExpiredError,
2809
+ "TAG_NOT_FOUND": TagNotFoundError,
2810
+ "TREE_NOT_FOUND": TreeNotFoundError,
2811
+ "BRANCH_NOT_FOUND": BranchNotFoundError,
2770
2812
  "FORBIDDEN": ForbiddenError,
2771
2813
  "UNAUTHORIZED": UnauthorizedError,
2772
- "INVALID_SERVICE": InvalidServiceError,
2773
- "EXPECTED_SERVICE": ExpectedServiceError,
2774
- "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2775
- "CONFLICT": ConflictError,
2776
- "BRANCH_NOT_FOUND": BranchNotFoundError,
2777
- "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
2778
- "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
2779
- "SOURCE_NOT_FOUND": SourceNotFoundError,
2780
- "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
2781
2814
  "REPO_ALREADY_EXISTS": RepoAlreadyExistsError,
2782
- "PATH_NOT_FOUND": PathNotFoundError,
2783
- "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2784
- "TAG_NOT_FOUND": TagNotFoundError,
2785
- "SEND_ERROR": SendErrorError,
2786
2815
  "GIT_HUB_SYNC_CONFLICT": GitHubSyncConflictError,
2787
2816
  "INVALID_OBJECT_ID": InvalidObjectIdError,
2788
2817
  "COMMIT_NOT_FOUND": CommitNotFoundError,
2789
- "TREE_NOT_FOUND": TreeNotFoundError,
2790
- "INVALID_REVISION": InvalidRevisionError,
2818
+ "PACKFILE": PackfileError,
2819
+ "SEND_ERROR": SendErrorError,
2820
+ "UNSUPPORTED_TRANSFER": UnsupportedTransferError,
2791
2821
  "INVALID_RANGE": InvalidRangeError,
2792
2822
  "OFFSET_WITH_SELECTOR": OffsetWithSelectorError,
2793
2823
  "COMMIT_NOT_IN_BRANCH": CommitNotInBranchError,
2794
2824
  "BLOB_NOT_FOUND": BlobNotFoundError,
2825
+ "INVALID_SERVICE": InvalidServiceError,
2826
+ "EXPECTED_SERVICE": ExpectedServiceError,
2827
+ "PATH_NOT_FOUND": PathNotFoundError,
2828
+ "REFERENCE_NOT_FOUND": ReferenceNotFoundError,
2795
2829
  "AMBIGUOUS": AmbiguousError,
2796
2830
  "INVALID": InvalidError,
2797
- "PACKFILE": PackfileError,
2831
+ "INVALID_ACCOUNT_ID": InvalidAccountIdError,
2832
+ "SOURCE_IMPORT_CONFLICT": SourceImportConflictError,
2833
+ "SOURCE_UNAUTHORIZED": SourceUnauthorizedError,
2834
+ "SOURCE_NOT_FOUND": SourceNotFoundError,
2835
+ "IMPORT_SUBDIR_NOT_FOUND": ImportSubdirNotFoundError,
2836
+ "CONFLICT": ConflictError,
2837
+ "INVALID_REVISION": InvalidRevisionError,
2798
2838
  "DATABASE_ERROR": DatabaseErrorError,
2799
- "EMPTY_TAG": EmptyTagError,
2800
- "RESIZE_FAILED": ResizeFailedError,
2801
- "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
2802
- "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
2803
- "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
2804
- "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
2805
- "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
2806
- "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
2807
- "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
2808
- "WATCH_FILES_FAILED": WatchFilesFailedError,
2809
- "LOGS_FAILED": LogsFailedError,
2810
- "STATUS_FAILED": StatusFailedError,
2811
- "RESTART_FAILED": RestartFailedError,
2812
- "SHUTDOWN_FAILED": ShutdownFailedError,
2813
- "COMMIT_FAILED": CommitFailedError,
2814
- "WRITE_FILE_FAILED": WriteFileFailedError,
2815
- "READ_FILE_FAILED": ReadFileFailedError,
2816
- "EXECUTION_FAILED": ExecutionFailedError,
2817
- "REQUEST_FAILED": RequestFailedError,
2818
- "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
2819
- "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
2820
2839
  "DEV_SERVER_NOT_FOUND": DevServerNotFoundError,
2821
- "ANYHOW": AnyhowError,
2822
- "BRANCH_NAME_EMPTY": BranchNameEmptyError,
2823
- "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
2824
- "LIST_TOKENS_FAILED": ListTokensFailedError,
2825
- "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
2826
- "CREATE_TOKEN_FAILED": CreateTokenFailedError,
2827
- "LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
2828
- "GET_PERMISSION_FAILED": GetPermissionFailedError,
2829
- "UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
2830
- "REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
2831
- "GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
2832
- "LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
2833
- "DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
2834
- "CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
2835
- "VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
2836
- "PERMISSION_NOT_FOUND": PermissionNotFoundError,
2837
- "VM_ACCESS_DENIED": VmAccessDeniedError,
2838
- "GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
2839
- "GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
2840
- "CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
2841
- "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
2842
- "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
2843
- "IDENTITY_NOT_FOUND": IdentityNotFoundError,
2844
- "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
2845
- "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
2846
- "LIST_RUNS_FAILED": ListRunsFailedError,
2847
- "EXECUTION_ERROR": ExecutionErrorError,
2848
- "CONNECTION_FAILED": ConnectionFailedError,
2849
- "METADATA_WRITE_FAILED": MetadataWriteFailedError,
2850
- "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
2851
- "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
2852
- "LOCK_GENERATION_FAILED": LockGenerationFailedError,
2853
- "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
2854
- "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
2855
- "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
2856
- "LOGGING_FAILED": LoggingFailedError,
2857
- "RUN_NOT_FOUND": RunNotFoundError,
2858
- "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
2859
- "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
2860
- "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
2861
- "RESTORE_FAILED": RestoreFailedError,
2862
- "CREATE_BACKUP_FAILED": CreateBackupFailedError,
2863
- "BACKUP_FAILED": BackupFailedError,
2864
- "DEPLOYMENT_FAILED": DeploymentFailedError,
2865
- "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
2866
- "PROJECT_NOT_FOUND": ProjectNotFoundError,
2867
- "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
2840
+ "EMPTY_TAG": EmptyTagError,
2868
2841
  "BUILD_FAILED": BuildFailedError,
2869
2842
  "SERVER_DEPLOYMENT_FAILED": ServerDeploymentFailedError,
2870
2843
  "LOCKFILE_ERROR": LockfileErrorError,
@@ -2877,12 +2850,8 @@ const FREESTYLE_ERROR_CODE_MAP = {
2877
2850
  "INVALID_DOMAINS": InvalidDomainsError,
2878
2851
  "WEB_DEPLOYMENT_BAD_REQUEST": WebDeploymentBadRequestError,
2879
2852
  "DEPLOYMENT_NOT_FOUND": DeploymentNotFoundError,
2880
- "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2881
- "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2882
- "PARSE_LOGS_FAILED": ParseLogsFailedError,
2883
- "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2884
- "INVALID_QUERY": InvalidQueryError,
2885
- "LOGS_NOT_FOUND": LogsNotFoundError,
2853
+ "RESIZE_FAILED": ResizeFailedError,
2854
+ "INTERNAL_RESIZE_VM_NOT_FOUND": InternalResizeVmNotFoundError,
2886
2855
  "TRIGGER_ERROR": TriggerErrorError,
2887
2856
  "TOKEN_ERROR": TokenErrorError,
2888
2857
  "PERMISSION_ERROR": PermissionErrorError,
@@ -2918,7 +2887,77 @@ const FREESTYLE_ERROR_CODE_MAP = {
2918
2887
  "FAILED_TO_INSERT_OWNERSHIP": FailedToInsertOwnershipError,
2919
2888
  "FAILED_REMOVE_DOMAIN_MAPPING": FailedRemoveDomainMappingError,
2920
2889
  "FAILED_PERMISSIONS_CHECK": FailedPermissionsCheckError,
2921
- "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError
2890
+ "FAILED_TO_CHECK_DOMAIN_MAPPING_PERMISSIONS": FailedToCheckDomainMappingPermissionsError,
2891
+ "BRANCH_NAME_EMPTY": BranchNameEmptyError,
2892
+ "ANYHOW": AnyhowError,
2893
+ "PERMISSION_ALREADY_EXISTS": PermissionAlreadyExistsError,
2894
+ "LIST_TOKENS_FAILED": ListTokensFailedError,
2895
+ "REVOKE_TOKEN_FAILED": RevokeTokenFailedError,
2896
+ "CREATE_TOKEN_FAILED": CreateTokenFailedError,
2897
+ "LIST_PERMISSIONS_FAILED": ListPermissionsFailedError,
2898
+ "GET_PERMISSION_FAILED": GetPermissionFailedError,
2899
+ "UPDATE_PERMISSION_FAILED": UpdatePermissionFailedError,
2900
+ "REVOKE_PERMISSION_FAILED": RevokePermissionFailedError,
2901
+ "GRANT_PERMISSION_FAILED": GrantPermissionFailedError,
2902
+ "LIST_IDENTITIES_FAILED": ListIdentitiesFailedError,
2903
+ "DELETE_IDENTITY_FAILED": DeleteIdentityFailedError,
2904
+ "CREATE_IDENTITY_FAILED": CreateIdentityFailedError,
2905
+ "VM_PERMISSION_NOT_FOUND": VmPermissionNotFoundError,
2906
+ "PERMISSION_NOT_FOUND": PermissionNotFoundError,
2907
+ "GIT_REPOSITORY_ACCESS_DENIED": GitRepositoryAccessDeniedError,
2908
+ "GIT_REPOSITORY_NOT_FOUND": GitRepositoryNotFoundError,
2909
+ "CANNOT_DELETE_MANAGED_IDENTITY": CannotDeleteManagedIdentityError,
2910
+ "CANNOT_MODIFY_MANAGED_IDENTITY": CannotModifyManagedIdentityError,
2911
+ "IDENTITY_ACCESS_DENIED": IdentityAccessDeniedError,
2912
+ "IDENTITY_NOT_FOUND": IdentityNotFoundError,
2913
+ "DOMAIN_OWNERSHIP_VERIFICATION_FAILED": DomainOwnershipVerificationFailedError,
2914
+ "ERROR_DELETING_RECORD": ErrorDeletingRecordError,
2915
+ "RECORD_OWNERSHIP_ERROR": RecordOwnershipErrorError,
2916
+ "ERROR_CREATING_RECORD": ErrorCreatingRecordError,
2917
+ "DOMAIN_OWNERSHIP_ERROR": DomainOwnershipErrorError,
2918
+ "BROWSER_OPERATION_FAILED": BrowserOperationFailedError,
2919
+ "WATCH_FILES_FAILED": WatchFilesFailedError,
2920
+ "LOGS_FAILED": LogsFailedError,
2921
+ "STATUS_FAILED": StatusFailedError,
2922
+ "RESTART_FAILED": RestartFailedError,
2923
+ "SHUTDOWN_FAILED": ShutdownFailedError,
2924
+ "COMMIT_FAILED": CommitFailedError,
2925
+ "WRITE_FILE_FAILED": WriteFileFailedError,
2926
+ "READ_FILE_FAILED": ReadFileFailedError,
2927
+ "EXECUTION_FAILED": ExecutionFailedError,
2928
+ "REQUEST_FAILED": RequestFailedError,
2929
+ "DEV_SERVER_FILE_NOT_FOUND": DevServerFileNotFoundError,
2930
+ "DEV_SERVER_INVALID_REQUEST": DevServerInvalidRequestError,
2931
+ "UNAUTHORIZED_ERROR": UnauthorizedErrorError,
2932
+ "EXECUTE_INTERNAL_ERROR": ExecuteInternalErrorError,
2933
+ "EXECUTE_ACCESS_DENIED": ExecuteAccessDeniedError,
2934
+ "LIST_RUNS_FAILED": ListRunsFailedError,
2935
+ "EXECUTION_ERROR": ExecutionErrorError,
2936
+ "CONNECTION_FAILED": ConnectionFailedError,
2937
+ "METADATA_WRITE_FAILED": MetadataWriteFailedError,
2938
+ "NODE_MODULES_INSTALL_FAILED": NodeModulesInstallFailedError,
2939
+ "NODE_MODULES_DOWNLOAD_FAILED": NodeModulesDownloadFailedError,
2940
+ "LOCK_GENERATION_FAILED": LockGenerationFailedError,
2941
+ "WRITE_SCRIPT_FAILED": WriteScriptFailedError,
2942
+ "DIRECTORY_CREATION_FAILED": DirectoryCreationFailedError,
2943
+ "NETWORK_PERMISSIONS_FAILED": NetworkPermissionsFailedError,
2944
+ "LOGGING_FAILED": LoggingFailedError,
2945
+ "RUN_NOT_FOUND": RunNotFoundError,
2946
+ "OBSERVABILITY_DATABASE_ERROR": ObservabilityDatabaseErrorError,
2947
+ "OBSERVABILITY_ACCESS_DENIED": ObservabilityAccessDeniedError,
2948
+ "PARSE_LOGS_FAILED": ParseLogsFailedError,
2949
+ "RETRIEVE_LOGS_FAILED": RetrieveLogsFailedError,
2950
+ "INVALID_QUERY": InvalidQueryError,
2951
+ "LOGS_NOT_FOUND": LogsNotFoundError,
2952
+ "CLOUDSTATE_INTERNAL_ERROR": CloudstateInternalErrorError,
2953
+ "CLOUDSTATE_DATABASE_ERROR": CloudstateDatabaseErrorError,
2954
+ "CLOUDSTATE_ACCESS_DENIED": CloudstateAccessDeniedError,
2955
+ "RESTORE_FAILED": RestoreFailedError,
2956
+ "CREATE_BACKUP_FAILED": CreateBackupFailedError,
2957
+ "BACKUP_FAILED": BackupFailedError,
2958
+ "DEPLOYMENT_FAILED": DeploymentFailedError,
2959
+ "INVALID_DEPLOYMENT_REQUEST": InvalidDeploymentRequestError,
2960
+ "PROJECT_NOT_FOUND": ProjectNotFoundError
2922
2961
  };
2923
2962
 
2924
2963
  var errors = /*#__PURE__*/Object.freeze({
@@ -3028,6 +3067,7 @@ var errors = /*#__PURE__*/Object.freeze({
3028
3067
  InternalForkVmNotFoundError: InternalForkVmNotFoundError,
3029
3068
  InternalResizeVmNotFoundError: InternalResizeVmNotFoundError,
3030
3069
  InternalVmNotFoundError: InternalVmNotFoundError,
3070
+ InvalidAccountIdError: InvalidAccountIdError,
3031
3071
  InvalidDeploymentRequestError: InvalidDeploymentRequestError,
3032
3072
  InvalidDomainError: InvalidDomainError,
3033
3073
  InvalidDomainsError: InvalidDomainsError,
@@ -3040,6 +3080,8 @@ var errors = /*#__PURE__*/Object.freeze({
3040
3080
  InvalidRevisionError: InvalidRevisionError,
3041
3081
  InvalidServiceError: InvalidServiceError,
3042
3082
  InvalidSignatureError: InvalidSignatureError,
3083
+ InvalidSnapshotIdError: InvalidSnapshotIdError,
3084
+ KernelPanicError: KernelPanicError,
3043
3085
  ListIdentitiesFailedError: ListIdentitiesFailedError,
3044
3086
  ListPermissionsFailedError: ListPermissionsFailedError,
3045
3087
  ListRepositoriesFailedError: ListRepositoriesFailedError,
@@ -3198,8 +3240,11 @@ class ApiClient {
3198
3240
  }
3199
3241
  return headers;
3200
3242
  }
3201
- async requestRaw(method, url, body) {
3202
- const headers = this.getDefaultHeaders();
3243
+ async requestRaw(method, url, body, customHeaders) {
3244
+ const headers = {
3245
+ ...this.getDefaultHeaders(),
3246
+ ...customHeaders
3247
+ };
3203
3248
  if (body) {
3204
3249
  headers["Content-Type"] = "application/json";
3205
3250
  }
@@ -3223,8 +3268,8 @@ class ApiClient {
3223
3268
  }
3224
3269
  return response;
3225
3270
  }
3226
- async request(method, url, body) {
3227
- const response = await this.requestRaw(method, url, body);
3271
+ async request(method, url, body, customHeaders) {
3272
+ const response = await this.requestRaw(method, url, body, customHeaders);
3228
3273
  return response.json();
3229
3274
  }
3230
3275
  async fetch(url, options) {
@@ -3240,32 +3285,32 @@ class ApiClient {
3240
3285
  }
3241
3286
  getRaw(path, options) {
3242
3287
  const url = this.buildUrl(path, options?.params, options?.query);
3243
- return this.requestRaw("GET", url);
3288
+ return this.requestRaw("GET", url, void 0, options?.headers);
3244
3289
  }
3245
3290
  get(path, ...args) {
3246
3291
  const options = args[0];
3247
3292
  const url = this.buildUrl(path, options?.params, options?.query);
3248
- return this.request("GET", url, options?.body);
3293
+ return this.request("GET", url, options?.body, options?.headers);
3249
3294
  }
3250
3295
  post(path, ...args) {
3251
3296
  const options = args[0];
3252
3297
  const url = this.buildUrl(path, options?.params, options?.query);
3253
- return this.request("POST", url, options?.body);
3298
+ return this.request("POST", url, options?.body, options?.headers);
3254
3299
  }
3255
3300
  put(path, ...args) {
3256
3301
  const options = args[0];
3257
3302
  const url = this.buildUrl(path, options?.params, options?.query);
3258
- return this.request("PUT", url, options?.body);
3303
+ return this.request("PUT", url, options?.body, options?.headers);
3259
3304
  }
3260
3305
  delete(path, ...args) {
3261
3306
  const options = args[0];
3262
3307
  const url = this.buildUrl(path, options?.params, options?.query);
3263
- return this.request("DELETE", url, options?.body);
3308
+ return this.request("DELETE", url, options?.body, options?.headers);
3264
3309
  }
3265
3310
  patch(path, ...args) {
3266
3311
  const options = args[0];
3267
3312
  const url = this.buildUrl(path, options?.params, options?.query);
3268
- return this.request("PATCH", url, options?.body);
3313
+ return this.request("PATCH", url, options?.body, options?.headers);
3269
3314
  }
3270
3315
  }
3271
3316
 
@@ -4275,9 +4320,21 @@ class DeploymentsNamespace {
4275
4320
  }) {
4276
4321
  let source;
4277
4322
  if ("repo" in body) {
4323
+ const isUrl = (() => {
4324
+ try {
4325
+ new URL(body.repo);
4326
+ return true;
4327
+ } catch {
4328
+ return false;
4329
+ }
4330
+ })();
4331
+ const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
4332
+ body.repo
4333
+ );
4334
+ const repoUrl = isUrl ? body.repo : isUuid ? `https://git.freestyle.sh/${body.repo}` : body.repo;
4278
4335
  source = {
4279
4336
  kind: "git",
4280
- url: body.repo,
4337
+ url: repoUrl,
4281
4338
  branch: body.branch,
4282
4339
  dir: body.rootPath
4283
4340
  };
@@ -4423,7 +4480,8 @@ class FileSystem {
4423
4480
  */
4424
4481
  async readFile(filepath) {
4425
4482
  const response = await this.client.get("/v1/vms/{vm_id}/files/{filepath}", {
4426
- params: { vm_id: this.vmId, filepath }
4483
+ params: { vm_id: this.vmId, filepath },
4484
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4427
4485
  });
4428
4486
  if (response && typeof response === "object" && "content" in response) {
4429
4487
  const content = response.content;
@@ -4444,7 +4502,8 @@ class FileSystem {
4444
4502
  const base64Content = content.toString("base64");
4445
4503
  await this.client.put("/v1/vms/{vm_id}/files/{filepath}", {
4446
4504
  params: { vm_id: this.vmId, filepath },
4447
- body: { content: base64Content }
4505
+ body: { content: base64Content },
4506
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4448
4507
  });
4449
4508
  }
4450
4509
  /**
@@ -4474,7 +4533,8 @@ class FileSystem {
4474
4533
  */
4475
4534
  async readDir(path) {
4476
4535
  const response = await this.client.get("/v1/vms/{vm_id}/files/{filepath}", {
4477
- params: { vm_id: this.vmId, filepath: path }
4536
+ params: { vm_id: this.vmId, filepath: path },
4537
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4478
4538
  });
4479
4539
  if ("files" in response && response.files) {
4480
4540
  return response.files;
@@ -4573,7 +4633,8 @@ class FileSystem {
4573
4633
  const response = await this.client.fetch(
4574
4634
  `/v1/vms/${this.vmId}/watch-files`,
4575
4635
  {
4576
- method: "POST"
4636
+ method: "POST",
4637
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4577
4638
  }
4578
4639
  );
4579
4640
  if (!response.ok) {
@@ -4976,15 +5037,24 @@ class VmTerminals {
4976
5037
  this.vmId = vmId;
4977
5038
  this.client = client;
4978
5039
  }
5040
+ vm = null;
4979
5041
  /**
4980
5042
  * List all terminals in the VM.
4981
5043
  * @returns Array of terminal information
4982
5044
  */
4983
5045
  async list() {
4984
5046
  return this.client.get("/v1/vms/{vm_id}/terminals", {
4985
- params: { vm_id: this.vmId }
5047
+ params: { vm_id: this.vmId },
5048
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4986
5049
  });
4987
5050
  }
5051
+ /**
5052
+ * @internal
5053
+ * Set the parent VM instance for exec operations
5054
+ */
5055
+ _setVm(vm) {
5056
+ this.vm = vm;
5057
+ }
4988
5058
  /**
4989
5059
  * Get logs from a specific terminal.
4990
5060
  * @param terminalId The ID of the terminal
@@ -4992,7 +5062,8 @@ class VmTerminals {
4992
5062
  */
4993
5063
  async getLogs({ terminalId }) {
4994
5064
  return this.client.get("/v1/vms/{vm_id}/terminals/{terminal_id}/logs", {
4995
- params: { vm_id: this.vmId, terminal_id: terminalId }
5065
+ params: { vm_id: this.vmId, terminal_id: terminalId },
5066
+ headers: linuxUsernameHeader(this.vm?._linux_username)
4996
5067
  });
4997
5068
  }
4998
5069
  /**
@@ -5004,7 +5075,8 @@ class VmTerminals {
5004
5075
  return this.client.get(
5005
5076
  "/v1/vms/{vm_id}/terminals/{terminal_id}/xterm-256color",
5006
5077
  {
5007
- params: { vm_id: this.vmId, terminal_id: terminalId }
5078
+ params: { vm_id: this.vmId, terminal_id: terminalId },
5079
+ headers: linuxUsernameHeader(this.vm?._linux_username)
5008
5080
  }
5009
5081
  );
5010
5082
  }
@@ -5016,10 +5088,13 @@ class Vm {
5016
5088
  this.fs = new FileSystem(vmId, apiClient);
5017
5089
  this.fs._setVm(this);
5018
5090
  this.terminals = new VmTerminals(vmId, apiClient);
5091
+ this.terminals._setVm(this);
5019
5092
  }
5020
5093
  vmId;
5021
5094
  fs;
5022
5095
  terminals;
5096
+ /** @internal */
5097
+ _linux_username;
5023
5098
  /**
5024
5099
  * Get the current state and metadata of the VM.
5025
5100
  * @returns VM state information
@@ -5029,6 +5104,11 @@ class Vm {
5029
5104
  params: { vm_id: this.vmId }
5030
5105
  });
5031
5106
  }
5107
+ user({ username }) {
5108
+ let vm = new Vm(this.vmId, this.apiClient);
5109
+ vm._linux_username = username;
5110
+ return vm;
5111
+ }
5032
5112
  /**
5033
5113
  * Start the VM.
5034
5114
  * @param options Optional startup configuration
@@ -5106,7 +5186,8 @@ class Vm {
5106
5186
  command,
5107
5187
  terminal: terminal ?? null,
5108
5188
  timeoutMs: timeoutMs ?? null
5109
- }
5189
+ },
5190
+ headers: linuxUsernameHeader(this._linux_username)
5110
5191
  });
5111
5192
  }
5112
5193
  /**
@@ -5277,6 +5358,19 @@ class VmsNamespace {
5277
5358
  * @returns A VM instance representing the created VM
5278
5359
  */
5279
5360
  async create(options = {}) {
5361
+ if (options.snapshot instanceof VmSpec) {
5362
+ if (options.spec instanceof VmSpec) {
5363
+ if (!options.spec.raw.snapshot) {
5364
+ options.spec.raw.snapshot = options.snapshot;
5365
+ }
5366
+ } else {
5367
+ options.spec = new VmSpec({ snapshot: options.snapshot });
5368
+ }
5369
+ }
5370
+ if ("snapshot" in options) {
5371
+ const { snapshot: _snapshot, ...rest } = options;
5372
+ options = rest;
5373
+ }
5280
5374
  if (options.spec instanceof VmSpec) {
5281
5375
  let spec = options.spec;
5282
5376
  spec = await processOuterSpecBuilders(spec);
@@ -5336,7 +5430,10 @@ class VmsNamespace {
5336
5430
  ...response,
5337
5431
  vmId,
5338
5432
  vm,
5339
- domains: response.domains || []
5433
+ // start to phase out built in domain
5434
+ domains: response.domains.filter(
5435
+ (domain) => !domain.endsWith(".vm.freestyle.sh") && !domain.endsWith(".vm.freestyle.it.com")
5436
+ ) || []
5340
5437
  };
5341
5438
  }
5342
5439
  /**
@@ -5349,15 +5446,14 @@ class VmsNamespace {
5349
5446
  /**
5350
5447
  * Get VM by ID.
5351
5448
  * @param vmId The ID of the VM
5352
- * @param allowedSpecs Array of allowed specs (currently only 1 supported, always uses the first)
5449
+ * @param spec Optional spec to attach builders to the returned VM
5353
5450
  * @returns The VM instance configured with builders from the spec
5354
5451
  */
5355
5452
  async get({
5356
5453
  vmId,
5357
- allowedSpecs
5454
+ spec
5358
5455
  }) {
5359
5456
  const vm = new Vm(vmId, this.apiClient);
5360
- const spec = allowedSpecs?.[0];
5361
5457
  if (spec) {
5362
5458
  const allBuilders = collectSpecBuilders(spec);
5363
5459
  for (const [key, builder] of Object.entries(allBuilders)) {
@@ -5373,8 +5469,22 @@ class VmsNamespace {
5373
5469
  /**
5374
5470
  * Create a VM instance by ID without making an api call.
5375
5471
  */
5376
- ref({ vmId }) {
5377
- return new Vm(vmId, this.apiClient);
5472
+ ref({
5473
+ vmId,
5474
+ spec
5475
+ }) {
5476
+ const vm = new Vm(vmId, this.apiClient);
5477
+ if (spec) {
5478
+ const allBuilders = collectSpecBuilders(spec);
5479
+ for (const [key, builder] of Object.entries(allBuilders)) {
5480
+ if (builder) {
5481
+ const instance = builder.createInstance();
5482
+ instance._init(vm);
5483
+ vm[key] = instance;
5484
+ }
5485
+ }
5486
+ }
5487
+ return vm;
5378
5488
  }
5379
5489
  async delete({ vmId }) {
5380
5490
  return this.apiClient.delete("/v1/vms/{vm_id}", {
@@ -5445,6 +5555,9 @@ async function layerTemplates(templates, snapshots) {
5445
5555
  }
5446
5556
  return lastTemplate;
5447
5557
  }
5558
+ function linuxUsernameHeader(linux_username) {
5559
+ return linux_username ? { "X-Freestyle-Vm-Linux-User-Id": linux_username } : void 0;
5560
+ }
5448
5561
 
5449
5562
  class Freestyle {
5450
5563
  apiClient;