@bett3r-dev/pv3-types 1.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.
- package/build/authentication.d.ts +261 -0
- package/build/authentication.d.ts.map +1 -0
- package/build/authentication.js +108 -0
- package/build/authentication.js.map +1 -0
- package/build/cache.d.ts +101 -0
- package/build/cache.d.ts.map +1 -0
- package/build/cache.js +3 -0
- package/build/cache.js.map +1 -0
- package/build/clusterAdministration.d.ts +642 -0
- package/build/clusterAdministration.d.ts.map +1 -0
- package/build/clusterAdministration.js +177 -0
- package/build/clusterAdministration.js.map +1 -0
- package/build/configuration.d.ts +66 -0
- package/build/configuration.d.ts.map +1 -0
- package/build/configuration.js +3 -0
- package/build/configuration.js.map +1 -0
- package/build/database.d.ts +120 -0
- package/build/database.d.ts.map +1 -0
- package/build/database.js +41 -0
- package/build/database.js.map +1 -0
- package/build/endpoints.d.ts +183 -0
- package/build/endpoints.d.ts.map +1 -0
- package/build/endpoints.js +78 -0
- package/build/endpoints.js.map +1 -0
- package/build/evenstore.d.ts +26 -0
- package/build/evenstore.d.ts.map +1 -0
- package/build/evenstore.js +12 -0
- package/build/evenstore.js.map +1 -0
- package/build/eventsourcing/aggregateBuilder.d.ts +10 -0
- package/build/eventsourcing/aggregateBuilder.d.ts.map +1 -0
- package/build/eventsourcing/aggregateBuilder.js +3 -0
- package/build/eventsourcing/aggregateBuilder.js.map +1 -0
- package/build/eventsourcing/commandBuilder.d.ts +58 -0
- package/build/eventsourcing/commandBuilder.d.ts.map +1 -0
- package/build/eventsourcing/commandBuilder.js +6 -0
- package/build/eventsourcing/commandBuilder.js.map +1 -0
- package/build/eventsourcing/commandHandlers.d.ts +104 -0
- package/build/eventsourcing/commandHandlers.d.ts.map +1 -0
- package/build/eventsourcing/commandHandlers.js +28 -0
- package/build/eventsourcing/commandHandlers.js.map +1 -0
- package/build/eventsourcing/eventHandlers.d.ts +102 -0
- package/build/eventsourcing/eventHandlers.d.ts.map +1 -0
- package/build/eventsourcing/eventHandlers.js +33 -0
- package/build/eventsourcing/eventHandlers.js.map +1 -0
- package/build/eventsourcing/eventHandlersBuilder.d.ts +36 -0
- package/build/eventsourcing/eventHandlersBuilder.d.ts.map +1 -0
- package/build/eventsourcing/eventHandlersBuilder.js +13 -0
- package/build/eventsourcing/eventHandlersBuilder.js.map +1 -0
- package/build/eventsourcing/externalSystemBuilder.d.ts +14 -0
- package/build/eventsourcing/externalSystemBuilder.d.ts.map +1 -0
- package/build/eventsourcing/externalSystemBuilder.js +3 -0
- package/build/eventsourcing/externalSystemBuilder.js.map +1 -0
- package/build/eventsourcing/index.d.ts +386 -0
- package/build/eventsourcing/index.d.ts.map +1 -0
- package/build/eventsourcing/index.js +47 -0
- package/build/eventsourcing/index.js.map +1 -0
- package/build/eventsourcing/invariants.d.ts +19 -0
- package/build/eventsourcing/invariants.d.ts.map +1 -0
- package/build/eventsourcing/invariants.js +3 -0
- package/build/eventsourcing/invariants.js.map +1 -0
- package/build/eventsourcing/utils.d.ts +4 -0
- package/build/eventsourcing/utils.d.ts.map +1 -0
- package/build/eventsourcing/utils.js +3 -0
- package/build/eventsourcing/utils.js.map +1 -0
- package/build/index.d.ts +16 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +32 -0
- package/build/index.js.map +1 -0
- package/build/infrastructure.d.ts +40 -0
- package/build/infrastructure.d.ts.map +1 -0
- package/build/infrastructure.js +11 -0
- package/build/infrastructure.js.map +1 -0
- package/build/logger.d.ts +32 -0
- package/build/logger.d.ts.map +1 -0
- package/build/logger.js +29 -0
- package/build/logger.js.map +1 -0
- package/build/outboxManager.d.ts +38 -0
- package/build/outboxManager.d.ts.map +1 -0
- package/build/outboxManager.js +21 -0
- package/build/outboxManager.js.map +1 -0
- package/build/ports.d.ts +39 -0
- package/build/ports.d.ts.map +1 -0
- package/build/ports.js +3 -0
- package/build/ports.js.map +1 -0
- package/build/routesAuth.d.ts +58 -0
- package/build/routesAuth.d.ts.map +1 -0
- package/build/routesAuth.js +37 -0
- package/build/routesAuth.js.map +1 -0
- package/build/typedEventEmitter.d.ts +23 -0
- package/build/typedEventEmitter.d.ts.map +1 -0
- package/build/typedEventEmitter.js +55 -0
- package/build/typedEventEmitter.js.map +1 -0
- package/build/validation.d.ts +64 -0
- package/build/validation.d.ts.map +1 -0
- package/build/validation.js +57 -0
- package/build/validation.js.map +1 -0
- package/package.json +15 -0
- package/src/authentication.ts +273 -0
- package/src/cache.ts +109 -0
- package/src/clusterAdministration.ts +216 -0
- package/src/configuration.ts +71 -0
- package/src/database.ts +157 -0
- package/src/endpoints.ts +198 -0
- package/src/evenstore.ts +27 -0
- package/src/eventsourcing/aggregateBuilder.ts +11 -0
- package/src/eventsourcing/commandBuilder.ts +64 -0
- package/src/eventsourcing/commandHandlers.ts +137 -0
- package/src/eventsourcing/eventHandlers.ts +118 -0
- package/src/eventsourcing/eventHandlersBuilder.ts +42 -0
- package/src/eventsourcing/externalSystemBuilder.ts +20 -0
- package/src/eventsourcing/index.ts +111 -0
- package/src/eventsourcing/invariants.ts +27 -0
- package/src/eventsourcing/utils.ts +4 -0
- package/src/index.ts +15 -0
- package/src/infrastructure.ts +41 -0
- package/src/logger.ts +45 -0
- package/src/outboxManager.ts +36 -0
- package/src/ports.ts +42 -0
- package/src/routesAuth.ts +58 -0
- package/src/typedEventEmitter.ts +73 -0
- package/src/validation.ts +89 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import S, { BaseSchema } from '@bett3r-dev/jsonschema-definer';
|
|
2
|
+
|
|
3
|
+
export type AppErrorInstance<ErrorPayload = unknown> = Error & AppErrorData<ErrorPayload>
|
|
4
|
+
export type AppErrorData<ErrorPayload = unknown> = {
|
|
5
|
+
error?: string,
|
|
6
|
+
description?: string,
|
|
7
|
+
type: ErrorTypes,
|
|
8
|
+
details?: ErrorPayload,
|
|
9
|
+
status?:number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AppErrorType<ErrorPayload = any> = AppErrorData<ErrorPayload> & {schema?: BaseSchema<ErrorPayload>}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export const errorStatusCodeMap = {
|
|
18
|
+
BadRequestError: 400,
|
|
19
|
+
UnauthorizedError: 401,
|
|
20
|
+
PaymentRequiredError: 402,
|
|
21
|
+
ForbiddenError: 403,
|
|
22
|
+
NotFoundError: 404,
|
|
23
|
+
MethodNotAllowedError: 405,
|
|
24
|
+
NotAcceptableError: 406,
|
|
25
|
+
ProxyAuthenticationRequiredError: 407,
|
|
26
|
+
RequestTimeoutError: 408,
|
|
27
|
+
ConflictError: 409,
|
|
28
|
+
ConcurrencyError: 409,
|
|
29
|
+
GoneError: 410,
|
|
30
|
+
LengthRequiredError: 411,
|
|
31
|
+
PreconditionFailedError: 412,
|
|
32
|
+
PayloadTooLargeError: 413,
|
|
33
|
+
TooManyRequestsError: 429,
|
|
34
|
+
InternalServerError: 500,
|
|
35
|
+
NotImplementedError: 501,
|
|
36
|
+
BadGatewayError: 502,
|
|
37
|
+
ServiceUnavailableError: 503,
|
|
38
|
+
GatewayTimeoutError: 504,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const statusCodeErrorMap = {
|
|
42
|
+
400: 'BadRequestError',
|
|
43
|
+
401: 'UnauthorizedError',
|
|
44
|
+
402: 'PaymentRequiredError',
|
|
45
|
+
403: 'ForbiddenError',
|
|
46
|
+
404: 'NotFoundError',
|
|
47
|
+
405: 'MethodNotAllowedError',
|
|
48
|
+
406: 'NotAcceptableError',
|
|
49
|
+
407: 'ProxyAuthenticationRequiredError',
|
|
50
|
+
408: 'RequestTimeoutError',
|
|
51
|
+
409: 'ConcurrencyError',
|
|
52
|
+
410: 'GoneError',
|
|
53
|
+
411: 'LengthRequiredError',
|
|
54
|
+
412: 'PreconditionFailedError',
|
|
55
|
+
413: 'PayloadTooLargeError',
|
|
56
|
+
429: 'TooManyRequestsError',
|
|
57
|
+
500: 'InternalServerError',
|
|
58
|
+
501: 'NotImplementedError',
|
|
59
|
+
502: 'BadGatewayError',
|
|
60
|
+
503: 'ServiceUnavailableError',
|
|
61
|
+
504: 'GatewayTimeoutError',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const ErrorTypesSchema = S.string().enum(
|
|
66
|
+
'BadRequestError',
|
|
67
|
+
'UnauthorizedError',
|
|
68
|
+
'PaymentRequiredError',
|
|
69
|
+
'ForbiddenError',
|
|
70
|
+
'NotFoundError',
|
|
71
|
+
'MethodNotAllowedError',
|
|
72
|
+
'NotAcceptableError',
|
|
73
|
+
'ProxyAuthenticationRequiredError',
|
|
74
|
+
'RequestTimeoutError',
|
|
75
|
+
'ConflictError',
|
|
76
|
+
'ConcurrencyError',
|
|
77
|
+
'GoneError',
|
|
78
|
+
'LengthRequiredError',
|
|
79
|
+
'PreconditionFailedError',
|
|
80
|
+
'PayloadTooLargeError',
|
|
81
|
+
'TooManyRequestsError',
|
|
82
|
+
'InternalServerError',
|
|
83
|
+
'NotImplementedError',
|
|
84
|
+
'BadGatewayError',
|
|
85
|
+
'ServiceUnavailableError',
|
|
86
|
+
'GatewayTimeoutError'
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export type ErrorTypes = typeof ErrorTypesSchema.type;
|
package/tsconfig.json
ADDED