@hg-ts/exception 0.2.29 → 0.3.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.
@@ -1 +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;CAepH"}
1
+ {"version":3,"file":"exception.factory.d.ts","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EAIb,iBAAiB,EAIjB,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;CAyBpH"}
@@ -5,7 +5,17 @@ const exceptions_1 = require("./exceptions");
5
5
  class ExceptionFactory {
6
6
  constructor() { }
7
7
  static fromJson(json, ctorList) {
8
- for (const ctor of ctorList) {
8
+ const ctorToMap = [
9
+ ...ctorList,
10
+ exceptions_1.AggregateErrorException,
11
+ exceptions_1.ErrorException,
12
+ exceptions_1.ForbiddenException,
13
+ exceptions_1.InvalidInputException,
14
+ exceptions_1.NotImplementedException,
15
+ exceptions_1.UnknownException,
16
+ exceptions_1.WillNeverHappenedException,
17
+ ];
18
+ for (const ctor of ctorToMap) {
9
19
  const { name, ...exceptionData } = json;
10
20
  if (ctor.name === name) {
11
21
  const exception = Object.create(ctor.prototype);
@@ -1 +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;gBACxC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE/C,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QAED,MAAM,IAAI,kCAAqB,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC;IAC9F,CAAC;CACD;AAlBD,4CAkBC"}
1
+ {"version":3,"file":"exception.factory.js","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":";;;AAAA,6CAUsB;AAEtB,MAAa,gBAAgB;IAC5B,gBAAuB,CAAC;IAEjB,MAAM,CAAC,QAAQ,CAA8B,IAAO,EAAE,QAAuC;QACnG,MAAM,SAAS,GAAG;YACjB,GAAG,QAAQ;YACX,oCAAuB;YACvB,2BAAc;YACd,+BAAkB;YAClB,kCAAqB;YACrB,oCAAuB;YACvB,6BAAgB;YAChB,uCAA0B;SAC1B,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC9B,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;gBACxC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE/C,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QAED,MAAM,IAAI,kCAAqB,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC;IAC9F,CAAC;CACD;AA5BD,4CA4BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hg-ts/exception",
3
- "version": "0.2.29",
3
+ "version": "0.3.0",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -13,24 +13,26 @@
13
13
  "build:dev": "tsc-watch",
14
14
  "lint:ts": "lint-ts",
15
15
  "lint:ts:fix": "lint-ts --fix",
16
- "test": "HG_ENV=test node --require ts-node/register --test src/**/*.test.ts",
17
- "test:dev": "yarn build:dev --onSuccess \"yarn test\""
16
+ "test": "HG_ENV=test vitest run",
17
+ "test:dev": "HG_ENV=test vitest watch"
18
18
  },
19
19
  "devDependencies": {
20
- "@hg-ts-config/typescript": "0.2.29",
21
- "@hg-ts/linter": "0.2.29",
22
- "@hg-ts/tests": "0.2.29",
23
- "@hg-ts/types": "0.2.29",
24
- "@types/node": "22.10.6",
20
+ "@hg-ts-config/typescript": "0.3.0",
21
+ "@hg-ts/linter": "0.3.0",
22
+ "@hg-ts/tests": "0.3.0",
23
+ "@hg-ts/types": "0.3.0",
24
+ "@types/node": "22.19.1",
25
25
  "eslint": "9.18.0",
26
26
  "reflect-metadata": "0.2.2",
27
27
  "ts-node": "10.9.2",
28
28
  "tsc-watch": "6.3.0",
29
29
  "tslib": "2.8.1",
30
- "typescript": "5.7.3"
30
+ "typescript": "5.7.3",
31
+ "vitest": "4.0.14"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "reflect-metadata": "*",
34
- "tslib": "*"
35
+ "tslib": "*",
36
+ "vitest": "*"
35
37
  }
36
38
  }
@@ -0,0 +1,3 @@
1
+ import config from '@hg-ts/tests/config';
2
+
3
+ export default config;