@yildizpay/http-adapter 3.0.0 → 3.2.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/README.md +253 -9
- package/README.tr.md +288 -44
- package/dist/builders/request.builder.d.ts +3 -0
- package/dist/builders/request.builder.js +6 -1
- package/dist/builders/request.builder.js.map +1 -1
- package/dist/contracts/http-client.contract.d.ts +0 -9
- package/dist/contracts/http-client.contract.js +0 -17
- package/dist/contracts/http-client.contract.js.map +1 -1
- package/dist/contracts/http-interceptor.contract.d.ts +6 -2
- package/dist/contracts/response-validator.contract.d.ts +4 -0
- package/dist/contracts/response-validator.contract.js +3 -0
- package/dist/contracts/response-validator.contract.js.map +1 -0
- package/dist/core/default-http-client.js +7 -6
- package/dist/core/default-http-client.js.map +1 -1
- package/dist/core/error.converter.d.ts +5 -0
- package/dist/core/error.converter.js +31 -0
- package/dist/core/error.converter.js.map +1 -0
- package/dist/core/http.adapter.js +28 -4
- package/dist/core/http.adapter.js.map +1 -1
- package/dist/exceptions/base-adapter.exception.d.ts +7 -0
- package/dist/exceptions/base-adapter.exception.js +34 -0
- package/dist/exceptions/base-adapter.exception.js.map +1 -0
- package/dist/exceptions/circuit-breaker-open.exception.d.ts +2 -2
- package/dist/exceptions/circuit-breaker-open.exception.js +3 -3
- package/dist/exceptions/circuit-breaker-open.exception.js.map +1 -1
- package/dist/exceptions/exception.guards.d.ts +17 -0
- package/dist/exceptions/exception.guards.js +53 -0
- package/dist/exceptions/exception.guards.js.map +1 -0
- package/dist/exceptions/http-exception.factory.d.ts +5 -0
- package/dist/exceptions/http-exception.factory.js +59 -0
- package/dist/exceptions/http-exception.factory.js.map +1 -0
- package/dist/exceptions/http-status.exceptions.d.ts +134 -0
- package/dist/exceptions/http-status.exceptions.js +382 -0
- package/dist/exceptions/http-status.exceptions.js.map +1 -0
- package/dist/exceptions/network-exception.factory.d.ts +6 -0
- package/dist/exceptions/network-exception.factory.js +35 -0
- package/dist/exceptions/network-exception.factory.js.map +1 -0
- package/dist/exceptions/network.exceptions.d.ts +25 -0
- package/dist/exceptions/network.exceptions.js +69 -0
- package/dist/exceptions/network.exceptions.js.map +1 -0
- package/dist/exceptions/unknown.exception.d.ts +7 -0
- package/dist/exceptions/unknown.exception.js +20 -0
- package/dist/exceptions/unknown.exception.js.map +1 -0
- package/dist/exceptions/validation.exception.d.ts +9 -0
- package/dist/exceptions/validation.exception.js +25 -0
- package/dist/exceptions/validation.exception.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/models/request-context.d.ts +5 -0
- package/dist/models/request-context.js +3 -0
- package/dist/models/request-context.js.map +1 -0
- package/dist/models/request.d.ts +3 -1
- package/dist/models/request.js +2 -1
- package/dist/models/request.js.map +1 -1
- package/dist/models/response.d.ts +8 -5
- package/dist/models/response.js +9 -5
- package/dist/models/response.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -3
- package/dist/exceptions/http.exception.d.ts +0 -5
- package/dist/exceptions/http.exception.js +0 -12
- package/dist/exceptions/http.exception.js.map +0 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetworkAuthenticationRequiredException = exports.NotExtendedException = exports.LoopDetectedException = exports.InsufficientStorageException = exports.VariantAlsoNegotiatesException = exports.HTTPVersionNotSupportedException = exports.GatewayTimeoutException = exports.ServiceUnavailableException = exports.BadGatewayException = exports.NotImplementedException = exports.InternalServerErrorException = exports.UnavailableForLegalReasonsException = exports.RequestHeaderFieldsTooLargeException = exports.TooManyRequestsException = exports.PreconditionRequiredException = exports.UpgradeRequiredException = exports.TooEarlyException = exports.FailedDependencyException = exports.LockedException = exports.UnprocessableEntityException = exports.MisdirectedRequestException = exports.ImATeapotException = exports.ExpectationFailedException = exports.RangeNotSatisfiableException = exports.UnsupportedMediaTypeException = exports.URITooLongException = exports.PayloadTooLargeException = exports.PreconditionFailedException = exports.LengthRequiredException = exports.GoneException = exports.ConflictException = exports.RequestTimeoutException = exports.ProxyAuthenticationRequiredException = exports.NotAcceptableException = exports.MethodNotAllowedException = exports.NotFoundException = exports.ForbiddenException = exports.PaymentRequiredException = exports.UnauthorizedException = exports.BadRequestException = exports.HttpException = void 0;
|
|
4
|
+
const base_adapter_exception_1 = require("./base-adapter.exception");
|
|
5
|
+
class HttpException extends base_adapter_exception_1.BaseAdapterException {
|
|
6
|
+
constructor(response, message, code, cause) {
|
|
7
|
+
super(message, code, cause);
|
|
8
|
+
this.name = 'HttpException';
|
|
9
|
+
this.response = response;
|
|
10
|
+
Object.setPrototypeOf(this, HttpException.prototype);
|
|
11
|
+
}
|
|
12
|
+
toJSON() {
|
|
13
|
+
return {
|
|
14
|
+
...super.toJSON(),
|
|
15
|
+
response: {
|
|
16
|
+
status: this.response.status,
|
|
17
|
+
data: this.response.data,
|
|
18
|
+
headers: this.response.headers,
|
|
19
|
+
...(this.response.requestContext && { request: this.response.requestContext }),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
isClientError() {
|
|
24
|
+
return this.response.status >= 400 && this.response.status < 500;
|
|
25
|
+
}
|
|
26
|
+
isServerError() {
|
|
27
|
+
return this.response.status >= 500 && this.response.status < 600;
|
|
28
|
+
}
|
|
29
|
+
getRetryAfterMs() {
|
|
30
|
+
const headers = this.response.headers;
|
|
31
|
+
if (!headers)
|
|
32
|
+
return undefined;
|
|
33
|
+
const key = Object.keys(headers).find((k) => k.toLowerCase() === 'retry-after');
|
|
34
|
+
const headerValue = key ? headers[key] : undefined;
|
|
35
|
+
if (!headerValue)
|
|
36
|
+
return undefined;
|
|
37
|
+
const asSeconds = Number.parseInt(headerValue, 10);
|
|
38
|
+
if (!Number.isNaN(asSeconds)) {
|
|
39
|
+
return asSeconds * 1000;
|
|
40
|
+
}
|
|
41
|
+
const asDate = Date.parse(headerValue);
|
|
42
|
+
if (!Number.isNaN(asDate)) {
|
|
43
|
+
const delay = asDate - Date.now();
|
|
44
|
+
return Math.max(0, delay);
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.HttpException = HttpException;
|
|
50
|
+
class BadRequestException extends HttpException {
|
|
51
|
+
constructor(response, message = 'Bad Request', code, cause) {
|
|
52
|
+
super(response, message, code, cause);
|
|
53
|
+
this.name = 'BadRequestException';
|
|
54
|
+
Object.setPrototypeOf(this, BadRequestException.prototype);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.BadRequestException = BadRequestException;
|
|
58
|
+
class UnauthorizedException extends HttpException {
|
|
59
|
+
constructor(response, message = 'Unauthorized', code, cause) {
|
|
60
|
+
super(response, message, code, cause);
|
|
61
|
+
this.name = 'UnauthorizedException';
|
|
62
|
+
Object.setPrototypeOf(this, UnauthorizedException.prototype);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.UnauthorizedException = UnauthorizedException;
|
|
66
|
+
class PaymentRequiredException extends HttpException {
|
|
67
|
+
constructor(response, message = 'Payment Required', code, cause) {
|
|
68
|
+
super(response, message, code, cause);
|
|
69
|
+
this.name = 'PaymentRequiredException';
|
|
70
|
+
Object.setPrototypeOf(this, PaymentRequiredException.prototype);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.PaymentRequiredException = PaymentRequiredException;
|
|
74
|
+
class ForbiddenException extends HttpException {
|
|
75
|
+
constructor(response, message = 'Forbidden', code, cause) {
|
|
76
|
+
super(response, message, code, cause);
|
|
77
|
+
this.name = 'ForbiddenException';
|
|
78
|
+
Object.setPrototypeOf(this, ForbiddenException.prototype);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ForbiddenException = ForbiddenException;
|
|
82
|
+
class NotFoundException extends HttpException {
|
|
83
|
+
constructor(response, message = 'Not Found', code, cause) {
|
|
84
|
+
super(response, message, code, cause);
|
|
85
|
+
this.name = 'NotFoundException';
|
|
86
|
+
Object.setPrototypeOf(this, NotFoundException.prototype);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.NotFoundException = NotFoundException;
|
|
90
|
+
class MethodNotAllowedException extends HttpException {
|
|
91
|
+
constructor(response, message = 'Method Not Allowed', code, cause) {
|
|
92
|
+
super(response, message, code, cause);
|
|
93
|
+
this.name = 'MethodNotAllowedException';
|
|
94
|
+
Object.setPrototypeOf(this, MethodNotAllowedException.prototype);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.MethodNotAllowedException = MethodNotAllowedException;
|
|
98
|
+
class NotAcceptableException extends HttpException {
|
|
99
|
+
constructor(response, message = 'Not Acceptable', code, cause) {
|
|
100
|
+
super(response, message, code, cause);
|
|
101
|
+
this.name = 'NotAcceptableException';
|
|
102
|
+
Object.setPrototypeOf(this, NotAcceptableException.prototype);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.NotAcceptableException = NotAcceptableException;
|
|
106
|
+
class ProxyAuthenticationRequiredException extends HttpException {
|
|
107
|
+
constructor(response, message = 'Proxy Authentication Required', code, cause) {
|
|
108
|
+
super(response, message, code, cause);
|
|
109
|
+
this.name = 'ProxyAuthenticationRequiredException';
|
|
110
|
+
Object.setPrototypeOf(this, ProxyAuthenticationRequiredException.prototype);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.ProxyAuthenticationRequiredException = ProxyAuthenticationRequiredException;
|
|
114
|
+
class RequestTimeoutException extends HttpException {
|
|
115
|
+
constructor(response, message = 'Request Timeout', code, cause) {
|
|
116
|
+
super(response, message, code, cause);
|
|
117
|
+
this.name = 'RequestTimeoutException';
|
|
118
|
+
Object.setPrototypeOf(this, RequestTimeoutException.prototype);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.RequestTimeoutException = RequestTimeoutException;
|
|
122
|
+
class ConflictException extends HttpException {
|
|
123
|
+
constructor(response, message = 'Conflict', code, cause) {
|
|
124
|
+
super(response, message, code, cause);
|
|
125
|
+
this.name = 'ConflictException';
|
|
126
|
+
Object.setPrototypeOf(this, ConflictException.prototype);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.ConflictException = ConflictException;
|
|
130
|
+
class GoneException extends HttpException {
|
|
131
|
+
constructor(response, message = 'Gone', code, cause) {
|
|
132
|
+
super(response, message, code, cause);
|
|
133
|
+
this.name = 'GoneException';
|
|
134
|
+
Object.setPrototypeOf(this, GoneException.prototype);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.GoneException = GoneException;
|
|
138
|
+
class LengthRequiredException extends HttpException {
|
|
139
|
+
constructor(response, message = 'Length Required', code, cause) {
|
|
140
|
+
super(response, message, code, cause);
|
|
141
|
+
this.name = 'LengthRequiredException';
|
|
142
|
+
Object.setPrototypeOf(this, LengthRequiredException.prototype);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.LengthRequiredException = LengthRequiredException;
|
|
146
|
+
class PreconditionFailedException extends HttpException {
|
|
147
|
+
constructor(response, message = 'Precondition Failed', code, cause) {
|
|
148
|
+
super(response, message, code, cause);
|
|
149
|
+
this.name = 'PreconditionFailedException';
|
|
150
|
+
Object.setPrototypeOf(this, PreconditionFailedException.prototype);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.PreconditionFailedException = PreconditionFailedException;
|
|
154
|
+
class PayloadTooLargeException extends HttpException {
|
|
155
|
+
constructor(response, message = 'Payload Too Large', code, cause) {
|
|
156
|
+
super(response, message, code, cause);
|
|
157
|
+
this.name = 'PayloadTooLargeException';
|
|
158
|
+
Object.setPrototypeOf(this, PayloadTooLargeException.prototype);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.PayloadTooLargeException = PayloadTooLargeException;
|
|
162
|
+
class URITooLongException extends HttpException {
|
|
163
|
+
constructor(response, message = 'URI Too Long', code, cause) {
|
|
164
|
+
super(response, message, code, cause);
|
|
165
|
+
this.name = 'URITooLongException';
|
|
166
|
+
Object.setPrototypeOf(this, URITooLongException.prototype);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.URITooLongException = URITooLongException;
|
|
170
|
+
class UnsupportedMediaTypeException extends HttpException {
|
|
171
|
+
constructor(response, message = 'Unsupported Media Type', code, cause) {
|
|
172
|
+
super(response, message, code, cause);
|
|
173
|
+
this.name = 'UnsupportedMediaTypeException';
|
|
174
|
+
Object.setPrototypeOf(this, UnsupportedMediaTypeException.prototype);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.UnsupportedMediaTypeException = UnsupportedMediaTypeException;
|
|
178
|
+
class RangeNotSatisfiableException extends HttpException {
|
|
179
|
+
constructor(response, message = 'Range Not Satisfiable', code, cause) {
|
|
180
|
+
super(response, message, code, cause);
|
|
181
|
+
this.name = 'RangeNotSatisfiableException';
|
|
182
|
+
Object.setPrototypeOf(this, RangeNotSatisfiableException.prototype);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.RangeNotSatisfiableException = RangeNotSatisfiableException;
|
|
186
|
+
class ExpectationFailedException extends HttpException {
|
|
187
|
+
constructor(response, message = 'Expectation Failed', code, cause) {
|
|
188
|
+
super(response, message, code, cause);
|
|
189
|
+
this.name = 'ExpectationFailedException';
|
|
190
|
+
Object.setPrototypeOf(this, ExpectationFailedException.prototype);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.ExpectationFailedException = ExpectationFailedException;
|
|
194
|
+
class ImATeapotException extends HttpException {
|
|
195
|
+
constructor(response, message = "I'm a teapot", code, cause) {
|
|
196
|
+
super(response, message, code, cause);
|
|
197
|
+
this.name = 'ImATeapotException';
|
|
198
|
+
Object.setPrototypeOf(this, ImATeapotException.prototype);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.ImATeapotException = ImATeapotException;
|
|
202
|
+
class MisdirectedRequestException extends HttpException {
|
|
203
|
+
constructor(response, message = 'Misdirected Request', code, cause) {
|
|
204
|
+
super(response, message, code, cause);
|
|
205
|
+
this.name = 'MisdirectedRequestException';
|
|
206
|
+
Object.setPrototypeOf(this, MisdirectedRequestException.prototype);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.MisdirectedRequestException = MisdirectedRequestException;
|
|
210
|
+
class UnprocessableEntityException extends HttpException {
|
|
211
|
+
constructor(response, message = 'Unprocessable Entity', code, cause) {
|
|
212
|
+
super(response, message, code, cause);
|
|
213
|
+
this.name = 'UnprocessableEntityException';
|
|
214
|
+
Object.setPrototypeOf(this, UnprocessableEntityException.prototype);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.UnprocessableEntityException = UnprocessableEntityException;
|
|
218
|
+
class LockedException extends HttpException {
|
|
219
|
+
constructor(response, message = 'Locked', code, cause) {
|
|
220
|
+
super(response, message, code, cause);
|
|
221
|
+
this.name = 'LockedException';
|
|
222
|
+
Object.setPrototypeOf(this, LockedException.prototype);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.LockedException = LockedException;
|
|
226
|
+
class FailedDependencyException extends HttpException {
|
|
227
|
+
constructor(response, message = 'Failed Dependency', code, cause) {
|
|
228
|
+
super(response, message, code, cause);
|
|
229
|
+
this.name = 'FailedDependencyException';
|
|
230
|
+
Object.setPrototypeOf(this, FailedDependencyException.prototype);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.FailedDependencyException = FailedDependencyException;
|
|
234
|
+
class TooEarlyException extends HttpException {
|
|
235
|
+
constructor(response, message = 'Too Early', code, cause) {
|
|
236
|
+
super(response, message, code, cause);
|
|
237
|
+
this.name = 'TooEarlyException';
|
|
238
|
+
Object.setPrototypeOf(this, TooEarlyException.prototype);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
exports.TooEarlyException = TooEarlyException;
|
|
242
|
+
class UpgradeRequiredException extends HttpException {
|
|
243
|
+
constructor(response, message = 'Upgrade Required', code, cause) {
|
|
244
|
+
super(response, message, code, cause);
|
|
245
|
+
this.name = 'UpgradeRequiredException';
|
|
246
|
+
Object.setPrototypeOf(this, UpgradeRequiredException.prototype);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.UpgradeRequiredException = UpgradeRequiredException;
|
|
250
|
+
class PreconditionRequiredException extends HttpException {
|
|
251
|
+
constructor(response, message = 'Precondition Required', code, cause) {
|
|
252
|
+
super(response, message, code, cause);
|
|
253
|
+
this.name = 'PreconditionRequiredException';
|
|
254
|
+
Object.setPrototypeOf(this, PreconditionRequiredException.prototype);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.PreconditionRequiredException = PreconditionRequiredException;
|
|
258
|
+
class TooManyRequestsException extends HttpException {
|
|
259
|
+
constructor(response, message = 'Too Many Requests', code, cause) {
|
|
260
|
+
super(response, message, code, cause);
|
|
261
|
+
this.name = 'TooManyRequestsException';
|
|
262
|
+
Object.setPrototypeOf(this, TooManyRequestsException.prototype);
|
|
263
|
+
}
|
|
264
|
+
isRetryable() {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.TooManyRequestsException = TooManyRequestsException;
|
|
269
|
+
class RequestHeaderFieldsTooLargeException extends HttpException {
|
|
270
|
+
constructor(response, message = 'Request Header Fields Too Large', code, cause) {
|
|
271
|
+
super(response, message, code, cause);
|
|
272
|
+
this.name = 'RequestHeaderFieldsTooLargeException';
|
|
273
|
+
Object.setPrototypeOf(this, RequestHeaderFieldsTooLargeException.prototype);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.RequestHeaderFieldsTooLargeException = RequestHeaderFieldsTooLargeException;
|
|
277
|
+
class UnavailableForLegalReasonsException extends HttpException {
|
|
278
|
+
constructor(response, message = 'Unavailable For Legal Reasons', code, cause) {
|
|
279
|
+
super(response, message, code, cause);
|
|
280
|
+
this.name = 'UnavailableForLegalReasonsException';
|
|
281
|
+
Object.setPrototypeOf(this, UnavailableForLegalReasonsException.prototype);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
exports.UnavailableForLegalReasonsException = UnavailableForLegalReasonsException;
|
|
285
|
+
class InternalServerErrorException extends HttpException {
|
|
286
|
+
constructor(response, message = 'Internal Server Error', code, cause) {
|
|
287
|
+
super(response, message, code, cause);
|
|
288
|
+
this.name = 'InternalServerErrorException';
|
|
289
|
+
Object.setPrototypeOf(this, InternalServerErrorException.prototype);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
exports.InternalServerErrorException = InternalServerErrorException;
|
|
293
|
+
class NotImplementedException extends HttpException {
|
|
294
|
+
constructor(response, message = 'Not Implemented', code, cause) {
|
|
295
|
+
super(response, message, code, cause);
|
|
296
|
+
this.name = 'NotImplementedException';
|
|
297
|
+
Object.setPrototypeOf(this, NotImplementedException.prototype);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
exports.NotImplementedException = NotImplementedException;
|
|
301
|
+
class BadGatewayException extends HttpException {
|
|
302
|
+
constructor(response, message = 'Bad Gateway', code, cause) {
|
|
303
|
+
super(response, message, code, cause);
|
|
304
|
+
this.name = 'BadGatewayException';
|
|
305
|
+
Object.setPrototypeOf(this, BadGatewayException.prototype);
|
|
306
|
+
}
|
|
307
|
+
isRetryable() {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.BadGatewayException = BadGatewayException;
|
|
312
|
+
class ServiceUnavailableException extends HttpException {
|
|
313
|
+
constructor(response, message = 'Service Unavailable', code, cause) {
|
|
314
|
+
super(response, message, code, cause);
|
|
315
|
+
this.name = 'ServiceUnavailableException';
|
|
316
|
+
Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
|
|
317
|
+
}
|
|
318
|
+
isRetryable() {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
exports.ServiceUnavailableException = ServiceUnavailableException;
|
|
323
|
+
class GatewayTimeoutException extends HttpException {
|
|
324
|
+
constructor(response, message = 'Gateway Timeout', code, cause) {
|
|
325
|
+
super(response, message, code, cause);
|
|
326
|
+
this.name = 'GatewayTimeoutException';
|
|
327
|
+
Object.setPrototypeOf(this, GatewayTimeoutException.prototype);
|
|
328
|
+
}
|
|
329
|
+
isRetryable() {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.GatewayTimeoutException = GatewayTimeoutException;
|
|
334
|
+
class HTTPVersionNotSupportedException extends HttpException {
|
|
335
|
+
constructor(response, message = 'HTTP Version Not Supported', code, cause) {
|
|
336
|
+
super(response, message, code, cause);
|
|
337
|
+
this.name = 'HTTPVersionNotSupportedException';
|
|
338
|
+
Object.setPrototypeOf(this, HTTPVersionNotSupportedException.prototype);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
exports.HTTPVersionNotSupportedException = HTTPVersionNotSupportedException;
|
|
342
|
+
class VariantAlsoNegotiatesException extends HttpException {
|
|
343
|
+
constructor(response, message = 'Variant Also Negotiates', code, cause) {
|
|
344
|
+
super(response, message, code, cause);
|
|
345
|
+
this.name = 'VariantAlsoNegotiatesException';
|
|
346
|
+
Object.setPrototypeOf(this, VariantAlsoNegotiatesException.prototype);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.VariantAlsoNegotiatesException = VariantAlsoNegotiatesException;
|
|
350
|
+
class InsufficientStorageException extends HttpException {
|
|
351
|
+
constructor(response, message = 'Insufficient Storage', code, cause) {
|
|
352
|
+
super(response, message, code, cause);
|
|
353
|
+
this.name = 'InsufficientStorageException';
|
|
354
|
+
Object.setPrototypeOf(this, InsufficientStorageException.prototype);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
exports.InsufficientStorageException = InsufficientStorageException;
|
|
358
|
+
class LoopDetectedException extends HttpException {
|
|
359
|
+
constructor(response, message = 'Loop Detected', code, cause) {
|
|
360
|
+
super(response, message, code, cause);
|
|
361
|
+
this.name = 'LoopDetectedException';
|
|
362
|
+
Object.setPrototypeOf(this, LoopDetectedException.prototype);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
exports.LoopDetectedException = LoopDetectedException;
|
|
366
|
+
class NotExtendedException extends HttpException {
|
|
367
|
+
constructor(response, message = 'Not Extended', code, cause) {
|
|
368
|
+
super(response, message, code, cause);
|
|
369
|
+
this.name = 'NotExtendedException';
|
|
370
|
+
Object.setPrototypeOf(this, NotExtendedException.prototype);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
exports.NotExtendedException = NotExtendedException;
|
|
374
|
+
class NetworkAuthenticationRequiredException extends HttpException {
|
|
375
|
+
constructor(response, message = 'Network Authentication Required', code, cause) {
|
|
376
|
+
super(response, message, code, cause);
|
|
377
|
+
this.name = 'NetworkAuthenticationRequiredException';
|
|
378
|
+
Object.setPrototypeOf(this, NetworkAuthenticationRequiredException.prototype);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
exports.NetworkAuthenticationRequiredException = NetworkAuthenticationRequiredException;
|
|
382
|
+
//# sourceMappingURL=http-status.exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status.exceptions.js","sourceRoot":"","sources":["../../src/exceptions/http-status.exceptions.ts"],"names":[],"mappings":";;;AACA,qEAAgE;AAEhE,MAAa,aAA2B,SAAQ,6CAAoB;IAGlE,YAAY,QAAqB,EAAE,OAAe,EAAE,IAAa,EAAE,KAAe;QAChF,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAEe,MAAM;QACpB,OAAO;YACL,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE;gBACR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AAmC,SAAQ,aAAgB;IACtE,YACE,QAAqB,EACrB,UAAkB,eAAe,EACjC,IAAa,EACb,KAAe;QAEf,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC/D,CAAC;CACF;AAXD,sDAWC;AAED,MAAa,oBAAkC,SAAQ,aAAgB;IACrE,YACE,QAAqB,EACrB,UAAkB,cAAc,EAChC,IAAa,EACb,KAAe;QAEf,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAXD,oDAWC;AAED,MAAa,sCAAoD,SAAQ,aAAgB;IACvF,YACE,QAAqB,EACrB,UAAkB,iCAAiC,EACnD,IAAa,EACb,KAAe;QAEf,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,wCAAwC,CAAC;QACrD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sCAAsC,CAAC,SAAS,CAAC,CAAC;IAChF,CAAC;CACF;AAXD,wFAWC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NetworkException } from './network.exceptions';
|
|
2
|
+
import { RequestContext } from '../models/request-context';
|
|
3
|
+
export declare class NetworkExceptionFactory {
|
|
4
|
+
static createFromNativeError(error: unknown, requestContext?: RequestContext): NetworkException;
|
|
5
|
+
private static extractMessage;
|
|
6
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetworkExceptionFactory = void 0;
|
|
4
|
+
const network_exceptions_1 = require("./network.exceptions");
|
|
5
|
+
class NetworkExceptionFactory {
|
|
6
|
+
static createFromNativeError(error, requestContext) {
|
|
7
|
+
if (error instanceof Error) {
|
|
8
|
+
const code = 'code' in error ? String(error.code) : undefined;
|
|
9
|
+
if (error.name === 'AbortError' || code === 'ECONNABORTED' || code === 'ETIMEDOUT') {
|
|
10
|
+
return new network_exceptions_1.TimeoutException(error.message, code || 'ECONNABORTED', error, requestContext);
|
|
11
|
+
}
|
|
12
|
+
if (code === 'ECONNREFUSED') {
|
|
13
|
+
return new network_exceptions_1.ConnectionRefusedException(error.message, code, error, requestContext);
|
|
14
|
+
}
|
|
15
|
+
if (code === 'ECONNRESET') {
|
|
16
|
+
return new network_exceptions_1.SocketResetException(error.message, code, error, requestContext);
|
|
17
|
+
}
|
|
18
|
+
if (code === 'ENOTFOUND' || code === 'EAI_AGAIN') {
|
|
19
|
+
return new network_exceptions_1.DnsResolutionException(error.message, code, error, requestContext);
|
|
20
|
+
}
|
|
21
|
+
if (code === 'EHOSTUNREACH' || code === 'ENETUNREACH') {
|
|
22
|
+
return new network_exceptions_1.HostUnreachableException(error.message, code, error, requestContext);
|
|
23
|
+
}
|
|
24
|
+
return new network_exceptions_1.NetworkException(error.message, code, error, requestContext);
|
|
25
|
+
}
|
|
26
|
+
const message = this.extractMessage(error);
|
|
27
|
+
return new network_exceptions_1.NetworkException(message, undefined, undefined, requestContext);
|
|
28
|
+
}
|
|
29
|
+
static extractMessage(error) {
|
|
30
|
+
return (error?.message ??
|
|
31
|
+
(typeof error === 'string' ? error : 'Unknown Network Error'));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.NetworkExceptionFactory = NetworkExceptionFactory;
|
|
35
|
+
//# sourceMappingURL=network-exception.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-exception.factory.js","sourceRoot":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AK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAE3C,OAAO,IAAI,qCAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAC7E,CAAC;IAaO,MAAM,CAAC,cAAc,CAAC,KAAc;QAC1C,OAAO,CACJ,KAA8B,EAAE,OAAO;YACxC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAC9D,CAAC;IACJ,CAAC;CACF;AAhED,0DAgEC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseAdapterException } from './base-adapter.exception';
|
|
2
|
+
import { RequestContext } from '../models/request-context';
|
|
3
|
+
export declare class NetworkException extends BaseAdapterException {
|
|
4
|
+
readonly requestContext?: RequestContext;
|
|
5
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
6
|
+
toJSON(): Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConnectionRefusedException extends NetworkException {
|
|
9
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
10
|
+
isRetryable(): boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class DnsResolutionException extends NetworkException {
|
|
13
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
14
|
+
}
|
|
15
|
+
export declare class TimeoutException extends NetworkException {
|
|
16
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
17
|
+
isRetryable(): boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare class SocketResetException extends NetworkException {
|
|
20
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
21
|
+
isRetryable(): boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare class HostUnreachableException extends NetworkException {
|
|
24
|
+
constructor(message?: string, code?: string, cause?: unknown, requestContext?: RequestContext);
|
|
25
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HostUnreachableException = exports.SocketResetException = exports.TimeoutException = exports.DnsResolutionException = exports.ConnectionRefusedException = exports.NetworkException = void 0;
|
|
4
|
+
const base_adapter_exception_1 = require("./base-adapter.exception");
|
|
5
|
+
class NetworkException extends base_adapter_exception_1.BaseAdapterException {
|
|
6
|
+
constructor(message = 'Network Error', code, cause, requestContext) {
|
|
7
|
+
super(message, code, cause);
|
|
8
|
+
this.name = 'NetworkException';
|
|
9
|
+
this.requestContext = requestContext;
|
|
10
|
+
Object.setPrototypeOf(this, NetworkException.prototype);
|
|
11
|
+
}
|
|
12
|
+
toJSON() {
|
|
13
|
+
return {
|
|
14
|
+
...super.toJSON(),
|
|
15
|
+
...(this.requestContext && { request: this.requestContext }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.NetworkException = NetworkException;
|
|
20
|
+
class ConnectionRefusedException extends NetworkException {
|
|
21
|
+
constructor(message = 'Connection Refused', code = 'ECONNREFUSED', cause, requestContext) {
|
|
22
|
+
super(message, code, cause, requestContext);
|
|
23
|
+
this.name = 'ConnectionRefusedException';
|
|
24
|
+
Object.setPrototypeOf(this, ConnectionRefusedException.prototype);
|
|
25
|
+
}
|
|
26
|
+
isRetryable() {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ConnectionRefusedException = ConnectionRefusedException;
|
|
31
|
+
class DnsResolutionException extends NetworkException {
|
|
32
|
+
constructor(message = 'DNS Resolution Failed', code = 'ENOTFOUND', cause, requestContext) {
|
|
33
|
+
super(message, code, cause, requestContext);
|
|
34
|
+
this.name = 'DnsResolutionException';
|
|
35
|
+
Object.setPrototypeOf(this, DnsResolutionException.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.DnsResolutionException = DnsResolutionException;
|
|
39
|
+
class TimeoutException extends NetworkException {
|
|
40
|
+
constructor(message = 'Request Timeout', code = 'ECONNABORTED', cause, requestContext) {
|
|
41
|
+
super(message, code, cause, requestContext);
|
|
42
|
+
this.name = 'TimeoutException';
|
|
43
|
+
Object.setPrototypeOf(this, TimeoutException.prototype);
|
|
44
|
+
}
|
|
45
|
+
isRetryable() {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.TimeoutException = TimeoutException;
|
|
50
|
+
class SocketResetException extends NetworkException {
|
|
51
|
+
constructor(message = 'Connection Reset', code = 'ECONNRESET', cause, requestContext) {
|
|
52
|
+
super(message, code, cause, requestContext);
|
|
53
|
+
this.name = 'SocketResetException';
|
|
54
|
+
Object.setPrototypeOf(this, SocketResetException.prototype);
|
|
55
|
+
}
|
|
56
|
+
isRetryable() {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.SocketResetException = SocketResetException;
|
|
61
|
+
class HostUnreachableException extends NetworkException {
|
|
62
|
+
constructor(message = 'Host Unreachable', code = 'EHOSTUNREACH', cause, requestContext) {
|
|
63
|
+
super(message, code, cause, requestContext);
|
|
64
|
+
this.name = 'HostUnreachableException';
|
|
65
|
+
Object.setPrototypeOf(this, HostUnreachableException.prototype);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.HostUnreachableException = HostUnreachableException;
|
|
69
|
+
//# sourceMappingURL=network.exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.exceptions.js","sourceRoot":"","sources":["../../src/exceptions/network.exceptions.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAGhE,MAAa,gBAAiB,SAAQ,6CAAoB;IAGxD,YACE,UAAkB,eAAe,EACjC,IAAa,EACb,KAAe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AC7B,KAAe,EACf,cAA+B;QAE/B,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAEe,WAAW;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAfD,4CAeC;AAED,MAAa,oBAAqB,SAAQ,gBAAgB;IACxD,YACE,UAAkB,kBAAkB,EACpC,OAAe,YAAY,EAC3B,KAAe,EACf,cAA+B;QAE/B,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IAEe,WAAW;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAfD,oDAeC;AAED,MAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,YACE,UAAkB,kBAAkB,EACpC,OAAe,cAAc,EAC7B,KAAe,EACf,cAA+B;QAE/B,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACF;AAXD,4DAWC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseAdapterException } from './base-adapter.exception';
|
|
2
|
+
import { RequestContext } from '../models/request-context';
|
|
3
|
+
export declare class UnknownException extends BaseAdapterException {
|
|
4
|
+
readonly requestContext?: RequestContext;
|
|
5
|
+
constructor(message?: string, cause?: unknown, requestContext?: RequestContext);
|
|
6
|
+
toJSON(): Record<string, unknown>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnknownException = void 0;
|
|
4
|
+
const base_adapter_exception_1 = require("./base-adapter.exception");
|
|
5
|
+
class UnknownException extends base_adapter_exception_1.BaseAdapterException {
|
|
6
|
+
constructor(message = 'An unknown error occurred within the adapter', cause, requestContext) {
|
|
7
|
+
super(message, undefined, cause);
|
|
8
|
+
this.name = 'UnknownException';
|
|
9
|
+
this.requestContext = requestContext;
|
|
10
|
+
Object.setPrototypeOf(this, UnknownException.prototype);
|
|
11
|
+
}
|
|
12
|
+
toJSON() {
|
|
13
|
+
return {
|
|
14
|
+
...super.toJSON(),
|
|
15
|
+
...(this.requestContext && { request: this.requestContext }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.UnknownException = UnknownException;
|
|
20
|
+
//# sourceMappingURL=unknown.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.exception.js","sourceRoot":"","sources":["../../src/exceptions/unknown.exception.ts"],"names":[],"mappings":";;;AAAA,qEAAgE;AAOhE,MAAa,gBAAiB,SAAQ,6CAAoB;IAGxD,YACE,UAAkB,8CAA8C,EAChE,KAAe,EACf,cAA+B;QAE/B,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAEe,MAAM;QACpB,OAAO;YACL,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;SAC7D,CAAC;IACJ,CAAC;CACF;AApBD,4CAoBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Response } from '../models/response';
|
|
2
|
+
import { BaseAdapterException } from './base-adapter.exception';
|
|
3
|
+
export declare class ValidationException<TCause = unknown> extends BaseAdapterException {
|
|
4
|
+
readonly name = "ValidationException";
|
|
5
|
+
readonly response: Response;
|
|
6
|
+
readonly cause: TCause | undefined;
|
|
7
|
+
constructor(message: string, response: Response, cause?: TCause);
|
|
8
|
+
toJSON(): Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationException = void 0;
|
|
4
|
+
const base_adapter_exception_1 = require("./base-adapter.exception");
|
|
5
|
+
class ValidationException extends base_adapter_exception_1.BaseAdapterException {
|
|
6
|
+
constructor(message, response, cause) {
|
|
7
|
+
super(message, 'ERR_VALIDATION', cause);
|
|
8
|
+
this.name = 'ValidationException';
|
|
9
|
+
this.response = response;
|
|
10
|
+
this.cause = cause;
|
|
11
|
+
Object.setPrototypeOf(this, ValidationException.prototype);
|
|
12
|
+
}
|
|
13
|
+
toJSON() {
|
|
14
|
+
return {
|
|
15
|
+
...super.toJSON(),
|
|
16
|
+
response: {
|
|
17
|
+
status: this.response.status,
|
|
18
|
+
data: this.response.data,
|
|
19
|
+
request: this.response.requestContext,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ValidationException = ValidationException;
|
|
25
|
+
//# sourceMappingURL=validation.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.exception.js","sourceRoot":"","sources":["../../src/exceptions/validation.exception.ts"],"names":[],"mappings":";;;AACA,qEAAgE;AAehE,MAAa,mBAAsC,SAAQ,6CAAoB;IAK7E,YAAmB,OAAe,EAAE,QAAkB,EAAE,KAAc;QACpE,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;QALjB,SAAI,GAAG,qBAAqB,CAAC;QAMpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;IAEe,MAAM;QACpB,OAAO;YACL,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE;gBACR,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;gBAC5B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;gBACxB,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc;aACtC;SACF,CAAC;IACJ,CAAC;CACF;AAtBD,kDAsBC"}
|