@emoyly/problem 7.0.6 → 8.0.1
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 +1 -1
- package/cjs/defaults/4xx.d.ts +144 -144
- package/cjs/defaults/5xx.d.ts +54 -54
- package/cjs/defaults/aws.d.ts +8 -8
- package/cjs/defaults/cloudflare.d.ts +44 -44
- package/cjs/defaults/iis.d.ts +12 -12
- package/cjs/defaults/nginx.d.ts +24 -24
- package/cjs/defaults/others.d.ts +28 -28
- package/cjs/middleware/axios.js +1 -1
- package/cjs/middleware/base.d.ts +1 -1
- package/cjs/middleware/base.js +4 -4
- package/cjs/middleware/express.js +10 -28
- package/cjs/parsers/axios.js +9 -8
- package/cjs/parsers/jsonwebtoken.js +3 -0
- package/cjs/parsers/mikroorm.js +1 -0
- package/cjs/parsers/tsoa.js +3 -2
- package/cjs/parsers/zod.js +2 -1
- package/cjs/problem.d.ts +7 -7
- package/cjs/problem.js +41 -32
- package/cjs/tsconfig.tsbuildinfo +1 -1
- package/cjs/typings/codes.d.ts +2 -2
- package/cjs/typings/problem.d.ts +13 -2
- package/cjs/util/getProblems.d.ts +4 -4
- package/cjs/util/getProblems.js +20 -16
- package/cjs/util/index.d.ts +1 -1
- package/cjs/util/index.js +1 -1
- package/cjs/util/misc.d.ts +2 -2
- package/cjs/util/misc.js +3 -4
- package/cjs/util/validation.d.ts +5 -0
- package/cjs/util/validation.js +38 -0
- package/cjs/util/version.d.ts +1 -2
- package/cjs/util/version.js +1 -16
- package/esm/defaults/4xx.d.ts +144 -144
- package/esm/defaults/5xx.d.ts +54 -54
- package/esm/defaults/aws.d.ts +8 -8
- package/esm/defaults/cloudflare.d.ts +44 -44
- package/esm/defaults/iis.d.ts +12 -12
- package/esm/defaults/nginx.d.ts +24 -24
- package/esm/defaults/others.d.ts +28 -28
- package/esm/middleware/axios.js +1 -1
- package/esm/middleware/base.d.ts +1 -1
- package/esm/middleware/base.js +4 -4
- package/esm/middleware/express.js +11 -29
- package/esm/parsers/axios.js +9 -8
- package/esm/parsers/jsonwebtoken.js +3 -0
- package/esm/parsers/mikroorm.js +1 -0
- package/esm/parsers/tsoa.js +3 -2
- package/esm/parsers/zod.js +2 -1
- package/esm/problem.d.ts +7 -7
- package/esm/problem.js +41 -32
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/typings/codes.d.ts +2 -2
- package/esm/typings/problem.d.ts +13 -2
- package/esm/util/getProblems.d.ts +4 -4
- package/esm/util/getProblems.js +20 -16
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +1 -1
- package/esm/util/misc.d.ts +2 -2
- package/esm/util/misc.js +2 -3
- package/esm/util/validation.d.ts +5 -0
- package/esm/util/validation.js +33 -0
- package/esm/util/version.d.ts +1 -2
- package/esm/util/version.js +1 -15
- package/package.json +18 -13
- package/tsconfig.json +5 -1
- package/.editorconfig +0 -11
- package/.vscode/extensions.json +0 -7
- package/.vscode/settings.json +0 -2
- package/cjs/util/defaults.d.ts +0 -4
- package/cjs/util/defaults.js +0 -7
- package/esm/util/defaults.d.ts +0 -4
- package/esm/util/defaults.js +0 -4
- package/scripts/ensureCorrectVersion.js +0 -20
- package/src/defaults/4xx.ts +0 -149
- package/src/defaults/5xx.ts +0 -59
- package/src/defaults/aws.ts +0 -14
- package/src/defaults/cloudflare.ts +0 -50
- package/src/defaults/iis.ts +0 -19
- package/src/defaults/index.ts +0 -7
- package/src/defaults/nginx.ts +0 -34
- package/src/defaults/others.ts +0 -37
- package/src/index.ts +0 -4
- package/src/middleware/axios.ts +0 -28
- package/src/middleware/base.ts +0 -78
- package/src/middleware/express.ts +0 -71
- package/src/parsers/axios.ts +0 -60
- package/src/parsers/jsonwebtoken.ts +0 -107
- package/src/parsers/mikroorm.ts +0 -21
- package/src/parsers/tsoa.ts +0 -26
- package/src/parsers/zod.ts +0 -23
- package/src/problem.ts +0 -56
- package/src/typings/codes.ts +0 -6
- package/src/typings/index.ts +0 -4
- package/src/typings/middleware.ts +0 -14
- package/src/typings/parser.ts +0 -3
- package/src/typings/problem.ts +0 -27
- package/src/util/defaults.ts +0 -4
- package/src/util/getProblems.ts +0 -56
- package/src/util/index.ts +0 -4
- package/src/util/misc.ts +0 -21
- package/src/util/problemArray.ts +0 -21
- package/src/util/version.ts +0 -16
package/src/util/problemArray.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Problem } from '../problem.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether a given object is an array of Problem objects
|
|
5
|
-
* @param input Object to test
|
|
6
|
-
* @param allowEmpty If true or undefined, an empty array is considered a Problem array. If false, an empty array is not considered a Problem array.
|
|
7
|
-
*/
|
|
8
|
-
export function isProblemArray(input: unknown, allowEmpty?: boolean): input is Problem[] {
|
|
9
|
-
if (!Array.isArray(input)) return false
|
|
10
|
-
|
|
11
|
-
if (input.length < 1) {
|
|
12
|
-
if (typeof allowEmpty !== 'boolean') {
|
|
13
|
-
console.warn(new Error('@emoyly/problem -> isProblemArray: input is an empty array, and therefore is considered a Problem array. If this is not the intended behavior, consider setting the "onlyWhenContent" argument to true.'))
|
|
14
|
-
return true
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return allowEmpty
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return input.every(val => val instanceof Problem)
|
|
21
|
-
}
|
package/src/util/version.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const version = '7.0.6'
|
|
2
|
-
export const major = Number(version.split('.')[0])
|
|
3
|
-
|
|
4
|
-
export function isCompatibleVersion(inputVersion: string) {
|
|
5
|
-
// TODO: Remove this
|
|
6
|
-
if (inputVersion === 'lua-dev') return true
|
|
7
|
-
|
|
8
|
-
const parts = inputVersion.split('.')
|
|
9
|
-
const inputMajor = Number(parts[0])
|
|
10
|
-
|
|
11
|
-
if (parts.length !== 3) return false
|
|
12
|
-
if (isNaN(inputMajor)) return false
|
|
13
|
-
if (inputMajor !== major) return false
|
|
14
|
-
|
|
15
|
-
return true
|
|
16
|
-
}
|