@tsed/platform-exceptions 7.0.0-beta.3 → 7.0.0-beta.6
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/cjs/components/ErrorFilter.js +1 -1
- package/lib/cjs/components/ExceptionFilter.js +1 -1
- package/lib/cjs/components/MongooseErrorFilter.js +1 -1
- package/lib/cjs/components/StringErrorFilter.js +1 -1
- package/lib/cjs/domain/ExceptionSchema.js +1 -1
- package/lib/cjs/domain/ExceptionSchema.js.map +1 -1
- package/lib/cjs/index.js +13 -15
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/PlatformExceptions.js +3 -3
- package/lib/cjs/services/PlatformExceptions.js.map +1 -1
- package/lib/esm/components/ErrorFilter.js +1 -1
- package/lib/esm/components/ExceptionFilter.js +2 -2
- package/lib/esm/components/MongooseErrorFilter.js +2 -2
- package/lib/esm/components/StringErrorFilter.js +1 -1
- package/lib/esm/decorators/catch.js +1 -1
- package/lib/esm/index.js +13 -15
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/PlatformExceptions.js +6 -6
- package/lib/types/index.d.ts +6 -3
- package/package.json +29 -13
- package/readme.md +1 -2
- package/tsconfig.compile.esm.json +1 -12
|
@@ -16,7 +16,7 @@ let ExceptionFilter = class ExceptionFilter extends ErrorFilter_1.ErrorFilter {
|
|
|
16
16
|
response.setHeaders(this.getHeaders(error)).contentType("application/json").status(error.status).body(err);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
ExceptionFilter =
|
|
19
|
+
ExceptionFilter = tslib_1.__decorate([
|
|
20
20
|
(0, catch_1.Catch)(exceptions_1.Exception)
|
|
21
21
|
], ExceptionFilter);
|
|
22
22
|
exports.ExceptionFilter = ExceptionFilter;
|
|
@@ -10,7 +10,7 @@ let MongooseErrorFilter = class MongooseErrorFilter extends ErrorFilter_1.ErrorF
|
|
|
10
10
|
return super.catch(new exceptions_1.BadRequest(error.message, error), ctx);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
MongooseErrorFilter =
|
|
13
|
+
MongooseErrorFilter = tslib_1.__decorate([
|
|
14
14
|
(0, catch_1.Catch)("MongooseError", "MongoError")
|
|
15
15
|
], MongooseErrorFilter);
|
|
16
16
|
exports.MongooseErrorFilter = MongooseErrorFilter;
|
|
@@ -9,7 +9,7 @@ let StringErrorFilter = class StringErrorFilter {
|
|
|
9
9
|
ctx.response.status(404).body(toHTML(error));
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
StringErrorFilter =
|
|
12
|
+
StringErrorFilter = tslib_1.__decorate([
|
|
13
13
|
(0, catch_1.Catch)(String)
|
|
14
14
|
], StringErrorFilter);
|
|
15
15
|
exports.StringErrorFilter = StringErrorFilter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const Exceptions =
|
|
4
|
+
const Exceptions = tslib_1.__importStar(require("@tsed/exceptions"));
|
|
5
5
|
const exceptions_1 = require("@tsed/exceptions");
|
|
6
6
|
const schema_1 = require("@tsed/schema");
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExceptionSchema.js","sourceRoot":"","sources":["../../../src/domain/ExceptionSchema.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ExceptionSchema.js","sourceRoot":"","sources":["../../../src/domain/ExceptionSchema.ts"],"names":[],"mappings":";;;AAAA,qEAA+C;AAC/C,iDAA2C;AAC3C,yCAAuG;AAEvG;;GAEG;AACH,MAAM,WAAW,GAAG,IAAA,eAAM,EAAC;IACzB,IAAI,EAAE,IAAA,eAAM,GAAE,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,gBAAgB,CAAC;IACvD,OAAO,EAAE,IAAA,eAAM,GA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C,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,kCAAkC,CAAC;aAC1H,CAAC,CAAC;YAEH,IAAA,0BAAiB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC1C;KACF;AACH,CAAC,CAAC,CAAC","sourcesContent":["import * as Exceptions from \"@tsed/exceptions\";\nimport {Exception} from \"@tsed/exceptions\";\nimport {array, defineStatusModel, from, getStatusConstant, number, object, string} from \"@tsed/schema\";\n\n/**\n * @ignore\n */\nconst ErrorSchema = object({\n name: string().required().description(\"The error name\"),\n message: string().required().description(\"An error message\")\n})\n .label(\"GenericError\")\n .unknown();\n\nfrom(Exception).properties({\n name: string().required().description(\"The error name\"),\n message: string().required().description(\"An error message\"),\n status: number().required().description(\"The status code of the exception\"),\n errors: array().items(ErrorSchema).description(\"A list of related errors\"),\n stack: string().description(\"The stack trace (only in development mode)\")\n});\n\n// Auto load models for all Exceptions\nObject.values(Exceptions).forEach((target: any) => {\n if (target !== Exception && target.STATUS) {\n if (target.STATUS > 302) {\n const name = getStatusConstant(target.STATUS);\n from(target).properties({\n name: string().required().example(name).default(name).description(\"The error name\"),\n status: number().required().example(target.STATUS).default(target.STATUS).description(\"The status code of the exception\")\n });\n\n defineStatusModel(target.STATUS, target);\n }\n }\n});\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(0, tslib_1.__exportStar)(require("./interfaces/ExceptionFilterMethods"), exports);
|
|
15
|
-
// middlewares
|
|
16
|
-
(0, tslib_1.__exportStar)(require("./services/PlatformExceptions"), exports);
|
|
17
|
-
// errors
|
|
18
|
-
(0, tslib_1.__exportStar)(require("./errors/ResourceNotFound"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./components/ErrorFilter"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/ExceptionFilter"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/MongooseErrorFilter"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/StringErrorFilter"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./decorators/catch"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./domain/ExceptionFiltersContainer"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./domain/ExceptionSchema"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./errors/ResourceNotFound"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./interfaces/ExceptionFilterMethods"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./services/PlatformExceptions"), exports);
|
|
19
17
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,mEAAyC;AACzC,uEAA6C;AAC7C,2EAAiD;AACjD,yEAA+C;AAC/C,6DAAmC;AACnC,6EAAmD;AACnD,mEAAyC;AACzC,oEAA0C;AAC1C,8EAAoD;AACpD,wEAA8C","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/ErrorFilter\";\nexport * from \"./components/ExceptionFilter\";\nexport * from \"./components/MongooseErrorFilter\";\nexport * from \"./components/StringErrorFilter\";\nexport * from \"./decorators/catch\";\nexport * from \"./domain/ExceptionFiltersContainer\";\nexport * from \"./domain/ExceptionSchema\";\nexport * from \"./errors/ResourceNotFound\";\nexport * from \"./interfaces/ExceptionFilterMethods\";\nexport * from \"./services/PlatformExceptions\";\n"]}
|
|
@@ -42,11 +42,11 @@ let PlatformExceptions = class PlatformExceptions {
|
|
|
42
42
|
return this.catch(new ResourceNotFound_1.ResourceNotFound(ctx.request.url), ctx);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
tslib_1.__decorate([
|
|
46
46
|
(0, di_1.Inject)(),
|
|
47
|
-
|
|
47
|
+
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
48
48
|
], PlatformExceptions.prototype, "injector", void 0);
|
|
49
|
-
PlatformExceptions =
|
|
49
|
+
PlatformExceptions = tslib_1.__decorate([
|
|
50
50
|
(0, di_1.Injectable)({
|
|
51
51
|
imports: [ErrorFilter_1.ErrorFilter, ExceptionFilter_1.ExceptionFilter, MongooseErrorFilter_1.MongooseErrorFilter, StringErrorFilter_1.StringErrorFilter]
|
|
52
52
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformExceptions.js","sourceRoot":"","sources":["../../../src/services/PlatformExceptions.ts"],"names":[],"mappings":";;;;AAAA,qCAAwD;AACxD,iCAA0E;AAC1E,2DAAsD;AACtD,mEAA8D;AAC9D,2EAAsE;AACtE,uEAAkE;AAClE,mFAAkG;AAClG,iEAA4D;AAG5D;;;;GAIG;AAIH,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAA/B;QACE,UAAK,GAAoD,IAAI,GAAG,EAAE,CAAC;IAiCrE,CAAC;IA5BC,OAAO;QACL,qDAAyB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAc,EAAE,GAAgB;QACpC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C;AAJf,kBAAkB;IAH9B,IAAA,eAAU,EAAC;QACV,OAAO,EAAE,CAAC,yBAAW,EAAE,iCAAe,EAAE,yCAAmB,EAAE,qCAAiB,CAAC;KAChF,CAAC;GACW,kBAAkB,CAkC9B;AAlCY,gDAAkB","sourcesContent":["import {ancestorsOf, classOf, nameOf} from \"@tsed/core\";\nimport {BaseContext, Inject, Injectable, InjectorService} from \"@tsed/di\";\nimport {ErrorFilter} from \"../components/ErrorFilter\";\nimport {ExceptionFilter} from \"../components/ExceptionFilter\";\nimport {MongooseErrorFilter} from \"../components/MongooseErrorFilter\";\nimport {StringErrorFilter} from \"../components/StringErrorFilter\";\nimport {ExceptionFilterKey, ExceptionFiltersContainer} from \"../domain/ExceptionFiltersContainer\";\nimport {ResourceNotFound} from \"../errors/ResourceNotFound\";\nimport {ExceptionFilterMethods} from \"../interfaces/ExceptionFilterMethods\";\n\n/**\n * Catch all errors and return the json error with the right status code when it's possible.\n *\n * @platform\n */\n@Injectable({\n imports: [ErrorFilter, ExceptionFilter, MongooseErrorFilter, StringErrorFilter]\n})\nexport class PlatformExceptions {\n types: Map<ExceptionFilterKey, ExceptionFilterMethods> = new Map();\n\n @Inject()\n injector: InjectorService;\n\n $onInit() {\n ExceptionFiltersContainer.forEach((token, type) => {\n this.types.set(type, this.injector.get(token)!);\n });\n }\n\n catch(error: unknown, ctx: BaseContext) {\n const name = nameOf(classOf(error));\n\n if (name && this.types.has(name)) {\n return this.types.get(name)!.catch(error, ctx);\n }\n\n const target = ancestorsOf(error)\n .reverse()\n .find((target) => this.types.has(target));\n\n if (target) {\n return this.types.get(target)!.catch(error, ctx);\n }\n\n // default\n return this.types.get(Error)!.catch(error, ctx);\n }\n\n resourceNotFound(ctx: BaseContext) {\n return this.catch(new ResourceNotFound(ctx.request.url), ctx);\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Env } from "@tsed/core";
|
|
3
|
-
import { Catch } from "../decorators/catch";
|
|
3
|
+
import { Catch } from "../decorators/catch.js";
|
|
4
4
|
let ErrorFilter = class ErrorFilter {
|
|
5
5
|
catch(error, ctx) {
|
|
6
6
|
const { response, logger, env } = ctx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Exception } from "@tsed/exceptions";
|
|
3
|
-
import { Catch } from "../decorators/catch";
|
|
4
|
-
import { ErrorFilter } from "./ErrorFilter";
|
|
3
|
+
import { Catch } from "../decorators/catch.js";
|
|
4
|
+
import { ErrorFilter } from "./ErrorFilter.js";
|
|
5
5
|
let ExceptionFilter = class ExceptionFilter extends ErrorFilter {
|
|
6
6
|
catch(error, ctx) {
|
|
7
7
|
const { response, logger, env } = ctx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { BadRequest } from "@tsed/exceptions";
|
|
3
|
-
import { Catch } from "../decorators/catch";
|
|
4
|
-
import { ErrorFilter } from "./ErrorFilter";
|
|
3
|
+
import { Catch } from "../decorators/catch.js";
|
|
4
|
+
import { ErrorFilter } from "./ErrorFilter.js";
|
|
5
5
|
let MongooseErrorFilter = class MongooseErrorFilter extends ErrorFilter {
|
|
6
6
|
catch(error, ctx) {
|
|
7
7
|
return super.catch(new BadRequest(error.message, error), ctx);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { Catch } from "../decorators/catch";
|
|
2
|
+
import { Catch } from "../decorators/catch.js";
|
|
3
3
|
const toHTML = (message = "") => message.replace(/\n/gi, "<br />");
|
|
4
4
|
let StringErrorFilter = class StringErrorFilter {
|
|
5
5
|
catch(error, ctx) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerProvider } from "@tsed/di";
|
|
2
|
-
import { registerExceptionType } from "../domain/ExceptionFiltersContainer";
|
|
2
|
+
import { registerExceptionType } from "../domain/ExceptionFiltersContainer.js";
|
|
3
3
|
/**
|
|
4
4
|
* Register a new class to handle an specific exception.
|
|
5
5
|
* @decorator
|
package/lib/esm/index.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./components/ErrorFilter";
|
|
5
|
-
export * from "./components/
|
|
6
|
-
|
|
7
|
-
export * from "./
|
|
8
|
-
|
|
9
|
-
export * from "./domain/ExceptionFiltersContainer";
|
|
10
|
-
export * from "./domain/ExceptionSchema";
|
|
11
|
-
export * from "./
|
|
12
|
-
|
|
13
|
-
export * from "./services/PlatformExceptions";
|
|
14
|
-
// errors
|
|
15
|
-
export * from "./errors/ResourceNotFound";
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
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";
|
|
16
14
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/ErrorFilter\";\nexport * from \"./components/ExceptionFilter\";\nexport * from \"./components/MongooseErrorFilter\";\nexport * from \"./components/StringErrorFilter\";\nexport * from \"./decorators/catch\";\nexport * from \"./domain/ExceptionFiltersContainer\";\nexport * from \"./domain/ExceptionSchema\";\nexport * from \"./errors/ResourceNotFound\";\nexport * from \"./interfaces/ExceptionFilterMethods\";\nexport * from \"./services/PlatformExceptions\";\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { ancestorsOf, classOf, nameOf } from "@tsed/core";
|
|
3
3
|
import { Inject, Injectable, InjectorService } from "@tsed/di";
|
|
4
|
-
import { ErrorFilter } from "../components/ErrorFilter";
|
|
5
|
-
import { ExceptionFilter } from "../components/ExceptionFilter";
|
|
6
|
-
import { MongooseErrorFilter } from "../components/MongooseErrorFilter";
|
|
7
|
-
import { StringErrorFilter } from "../components/StringErrorFilter";
|
|
8
|
-
import { ExceptionFiltersContainer } from "../domain/ExceptionFiltersContainer";
|
|
9
|
-
import { ResourceNotFound } from "../errors/ResourceNotFound";
|
|
4
|
+
import { ErrorFilter } from "../components/ErrorFilter.js";
|
|
5
|
+
import { ExceptionFilter } from "../components/ExceptionFilter.js";
|
|
6
|
+
import { MongooseErrorFilter } from "../components/MongooseErrorFilter.js";
|
|
7
|
+
import { StringErrorFilter } from "../components/StringErrorFilter.js";
|
|
8
|
+
import { ExceptionFiltersContainer } from "../domain/ExceptionFiltersContainer.js";
|
|
9
|
+
import { ResourceNotFound } from "../errors/ResourceNotFound.js";
|
|
10
10
|
/**
|
|
11
11
|
* Catch all errors and return the json error with the right status code when it's possible.
|
|
12
12
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
3
4
|
export * from "./components/ErrorFilter";
|
|
5
|
+
export * from "./components/ExceptionFilter";
|
|
4
6
|
export * from "./components/MongooseErrorFilter";
|
|
7
|
+
export * from "./components/StringErrorFilter";
|
|
5
8
|
export * from "./decorators/catch";
|
|
6
9
|
export * from "./domain/ExceptionFiltersContainer";
|
|
7
10
|
export * from "./domain/ExceptionSchema";
|
|
11
|
+
export * from "./errors/ResourceNotFound";
|
|
8
12
|
export * from "./interfaces/ExceptionFilterMethods";
|
|
9
13
|
export * from "./services/PlatformExceptions";
|
|
10
|
-
export * from "./errors/ResourceNotFound";
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-exceptions",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.6",
|
|
4
4
|
"description": "Platform exceptions module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/cjs/index.js",
|
|
8
|
+
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
"types": "./lib/types/index.d.ts",
|
|
@@ -13,30 +14,45 @@
|
|
|
13
14
|
"default": "./lib/esm/index.js"
|
|
14
15
|
},
|
|
15
16
|
"scripts": {
|
|
16
|
-
"build": "yarn run build:esm && yarn run build:cjs",
|
|
17
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
17
18
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
-
"build:esm": "tsc --build tsconfig.compile.esm.json"
|
|
19
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\""
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
|
-
"tslib": "2.
|
|
23
|
+
"tslib": "2.3.1"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@tsed/core": "7.0.0-beta.
|
|
25
|
-
"@tsed/di": "7.0.0-beta.
|
|
26
|
-
"@tsed/exceptions": "7.0.0-beta.
|
|
27
|
-
"@tsed/schema": "7.0.0-beta.
|
|
26
|
+
"@tsed/core": "7.0.0-beta.6",
|
|
27
|
+
"@tsed/di": "7.0.0-beta.6",
|
|
28
|
+
"@tsed/exceptions": "7.0.0-beta.6",
|
|
29
|
+
"@tsed/schema": "7.0.0-beta.6"
|
|
28
30
|
},
|
|
29
31
|
"peerDependencies": {
|
|
30
|
-
"@tsed/core": "^7.0.0-beta.
|
|
31
|
-
"@tsed/di": "^7.0.0-beta.
|
|
32
|
-
"@tsed/exceptions": "^7.0.0-beta.
|
|
33
|
-
"@tsed/schema": "^7.0.0-beta.
|
|
32
|
+
"@tsed/core": "^7.0.0-beta.6",
|
|
33
|
+
"@tsed/di": "^7.0.0-beta.6",
|
|
34
|
+
"@tsed/exceptions": "^7.0.0-beta.6",
|
|
35
|
+
"@tsed/schema": "^7.0.0-beta.6"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@tsed/core": {
|
|
39
|
+
"optional": false
|
|
40
|
+
},
|
|
41
|
+
"@tsed/di": {
|
|
42
|
+
"optional": false
|
|
43
|
+
},
|
|
44
|
+
"@tsed/exceptions": {
|
|
45
|
+
"optional": false
|
|
46
|
+
},
|
|
47
|
+
"@tsed/schema": {
|
|
48
|
+
"optional": false
|
|
49
|
+
}
|
|
34
50
|
},
|
|
35
51
|
"repository": "https://github.com/tsedio/tsed",
|
|
36
52
|
"bugs": {
|
|
37
53
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
38
54
|
},
|
|
39
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
55
|
+
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/platform/platform-exceptions",
|
|
40
56
|
"author": "Romain Lenzotti",
|
|
41
57
|
"license": "MIT"
|
|
42
58
|
}
|
package/readme.md
CHANGED
|
@@ -36,18 +36,17 @@ npm install --save @tsed/platform-exceptions
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Contributors
|
|
39
|
+
|
|
39
40
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html).
|
|
40
41
|
|
|
41
42
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
## Backers
|
|
45
45
|
|
|
46
46
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
|
|
47
47
|
|
|
48
48
|
<a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
## Sponsors
|
|
52
51
|
|
|
53
52
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
|
|
@@ -8,16 +8,5 @@
|
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"declarationDir": "./lib/types"
|
|
10
10
|
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"test",
|
|
14
|
-
"lib",
|
|
15
|
-
"benchmark",
|
|
16
|
-
"coverage",
|
|
17
|
-
"spec",
|
|
18
|
-
"**/*.benchmark.ts",
|
|
19
|
-
"**/*.spec.ts",
|
|
20
|
-
"keys",
|
|
21
|
-
"jest.config.js"
|
|
22
|
-
]
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
23
12
|
}
|