@zuplo/errors 0.0.0

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.
@@ -0,0 +1,1297 @@
1
+ import { HttpStatusCode } from "./http-status";
2
+ import { ProblemDetails, ProblemDetailsFactory } from "./interfaces";
3
+ import { getSourceControlProviderLabel } from "./utils";
4
+
5
+ // Generic
6
+ const zuploGithubAppInstallationUrl =
7
+ "https://github.com/apps/zuplo/installations/new";
8
+ export const INTERNAL_SERVER_ERROR: ProblemDetails = {
9
+ type: "https://zup.fail/http-status/500",
10
+ title: "Internal Server Error",
11
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
12
+ };
13
+
14
+ export const BAD_REQUEST: ProblemDetails = {
15
+ type: "https://zup.fail/http-status/400",
16
+ title: "Bad Request",
17
+ status: HttpStatusCode.BAD_REQUEST,
18
+ };
19
+
20
+ export const CONFLICT: ProblemDetails = {
21
+ type: "https://zup.fail/http-status/409",
22
+ title: "Conflict",
23
+ status: HttpStatusCode.CONFLICT,
24
+ };
25
+
26
+ export const NOT_FOUND: ProblemDetails = {
27
+ type: "https://zup.fail/http-status/404",
28
+ title: "Not Found",
29
+ status: HttpStatusCode.NOT_FOUND,
30
+ };
31
+
32
+ export const METHOD_NOT_ALLOWED: ProblemDetails = {
33
+ type: "https://zup.fail/http-status/405",
34
+ title: "Method Not Allowed",
35
+ status: HttpStatusCode.METHOD_NOT_ALLOWED,
36
+ };
37
+
38
+ export const UNAUTHORIZED: ProblemDetails = {
39
+ type: "https://zup.fail/http-status/401",
40
+ title: "Unauthorized",
41
+ status: HttpStatusCode.UNAUTHORIZED,
42
+ };
43
+
44
+ export const FORBIDDEN: ProblemDetails = {
45
+ type: "https://zup.fail/http-status/403",
46
+ title: "Forbidden",
47
+ status: HttpStatusCode.FORBIDDEN,
48
+ };
49
+
50
+ // Custom
51
+
52
+ export const CLIENT_NOT_FOUND: ProblemDetails = {
53
+ type: "https://zup.fail/client-not-found",
54
+ title: "Client not found",
55
+ status: HttpStatusCode.NOT_FOUND,
56
+ };
57
+
58
+ export const USER_ALREADY_EXISTS: ProblemDetails = {
59
+ type: "https://zup.fail/user-already-exists",
60
+ title: "User already exists",
61
+ status: HttpStatusCode.CONFLICT,
62
+ };
63
+
64
+ export const USER_DETAILS_CANNOT_BE_FOUND: ProblemDetails = {
65
+ type: "https://zup.fail/user-details-cannot-be-found",
66
+ title: "User cannot be found",
67
+ status: HttpStatusCode.NOT_FOUND,
68
+ };
69
+
70
+ export const USER_HAS_NO_ACCESS_TO_ACCOUNT: ProblemDetails = {
71
+ type: "https://zup.fail/user-has-no-access-to-account",
72
+ title: "Not a member of the account",
73
+ status: HttpStatusCode.UNAUTHORIZED,
74
+ };
75
+
76
+ export const USER_REMOVE_NOT_MEMBER_ACCOUNT: ProblemDetails = {
77
+ type: "https://zup.fail/removed-user-not-account-member",
78
+ title: "The user being removed is not a member of the account",
79
+ status: HttpStatusCode.BAD_REQUEST,
80
+ };
81
+
82
+ export const USER_IS_NOT_SERVICE_ACCOUNT: ProblemDetails = {
83
+ type: "https://zup.fail/user-not-service-account",
84
+ title: "User is not a service account",
85
+ status: HttpStatusCode.BAD_REQUEST,
86
+ };
87
+
88
+ export const ACCOUNT_NOT_FOUND: ProblemDetails = {
89
+ type: "https://zup.fail/account-not-found",
90
+ title: "Account not found",
91
+ status: HttpStatusCode.NOT_FOUND,
92
+ };
93
+
94
+ export const ACCOUNT_ALREADY_EXISTS: ProblemDetails = {
95
+ type: "https://zup.fail/account-already-exists",
96
+ title: "Account already exists",
97
+ status: HttpStatusCode.CONFLICT,
98
+ };
99
+
100
+ export const ACCOUNT_NAME_USES_RESERVED_KEYWORD: ProblemDetails = {
101
+ type: "https://zup.fail/account-name-reserved-keyword",
102
+ title: "The account name can not use reserved keyword 'zuplo'",
103
+ status: HttpStatusCode.BAD_REQUEST,
104
+ };
105
+
106
+ export const ACCOUNT_NAME_STARTS_WITH_RESERVED_KEYWORD: ProblemDetails = {
107
+ type: "https://zup.fail/account-use-reserved-keyword",
108
+ title: "The account name can not start with a reserved keyword",
109
+ status: HttpStatusCode.BAD_REQUEST,
110
+ };
111
+
112
+ export const ACCOUNT_DOES_NOT_EXISTS: ProblemDetails = {
113
+ type: "https://zup.fail/account-does-not-exists",
114
+ title: "You are not a member of any accounts",
115
+ status: HttpStatusCode.NOT_FOUND,
116
+ };
117
+
118
+ export const ACCOUNT_INFO_MISSING: ProblemDetails = {
119
+ type: "https://zup.fail/account-info-missing",
120
+ title: "Account information is required",
121
+ status: HttpStatusCode.NOT_FOUND,
122
+ };
123
+
124
+ export const ACCOUNT_UPDATE_INFO_MISSING: ProblemDetails = {
125
+ type: "https://zup.fail/account-update-info-missing",
126
+ title: "Account information is insufficient for this operation.",
127
+ status: HttpStatusCode.BAD_REQUEST,
128
+ };
129
+
130
+ export const ACCOUNT_MEMBER_ALREADY_EXISTS: ProblemDetails = {
131
+ type: "https://zup.fail/account-member-already-exists",
132
+ title: "Account member already exists",
133
+ status: HttpStatusCode.BAD_REQUEST,
134
+ };
135
+
136
+ export const ACCOUNT_MEMBER_INFO_MISSING: ProblemDetails = {
137
+ type: "https://zup.fail/account-member-info-missing",
138
+ title: "Account member information is required",
139
+ status: HttpStatusCode.BAD_REQUEST,
140
+ };
141
+
142
+ export const ACCOUNT_MEMBER_DOES_NOT_EXIST: ProblemDetails = {
143
+ type: "https://zup.fail/account-member-does-not-exists",
144
+ title: "Account member information cannot be found",
145
+ status: HttpStatusCode.NOT_FOUND,
146
+ };
147
+
148
+ export const ACCOUNT_MEMBER_INVITE_DOES_NOT_EXIST: ProblemDetails = {
149
+ type: "https://zup.fail/account-member-invite-does-not-exist",
150
+ title: "Account member invite cannot be found",
151
+ status: HttpStatusCode.NOT_FOUND,
152
+ };
153
+
154
+ export const ACCOUNT_MEMBER_INVITE_INVALID: ProblemDetails = {
155
+ type: "https://zup.fail/account-member-invite-invalid",
156
+ title: "Account member invite is invalid",
157
+ status: HttpStatusCode.BAD_REQUEST,
158
+ };
159
+
160
+ export const ACCOUNT_MEMBER_INVITE_FAILED_TO_SEND: ProblemDetails = {
161
+ type: "https://zup.fail/account-member-invite-failed-send",
162
+ title:
163
+ "We were not able to send the account member invite. Please try again or contact support.",
164
+ status: HttpStatusCode.BAD_REQUEST,
165
+ };
166
+
167
+ export const CANNOT_INVITE_EXISTING_ACCOUNT_MEMBER: ProblemDetails = {
168
+ type: "https://zup.fail/account-member-cannot-be-invited",
169
+ title: "The user is already part of the account.",
170
+ status: HttpStatusCode.BAD_REQUEST,
171
+ };
172
+
173
+ export const EXISTING_PENDING_ACCOUNT_MEMBER_INVITE: ProblemDetails = {
174
+ type: "https://zup.fail/existing-pending-account-member-invites",
175
+ title: "The user has a pending invitation to this account.",
176
+ status: HttpStatusCode.BAD_REQUEST,
177
+ };
178
+
179
+ export const MULTIPLE_ACCOUNT_MEMBERS_NOT_ALLOWED: ProblemDetails = {
180
+ type: "https://zup.fail/no-multi-account-members",
181
+ title: "Account is not configured for multiple members",
182
+ status: HttpStatusCode.BAD_REQUEST,
183
+ };
184
+
185
+ export const ACCOUNT_MEMBERS_ALLOWED_LIMIT_REACHED: ProblemDetails = {
186
+ type: "https://zup.fail/account-members-limit-reached",
187
+ title:
188
+ "This account has reached the limit of users allowed by its current billing plan.",
189
+ status: HttpStatusCode.BAD_REQUEST,
190
+ };
191
+
192
+ export const PROJECT_SHARING_DISABLED_ON_ACCOUNT: ProblemDetails = {
193
+ type: "https://zup.fail/project-sharing-disabled-on-account",
194
+ title: "Project sharing is not enabled on account",
195
+ status: HttpStatusCode.FORBIDDEN,
196
+ };
197
+
198
+ export const PROJECT_NOT_FOUND_FOR_SOURCE_REPO: ProblemDetails = {
199
+ type: "https://zup.fail/project-not-found-for-source-repo",
200
+ title: "Project not found for provided repository",
201
+ status: HttpStatusCode.NOT_FOUND,
202
+ };
203
+
204
+ export const PROJECT_NOT_FOUND: ProblemDetails = {
205
+ type: "https://zup.fail/project-not-found",
206
+ title: "Project not found",
207
+ status: HttpStatusCode.NOT_FOUND,
208
+ };
209
+
210
+ export const PROJECT_CANNOT_BE_DELETED_PROTECTED_DEPLOYMENTS_EXISTS: ProblemDetails =
211
+ {
212
+ type: "https://zup.fail/project-cannot-be-deleted-protected-deployments-exists",
213
+ title: "Project cannot be deleted because it has protected deployments",
214
+ status: HttpStatusCode.FORBIDDEN,
215
+ };
216
+
217
+ export const INCORRECT_PROJECT_TEMPLATE: ProblemDetails = {
218
+ type: "https://zup.fail/incorrect-project-template",
219
+ title: "Incorrect project template name",
220
+ status: HttpStatusCode.BAD_REQUEST,
221
+ };
222
+
223
+ export const INVALID_TEMPLATE_REPOSITORY: ProblemDetailsFactory<{
224
+ repositoryUrl: string;
225
+ }> = ({ repositoryUrl }) => ({
226
+ type: "https://zup.fail/user-no-access-github-app-repo",
227
+ title: `The repository '${repositoryUrl} is not a valid Zuplo template repository`,
228
+ status: HttpStatusCode.FORBIDDEN,
229
+ });
230
+
231
+ export const PROJECT_MEMBER_NOT_FOUND: ProblemDetails = {
232
+ type: "https://zup.fail/project-member-not-found",
233
+ title: "Project Member not found",
234
+ status: HttpStatusCode.NOT_FOUND,
235
+ };
236
+
237
+ export const PROJECT_MEMBER_ALREADY_EXISTS: ProblemDetails = {
238
+ type: "https://zup.fail/project-member-already-exists",
239
+ title: "Project Member already exists",
240
+ status: HttpStatusCode.BAD_REQUEST,
241
+ };
242
+
243
+ export const CAN_NOT_DELETE_YOUR_OWN_PROJECT_MEMBERS: ProblemDetails = {
244
+ type: "https://zup.fail/cannt-delete-your-own-project-member",
245
+ title: "Can not delete your own Project Member record",
246
+ status: HttpStatusCode.BAD_REQUEST,
247
+ };
248
+
249
+ export const PROJECT_MUST_HAVE_ONE_MEMBER: ProblemDetails = {
250
+ type: "https://zup.fail/project-must-have-one-member",
251
+ title: "Project must have at least one member",
252
+ status: HttpStatusCode.BAD_REQUEST,
253
+ };
254
+
255
+ export const SHARED_PROJECT_PREVIOUSLY_INITIALIZED: ProblemDetails = {
256
+ type: "https://zup.fail/project-previously-initialized",
257
+ title: "Project was previously initialized",
258
+ status: HttpStatusCode.BAD_REQUEST,
259
+ };
260
+
261
+ export const INVALID_EMAIL_FORMAT: ProblemDetails = {
262
+ type: "https://zup.fail/invalid-email-format",
263
+ title: "The email address provided is in an invalid email format",
264
+ status: HttpStatusCode.BAD_REQUEST,
265
+ };
266
+
267
+ export const INVALID_SOURCE_REPO_URL: ProblemDetails = {
268
+ type: "https://zup.fail/invalid-source-repo-url",
269
+ title:
270
+ "Project is not connected to source control, a sourceRepoUrl property must be specified and valid",
271
+ status: HttpStatusCode.BAD_REQUEST,
272
+ };
273
+
274
+ export const DEPLOYMENT_NO_ACCESS: ProblemDetails = {
275
+ type: "https://zup.fail/deployment-no-access",
276
+ title: "User does not have access to deployment",
277
+ status: HttpStatusCode.FORBIDDEN,
278
+ };
279
+
280
+ export const DEPLOYMENT_NOT_FOUND: ProblemDetails = {
281
+ type: "https://zup.fail/deployment-not-found",
282
+ title: "Deployment was not found",
283
+ status: HttpStatusCode.NOT_FOUND,
284
+ };
285
+
286
+ export const DEPLOYMENT_FILE_DOES_NOT_EXISTS: ProblemDetails = {
287
+ type: "https://zup.fail/deployment-file-does-not-exists",
288
+ title: "Files were not found",
289
+ status: HttpStatusCode.NOT_FOUND,
290
+ };
291
+
292
+ export const DEPLOYMENT_REQUEST_IS_NOT_MULTI_PART: ProblemDetails = {
293
+ type: "https://zup.fail/deployment-request-is-not-multi-part",
294
+ title: "Request is not multipart.",
295
+ status: HttpStatusCode.BAD_REQUEST,
296
+ };
297
+
298
+ export const DEPLOYMENT_INVALID_MULTI_PART: ProblemDetails = {
299
+ type: "https://zup.fail/deployment-invalid-multi-part",
300
+ title: "Invalid request format. Must be multi-part file upload.",
301
+ status: HttpStatusCode.BAD_REQUEST,
302
+ };
303
+ export const DEPLOYMENT_CANNOT_DELETE_INSTANCE: ProblemDetails = {
304
+ type: "https://zup.fail/deployment-cannot-delete-instance",
305
+ title:
306
+ "Cannot delete instance of the deployment. Invalid account or project.",
307
+ status: HttpStatusCode.NOT_FOUND,
308
+ };
309
+
310
+ export const DEPLOYMENT_DELETE_ERROR: ProblemDetails = {
311
+ type: "https://zup.fail/deployment-delete-error",
312
+ title: "Error deleting deployment instance.",
313
+ status: HttpStatusCode.NOT_FOUND,
314
+ };
315
+
316
+ export const DEPLOYMENT_INVALID_ENVIRONMENT_TO_DELETE: ProblemDetails = {
317
+ type: "https://zup.fail/deployment-invalid-environment-to-delete",
318
+ title: "Invalid environment to delete deployment",
319
+ status: HttpStatusCode.BAD_REQUEST,
320
+ };
321
+
322
+ export const DEPLOYMENT_IS_PROTECTED_CANNOT_BE_DELETED: ProblemDetails = {
323
+ type: "https://zup.fail/deployment-is-protected-cannot-be-deleted",
324
+ title: "Deployment is protected and cannot be deleted",
325
+ status: HttpStatusCode.FORBIDDEN,
326
+ };
327
+
328
+ export const DEPLOYMENT_CANNOT_BE_REDEPLOYED_DUE_TO_ACCOUNT: ProblemDetails = {
329
+ type: "https://zup.fail/deployment-log-not-found",
330
+ title: "Deployment cannot be redeployed due to invalid account",
331
+ status: HttpStatusCode.NOT_FOUND,
332
+ };
333
+
334
+ export const DEPLOYMENT_CANNOT_BE_REDEPLOYED_DUE_TO_PROJECT: ProblemDetails = {
335
+ type: "https://zup.fail/deployment-log-not-found",
336
+ title: "Deployment cannot be redeployed due to invalid project name",
337
+ status: HttpStatusCode.NOT_FOUND,
338
+ };
339
+
340
+ export const DEPLOYMENT_CANNOT_BE_REDEPLOYED_DUE_TO_USER_SUB: ProblemDetails = {
341
+ type: "https://zup.fail/deployment-log-not-found",
342
+ title: "Deployment cannot be redeployed due to invalid user sub",
343
+ status: HttpStatusCode.NOT_FOUND,
344
+ };
345
+
346
+ export const DEPLOYMENT_CANNOT_BE_DELETED_DUE_WORKING_COPY: ProblemDetails = {
347
+ type: "https://zup.fail/deployment-cannot-be-deleted",
348
+ title: "Deployment cannot be deleted since is a working copy",
349
+ status: HttpStatusCode.FORBIDDEN,
350
+ };
351
+
352
+ export const DEPLOYMENT_LOG_NOT_FOUND: ProblemDetails = {
353
+ type: "https://zup.fail/deployment-log-not-found",
354
+ title: "DeploymentLog was not found",
355
+ status: HttpStatusCode.NOT_FOUND,
356
+ };
357
+
358
+ export const DEPLOYMENT_NOT_WORKING_COPY: ProblemDetails = {
359
+ type: "https://zup.fail/deployment-not-working-copy",
360
+ title: `Deployment is not working copy.`,
361
+ status: HttpStatusCode.BAD_REQUEST,
362
+ };
363
+
364
+ export const DEPLOYMENT_INCORRECT_STATUS_PAUSE: ProblemDetails = {
365
+ type: "https://zup.fail/deployment-incorrect-status-pause",
366
+ title: "Deployment is not in a state to be paused.",
367
+ status: HttpStatusCode.BAD_REQUEST,
368
+ };
369
+
370
+ export const DEPLOYMENT_INCORRECT_STATUS_UNPAUSE: ProblemDetails = {
371
+ type: "https://zup.fail/deployment-incorrect-status-unpause",
372
+ title: "Deployment is not in a state to be unpaused.",
373
+ status: HttpStatusCode.BAD_REQUEST,
374
+ };
375
+
376
+ export const SERVICE_CONFIGURATION_NOT_FOUND: ProblemDetails = {
377
+ type: "https://zup.fail/service-config-not-found",
378
+ title: "Service configuration not found.",
379
+ status: HttpStatusCode.NOT_FOUND,
380
+ };
381
+
382
+ export const WORKING_COPY_SERVICE_NOT_FOUND: ProblemDetails = {
383
+ type: "https://zup.fail/service-config-not-found",
384
+ title: "Working Copy service not found.",
385
+ status: HttpStatusCode.NOT_FOUND,
386
+ };
387
+
388
+ export const WORKING_COPY_SERVICE_NOT_DELETED: ProblemDetails = {
389
+ type: "https://zup.fail/working-copy-service-not-deleted",
390
+ title: "Working Copy service failed to be deleted.",
391
+ status: HttpStatusCode.BAD_REQUEST,
392
+ };
393
+
394
+ export const WORKING_COPY_SERVICE_NOT_CREATED: ProblemDetails = {
395
+ type: "https://zup.fail/working-copy-service-not-created",
396
+ title: "Working Copy service failed to be created.",
397
+ status: HttpStatusCode.BAD_REQUEST,
398
+ };
399
+
400
+ export const SERVICE_CONFIGURATION_FAILED_DECRYPTION: ProblemDetails = {
401
+ type: "https://zup.fail/service-config-not-decrypted",
402
+ title: "Service configuration failed to decrypt.",
403
+ status: HttpStatusCode.BAD_REQUEST,
404
+ };
405
+
406
+ export const PROJECT_ALREADY_EXISTS: ProblemDetails = {
407
+ type: "https://zup.fail/project-already-exists",
408
+ title: "Project already exists.",
409
+ status: HttpStatusCode.BAD_REQUEST,
410
+ };
411
+
412
+ export const PROJECT_NO_MEMBERS: ProblemDetails = {
413
+ type: "https://zup.fail/project-no-members",
414
+ title: "Cannot find project members.",
415
+ status: HttpStatusCode.NOT_FOUND,
416
+ };
417
+
418
+ export const RUNTIME_FLAG_ALREADY_EXISTS: ProblemDetails = {
419
+ type: "https://zup.fail/runtime-flag-already-exists",
420
+ title: "RuntimeFlag already exists.",
421
+ status: HttpStatusCode.BAD_REQUEST,
422
+ };
423
+
424
+ export const RUNTIME_FLAG_NOT_FOUND: ProblemDetails = {
425
+ type: "https://zup.fail/runtime-flag-not-found",
426
+ title: "RuntimeFlag was not found.",
427
+ status: HttpStatusCode.NOT_FOUND,
428
+ };
429
+
430
+ export const RUNTIME_FLAG_KEY_NOT_VALID: ProblemDetails = {
431
+ type: "https://zup.fail/runtime-flag-key-not-valid",
432
+ title: "RuntimeFlag key must be snake case",
433
+ status: HttpStatusCode.BAD_REQUEST,
434
+ };
435
+
436
+ export const USER_HAS_NO_ACCESS_TO_PROJECT: ProblemDetails = {
437
+ type: "https://zup.fail/user-has-no-access-to-project",
438
+ title: "Not a member of the project",
439
+ status: HttpStatusCode.FORBIDDEN,
440
+ };
441
+
442
+ export const USER_IS_PROJECT_MEMBER: ProblemDetails = {
443
+ type: "https://zup.fail/user-is-project-member",
444
+ title: "The user is already a project member.",
445
+ status: HttpStatusCode.BAD_REQUEST,
446
+ };
447
+
448
+ export const PROJECT_INVALID_GIT_CLONE: ProblemDetails = {
449
+ type: "https://zup.fail/project-invalid-git-clone",
450
+ title:
451
+ "Project requires defaultBranch & sourceRepoUrl for creation from a GitHub repository.",
452
+ status: HttpStatusCode.BAD_REQUEST,
453
+ };
454
+
455
+ export const PROJECT_INVALID_GIT_REPO: ProblemDetails = {
456
+ type: "https://zup.fail/project-invalid-git-repo",
457
+ title:
458
+ "The current source control repository is already in use by a Zuplo project",
459
+ status: HttpStatusCode.BAD_REQUEST,
460
+ };
461
+
462
+ export const PROJECT_SHARING_REQUIRES_GIT_REPO: ProblemDetails = {
463
+ type: "https://zup.fail/project-sharing-requires-git-repo",
464
+ title: "The current project is not connected to a source control repository.",
465
+ status: HttpStatusCode.BAD_REQUEST,
466
+ };
467
+
468
+ export const USER_NO_ACCESS_GITHUB_REPO: ProblemDetailsFactory<{
469
+ repositoryUrl: string;
470
+ }> = ({ repositoryUrl }) => ({
471
+ type: "https://zup.fail/user-no-access-github-repo",
472
+ title:
473
+ "You do not have access to the GitHub repository associated to the project. Ask your GitHub admin for access and try again.",
474
+ detail: `User does not have access to the GitHub repository associated to the project. Go to Settings > Access > Collaborators in '${repositoryUrl}' to add a new collaborator.`,
475
+ status: HttpStatusCode.FORBIDDEN,
476
+ });
477
+
478
+ export const USER_NO_PULL_ACCESS_GITHUB_REPO: ProblemDetailsFactory<{
479
+ repositoryUrl: string;
480
+ }> = ({ repositoryUrl }) => ({
481
+ type: "https://zup.fail/user-no-access-github-repo",
482
+ title:
483
+ "You do not have pull access to the GitHub repository associated to the project. Ask your GitHub admin for access and try again.",
484
+ detail: `User does not have access to the GitHub repository associated to the project. Go to Settings > Access > Collaborators in '${repositoryUrl}' to add a new collaborator.`,
485
+ status: HttpStatusCode.FORBIDDEN,
486
+ });
487
+
488
+ export const GITHUB_USER_NO_READ_ACCESS_REPO: ProblemDetailsFactory<{
489
+ repositoryUrl: string;
490
+ }> = ({ repositoryUrl }) => ({
491
+ type: "https://zup.fail/no-read-access-github-repo",
492
+ title:
493
+ "You do not have read access to the GitHub repository associated to the project. Ask your GitHub admin for access and try again.",
494
+ detail: `User does not have access to the GitHub repository associated to the project. Go to Settings > Access > Collaborators in '${repositoryUrl}' to add a new collaborator.`,
495
+ status: HttpStatusCode.FORBIDDEN,
496
+ });
497
+
498
+ export const GENERIC_GITHUB_BRANCH_INFO_ERROR: ProblemDetails = {
499
+ type: "https://zup.fail/gh-branch-info-error",
500
+ title:
501
+ "There was an error getting branch information for the GitHub repository associated to the project.",
502
+ status: HttpStatusCode.BAD_REQUEST,
503
+ };
504
+
505
+ export const GITHUB_APP_NO_NAMESPACE_ACCESS: ProblemDetails = {
506
+ type: "https://zup.fail/no-namespace-access-github-app",
507
+ title:
508
+ "The Zuplo GitHub app does not have access to the repositories under the namespace provided. Make sure to configure the GitHub Zuplo App on the repository.",
509
+ status: HttpStatusCode.FORBIDDEN,
510
+ };
511
+
512
+ export const GITHUB_APP_NO_USER_ACCESS_: ProblemDetailsFactory<{
513
+ repositoryUrl: string;
514
+ }> = ({ repositoryUrl }) => ({
515
+ type: "https://zup.fail/user-no-access-github-app-repo",
516
+ title:
517
+ "The Zuplo GitHub app does not have access to the repository. Make sure to configure the GitHub Zuplo App on the repository.",
518
+ detail: `The Zuplo GitHub app has not been granted access to the repository '${repositoryUrl}'. Go to '${zuploGithubAppInstallationUrl}' to add the repository.`,
519
+ status: HttpStatusCode.FORBIDDEN,
520
+ });
521
+
522
+ export const GITHUB_APP_CONFIGURATION_NOT_FOUND: ProblemDetails = {
523
+ type: "https://zup.fail/gh-app-not-found",
524
+ title: "Global GitHub App configuration not found",
525
+ status: HttpStatusCode.NOT_FOUND,
526
+ };
527
+
528
+ export const USER_NO_ACCESS_BITBUCKET_REPO: ProblemDetailsFactory<{
529
+ repositoryUrl: string;
530
+ }> = ({ repositoryUrl }) => ({
531
+ type: "https://zup.fail/user-no-access-bitbucket-repo",
532
+ title:
533
+ "You do not have access to the Bitbucket repository associated to the project. Ask your Bitbucket admin for access and try again.",
534
+ detail: `User does not have access to the Bitbucket repository associated to the project. Update the user permissions in '${repositoryUrl}' to add a new collaborator.`,
535
+ status: HttpStatusCode.FORBIDDEN,
536
+ });
537
+
538
+ export const USER_NO_ACCESS_GITLAB_REPO: ProblemDetailsFactory<{
539
+ repositoryUrl: string;
540
+ }> = ({ repositoryUrl }) => ({
541
+ type: "https://zup.fail/user-no-access-gitlab-repo",
542
+ title:
543
+ "You do not have access to the GitLab repository associated to the project. Ask your GitLab admin for access and try again.",
544
+ detail: `User does not have access to the GitLab repository associated to the project. Update the user permissions in '${repositoryUrl}' to add a new collaborator.`,
545
+ status: HttpStatusCode.FORBIDDEN,
546
+ });
547
+
548
+ export const USER_ACCOUNT_NOT_FS_MIGRATED: ProblemDetails = {
549
+ type: "https://zup.fail/user-account-not-fs-migrated",
550
+ title:
551
+ "User account is in a plan that does not allow project sharing. Please contact your account admin.",
552
+ status: HttpStatusCode.FORBIDDEN,
553
+ };
554
+
555
+ export const FAILED_TO_REVOKE_GH_TOKEN: ProblemDetails = {
556
+ type: "https://zup.fail/failed-to-revoke-gh-token",
557
+ title: "Failed to revoke GitHub token for the user",
558
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
559
+ };
560
+
561
+ export const PROJECT_INVALID_NAME: ProblemDetails = {
562
+ type: "https://zup.fail/project-invalid-name",
563
+ title:
564
+ "Project name is invalid, it only can contain letter, number and dashes.",
565
+ status: HttpStatusCode.BAD_REQUEST,
566
+ };
567
+
568
+ export const PROJECT_ALREADY_HAS_REPO: ProblemDetails = {
569
+ type: "https://zup.fail/project-already-has-repo",
570
+ title:
571
+ "The current project has been previously linked to a source control repository",
572
+ status: HttpStatusCode.BAD_REQUEST,
573
+ };
574
+
575
+ export const MAX_ALLOWED_PROJECTS_LIMIT_REACHED: ProblemDetails = {
576
+ type: "https://zup.fail/max-allowed-projects-limit-reached",
577
+ title: "Your account has reached the maximum number of projects allowed.",
578
+ status: HttpStatusCode.BAD_REQUEST,
579
+ };
580
+
581
+ export const FEATURE_FLAGS_NOT_FOUND: ProblemDetails = {
582
+ type: "https://zup.fail/feature-flags-not-found",
583
+ title: "Error trying to retrieve feature flags for this user",
584
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
585
+ };
586
+
587
+ export const GITHUB_INTEGRATION_ALREADY_EXISTS: ProblemDetails = {
588
+ type: "https://zup.fail/github-integration-already-exists",
589
+ title: "Error trying to create GitHub Integration, already exists.",
590
+ status: HttpStatusCode.BAD_REQUEST,
591
+ };
592
+
593
+ export const GITHUB_INTEGRATION_REPOSITORY_NOT_FOUND: ProblemDetailsFactory<{
594
+ repositoryUrl: string;
595
+ }> = ({ repositoryUrl }) => ({
596
+ type: "https://zup.fail/github-integration-not-found",
597
+ title: "Cannot find a project configured for this repository",
598
+ status: HttpStatusCode.CONFLICT,
599
+ detail: `The repository ${repositoryUrl} does not have a GitHub configured project.`,
600
+ });
601
+
602
+ export const GITHUB_REPOSITORY_NOT_FOUND: ProblemDetailsFactory<{
603
+ repositoryUrl: string;
604
+ }> = ({ repositoryUrl }) => ({
605
+ type: "https://zup.fail/github-repo-not-found",
606
+ title: "Cannot find a provided GitHub repository",
607
+ status: HttpStatusCode.CONFLICT,
608
+ detail: `The GitHub repository ${repositoryUrl} was not found.`,
609
+ });
610
+
611
+ export const GITHUB_INTEGRATION_NOT_FOUND: ProblemDetails = {
612
+ type: "https://zup.fail/github-integration-not-found",
613
+ title: "Project is not integrated with GitHub",
614
+ status: HttpStatusCode.NOT_FOUND,
615
+ detail: `The project does not have a GitHub integration configured.`,
616
+ };
617
+
618
+ export const GITHUB_INTEGRATION_BRANCH_BEHIND: ProblemDetails = {
619
+ type: "https://zup.fail/github-integration-branch-behind",
620
+ title:
621
+ "The current branch is behind, sync with remote repo for avoid conflicts.",
622
+ status: HttpStatusCode.BAD_REQUEST,
623
+ };
624
+
625
+ export const GITHUB_INTEGRATION_AUTHENTICATION_FAILED: ProblemDetails = {
626
+ type: "https://zup.fail/github-integration-authentication-failed",
627
+ title: "GitHub integration: Authentication failed",
628
+ status: HttpStatusCode.FORBIDDEN,
629
+ };
630
+
631
+ export const GITHUB_INTEGRATION_QUERY_USER_INFO_FAILED: ProblemDetails = {
632
+ type: "https://zup.fail/github-integration-query-user-info-failed",
633
+ title: "Failed while requesting basic user info from GitHub",
634
+ status: HttpStatusCode.FORBIDDEN,
635
+ };
636
+
637
+ export const GITHUB_INTEGRATION_DUPLICATE_REPO: ProblemDetailsFactory<{
638
+ repositoryName: string;
639
+ orgName: string;
640
+ }> = ({ repositoryName, orgName }) => ({
641
+ type: "https://zup.fail/github-integration-duplicate-repo",
642
+ title: "A repository with that name already exists in GitHub",
643
+ details: `A repository named '${repositoryName}' already exists on GitHub org '${orgName}'.`,
644
+ instance: repositoryName,
645
+ status: HttpStatusCode.BAD_REQUEST,
646
+ });
647
+
648
+ export const GITHUB_INTEGRATION_FAILED_DURING_REPO_CREATION: ProblemDetailsFactory<{
649
+ repositoryName: string;
650
+ details: string;
651
+ }> = ({ repositoryName, details }) => ({
652
+ type: "https://zup.fail/github-integration-failed-repo-creation",
653
+ title: "Failed to create a new repository in GitHub",
654
+ details,
655
+ instance: repositoryName,
656
+ status: HttpStatusCode.BAD_REQUEST,
657
+ });
658
+
659
+ export const GIT_CREATE_PROJECT_WITH_EMPTY_REPO: ProblemDetailsFactory<{
660
+ repositoryUrl: string;
661
+ }> = ({ repositoryUrl }) => ({
662
+ type: "https://zup.fail/create-project-invalid-empty-repo",
663
+ title:
664
+ "The repository is empty and we can only create a project using a repository containing a valid Zuplo project. Try again with a Git repository containing a Zuplo project.",
665
+ details: `Repository '${repositoryUrl}' is empty and we can only create a project using a repository containing a valid Zuplo project. Try again with a Git repository containing a Zuplo project.`,
666
+ instance: repositoryUrl,
667
+ status: HttpStatusCode.BAD_REQUEST,
668
+ });
669
+
670
+ export const GIT_CREATE_PROJECT_WITH_INVALID_REPO: ProblemDetailsFactory<{
671
+ repositoryUrl: string;
672
+ }> = ({ repositoryUrl }) => ({
673
+ type: "https://zup.fail/create-project-invalid-git-repo",
674
+ title:
675
+ "We can only create a project using a repository containing a valid Zuplo project. Try again with a Git repository containing a Zuplo project.",
676
+ details: `Repository '${repositoryUrl}' is not a repository containing a valid Zuplo project. Try again with a Git repository containing a Zuplo project.`,
677
+ instance: repositoryUrl,
678
+ status: HttpStatusCode.BAD_REQUEST,
679
+ });
680
+
681
+ export const GITHUB_INTEGRATION_INVALID_REPO: ProblemDetailsFactory<{
682
+ repositoryUrl: string;
683
+ }> = ({ repositoryUrl }) => ({
684
+ type: "https://zup.fail/github-integration-invalid-repo",
685
+ title:
686
+ "We can only connect to an empty repository or a repository containing a valid Zuplo project. Try again with an empty GitHub repository.",
687
+ details: `Repository '${repositoryUrl}' is not an empty repository or a repository containing a valid Zuplo project. Try again with an empty GitHub repository.`,
688
+ instance: repositoryUrl,
689
+ status: HttpStatusCode.BAD_REQUEST,
690
+ });
691
+
692
+ export const BITBUCKET_QUERY_USER_INFO_FAILED: ProblemDetails = {
693
+ type: "https://zup.fail/bitbucket-query-user-info-failed",
694
+ title: "Failed while requesting basic user info from Bitbucket",
695
+ status: HttpStatusCode.FORBIDDEN,
696
+ };
697
+
698
+ export const BITBUCKET_WORKSPACE_MISCONFIGURATION: ProblemDetails = {
699
+ type: "https://zup.fail/bitbucket-workspace-misconfiguration",
700
+ title:
701
+ "Bitbucket source control configuration is missing workspace information",
702
+ status: HttpStatusCode.FORBIDDEN,
703
+ };
704
+
705
+ export const BITBUCKET_FAILED_DURING_REPO_CREATION: ProblemDetailsFactory<{
706
+ details: string;
707
+ }> = ({ details }) => ({
708
+ type: "https://zup.fail/bitbucket-failed-repo-creation",
709
+ title: "Failed to create a new repository in Bitbucket",
710
+ details,
711
+ status: HttpStatusCode.BAD_REQUEST,
712
+ });
713
+
714
+ export const GITLAB_QUERY_USER_INFO_FAILED: ProblemDetails = {
715
+ type: "https://zup.fail/gitlab-query-user-info-failed",
716
+ title: "Failed while requesting basic user info from GitLab",
717
+ status: HttpStatusCode.FORBIDDEN,
718
+ };
719
+
720
+ export const GITLAB_FAILED_DURING_REPO_CREATION: ProblemDetailsFactory<{
721
+ details: string;
722
+ }> = ({ details }) => ({
723
+ type: "https://zup.fail/gitlab-failed-repo-creation",
724
+ title: "Failed to create a new repository in GitLab",
725
+ details,
726
+ status: HttpStatusCode.BAD_REQUEST,
727
+ });
728
+
729
+ export const GITLAB_DUPLICATE_REPO: ProblemDetailsFactory<{
730
+ repositoryName: string;
731
+ orgName: string;
732
+ }> = ({ repositoryName, orgName }) => ({
733
+ type: "https://zup.fail/gitlab-duplicate-repo",
734
+ title: "A repository with that name already exists in GitLab",
735
+ details: `A repository named '${repositoryName}' already exists in GitLab team '${orgName}'.`,
736
+ instance: repositoryName,
737
+ status: HttpStatusCode.BAD_REQUEST,
738
+ });
739
+
740
+ export const GITLAB_INSUFFICIENT_PERM_CREATE_REPO: ProblemDetailsFactory<{
741
+ orgName: string;
742
+ }> = ({ orgName }) => ({
743
+ type: "https://zup.fail/gitlab-create-repo-perm",
744
+ title:
745
+ "The user's GitLab group access level does not allow for repository creation.",
746
+ details:
747
+ "The user's GitLab group access level does not allow for repository creation.",
748
+ instance: orgName,
749
+ status: HttpStatusCode.BAD_REQUEST,
750
+ });
751
+
752
+ export const GITLAB_INSUFFICIENT_NAMESPACE_ACCESS: ProblemDetailsFactory<{
753
+ namespaceLabel: string;
754
+ }> = ({ namespaceLabel }) => ({
755
+ type: "https://zup.fail/gitlab-insufficient-namespace-access",
756
+ title: `The user's GitLab access level does not allow the use of namespace '${namespaceLabel}'.`,
757
+ details: `The user's GitLab access level does not allow the use of namespace '${namespaceLabel}'.`,
758
+ instance: namespaceLabel,
759
+ status: HttpStatusCode.BAD_REQUEST,
760
+ });
761
+
762
+ export const GITLAB_ACCESS_LEVEL_CHECK_FAIL: ProblemDetailsFactory<{
763
+ orgName: string;
764
+ }> = ({ orgName }) => ({
765
+ type: "https://zup.fail/gitlab-access-check-fail",
766
+ title: "Failed to verify user's GitLab group access level",
767
+ instance: orgName,
768
+ status: HttpStatusCode.BAD_REQUEST,
769
+ });
770
+
771
+ export const CONSUMER_NO_ACCESS: ProblemDetails = {
772
+ type: "https://zup.fail/consumer-no-access",
773
+ title: "User does not have access to this consumer.",
774
+ status: HttpStatusCode.UNAUTHORIZED,
775
+ };
776
+
777
+ export const CONSUMER_DOES_NOT_EXIST: ProblemDetails = {
778
+ type: "https://zup.fail/consumer-does-not-exist",
779
+ title: "Consumer does not exist.",
780
+ status: HttpStatusCode.NOT_FOUND,
781
+ };
782
+
783
+ export const EXTERNAL_USER_NO_ACCESS: ProblemDetails = {
784
+ type: "https://zup.fail/external-user-no-access",
785
+ title: "User does not have access to this external user.",
786
+ status: HttpStatusCode.UNAUTHORIZED,
787
+ };
788
+
789
+ export const EXTERNAL_USER_NOT_CONFIGURED: ProblemDetails = {
790
+ type: "https://zup.fail/external-user-not-configured",
791
+ title: "User is not setup as an External User (Key Manager)",
792
+ status: HttpStatusCode.FORBIDDEN,
793
+ };
794
+
795
+ export const API_USER_NO_ACCESS: ProblemDetails = {
796
+ type: "https://zup.fail/api-user-no-access",
797
+ title: "Api user does not have access to this endpoint.",
798
+ status: HttpStatusCode.FORBIDDEN,
799
+ };
800
+
801
+ export const EXTERNAL_SERVICE_GENERIC_ERROR: ProblemDetails = {
802
+ type: "https://zup.fail/external-service-generic-error",
803
+ title: "Unable to complete API request for External Service.",
804
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
805
+ };
806
+
807
+ export const SOURCE_CONTROL_AUTHENTICATION_FAILED: ProblemDetailsFactory<{
808
+ sourceControlProvider: "GitHub" | "Bitbucket" | "GitLab" | string;
809
+ }> = ({ sourceControlProvider }) => {
810
+ const label = getSourceControlProviderLabel(sourceControlProvider);
811
+ return {
812
+ type: "https://zup.fail/source-control-authentication-failed",
813
+ title: "Source provider authentication failed",
814
+ detail: `Could not authenticate to ${label}`,
815
+ status: HttpStatusCode.UNAUTHORIZED,
816
+ };
817
+ };
818
+
819
+ export const SOURCE_CONTROL_REPO_NOT_FOUND: ProblemDetailsFactory<{
820
+ sourceControlProvider: "GitHub" | "Bitbucket" | "GitLab" | string;
821
+ }> = ({ sourceControlProvider }) => {
822
+ const label = getSourceControlProviderLabel(sourceControlProvider);
823
+ return {
824
+ type: "https://zup.fail/source-control-repo-not-found",
825
+ title:
826
+ "We cannot connect to the repository associated to the project, verify your source control access configuration and try again.",
827
+ detail: `Could not connect to ${label} repository`,
828
+ status: HttpStatusCode.NOT_FOUND,
829
+ };
830
+ };
831
+
832
+ export const SOURCE_CONTROL_EMPTY_COMMIT_MESSAGE: ProblemDetails = {
833
+ type: "https://zup.fail/source-control-empty-commit",
834
+ title:
835
+ "Commit operation failed because you provided an empty message. Please try again by providing a commit message.",
836
+ status: HttpStatusCode.BAD_REQUEST,
837
+ };
838
+
839
+ export const SOURCE_CONTROL_REPO_OPERATION_ERROR: ProblemDetailsFactory<{
840
+ repoURL: string;
841
+ operation: "commit" | "push" | "checkout";
842
+ }> = ({ repoURL, operation }) => {
843
+ return {
844
+ type: `https://zup.fail/source-control-repo-${operation}-error`,
845
+ title: `Failed on ${operation} operation to repository '${repoURL}'. Verify you have read & write access to the repository and try again.`,
846
+ detail: `Verify your source control configuration and make sure you have been granted read & write access to the repository`,
847
+ status: HttpStatusCode.FORBIDDEN,
848
+ };
849
+ };
850
+
851
+ export const SOURCE_CONTROL_REPO_WRITE_ACCESS_ISSUE: ProblemDetails = {
852
+ type: "https://zup.fail/source-control-write-access-issue",
853
+ title: `You do not have write access to the repository, verify your source control access configuration and try again.`,
854
+ detail: `Verify your source control configuration and make sure you have been granted access to the repository`,
855
+ status: HttpStatusCode.FORBIDDEN,
856
+ };
857
+
858
+ export const SOURCE_CONTROL_CONFIGURATION_NOT_FOUND: ProblemDetails = {
859
+ type: "https://zup.fail/source-control-configuration-not-found",
860
+ title: "Source control configuration not found for this account.",
861
+ status: HttpStatusCode.NOT_FOUND,
862
+ };
863
+
864
+ export const SOURCE_CONTROL_CREDENTIALS_NOT_FOUND: ProblemDetails = {
865
+ type: "https://zup.fail/source-control-credentials-not-found",
866
+ title:
867
+ "Source control credentials not found for this user. Verify your user's source control connection and try again.",
868
+ status: HttpStatusCode.NOT_FOUND,
869
+ };
870
+
871
+ export const FAILED_TO_REFRESH_SOURCE_CONTROL_CREDENTIALS: ProblemDetails = {
872
+ type: "https://zup.fail/failed-to-refresh-source-control-credentials",
873
+ title:
874
+ "Failed to refresh Source Control credentials. Verify your user's source control connection and try again.",
875
+ status: HttpStatusCode.FORBIDDEN,
876
+ };
877
+
878
+ export const SOURCE_CONTROL_GH_APP_CONFIG_REQUIRED: ProblemDetails = {
879
+ type: "https://zup.fail/new-gh-config-required",
880
+ title:
881
+ "Current Source Control credentials are using the previous Zuplo GitHup App. Re-authenticate using the latest Zuplo GitHup App via Profile UI and try again.",
882
+ status: HttpStatusCode.FORBIDDEN,
883
+ };
884
+
885
+ export const SOURCE_CONTROL_GH_APP_REVOKED_ACCESS: ProblemDetails = {
886
+ type: "https://zup.fail/gh-app-revoked-access",
887
+ title:
888
+ "Current Source Control credentials are invalid. Re-authenticate to GitHub via Profile UI and try again.",
889
+ status: HttpStatusCode.UNAUTHORIZED,
890
+ };
891
+
892
+ export const FAILED_TO_REVOKE_SOURCE_CONTROL_CREDENTIALS: ProblemDetails = {
893
+ type: "https://zup.fail/failed-to-revoke-source-control-credentials",
894
+ title: "Failed to revoke Source Control access token for the user",
895
+ status: HttpStatusCode.FORBIDDEN,
896
+ };
897
+
898
+ export const SOURCE_CONTROL_CONFIGURATION_INFO_MISSING: ProblemDetails = {
899
+ type: "https://zup.fail/source-control-configuration-info-missing",
900
+ title:
901
+ "Source Control Configuration information is insufficient for this operation.",
902
+ status: HttpStatusCode.BAD_REQUEST,
903
+ };
904
+
905
+ export const SOURCE_CONTROL_CONFIGURATION_BITBUCKET_WORKSPACE_MISSING: ProblemDetails =
906
+ {
907
+ type: "https://zup.fail/source-control-configuration-bb-workspace-missing",
908
+ title:
909
+ "Source Control Configuration for Bitbucket must include a workspace configuration (additionalMetadata).",
910
+ status: HttpStatusCode.BAD_REQUEST,
911
+ };
912
+
913
+ export const ACCOUNT_HAS_PREEXISTING_SOURCE_CONTROL_CONFIGURATION: ProblemDetails =
914
+ {
915
+ type: "https://zup.fail/preexisiting-source-control-configuration-on-account",
916
+ title:
917
+ "This account already has a Source Control Configuration for this provider.",
918
+ detail:
919
+ "This account has a pre-existing Source Control Configuration for this provider. Delete or update the existing configuration.",
920
+ status: HttpStatusCode.BAD_REQUEST,
921
+ };
922
+
923
+ export const SOURCE_CONTROL_INTEGRATION_BRANCH_BEHIND: ProblemDetails = {
924
+ type: "https://zup.fail/source-control-integration-branch-behind",
925
+ title:
926
+ "The current branch is behind, sync with remote repo for avoid conflicts.",
927
+ status: HttpStatusCode.BAD_REQUEST,
928
+ };
929
+
930
+ export const SOURCE_CONTROL_INTEGRATION_AUTHENTICATION_FAILED: ProblemDetails =
931
+ {
932
+ type: "https://zup.fail/source-control-integration-authentication-failed",
933
+ title: "Source control integration: Authentication failed",
934
+ status: HttpStatusCode.FORBIDDEN,
935
+ };
936
+
937
+ export const THIRD_PARTY_APP_AUTH0_CLIENTS_ENDPOINT_ERROR: ProblemDetails = {
938
+ type: "https://zup.fail/third-party-app-auth0-clients-endpoint-error",
939
+ title: "Error Creating an Auth0 Client through tenant api",
940
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
941
+ };
942
+
943
+ export const THIRD_PARTY_APP_AUTH0_CONFIG_DOES_NOT_EXIST: ProblemDetails = {
944
+ type: "https://zup.fail/third-party-app-auth0-config-does-not-exist",
945
+ title: "Auth0 Configuration does not exist for account and environment",
946
+ status: HttpStatusCode.NOT_FOUND,
947
+ };
948
+ export const THIRD_PARTY_APP_AUTH0_CLIENT_NOT_FOUND_ERROR: ProblemDetails = {
949
+ type: "https://zup.fail/third-party-app-auth0-client-not-found-error",
950
+ title: "Third Party App Not Found",
951
+ status: HttpStatusCode.NOT_FOUND,
952
+ };
953
+
954
+ export const THIRD_PARTY_APP_AUTH_SCOPE_CONFIG_ERROR: ProblemDetails = {
955
+ type: "https://zup.fail/third-party-app-auth-scope-config-error",
956
+ title: "API Scope configuration at Auth0 end Error",
957
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
958
+ };
959
+
960
+ export const THIRD_PARTY_APP_CONNECTIONS_NOT_FOUND: ProblemDetails = {
961
+ type: "https://zup.fail/third-party-app-connections-not-found",
962
+ title: "Cannot find auth0 tenant connections",
963
+ status: HttpStatusCode.FAILED_DEPENDENCY,
964
+ };
965
+
966
+ export const THIRD_PARTY_APP_CONNECTION_NOT_FOUND: ProblemDetails = {
967
+ type: "https://zup.fail/third-party-app-connection-not-found",
968
+ title: "Cannot find connection with the given name",
969
+ status: HttpStatusCode.FAILED_DEPENDENCY,
970
+ };
971
+
972
+ export const THIRD_PARTY_APP_CANNOT_LINK_TPA_TO_CONNECTION: ProblemDetails = {
973
+ type: "https://zup.fail/third-party-app-cannot-link-tpa-to-connection",
974
+ title: "Cannot link a connection to a third party app",
975
+ status: HttpStatusCode.FAILED_DEPENDENCY,
976
+ };
977
+
978
+ export const DUPLICATE_ENVIRONMENT_VARIABLE: ProblemDetails = {
979
+ type: "https://zup.fail/duplicate-environment-variable",
980
+ title: "Duplicate environment variable",
981
+ status: HttpStatusCode.BAD_REQUEST,
982
+ };
983
+
984
+ export const ENVIRONMENT_VARIABLE_VALIDATION_ERROR: ProblemDetails = {
985
+ type: "https://zup.fail/environment-variables-validation-error",
986
+ title: "Environment variable configuration is invalid",
987
+ status: HttpStatusCode.BAD_REQUEST,
988
+ };
989
+
990
+ export const ENVIRONMENT_VARIABLE_INVALID_ENVIRONMENT_TYPE: ProblemDetails = {
991
+ type: "https://zup.fail/environment-variables-cannot-be-retrieved-invalid-env-type",
992
+ title:
993
+ "Env vars will not be retrieved since the deployment is from non valid environment type",
994
+ status: HttpStatusCode.BAD_REQUEST,
995
+ };
996
+
997
+ export const NON_EXISTENT_ENVIRONMENT_VARIABLE: ProblemDetails = {
998
+ type: "https://zup.fail/non-existent-environment-variable",
999
+ title: "Environment variable doesn't exist",
1000
+ status: HttpStatusCode.NOT_FOUND,
1001
+ };
1002
+
1003
+ export const DEPLOYMENT_NAME_MISSING: ProblemDetails = {
1004
+ type: "https://zup.fail/deployment-name-missing",
1005
+ title: "Deployment name missing",
1006
+ status: HttpStatusCode.BAD_REQUEST,
1007
+ };
1008
+
1009
+ export const INVALIDLY_NAMED_ENVIRONMENT_VARIABLE: ProblemDetails = {
1010
+ type: "https://zup.fail/invalidly-named-environment-variable",
1011
+ title: "Environment variable needs a valid name",
1012
+ status: HttpStatusCode.BAD_REQUEST,
1013
+ };
1014
+
1015
+ export const PERSONAL_OVERRIDE_ONLY_FOR_WORKING_COPY: ProblemDetails = {
1016
+ type: "https://zup.fail/personal-override-only-for-working-copy",
1017
+ title:
1018
+ "A personal override can only be used for a working-copy environment variable",
1019
+ status: HttpStatusCode.BAD_REQUEST,
1020
+ };
1021
+
1022
+ export const TARGET_BRANCH_ONLY_FOR_PREVIEW: ProblemDetails = {
1023
+ type: "https://zup.fail/target-branch-only-for-preview",
1024
+ title: "A target branch can only be used for preview environment variables",
1025
+ status: HttpStatusCode.BAD_REQUEST,
1026
+ };
1027
+
1028
+ export const INVALID_BRANCH_NAME: ProblemDetails = {
1029
+ type: "https://zup.fail/invalid-branch-name",
1030
+ title: "Branch name is invalid",
1031
+ status: HttpStatusCode.BAD_REQUEST,
1032
+ };
1033
+
1034
+ export const OVERLAPPING_TARGETS: ProblemDetails = {
1035
+ type: "https://zup.fail/overlapping-targets",
1036
+ title:
1037
+ "The environments of this environment variable overlaps with an existing environment variable",
1038
+ status: HttpStatusCode.BAD_REQUEST,
1039
+ };
1040
+
1041
+ export const CONFLICTING_TYPES: ProblemDetails = {
1042
+ type: "https://zup.fail/conflicting-types",
1043
+ title:
1044
+ "The type of this environment variable conflicts with an existing environment variable with the same name",
1045
+ status: HttpStatusCode.BAD_REQUEST,
1046
+ };
1047
+
1048
+ export const NON_EMPTY_TARGETS_REQUIRED: ProblemDetails = {
1049
+ type: "https://zup.fail/non-empty-targets-required",
1050
+ title:
1051
+ "The environment targets for this environment variable cannot be empty.",
1052
+ status: HttpStatusCode.BAD_REQUEST,
1053
+ };
1054
+
1055
+ export const NO_ZUPLO_PREFIXED_VARIABLES: ProblemDetails = {
1056
+ type: "https://zup.fail/no-zuplo-prefixed-variables",
1057
+ title:
1058
+ "Environment variables should not start with the reserved prefix of ZUPLO or __ZUPLO",
1059
+ status: HttpStatusCode.BAD_REQUEST,
1060
+ };
1061
+
1062
+ export const NO_GLOBAL_SYMBOLS: ProblemDetails = {
1063
+ type: "https://zup.fail/no-global-symbols",
1064
+ title: "Environment variables cannot be named after global variables.",
1065
+ status: HttpStatusCode.BAD_REQUEST,
1066
+ };
1067
+
1068
+ export const DEPLOYER_NON_VALID_DEPLOYMENT_ENVIRONMENT_TYPE: ProblemDetails = {
1069
+ type: "https://zup.fail/deployer-non-valid-deployment-environment-type",
1070
+ title: "Deployment cannot be different than preview or production",
1071
+ status: HttpStatusCode.BAD_REQUEST,
1072
+ };
1073
+
1074
+ export const DEPLOYER_CANNOT_DEPLOY_USING_ENV_VARS_V2: ProblemDetails = {
1075
+ type: "https://zup.fail/deployer-cannot-deploy-using-env-vars-v2",
1076
+ title: "Deployer was not able to deploy zup using environment variables v2",
1077
+ status: HttpStatusCode.FORBIDDEN,
1078
+ };
1079
+
1080
+ export const DELETING_ZUPLO_ENVIRONMENT_VARIABLES_ERROR: ProblemDetails = {
1081
+ type: "https://zup.fail/deleting-zuplo-environment-variables-error",
1082
+ title: "Problems deleting ZUPLO environment variables for deployment",
1083
+ status: HttpStatusCode.NOT_FOUND,
1084
+ };
1085
+
1086
+ export const CANNOT_MODIFY_FILE_ON_READ_ONLY_ENVIRONMENT: ProblemDetailsFactory<{
1087
+ operation: "write" | "delete" | "edit" | "rename";
1088
+ path: string;
1089
+ }> = ({ operation, path }) => ({
1090
+ type: "https://zup.fail/cannot-modify-file-on-read-only-environment",
1091
+ title: `Cannot modify file on read-only environment`,
1092
+ detail: `Cannot ${operation} file ${path} for a read-only environment. Read-only environments cannot be edited.`,
1093
+ status: HttpStatusCode.METHOD_NOT_ALLOWED,
1094
+ });
1095
+
1096
+ export const CANNOT_SAVE_FILES_ON_READ_ONLY_ENVIRONMENT: ProblemDetailsFactory<
1097
+ Record<string, never>
1098
+ > = () => ({
1099
+ type: "https://zup.fail/cannot-modify-file-on-read-only-environment",
1100
+ title: `Cannot modify files on read-only environment`,
1101
+ detail: `Cannot save files on a read-only environment. Read-only environments cannot be edited.`,
1102
+ status: HttpStatusCode.METHOD_NOT_ALLOWED,
1103
+ });
1104
+
1105
+ export const MIGRATIONS_ONLY_ON_WORKING_COPY: ProblemDetails = {
1106
+ type: "https://zup.fail/migration-only-on-working-copy",
1107
+ title: `Migrations can only run on working copies.`,
1108
+ status: HttpStatusCode.BAD_REQUEST,
1109
+ };
1110
+
1111
+ export const RUNTIME_VERSION_INCORRECT_FORMAT: ProblemDetails = {
1112
+ type: "https://zup.fail/migration-incorrect-runtime-version-format",
1113
+ title: `Runtime version is in an incorrect format.`,
1114
+ status: HttpStatusCode.BAD_REQUEST,
1115
+ };
1116
+
1117
+ export const PACKAGE_JSON_NOT_FOUND: ProblemDetails = {
1118
+ type: "https://zup.fail/no-pkg-file-found",
1119
+ title: `No package.json file found.`,
1120
+ status: HttpStatusCode.NOT_FOUND,
1121
+ };
1122
+
1123
+ export const CANNOT_READ_PACKAGE_JSON: ProblemDetails = {
1124
+ type: "https://zup.fail/cannot-read-pkg-file",
1125
+ title: `Cannot read package.json file.`,
1126
+ status: HttpStatusCode.BAD_REQUEST,
1127
+ };
1128
+
1129
+ export const CANNOT_FIND_SRC_DIRECTORY: ProblemDetails = {
1130
+ type: "https://zup.fail/cannot-find-src-dir",
1131
+ title: `Cannot find source directory.`,
1132
+ status: HttpStatusCode.BAD_REQUEST,
1133
+ };
1134
+
1135
+ export const FAILED_DOWNLOAD_FROM_STORAGE: ProblemDetails = {
1136
+ type: "https://zup.fail/failed-download-storage",
1137
+ title: `Failed to download content from storage.`,
1138
+ status: HttpStatusCode.BAD_REQUEST,
1139
+ };
1140
+
1141
+ export const CANNOT_CREATE_DIRECTORY_ON_READ_ONLY_ENVIRONMENT: ProblemDetailsFactory<{
1142
+ path: string;
1143
+ }> = ({ path }) => ({
1144
+ type: "https://zup.fail/cannot-modify-file-on-read-only-environment",
1145
+ title: `Cannot create directory on read-only environment`,
1146
+ detail: `Cannot create folder ${path} for a read-only environment. Read-only environments cannot be edited.`,
1147
+ status: HttpStatusCode.METHOD_NOT_ALLOWED,
1148
+ });
1149
+
1150
+ export const CANNOT_CREATE_DIRECTORY_IN_NON_ALLOWED_LOCATION: ProblemDetailsFactory<{
1151
+ path: string;
1152
+ }> = ({ path }) => ({
1153
+ type: "https://zup.fail/directory-creation-in-non-allowed-location",
1154
+ title: "Directory creation attempted in non allowed location",
1155
+ detail: `Directory creation in ${path} is not allowed.`,
1156
+ instance: path,
1157
+ status: HttpStatusCode.BAD_REQUEST,
1158
+ });
1159
+
1160
+ export const DIRECTORY_ALREADY_EXISTS: ProblemDetailsFactory<{
1161
+ path: string;
1162
+ }> = ({ path }) => ({
1163
+ type: "https://zup.fail/directory-already-exists",
1164
+ title: "Directory already exists",
1165
+ status: HttpStatusCode.BAD_REQUEST,
1166
+ detail: `Directory already exists at ${path}.`,
1167
+ });
1168
+
1169
+ export const DIRECTORY_DOES_NOT_EXIST: ProblemDetailsFactory<{
1170
+ path: string;
1171
+ }> = ({ path }) => ({
1172
+ type: "https://zup.fail/directory-does-not-exist",
1173
+ title: "Directory does not exist",
1174
+ status: HttpStatusCode.BAD_REQUEST,
1175
+ detail: `No directory at ${path}`,
1176
+ });
1177
+
1178
+ export const DIRECTORY_OR_FILE_DOES_NOT_EXIST: ProblemDetailsFactory<{
1179
+ path: string;
1180
+ }> = ({ path }) => ({
1181
+ type: "https://zup.fail/directory-or-file-does-not-exist",
1182
+ title: "Directory or File does not exist",
1183
+ status: HttpStatusCode.BAD_REQUEST,
1184
+ detail: `No file/directory at ${path}`,
1185
+ });
1186
+
1187
+ export const DIRECTORY_CREATION_FAILED: ProblemDetailsFactory<{
1188
+ path: string;
1189
+ }> = ({ path }) => ({
1190
+ type: "https://zup.fail/directory-creation-failure",
1191
+ title: "Directory creation failed",
1192
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
1193
+ detail: `Failed to create directory at ${path}. Please try again or contact support.`,
1194
+ });
1195
+
1196
+ export const FILE_RENAME_PATHS_MATCH: ProblemDetailsFactory<{
1197
+ path: string;
1198
+ }> = ({ path }) => ({
1199
+ type: "https://zup.fail/file-rename-paths-match",
1200
+ title: "New file name matches old file name",
1201
+ status: HttpStatusCode.BAD_REQUEST,
1202
+ detail: `Failed to rename file, the old path ${path} matched the provided new path. Please choose a different name.`,
1203
+ });
1204
+
1205
+ export const FILE_RENAME_CANNOT_CHANGE_EXTENSION: ProblemDetailsFactory<{
1206
+ oldExtension: string;
1207
+ newExtension: string;
1208
+ }> = ({ oldExtension, newExtension }) => ({
1209
+ type: "https://zup.fail/file-rename-cannot-change-extension",
1210
+ title: "Cannot change extension of renamed file",
1211
+ status: HttpStatusCode.BAD_REQUEST,
1212
+ detail: `Failed to rename file, the new extension ${newExtension} must match the old extension ${oldExtension}.`,
1213
+ });
1214
+
1215
+ export const FILE_RENAME_FILE_ALREADY_EXISTS: ProblemDetailsFactory<{
1216
+ path: string;
1217
+ }> = ({ path }) => ({
1218
+ type: "https://zup.fail/file-rename-file-exists",
1219
+ title: "File already exists",
1220
+ status: HttpStatusCode.BAD_REQUEST,
1221
+ detail: `Failed to rename file, there already exists a file at ${path}. Please choose a different name.`,
1222
+ });
1223
+
1224
+ export const FILE_RENAME_FAILED: ProblemDetailsFactory<{
1225
+ path: string;
1226
+ }> = ({ path }) => ({
1227
+ type: "https://zup.fail/file-rename-failure",
1228
+ title: "File rename failed",
1229
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
1230
+ detail: `Failed to rename file ${path}. Please try again or contact support.`,
1231
+ });
1232
+
1233
+ export const FILE_WRITE_FAILED: ProblemDetailsFactory<{
1234
+ path: string;
1235
+ }> = ({ path }) => ({
1236
+ type: "https://zup.fail/file-write-failure",
1237
+ title: "File write failed",
1238
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
1239
+ detail: `Failed to write file ${path}. Please try again or contact support.`,
1240
+ });
1241
+
1242
+ export const CANNOT_DELETE_ESSENTIAL_FILE: ProblemDetailsFactory<{
1243
+ path: string;
1244
+ }> = ({ path }) => ({
1245
+ type: "https://zup.fail/essential-file-deletion",
1246
+ title: "Cannot delete essential file",
1247
+ status: HttpStatusCode.BAD_REQUEST,
1248
+ detail: `File '${path}' cannot be deleted. It is an essential file.`,
1249
+ });
1250
+
1251
+ export const CANNOT_DELETE_ESSENTIAL_DIRECTORY: ProblemDetailsFactory<{
1252
+ path: string;
1253
+ }> = ({ path }) => ({
1254
+ type: "https://zup.fail/essential-directory-deletion",
1255
+ title: "Cannot delete essential file",
1256
+ status: HttpStatusCode.BAD_REQUEST,
1257
+ detail: `Directory '${path}' cannot be deleted. It is an essential directory.`,
1258
+ });
1259
+
1260
+ export const CANNOT_DELETE_SOLE_OPEN_API_FILE: ProblemDetailsFactory<
1261
+ void
1262
+ > = () => ({
1263
+ type: "https://zup.fail/sole-open-api-file-deletion",
1264
+ title: "Cannot delete sole OpenAPI file",
1265
+ status: HttpStatusCode.BAD_REQUEST,
1266
+ detail: `Your project must have at least 1 OpenAPI file.`,
1267
+ });
1268
+
1269
+ export const FILE_DELETE_FAILED: ProblemDetailsFactory<{
1270
+ path: string;
1271
+ }> = ({ path }) => ({
1272
+ type: "https://zup.fail/file-delete-failure",
1273
+ title: "File deletion failed",
1274
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
1275
+ detail: `Failed to delete file ${path}. Please try again or contact support.`,
1276
+ });
1277
+
1278
+ export const DIRECTORY_DELETE_FAILED: ProblemDetailsFactory<{
1279
+ path: string;
1280
+ }> = ({ path }) => ({
1281
+ type: "https://zup.fail/directory-delete-failure",
1282
+ title: "Directory deletion failed",
1283
+ status: HttpStatusCode.INTERNAL_SERVER_ERROR,
1284
+ detail: `Failed to delete directory ${path}. Please try again or contact support.`,
1285
+ });
1286
+
1287
+ export const BUCKET_API_KEY_SERVICE_CONFLICT: ProblemDetails = {
1288
+ type: "https://zup.fail/bucket-api-key-service-error",
1289
+ title: "Bucket name conflicts",
1290
+ status: HttpStatusCode.CONFLICT,
1291
+ };
1292
+
1293
+ export const UNABLE_UPGRADE_PLAN: ProblemDetails = {
1294
+ type: "https://zup.fail/cant-upgrade-plan",
1295
+ title: "Can't upgrade to selected plan",
1296
+ status: HttpStatusCode.BAD_REQUEST,
1297
+ };