@hg-ts/exception 0.1.95 → 0.1.97
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/exception.factory.d.ts +6 -0
- package/dist/exception.factory.d.ts.map +1 -0
- package/dist/exception.factory.js +20 -0
- package/dist/exception.factory.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseException, JSONBaseException } from './exceptions';
|
|
2
|
+
export declare class ExceptionFactory {
|
|
3
|
+
private constructor();
|
|
4
|
+
static fromJson<T extends JSONBaseException>(json: T, ctorList: Class<BaseException, any[]>[]): BaseException;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=exception.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.factory.d.ts","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAEb,iBAAiB,EACjB,MAAM,cAAc,CAAC;AAEtB,qBAAa,gBAAgB;IAC5B,OAAO;WAEO,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,aAAa;CAcpH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExceptionFactory = void 0;
|
|
4
|
+
const exceptions_1 = require("./exceptions");
|
|
5
|
+
class ExceptionFactory {
|
|
6
|
+
constructor() { }
|
|
7
|
+
static fromJson(json, ctorList) {
|
|
8
|
+
for (const ctor of ctorList) {
|
|
9
|
+
const { name, ...exceptionData } = json;
|
|
10
|
+
if (ctor.name === name) {
|
|
11
|
+
const exception = Object.create(ctor.prototype);
|
|
12
|
+
Object.assign(exception, exceptionData);
|
|
13
|
+
return exception;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
throw new exceptions_1.InvalidInputException(`Exception constructor with name "${json.name}" not passed`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ExceptionFactory = ExceptionFactory;
|
|
20
|
+
//# sourceMappingURL=exception.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exception.factory.js","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":";;;AAAA,6CAIsB;AAEtB,MAAa,gBAAgB;IAC5B,gBAAuB,CAAC;IAEjB,MAAM,CAAC,QAAQ,CAA8B,IAAO,EAAE,QAAuC;QACnG,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC;YACxC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAEhD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;gBAExC,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QAED,MAAM,IAAI,kCAAqB,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC;IAC9F,CAAC;CACD;AAjBD,4CAiBC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,8DAAoC"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hg-ts/exception",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.97",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"repository": "git@gitlab.com:hyper-graph/framework.git",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"publishPackage": "yarn npm publish --tolerate-republish",
|
|
11
10
|
"prepack": "turbo preparePackage",
|
|
12
11
|
"clear": "rm -rf dist",
|
|
13
12
|
"build": "tsc",
|
|
14
13
|
"build:dev": "tsc-watch",
|
|
15
14
|
"lint:ts": "lint-ts",
|
|
16
15
|
"lint:ts:fix": "lint-ts --fix",
|
|
17
|
-
"test": "node --test",
|
|
16
|
+
"test": "HG_ENV=test node --require ts-node/register --test src/**/*.test.ts",
|
|
18
17
|
"test:dev": "yarn build:dev --onSuccess \"yarn test\""
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"@hg-ts-config/typescript": "0.1.
|
|
22
|
-
"@hg-ts/linter": "0.1.
|
|
23
|
-
"@hg-ts/tests": "0.1.
|
|
24
|
-
"@hg-ts/types": "0.1.
|
|
25
|
-
"@types/node": "
|
|
26
|
-
"eslint": "
|
|
27
|
-
"reflect-metadata": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
20
|
+
"@hg-ts-config/typescript": "0.1.97",
|
|
21
|
+
"@hg-ts/linter": "0.1.97",
|
|
22
|
+
"@hg-ts/tests": "0.1.97",
|
|
23
|
+
"@hg-ts/types": "0.1.97",
|
|
24
|
+
"@types/node": "catalog:types",
|
|
25
|
+
"eslint": "catalog:devtools",
|
|
26
|
+
"reflect-metadata": "catalog:core",
|
|
27
|
+
"ts-node": "catalog:devtools",
|
|
28
|
+
"tsc-watch": "catalog:devtools",
|
|
29
|
+
"tslib": "catalog:core",
|
|
30
|
+
"typescript": "catalog:devtools"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"reflect-metadata": "*",
|