@venizia/ignis-inversion 0.4.3 → 0.4.4

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.
Files changed (153) hide show
  1. package/LICENSE.md +2 -5
  2. package/README.md +18 -6
  3. package/dist/esm/modules/container/base.d.ts.map +1 -1
  4. package/dist/esm/modules/container/base.js +3 -1
  5. package/dist/esm/modules/container/base.js.map +1 -1
  6. package/dist/esm/modules/container/container.d.ts.map +1 -1
  7. package/dist/esm/modules/container/container.js +1 -0
  8. package/dist/esm/modules/container/container.js.map +1 -1
  9. package/dist/esm/modules/container/index.d.ts +1 -0
  10. package/dist/esm/modules/container/index.d.ts.map +1 -1
  11. package/dist/esm/modules/container/index.js +1 -0
  12. package/dist/esm/modules/container/index.js.map +1 -1
  13. package/dist/esm/modules/container/verifier.d.ts +47 -0
  14. package/dist/esm/modules/container/verifier.d.ts.map +1 -0
  15. package/dist/esm/modules/container/verifier.js +115 -0
  16. package/dist/esm/modules/container/verifier.js.map +1 -0
  17. package/package.json +7 -15
  18. package/dist/cjs/common/base-helper.d.ts +0 -9
  19. package/dist/cjs/common/base-helper.d.ts.map +0 -1
  20. package/dist/cjs/common/base-helper.js +0 -11
  21. package/dist/cjs/common/base-helper.js.map +0 -1
  22. package/dist/cjs/common/index.d.ts +0 -5
  23. package/dist/cjs/common/index.d.ts.map +0 -1
  24. package/dist/cjs/common/index.js +0 -21
  25. package/dist/cjs/common/index.js.map +0 -1
  26. package/dist/cjs/common/logger.d.ts +0 -11
  27. package/dist/cjs/common/logger.d.ts.map +0 -1
  28. package/dist/cjs/common/logger.js +0 -26
  29. package/dist/cjs/common/logger.js.map +0 -1
  30. package/dist/cjs/common/types.d.ts +0 -22
  31. package/dist/cjs/common/types.d.ts.map +0 -1
  32. package/dist/cjs/common/types.js +0 -3
  33. package/dist/cjs/common/types.js.map +0 -1
  34. package/dist/cjs/common/utilities.d.ts +0 -38
  35. package/dist/cjs/common/utilities.d.ts.map +0 -1
  36. package/dist/cjs/common/utilities.js +0 -83
  37. package/dist/cjs/common/utilities.js.map +0 -1
  38. package/dist/cjs/index.d.ts +0 -4
  39. package/dist/cjs/index.d.ts.map +0 -1
  40. package/dist/cjs/index.js +0 -26
  41. package/dist/cjs/index.js.map +0 -1
  42. package/dist/cjs/modules/binding/binding.d.ts +0 -37
  43. package/dist/cjs/modules/binding/binding.d.ts.map +0 -1
  44. package/dist/cjs/modules/binding/binding.js +0 -120
  45. package/dist/cjs/modules/binding/binding.js.map +0 -1
  46. package/dist/cjs/modules/binding/common/constants.d.ts +0 -19
  47. package/dist/cjs/modules/binding/common/constants.d.ts.map +0 -1
  48. package/dist/cjs/modules/binding/common/constants.js +0 -33
  49. package/dist/cjs/modules/binding/common/constants.js.map +0 -1
  50. package/dist/cjs/modules/binding/common/index.d.ts +0 -3
  51. package/dist/cjs/modules/binding/common/index.d.ts.map +0 -1
  52. package/dist/cjs/modules/binding/common/index.js +0 -19
  53. package/dist/cjs/modules/binding/common/index.js.map +0 -1
  54. package/dist/cjs/modules/binding/common/types.d.ts +0 -28
  55. package/dist/cjs/modules/binding/common/types.d.ts.map +0 -1
  56. package/dist/cjs/modules/binding/common/types.js +0 -8
  57. package/dist/cjs/modules/binding/common/types.js.map +0 -1
  58. package/dist/cjs/modules/binding/index.d.ts +0 -3
  59. package/dist/cjs/modules/binding/index.d.ts.map +0 -1
  60. package/dist/cjs/modules/binding/index.js +0 -19
  61. package/dist/cjs/modules/binding/index.js.map +0 -1
  62. package/dist/cjs/modules/container/abstract.d.ts +0 -69
  63. package/dist/cjs/modules/container/abstract.d.ts.map +0 -1
  64. package/dist/cjs/modules/container/abstract.js +0 -12
  65. package/dist/cjs/modules/container/abstract.js.map +0 -1
  66. package/dist/cjs/modules/container/base.d.ts +0 -101
  67. package/dist/cjs/modules/container/base.d.ts.map +0 -1
  68. package/dist/cjs/modules/container/base.js +0 -193
  69. package/dist/cjs/modules/container/base.js.map +0 -1
  70. package/dist/cjs/modules/container/common/index.d.ts +0 -2
  71. package/dist/cjs/modules/container/common/index.d.ts.map +0 -1
  72. package/dist/cjs/modules/container/common/index.js +0 -18
  73. package/dist/cjs/modules/container/common/index.js.map +0 -1
  74. package/dist/cjs/modules/container/common/types.d.ts +0 -60
  75. package/dist/cjs/modules/container/common/types.d.ts.map +0 -1
  76. package/dist/cjs/modules/container/common/types.js +0 -3
  77. package/dist/cjs/modules/container/common/types.js.map +0 -1
  78. package/dist/cjs/modules/container/container.d.ts +0 -24
  79. package/dist/cjs/modules/container/container.d.ts.map +0 -1
  80. package/dist/cjs/modules/container/container.js +0 -100
  81. package/dist/cjs/modules/container/container.js.map +0 -1
  82. package/dist/cjs/modules/container/index.d.ts +0 -5
  83. package/dist/cjs/modules/container/index.d.ts.map +0 -1
  84. package/dist/cjs/modules/container/index.js +0 -21
  85. package/dist/cjs/modules/container/index.js.map +0 -1
  86. package/dist/cjs/modules/error/app-error.d.ts +0 -32
  87. package/dist/cjs/modules/error/app-error.d.ts.map +0 -1
  88. package/dist/cjs/modules/error/app-error.js +0 -102
  89. package/dist/cjs/modules/error/app-error.js.map +0 -1
  90. package/dist/cjs/modules/error/common/constants.d.ts +0 -14
  91. package/dist/cjs/modules/error/common/constants.d.ts.map +0 -1
  92. package/dist/cjs/modules/error/common/constants.js +0 -23
  93. package/dist/cjs/modules/error/common/constants.js.map +0 -1
  94. package/dist/cjs/modules/error/common/index.d.ts +0 -3
  95. package/dist/cjs/modules/error/common/index.d.ts.map +0 -1
  96. package/dist/cjs/modules/error/common/index.js +0 -19
  97. package/dist/cjs/modules/error/common/index.js.map +0 -1
  98. package/dist/cjs/modules/error/common/types.d.ts +0 -75
  99. package/dist/cjs/modules/error/common/types.d.ts.map +0 -1
  100. package/dist/cjs/modules/error/common/types.js +0 -3
  101. package/dist/cjs/modules/error/common/types.js.map +0 -1
  102. package/dist/cjs/modules/error/definition.d.ts +0 -10
  103. package/dist/cjs/modules/error/definition.d.ts.map +0 -1
  104. package/dist/cjs/modules/error/definition.js +0 -12
  105. package/dist/cjs/modules/error/definition.js.map +0 -1
  106. package/dist/cjs/modules/error/index.d.ts +0 -6
  107. package/dist/cjs/modules/error/index.d.ts.map +0 -1
  108. package/dist/cjs/modules/error/index.js +0 -22
  109. package/dist/cjs/modules/error/index.js.map +0 -1
  110. package/dist/cjs/modules/error/message-code.d.ts +0 -28
  111. package/dist/cjs/modules/error/message-code.d.ts.map +0 -1
  112. package/dist/cjs/modules/error/message-code.js +0 -57
  113. package/dist/cjs/modules/error/message-code.js.map +0 -1
  114. package/dist/cjs/modules/error/message-template.d.ts +0 -19
  115. package/dist/cjs/modules/error/message-template.d.ts.map +0 -1
  116. package/dist/cjs/modules/error/message-template.js +0 -38
  117. package/dist/cjs/modules/error/message-template.js.map +0 -1
  118. package/dist/cjs/modules/index.d.ts +0 -6
  119. package/dist/cjs/modules/index.d.ts.map +0 -1
  120. package/dist/cjs/modules/index.js +0 -22
  121. package/dist/cjs/modules/index.js.map +0 -1
  122. package/dist/cjs/modules/metadata/common/constants.d.ts +0 -6
  123. package/dist/cjs/modules/metadata/common/constants.d.ts.map +0 -1
  124. package/dist/cjs/modules/metadata/common/constants.js +0 -9
  125. package/dist/cjs/modules/metadata/common/constants.js.map +0 -1
  126. package/dist/cjs/modules/metadata/common/index.d.ts +0 -2
  127. package/dist/cjs/modules/metadata/common/index.d.ts.map +0 -1
  128. package/dist/cjs/modules/metadata/common/index.js +0 -18
  129. package/dist/cjs/modules/metadata/common/index.js.map +0 -1
  130. package/dist/cjs/modules/metadata/index.d.ts +0 -3
  131. package/dist/cjs/modules/metadata/index.d.ts.map +0 -1
  132. package/dist/cjs/modules/metadata/index.js +0 -19
  133. package/dist/cjs/modules/metadata/index.js.map +0 -1
  134. package/dist/cjs/modules/metadata/injectors.d.ts +0 -16
  135. package/dist/cjs/modules/metadata/injectors.d.ts.map +0 -1
  136. package/dist/cjs/modules/metadata/injectors.js +0 -47
  137. package/dist/cjs/modules/metadata/injectors.js.map +0 -1
  138. package/dist/cjs/modules/registry/common/index.d.ts +0 -2
  139. package/dist/cjs/modules/registry/common/index.d.ts.map +0 -1
  140. package/dist/cjs/modules/registry/common/index.js +0 -18
  141. package/dist/cjs/modules/registry/common/index.js.map +0 -1
  142. package/dist/cjs/modules/registry/common/types.d.ts +0 -20
  143. package/dist/cjs/modules/registry/common/types.d.ts.map +0 -1
  144. package/dist/cjs/modules/registry/common/types.js +0 -3
  145. package/dist/cjs/modules/registry/common/types.js.map +0 -1
  146. package/dist/cjs/modules/registry/index.d.ts +0 -3
  147. package/dist/cjs/modules/registry/index.d.ts.map +0 -1
  148. package/dist/cjs/modules/registry/index.js +0 -19
  149. package/dist/cjs/modules/registry/index.js.map +0 -1
  150. package/dist/cjs/modules/registry/registry.d.ts +0 -66
  151. package/dist/cjs/modules/registry/registry.d.ts.map +0 -1
  152. package/dist/cjs/modules/registry/registry.js +0 -98
  153. package/dist/cjs/modules/registry/registry.js.map +0 -1
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Container = void 0;
4
- const error_1 = require("../error");
5
- const utilities_1 = require("../../common/utilities");
6
- const base_1 = require("./base");
7
- /** Default container: constructor + property injection driven by the decorator metadata registry. */
8
- class Container extends base_1.BaseContainer {
9
- constructor(opts) {
10
- super({ scope: opts?.scope ?? Container.name });
11
- }
12
- /**
13
- * The class form reads the key the REGISTRATION recorded, so a call-site override and an imperative
14
- * `application.service(X)` both resolve. `@inject` takes a key or a class; metadata a framework
15
- * writes may carry both, and then the class wins and the key is the fallback for a class nothing
16
- * recorded - one bound by hand with `bind({ key }).toClass(X)`. An optional class with neither
17
- * resolves to `undefined`, as an optional key would.
18
- */
19
- resolveBindingKey(opts) {
20
- const { key, target: declared, isOptional = false, cls, at } = opts;
21
- if (declared === undefined && key !== undefined) {
22
- return key;
23
- }
24
- if (declared === undefined) {
25
- throw (0, error_1.getError)({
26
- message: `[${cls.name}] ${at} has neither an @inject key nor a class`,
27
- });
28
- }
29
- const target = (0, utilities_1.resolveInjectTarget)({ target: declared });
30
- if (target === undefined) {
31
- throw (0, error_1.getError)({
32
- message: `[${cls.name}] ${at} names a function that did not return a class`,
33
- });
34
- }
35
- const recorded = this.getMetadataRegistry().getBindingKey({ target }) ?? key;
36
- if (recorded === undefined && isOptional) {
37
- return undefined;
38
- }
39
- if (recorded === undefined) {
40
- throw (0, error_1.getError)({
41
- message: `[${cls.name}] ${at} names '${target.name}', which is not registered as an artifact | Decorate it (@service, @repository, ...) or register it on the application before it is injected`,
42
- });
43
- }
44
- // A same-name class records the same derived key (a library's own copy of a class the application registers): resolving it would hand back the OTHER class without a word.
45
- const bound = this.getBinding({ key: recorded })?.boundClass();
46
- if (bound && bound !== target && !(bound.prototype instanceof target)) {
47
- throw (0, error_1.getError)({
48
- message: `[${cls.name}] ${at} names '${target.name}', but '${String(recorded)}' is bound to a different class named '${bound.name}' | Two classes share one name and so one key - rename one, re-export the registered one, or inject by key`,
49
- });
50
- }
51
- return recorded;
52
- }
53
- instantiate(cls) {
54
- const registry = this.getMetadataRegistry();
55
- const injectMetadata = registry.getInjectMetadata({
56
- target: cls,
57
- });
58
- const args = [];
59
- for (let index = 0; index < (injectMetadata?.length ?? 0); index++) {
60
- const meta = injectMetadata?.[index];
61
- if (!meta) {
62
- throw (0, error_1.getError)({
63
- message: `[${cls.name}] Constructor parameter ${index} has no @inject | Every parameter of a container-instantiated class must be decorated - the container cannot supply an undecorated one`,
64
- });
65
- }
66
- const isOptional = meta.isOptional ?? false;
67
- const key = this.resolveBindingKey({
68
- key: meta.key,
69
- target: meta.target,
70
- isOptional,
71
- cls,
72
- at: `Constructor parameter ${index}`,
73
- });
74
- args[meta.index] = key === undefined ? undefined : this.get({ key, isOptional });
75
- }
76
- const instance = new cls(...args);
77
- const propertyMetadata = registry.getPropertiesMetadata({
78
- target: instance,
79
- });
80
- if (!propertyMetadata?.size) {
81
- return instance;
82
- }
83
- const properties = propertyMetadata.entries();
84
- for (const [propertyKey, metadata] of properties) {
85
- const isOptional = metadata.isOptional ?? false;
86
- const key = this.resolveBindingKey({
87
- key: metadata.bindingKey,
88
- target: metadata.target,
89
- isOptional,
90
- cls,
91
- at: `Property '${String(propertyKey)}'`,
92
- });
93
- instance[propertyKey] =
94
- key === undefined ? undefined : this.get({ key, isOptional });
95
- }
96
- return instance;
97
- }
98
- }
99
- exports.Container = Container;
100
- //# sourceMappingURL=container.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../src/modules/container/container.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AAEpC,kDAAyD;AACzD,iCAAuC;AAEvC,qGAAqG;AACrG,MAAa,SAAU,SAAQ,oBAAa;IAC1C,YAAY,IAAwB;QAClC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;OAMG;IACO,iBAAiB,CAAC,IAM3B;QACC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;QAEpE,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAChD,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAA,gBAAQ,EAAC;gBACb,OAAO,EAAE,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,yCAAyC;aACtE,CAAC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,+BAAmB,EAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAA,gBAAQ,EAAC;gBACb,OAAO,EAAE,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,+CAA+C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AAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,UAAU;gBACV,GAAG;gBACH,EAAE,EAAE,aAAa,MAAM,CAAC,WAAW,CAAC,GAAG;aACxC,CAAC,CAAC;YAEF,QAAgB,CAAC,WAAW,CAAC;gBAC5B,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AArHD,8BAqHC","sourcesContent":["import { getError } from '../error';\nimport { type AnyType, type TBindingKey, type TClass, type TInjectTarget } from '@/common/types';\nimport { resolveInjectTarget } from '@/common/utilities';\nimport { BaseContainer } from './base';\n\n/** Default container: constructor + property injection driven by the decorator metadata registry. */\nexport class Container extends BaseContainer {\n constructor(opts?: { scope: string }) {\n super({ scope: opts?.scope ?? Container.name });\n }\n\n /**\n * The class form reads the key the REGISTRATION recorded, so a call-site override and an imperative\n * `application.service(X)` both resolve. `@inject` takes a key or a class; metadata a framework\n * writes may carry both, and then the class wins and the key is the fallback for a class nothing\n * recorded - one bound by hand with `bind({ key }).toClass(X)`. An optional class with neither\n * resolves to `undefined`, as an optional key would.\n */\n protected resolveBindingKey(opts: {\n key?: TBindingKey;\n target?: TInjectTarget;\n isOptional?: boolean;\n cls: TClass<AnyType>;\n at: string;\n }): TBindingKey | undefined {\n const { key, target: declared, isOptional = false, cls, at } = opts;\n\n if (declared === undefined && key !== undefined) {\n return key;\n }\n\n if (declared === undefined) {\n throw getError({\n message: `[${cls.name}] ${at} has neither an @inject key nor a class`,\n });\n }\n\n const target = resolveInjectTarget({ target: declared });\n if (target === undefined) {\n throw getError({\n message: `[${cls.name}] ${at} names a function that did not return a class`,\n });\n }\n\n const recorded = this.getMetadataRegistry().getBindingKey({ target }) ?? key;\n if (recorded === undefined && isOptional) {\n return undefined;\n }\n\n if (recorded === undefined) {\n throw getError({\n message: `[${cls.name}] ${at} names '${target.name}', which is not registered as an artifact | Decorate it (@service, @repository, ...) or register it on the application before it is injected`,\n });\n }\n\n // A same-name class records the same derived key (a library's own copy of a class the application registers): resolving it would hand back the OTHER class without a word.\n const bound = this.getBinding({ key: recorded })?.boundClass();\n if (bound && bound !== target && !(bound.prototype instanceof target)) {\n throw getError({\n message: `[${cls.name}] ${at} names '${target.name}', but '${String(recorded)}' is bound to a different class named '${bound.name}' | Two classes share one name and so one key - rename one, re-export the registered one, or inject by key`,\n });\n }\n\n return recorded;\n }\n\n override instantiate<T>(cls: TClass<T>): T {\n const registry = this.getMetadataRegistry();\n\n const injectMetadata = registry.getInjectMetadata({\n target: cls,\n });\n\n const args: any[] = [];\n\n for (let index = 0; index < (injectMetadata?.length ?? 0); index++) {\n const meta = injectMetadata?.[index];\n\n if (!meta) {\n throw getError({\n message: `[${cls.name}] Constructor parameter ${index} has no @inject | Every parameter of a container-instantiated class must be decorated - the container cannot supply an undecorated one`,\n });\n }\n\n const isOptional = meta.isOptional ?? false;\n const key = this.resolveBindingKey({\n key: meta.key,\n target: meta.target,\n isOptional,\n cls,\n at: `Constructor parameter ${index}`,\n });\n\n args[meta.index] = key === undefined ? undefined : this.get({ key, isOptional });\n }\n\n const instance = new cls(...args);\n\n const propertyMetadata = registry.getPropertiesMetadata({\n target: instance as object,\n });\n\n if (!propertyMetadata?.size) {\n return instance;\n }\n\n const properties = propertyMetadata.entries();\n for (const [propertyKey, metadata] of properties) {\n const isOptional = metadata.isOptional ?? false;\n const key = this.resolveBindingKey({\n key: metadata.bindingKey,\n target: metadata.target,\n isOptional,\n cls,\n at: `Property '${String(propertyKey)}'`,\n });\n\n (instance as any)[propertyKey] =\n key === undefined ? undefined : this.get({ key, isOptional });\n }\n\n return instance;\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export * from './abstract';
2
- export * from './base';
3
- export * from './common';
4
- export * from './container';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/container/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./abstract"), exports);
18
- __exportStar(require("./base"), exports);
19
- __exportStar(require("./common"), exports);
20
- __exportStar(require("./container"), exports);
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/container/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,yCAAuB;AACvB,2CAAyB;AACzB,8CAA4B","sourcesContent":["export * from './abstract';\nexport * from './base';\nexport * from './common';\nexport * from './container';\n"]}
@@ -1,32 +0,0 @@
1
- import type { TError, TErrorLogLevel, TErrorNormalized, TResponsedError } from './common';
2
- export declare class ApplicationError extends Error {
3
- statusCode: number;
4
- normalized: TErrorNormalized;
5
- extra?: Record<string, unknown>;
6
- readonly logLevel?: TErrorLogLevel;
7
- constructor(opts: TError);
8
- /**
9
- * The message with its args filled in: `Only 2 left of TRA-01`. `message` itself stays the template,
10
- * so a log or an error tracker never prints a value outside the args it redacts by key - call this
11
- * where a plain reader stores or shows the text, such as a queue's failure reason.
12
- */
13
- toFilledText(): string;
14
- static getError(opts: TError): ApplicationError;
15
- static fromError(opts: {
16
- error: TResponsedError;
17
- }): ApplicationError;
18
- }
19
- export declare const getError: (opts: TError) => ApplicationError;
20
- export declare const fromError: (opts: {
21
- error: TResponsedError;
22
- }) => ApplicationError;
23
- /**
24
- * An `ApplicationError` by shape - a numeric `statusCode` and a `normalized` with its `text` - so it
25
- * holds across the CJS and ESM copies of this class, where `instanceof` does not. A plain `Error`
26
- * that merely carries a `statusCode` (an HTTP client's, an engine's) is not one.
27
- *
28
- * An error from a copy older than 0.2.2-0 matches but has no `toFilledText()`.
29
- */
30
- export declare const isApplicationError: (error: unknown) => error is ApplicationError;
31
- export type TApplicationError = ApplicationError;
32
- //# sourceMappingURL=app-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-error.d.ts","sourceRoot":"","sources":["../../../../src/modules/error/app-error.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAgB1F,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;gBAEvB,IAAI,EAAE,MAAM;IA2CxB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAI5B,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,eAAe,CAAA;KAAE,GAAG,gBAAgB;CAcrE;AAED,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,gBAAmD,CAAC;AAE5F,eAAO,MAAM,SAAS,GAAI,MAAM;IAAE,KAAK,EAAE,eAAe,CAAA;CAAE,KAAG,gBAC3B,CAAC;AAEnC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,gBAa5D,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAC"}
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isApplicationError = exports.fromError = exports.getError = exports.ApplicationError = void 0;
4
- const utilities_1 = require("../../common/utilities");
5
- const message_code_1 = require("./message-code");
6
- const message_template_1 = require("./message-template");
7
- /** Consumed keys. Everything else rides into `extra`. */
8
- const KNOWN_KEYS = [
9
- 'error',
10
- 'message',
11
- 'messageCode',
12
- 'statusCode',
13
- 'messageArgs',
14
- 'cause',
15
- 'extra',
16
- 'transform',
17
- 'logLevel',
18
- 'name',
19
- ];
20
- class ApplicationError extends Error {
21
- constructor(opts) {
22
- const { statusCode, messageArgs, cause, extra, transform, logLevel } = opts;
23
- // Index signature defeats `in` narrowing - read the discriminant and cast.
24
- const definition = 'error' in opts ? opts.error : undefined;
25
- const input = opts.message;
26
- const override = typeof input === 'string' ? { text: input } : input;
27
- // `?.message?.` has to guard BOTH: `error` reaches here from an untyped call site as anything at all, and a bare `definition?.message.text` throws on a malformed one.
28
- const message = override?.text ?? definition?.message?.text ?? '';
29
- const messageCode = message_code_1.MessageCode.resolve(override?.code ?? definition?.message?.code ?? opts.messageCode);
30
- const args = override?.args ?? messageArgs ?? definition?.message?.args;
31
- super(message, cause === undefined ? undefined : { cause });
32
- this.statusCode = statusCode ?? definition?.statusCode ?? 400;
33
- this.logLevel = logLevel;
34
- // Explicit `extra` wins over swept keys.
35
- const merged = {
36
- ...(0, utilities_1.omit)({ source: opts, keys: KNOWN_KEYS }),
37
- ...extra,
38
- };
39
- this.extra = Object.keys(merged).length > 0 ? merged : undefined;
40
- const normalized = {
41
- text: message,
42
- code: messageCode,
43
- args: args ?? {},
44
- };
45
- this.normalized = transform
46
- ? transform({
47
- message: normalized,
48
- statusCode: this.statusCode,
49
- extra: this.extra,
50
- })
51
- : normalized;
52
- }
53
- /**
54
- * The message with its args filled in: `Only 2 left of TRA-01`. `message` itself stays the template,
55
- * so a log or an error tracker never prints a value outside the args it redacts by key - call this
56
- * where a plain reader stores or shows the text, such as a queue's failure reason.
57
- */
58
- toFilledText() {
59
- return message_template_1.MessageTemplate.render({ text: this.message, args: this.normalized.args }).text;
60
- }
61
- static getError(opts) {
62
- return new ApplicationError(opts);
63
- }
64
- static fromError(opts) {
65
- const { error } = opts;
66
- return this.getError({
67
- message: {
68
- text: error.normalized?.text ?? error.message ?? '',
69
- code: error.normalized?.code,
70
- args: error.normalized?.args,
71
- },
72
- statusCode: error.statusCode,
73
- extra: error.extra,
74
- ...(error.requestId === undefined ? {} : { requestId: error.requestId }),
75
- });
76
- }
77
- }
78
- exports.ApplicationError = ApplicationError;
79
- const getError = (opts) => ApplicationError.getError(opts);
80
- exports.getError = getError;
81
- const fromError = (opts) => ApplicationError.fromError(opts);
82
- exports.fromError = fromError;
83
- /**
84
- * An `ApplicationError` by shape - a numeric `statusCode` and a `normalized` with its `text` - so it
85
- * holds across the CJS and ESM copies of this class, where `instanceof` does not. A plain `Error`
86
- * that merely carries a `statusCode` (an HTTP client's, an engine's) is not one.
87
- *
88
- * An error from a copy older than 0.2.2-0 matches but has no `toFilledText()`.
89
- */
90
- const isApplicationError = (error) => {
91
- if (!(error instanceof Error) || !('statusCode' in error) || !('normalized' in error)) {
92
- return false;
93
- }
94
- const { statusCode, normalized } = error;
95
- return (typeof statusCode === 'number' &&
96
- typeof normalized === 'object' &&
97
- normalized !== null &&
98
- 'text' in normalized &&
99
- typeof normalized.text === 'string');
100
- };
101
- exports.isApplicationError = isApplicationError;
102
- //# sourceMappingURL=app-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-error.js","sourceRoot":"","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EAAE;gBACnD,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI;gBAC5B,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI;aAC7B;YACD,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;SACzE,CAAC,CAAC;IACL,CAAC;CACF;AA5ED,4CA4EC;AAEM,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAoB,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAA/E,QAAA,QAAQ,YAAuE;AAErF,MAAM,SAAS,GAAG,CAAC,IAAgC,EAAoB,EAAE,CAC9E,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AADtB,QAAA,SAAS,aACa;AAEnC;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA6B,EAAE;IAC9E,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,EAAE,CAAC;QACtF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACzC,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,IAAI,UAAU;QACpB,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,CACpC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B","sourcesContent":["import { type TNullable } from '@/common/types';\nimport { omit } from '@/common/utilities';\nimport { MessageCode } from './message-code';\nimport { MessageTemplate } from './message-template';\nimport type { TError, TErrorLogLevel, TErrorNormalized, TResponsedError } from './common';\n\n/** Consumed keys. Everything else rides into `extra`. */\nconst KNOWN_KEYS = [\n 'error',\n 'message',\n 'messageCode',\n 'statusCode',\n 'messageArgs',\n 'cause',\n 'extra',\n 'transform',\n 'logLevel',\n 'name',\n] as const;\n\nexport class ApplicationError extends Error {\n statusCode: number;\n normalized: TErrorNormalized;\n extra?: Record<string, unknown>;\n readonly logLevel?: TErrorLogLevel;\n\n constructor(opts: TError) {\n const { statusCode, messageArgs, cause, extra, transform, logLevel } = opts;\n\n // Index signature defeats `in` narrowing - read the discriminant and cast.\n const definition = 'error' in opts ? opts.error : undefined;\n\n const input = opts.message;\n const override = typeof input === 'string' ? { text: input } : input;\n\n // `?.message?.` has to guard BOTH: `error` reaches here from an untyped call site as anything at all, and a bare `definition?.message.text` throws on a malformed one.\n const message = override?.text ?? definition?.message?.text ?? '';\n const messageCode = MessageCode.resolve(\n override?.code ?? definition?.message?.code ?? (opts.messageCode as TNullable<string>),\n );\n const args = override?.args ?? messageArgs ?? definition?.message?.args;\n\n super(message, cause === undefined ? undefined : { cause });\n\n this.statusCode = statusCode ?? definition?.statusCode ?? 400;\n this.logLevel = logLevel;\n\n // Explicit `extra` wins over swept keys.\n const merged = {\n ...omit({ source: opts, keys: KNOWN_KEYS }),\n ...extra,\n };\n this.extra = Object.keys(merged).length > 0 ? merged : undefined;\n\n const normalized: TErrorNormalized = {\n text: message,\n code: messageCode,\n args: args ?? {},\n };\n\n this.normalized = transform\n ? transform({\n message: normalized,\n statusCode: this.statusCode,\n extra: this.extra,\n })\n : normalized;\n }\n\n /**\n * The message with its args filled in: `Only 2 left of TRA-01`. `message` itself stays the template,\n * so a log or an error tracker never prints a value outside the args it redacts by key - call this\n * where a plain reader stores or shows the text, such as a queue's failure reason.\n */\n toFilledText(): string {\n return MessageTemplate.render({ text: this.message, args: this.normalized.args }).text;\n }\n\n static getError(opts: TError) {\n return new ApplicationError(opts);\n }\n\n static fromError(opts: { error: TResponsedError }): ApplicationError {\n const { error } = opts;\n\n return this.getError({\n message: {\n text: error.normalized?.text ?? error.message ?? '',\n code: error.normalized?.code,\n args: error.normalized?.args,\n },\n statusCode: error.statusCode,\n extra: error.extra,\n ...(error.requestId === undefined ? {} : { requestId: error.requestId }),\n });\n }\n}\n\nexport const getError = (opts: TError): ApplicationError => ApplicationError.getError(opts);\n\nexport const fromError = (opts: { error: TResponsedError }): ApplicationError =>\n ApplicationError.fromError(opts);\n\n/**\n * An `ApplicationError` by shape - a numeric `statusCode` and a `normalized` with its `text` - so it\n * holds across the CJS and ESM copies of this class, where `instanceof` does not. A plain `Error`\n * that merely carries a `statusCode` (an HTTP client's, an engine's) is not one.\n *\n * An error from a copy older than 0.2.2-0 matches but has no `toFilledText()`.\n */\nexport const isApplicationError = (error: unknown): error is ApplicationError => {\n if (!(error instanceof Error) || !('statusCode' in error) || !('normalized' in error)) {\n return false;\n }\n\n const { statusCode, normalized } = error;\n return (\n typeof statusCode === 'number' &&\n typeof normalized === 'object' &&\n normalized !== null &&\n 'text' in normalized &&\n typeof normalized.text === 'string'\n );\n};\n\nexport type TApplicationError = ApplicationError;\n"]}
@@ -1,14 +0,0 @@
1
- import type { TConstValue } from '../../../common/types';
2
- /** Declared here, not imported from helpers' `LogLevels` (browser-safe); a helpers guard pins them equal. */
3
- export declare class ErrorLogLevels {
4
- static readonly ERROR = "error";
5
- static readonly EMERG = "emerg";
6
- static readonly WARN = "warn";
7
- static readonly INFO = "info";
8
- static readonly DEBUG = "debug";
9
- static readonly SCHEME_SET: Set<string>;
10
- static isValid(value: string): boolean;
11
- }
12
- /** The level an error is logged at. */
13
- export type TErrorLogLevel = TConstValue<typeof ErrorLogLevels>;
14
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/modules/error/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,6GAA6G;AAC7G,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAChC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAMvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorLogLevels = void 0;
4
- /** Declared here, not imported from helpers' `LogLevels` (browser-safe); a helpers guard pins them equal. */
5
- class ErrorLogLevels {
6
- static { this.ERROR = 'error'; }
7
- static { this.EMERG = 'emerg'; }
8
- static { this.WARN = 'warn'; }
9
- static { this.INFO = 'info'; }
10
- static { this.DEBUG = 'debug'; }
11
- static { this.SCHEME_SET = new Set([
12
- this.ERROR,
13
- this.EMERG,
14
- this.WARN,
15
- this.INFO,
16
- this.DEBUG,
17
- ]); }
18
- static isValid(value) {
19
- return this.SCHEME_SET.has(value);
20
- }
21
- }
22
- exports.ErrorLogLevels = ErrorLogLevels;
23
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/modules/error/common/constants.ts"],"names":[],"mappings":";;;AAEA,6GAA6G;AAC7G,MAAa,cAAc;aACT,UAAK,GAAG,OAAO,CAAC;aAChB,UAAK,GAAG,OAAO,CAAC;aAChB,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;aACd,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAjBH,wCAkBC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\n/** Declared here, not imported from helpers' `LogLevels` (browser-safe); a helpers guard pins them equal. */\nexport class ErrorLogLevels {\n static readonly ERROR = 'error';\n static readonly EMERG = 'emerg';\n static readonly WARN = 'warn';\n static readonly INFO = 'info';\n static readonly DEBUG = 'debug';\n\n static readonly SCHEME_SET = new Set<string>([\n this.ERROR,\n this.EMERG,\n this.WARN,\n this.INFO,\n this.DEBUG,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** The level an error is logged at. */\nexport type TErrorLogLevel = TConstValue<typeof ErrorLogLevels>;\n"]}
@@ -1,3 +0,0 @@
1
- export * from './constants';
2
- export * from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/error/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./constants"), exports);
18
- __exportStar(require("./types"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/error/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
@@ -1,75 +0,0 @@
1
- import type { TErrorScope } from '../definition';
2
- import type { TErrorLogLevel } from './constants';
3
- /** Resolved message a client renders. All fields always present - no null-checks downstream. */
4
- export type TErrorNormalized = {
5
- text: string;
6
- code: string;
7
- args: Record<string, unknown>;
8
- };
9
- /** Wire payload as a CLIENT receives it - the input to {@link ApplicationError.fromError}. Every field is optional on purpose: a client parses what a gateway, a proxy or an older server actually sent. */
10
- export type TResponsedError = {
11
- message?: string;
12
- statusCode?: number;
13
- normalized?: Partial<TErrorNormalized>;
14
- extra?: Record<string, unknown>;
15
- requestId?: string;
16
- details?: Record<string, unknown>;
17
- };
18
- /** The message a CALLER supplies - only `text` is required, the rest is what {@link TErrorNormalized} resolves; every other message shape is derived from this one. */
19
- export type TErrorMessageInput = {
20
- text: string;
21
- code?: TErrorKey | (string & Record<never, never>);
22
- args?: Record<string, unknown>;
23
- };
24
- /** Catalogued message - `code` required, typed `string` and not {@link TErrorKey}: catalogs DECLARE the registry keys, so typing against the registry would be self-referential. */
25
- export type TErrorDefinitionMessage = Omit<TErrorMessageInput, 'code'> & {
26
- code: string;
27
- };
28
- /** The free-form input: a bare string is the historical shape. */
29
- export type TErrorMessage = string | TErrorMessageInput;
30
- /** The catalogued form's override - every field optional, since the definition supplies the rest. */
31
- export type TErrorMessageOverride = string | Partial<TErrorMessageInput>;
32
- export type TErrorDefinition = {
33
- message: TErrorDefinitionMessage;
34
- statusCode: number;
35
- category?: TErrorScope;
36
- description?: string;
37
- };
38
- /** Augmented per-package via declaration merging, driving `messageCode` autocomplete. */
39
- export interface IErrorKeyRegistry {
40
- }
41
- export type TErrorKey = [keyof IErrorKeyRegistry] extends [never] ? string : Extract<keyof IErrorKeyRegistry, string>;
42
- /** Builds {@link TErrorNormalized} in place of the default; `message` is the default it replaces. */
43
- export type TErrorNormalizeTransformFn = (opts: {
44
- message: TErrorNormalized;
45
- statusCode: number;
46
- extra?: Record<string, unknown>;
47
- }) => TErrorNormalized;
48
- /** Shared by both input forms - unknown keys ride the index signature into `extra`, so a throw site can attach context the framework does not model, and so does a mistyped key. */
49
- type TErrorCommon = {
50
- statusCode?: number;
51
- messageArgs?: Record<string, unknown>;
52
- cause?: unknown;
53
- extra?: Record<string, unknown>;
54
- transform?: TErrorNormalizeTransformFn;
55
- logLevel?: TErrorLogLevel;
56
- };
57
- /** Catalogued form - `message` and `statusCode` override the definition's defaults; the object form is partial, so `{ message: { args } }` amends the args and keeps the definition's text and code. */
58
- export type TErrorByDefinition = TErrorCommon & {
59
- error: TErrorDefinition;
60
- message?: TErrorMessageOverride;
61
- [key: string]: unknown;
62
- };
63
- /** Free-form: an invariant, a misconfiguration, a failure carrying no i18n code. `message` is the only required field - most throw sites legitimately fall back to `MessageCode.DEFAULT`. */
64
- export type TErrorByField = TErrorCommon & {
65
- message: TErrorMessage;
66
- messageCode?: TErrorKey | (string & Record<never, never>);
67
- /** Never valid here - `error` is the catalogued form's discriminant and a CONSUMED key, so a wrapped failure passed as `error` would vanish; use `cause`. */
68
- error?: never;
69
- [key: string]: unknown;
70
- };
71
- export type TError = TErrorByDefinition | TErrorByField;
72
- /** Registers a catalog's keys with {@link IErrorKeyRegistry}, via `declare module '@venizia/ignis-helpers' { interface IErrorKeyRegistry extends TRegisterErrors<typeof CategoryErrors> {} }`. */
73
- export type TRegisterErrors<T extends Record<string, TErrorDefinition>> = Record<T[keyof T]['message']['code'], true>;
74
- export {};
75
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/modules/error/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,gGAAgG;AAChG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF,4MAA4M;AAC5M,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,uKAAuK;AACvK,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,oLAAoL;AACpL,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1F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AAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,6LAA6L;AAC7L,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1D,6JAA6J;IAC7J,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,kBAAkB,GAAG,aAAa,CAAC;AAExD,kMAAkM;AAClM,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,MAAM,CAC9E,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAC7B,IAAI,CACL,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/modules/error/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TErrorScope } from '../definition';\nimport type { TErrorLogLevel } from './constants';\n\n/** Resolved message a client renders. All fields always present - no null-checks downstream. */\nexport type TErrorNormalized = {\n text: string;\n code: string;\n args: Record<string, unknown>;\n};\n\n/** Wire payload as a CLIENT receives it - the input to {@link ApplicationError.fromError}. Every field is optional on purpose: a client parses what a gateway, a proxy or an older server actually sent. */\nexport type TResponsedError = {\n message?: string;\n statusCode?: number;\n normalized?: Partial<TErrorNormalized>;\n extra?: Record<string, unknown>;\n requestId?: string;\n details?: Record<string, unknown>;\n};\n\n/** The message a CALLER supplies - only `text` is required, the rest is what {@link TErrorNormalized} resolves; every other message shape is derived from this one. */\nexport type TErrorMessageInput = {\n text: string;\n code?: TErrorKey | (string & Record<never, never>);\n args?: Record<string, unknown>;\n};\n\n/** Catalogued message - `code` required, typed `string` and not {@link TErrorKey}: catalogs DECLARE the registry keys, so typing against the registry would be self-referential. */\nexport type TErrorDefinitionMessage = Omit<TErrorMessageInput, 'code'> & { code: string };\n\n/** The free-form input: a bare string is the historical shape. */\nexport type TErrorMessage = string | TErrorMessageInput;\n\n/** The catalogued form's override - every field optional, since the definition supplies the rest. */\nexport type TErrorMessageOverride = string | Partial<TErrorMessageInput>;\n\nexport type TErrorDefinition = {\n message: TErrorDefinitionMessage;\n statusCode: number;\n category?: TErrorScope;\n description?: string;\n};\n\n/** Augmented per-package via declaration merging, driving `messageCode` autocomplete. */\nexport interface IErrorKeyRegistry {}\n\nexport type TErrorKey = [keyof IErrorKeyRegistry] extends [never]\n ? string\n : Extract<keyof IErrorKeyRegistry, string>;\n\n/** Builds {@link TErrorNormalized} in place of the default; `message` is the default it replaces. */\nexport type TErrorNormalizeTransformFn = (opts: {\n message: TErrorNormalized;\n statusCode: number;\n extra?: Record<string, unknown>;\n}) => TErrorNormalized;\n\n/** Shared by both input forms - unknown keys ride the index signature into `extra`, so a throw site can attach context the framework does not model, and so does a mistyped key. */\ntype TErrorCommon = {\n statusCode?: number;\n messageArgs?: Record<string, unknown>;\n cause?: unknown;\n extra?: Record<string, unknown>;\n transform?: TErrorNormalizeTransformFn;\n logLevel?: TErrorLogLevel; // Default: error\n};\n\n/** Catalogued form - `message` and `statusCode` override the definition's defaults; the object form is partial, so `{ message: { args } }` amends the args and keeps the definition's text and code. */\nexport type TErrorByDefinition = TErrorCommon & {\n error: TErrorDefinition;\n message?: TErrorMessageOverride;\n [key: string]: unknown;\n};\n\n/** Free-form: an invariant, a misconfiguration, a failure carrying no i18n code. `message` is the only required field - most throw sites legitimately fall back to `MessageCode.DEFAULT`. */\nexport type TErrorByField = TErrorCommon & {\n message: TErrorMessage;\n messageCode?: TErrorKey | (string & Record<never, never>);\n /** Never valid here - `error` is the catalogued form's discriminant and a CONSUMED key, so a wrapped failure passed as `error` would vanish; use `cause`. */\n error?: never;\n [key: string]: unknown;\n};\n\nexport type TError = TErrorByDefinition | TErrorByField;\n\n/** Registers a catalog's keys with {@link IErrorKeyRegistry}, via `declare module '@venizia/ignis-helpers' { interface IErrorKeyRegistry extends TRegisterErrors<typeof CategoryErrors> {} }`. */\nexport type TRegisterErrors<T extends Record<string, TErrorDefinition>> = Record<\n T[keyof T]['message']['code'],\n true\n>;\n"]}
@@ -1,10 +0,0 @@
1
- import type { TConstValue } from '../../common/types';
2
- export declare class ErrorScopes {
3
- static readonly AUTH = "auth";
4
- static readonly VALIDATION = "validation";
5
- static readonly BUSINESS = "business";
6
- static readonly SYSTEM = "system";
7
- static readonly INTEGRATION = "integration";
8
- }
9
- export type TErrorScope = TConstValue<typeof ErrorScopes>;
10
- //# sourceMappingURL=definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../src/modules/error/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAiB;CAC7C;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorScopes = void 0;
4
- class ErrorScopes {
5
- static { this.AUTH = 'auth'; }
6
- static { this.VALIDATION = 'validation'; }
7
- static { this.BUSINESS = 'business'; }
8
- static { this.SYSTEM = 'system'; }
9
- static { this.INTEGRATION = 'integration'; }
10
- }
11
- exports.ErrorScopes = ErrorScopes;
12
- //# sourceMappingURL=definition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../../src/modules/error/definition.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;aACN,SAAI,GAAG,MAAM,CAAC;aACd,eAAU,GAAG,YAAY,CAAC;aAC1B,aAAQ,GAAG,UAAU,CAAC;aACtB,WAAM,GAAG,QAAQ,CAAC;aAClB,gBAAW,GAAG,aAAa,CAAC;;AAL9C,kCAMC","sourcesContent":["import type { TConstValue } from '@/common/types';\n\nexport class ErrorScopes {\n static readonly AUTH = 'auth';\n static readonly VALIDATION = 'validation';\n static readonly BUSINESS = 'business';\n static readonly SYSTEM = 'system';\n static readonly INTEGRATION = 'integration';\n}\n\nexport type TErrorScope = TConstValue<typeof ErrorScopes>;\n"]}
@@ -1,6 +0,0 @@
1
- export * from './app-error';
2
- export * from './common';
3
- export * from './definition';
4
- export * from './message-code';
5
- export * from './message-template';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./app-error"), exports);
18
- __exportStar(require("./common"), exports);
19
- __exportStar(require("./definition"), exports);
20
- __exportStar(require("./message-code"), exports);
21
- __exportStar(require("./message-template"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,+CAA6B;AAC7B,iDAA+B;AAC/B,qDAAmC","sourcesContent":["export * from './app-error';\nexport * from './common';\nexport * from './definition';\nexport * from './message-code';\nexport * from './message-template';\n"]}
@@ -1,28 +0,0 @@
1
- import type { TNullable } from '../../common/types';
2
- import type { TError } from './common';
3
- type TErrorFactory = (opts: TError) => Error;
4
- export declare class MessageCode {
5
- static readonly SEPARATOR = ".";
6
- static readonly SEGMENT_PATTERN: RegExp;
7
- static readonly MIN_SEGMENTS = 2;
8
- static readonly DEFAULT = "core.system_error";
9
- private static errorFactory;
10
- /**
11
- * Registered by the package entry at module init; keeps the throws identical without a
12
- * static import of app-error (that import was the cycle).
13
- * @internal Framework wiring; consumers must not replace the factory.
14
- */
15
- static useErrorFactory(opts: {
16
- factory: TErrorFactory;
17
- }): void;
18
- /** Builds a code from its segments, throwing on a malformed one - codes are declared at module scope, so a bad code fails the process at import instead of shipping dead into production. */
19
- static build(opts: {
20
- parts: Array<string>;
21
- }): string;
22
- /** True when `code` is well-formed. Takes `unknown` because it guards codes arriving from outside - a guard that throws on the very input it exists to screen is not a guard. */
23
- static isValid(code: unknown): boolean;
24
- /** Normalizes an absent, empty or non-string code to {@link DEFAULT}. */
25
- static resolve(code?: TNullable<string>): string;
26
- }
27
- export {};
28
- //# sourceMappingURL=message-code.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message-code.d.ts","sourceRoot":"","sources":["../../../../src/modules/error/message-code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;AAE7C,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,SAAS,OAAO;IAChC,MAAM,CAAC,QAAQ,CAAC,eAAe,SAA8B;IAC7D,MAAM,CAAC,QAAQ,CAAC,YAAY,KAAK;IACjC,MAAM,CAAC,QAAQ,CAAC,OAAO,uBAAuB;IAG9C,OAAO,CAAC,MAAM,CAAC,YAAY,CAEiE;IAE5F;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI;IAI9D,6LAA6L;IAC7L,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE,GAAG,MAAM;IAsBpD,iLAAiL;IACjL,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAatC,yEAAyE;IACzE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;CAKjD"}