@tsed/platform-exceptions 7.79.4 → 7.80.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/lib/types-esm/components/ErrorFilter.d.ts +15 -0
- package/lib/types-esm/components/ExceptionFilter.d.ts +6 -0
- package/lib/types-esm/components/MongooseErrorFilter.d.ts +5 -0
- package/lib/types-esm/components/StringErrorFilter.d.ts +5 -0
- package/lib/types-esm/decorators/catch.d.ts +7 -0
- package/lib/types-esm/domain/ExceptionFiltersContainer.d.ts +14 -0
- package/lib/types-esm/domain/ExceptionSchema.d.ts +1 -0
- package/lib/types-esm/errors/ResourceNotFound.d.ts +5 -0
- package/lib/types-esm/index.d.ts +13 -0
- package/lib/types-esm/interfaces/ExceptionFilterMethods.d.ts +4 -0
- package/lib/types-esm/services/PlatformExceptions.d.ts +15 -0
- package/package.json +22 -18
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -14
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -42
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Env } from "@tsed/core";
|
|
2
|
+
import { BaseContext } from "@tsed/di";
|
|
3
|
+
import type { ExceptionFilterMethods } from "../interfaces/ExceptionFilterMethods.js";
|
|
4
|
+
export declare class ErrorFilter implements ExceptionFilterMethods {
|
|
5
|
+
catch(error: any, ctx: BaseContext): void;
|
|
6
|
+
mapError(error: any, env?: Env): {
|
|
7
|
+
name: any;
|
|
8
|
+
message: any;
|
|
9
|
+
status: any;
|
|
10
|
+
errors: any;
|
|
11
|
+
stack: any;
|
|
12
|
+
};
|
|
13
|
+
protected getErrors(error: any): any;
|
|
14
|
+
protected getHeaders(error: any): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Type } from "@tsed/core";
|
|
2
|
+
import type { ExceptionFilterMethods } from "../interfaces/ExceptionFilterMethods.js";
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export type ExceptionFilterKey = Type<any> | Symbol | string;
|
|
7
|
+
/**
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export declare const ExceptionFiltersContainer: Map<ExceptionFilterKey, Type<ExceptionFilterMethods<unknown>>>;
|
|
11
|
+
/**
|
|
12
|
+
* @ignore
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerExceptionType(type: ExceptionFilterKey, token: Type<ExceptionFilterMethods>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./components/ErrorFilter.js";
|
|
5
|
+
export * from "./components/ExceptionFilter.js";
|
|
6
|
+
export * from "./components/MongooseErrorFilter.js";
|
|
7
|
+
export * from "./components/StringErrorFilter.js";
|
|
8
|
+
export * from "./decorators/catch.js";
|
|
9
|
+
export * from "./domain/ExceptionFiltersContainer.js";
|
|
10
|
+
export * from "./domain/ExceptionSchema.js";
|
|
11
|
+
export * from "./errors/ResourceNotFound.js";
|
|
12
|
+
export * from "./interfaces/ExceptionFilterMethods.js";
|
|
13
|
+
export * from "./services/PlatformExceptions.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DIContext, InjectorService } from "@tsed/di";
|
|
2
|
+
import { ExceptionFilterKey } from "../domain/ExceptionFiltersContainer.js";
|
|
3
|
+
import { ExceptionFilterMethods } from "../interfaces/ExceptionFilterMethods.js";
|
|
4
|
+
/**
|
|
5
|
+
* Catch all errors and return the json error with the right status code when it's possible.
|
|
6
|
+
*
|
|
7
|
+
* @platform
|
|
8
|
+
*/
|
|
9
|
+
export declare class PlatformExceptions {
|
|
10
|
+
types: Map<ExceptionFilterKey, ExceptionFilterMethods>;
|
|
11
|
+
injector: InjectorService;
|
|
12
|
+
$onInit(): void;
|
|
13
|
+
catch(error: unknown, ctx: DIContext): void;
|
|
14
|
+
resourceNotFound(ctx: DIContext): void;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-exceptions",
|
|
3
|
-
"version": "7.79.4",
|
|
4
3
|
"description": "Platform exceptions module for Ts.ED Framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.1",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/cjs/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn barrels && yarn build:ts",
|
|
17
19
|
"barrels": "barrels",
|
|
18
|
-
"test": "
|
|
19
|
-
"build:ts": "tsc --build tsconfig.json
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
22
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"tslib": "2.6.1"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
|
-
"@tsed/barrels": "7.
|
|
26
|
-
"@tsed/core": "7.
|
|
27
|
-
"@tsed/di": "7.
|
|
28
|
-
"@tsed/exceptions": "7.
|
|
29
|
-
"@tsed/schema": "7.
|
|
30
|
-
"@tsed/typescript": "7.
|
|
28
|
+
"@tsed/barrels": "7.80.1",
|
|
29
|
+
"@tsed/core": "7.80.1",
|
|
30
|
+
"@tsed/di": "7.80.1",
|
|
31
|
+
"@tsed/exceptions": "7.80.1",
|
|
32
|
+
"@tsed/schema": "7.80.1",
|
|
33
|
+
"@tsed/typescript": "7.80.1",
|
|
31
34
|
"eslint": "^8.57.0",
|
|
32
|
-
"
|
|
35
|
+
"typescript": "4.9.5",
|
|
36
|
+
"vitest": "2.0.4"
|
|
33
37
|
},
|
|
34
38
|
"peerDependencies": {
|
|
35
|
-
"@tsed/core": "7.
|
|
36
|
-
"@tsed/di": "7.
|
|
37
|
-
"@tsed/exceptions": "7.
|
|
38
|
-
"@tsed/schema": "7.
|
|
39
|
+
"@tsed/core": "7.80.1",
|
|
40
|
+
"@tsed/di": "7.80.1",
|
|
41
|
+
"@tsed/exceptions": "7.80.1",
|
|
42
|
+
"@tsed/schema": "7.80.1"
|
|
39
43
|
},
|
|
40
44
|
"peerDependenciesMeta": {
|
|
41
45
|
"@tsed/core": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/jest.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
...require("@tsed/jest-config"),
|
|
6
|
-
coverageThreshold: {
|
|
7
|
-
global: {
|
|
8
|
-
statements: 100,
|
|
9
|
-
branches: 95.55,
|
|
10
|
-
functions: 100,
|
|
11
|
-
lines: 100
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types",
|
|
10
|
-
"composite": true,
|
|
11
|
-
"noEmit": false
|
|
12
|
-
},
|
|
13
|
-
"include": ["src", "src/**/*.json"],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"node_modules",
|
|
16
|
-
"test",
|
|
17
|
-
"lib",
|
|
18
|
-
"benchmark",
|
|
19
|
-
"coverage",
|
|
20
|
-
"spec",
|
|
21
|
-
"**/*.benchmark.ts",
|
|
22
|
-
"**/*.spec.ts",
|
|
23
|
-
"keys",
|
|
24
|
-
"jest.config.js",
|
|
25
|
-
"**/__mock__/**",
|
|
26
|
-
"webpack.config.js"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "../../core"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../di"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../specs/exceptions"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../specs/schema"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|