@emoyly/problem 8.0.5 → 9.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/LICENSE +1 -1
- package/{cjs → dist}/middleware/axios.d.ts +3 -3
- package/{cjs → dist}/middleware/base.d.ts +7 -7
- package/{esm → dist}/middleware/express.d.ts +4 -4
- package/{esm → dist}/problem.d.ts +1 -1
- package/{esm → dist}/util/index.d.ts +1 -0
- package/{esm → dist}/util/index.js +1 -0
- package/dist/util/version.d.ts +2 -0
- package/{esm → dist}/util/version.js +1 -1
- package/package.json +14 -45
- package/{cjs/defaults/4xx.js → src/defaults/4xx.ts} +5 -5
- package/{cjs/defaults/5xx.js → src/defaults/5xx.ts} +5 -5
- package/{cjs/defaults/aws.js → src/defaults/aws.ts} +5 -5
- package/{cjs/defaults/cloudflare.js → src/defaults/cloudflare.ts} +5 -5
- package/{cjs/defaults/iis.js → src/defaults/iis.ts} +5 -5
- package/src/defaults/index.ts +7 -0
- package/{cjs/defaults/nginx.js → src/defaults/nginx.ts} +5 -5
- package/{cjs/defaults/others.js → src/defaults/others.ts} +4 -5
- package/src/index.ts +4 -0
- package/src/middleware/axios.ts +26 -0
- package/src/middleware/base.ts +72 -0
- package/src/middleware/express.ts +52 -0
- package/src/parsers/axios.ts +59 -0
- package/{cjs/parsers/jsonwebtoken.js → src/parsers/jsonwebtoken.ts} +42 -35
- package/src/parsers/mikroorm.ts +22 -0
- package/src/parsers/tsoa.ts +27 -0
- package/src/parsers/zod.ts +23 -0
- package/src/problem.ts +70 -0
- package/src/typings/codes.ts +7 -0
- package/src/typings/index.ts +4 -0
- package/{esm/typings/middleware.d.ts → src/typings/middleware.ts} +8 -5
- package/src/typings/parser.ts +3 -0
- package/{esm/typings/problem.d.ts → src/typings/problem.ts} +18 -17
- package/src/util/getProblems.ts +62 -0
- package/src/util/index.ts +5 -0
- package/src/util/misc.ts +20 -0
- package/{cjs/util/problemArray.js → src/util/problemArray.ts} +11 -11
- package/src/util/validation.ts +39 -0
- package/src/util/version.ts +2 -0
- package/.yarn/versions/524dd037.yml +0 -0
- package/.yarn/versions/b57d536b.yml +0 -0
- package/.yarn/versions/d984e272.yml +0 -0
- package/cjs/defaults/index.js +0 -17
- package/cjs/index.js +0 -22
- package/cjs/middleware/axios.js +0 -23
- package/cjs/middleware/base.js +0 -62
- package/cjs/middleware/express.d.ts +0 -19
- package/cjs/middleware/express.js +0 -46
- package/cjs/package.json +0 -3
- package/cjs/parsers/axios.js +0 -56
- package/cjs/parsers/mikroorm.js +0 -20
- package/cjs/parsers/tsoa.js +0 -25
- package/cjs/parsers/zod.js +0 -21
- package/cjs/problem.d.ts +0 -14
- package/cjs/problem.js +0 -76
- package/cjs/tsconfig.tsbuildinfo +0 -1
- package/cjs/typings/codes.js +0 -2
- package/cjs/typings/index.js +0 -20
- package/cjs/typings/middleware.js +0 -2
- package/cjs/typings/parser.js +0 -2
- package/cjs/typings/problem.js +0 -12
- package/cjs/util/getProblems.js +0 -62
- package/cjs/util/index.d.ts +0 -4
- package/cjs/util/index.js +0 -20
- package/cjs/util/misc.js +0 -18
- package/cjs/util/validation.js +0 -38
- package/cjs/util/version.d.ts +0 -2
- package/cjs/util/version.js +0 -5
- package/eslint.config.mjs +0 -5
- package/esm/defaults/4xx.d.ts +0 -147
- package/esm/defaults/5xx.d.ts +0 -57
- package/esm/defaults/aws.d.ts +0 -12
- package/esm/defaults/cloudflare.d.ts +0 -47
- package/esm/defaults/iis.d.ts +0 -17
- package/esm/defaults/index.d.ts +0 -7
- package/esm/defaults/nginx.d.ts +0 -32
- package/esm/defaults/others.d.ts +0 -37
- package/esm/index.d.ts +0 -4
- package/esm/middleware/axios.d.ts +0 -13
- package/esm/middleware/base.d.ts +0 -30
- package/esm/package.json +0 -3
- package/esm/parsers/axios.d.ts +0 -3
- package/esm/parsers/jsonwebtoken.d.ts +0 -3
- package/esm/parsers/mikroorm.d.ts +0 -3
- package/esm/parsers/tsoa.d.ts +0 -3
- package/esm/parsers/zod.d.ts +0 -3
- package/esm/tsconfig.tsbuildinfo +0 -1
- package/esm/typings/codes.d.ts +0 -5
- package/esm/typings/index.d.ts +0 -4
- package/esm/typings/parser.d.ts +0 -2
- package/esm/util/getProblems.d.ts +0 -11
- package/esm/util/misc.d.ts +0 -2
- package/esm/util/problemArray.d.ts +0 -7
- package/esm/util/validation.d.ts +0 -5
- package/esm/util/version.d.ts +0 -2
- package/tsconfig.json +0 -19
- /package/{cjs → dist}/defaults/4xx.d.ts +0 -0
- /package/{esm → dist}/defaults/4xx.js +0 -0
- /package/{cjs → dist}/defaults/5xx.d.ts +0 -0
- /package/{esm → dist}/defaults/5xx.js +0 -0
- /package/{cjs → dist}/defaults/aws.d.ts +0 -0
- /package/{esm → dist}/defaults/aws.js +0 -0
- /package/{cjs → dist}/defaults/cloudflare.d.ts +0 -0
- /package/{esm → dist}/defaults/cloudflare.js +0 -0
- /package/{cjs → dist}/defaults/iis.d.ts +0 -0
- /package/{esm → dist}/defaults/iis.js +0 -0
- /package/{cjs → dist}/defaults/index.d.ts +0 -0
- /package/{esm → dist}/defaults/index.js +0 -0
- /package/{cjs → dist}/defaults/nginx.d.ts +0 -0
- /package/{esm → dist}/defaults/nginx.js +0 -0
- /package/{cjs → dist}/defaults/others.d.ts +0 -0
- /package/{esm → dist}/defaults/others.js +0 -0
- /package/{cjs → dist}/index.d.ts +0 -0
- /package/{esm → dist}/index.js +0 -0
- /package/{esm → dist}/middleware/axios.js +0 -0
- /package/{esm → dist}/middleware/base.js +0 -0
- /package/{esm → dist}/middleware/express.js +0 -0
- /package/{cjs → dist}/parsers/axios.d.ts +0 -0
- /package/{esm → dist}/parsers/axios.js +0 -0
- /package/{cjs → dist}/parsers/jsonwebtoken.d.ts +0 -0
- /package/{esm → dist}/parsers/jsonwebtoken.js +0 -0
- /package/{cjs → dist}/parsers/mikroorm.d.ts +0 -0
- /package/{esm → dist}/parsers/mikroorm.js +0 -0
- /package/{cjs → dist}/parsers/tsoa.d.ts +0 -0
- /package/{esm → dist}/parsers/tsoa.js +0 -0
- /package/{cjs → dist}/parsers/zod.d.ts +0 -0
- /package/{esm → dist}/parsers/zod.js +0 -0
- /package/{esm → dist}/problem.js +0 -0
- /package/{cjs → dist}/typings/codes.d.ts +0 -0
- /package/{esm → dist}/typings/codes.js +0 -0
- /package/{cjs → dist}/typings/index.d.ts +0 -0
- /package/{esm → dist}/typings/index.js +0 -0
- /package/{cjs → dist}/typings/middleware.d.ts +0 -0
- /package/{esm → dist}/typings/middleware.js +0 -0
- /package/{cjs → dist}/typings/parser.d.ts +0 -0
- /package/{esm → dist}/typings/parser.js +0 -0
- /package/{cjs → dist}/typings/problem.d.ts +0 -0
- /package/{esm → dist}/typings/problem.js +0 -0
- /package/{cjs → dist}/util/getProblems.d.ts +0 -0
- /package/{esm → dist}/util/getProblems.js +0 -0
- /package/{cjs → dist}/util/misc.d.ts +0 -0
- /package/{esm → dist}/util/misc.js +0 -0
- /package/{cjs → dist}/util/problemArray.d.ts +0 -0
- /package/{esm → dist}/util/problemArray.js +0 -0
- /package/{cjs → dist}/util/validation.d.ts +0 -0
- /package/{esm → dist}/util/validation.js +0 -0
package/cjs/util/getProblems.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isJsonProblem = isJsonProblem;
|
|
4
|
-
exports.createFromJson = createFromJson;
|
|
5
|
-
exports.getProblems = getProblems;
|
|
6
|
-
const problem_js_1 = require("../problem.js");
|
|
7
|
-
const problemArray_js_1 = require("./problemArray.js");
|
|
8
|
-
const validation_js_1 = require("./validation.js");
|
|
9
|
-
function isJsonProblem(input) {
|
|
10
|
-
return (0, validation_js_1.validateBasicInput)(input) === true;
|
|
11
|
-
}
|
|
12
|
-
function createFromJson({ title, type, instance, detail, status, data: _data, __problemVersion, source, errorObject, stack, ...extras }) {
|
|
13
|
-
let data;
|
|
14
|
-
const extraKeys = Object.keys(extras);
|
|
15
|
-
if /* No extras, just use data */ (extraKeys.length < 1) {
|
|
16
|
-
data = _data;
|
|
17
|
-
}
|
|
18
|
-
else if /* Extras but no data, just use extras */ ((_data === undefined || _data === null)) {
|
|
19
|
-
data = extras;
|
|
20
|
-
}
|
|
21
|
-
else if /* Data is not object we can merge with, and we do have extras */ (typeof _data !== 'object' || Array.isArray(_data) || Object.keys(_data).some(val => extraKeys.includes(val))) {
|
|
22
|
-
data = { original: _data, extras };
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
data = { ...extras, ..._data };
|
|
26
|
-
}
|
|
27
|
-
// TODO: Validate that source, errorObject and stack should actually be passed through
|
|
28
|
-
return new problem_js_1.Problem({ title, type, instance, detail, status, data, source, errorObject, stack });
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get an array of Problems from any given input.
|
|
32
|
-
* Handles existing Problems, arrays of Problems, JSON Problems, JSON Problem arrays and optionally attempts to parse any input with the given parsers.
|
|
33
|
-
* Only returns an array of Problems if it can successfully parse the input.
|
|
34
|
-
*/
|
|
35
|
-
function getProblems(input, parsers) {
|
|
36
|
-
if (typeof input === 'string') {
|
|
37
|
-
try {
|
|
38
|
-
const p = JSON.parse(input);
|
|
39
|
-
input = p;
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
|
-
}
|
|
42
|
-
catch (err) { /**/ }
|
|
43
|
-
}
|
|
44
|
-
if (input instanceof problem_js_1.Problem)
|
|
45
|
-
return [input];
|
|
46
|
-
if ((0, problemArray_js_1.isProblemArray)(input, false))
|
|
47
|
-
return input;
|
|
48
|
-
if (Array.isArray(input) && input.length > 0 && input.every(val => isJsonProblem(val))) {
|
|
49
|
-
return input.map(val => createFromJson(val));
|
|
50
|
-
}
|
|
51
|
-
if (isJsonProblem(input)) {
|
|
52
|
-
return [createFromJson(input)];
|
|
53
|
-
}
|
|
54
|
-
if (parsers) {
|
|
55
|
-
for (const parser of parsers) {
|
|
56
|
-
const problems = parser(input);
|
|
57
|
-
if (!problems || !problems.length)
|
|
58
|
-
continue;
|
|
59
|
-
return problems;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
package/cjs/util/index.d.ts
DELETED
package/cjs/util/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./getProblems.js"), exports);
|
|
18
|
-
__exportStar(require("./problemArray.js"), exports);
|
|
19
|
-
__exportStar(require("./misc.js"), exports);
|
|
20
|
-
__exportStar(require("./validation.js"), exports);
|
package/cjs/util/misc.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCodeDefaults = getCodeDefaults;
|
|
4
|
-
const allCodes = require("../defaults/index.js");
|
|
5
|
-
function getCodeDefaults(statusCode) {
|
|
6
|
-
for (const key in allCodes) {
|
|
7
|
-
const codeObject = allCodes[key];
|
|
8
|
-
if (typeof statusCode === 'string') {
|
|
9
|
-
const conv = Number(statusCode);
|
|
10
|
-
if (!isNaN(conv))
|
|
11
|
-
statusCode = conv;
|
|
12
|
-
}
|
|
13
|
-
const code = codeObject[statusCode];
|
|
14
|
-
if (!code)
|
|
15
|
-
continue;
|
|
16
|
-
return code;
|
|
17
|
-
}
|
|
18
|
-
}
|
package/cjs/util/validation.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProblemValidationError = void 0;
|
|
4
|
-
exports.validateBasicInput = validateBasicInput;
|
|
5
|
-
class ProblemValidationError extends Error {
|
|
6
|
-
errors;
|
|
7
|
-
constructor(errors) {
|
|
8
|
-
super(`Problem input is invalid:\n${errors.join('\n')}`);
|
|
9
|
-
this.errors = errors;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.ProblemValidationError = ProblemValidationError;
|
|
13
|
-
const requiredStrings = ['title', 'type'];
|
|
14
|
-
const optionalStrings = ['detail', '__problemVersion', 'instance', 'stack', 'source'];
|
|
15
|
-
function validateBasicInput(input) {
|
|
16
|
-
const errors = [];
|
|
17
|
-
if (input === null) {
|
|
18
|
-
errors.push('Input is null');
|
|
19
|
-
return new ProblemValidationError(errors);
|
|
20
|
-
}
|
|
21
|
-
if (typeof input !== 'object') {
|
|
22
|
-
errors.push('Input is not an object');
|
|
23
|
-
return new ProblemValidationError(errors);
|
|
24
|
-
}
|
|
25
|
-
const missingRequired = requiredStrings.filter(val => typeof input[val] !== 'string');
|
|
26
|
-
for (const miss of missingRequired) {
|
|
27
|
-
errors.push(`"${miss}" is missing or not a string`);
|
|
28
|
-
}
|
|
29
|
-
const wrongOptional = optionalStrings.filter((val) => val in input && input[val] !== undefined && input[val] !== null && typeof input[val] !== 'string');
|
|
30
|
-
for (const wrong of wrongOptional) {
|
|
31
|
-
errors.push(`"${wrong}" is set, and is not a string`);
|
|
32
|
-
}
|
|
33
|
-
if (!('status' in input) || typeof input.status !== 'number')
|
|
34
|
-
errors.push('Status is not a number');
|
|
35
|
-
if (errors.length > 0)
|
|
36
|
-
return new ProblemValidationError(errors);
|
|
37
|
-
return true;
|
|
38
|
-
}
|
package/cjs/util/version.d.ts
DELETED
package/cjs/util/version.js
DELETED
package/eslint.config.mjs
DELETED
package/esm/defaults/4xx.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 400: {
|
|
3
|
-
readonly status: 400;
|
|
4
|
-
readonly title: "Bad Request";
|
|
5
|
-
readonly type: "/errors/defaults/4xx/badrequest";
|
|
6
|
-
};
|
|
7
|
-
readonly 401: {
|
|
8
|
-
readonly status: 401;
|
|
9
|
-
readonly title: "Unauthorized";
|
|
10
|
-
readonly type: "/errors/defaults/4xx/unauthorized";
|
|
11
|
-
};
|
|
12
|
-
readonly 402: {
|
|
13
|
-
readonly status: 402;
|
|
14
|
-
readonly title: "Payment Required";
|
|
15
|
-
readonly type: "/errors/defaults/4xx/paymentrequired";
|
|
16
|
-
};
|
|
17
|
-
readonly 403: {
|
|
18
|
-
readonly status: 403;
|
|
19
|
-
readonly title: "Forbidden";
|
|
20
|
-
readonly type: "/errors/defaults/4xx/forbidden";
|
|
21
|
-
};
|
|
22
|
-
readonly 404: {
|
|
23
|
-
readonly status: 404;
|
|
24
|
-
readonly title: "Not Found";
|
|
25
|
-
readonly type: "/errors/defaults/4xx/notfound";
|
|
26
|
-
};
|
|
27
|
-
readonly 406: {
|
|
28
|
-
readonly status: 406;
|
|
29
|
-
readonly title: "Not Acceptable";
|
|
30
|
-
readonly type: "errors/defaults/4xx/notacceptable";
|
|
31
|
-
};
|
|
32
|
-
readonly 405: {
|
|
33
|
-
readonly status: 405;
|
|
34
|
-
readonly title: "Method Not Allowed";
|
|
35
|
-
readonly type: "errors/defaults/4xx/methodnotallowed";
|
|
36
|
-
};
|
|
37
|
-
readonly 407: {
|
|
38
|
-
readonly status: 407;
|
|
39
|
-
readonly title: "Proxy Authentication Required (RFC 7235)";
|
|
40
|
-
readonly type: "errors/defaults/4xx/proxyauthenticationrequired";
|
|
41
|
-
};
|
|
42
|
-
readonly 408: {
|
|
43
|
-
readonly status: 408;
|
|
44
|
-
readonly title: "Request Timeout";
|
|
45
|
-
readonly type: "errors/defaults/4xx/requesttimeout";
|
|
46
|
-
};
|
|
47
|
-
readonly 409: {
|
|
48
|
-
readonly status: 409;
|
|
49
|
-
readonly title: "Conflict";
|
|
50
|
-
readonly type: "errors/defaults/4xx/conflict";
|
|
51
|
-
};
|
|
52
|
-
readonly 410: {
|
|
53
|
-
readonly status: 410;
|
|
54
|
-
readonly title: "Gone";
|
|
55
|
-
readonly type: "errors/defaults/4xx/gone";
|
|
56
|
-
};
|
|
57
|
-
readonly 411: {
|
|
58
|
-
readonly status: 411;
|
|
59
|
-
readonly title: "Length Required";
|
|
60
|
-
readonly type: "errors/defaults/4xx/lengthrequired";
|
|
61
|
-
};
|
|
62
|
-
readonly 412: {
|
|
63
|
-
readonly status: 412;
|
|
64
|
-
readonly title: "Precondition Failed (RFC 7232)";
|
|
65
|
-
readonly type: "errors/defaults/4xx/preconditionfailed";
|
|
66
|
-
};
|
|
67
|
-
readonly 413: {
|
|
68
|
-
readonly status: 413;
|
|
69
|
-
readonly title: "Payload Too Large (RFC 7231)";
|
|
70
|
-
readonly type: "errors/defaults/4xx/payloadtoolarge";
|
|
71
|
-
};
|
|
72
|
-
readonly 414: {
|
|
73
|
-
readonly status: 414;
|
|
74
|
-
readonly title: "URI Too Long (RFC 7231)";
|
|
75
|
-
readonly type: "errors/defaults/4xx/uritoolong";
|
|
76
|
-
};
|
|
77
|
-
readonly 415: {
|
|
78
|
-
readonly status: 415;
|
|
79
|
-
readonly title: "Unsupported Media Type (RFC 7231)";
|
|
80
|
-
readonly type: "errors/defaults/4xx/unsupportedmediatype";
|
|
81
|
-
};
|
|
82
|
-
readonly 416: {
|
|
83
|
-
readonly status: 416;
|
|
84
|
-
readonly title: "Range Not Satisfiable (RFC 7233)";
|
|
85
|
-
readonly type: "errors/defaults/4xx/rangenotsatisfiable";
|
|
86
|
-
};
|
|
87
|
-
readonly 417: {
|
|
88
|
-
readonly status: 417;
|
|
89
|
-
readonly title: "Expectation Failed";
|
|
90
|
-
readonly type: "errors/defaults/4xx/expectationfailed";
|
|
91
|
-
};
|
|
92
|
-
readonly 418: {
|
|
93
|
-
readonly status: 418;
|
|
94
|
-
readonly title: "I'm a teapot (RFC 2324, RFC 7168)";
|
|
95
|
-
readonly type: "errors/defaults/4xx/i'mateapot";
|
|
96
|
-
};
|
|
97
|
-
readonly 421: {
|
|
98
|
-
readonly status: 421;
|
|
99
|
-
readonly title: "Misdirected Request (RFC 7540)";
|
|
100
|
-
readonly type: "errors/defaults/4xx/misdirectedrequest";
|
|
101
|
-
};
|
|
102
|
-
readonly 422: {
|
|
103
|
-
readonly status: 422;
|
|
104
|
-
readonly title: "Unprocessable Entity (WebDAV; RFC 4918)";
|
|
105
|
-
readonly type: "errors/defaults/4xx/unprocessableentity";
|
|
106
|
-
};
|
|
107
|
-
readonly 423: {
|
|
108
|
-
readonly status: 423;
|
|
109
|
-
readonly title: "Locked (WebDAV; RFC 4918)";
|
|
110
|
-
readonly type: "errors/defaults/4xx/locked";
|
|
111
|
-
};
|
|
112
|
-
readonly 424: {
|
|
113
|
-
readonly status: 424;
|
|
114
|
-
readonly title: "Failed Dependency (WebDAV; RFC 4918)";
|
|
115
|
-
readonly type: "errors/defaults/4xx/faileddependency";
|
|
116
|
-
};
|
|
117
|
-
readonly 425: {
|
|
118
|
-
readonly status: 425;
|
|
119
|
-
readonly title: "Too Early (RFC 8470)";
|
|
120
|
-
readonly type: "errors/defaults/4xx/tooearly";
|
|
121
|
-
};
|
|
122
|
-
readonly 426: {
|
|
123
|
-
readonly status: 426;
|
|
124
|
-
readonly title: "Upgrade Required";
|
|
125
|
-
readonly type: "errors/defaults/4xx/upgraderequired";
|
|
126
|
-
};
|
|
127
|
-
readonly 428: {
|
|
128
|
-
readonly status: 428;
|
|
129
|
-
readonly title: "Precondition Required (RFC 6585)";
|
|
130
|
-
readonly type: "errors/defaults/4xx/preconditionrequired";
|
|
131
|
-
};
|
|
132
|
-
readonly 429: {
|
|
133
|
-
readonly status: 429;
|
|
134
|
-
readonly title: "Too Many Requests (RFC 6585)";
|
|
135
|
-
readonly type: "errors/defaults/4xx/toomanyrequests";
|
|
136
|
-
};
|
|
137
|
-
readonly 431: {
|
|
138
|
-
readonly status: 431;
|
|
139
|
-
readonly title: "Request Header Fields Too Large (RFC 6585)";
|
|
140
|
-
readonly type: "errors/defaults/4xx/requestheaderfieldstoolarge";
|
|
141
|
-
};
|
|
142
|
-
readonly 451: {
|
|
143
|
-
readonly status: 451;
|
|
144
|
-
readonly title: "Unavailable For Legal Reasons (RFC 7725)";
|
|
145
|
-
readonly type: "errors/defaults/4xx/unavailableforlegalreasons";
|
|
146
|
-
};
|
|
147
|
-
};
|
package/esm/defaults/5xx.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 500: {
|
|
3
|
-
readonly status: 500;
|
|
4
|
-
readonly title: "Internal Server Error";
|
|
5
|
-
readonly type: "errors/defaults/5xx/internalservererror";
|
|
6
|
-
};
|
|
7
|
-
readonly 501: {
|
|
8
|
-
readonly status: 501;
|
|
9
|
-
readonly title: "Not Implemented";
|
|
10
|
-
readonly type: "errors/defaults/5xx/notimplemented";
|
|
11
|
-
};
|
|
12
|
-
readonly 502: {
|
|
13
|
-
readonly status: 502;
|
|
14
|
-
readonly title: "Bad Gateway";
|
|
15
|
-
readonly type: "errors/defaults/5xx/badgateway";
|
|
16
|
-
};
|
|
17
|
-
readonly 503: {
|
|
18
|
-
readonly status: 503;
|
|
19
|
-
readonly title: "Service Unavailable";
|
|
20
|
-
readonly type: "errors/defaults/5xx/serviceunavailable";
|
|
21
|
-
};
|
|
22
|
-
readonly 504: {
|
|
23
|
-
readonly status: 504;
|
|
24
|
-
readonly title: "Gateway Timeout";
|
|
25
|
-
readonly type: "errors/defaults/5xx/gatewaytimeout";
|
|
26
|
-
};
|
|
27
|
-
readonly 505: {
|
|
28
|
-
readonly status: 505;
|
|
29
|
-
readonly title: "HTTP Version Not Supported";
|
|
30
|
-
readonly type: "errors/defaults/5xx/httpversionnotsupported";
|
|
31
|
-
};
|
|
32
|
-
readonly 506: {
|
|
33
|
-
readonly status: 506;
|
|
34
|
-
readonly title: "Variant Also Negotiates (RFC 2295)";
|
|
35
|
-
readonly type: "errors/defaults/5xx/variantalsonegotiates";
|
|
36
|
-
};
|
|
37
|
-
readonly 507: {
|
|
38
|
-
readonly status: 507;
|
|
39
|
-
readonly title: "Insufficient Storage (WebDAV; RFC 4918)";
|
|
40
|
-
readonly type: "errors/defaults/5xx/insufficientstorage";
|
|
41
|
-
};
|
|
42
|
-
readonly 508: {
|
|
43
|
-
readonly status: 508;
|
|
44
|
-
readonly title: "Loop Detected (WebDAV; RFC 5842)";
|
|
45
|
-
readonly type: "errors/defaults/5xx/loopdetected";
|
|
46
|
-
};
|
|
47
|
-
readonly 511: {
|
|
48
|
-
readonly status: 511;
|
|
49
|
-
readonly title: "Network Authentication Required (RFC 6585)";
|
|
50
|
-
readonly type: "errors/defaults/5xx/networkauthenticationrequired";
|
|
51
|
-
};
|
|
52
|
-
readonly 510: {
|
|
53
|
-
readonly status: 510;
|
|
54
|
-
readonly title: "Not Extended (RFC 2774)";
|
|
55
|
-
readonly type: "errors/defaults/5xx/notextended";
|
|
56
|
-
};
|
|
57
|
-
};
|
package/esm/defaults/aws.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 460: {
|
|
3
|
-
readonly status: 460;
|
|
4
|
-
readonly title: "Client closed connection before idle timeout period elapsed";
|
|
5
|
-
readonly type: "/errors/defaults/aws/clientclosedbeforetimeout";
|
|
6
|
-
};
|
|
7
|
-
readonly 463: {
|
|
8
|
-
readonly status: 463;
|
|
9
|
-
readonly title: "X-Forwarded-For contains more than 30 ips";
|
|
10
|
-
readonly type: "/errors/defaults/aws/toomanyips";
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 520: {
|
|
3
|
-
readonly status: 520;
|
|
4
|
-
readonly title: "Web Server returned an unknown error";
|
|
5
|
-
readonly type: "/errors/defaults/cloudflare/unknownerror";
|
|
6
|
-
};
|
|
7
|
-
readonly 521: {
|
|
8
|
-
readonly status: 521;
|
|
9
|
-
readonly title: "Web server is down";
|
|
10
|
-
readonly type: "/errors/defaults/cloudflare/webserverdown";
|
|
11
|
-
};
|
|
12
|
-
readonly 522: {
|
|
13
|
-
readonly status: 522;
|
|
14
|
-
readonly title: "Connection timed out";
|
|
15
|
-
readonly type: "/errors/defaults/cloudflare/connectiontimeout";
|
|
16
|
-
};
|
|
17
|
-
readonly 523: {
|
|
18
|
-
readonly status: 523;
|
|
19
|
-
readonly title: "Origin is unreachable";
|
|
20
|
-
readonly type: "/errors/defaults/cloudflare/originunreachable";
|
|
21
|
-
};
|
|
22
|
-
readonly 524: {
|
|
23
|
-
readonly status: 524;
|
|
24
|
-
readonly title: "A timeout occurred";
|
|
25
|
-
readonly type: "/errors/defaults/cloudflare/timeout";
|
|
26
|
-
};
|
|
27
|
-
readonly 525: {
|
|
28
|
-
readonly status: 525;
|
|
29
|
-
readonly title: "SSL handshake failed";
|
|
30
|
-
readonly type: "/errors/defaults/cloudflare/sslhandshakefail";
|
|
31
|
-
};
|
|
32
|
-
readonly 526: {
|
|
33
|
-
readonly status: 526;
|
|
34
|
-
readonly title: "Invalid SSL certificate";
|
|
35
|
-
readonly type: "/errors/defaults/cloudflare/invalidssl";
|
|
36
|
-
};
|
|
37
|
-
readonly 527: {
|
|
38
|
-
readonly status: 527;
|
|
39
|
-
readonly title: "Railgun Listener to origin error";
|
|
40
|
-
readonly type: "/errors/defaults/cloudflare/railgunoriginerr";
|
|
41
|
-
};
|
|
42
|
-
readonly 530: {
|
|
43
|
-
readonly status: 530;
|
|
44
|
-
readonly title: "Cloudflare returned 1xxx error";
|
|
45
|
-
readonly type: "/errors/defaults/cloudflare/1xxx";
|
|
46
|
-
};
|
|
47
|
-
};
|
package/esm/defaults/iis.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 440: {
|
|
3
|
-
readonly status: 440;
|
|
4
|
-
readonly title: "Login Time-out";
|
|
5
|
-
readonly type: "/errors/defaults/iis/logintimeout";
|
|
6
|
-
};
|
|
7
|
-
readonly 449: {
|
|
8
|
-
readonly status: 449;
|
|
9
|
-
readonly title: "Retry with required information";
|
|
10
|
-
readonly type: "/errors/defaults/iis/retrywith";
|
|
11
|
-
};
|
|
12
|
-
readonly 451: {
|
|
13
|
-
readonly status: 451;
|
|
14
|
-
readonly title: "Redirect";
|
|
15
|
-
readonly type: "/errors/defaults/iis/redirect";
|
|
16
|
-
};
|
|
17
|
-
};
|
package/esm/defaults/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { statusCodes as codes4xx } from '../defaults/4xx.js';
|
|
2
|
-
export { statusCodes as codes5xx } from '../defaults/5xx.js';
|
|
3
|
-
export { statusCodes as codesAws } from '../defaults/aws.js';
|
|
4
|
-
export { statusCodes as codesCloudflare } from '../defaults/cloudflare.js';
|
|
5
|
-
export { statusCodes as codesIis } from '../defaults/iis.js';
|
|
6
|
-
export { statusCodes as codesNginx } from '../defaults/nginx.js';
|
|
7
|
-
export { otherErrors } from '../defaults/others.js';
|
package/esm/defaults/nginx.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare const statusCodes: {
|
|
2
|
-
readonly 444: {
|
|
3
|
-
readonly status: 494;
|
|
4
|
-
readonly title: "No Response";
|
|
5
|
-
readonly type: "/errors/defaults/nginx/noresponse";
|
|
6
|
-
};
|
|
7
|
-
readonly 494: {
|
|
8
|
-
readonly status: 494;
|
|
9
|
-
readonly title: "Request header too large";
|
|
10
|
-
readonly type: "/errors/defaults/nginx/headertoolarge";
|
|
11
|
-
};
|
|
12
|
-
readonly 495: {
|
|
13
|
-
readonly status: 495;
|
|
14
|
-
readonly title: "SSL Certificate Error";
|
|
15
|
-
readonly type: "/errors/defaults/nginx/sslcerterr";
|
|
16
|
-
};
|
|
17
|
-
readonly 496: {
|
|
18
|
-
readonly status: 496;
|
|
19
|
-
readonly title: "SSL Certificate Required";
|
|
20
|
-
readonly type: "/errors/defaults/nginx/sslcertrequired";
|
|
21
|
-
};
|
|
22
|
-
readonly 497: {
|
|
23
|
-
readonly status: 497;
|
|
24
|
-
readonly title: "HTTP Request Sent to HTTPS Port";
|
|
25
|
-
readonly type: "/errors/defaults/nginx/httpreqtohttpsport";
|
|
26
|
-
};
|
|
27
|
-
readonly 499: {
|
|
28
|
-
readonly status: 499;
|
|
29
|
-
readonly title: "Client Closed Request";
|
|
30
|
-
readonly type: "/errors/defaults/nginx/clientclosedreq";
|
|
31
|
-
};
|
|
32
|
-
};
|
package/esm/defaults/others.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const otherErrors: {
|
|
2
|
-
readonly unknown: {
|
|
3
|
-
readonly status: 500;
|
|
4
|
-
readonly title: "Unknown error";
|
|
5
|
-
readonly type: "/errors/defaults/others/unknown";
|
|
6
|
-
};
|
|
7
|
-
readonly corsError: {
|
|
8
|
-
readonly status: 401;
|
|
9
|
-
readonly title: "Request not allowed by CORS policy";
|
|
10
|
-
readonly type: "/errors/defaults/others/corsdenied";
|
|
11
|
-
};
|
|
12
|
-
readonly problemParseError: {
|
|
13
|
-
readonly status: 1000;
|
|
14
|
-
readonly title: "Could not parse problem details";
|
|
15
|
-
readonly type: "/errors/defaults/others/problemparseerror";
|
|
16
|
-
};
|
|
17
|
-
readonly problemJsonError: {
|
|
18
|
-
readonly status: 1000;
|
|
19
|
-
readonly title: "Could not parse problem JSON";
|
|
20
|
-
readonly type: "/errors/defaults/others/problemjsonerror";
|
|
21
|
-
};
|
|
22
|
-
readonly notAnError: {
|
|
23
|
-
readonly status: 1000;
|
|
24
|
-
readonly title: "Not an error";
|
|
25
|
-
readonly type: "/errors/defaults/others/notanerror";
|
|
26
|
-
};
|
|
27
|
-
readonly networkError: {
|
|
28
|
-
readonly status: 1000;
|
|
29
|
-
readonly title: "Network error";
|
|
30
|
-
readonly type: "/errors/defaults/others/networkerror";
|
|
31
|
-
};
|
|
32
|
-
readonly inputValidationError: {
|
|
33
|
-
readonly status: 400;
|
|
34
|
-
readonly title: "Input failed validation";
|
|
35
|
-
readonly type: "/errors/defaults/others/validationerror";
|
|
36
|
-
};
|
|
37
|
-
};
|
package/esm/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { PartialMiddlewareOptions } from '../typings/middleware.js';
|
|
2
|
-
import { MiddlewareBase } from './base.js';
|
|
3
|
-
type InterceptorArray = [undefined, (error: unknown) => Promise<never>];
|
|
4
|
-
export declare class AxiosMiddleware extends MiddlewareBase {
|
|
5
|
-
name: string;
|
|
6
|
-
constructor(options?: PartialMiddlewareOptions);
|
|
7
|
-
interceptor: (error: unknown) => Promise<never>;
|
|
8
|
-
/**
|
|
9
|
-
* @example instance.interceptors.response.use(...middleware.use())
|
|
10
|
-
*/
|
|
11
|
-
use: () => InterceptorArray;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
package/esm/middleware/base.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Problem } from '../problem.js';
|
|
2
|
-
import type { ProblemOpts } from '../typings/index.js';
|
|
3
|
-
import type { MiddlewareOptions, PartialMiddlewareOptions, ProblemListener } from '../typings/middleware.js';
|
|
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
|
-
readonly 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
|
-
readonly enableFallback = true;
|
|
14
|
-
constructor(defaultOptions: MiddlewareOptions, options?: PartialMiddlewareOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Parse input using parsers
|
|
17
|
-
*/
|
|
18
|
-
protected parse: (input: unknown) => Problem[];
|
|
19
|
-
protected fallback: ProblemOpts;
|
|
20
|
-
protected problemListeners: ProblemListener[];
|
|
21
|
-
protected emit: (list: Problem[]) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Listen to problems
|
|
24
|
-
*/
|
|
25
|
-
onProblem: (listener: ProblemListener) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Un-listen to problems
|
|
28
|
-
*/
|
|
29
|
-
offProblem: (listener: ProblemListener) => void;
|
|
30
|
-
}
|
package/esm/package.json
DELETED
package/esm/parsers/axios.d.ts
DELETED
package/esm/parsers/tsoa.d.ts
DELETED
package/esm/parsers/zod.d.ts
DELETED