@adgytec/adgytec-web-utils 0.0.5 → 0.0.7
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/create +24 -0
- package/dist/chunks/create.map +1 -0
- package/dist/chunks/decode +15 -15
- package/dist/chunks/parse +29 -12
- package/dist/chunks/parse.map +1 -1
- package/dist/chunks/restrictions +151 -0
- package/dist/chunks/restrictions.map +1 -0
- package/dist/chunks/schema +227 -195
- package/dist/chunks/schema.map +1 -1
- package/dist/chunks/uploadDetails +92 -91
- package/dist/chunks/uploadDetails.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +5 -3
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/media_limits.d.ts +2 -0
- package/dist/errorCodes/auth.d.ts +3 -0
- package/dist/errorCodes/common.d.ts +2 -0
- package/dist/errorCodes/iam.d.ts +2 -0
- package/dist/errorCodes/index.d.ts +2 -0
- package/dist/errorCodes/index.js +32 -85
- package/dist/errorCodes/index.js.map +1 -1
- package/dist/errorCodes/media.d.ts +2 -0
- package/dist/errorCodes/overrides.d.ts +2 -0
- package/dist/errorCodes/pagination.d.ts +2 -0
- package/dist/errorCodes/reqBody.d.ts +2 -0
- package/dist/errorCodes/restrictions.d.ts +3 -0
- package/dist/errorCodes/server.d.ts +2 -0
- package/dist/errorSchema/create.d.ts +2 -0
- package/dist/errorSchema/index.d.ts +2 -0
- package/dist/errorSchema/index.js +53 -49
- package/dist/errorSchema/index.js.map +1 -1
- package/dist/errorSchema/media.d.ts +1 -1
- package/dist/errorSchema/restrictions.d.ts +7 -0
- package/dist/errorSchema/schema.d.ts +6 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +4 -3
- package/dist/errors/normalization.d.ts +12 -0
- package/dist/errors/parse.d.ts +1 -2
- package/dist/index.js +116 -99
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/applicationError +0 -28
- package/dist/chunks/applicationError.map +0 -1
package/dist/errorCodes/index.js
CHANGED
|
@@ -1,88 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
tokenNotFound: "token-not-found"
|
|
14
|
-
}, o = {
|
|
15
|
-
invalidId: "invalid-id",
|
|
16
|
-
routeNotFound: "route-not-found",
|
|
17
|
-
methodNotAllowed: "method-not-allowed",
|
|
18
|
-
networkError: "network-error",
|
|
19
|
-
unexpectedError: "unexpected-error",
|
|
20
|
-
zodError: "zod-error"
|
|
21
|
-
}, i = {
|
|
22
|
-
formValidationFailed: "validation-failed"
|
|
23
|
-
}, n = {
|
|
24
|
-
missing: "missing",
|
|
25
|
-
overflow: "overflow",
|
|
26
|
-
underflow: "underflow",
|
|
27
|
-
length: "length",
|
|
28
|
-
invalid: "invalid",
|
|
29
|
-
unknown: "unknown"
|
|
30
|
-
}, a = {
|
|
31
|
-
invalidValue: "invalid-value",
|
|
32
|
-
invalidEnumValue: "invalid-enum-value",
|
|
33
|
-
requireHttps: "require-https",
|
|
34
|
-
missingHost: "missing-host",
|
|
35
|
-
containsPath: "contains-path",
|
|
36
|
-
containsQuery: "contains-query",
|
|
37
|
-
containsFragment: "contains-fragment",
|
|
38
|
-
absoluteUrl: "absolute-url",
|
|
39
|
-
nilID: "nil-id",
|
|
40
|
-
invalidEmail: "invalid-email",
|
|
41
|
-
missingMxRecords: "missing-mx-records",
|
|
42
|
-
notDigit: "not-digit",
|
|
43
|
-
notBase64UrlEncoded: "not-base64-url-encoded",
|
|
44
|
-
invalidUrl: "invalid-url",
|
|
45
|
-
nullValue: "null-value"
|
|
46
|
-
}, t = {
|
|
47
|
-
selfPermissionMismatch: "self-permission-mismatch",
|
|
48
|
-
invalidActor: "invalid-actor",
|
|
49
|
-
permissionExplicitlyDenied: "permission-explicitly-denied",
|
|
50
|
-
missingPermission: "missing-permission"
|
|
51
|
-
}, r = {
|
|
52
|
-
invalidMultipartNumber: "invalid-multipart-upload-part-number",
|
|
53
|
-
mediaObjectNotFound: "object-not-found",
|
|
54
|
-
mediaTooLarge: "media-too-large",
|
|
55
|
-
mediaItemsLimitExceeded: "media-items-limit-exceeded",
|
|
56
|
-
uploadAlreadyCompleted: "upload-already-completed",
|
|
57
|
-
unsupportedObjectUploaded: "unsupported-object-uploaded",
|
|
58
|
-
completeMultipartUploadCalledTooSoon: "complete-multipart-upload-called-too-soon",
|
|
59
|
-
singlepartUploadFailed: "singlepart-upload-failed",
|
|
60
|
-
multipartPartUploadFailed: "multipart-part-upload-failed",
|
|
61
|
-
missingETagValue: "missing-etag-value"
|
|
62
|
-
}, d = {
|
|
63
|
-
invalidCursorValue: "invalid-cursor-value"
|
|
64
|
-
}, s = {
|
|
65
|
-
invalidRequestBody: "invalid-request-body",
|
|
66
|
-
unknownFieldInRequestBody: "unknown-field-in-request-body",
|
|
67
|
-
emptyRequestBody: "empty-request-body",
|
|
68
|
-
requestBodyTooLarge: "request-body-too-large"
|
|
69
|
-
}, l = {
|
|
70
|
-
malformedResponseBody: "malformed-response-body",
|
|
71
|
-
malformedJsonFromServer: "malformed-json-from-server",
|
|
72
|
-
invalidResponseShape: "invalid-response-shape",
|
|
73
|
-
unknownServerError: "unknown-server-error",
|
|
74
|
-
internalServerError: "internal-server-error"
|
|
75
|
-
};
|
|
1
|
+
import { b as e, q as s, d as r, h as a, j as d, k as o, r as i, o as m } from "../chunks/restrictions";
|
|
2
|
+
import { a as O, c as p, f, e as c, g as l, i as u, m as g, p as y, l as h, n as q, s as x } from "../chunks/restrictions";
|
|
3
|
+
const v = [
|
|
4
|
+
e,
|
|
5
|
+
s,
|
|
6
|
+
r,
|
|
7
|
+
a,
|
|
8
|
+
d,
|
|
9
|
+
o,
|
|
10
|
+
i,
|
|
11
|
+
m
|
|
12
|
+
];
|
|
76
13
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
14
|
+
O as authCodes,
|
|
15
|
+
e as authOverrides,
|
|
16
|
+
p as commonCodes,
|
|
17
|
+
r as commonOverrides,
|
|
18
|
+
v as defaultOverrides,
|
|
19
|
+
f as formCodes,
|
|
20
|
+
c as formFieldInvalidTypeCauses,
|
|
21
|
+
l as formFieldTypes,
|
|
22
|
+
u as iamCodes,
|
|
23
|
+
a as iamOverrides,
|
|
24
|
+
g as mediaCodes,
|
|
25
|
+
d as mediaOverrides,
|
|
26
|
+
y as paginationCodes,
|
|
27
|
+
o as paginationOverrides,
|
|
28
|
+
i as reqBodyOverrides,
|
|
29
|
+
h as requestBodyCodes,
|
|
30
|
+
q as restrictionCodes,
|
|
31
|
+
x as serverCodes,
|
|
32
|
+
m as serverOverrides,
|
|
33
|
+
s as signedURLOverrides
|
|
87
34
|
};
|
|
88
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/errorCodes/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/errorCodes/overrides.ts"],"sourcesContent":["import type { ErrorNormalization } from \"../errors\";\nimport { authOverrides, signedURLOverrides } from \"./auth\";\nimport { commonOverrides } from \"./common\";\nimport { iamOverrides } from \"./iam\";\nimport { mediaOverrides } from \"./media\";\nimport { paginationOverrides } from \"./pagination\";\nimport { reqBodyOverrides } from \"./reqBody\";\nimport { serverOverrides } from \"./server\";\n\nexport const defaultOverrides: readonly ErrorNormalization[] = [\n authOverrides,\n signedURLOverrides,\n commonOverrides,\n iamOverrides,\n mediaOverrides,\n paginationOverrides,\n reqBodyOverrides,\n serverOverrides,\n] as const;\n"],"names":["defaultOverrides","authOverrides","signedURLOverrides","commonOverrides","iamOverrides","mediaOverrides","paginationOverrides","reqBodyOverrides","serverOverrides"],"mappings":";;AASO,MAAMA,IAAkD;AAAA,EAC3DC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACJ;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ErrorNormalization } from '../errors';
|
|
1
2
|
export declare const mediaCodes: {
|
|
2
3
|
readonly invalidMultipartNumber: "invalid-multipart-upload-part-number";
|
|
3
4
|
readonly mediaObjectNotFound: "object-not-found";
|
|
@@ -10,3 +11,4 @@ export declare const mediaCodes: {
|
|
|
10
11
|
readonly multipartPartUploadFailed: "multipart-part-upload-failed";
|
|
11
12
|
readonly missingETagValue: "missing-etag-value";
|
|
12
13
|
};
|
|
14
|
+
export declare const mediaOverrides: ErrorNormalization;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ErrorNormalization } from '../errors';
|
|
1
2
|
export declare const requestBodyCodes: {
|
|
2
3
|
readonly invalidRequestBody: "invalid-request-body";
|
|
3
4
|
readonly unknownFieldInRequestBody: "unknown-field-in-request-body";
|
|
4
5
|
readonly emptyRequestBody: "empty-request-body";
|
|
5
6
|
readonly requestBodyTooLarge: "request-body-too-large";
|
|
6
7
|
};
|
|
8
|
+
export declare const reqBodyOverrides: ErrorNormalization;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ErrorNormalization } from '../errors';
|
|
1
2
|
export declare const serverCodes: {
|
|
2
3
|
readonly malformedResponseBody: "malformed-response-body";
|
|
3
4
|
readonly malformedJsonFromServer: "malformed-json-from-server";
|
|
@@ -5,3 +6,4 @@ export declare const serverCodes: {
|
|
|
5
6
|
readonly unknownServerError: "unknown-server-error";
|
|
6
7
|
readonly internalServerError: "internal-server-error";
|
|
7
8
|
};
|
|
9
|
+
export declare const serverOverrides: ErrorNormalization;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './auth';
|
|
2
2
|
export * from './common';
|
|
3
|
+
export * from './create';
|
|
3
4
|
export * from './form';
|
|
4
5
|
export * from './formField';
|
|
5
6
|
export * from './formFieldInvalid';
|
|
@@ -8,5 +9,6 @@ export * from './iam';
|
|
|
8
9
|
export * from './media';
|
|
9
10
|
export * from './pagination';
|
|
10
11
|
export * from './reqBody';
|
|
12
|
+
export * from './restrictions';
|
|
11
13
|
export * from './schema';
|
|
12
14
|
export * from './server';
|
|
@@ -1,70 +1,74 @@
|
|
|
1
|
-
import { a as r, c as s, b as i, d as o, e as m, f as
|
|
2
|
-
import {
|
|
1
|
+
import { a as r, c as s, b as i, d as o, e as m, f as c, g as n, h as d, i as h, j as t, k as l, l as S, m as u, n as E, o as p, p as f, q as v, r as g, s as F, t as U, u as N, v as x, w as y, x as w, y as I, z as M, C as V, D as b, E as D, F as A, G as B, H as L, I as O, J as R, K as q, L as T, M as k, N as P, O as j, P as z, Q as C, R as H, S as J, T as K, U as Q, V as G, W, X, Y, Z, _, $, a0 as aa, a1 as ea, a2 as ra, a3 as sa, a4 as ia, a5 as oa, a6 as ma, a7 as ca, a8 as na, a9 as da, aa as ha, ab as ta, ac as la } from "../chunks/schema";
|
|
2
|
+
import { n as ua, a as Ea } from "../chunks/create";
|
|
3
|
+
import { f as fa } from "../chunks/formParse";
|
|
3
4
|
export {
|
|
4
5
|
r as absoluteUrlErrorSchema,
|
|
5
6
|
s as completeMultipartUploadCalledTooSoonSchema,
|
|
6
7
|
i as containsFragmentErrorSchema,
|
|
7
8
|
o as containsPathErrorSchema,
|
|
8
9
|
m as containsQueryErrorSchema,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
c as emptyRequestBodySchema,
|
|
11
|
+
n as errorSchema,
|
|
12
|
+
d as fieldInvalidSchema,
|
|
13
|
+
h as fieldLengthErrorSchema,
|
|
14
|
+
t as fieldMissingErrorSchema,
|
|
15
|
+
l as fieldOverflowErrorSchema,
|
|
16
|
+
S as fieldUnderflowErrorSchema,
|
|
16
17
|
u as fieldUnknownValidationErrorSchema,
|
|
17
|
-
|
|
18
|
+
fa as flattenFieldNodes,
|
|
18
19
|
E as formFieldDiscriminatedUnionSchema,
|
|
19
20
|
p as formFieldInvalidDiscriminatedUnion,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
f as formValidationFailedSchema,
|
|
22
|
+
v as hashMismatchSchema,
|
|
22
23
|
g as internalServerErrorSchema,
|
|
23
24
|
F as invalidActorSchema,
|
|
24
25
|
U as invalidApiKeySchema,
|
|
25
26
|
N as invalidAuthHeaderValueSchema,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
x as invalidCursorValueSchema,
|
|
28
|
+
y as invalidEmailErrorSchema,
|
|
29
|
+
w as invalidEnumValueErrorSchema,
|
|
30
|
+
I as invalidIDSchema,
|
|
31
|
+
M as invalidMultipartNumberSchema,
|
|
32
|
+
V as invalidRequestBodySchema,
|
|
33
|
+
b as invalidResponseShapeSchema,
|
|
33
34
|
D as invalidSignedUrlSchema,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
A as invalidUrlErrorSchema,
|
|
36
|
+
B as invalidValueErrorSchema,
|
|
37
|
+
L as jwtNotAcceptableSchema,
|
|
38
|
+
O as limitExceededSchema,
|
|
37
39
|
R as malformedJSONFromServerSchema,
|
|
38
40
|
q as malformedResponseBodySchema,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
T as mediaItemsLimitExceededSchema,
|
|
42
|
+
k as mediaObjectNotFoundSchema,
|
|
41
43
|
P as mediaTooLargeSchema,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
j as methodNotAllowedSchema,
|
|
45
|
+
z as missingETagValueSchema,
|
|
46
|
+
C as missingHostErrorSchema,
|
|
47
|
+
H as missingMxRecordsErrorSchema,
|
|
48
|
+
J as missingPermissionSchema,
|
|
49
|
+
K as multipartPartUploadFailedSchema,
|
|
50
|
+
ua as newMediaItemsLimitExceedError,
|
|
51
|
+
Ea as newMediaTooLargeError,
|
|
52
|
+
Q as nilIDErrorSchema,
|
|
53
|
+
G as notBase64UrlEncodedErrorSchema,
|
|
54
|
+
W as notDigitErrorSchema,
|
|
55
|
+
X as nullValueErrorSchema,
|
|
56
|
+
Y as organizationStatusBadSchema,
|
|
57
|
+
Z as permissionExplicitlyDeniedSchema,
|
|
58
|
+
_ as requestBodyTooLargeSchema,
|
|
59
|
+
$ as requireHttpsErrorSchema,
|
|
60
|
+
aa as routeNotFoundSchema,
|
|
61
|
+
ea as selfPermissionMismatchSchema,
|
|
62
|
+
ra as singlepartUploadFailedSchema,
|
|
63
|
+
sa as tokenNotFoundSchema,
|
|
64
|
+
ia as unknownFieldInRequestBodySchema,
|
|
65
|
+
oa as unknownServerErrorSchema,
|
|
66
|
+
ma as unsupportedAuthSchemeSchema,
|
|
67
|
+
ca as unsupportedObjectUploadedSchema,
|
|
64
68
|
na as uploadAlreadyCompletedSchema,
|
|
65
|
-
|
|
69
|
+
da as userDisabledSchema,
|
|
66
70
|
ha as userNotExistInOrganizationSchema,
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
ta as userNotExistsInOrganizationManagementSchema,
|
|
72
|
+
la as userNotFoundSchema
|
|
69
73
|
};
|
|
70
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -7,7 +7,7 @@ export declare const mediaObjectNotFoundSchema: z.ZodObject<{
|
|
|
7
7
|
}, z.core.$strip>;
|
|
8
8
|
export declare const mediaTooLargeSchema: z.ZodObject<{
|
|
9
9
|
code: z.ZodLiteral<"media-too-large">;
|
|
10
|
-
mediaID: z.
|
|
10
|
+
mediaID: z.ZodString;
|
|
11
11
|
currentSize: z.ZodInt;
|
|
12
12
|
maxSupportedSize: z.ZodInt;
|
|
13
13
|
}, z.core.$strip>;
|
|
@@ -48,13 +48,18 @@ export declare const errorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
48
48
|
}, z.core.$strip>, z.ZodObject<{
|
|
49
49
|
code: z.ZodLiteral<"missing-permission">;
|
|
50
50
|
missingPermission: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
code: z.ZodLiteral<string>;
|
|
53
|
+
action: z.ZodString;
|
|
54
|
+
limit: z.ZodBigIntFormat;
|
|
55
|
+
currentValue: z.ZodBigIntFormat;
|
|
51
56
|
}, z.core.$strip>, z.ZodObject<{
|
|
52
57
|
code: z.ZodLiteral<"invalid-multipart-upload-part-number">;
|
|
53
58
|
}, z.core.$strip>, z.ZodObject<{
|
|
54
59
|
code: z.ZodLiteral<"object-not-found">;
|
|
55
60
|
}, z.core.$strip>, z.ZodObject<{
|
|
56
61
|
code: z.ZodLiteral<"media-too-large">;
|
|
57
|
-
mediaID: z.
|
|
62
|
+
mediaID: z.ZodString;
|
|
58
63
|
currentSize: z.ZodInt;
|
|
59
64
|
maxSupportedSize: z.ZodInt;
|
|
60
65
|
}, z.core.$strip>, z.ZodObject<{
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { A as a, B as p } from "../chunks/
|
|
2
|
-
import {
|
|
1
|
+
import { A as a, B as p } from "../chunks/schema";
|
|
2
|
+
import { n as e, p as E } from "../chunks/parse";
|
|
3
3
|
export {
|
|
4
4
|
a as ApplicationError,
|
|
5
5
|
p as BaseError,
|
|
6
|
-
e as
|
|
6
|
+
e as normalizeError,
|
|
7
|
+
E as parseError
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ParseErrorResponse } from './parse';
|
|
2
|
+
export type ErrorNormalization = {
|
|
3
|
+
code: string;
|
|
4
|
+
items: readonly string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const normalizeError: (parsedResponse: ParseErrorResponse | {
|
|
7
|
+
code: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}, customOverrides?: readonly ErrorNormalization[]) => ParseErrorResponse | {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
code: string;
|
|
12
|
+
};
|
package/dist/errors/parse.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as z } from 'zod';
|
|
2
2
|
import { commonCodes } from '../errorCodes';
|
|
3
3
|
import { ErrorDetails } from '../errorSchema';
|
|
4
|
-
type ParseErrorResponse = {
|
|
4
|
+
export type ParseErrorResponse = {
|
|
5
5
|
code: typeof commonCodes.networkError;
|
|
6
6
|
debugMessage: string;
|
|
7
7
|
} | {
|
|
@@ -12,4 +12,3 @@ type ParseErrorResponse = {
|
|
|
12
12
|
error: z.ZodError;
|
|
13
13
|
} | ErrorDetails;
|
|
14
14
|
export declare function parseError(err: unknown): ParseErrorResponse;
|
|
15
|
-
export {};
|