@eleva-io/erp-sdk 0.1.148 → 0.1.149
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/cjs/errors/catalog.d.ts +28 -3
- package/dist/cjs/errors/catalog.d.ts.map +1 -1
- package/dist/cjs/errors/catalog.js +2 -0
- package/dist/cjs/errors/catalog.js.map +1 -1
- package/dist/cjs/errors/catalog_api.d.ts +15 -2
- package/dist/cjs/errors/catalog_api.d.ts.map +1 -1
- package/dist/cjs/errors/catalog_api.js +10 -1
- package/dist/cjs/errors/catalog_api.js.map +1 -1
- package/dist/cjs/errors/catalog_base.d.ts +42 -2
- package/dist/cjs/errors/catalog_base.d.ts.map +1 -1
- package/dist/cjs/errors/catalog_base.js +37 -0
- package/dist/cjs/errors/catalog_base.js.map +1 -1
- package/dist/cjs/errors/catalog_types.d.ts +24 -0
- package/dist/cjs/errors/catalog_types.d.ts.map +1 -1
- package/dist/cjs/errors/catalog_types.js +6 -0
- package/dist/cjs/errors/catalog_types.js.map +1 -1
- package/dist/cjs/errors/errors.d.ts +139 -33
- package/dist/cjs/errors/errors.d.ts.map +1 -1
- package/dist/cjs/errors/errors.js +121 -74
- package/dist/cjs/errors/errors.js.map +1 -1
- package/dist/cjs/errors/errors_remote.d.ts +58 -20
- package/dist/cjs/errors/errors_remote.d.ts.map +1 -1
- package/dist/cjs/errors/errors_remote.js +22 -0
- package/dist/cjs/errors/errors_remote.js.map +1 -1
- package/dist/cjs/errors/errors_remote.spec.js +49 -9
- package/dist/cjs/errors/errors_remote.spec.js.map +1 -1
- package/dist/cjs/errors/index.d.ts +19 -0
- package/dist/cjs/errors/index.d.ts.map +1 -1
- package/dist/cjs/errors/index.js +19 -0
- package/dist/cjs/errors/index.js.map +1 -1
- package/dist/cjs/utils/errors.d.ts.map +1 -1
- package/dist/cjs/utils/errors.js +3 -1
- package/dist/cjs/utils/errors.js.map +1 -1
- package/dist/cjs/utils/http.js +10 -10
- package/dist/cjs/utils/http.js.map +1 -1
- package/dist/esm/errors/catalog.d.ts +28 -3
- package/dist/esm/errors/catalog.d.ts.map +1 -1
- package/dist/esm/errors/catalog.js +2 -0
- package/dist/esm/errors/catalog.js.map +1 -1
- package/dist/esm/errors/catalog_api.d.ts +15 -2
- package/dist/esm/errors/catalog_api.d.ts.map +1 -1
- package/dist/esm/errors/catalog_api.js +10 -1
- package/dist/esm/errors/catalog_api.js.map +1 -1
- package/dist/esm/errors/catalog_base.d.ts +42 -2
- package/dist/esm/errors/catalog_base.d.ts.map +1 -1
- package/dist/esm/errors/catalog_base.js +37 -0
- package/dist/esm/errors/catalog_base.js.map +1 -1
- package/dist/esm/errors/catalog_types.d.ts +24 -0
- package/dist/esm/errors/catalog_types.d.ts.map +1 -1
- package/dist/esm/errors/catalog_types.js +6 -0
- package/dist/esm/errors/catalog_types.js.map +1 -1
- package/dist/esm/errors/errors.d.ts +139 -33
- package/dist/esm/errors/errors.d.ts.map +1 -1
- package/dist/esm/errors/errors.js +121 -74
- package/dist/esm/errors/errors.js.map +1 -1
- package/dist/esm/errors/errors_remote.d.ts +58 -20
- package/dist/esm/errors/errors_remote.d.ts.map +1 -1
- package/dist/esm/errors/errors_remote.js +22 -0
- package/dist/esm/errors/errors_remote.js.map +1 -1
- package/dist/esm/errors/errors_remote.spec.js +49 -9
- package/dist/esm/errors/errors_remote.spec.js.map +1 -1
- package/dist/esm/errors/index.d.ts +19 -0
- package/dist/esm/errors/index.d.ts.map +1 -1
- package/dist/esm/errors/index.js +19 -0
- package/dist/esm/errors/index.js.map +1 -1
- package/dist/esm/utils/errors.d.ts.map +1 -1
- package/dist/esm/utils/errors.js +3 -1
- package/dist/esm/utils/errors.js.map +1 -1
- package/dist/esm/utils/http.js +10 -10
- package/dist/esm/utils/http.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ErrorKind } from './catalog_types';
|
|
2
|
+
import { CatalogDetails, ErrorKind } from './catalog_types';
|
|
3
|
+
/**
|
|
4
|
+
* Generic HTTP-level error codes shared across all API domains.
|
|
5
|
+
* Domain-specific codes live in `catalog_api.ts`.
|
|
6
|
+
*/
|
|
3
7
|
export declare enum BASE_ERROR_CODES {
|
|
8
|
+
/** Input data failed schema or business-rule validation. */
|
|
4
9
|
VALIDATION = "VALIDATION",
|
|
10
|
+
/** The request is malformed or contains invalid parameters. */
|
|
5
11
|
BAD_REQUEST = "BAD_REQUEST",
|
|
12
|
+
/** Credentials are missing, expired, or invalid. */
|
|
6
13
|
AUTHENTICATION = "AUTHENTICATION",
|
|
14
|
+
/** Authenticated but lacks the required permissions. */
|
|
7
15
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
16
|
+
/** The requested resource does not exist. */
|
|
8
17
|
NOT_FOUND = "NOT_FOUND",
|
|
18
|
+
/** Server cannot produce a response matching the `Accept` header. */
|
|
9
19
|
NOT_ACCEPTABLE = "NOT_ACCEPTABLE",
|
|
20
|
+
/** Operation would violate a uniqueness or integrity constraint. */
|
|
10
21
|
CONFLICT = "CONFLICT",
|
|
22
|
+
/** Resource existed but has been permanently removed (unlike 404, retrying is futile). */
|
|
11
23
|
GONE = "GONE",
|
|
24
|
+
/** Request is syntactically valid but semantically unprocessable (e.g. invalid state transition). */
|
|
12
25
|
UNPROCESSABLE_ENTITY = "UNPROCESSABLE_ENTITY",
|
|
26
|
+
/** A required field was omitted from the request. */
|
|
13
27
|
MANDATORY_FIELD = "MANDATORY_FIELD",
|
|
28
|
+
/** Unexpected server-side error (`SYSTEM` — message sanitised before being sent to clients). */
|
|
14
29
|
INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
|
|
30
|
+
/** Upstream gateway received an invalid response from the origin server (`SYSTEM`). */
|
|
31
|
+
BAD_GATEWAY = "BAD_GATEWAY",
|
|
32
|
+
/** Service is temporarily unavailable (`SYSTEM`). */
|
|
15
33
|
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE"
|
|
16
34
|
}
|
|
35
|
+
/** Maps every `BASE_ERROR_CODES` member to its HTTP status, kind, default message, and details schema. */
|
|
17
36
|
export declare const BASE_ERRORS_CATALOG: {
|
|
18
37
|
VALIDATION: {
|
|
19
38
|
kind: ErrorKind.DOMAIN;
|
|
20
39
|
status: number;
|
|
21
40
|
details: z.ZodObject<{
|
|
22
41
|
errors: z.ZodArray<z.ZodObject<{
|
|
42
|
+
/** Dot-separated field path (e.g. `"address.zipCode"`) or `"root"` for top-level issues. */
|
|
23
43
|
validation: z.ZodString;
|
|
44
|
+
/** Zod issue code (e.g. `"invalid_type"`, `"too_small"`). */
|
|
24
45
|
code: z.ZodString;
|
|
25
46
|
message: z.ZodString;
|
|
26
47
|
path: z.ZodArray<z.ZodString, "many">;
|
|
@@ -118,6 +139,7 @@ export declare const BASE_ERRORS_CATALOG: {
|
|
|
118
139
|
}>;
|
|
119
140
|
message: string;
|
|
120
141
|
};
|
|
142
|
+
/** Each item in the array identifies one conflicting field. */
|
|
121
143
|
CONFLICT: {
|
|
122
144
|
kind: ErrorKind.DOMAIN;
|
|
123
145
|
status: number;
|
|
@@ -187,6 +209,18 @@ export declare const BASE_ERRORS_CATALOG: {
|
|
|
187
209
|
}>;
|
|
188
210
|
message: string;
|
|
189
211
|
};
|
|
212
|
+
BAD_GATEWAY: {
|
|
213
|
+
kind: ErrorKind.SYSTEM;
|
|
214
|
+
status: number;
|
|
215
|
+
details: z.ZodObject<{
|
|
216
|
+
upstream: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
upstream?: string | undefined;
|
|
219
|
+
}, {
|
|
220
|
+
upstream?: string | undefined;
|
|
221
|
+
}>;
|
|
222
|
+
message: string;
|
|
223
|
+
};
|
|
190
224
|
SERVICE_UNAVAILABLE: {
|
|
191
225
|
kind: ErrorKind.SYSTEM;
|
|
192
226
|
status: number;
|
|
@@ -200,5 +234,11 @@ export declare const BASE_ERRORS_CATALOG: {
|
|
|
200
234
|
message: string;
|
|
201
235
|
};
|
|
202
236
|
};
|
|
203
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Strongly-typed `details` shape for a given `BASE_ERROR_CODES` member.
|
|
239
|
+
* @example
|
|
240
|
+
* type ConflictDetails = BaseErrorDetails<BASE_ERROR_CODES.CONFLICT>
|
|
241
|
+
* // → Array<{ key: string; value: string; cause: string }>
|
|
242
|
+
*/
|
|
243
|
+
export type BaseErrorDetails<C extends BASE_ERROR_CODES> = CatalogDetails<C, typeof BASE_ERRORS_CATALOG>;
|
|
204
244
|
//# sourceMappingURL=catalog_base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog_base.d.ts","sourceRoot":"","sources":["../../../src/errors/catalog_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAqB,SAAS,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"catalog_base.d.ts","sourceRoot":"","sources":["../../../src/errors/catalog_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,cAAc,EAAqB,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE9E;;;GAGG;AACH,oBAAY,gBAAgB;IAE1B,4DAA4D;IAC5D,UAAU,eAAe;IACzB,+DAA+D;IAC/D,WAAW,gBAAgB;IAC3B,oDAAoD;IACpD,cAAc,mBAAmB;IACjC,wDAAwD;IACxD,YAAY,iBAAiB;IAC7B,6CAA6C;IAC7C,SAAS,cAAc;IACvB,qEAAqE;IACrE,cAAc,mBAAmB;IACjC,oEAAoE;IACpE,QAAQ,aAAa;IACrB,0FAA0F;IAC1F,IAAI,SAAS;IACb,qGAAqG;IACrG,oBAAoB,yBAAyB;IAC7C,qDAAqD;IACrD,eAAe,oBAAoB;IAGnC,gGAAgG;IAChG,qBAAqB,0BAA0B;IAC/C,uFAAuF;IACvF,WAAW,gBAAgB;IAC3B,qDAAqD;IACrD,mBAAmB,wBAAwB;CAC5C;AAED,0GAA0G;AAC1G,eAAO,MAAM,mBAAmB;;;;;;gBAStB,4FAA4F;;gBAE5F,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqErE,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFV,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,IAAI,cAAc,CAAC,CAAC,EAAE,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ErrorKind } from './catalog_types';
|
|
3
|
+
/**
|
|
4
|
+
* Generic HTTP-level error codes shared across all API domains.
|
|
5
|
+
* Domain-specific codes live in `catalog_api.ts`.
|
|
6
|
+
*/
|
|
3
7
|
export var BASE_ERROR_CODES;
|
|
4
8
|
(function (BASE_ERROR_CODES) {
|
|
5
9
|
// >= 400
|
|
10
|
+
/** Input data failed schema or business-rule validation. */
|
|
6
11
|
BASE_ERROR_CODES["VALIDATION"] = "VALIDATION";
|
|
12
|
+
/** The request is malformed or contains invalid parameters. */
|
|
7
13
|
BASE_ERROR_CODES["BAD_REQUEST"] = "BAD_REQUEST";
|
|
14
|
+
/** Credentials are missing, expired, or invalid. */
|
|
8
15
|
BASE_ERROR_CODES["AUTHENTICATION"] = "AUTHENTICATION";
|
|
16
|
+
/** Authenticated but lacks the required permissions. */
|
|
9
17
|
BASE_ERROR_CODES["UNAUTHORIZED"] = "UNAUTHORIZED";
|
|
18
|
+
/** The requested resource does not exist. */
|
|
10
19
|
BASE_ERROR_CODES["NOT_FOUND"] = "NOT_FOUND";
|
|
20
|
+
/** Server cannot produce a response matching the `Accept` header. */
|
|
11
21
|
BASE_ERROR_CODES["NOT_ACCEPTABLE"] = "NOT_ACCEPTABLE";
|
|
22
|
+
/** Operation would violate a uniqueness or integrity constraint. */
|
|
12
23
|
BASE_ERROR_CODES["CONFLICT"] = "CONFLICT";
|
|
24
|
+
/** Resource existed but has been permanently removed (unlike 404, retrying is futile). */
|
|
13
25
|
BASE_ERROR_CODES["GONE"] = "GONE";
|
|
26
|
+
/** Request is syntactically valid but semantically unprocessable (e.g. invalid state transition). */
|
|
14
27
|
BASE_ERROR_CODES["UNPROCESSABLE_ENTITY"] = "UNPROCESSABLE_ENTITY";
|
|
28
|
+
/** A required field was omitted from the request. */
|
|
15
29
|
BASE_ERROR_CODES["MANDATORY_FIELD"] = "MANDATORY_FIELD";
|
|
16
30
|
// >= 500
|
|
31
|
+
/** Unexpected server-side error (`SYSTEM` — message sanitised before being sent to clients). */
|
|
17
32
|
BASE_ERROR_CODES["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
|
|
33
|
+
/** Upstream gateway received an invalid response from the origin server (`SYSTEM`). */
|
|
34
|
+
BASE_ERROR_CODES["BAD_GATEWAY"] = "BAD_GATEWAY";
|
|
35
|
+
/** Service is temporarily unavailable (`SYSTEM`). */
|
|
18
36
|
BASE_ERROR_CODES["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
19
37
|
})(BASE_ERROR_CODES || (BASE_ERROR_CODES = {}));
|
|
38
|
+
/** Maps every `BASE_ERROR_CODES` member to its HTTP status, kind, default message, and details schema. */
|
|
20
39
|
export const BASE_ERRORS_CATALOG = {
|
|
21
40
|
// >= 400
|
|
22
41
|
[BASE_ERROR_CODES.VALIDATION]: {
|
|
@@ -25,7 +44,9 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
25
44
|
details: z.object({
|
|
26
45
|
errors: z
|
|
27
46
|
.object({
|
|
47
|
+
/** Dot-separated field path (e.g. `"address.zipCode"`) or `"root"` for top-level issues. */
|
|
28
48
|
validation: z.string(),
|
|
49
|
+
/** Zod issue code (e.g. `"invalid_type"`, `"too_small"`). */
|
|
29
50
|
code: z.string(),
|
|
30
51
|
message: z.string(),
|
|
31
52
|
path: z.array(z.string()),
|
|
@@ -50,6 +71,7 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
50
71
|
status: 401,
|
|
51
72
|
details: z
|
|
52
73
|
.object({
|
|
74
|
+
/** Why authentication failed (e.g. `"token_expired"`). */
|
|
53
75
|
reason: z.string(),
|
|
54
76
|
})
|
|
55
77
|
.partial(),
|
|
@@ -71,6 +93,7 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
71
93
|
status: 404,
|
|
72
94
|
details: z
|
|
73
95
|
.object({
|
|
96
|
+
/** Entity type that was not found (e.g. `"Invoice"`). */
|
|
74
97
|
entity: z.string(),
|
|
75
98
|
})
|
|
76
99
|
.partial(),
|
|
@@ -86,6 +109,7 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
86
109
|
.partial(),
|
|
87
110
|
message: 'Not acceptable',
|
|
88
111
|
},
|
|
112
|
+
/** Each item in the array identifies one conflicting field. */
|
|
89
113
|
[BASE_ERROR_CODES.CONFLICT]: {
|
|
90
114
|
kind: ErrorKind.DOMAIN,
|
|
91
115
|
status: 409,
|
|
@@ -103,6 +127,7 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
103
127
|
status: 410,
|
|
104
128
|
details: z
|
|
105
129
|
.object({
|
|
130
|
+
/** ISO 8601 timestamp of when the resource was removed. */
|
|
106
131
|
since: z.string(),
|
|
107
132
|
})
|
|
108
133
|
.partial(),
|
|
@@ -136,11 +161,23 @@ export const BASE_ERRORS_CATALOG = {
|
|
|
136
161
|
.partial(),
|
|
137
162
|
message: 'Internal server error',
|
|
138
163
|
},
|
|
164
|
+
[BASE_ERROR_CODES.BAD_GATEWAY]: {
|
|
165
|
+
kind: ErrorKind.SYSTEM,
|
|
166
|
+
status: 502,
|
|
167
|
+
details: z
|
|
168
|
+
.object({
|
|
169
|
+
/** Name of the upstream service that returned the invalid response. */
|
|
170
|
+
upstream: z.string(),
|
|
171
|
+
})
|
|
172
|
+
.partial(),
|
|
173
|
+
message: 'Bad gateway',
|
|
174
|
+
},
|
|
139
175
|
[BASE_ERROR_CODES.SERVICE_UNAVAILABLE]: {
|
|
140
176
|
kind: ErrorKind.SYSTEM,
|
|
141
177
|
status: 503,
|
|
142
178
|
details: z
|
|
143
179
|
.object({
|
|
180
|
+
/** Seconds the client should wait before retrying. */
|
|
144
181
|
retryAfter: z.number(),
|
|
145
182
|
})
|
|
146
183
|
.partial(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog_base.js","sourceRoot":"","sources":["../../../src/errors/catalog_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,
|
|
1
|
+
{"version":3,"file":"catalog_base.js","sourceRoot":"","sources":["../../../src/errors/catalog_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAqC,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE9E;;;GAGG;AACH,MAAM,CAAN,IAAY,gBA8BX;AA9BD,WAAY,gBAAgB;IAC1B,SAAS;IACT,4DAA4D;IAC5D,6CAAyB,CAAA;IACzB,+DAA+D;IAC/D,+CAA2B,CAAA;IAC3B,oDAAoD;IACpD,qDAAiC,CAAA;IACjC,wDAAwD;IACxD,iDAA6B,CAAA;IAC7B,6CAA6C;IAC7C,2CAAuB,CAAA;IACvB,qEAAqE;IACrE,qDAAiC,CAAA;IACjC,oEAAoE;IACpE,yCAAqB,CAAA;IACrB,0FAA0F;IAC1F,iCAAa,CAAA;IACb,qGAAqG;IACrG,iEAA6C,CAAA;IAC7C,qDAAqD;IACrD,uDAAmC,CAAA;IAEnC,SAAS;IACT,gGA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E;QACZ,OAAO,EAAE,aAAa;KACvB;IAED,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE;QACtC,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,CAAC;aACP,MAAM,CAAC;YACN,sDAAsD;YACtD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;SACvB,CAAC;aACD,OAAO,EAAE;QACZ,OAAO,EAAE,qBAAqB;KAC/B;CACoD,CAAA"}
|
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Classifies an error by origin and visibility.
|
|
4
|
+
*
|
|
5
|
+
* - `DOMAIN` – predictable business-logic error; details are safe to expose to the client.
|
|
6
|
+
* - `SYSTEM` – unexpected infrastructure error; message is sanitised before being sent.
|
|
7
|
+
*/
|
|
2
8
|
export declare enum ErrorKind {
|
|
3
9
|
SYSTEM = "system",
|
|
4
10
|
DOMAIN = "domain"
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Source-of-truth definition for a single error code.
|
|
14
|
+
*
|
|
15
|
+
* - `kind` – domain (safe to expose) or system (sanitised).
|
|
16
|
+
* - `status` – HTTP status code.
|
|
17
|
+
* - `details` – Zod schema for both runtime validation and TypeScript type inference.
|
|
18
|
+
* - `message` – Default human-readable description.
|
|
19
|
+
*/
|
|
6
20
|
export type ErrorCatalogEntry = {
|
|
7
21
|
kind: ErrorKind;
|
|
8
22
|
status: number;
|
|
9
23
|
details: z.ZodTypeAny;
|
|
10
24
|
message: string;
|
|
11
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Infers the `details` payload type for code `C` by indexing the catalog object `Cat`.
|
|
28
|
+
* Keeps per-catalog `*ErrorDetails` aliases to a single line.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* export type MyDetails<C extends MY_CODES> = CatalogDetails<C, typeof MY_CATALOG>
|
|
32
|
+
*/
|
|
33
|
+
export type CatalogDetails<C extends string, Cat extends Record<string, {
|
|
34
|
+
details: z.ZodTypeAny;
|
|
35
|
+
}>> = C extends keyof Cat ? z.infer<Cat[C]['details']> : never;
|
|
12
36
|
//# sourceMappingURL=catalog_types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog_types.d.ts","sourceRoot":"","sources":["../../../src/errors/catalog_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,CAAC,UAAU,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
1
|
+
{"version":3,"file":"catalog_types.d.ts","sourceRoot":"","sources":["../../../src/errors/catalog_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;GAKG;AACH,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,CAAC,UAAU,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS,MAAM,EAChB,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,CAAC,CAAC,UAAU,CAAA;CAAE,CAAC,IACnD,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAA"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifies an error by origin and visibility.
|
|
3
|
+
*
|
|
4
|
+
* - `DOMAIN` – predictable business-logic error; details are safe to expose to the client.
|
|
5
|
+
* - `SYSTEM` – unexpected infrastructure error; message is sanitised before being sent.
|
|
6
|
+
*/
|
|
1
7
|
export var ErrorKind;
|
|
2
8
|
(function (ErrorKind) {
|
|
3
9
|
ErrorKind["SYSTEM"] = "system";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog_types.js","sourceRoot":"","sources":["../../../src/errors/catalog_types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
|
|
1
|
+
{"version":3,"file":"catalog_types.js","sourceRoot":"","sources":["../../../src/errors/catalog_types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB"}
|
|
@@ -3,6 +3,7 @@ import { ErrorCode, type ErrorDetails } from './catalog';
|
|
|
3
3
|
import { ErrorKind } from './catalog_types';
|
|
4
4
|
import { BASE_ERROR_CODES } from './catalog_base';
|
|
5
5
|
import { API_ERROR_CODES } from './catalog_api';
|
|
6
|
+
/** Plain-object representation of an `ElevaError`, suitable for serialisation. */
|
|
6
7
|
export interface ElevaErrorJSON<C extends ErrorCode = ErrorCode> {
|
|
7
8
|
code: C | string;
|
|
8
9
|
kind: ErrorKind;
|
|
@@ -10,83 +11,188 @@ export interface ElevaErrorJSON<C extends ErrorCode = ErrorCode> {
|
|
|
10
11
|
message: string;
|
|
11
12
|
details: ErrorDetails<C>;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Slim response payload for API consumers.
|
|
16
|
+
* `SYSTEM` errors omit `details`; `DOMAIN` errors include it.
|
|
17
|
+
*/
|
|
13
18
|
export interface ElevaErrorResponse<C extends ErrorCode = ErrorCode> {
|
|
14
19
|
code: ElevaErrorJSON<C>['code'];
|
|
15
20
|
message: ElevaErrorJSON<C>['message'];
|
|
16
21
|
details?: ElevaErrorJSON<C>['details'];
|
|
17
22
|
}
|
|
23
|
+
/** Constructor arguments for `ElevaError`. Adds optional `cause` for error chaining. */
|
|
18
24
|
export type ElevaErrorArgs<C extends ErrorCode> = ElevaErrorJSON<C> & {
|
|
25
|
+
/** The original error forwarded to `Error.cause`. */
|
|
19
26
|
cause?: unknown;
|
|
20
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Central error class for the Eleva ERP SDK.
|
|
30
|
+
*
|
|
31
|
+
* Extends `Error` with structured metadata: `code`, `kind`, `status`, and typed `details`.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Create
|
|
35
|
+
* throw ElevaError.notFound({ entity: 'Invoice' })
|
|
36
|
+
* throw ElevaError.conflict({ details: [{ key: 'email', value: 'a@b.com', cause: 'duplicate' }] })
|
|
37
|
+
*
|
|
38
|
+
* // Narrow
|
|
39
|
+
* if (err instanceof ElevaError && err.is(ERROR_CODES.NOT_FOUND)) {
|
|
40
|
+
* console.log(err.details.entity) // string
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Serialisation: `toJSON()` for logging, `toResponse()` for sanitised API output.
|
|
45
|
+
*/
|
|
21
46
|
export declare class ElevaError<C extends ErrorCode = ErrorCode> extends Error {
|
|
47
|
+
/** Error code constant identifying the failure condition. */
|
|
22
48
|
readonly code: C | string;
|
|
49
|
+
/** `DOMAIN` (safe to expose) or `SYSTEM` (sanitised before sending to clients). */
|
|
23
50
|
readonly kind: ErrorKind;
|
|
51
|
+
/** HTTP status code for this error. */
|
|
24
52
|
readonly status: number;
|
|
53
|
+
/** Structured, code-specific failure context. */
|
|
25
54
|
readonly details: ErrorDetails<C>;
|
|
26
55
|
constructor(args: ElevaErrorArgs<C>);
|
|
56
|
+
/**
|
|
57
|
+
* Type-guard: narrows to `ElevaError<K>` when `this.code === code`.
|
|
58
|
+
* After a positive check `this.details` is fully typed for `K`.
|
|
59
|
+
* @example
|
|
60
|
+
* if (err.is(ERROR_CODES.NOT_FOUND)) console.log(err.details.entity)
|
|
61
|
+
*/
|
|
27
62
|
is<K extends ErrorCode>(code: K | string): this is ElevaError<K>;
|
|
63
|
+
/** Full serialised representation for logging / diagnostics. */
|
|
28
64
|
toJSON(): ElevaErrorJSON<C>;
|
|
29
65
|
toString(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Sanitised payload safe for API responses.
|
|
68
|
+
* `SYSTEM` errors replace the message with a generic string; `DOMAIN` errors include `details`.
|
|
69
|
+
*/
|
|
30
70
|
toResponse(): ElevaErrorResponse<C>;
|
|
71
|
+
/**
|
|
72
|
+
* Parses an unknown value into `ElevaErrorArgs`. Shared by `parse()` and `RemoteElevaError.from()`.
|
|
73
|
+
*
|
|
74
|
+
* Strategy: validate against `errorSchema` → look up known codes in the catalog →
|
|
75
|
+
* fall back to `INTERNAL_SERVER_ERROR` for unrecognised codes or malformed payloads →
|
|
76
|
+
* accept legacy `errors` field as a fallback for `details`.
|
|
77
|
+
*/
|
|
31
78
|
protected static _parsePayload(value: unknown): ElevaErrorArgs<ErrorCode>;
|
|
79
|
+
/** Deserialises an unknown value into an `ElevaError`. Unrecognised payloads become `INTERNAL_SERVER_ERROR`. */
|
|
32
80
|
static parse(value: unknown): ElevaError<ErrorCode>;
|
|
81
|
+
/** Converts a `ZodError` into a `VALIDATION` error, preserving field paths and rule codes. */
|
|
33
82
|
static fromZodError<T>(error: z.ZodError<T>): ElevaError<BASE_ERROR_CODES.VALIDATION>;
|
|
83
|
+
/** Creates a `VALIDATION` error from a pre-built array of issue descriptors. */
|
|
34
84
|
static validation(args: {
|
|
35
85
|
errors: ErrorDetails<BASE_ERROR_CODES.VALIDATION>['errors'];
|
|
36
86
|
message?: string;
|
|
37
87
|
}): ElevaError<BASE_ERROR_CODES.VALIDATION>;
|
|
88
|
+
/** Creates a `VALIDATION` error for a single invalid field. Convenience wrapper around `validation()`. */
|
|
38
89
|
static invalidField(args: {
|
|
39
90
|
error: ErrorDetails<BASE_ERROR_CODES.VALIDATION>['errors'][number];
|
|
40
91
|
message?: string;
|
|
41
92
|
}): ElevaError<BASE_ERROR_CODES.VALIDATION>;
|
|
42
|
-
|
|
93
|
+
/** HTTP 400 — request is malformed or has invalid parameters outside of validation. */
|
|
94
|
+
static readonly badRequest: (args?: {
|
|
43
95
|
message?: string;
|
|
44
|
-
details?:
|
|
45
|
-
|
|
46
|
-
|
|
96
|
+
details?: {
|
|
97
|
+
field?: string | undefined;
|
|
98
|
+
reason?: string | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.BAD_REQUEST>;
|
|
101
|
+
/** HTTP 401 — credentials are missing, expired, or invalid. Caller must re-authenticate. */
|
|
102
|
+
static readonly authentication: (args?: {
|
|
47
103
|
message?: string;
|
|
48
|
-
details?:
|
|
49
|
-
|
|
50
|
-
|
|
104
|
+
details?: {
|
|
105
|
+
reason?: string | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.AUTHENTICATION>;
|
|
108
|
+
/** HTTP 403 — authenticated but lacks the required scope or permission. */
|
|
109
|
+
static readonly unauthorized: (args?: {
|
|
51
110
|
message?: string;
|
|
52
|
-
details?:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
111
|
+
details?: {
|
|
112
|
+
requiredScope?: string | undefined;
|
|
113
|
+
resource?: string | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.UNAUTHORIZED>;
|
|
116
|
+
/**
|
|
117
|
+
* HTTP 404 — no resource found for the given identifier.
|
|
118
|
+
* @param args.entity - Entity type that was not found (e.g. `"Invoice"`).
|
|
119
|
+
*/
|
|
120
|
+
static readonly notFound: (args: Record<"entity", string> & {
|
|
56
121
|
message?: string;
|
|
57
|
-
})
|
|
58
|
-
|
|
122
|
+
}) => ElevaError<BASE_ERROR_CODES.NOT_FOUND>;
|
|
123
|
+
/** HTTP 406 — server cannot produce a response matching the `Accept` header. */
|
|
124
|
+
static readonly notAcceptable: (args?: {
|
|
59
125
|
message?: string;
|
|
60
|
-
details?:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
126
|
+
details?: {
|
|
127
|
+
acceptedTypes?: string[] | undefined;
|
|
128
|
+
} | undefined;
|
|
129
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.NOT_ACCEPTABLE>;
|
|
130
|
+
/** HTTP 409 — operation violates a uniqueness or integrity constraint. */
|
|
131
|
+
static readonly conflict: (args: {
|
|
132
|
+
details: {
|
|
133
|
+
value: string;
|
|
134
|
+
key: string;
|
|
135
|
+
cause: string;
|
|
136
|
+
}[];
|
|
64
137
|
message?: string;
|
|
65
|
-
})
|
|
66
|
-
|
|
138
|
+
}) => ElevaError<BASE_ERROR_CODES.CONFLICT>;
|
|
139
|
+
/** HTTP 410 — resource permanently removed; retrying will never succeed. */
|
|
140
|
+
static readonly gone: (args?: {
|
|
67
141
|
message?: string;
|
|
68
|
-
details?:
|
|
69
|
-
|
|
70
|
-
|
|
142
|
+
details?: {
|
|
143
|
+
since?: string | undefined;
|
|
144
|
+
} | undefined;
|
|
145
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.GONE>;
|
|
146
|
+
/** HTTP 422 — request is syntactically valid but semantically unprocessable. */
|
|
147
|
+
static readonly unprocessableEntity: (args?: {
|
|
71
148
|
message?: string;
|
|
72
|
-
details?:
|
|
73
|
-
|
|
74
|
-
|
|
149
|
+
details?: {
|
|
150
|
+
field?: string | undefined;
|
|
151
|
+
reason?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.UNPROCESSABLE_ENTITY>;
|
|
154
|
+
/**
|
|
155
|
+
* HTTP 502 — upstream service returned an invalid response (`SYSTEM`).
|
|
156
|
+
* @param args.details.upstream - Name of the misbehaving upstream service.
|
|
157
|
+
*/
|
|
158
|
+
static readonly badGateway: (args?: {
|
|
75
159
|
message?: string;
|
|
76
|
-
details?:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
160
|
+
details?: {
|
|
161
|
+
upstream?: string | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.BAD_GATEWAY>;
|
|
164
|
+
/** HTTP 503 — service temporarily unavailable (`SYSTEM`). Pass `retryAfter` (seconds) if known. */
|
|
165
|
+
static readonly serviceUnavailable: (args?: {
|
|
80
166
|
message?: string;
|
|
81
|
-
|
|
167
|
+
details?: {
|
|
168
|
+
retryAfter?: number | undefined;
|
|
169
|
+
} | undefined;
|
|
170
|
+
} | undefined) => ElevaError<BASE_ERROR_CODES.SERVICE_UNAVAILABLE>;
|
|
171
|
+
/**
|
|
172
|
+
* HTTP 400 — a required field was missing from the request.
|
|
173
|
+
* @param args.field - Name of the missing field.
|
|
174
|
+
*/
|
|
175
|
+
static readonly mandatoryField: (args: Record<"field", string> & {
|
|
176
|
+
message?: string;
|
|
177
|
+
}) => ElevaError<BASE_ERROR_CODES.MANDATORY_FIELD>;
|
|
178
|
+
/**
|
|
179
|
+
* HTTP 500 — unexpected server error (`SYSTEM`).
|
|
180
|
+
* Pass the original exception as `cause` to preserve the full stack chain for logging.
|
|
181
|
+
*/
|
|
82
182
|
static internal(args?: {
|
|
83
183
|
message?: string;
|
|
84
184
|
cause?: unknown;
|
|
85
185
|
details?: ErrorDetails<BASE_ERROR_CODES.INTERNAL_SERVER_ERROR>;
|
|
86
186
|
}): ElevaError<BASE_ERROR_CODES.INTERNAL_SERVER_ERROR>;
|
|
87
|
-
|
|
187
|
+
/**
|
|
188
|
+
* HTTP 403 — caller is not authorised to access the given contact person.
|
|
189
|
+
* @param args.details.contactId - UUID of the blocked contact.
|
|
190
|
+
*/
|
|
191
|
+
static readonly forbiddenContact: (args: {
|
|
192
|
+
details: {
|
|
193
|
+
contactId: string;
|
|
194
|
+
};
|
|
88
195
|
message?: string;
|
|
89
|
-
|
|
90
|
-
}): ElevaError<API_ERROR_CODES.FORBIDDEN_CONTACT>;
|
|
196
|
+
}) => ElevaError<API_ERROR_CODES>;
|
|
91
197
|
}
|
|
92
198
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAA+B,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAA+B,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAuB/C,kFAAkF;AAClF,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC7D,IAAI,EAAE,CAAC,GAAG,MAAM,CA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