@emoyly/problem 4.1.10 → 4.1.11
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/defaults → defaults}/4xx.d.ts +147 -147
- package/{dist/defaults → defaults}/4xx.js +151 -151
- package/{dist/defaults → defaults}/5xx.d.ts +57 -57
- package/{dist/defaults → defaults}/5xx.js +61 -61
- package/{dist/defaults → defaults}/aws.d.ts +12 -12
- package/{dist/defaults → defaults}/aws.js +16 -16
- package/{dist/defaults → defaults}/cloudflare.d.ts +47 -47
- package/{dist/defaults → defaults}/cloudflare.js +52 -52
- package/{dist/defaults → defaults}/iis.d.ts +17 -17
- package/{dist/defaults → defaults}/iis.js +21 -21
- package/{dist/defaults → defaults}/index.d.ts +7 -7
- package/{dist/defaults → defaults}/index.js +17 -17
- package/{dist/defaults → defaults}/nginx.d.ts +32 -32
- package/{dist/defaults → defaults}/nginx.js +36 -36
- package/{dist/defaults → defaults}/others.d.ts +37 -37
- package/{dist/defaults → defaults}/others.js +40 -40
- package/{dist/index.d.ts → index.d.ts} +4 -4
- package/{dist/index.js → index.js} +34 -34
- package/{dist/middleware → middleware}/axios.d.ts +13 -13
- package/{dist/middleware → middleware}/axios.js +36 -36
- package/{dist/middleware → middleware}/base.d.ts +24 -24
- package/{dist/middleware → middleware}/base.js +49 -49
- package/{dist/middleware → middleware}/express.d.ts +19 -19
- package/{dist/middleware → middleware}/express.js +57 -57
- package/package.json +7 -19
- package/{dist/parsers → parsers}/axios.d.ts +3 -3
- package/{dist/parsers → parsers}/axios.js +39 -39
- package/{dist/parsers → parsers}/http.d.ts +3 -3
- package/{dist/parsers → parsers}/http.js +15 -15
- package/{dist/parsers → parsers}/jsonwebtoken.d.ts +3 -3
- package/{dist/parsers → parsers}/jsonwebtoken.js +96 -96
- package/{dist/parsers → parsers}/mikroorm.d.ts +3 -3
- package/{dist/parsers → parsers}/mikroorm.js +15 -15
- package/{dist/parsers → parsers}/tsoa.d.ts +3 -3
- package/{dist/parsers → parsers}/tsoa.js +17 -17
- package/{dist/problem.d.ts → problem.d.ts} +13 -13
- package/{dist/problem.js → problem.js} +50 -50
- package/{dist/tsconfig.tsbuildinfo → tsconfig.tsbuildinfo} +793 -793
- package/{dist/typings → typings}/events.d.ts +2 -2
- package/{dist/typings → typings}/events.js +2 -2
- package/{dist/typings → typings}/index.d.ts +5 -5
- package/{dist/typings → typings}/index.js +17 -17
- package/{dist/typings → typings}/middleware.d.ts +9 -9
- package/{dist/typings → typings}/middleware.js +2 -2
- package/{dist/typings → typings}/misc.d.ts +3 -3
- package/{dist/typings → typings}/misc.js +2 -2
- package/{dist/typings → typings}/parser.d.ts +9 -9
- package/{dist/typings → typings}/parser.js +2 -2
- package/{dist/typings → typings}/problem.d.ts +23 -23
- package/{dist/typings → typings}/problem.js +12 -12
- package/{dist/util → util}/events.d.ts +16 -16
- package/{dist/util → util}/events.js +29 -29
- package/{dist/util → util}/getProblems.d.ts +5 -5
- package/{dist/util → util}/getProblems.js +45 -45
- package/{dist/util → util}/version.d.ts +3 -3
- package/{dist/util → util}/version.js +20 -20
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -59
- package/dist/SECURITY.md +0 -12
- package/dist/package.json +0 -45
- package/dist/yarn.lock +0 -2076
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
444: {
|
|
3
|
-
status: number;
|
|
4
|
-
title: string;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
494: {
|
|
8
|
-
status: number;
|
|
9
|
-
title: string;
|
|
10
|
-
type: string;
|
|
11
|
-
};
|
|
12
|
-
495: {
|
|
13
|
-
status: number;
|
|
14
|
-
title: string;
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
496: {
|
|
18
|
-
status: number;
|
|
19
|
-
title: string;
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
497: {
|
|
23
|
-
status: number;
|
|
24
|
-
title: string;
|
|
25
|
-
type: string;
|
|
26
|
-
};
|
|
27
|
-
499: {
|
|
28
|
-
status: number;
|
|
29
|
-
title: string;
|
|
30
|
-
type: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
1
|
+
export declare const statusCodes: {
|
|
2
|
+
444: {
|
|
3
|
+
status: number;
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
494: {
|
|
8
|
+
status: number;
|
|
9
|
+
title: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
495: {
|
|
13
|
+
status: number;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
496: {
|
|
18
|
+
status: number;
|
|
19
|
+
title: string;
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
497: {
|
|
23
|
+
status: number;
|
|
24
|
+
title: string;
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
499: {
|
|
28
|
+
status: number;
|
|
29
|
+
title: string;
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Source: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.statusCodes = void 0;
|
|
5
|
-
exports.statusCodes = {
|
|
6
|
-
444: {
|
|
7
|
-
status: 494,
|
|
8
|
-
title: 'No Response',
|
|
9
|
-
type: '/errors/defaults/nginx/noresponse',
|
|
10
|
-
},
|
|
11
|
-
494: {
|
|
12
|
-
status: 494,
|
|
13
|
-
title: 'Request header too large',
|
|
14
|
-
type: '/errors/defaults/nginx/headertoolarge',
|
|
15
|
-
},
|
|
16
|
-
495: {
|
|
17
|
-
status: 495,
|
|
18
|
-
title: 'SSL Certificate Error',
|
|
19
|
-
type: '/errors/defaults/nginx/sslcerterr'
|
|
20
|
-
},
|
|
21
|
-
496: {
|
|
22
|
-
status: 496,
|
|
23
|
-
title: 'SSL Certificate Required',
|
|
24
|
-
type: '/errors/defaults/nginx/sslcertrequired'
|
|
25
|
-
},
|
|
26
|
-
497: {
|
|
27
|
-
status: 497,
|
|
28
|
-
title: 'HTTP Request Sent to HTTPS Port',
|
|
29
|
-
type: '/errors/defaults/nginx/httpreqtohttpsport'
|
|
30
|
-
},
|
|
31
|
-
499: {
|
|
32
|
-
status: 499,
|
|
33
|
-
title: 'Client Closed Request',
|
|
34
|
-
type: '/errors/defaults/nginx/clientclosedreq'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
// Source: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.statusCodes = void 0;
|
|
5
|
+
exports.statusCodes = {
|
|
6
|
+
444: {
|
|
7
|
+
status: 494,
|
|
8
|
+
title: 'No Response',
|
|
9
|
+
type: '/errors/defaults/nginx/noresponse',
|
|
10
|
+
},
|
|
11
|
+
494: {
|
|
12
|
+
status: 494,
|
|
13
|
+
title: 'Request header too large',
|
|
14
|
+
type: '/errors/defaults/nginx/headertoolarge',
|
|
15
|
+
},
|
|
16
|
+
495: {
|
|
17
|
+
status: 495,
|
|
18
|
+
title: 'SSL Certificate Error',
|
|
19
|
+
type: '/errors/defaults/nginx/sslcerterr'
|
|
20
|
+
},
|
|
21
|
+
496: {
|
|
22
|
+
status: 496,
|
|
23
|
+
title: 'SSL Certificate Required',
|
|
24
|
+
type: '/errors/defaults/nginx/sslcertrequired'
|
|
25
|
+
},
|
|
26
|
+
497: {
|
|
27
|
+
status: 497,
|
|
28
|
+
title: 'HTTP Request Sent to HTTPS Port',
|
|
29
|
+
type: '/errors/defaults/nginx/httpreqtohttpsport'
|
|
30
|
+
},
|
|
31
|
+
499: {
|
|
32
|
+
status: 499,
|
|
33
|
+
title: 'Client Closed Request',
|
|
34
|
+
type: '/errors/defaults/nginx/clientclosedreq'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export declare const otherErrors: {
|
|
2
|
-
unknown: {
|
|
3
|
-
status: number;
|
|
4
|
-
title: string;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
corsError: {
|
|
8
|
-
status: number;
|
|
9
|
-
title: string;
|
|
10
|
-
type: string;
|
|
11
|
-
};
|
|
12
|
-
problemParseError: {
|
|
13
|
-
status: number;
|
|
14
|
-
title: string;
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
problemJsonError: {
|
|
18
|
-
status: number;
|
|
19
|
-
title: string;
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
notAnError: {
|
|
23
|
-
status: number;
|
|
24
|
-
title: string;
|
|
25
|
-
type: string;
|
|
26
|
-
};
|
|
27
|
-
networkError: {
|
|
28
|
-
status: number;
|
|
29
|
-
title: string;
|
|
30
|
-
type: string;
|
|
31
|
-
};
|
|
32
|
-
inputValidationError: {
|
|
33
|
-
status: number;
|
|
34
|
-
title: string;
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
1
|
+
export declare const otherErrors: {
|
|
2
|
+
unknown: {
|
|
3
|
+
status: number;
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
corsError: {
|
|
8
|
+
status: number;
|
|
9
|
+
title: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
problemParseError: {
|
|
13
|
+
status: number;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
problemJsonError: {
|
|
18
|
+
status: number;
|
|
19
|
+
title: string;
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
notAnError: {
|
|
23
|
+
status: number;
|
|
24
|
+
title: string;
|
|
25
|
+
type: string;
|
|
26
|
+
};
|
|
27
|
+
networkError: {
|
|
28
|
+
status: number;
|
|
29
|
+
title: string;
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
inputValidationError: {
|
|
33
|
+
status: number;
|
|
34
|
+
title: string;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.otherErrors = void 0;
|
|
4
|
-
exports.otherErrors = {
|
|
5
|
-
'unknown': {
|
|
6
|
-
status: 500,
|
|
7
|
-
title: 'Unknown error',
|
|
8
|
-
type: '/errors/defaults/others/unknown',
|
|
9
|
-
},
|
|
10
|
-
'corsError': {
|
|
11
|
-
status: 401,
|
|
12
|
-
title: 'Request not allowed by CORS policy',
|
|
13
|
-
type: '/errors/defaults/others/corsdenied',
|
|
14
|
-
},
|
|
15
|
-
'problemParseError': {
|
|
16
|
-
status: 1000,
|
|
17
|
-
title: 'Could not parse problem details',
|
|
18
|
-
type: '/errors/defaults/others/problemparseerror',
|
|
19
|
-
},
|
|
20
|
-
'problemJsonError': {
|
|
21
|
-
status: 1000,
|
|
22
|
-
title: 'Could not parse problem JSON',
|
|
23
|
-
type: '/errors/defaults/others/problemjsonerror',
|
|
24
|
-
},
|
|
25
|
-
'notAnError': {
|
|
26
|
-
status: 1000,
|
|
27
|
-
title: 'Not an error',
|
|
28
|
-
type: '/errors/defaults/others/notanerror',
|
|
29
|
-
},
|
|
30
|
-
'networkError': {
|
|
31
|
-
status: 1000,
|
|
32
|
-
title: 'Network error',
|
|
33
|
-
type: '/errors/defaults/others/networkerror'
|
|
34
|
-
},
|
|
35
|
-
'inputValidationError': {
|
|
36
|
-
status: 400,
|
|
37
|
-
title: 'Input failed validation',
|
|
38
|
-
type: '/errors/defaults/others/validationerror'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.otherErrors = void 0;
|
|
4
|
+
exports.otherErrors = {
|
|
5
|
+
'unknown': {
|
|
6
|
+
status: 500,
|
|
7
|
+
title: 'Unknown error',
|
|
8
|
+
type: '/errors/defaults/others/unknown',
|
|
9
|
+
},
|
|
10
|
+
'corsError': {
|
|
11
|
+
status: 401,
|
|
12
|
+
title: 'Request not allowed by CORS policy',
|
|
13
|
+
type: '/errors/defaults/others/corsdenied',
|
|
14
|
+
},
|
|
15
|
+
'problemParseError': {
|
|
16
|
+
status: 1000,
|
|
17
|
+
title: 'Could not parse problem details',
|
|
18
|
+
type: '/errors/defaults/others/problemparseerror',
|
|
19
|
+
},
|
|
20
|
+
'problemJsonError': {
|
|
21
|
+
status: 1000,
|
|
22
|
+
title: 'Could not parse problem JSON',
|
|
23
|
+
type: '/errors/defaults/others/problemjsonerror',
|
|
24
|
+
},
|
|
25
|
+
'notAnError': {
|
|
26
|
+
status: 1000,
|
|
27
|
+
title: 'Not an error',
|
|
28
|
+
type: '/errors/defaults/others/notanerror',
|
|
29
|
+
},
|
|
30
|
+
'networkError': {
|
|
31
|
+
status: 1000,
|
|
32
|
+
title: 'Network error',
|
|
33
|
+
type: '/errors/defaults/others/networkerror'
|
|
34
|
+
},
|
|
35
|
+
'inputValidationError': {
|
|
36
|
+
status: 400,
|
|
37
|
+
title: 'Input failed validation',
|
|
38
|
+
type: '/errors/defaults/others/validationerror'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Problem } from './problem';
|
|
2
|
-
export * as defaults from './defaults';
|
|
3
|
-
export { default as events } from './util/events';
|
|
4
|
-
export * from './typings';
|
|
1
|
+
export { Problem } from './problem';
|
|
2
|
+
export * as defaults from './defaults';
|
|
3
|
+
export { default as events } from './util/events';
|
|
4
|
+
export * from './typings';
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.events = exports.defaults = exports.Problem = void 0;
|
|
29
|
-
var problem_1 = require("./problem");
|
|
30
|
-
Object.defineProperty(exports, "Problem", { enumerable: true, get: function () { return problem_1.Problem; } });
|
|
31
|
-
exports.defaults = __importStar(require("./defaults"));
|
|
32
|
-
var events_1 = require("./util/events");
|
|
33
|
-
Object.defineProperty(exports, "events", { enumerable: true, get: function () { return __importDefault(events_1).default; } });
|
|
34
|
-
__exportStar(require("./typings"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.events = exports.defaults = exports.Problem = void 0;
|
|
29
|
+
var problem_1 = require("./problem");
|
|
30
|
+
Object.defineProperty(exports, "Problem", { enumerable: true, get: function () { return problem_1.Problem; } });
|
|
31
|
+
exports.defaults = __importStar(require("./defaults"));
|
|
32
|
+
var events_1 = require("./util/events");
|
|
33
|
+
Object.defineProperty(exports, "events", { enumerable: true, get: function () { return __importDefault(events_1).default; } });
|
|
34
|
+
__exportStar(require("./typings"), exports);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { PartialMiddlewareOptions } from '../typings/middleware';
|
|
2
|
-
import { MiddlewareBase } from './base';
|
|
3
|
-
declare type InterceptorArray = [undefined, (error: any) => Promise<never>];
|
|
4
|
-
export declare class AxiosMiddleware extends MiddlewareBase {
|
|
5
|
-
name: string;
|
|
6
|
-
constructor(options?: PartialMiddlewareOptions);
|
|
7
|
-
interceptor: (error: any) => Promise<never>;
|
|
8
|
-
/**
|
|
9
|
-
* @example instance.interceptors.response.use(...middleware.use())
|
|
10
|
-
*/
|
|
11
|
-
use: () => InterceptorArray;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
1
|
+
import type { PartialMiddlewareOptions } from '../typings/middleware';
|
|
2
|
+
import { MiddlewareBase } from './base';
|
|
3
|
+
declare type InterceptorArray = [undefined, (error: any) => Promise<never>];
|
|
4
|
+
export declare class AxiosMiddleware extends MiddlewareBase {
|
|
5
|
+
name: string;
|
|
6
|
+
constructor(options?: PartialMiddlewareOptions);
|
|
7
|
+
interceptor: (error: any) => Promise<never>;
|
|
8
|
+
/**
|
|
9
|
+
* @example instance.interceptors.response.use(...middleware.use())
|
|
10
|
+
*/
|
|
11
|
+
use: () => InterceptorArray;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AxiosMiddleware = void 0;
|
|
16
|
-
const base_1 = require("./base");
|
|
17
|
-
const axios_1 = __importDefault(require("../parsers/axios"));
|
|
18
|
-
const events_1 = __importDefault(require("../util/events"));
|
|
19
|
-
class AxiosMiddleware extends base_1.MiddlewareBase {
|
|
20
|
-
constructor(options) {
|
|
21
|
-
super({
|
|
22
|
-
'parsers': [axios_1.default]
|
|
23
|
-
}, options);
|
|
24
|
-
this.name = 'axios';
|
|
25
|
-
this.interceptor = (error) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const problems = yield this.parse(error);
|
|
27
|
-
events_1.default.emit(problems);
|
|
28
|
-
return Promise.reject(problems);
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* @example instance.interceptors.response.use(...middleware.use())
|
|
32
|
-
*/
|
|
33
|
-
this.use = () => [undefined, this.interceptor];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.AxiosMiddleware = AxiosMiddleware;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AxiosMiddleware = void 0;
|
|
16
|
+
const base_1 = require("./base");
|
|
17
|
+
const axios_1 = __importDefault(require("../parsers/axios"));
|
|
18
|
+
const events_1 = __importDefault(require("../util/events"));
|
|
19
|
+
class AxiosMiddleware extends base_1.MiddlewareBase {
|
|
20
|
+
constructor(options) {
|
|
21
|
+
super({
|
|
22
|
+
'parsers': [axios_1.default]
|
|
23
|
+
}, options);
|
|
24
|
+
this.name = 'axios';
|
|
25
|
+
this.interceptor = (error) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const problems = yield this.parse(error);
|
|
27
|
+
events_1.default.emit(problems);
|
|
28
|
+
return Promise.reject(problems);
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* @example instance.interceptors.response.use(...middleware.use())
|
|
32
|
+
*/
|
|
33
|
+
this.use = () => [undefined, this.interceptor];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AxiosMiddleware = AxiosMiddleware;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { Problem } from '../problem';
|
|
2
|
-
import type { ProblemOpts } from '../typings';
|
|
3
|
-
import type { MiddlewareOptions, PartialMiddlewareOptions } from '../typings/middleware';
|
|
4
|
-
/**
|
|
5
|
-
* Middleware collects errors from somewhere, transforms them into something recognizable by a parser, and then passes them to the parsers, and then returns an array of Problems to whatever is using the middleware
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class MiddlewareBase {
|
|
8
|
-
options: MiddlewareOptions;
|
|
9
|
-
abstract name: string;
|
|
10
|
-
/**
|
|
11
|
-
* When nothing is returned from the parsers, just throw in a default "fallback" Problem object, so that a Problem is still actually returned/emitted
|
|
12
|
-
*/
|
|
13
|
-
enableFallback: boolean;
|
|
14
|
-
constructor(defaultOptions: MiddlewareOptions, options?: PartialMiddlewareOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Call this function when you want to use the middleware function
|
|
17
|
-
*/
|
|
18
|
-
abstract use(): any;
|
|
19
|
-
/**
|
|
20
|
-
* Parse input using parsers
|
|
21
|
-
*/
|
|
22
|
-
parse: (input: any) => Promise<Problem[]>;
|
|
23
|
-
fallback: ProblemOpts;
|
|
24
|
-
}
|
|
1
|
+
import { Problem } from '../problem';
|
|
2
|
+
import type { ProblemOpts } from '../typings';
|
|
3
|
+
import type { MiddlewareOptions, PartialMiddlewareOptions } from '../typings/middleware';
|
|
4
|
+
/**
|
|
5
|
+
* Middleware collects errors from somewhere, transforms them into something recognizable by a parser, and then passes them to the parsers, and then returns an array of Problems to whatever is using the middleware
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class MiddlewareBase {
|
|
8
|
+
options: MiddlewareOptions;
|
|
9
|
+
abstract name: string;
|
|
10
|
+
/**
|
|
11
|
+
* When nothing is returned from the parsers, just throw in a default "fallback" Problem object, so that a Problem is still actually returned/emitted
|
|
12
|
+
*/
|
|
13
|
+
enableFallback: boolean;
|
|
14
|
+
constructor(defaultOptions: MiddlewareOptions, options?: PartialMiddlewareOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Call this function when you want to use the middleware function
|
|
17
|
+
*/
|
|
18
|
+
abstract use(): any;
|
|
19
|
+
/**
|
|
20
|
+
* Parse input using parsers
|
|
21
|
+
*/
|
|
22
|
+
parse: (input: any) => Promise<Problem[]>;
|
|
23
|
+
fallback: ProblemOpts;
|
|
24
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MiddlewareBase = void 0;
|
|
13
|
-
const defaults_1 = require("../defaults");
|
|
14
|
-
const problem_1 = require("../problem");
|
|
15
|
-
const getProblems_1 = require("../util/getProblems");
|
|
16
|
-
/**
|
|
17
|
-
* Middleware collects errors from somewhere, transforms them into something recognizable by a parser, and then passes them to the parsers, and then returns an array of Problems to whatever is using the middleware
|
|
18
|
-
*/
|
|
19
|
-
class MiddlewareBase {
|
|
20
|
-
constructor(defaultOptions, options) {
|
|
21
|
-
/**
|
|
22
|
-
* When nothing is returned from the parsers, just throw in a default "fallback" Problem object, so that a Problem is still actually returned/emitted
|
|
23
|
-
*/
|
|
24
|
-
this.enableFallback = true;
|
|
25
|
-
/**
|
|
26
|
-
* Parse input using parsers
|
|
27
|
-
*/
|
|
28
|
-
this.parse = (input) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const problems = [];
|
|
30
|
-
const prob = getProblems_1.getProblems(input);
|
|
31
|
-
if (prob)
|
|
32
|
-
return prob;
|
|
33
|
-
for (const parse of this.options.parsers) {
|
|
34
|
-
const resp = parse(input);
|
|
35
|
-
if (!resp.length)
|
|
36
|
-
continue;
|
|
37
|
-
problems.push(...resp);
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
if (!problems.length && this.enableFallback) {
|
|
41
|
-
problems.push(new problem_1.Problem(Object.assign(Object.assign({}, this.fallback), { 'errorObject': input })));
|
|
42
|
-
}
|
|
43
|
-
return problems;
|
|
44
|
-
});
|
|
45
|
-
this.fallback = defaults_1.otherErrors.unknown;
|
|
46
|
-
this.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.MiddlewareBase = MiddlewareBase;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MiddlewareBase = void 0;
|
|
13
|
+
const defaults_1 = require("../defaults");
|
|
14
|
+
const problem_1 = require("../problem");
|
|
15
|
+
const getProblems_1 = require("../util/getProblems");
|
|
16
|
+
/**
|
|
17
|
+
* Middleware collects errors from somewhere, transforms them into something recognizable by a parser, and then passes them to the parsers, and then returns an array of Problems to whatever is using the middleware
|
|
18
|
+
*/
|
|
19
|
+
class MiddlewareBase {
|
|
20
|
+
constructor(defaultOptions, options) {
|
|
21
|
+
/**
|
|
22
|
+
* When nothing is returned from the parsers, just throw in a default "fallback" Problem object, so that a Problem is still actually returned/emitted
|
|
23
|
+
*/
|
|
24
|
+
this.enableFallback = true;
|
|
25
|
+
/**
|
|
26
|
+
* Parse input using parsers
|
|
27
|
+
*/
|
|
28
|
+
this.parse = (input) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const problems = [];
|
|
30
|
+
const prob = getProblems_1.getProblems(input);
|
|
31
|
+
if (prob)
|
|
32
|
+
return prob;
|
|
33
|
+
for (const parse of this.options.parsers) {
|
|
34
|
+
const resp = parse(input);
|
|
35
|
+
if (!resp.length)
|
|
36
|
+
continue;
|
|
37
|
+
problems.push(...resp);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if (!problems.length && this.enableFallback) {
|
|
41
|
+
problems.push(new problem_1.Problem(Object.assign(Object.assign({}, this.fallback), { 'errorObject': input })));
|
|
42
|
+
}
|
|
43
|
+
return problems;
|
|
44
|
+
});
|
|
45
|
+
this.fallback = defaults_1.otherErrors.unknown;
|
|
46
|
+
this.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.MiddlewareBase = MiddlewareBase;
|