@adgytec/adgytec-web-utils 0.0.2 → 0.0.3
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.
- package/dist/chunks/applicationError +26 -0
- package/dist/chunks/decode +42 -31
- package/dist/chunks/formParse +11 -0
- package/dist/chunks/schema +322 -0
- package/dist/chunks/upload +97 -95
- package/dist/constants/httpRequestCredentials.d.ts +1 -0
- package/dist/constants/httpRequestHeaders.d.ts +14 -6
- package/dist/constants/http_methods.d.ts +7 -0
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +27 -15
- package/dist/errorCodes/auth.d.ts +14 -0
- package/dist/errorCodes/common.d.ts +5 -0
- package/dist/errorCodes/form.d.ts +28 -0
- package/dist/errorCodes/iam.d.ts +6 -0
- package/dist/errorCodes/index.d.ts +8 -0
- package/dist/errorCodes/index.js +84 -0
- package/dist/errorCodes/media.d.ts +12 -0
- package/dist/errorCodes/pagination.d.ts +3 -0
- package/dist/errorCodes/reqBody.d.ts +6 -0
- package/dist/errorCodes/server.d.ts +7 -0
- package/dist/errorSchema/auth.d.ts +37 -0
- package/dist/errorSchema/common.d.ts +10 -0
- package/dist/errorSchema/form.d.ts +14 -0
- package/dist/errorSchema/formField.d.ts +117 -0
- package/dist/errorSchema/formFieldInvalid.d.ts +79 -0
- package/dist/errorSchema/formParse.d.ts +4 -0
- package/dist/errorSchema/iam.d.ts +21 -0
- package/dist/errorSchema/index.d.ts +12 -0
- package/dist/errorSchema/index.js +69 -0
- package/dist/errorSchema/media.d.ts +41 -0
- package/dist/errorSchema/pagination.d.ts +4 -0
- package/dist/errorSchema/reqBody.d.ts +35 -0
- package/dist/errorSchema/schema.d.ts +138 -0
- package/dist/errorSchema/server.d.ts +29 -0
- package/dist/errors/applicationError.d.ts +9 -0
- package/dist/errors/index.d.ts +1 -2
- package/dist/errors/index.js +3 -6
- package/dist/errors/types.d.ts +0 -19
- package/dist/index.d.ts +2 -0
- package/dist/index.js +97 -33
- package/dist/media/types/lifecycle.d.ts +1 -2
- package/dist/response/errorResponse.d.ts +1 -0
- package/dist/response/successReponse.d.ts +2 -0
- package/dist/test.d.ts +1 -0
- package/package.json +2 -1
- package/dist/chunks/apiError +0 -24
- package/dist/chunks/parse +0 -88
- package/dist/constants/http.d.ts +0 -5
- package/dist/constants/httpRequest.d.ts +0 -3
- package/dist/errors/apiError.d.ts +0 -8
- package/dist/errors/parse.d.ts +0 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const invalidIDSchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"invalid-id">;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const routeNotFoundSchema: z.ZodObject<{
|
|
6
|
+
code: z.ZodLiteral<"route-not-found">;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const methodNotAllowedSchema: z.ZodObject<{
|
|
9
|
+
code: z.ZodLiteral<"method-not-allowed">;
|
|
10
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
import { FormFieldError } from './formField';
|
|
3
|
+
export type FieldNode = {
|
|
4
|
+
key: string;
|
|
5
|
+
errors: FormFieldError[];
|
|
6
|
+
} | {
|
|
7
|
+
key: string;
|
|
8
|
+
children: FieldNode[];
|
|
9
|
+
};
|
|
10
|
+
export declare const formValidationFailedSchema: z.ZodObject<{
|
|
11
|
+
code: z.ZodLiteral<"validation-failed">;
|
|
12
|
+
details: z.ZodArray<z.ZodType<FieldNode, unknown, z.core.$ZodTypeInternals<FieldNode, unknown>>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type FormValidationFailed = z.infer<typeof formValidationFailedSchema>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const fieldUnknownValidationErrorSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"unknown">;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const fieldMissingErrorSchema: z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"missing">;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const fieldOverflowErrorSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"overflow">;
|
|
10
|
+
details: z.ZodObject<{
|
|
11
|
+
max: z.ZodUnion<readonly [z.ZodCoercedDate<unknown>, z.ZodNumber]>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const fieldUnderflowErrorSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"underflow">;
|
|
16
|
+
details: z.ZodObject<{
|
|
17
|
+
min: z.ZodUnion<readonly [z.ZodCoercedDate<unknown>, z.ZodNumber]>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const fieldLengthErrorSchema: z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"length">;
|
|
22
|
+
details: z.ZodObject<{
|
|
23
|
+
min: z.ZodNumber;
|
|
24
|
+
max: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const fieldInvalidSchema: z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"invalid">;
|
|
29
|
+
details: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
+
cause: z.ZodLiteral<"invalid-value">;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
cause: z.ZodLiteral<"invalid-enum-value">;
|
|
33
|
+
possibleValues: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
cause: z.ZodLiteral<"require-https">;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
cause: z.ZodLiteral<"missing-host">;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
cause: z.ZodLiteral<"contains-path">;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
cause: z.ZodLiteral<"contains-query">;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
cause: z.ZodLiteral<"contains-fragment">;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
cause: z.ZodLiteral<"absolute-url">;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
cause: z.ZodLiteral<"nil-id">;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
cause: z.ZodLiteral<"invalid-email">;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
cause: z.ZodLiteral<"missing-mx-records">;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
cause: z.ZodLiteral<"not-digit">;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
cause: z.ZodLiteral<"not-base64-url-encoded">;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
cause: z.ZodLiteral<"invalid-url">;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
cause: z.ZodLiteral<"null-value">;
|
|
60
|
+
}, z.core.$strip>], "cause">;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export declare const formFieldDiscriminatedUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"unknown">;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"missing">;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"overflow">;
|
|
68
|
+
details: z.ZodObject<{
|
|
69
|
+
max: z.ZodUnion<readonly [z.ZodCoercedDate<unknown>, z.ZodNumber]>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"underflow">;
|
|
73
|
+
details: z.ZodObject<{
|
|
74
|
+
min: z.ZodUnion<readonly [z.ZodCoercedDate<unknown>, z.ZodNumber]>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"length">;
|
|
78
|
+
details: z.ZodObject<{
|
|
79
|
+
min: z.ZodNumber;
|
|
80
|
+
max: z.ZodNumber;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"invalid">;
|
|
84
|
+
details: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
cause: z.ZodLiteral<"invalid-value">;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
cause: z.ZodLiteral<"invalid-enum-value">;
|
|
88
|
+
possibleValues: z.ZodArray<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
cause: z.ZodLiteral<"require-https">;
|
|
91
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
+
cause: z.ZodLiteral<"missing-host">;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
cause: z.ZodLiteral<"contains-path">;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
cause: z.ZodLiteral<"contains-query">;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
cause: z.ZodLiteral<"contains-fragment">;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
cause: z.ZodLiteral<"absolute-url">;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
cause: z.ZodLiteral<"nil-id">;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
cause: z.ZodLiteral<"invalid-email">;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
cause: z.ZodLiteral<"missing-mx-records">;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
cause: z.ZodLiteral<"not-digit">;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
cause: z.ZodLiteral<"not-base64-url-encoded">;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
cause: z.ZodLiteral<"invalid-url">;
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
114
|
+
cause: z.ZodLiteral<"null-value">;
|
|
115
|
+
}, z.core.$strip>], "cause">;
|
|
116
|
+
}, z.core.$strip>], "type">;
|
|
117
|
+
export type FormFieldError = z.infer<typeof formFieldDiscriminatedUnionSchema>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const invalidValueErrorSchema: z.ZodObject<{
|
|
3
|
+
cause: z.ZodLiteral<"invalid-value">;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const invalidEnumValueErrorSchema: z.ZodObject<{
|
|
6
|
+
cause: z.ZodLiteral<"invalid-enum-value">;
|
|
7
|
+
possibleValues: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const requireHttpsErrorSchema: z.ZodObject<{
|
|
10
|
+
cause: z.ZodLiteral<"require-https">;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const missingHostErrorSchema: z.ZodObject<{
|
|
13
|
+
cause: z.ZodLiteral<"missing-host">;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const containsPathErrorSchema: z.ZodObject<{
|
|
16
|
+
cause: z.ZodLiteral<"contains-path">;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const containsQueryErrorSchema: z.ZodObject<{
|
|
19
|
+
cause: z.ZodLiteral<"contains-query">;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const containsFragmentErrorSchema: z.ZodObject<{
|
|
22
|
+
cause: z.ZodLiteral<"contains-fragment">;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const absoluteUrlErrorSchema: z.ZodObject<{
|
|
25
|
+
cause: z.ZodLiteral<"absolute-url">;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const nilIDErrorSchema: z.ZodObject<{
|
|
28
|
+
cause: z.ZodLiteral<"nil-id">;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const invalidEmailErrorSchema: z.ZodObject<{
|
|
31
|
+
cause: z.ZodLiteral<"invalid-email">;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const missingMxRecordsErrorSchema: z.ZodObject<{
|
|
34
|
+
cause: z.ZodLiteral<"missing-mx-records">;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const notDigitErrorSchema: z.ZodObject<{
|
|
37
|
+
cause: z.ZodLiteral<"not-digit">;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const notBase64UrlEncodedErrorSchema: z.ZodObject<{
|
|
40
|
+
cause: z.ZodLiteral<"not-base64-url-encoded">;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const invalidUrlErrorSchema: z.ZodObject<{
|
|
43
|
+
cause: z.ZodLiteral<"invalid-url">;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export declare const nullValueErrorSchema: z.ZodObject<{
|
|
46
|
+
cause: z.ZodLiteral<"null-value">;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const formFieldInvalidDiscriminatedUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
cause: z.ZodLiteral<"invalid-value">;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
cause: z.ZodLiteral<"invalid-enum-value">;
|
|
52
|
+
possibleValues: z.ZodArray<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
cause: z.ZodLiteral<"require-https">;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
cause: z.ZodLiteral<"missing-host">;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
cause: z.ZodLiteral<"contains-path">;
|
|
59
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
+
cause: z.ZodLiteral<"contains-query">;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
cause: z.ZodLiteral<"contains-fragment">;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
cause: z.ZodLiteral<"absolute-url">;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
cause: z.ZodLiteral<"nil-id">;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
cause: z.ZodLiteral<"invalid-email">;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
cause: z.ZodLiteral<"missing-mx-records">;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
cause: z.ZodLiteral<"not-digit">;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
cause: z.ZodLiteral<"not-base64-url-encoded">;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
cause: z.ZodLiteral<"invalid-url">;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
cause: z.ZodLiteral<"null-value">;
|
|
79
|
+
}, z.core.$strip>], "cause">;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const selfPermissionMismatchSchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"self-permission-mismatch">;
|
|
4
|
+
permission: z.ZodString;
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
required: z.ZodString;
|
|
7
|
+
got: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const invalidActorSchema: z.ZodObject<{
|
|
10
|
+
code: z.ZodLiteral<"invalid-actor">;
|
|
11
|
+
supportedActors: z.ZodArray<z.ZodString>;
|
|
12
|
+
currentActor: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const permissionExplicitlyDeniedSchema: z.ZodObject<{
|
|
15
|
+
code: z.ZodLiteral<"permission-explicitly-denied">;
|
|
16
|
+
deniedPermission: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const missingPermissionSchema: z.ZodObject<{
|
|
19
|
+
code: z.ZodLiteral<"missing-permission">;
|
|
20
|
+
missingPermission: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './server';
|
|
2
|
+
export * from './form';
|
|
3
|
+
export * from './formField';
|
|
4
|
+
export * from './formFieldInvalid';
|
|
5
|
+
export * from './formParse';
|
|
6
|
+
export * from './auth';
|
|
7
|
+
export * from './reqBody';
|
|
8
|
+
export * from './pagination';
|
|
9
|
+
export * from './common';
|
|
10
|
+
export * from './media';
|
|
11
|
+
export * from './iam';
|
|
12
|
+
export * from './schema';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { a as r, c as s, b as i, d as o, e as m, f as n, g as c, h, i as l, j as S, k as d, l as t, m as u, n as E, o as p, p as v, q as f, r as g, s as F, t as U, u as N, v as y, w as I, x as V, y as w, z as x, A, B, C as D, D as M, E as b, F as O, G as R, H as q, I as k, J as L, K as P, L as T, M as j, N as z, O as C, P as H, Q as J, R as K, S as Q, T as G, U as W, V as X, W as Y, X as Z, Y as _, Z as $, _ as aa, $ as ea, a0 as ra, a1 as sa, a2 as ia, a3 as oa, a4 as ma, a5 as na, a6 as ca, a7 as ha, a8 as la, a9 as Sa } from "../chunks/schema";
|
|
2
|
+
import { f as ta } from "../chunks/formParse";
|
|
3
|
+
export {
|
|
4
|
+
r as absoluteUrlErrorSchema,
|
|
5
|
+
s as completeMultipartUploadCalledTooSoonSchema,
|
|
6
|
+
i as containsFragmentErrorSchema,
|
|
7
|
+
o as containsPathErrorSchema,
|
|
8
|
+
m as containsQueryErrorSchema,
|
|
9
|
+
n as emptyRequestBodySchema,
|
|
10
|
+
c as errorSchema,
|
|
11
|
+
h as fieldInvalidSchema,
|
|
12
|
+
l as fieldLengthErrorSchema,
|
|
13
|
+
S as fieldMissingErrorSchema,
|
|
14
|
+
d as fieldOverflowErrorSchema,
|
|
15
|
+
t as fieldUnderflowErrorSchema,
|
|
16
|
+
u as fieldUnknownValidationErrorSchema,
|
|
17
|
+
ta as flattenFieldNodes,
|
|
18
|
+
E as formFieldDiscriminatedUnionSchema,
|
|
19
|
+
p as formFieldInvalidDiscriminatedUnion,
|
|
20
|
+
v as formValidationFailedSchema,
|
|
21
|
+
f as hashMismatchSchema,
|
|
22
|
+
g as internalServerErrorSchema,
|
|
23
|
+
F as invalidActorSchema,
|
|
24
|
+
U as invalidApiKeySchema,
|
|
25
|
+
N as invalidAuthHeaderValueSchema,
|
|
26
|
+
y as invalidCursorValueSchema,
|
|
27
|
+
I as invalidEmailErrorSchema,
|
|
28
|
+
V as invalidEnumValueErrorSchema,
|
|
29
|
+
w as invalidIDSchema,
|
|
30
|
+
x as invalidMultipartNumberSchema,
|
|
31
|
+
A as invalidRequestBodySchema,
|
|
32
|
+
B as invalidResponseShapeSchema,
|
|
33
|
+
D as invalidSignedUrlSchema,
|
|
34
|
+
M as invalidUrlErrorSchema,
|
|
35
|
+
b as invalidValueErrorSchema,
|
|
36
|
+
O as jwtNotAcceptableSchema,
|
|
37
|
+
R as malformedJSONFromServerSchema,
|
|
38
|
+
q as malformedResponseBodySchema,
|
|
39
|
+
k as mediaItemsLimitExceededSchema,
|
|
40
|
+
L as mediaObjectNotFoundSchema,
|
|
41
|
+
P as mediaTooLargeSchema,
|
|
42
|
+
T as methodNotAllowedSchema,
|
|
43
|
+
j as missingETagValueSchema,
|
|
44
|
+
z as missingHostErrorSchema,
|
|
45
|
+
C as missingMxRecordsErrorSchema,
|
|
46
|
+
H as missingPermissionSchema,
|
|
47
|
+
J as multipartPartUploadFailedSchema,
|
|
48
|
+
K as nilIDErrorSchema,
|
|
49
|
+
Q as notBase64UrlEncodedErrorSchema,
|
|
50
|
+
G as notDigitErrorSchema,
|
|
51
|
+
W as nullValueErrorSchema,
|
|
52
|
+
X as organizationStatusBadSchema,
|
|
53
|
+
Y as permissionExplicitlyDeniedSchema,
|
|
54
|
+
Z as requestBodyTooLargeSchema,
|
|
55
|
+
_ as requireHttpsErrorSchema,
|
|
56
|
+
$ as routeNotFoundSchema,
|
|
57
|
+
aa as selfPermissionMismatchSchema,
|
|
58
|
+
ea as singlepartUploadFailedSchema,
|
|
59
|
+
ra as tokenNotFoundSchema,
|
|
60
|
+
sa as unknownFieldInRequestBodySchema,
|
|
61
|
+
ia as unknownServerErrorSchema,
|
|
62
|
+
oa as unsupportedAuthSchemeSchema,
|
|
63
|
+
ma as unsupportedObjectUploadedSchema,
|
|
64
|
+
na as uploadAlreadyCompletedSchema,
|
|
65
|
+
ca as userDisabledSchema,
|
|
66
|
+
ha as userNotExistInOrganizationSchema,
|
|
67
|
+
la as userNotExistsInOrganizationManagementSchema,
|
|
68
|
+
Sa as userNotFoundSchema
|
|
69
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const invalidMultipartNumberSchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"invalid-multipart-upload-part-number">;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const mediaObjectNotFoundSchema: z.ZodObject<{
|
|
6
|
+
code: z.ZodLiteral<"object-not-found">;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const mediaTooLargeSchema: z.ZodObject<{
|
|
9
|
+
code: z.ZodLiteral<"media-too-large">;
|
|
10
|
+
mediaID: z.ZodUUID;
|
|
11
|
+
currentSize: z.ZodInt;
|
|
12
|
+
maxSupportedSize: z.ZodInt;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const mediaItemsLimitExceededSchema: z.ZodObject<{
|
|
15
|
+
code: z.ZodLiteral<"media-items-limit-exceeded">;
|
|
16
|
+
currentLength: z.ZodInt;
|
|
17
|
+
maxItemsSupported: z.ZodInt;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const uploadAlreadyCompletedSchema: z.ZodObject<{
|
|
20
|
+
code: z.ZodLiteral<"upload-already-completed">;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const unsupportedObjectUploadedSchema: z.ZodObject<{
|
|
23
|
+
code: z.ZodLiteral<"unsupported-object-uploaded">;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const completeMultipartUploadCalledTooSoonSchema: z.ZodObject<{
|
|
26
|
+
code: z.ZodLiteral<"complete-multipart-upload-called-too-soon">;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const singlepartUploadFailedSchema: z.ZodObject<{
|
|
29
|
+
code: z.ZodLiteral<"singlepart-upload-failed">;
|
|
30
|
+
mediaID: z.ZodUUID;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export declare const multipartPartUploadFailedSchema: z.ZodObject<{
|
|
33
|
+
code: z.ZodLiteral<"multipart-part-upload-failed">;
|
|
34
|
+
mediaID: z.ZodUUID;
|
|
35
|
+
partNumber: z.ZodInt;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const missingETagValueSchema: z.ZodObject<{
|
|
38
|
+
code: z.ZodLiteral<"missing-etag-value">;
|
|
39
|
+
mediaID: z.ZodUUID;
|
|
40
|
+
partNumber: z.ZodInt;
|
|
41
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const invalidRequestBodySchema: z.ZodPipe<z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"invalid-request-body">;
|
|
4
|
+
message: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
6
|
+
code: "invalid-request-body";
|
|
7
|
+
debugMessage: string;
|
|
8
|
+
}, {
|
|
9
|
+
code: "invalid-request-body";
|
|
10
|
+
message: string;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const unknownFieldInRequestBodySchema: z.ZodPipe<z.ZodObject<{
|
|
13
|
+
code: z.ZodLiteral<"unknown-field-in-request-body">;
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
16
|
+
code: "unknown-field-in-request-body";
|
|
17
|
+
debugMessage: string;
|
|
18
|
+
}, {
|
|
19
|
+
code: "unknown-field-in-request-body";
|
|
20
|
+
message: string;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const requestBodyTooLargeSchema: z.ZodObject<{
|
|
23
|
+
code: z.ZodLiteral<"request-body-too-large">;
|
|
24
|
+
limit: z.ZodInt;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const emptyRequestBodySchema: z.ZodPipe<z.ZodObject<{
|
|
27
|
+
code: z.ZodLiteral<"empty-request-body">;
|
|
28
|
+
message: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
30
|
+
code: "empty-request-body";
|
|
31
|
+
debugMessage: string;
|
|
32
|
+
}, {
|
|
33
|
+
code: "empty-request-body";
|
|
34
|
+
message: string;
|
|
35
|
+
}>>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const errorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"invalid-api-key">;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
code: z.ZodLiteral<"user-not-found">;
|
|
6
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
code: z.ZodLiteral<"jwt-not-acceptable">;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
code: z.ZodLiteral<"invalid-signed-url">;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
code: z.ZodLiteral<"hash-mismatch">;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
code: z.ZodLiteral<"invalid-auth-header-value">;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
code: z.ZodLiteral<"bad-org-status">;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
code: z.ZodLiteral<"user-not-exists-in-organization-management">;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
code: z.ZodLiteral<"user-not-exists-in-organization">;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
code: z.ZodLiteral<"user-disabled">;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
code: z.ZodLiteral<"token-not-found">;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
code: z.ZodLiteral<"unsupported-auth-scheme">;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
code: z.ZodLiteral<"invalid-id">;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
code: z.ZodLiteral<"route-not-found">;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
code: z.ZodLiteral<"method-not-allowed">;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
code: z.ZodLiteral<"validation-failed">;
|
|
34
|
+
details: z.ZodArray<z.ZodType<import('./form').FieldNode, unknown, z.core.$ZodTypeInternals<import('./form').FieldNode, unknown>>>;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
code: z.ZodLiteral<"self-permission-mismatch">;
|
|
37
|
+
permission: z.ZodString;
|
|
38
|
+
key: z.ZodString;
|
|
39
|
+
required: z.ZodString;
|
|
40
|
+
got: z.ZodString;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
code: z.ZodLiteral<"invalid-actor">;
|
|
43
|
+
supportedActors: z.ZodArray<z.ZodString>;
|
|
44
|
+
currentActor: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
code: z.ZodLiteral<"permission-explicitly-denied">;
|
|
47
|
+
deniedPermission: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
code: z.ZodLiteral<"missing-permission">;
|
|
50
|
+
missingPermission: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
code: z.ZodLiteral<"invalid-multipart-upload-part-number">;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
code: z.ZodLiteral<"object-not-found">;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
code: z.ZodLiteral<"media-too-large">;
|
|
57
|
+
mediaID: z.ZodUUID;
|
|
58
|
+
currentSize: z.ZodInt;
|
|
59
|
+
maxSupportedSize: z.ZodInt;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
code: z.ZodLiteral<"media-items-limit-exceeded">;
|
|
62
|
+
currentLength: z.ZodInt;
|
|
63
|
+
maxItemsSupported: z.ZodInt;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
code: z.ZodLiteral<"upload-already-completed">;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
code: z.ZodLiteral<"unsupported-object-uploaded">;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
code: z.ZodLiteral<"complete-multipart-upload-called-too-soon">;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
code: z.ZodLiteral<"singlepart-upload-failed">;
|
|
72
|
+
mediaID: z.ZodUUID;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
code: z.ZodLiteral<"multipart-part-upload-failed">;
|
|
75
|
+
mediaID: z.ZodUUID;
|
|
76
|
+
partNumber: z.ZodInt;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
code: z.ZodLiteral<"missing-etag-value">;
|
|
79
|
+
mediaID: z.ZodUUID;
|
|
80
|
+
partNumber: z.ZodInt;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
code: z.ZodLiteral<"invalid-cursor-value">;
|
|
83
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
84
|
+
code: z.ZodLiteral<"invalid-request-body">;
|
|
85
|
+
message: z.ZodString;
|
|
86
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
87
|
+
code: "invalid-request-body";
|
|
88
|
+
debugMessage: string;
|
|
89
|
+
}, {
|
|
90
|
+
code: "invalid-request-body";
|
|
91
|
+
message: string;
|
|
92
|
+
}>>, z.ZodPipe<z.ZodObject<{
|
|
93
|
+
code: z.ZodLiteral<"unknown-field-in-request-body">;
|
|
94
|
+
message: z.ZodString;
|
|
95
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
96
|
+
code: "unknown-field-in-request-body";
|
|
97
|
+
debugMessage: string;
|
|
98
|
+
}, {
|
|
99
|
+
code: "unknown-field-in-request-body";
|
|
100
|
+
message: string;
|
|
101
|
+
}>>, z.ZodObject<{
|
|
102
|
+
code: z.ZodLiteral<"request-body-too-large">;
|
|
103
|
+
limit: z.ZodInt;
|
|
104
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
105
|
+
code: z.ZodLiteral<"empty-request-body">;
|
|
106
|
+
message: z.ZodString;
|
|
107
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
108
|
+
code: "empty-request-body";
|
|
109
|
+
debugMessage: string;
|
|
110
|
+
}, {
|
|
111
|
+
code: "empty-request-body";
|
|
112
|
+
message: string;
|
|
113
|
+
}>>, z.ZodObject<{
|
|
114
|
+
code: z.ZodLiteral<"malformed-response-body">;
|
|
115
|
+
response: z.ZodCustom<Response, Response>;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
code: z.ZodLiteral<"malformed-json-from-server">;
|
|
118
|
+
response: z.ZodCustom<Response, Response>;
|
|
119
|
+
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
120
|
+
code: z.ZodLiteral<"invalid-response-shape">;
|
|
121
|
+
message: z.ZodString;
|
|
122
|
+
payload: z.ZodUnknown;
|
|
123
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
124
|
+
code: "invalid-response-shape";
|
|
125
|
+
debugMessage: string;
|
|
126
|
+
payload: unknown;
|
|
127
|
+
}, {
|
|
128
|
+
code: "invalid-response-shape";
|
|
129
|
+
message: string;
|
|
130
|
+
payload: unknown;
|
|
131
|
+
}>>, z.ZodObject<{
|
|
132
|
+
code: z.ZodLiteral<"unknown-server-error">;
|
|
133
|
+
payload: z.ZodUnknown;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
code: z.ZodLiteral<"internal-server-error">;
|
|
136
|
+
}, z.core.$strip>], "code">;
|
|
137
|
+
export type ErrorCode = z.infer<typeof errorSchema>["code"];
|
|
138
|
+
export type ErrorDetails = z.infer<typeof errorSchema>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as z } from 'zod';
|
|
2
|
+
export declare const malformedResponseBodySchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"malformed-response-body">;
|
|
4
|
+
response: z.ZodCustom<Response, Response>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const malformedJSONFromServerSchema: z.ZodObject<{
|
|
7
|
+
code: z.ZodLiteral<"malformed-json-from-server">;
|
|
8
|
+
response: z.ZodCustom<Response, Response>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const invalidResponseShapeSchema: z.ZodPipe<z.ZodObject<{
|
|
11
|
+
code: z.ZodLiteral<"invalid-response-shape">;
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
payload: z.ZodUnknown;
|
|
14
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
15
|
+
code: "invalid-response-shape";
|
|
16
|
+
debugMessage: string;
|
|
17
|
+
payload: unknown;
|
|
18
|
+
}, {
|
|
19
|
+
code: "invalid-response-shape";
|
|
20
|
+
message: string;
|
|
21
|
+
payload: unknown;
|
|
22
|
+
}>>;
|
|
23
|
+
export declare const unknownServerErrorSchema: z.ZodObject<{
|
|
24
|
+
code: z.ZodLiteral<"unknown-server-error">;
|
|
25
|
+
payload: z.ZodUnknown;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const internalServerErrorSchema: z.ZodObject<{
|
|
28
|
+
code: z.ZodLiteral<"internal-server-error">;
|
|
29
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorDetails } from '../errorSchema';
|
|
2
|
+
import { BaseError } from './baseError';
|
|
3
|
+
export declare class ApplicationError extends BaseError {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(code: string, details?: object);
|
|
6
|
+
get details(): unknown;
|
|
7
|
+
get code(): string;
|
|
8
|
+
parse(): ErrorDetails;
|
|
9
|
+
}
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { p as E } from "../chunks/parse";
|
|
1
|
+
import { A as a, B as p } from "../chunks/applicationError";
|
|
3
2
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
a as newAPIErrorResponse,
|
|
7
|
-
E as parseError
|
|
3
|
+
a as ApplicationError,
|
|
4
|
+
p as BaseError
|
|
8
5
|
};
|
package/dist/errors/types.d.ts
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
export declare const APIErrorResponseSchema: z.ZodObject<{
|
|
3
|
-
message: z.ZodOptional<z.ZodString>;
|
|
4
|
-
fieldErrors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export type APIErrorResponse = z.infer<typeof APIErrorResponseSchema>;
|
|
7
|
-
export type NewAPIErrorResponse = (res: unknown) => APIErrorResponse;
|
|
8
|
-
export type ErrorCode = "server-error" | "network-error" | "too-many-requests-error" | "authentication-error" | "authorization-error" | "not-found-error" | "method-not-allowed-error" | "form-field-error" | "user-action-error" | "content-too-large-error" | "unknown-error";
|
|
9
|
-
type WithMessage<T extends Exclude<ErrorCode, "form-field-error">> = {
|
|
10
|
-
errorCode: T;
|
|
11
|
-
message: string;
|
|
12
|
-
};
|
|
13
|
-
export type APPError = WithMessage<"server-error"> | WithMessage<"network-error"> | (WithMessage<"too-many-requests-error"> & {
|
|
14
|
-
retryAfter: number;
|
|
15
|
-
}) | WithMessage<"authentication-error"> | WithMessage<"authorization-error"> | WithMessage<"not-found-error"> | WithMessage<"method-not-allowed-error"> | {
|
|
16
|
-
errorCode: "form-field-error";
|
|
17
|
-
fieldErrors: Record<string, string | string[]>;
|
|
18
|
-
} | WithMessage<"user-action-error"> | WithMessage<"content-too-large-error"> | WithMessage<"unknown-error">;
|
|
19
|
-
export type ParseError = (error: any) => APPError;
|
|
20
1
|
export {};
|