@plyaz/types 1.7.8 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const ERRORS_CODES: {
|
|
2
|
+
readonly validation_error: {
|
|
3
|
+
readonly status: 400;
|
|
4
|
+
readonly message: "errors.validation.error";
|
|
5
|
+
};
|
|
6
|
+
readonly unauthorized: {
|
|
7
|
+
readonly status: 401;
|
|
8
|
+
readonly message: "errors.auth.unauthorized";
|
|
9
|
+
};
|
|
10
|
+
readonly payment_failed: {
|
|
11
|
+
readonly status: 402;
|
|
12
|
+
readonly message: "errors.payment.failed";
|
|
13
|
+
};
|
|
14
|
+
readonly forbidden: {
|
|
15
|
+
readonly status: 403;
|
|
16
|
+
readonly message: "errors.auth.forbidden";
|
|
17
|
+
};
|
|
18
|
+
readonly not_found: {
|
|
19
|
+
readonly status: 404;
|
|
20
|
+
readonly message: "errors.common.notFound";
|
|
21
|
+
};
|
|
22
|
+
readonly method_not_allowed: {
|
|
23
|
+
readonly status: 405;
|
|
24
|
+
readonly message: "errors.common.methodNotAllowed";
|
|
25
|
+
};
|
|
26
|
+
readonly user_already_exists: {
|
|
27
|
+
readonly status: 409;
|
|
28
|
+
readonly message: "errors.user.alreadyExists";
|
|
29
|
+
};
|
|
30
|
+
readonly unprocessable_entity: {
|
|
31
|
+
readonly status: 422;
|
|
32
|
+
readonly message: "errors.validation.unprocessable";
|
|
33
|
+
};
|
|
34
|
+
readonly too_many_requests: {
|
|
35
|
+
readonly status: 429;
|
|
36
|
+
readonly message: "errors.rateLimit.tooManyRequests";
|
|
37
|
+
};
|
|
38
|
+
readonly internal_server_error: {
|
|
39
|
+
readonly status: 500;
|
|
40
|
+
readonly message: "errors.server.internal";
|
|
41
|
+
};
|
|
42
|
+
readonly not_implemented: {
|
|
43
|
+
readonly status: 501;
|
|
44
|
+
readonly message: "errors.server.notImplemented";
|
|
45
|
+
};
|
|
46
|
+
readonly bad_gateway: {
|
|
47
|
+
readonly status: 502;
|
|
48
|
+
readonly message: "errors.server.badGateway";
|
|
49
|
+
};
|
|
50
|
+
readonly service_unavailable: {
|
|
51
|
+
readonly status: 503;
|
|
52
|
+
readonly message: "errors.server.serviceUnavailable";
|
|
53
|
+
};
|
|
54
|
+
readonly gateway_timeout: {
|
|
55
|
+
readonly status: 504;
|
|
56
|
+
readonly message: "errors.server.gatewayTimeout";
|
|
57
|
+
};
|
|
58
|
+
};
|
package/dist/errors/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WithStatusCode, WithErrorCode, WithMessage, WithCorrelationId, WithTimestamp, WithValidationError } from '../common/types';
|
|
2
|
+
import type { ERRORS_CODES } from './constants/errors-codes';
|
|
2
3
|
/**
|
|
3
4
|
* Represents the structure of an error response returned by the application.
|
|
4
5
|
* @template ErrorDetails - The type of the `errors` array, defaults to `ErrorDetailsList`.
|
|
@@ -42,3 +43,5 @@ export type ErrorDetail<ValueGiven, AllowedValues, Constraints> = WithValidation
|
|
|
42
43
|
* @description A flexible list of error details that can contain string, number, or boolean values along with structured allowed values and constraints.
|
|
43
44
|
*/
|
|
44
45
|
export type ErrorDetailsList = readonly ErrorDetail<string | number | boolean, Record<string, string>, Record<string, string>>[];
|
|
46
|
+
export type ErrorCodeKey = keyof typeof ERRORS_CODES;
|
|
47
|
+
export type ErrorCodeValue = typeof ERRORS_CODES[ErrorCodeKey];
|
package/package.json
CHANGED