@digitaldefiance/i18n-lib 2.0.3 → 2.1.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.
- package/README.md +166 -4
- package/package.json +1 -1
- package/src/builders/i18n-builder.d.ts +2 -0
- package/src/builders/i18n-builder.d.ts.map +1 -1
- package/src/builders/i18n-builder.js +8 -0
- package/src/builders/i18n-builder.js.map +1 -1
- package/src/core/i18n-engine.d.ts +7 -0
- package/src/core/i18n-engine.d.ts.map +1 -1
- package/src/core/i18n-engine.js +171 -10
- package/src/core/i18n-engine.js.map +1 -1
- package/src/errors/i18n-error.d.ts +2 -0
- package/src/errors/i18n-error.d.ts.map +1 -1
- package/src/errors/i18n-error.js +4 -0
- package/src/errors/i18n-error.js.map +1 -1
- package/src/errors/index.d.ts +4 -4
- package/src/errors/index.d.ts.map +1 -1
- package/src/errors/index.js +4 -4
- package/src/errors/index.js.map +1 -1
- package/src/errors/{plugin-translatable-generic.d.ts → translatable-generic.d.ts} +4 -4
- package/src/errors/translatable-generic.d.ts.map +1 -0
- package/src/errors/{plugin-translatable-generic.js → translatable-generic.js} +8 -8
- package/src/errors/translatable-generic.js.map +1 -0
- package/src/errors/{plugin-translatable-handleable-generic.d.ts → translatable-handleable-generic.d.ts} +3 -3
- package/src/errors/translatable-handleable-generic.d.ts.map +1 -0
- package/src/errors/{plugin-translatable-handleable-generic.js → translatable-handleable-generic.js} +5 -5
- package/src/errors/translatable-handleable-generic.js.map +1 -0
- package/src/errors/translatable.d.ts +2 -2
- package/src/errors/translatable.d.ts.map +1 -1
- package/src/errors/translatable.js +4 -4
- package/src/errors/translatable.js.map +1 -1
- package/src/errors/typed-handleable.d.ts +2 -1
- package/src/errors/typed-handleable.d.ts.map +1 -1
- package/src/errors/typed-handleable.js +12 -4
- package/src/errors/typed-handleable.js.map +1 -1
- package/src/errors/typed.d.ts +19 -2
- package/src/errors/typed.d.ts.map +1 -1
- package/src/errors/typed.js +88 -30
- package/src/errors/typed.js.map +1 -1
- package/src/global-active-context.d.ts.map +1 -1
- package/src/global-active-context.js +6 -0
- package/src/global-active-context.js.map +1 -1
- package/src/index.d.ts +0 -5
- package/src/index.d.ts.map +1 -1
- package/src/index.js +0 -5
- package/src/index.js.map +1 -1
- package/src/utils/currency.d.ts +1 -0
- package/src/utils/currency.d.ts.map +1 -1
- package/src/utils/currency.js +4 -1
- package/src/utils/currency.js.map +1 -1
- package/src/utils/string-utils.d.ts.map +1 -1
- package/src/utils/string-utils.js +14 -2
- package/src/utils/string-utils.js.map +1 -1
- package/src/utils/timezone.d.ts +1 -0
- package/src/utils/timezone.d.ts.map +1 -1
- package/src/utils/timezone.js +3 -0
- package/src/utils/timezone.js.map +1 -1
- package/src/errors/plugin-translatable-generic.d.ts.map +0 -1
- package/src/errors/plugin-translatable-generic.js.map +0 -1
- package/src/errors/plugin-translatable-handleable-generic.d.ts.map +0 -1
- package/src/errors/plugin-translatable-handleable-generic.js.map +0 -1
- package/src/errors/plugin-typed-handleable.d.ts +0 -14
- package/src/errors/plugin-typed-handleable.d.ts.map +0 -1
- package/src/errors/plugin-typed-handleable.js +0 -51
- package/src/errors/plugin-typed-handleable.js.map +0 -1
package/src/errors/index.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
tslib_1.__exportStar(require("./i18n-error"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./handleable"), exports);
|
|
9
7
|
tslib_1.__exportStar(require("./context-error"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./
|
|
11
|
-
tslib_1.__exportStar(require("./
|
|
8
|
+
tslib_1.__exportStar(require("./handleable"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./i18n-error"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./translatable-generic"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./translatable-handleable-generic"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./translatable"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./typed-handleable"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./typed"), exports);
|
package/src/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uDAA6B;AAC7B,uDAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,0DAAgC;AAChC,uDAA6B;AAC7B,uDAA6B;AAC7B,iEAAuC;AACvC,4EAAkD;AAClD,yDAA+B;AAC/B,6DAAmC;AACnC,kDAAwB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18nEngine } from '../core';
|
|
2
2
|
/**
|
|
3
3
|
* Generic translatable error that works with any plugin engine and component
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class TranslatableGenericError<TStringKey extends string = string> extends Error {
|
|
6
6
|
readonly stringKey: TStringKey;
|
|
7
7
|
readonly componentId: string;
|
|
8
8
|
readonly language?: string;
|
|
@@ -21,10 +21,10 @@ export declare class PluginTranslatableGenericError<TStringKey extends string =
|
|
|
21
21
|
/**
|
|
22
22
|
* Create error with explicit engine instance
|
|
23
23
|
*/
|
|
24
|
-
static withEngine<TStringKey extends string>(engine:
|
|
24
|
+
static withEngine<TStringKey extends string>(engine: I18nEngine, componentId: string, stringKey: TStringKey, variables?: Record<string, string | number>, language?: string, metadata?: Record<string, any>): TranslatableGenericError<TStringKey>;
|
|
25
25
|
/**
|
|
26
26
|
* Retranslate the error message in a different language
|
|
27
27
|
*/
|
|
28
28
|
retranslate(language: string, instanceKey?: string): string;
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=translatable-generic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translatable-generic.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable-generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG;AACH,qBAAa,wBAAwB,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,KAAK;IACrF,SAAgB,SAAS,EAAE,UAAU,CAAC;IACtC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5D,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/C;;;;;;;;OAQG;gBAED,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,WAAW,CAAC,EAAE,MAAM;IA0BtB;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,UAAU,SAAS,MAAM,EACzC,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,wBAAwB,CAAC,UAAU,CAAC;IAqBvC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;CAa5D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.TranslatableGenericError = void 0;
|
|
4
|
+
const core_1 = require("../core");
|
|
5
5
|
/**
|
|
6
6
|
* Generic translatable error that works with any plugin engine and component
|
|
7
7
|
*/
|
|
8
|
-
class
|
|
8
|
+
class TranslatableGenericError extends Error {
|
|
9
9
|
stringKey;
|
|
10
10
|
componentId;
|
|
11
11
|
language;
|
|
@@ -23,7 +23,7 @@ class PluginTranslatableGenericError extends Error {
|
|
|
23
23
|
constructor(componentId, stringKey, variables, language, metadata, instanceKey) {
|
|
24
24
|
let translatedMessage;
|
|
25
25
|
try {
|
|
26
|
-
const engine =
|
|
26
|
+
const engine = core_1.I18nEngine.getInstance(instanceKey);
|
|
27
27
|
translatedMessage = engine.safeTranslate(componentId, stringKey, variables, language);
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
@@ -43,7 +43,7 @@ class PluginTranslatableGenericError extends Error {
|
|
|
43
43
|
*/
|
|
44
44
|
static withEngine(engine, componentId, stringKey, variables, language, metadata) {
|
|
45
45
|
const translatedMessage = engine.safeTranslate(componentId, stringKey, variables, language);
|
|
46
|
-
const error = Object.create(
|
|
46
|
+
const error = Object.create(TranslatableGenericError.prototype);
|
|
47
47
|
Error.call(error, translatedMessage);
|
|
48
48
|
error.name = 'TranslatableGenericError';
|
|
49
49
|
error.stringKey = stringKey;
|
|
@@ -59,7 +59,7 @@ class PluginTranslatableGenericError extends Error {
|
|
|
59
59
|
*/
|
|
60
60
|
retranslate(language, instanceKey) {
|
|
61
61
|
try {
|
|
62
|
-
const engine =
|
|
62
|
+
const engine = core_1.I18nEngine.getInstance(instanceKey);
|
|
63
63
|
return engine.safeTranslate(this.componentId, this.stringKey, this.variables, language);
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
@@ -67,5 +67,5 @@ class PluginTranslatableGenericError extends Error {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
exports.
|
|
71
|
-
//# sourceMappingURL=
|
|
70
|
+
exports.TranslatableGenericError = TranslatableGenericError;
|
|
71
|
+
//# sourceMappingURL=translatable-generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translatable-generic.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable-generic.ts"],"names":[],"mappings":";;;AAAA,kCAAqC;AAErC;;GAEG;AACH,MAAa,wBAA6D,SAAQ,KAAK;IACrE,SAAS,CAAa;IACtB,WAAW,CAAS;IACpB,QAAQ,CAAU;IAClB,SAAS,CAAmC;IAC5C,QAAQ,CAAuB;IAE/C;;;;;;;;OAQG;IACH,YACE,WAAmB,EACnB,SAAqB,EACrB,SAA2C,EAC3C,QAAiB,EACjB,QAA8B,EAC9B,WAAoB;QAEpB,IAAI,iBAAyB,CAAC;QAE9B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,iBAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YACnD,iBAAiB,GAAG,MAAM,CAAC,aAAa,CACtC,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,CACT,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gEAAgE;YAChE,iBAAiB,GAAG,IAAI,WAAW,IAAI,SAAS,GAAG,CAAC;QACtD,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,C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@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IHandleable } from '../interfaces/handleable';
|
|
2
|
-
import {
|
|
2
|
+
import { TranslatableGenericError } from './translatable-generic';
|
|
3
3
|
/**
|
|
4
4
|
* Generic translatable error that works with any plugin engine and component
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class TranslatableHandleableGenericError<TStringKey extends string = string> extends TranslatableGenericError<TStringKey> implements IHandleable {
|
|
7
7
|
private _handled;
|
|
8
8
|
readonly cause?: Error;
|
|
9
9
|
readonly statusCode: number;
|
|
@@ -26,4 +26,4 @@ export declare class PluginTranslatableHandleableGenericError<TStringKey extends
|
|
|
26
26
|
set handled(value: boolean);
|
|
27
27
|
toJSON(): Record<string, unknown>;
|
|
28
28
|
}
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=translatable-handleable-generic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translatable-handleable-generic.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable-handleable-generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;GAEG;AACH,qBAAa,kCAAkC,CAC3C,UAAU,SAAS,MAAM,GAAG,MAAM,CAEpC,SAAQ,wBAAwB,CAAC,UAAU,CAC3C,YAAW,WAAW;IAEtB,OAAO,CAAC,QAAQ,CAAS;IACzB,SAAyB,KAAK,CAAC,EAAE,KAAK,CAAC;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErC;;;;;;;;OAQG;gBAED,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,WAAW,CAAC,EAAE,MAAM,EACpB,iBAAiB,CAAC,EAAE;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB;IAOH,IAAW,OAAO,IAAI,OAAO,CAE5B;IACD,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAEhC;IACD,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAQlC"}
|
package/src/errors/{plugin-translatable-handleable-generic.js → translatable-handleable-generic.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.TranslatableHandleableGenericError = void 0;
|
|
4
|
+
const translatable_generic_1 = require("./translatable-generic");
|
|
5
5
|
/**
|
|
6
6
|
* Generic translatable error that works with any plugin engine and component
|
|
7
7
|
*/
|
|
8
|
-
class
|
|
8
|
+
class TranslatableHandleableGenericError extends translatable_generic_1.TranslatableGenericError {
|
|
9
9
|
_handled = false;
|
|
10
10
|
cause;
|
|
11
11
|
statusCode;
|
|
@@ -40,5 +40,5 @@ class PluginTranslatableHandleableGenericError extends plugin_translatable_gener
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
exports.
|
|
44
|
-
//# sourceMappingURL=
|
|
43
|
+
exports.TranslatableHandleableGenericError = TranslatableHandleableGenericError;
|
|
44
|
+
//# sourceMappingURL=translatable-handleable-generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translatable-handleable-generic.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable-handleable-generic.ts"],"names":[],"mappings":";;;AACA,iEAAkE;AAElE;;GAEG;AACH,MAAa,kCAGX,SAAQ,+CAAoC;IAGpC,QAAQ,GAAG,KAAK,CAAC;IACA,KAAK,CAAS;IACvB,UAAU,CAAS;IACnB,UAAU,CAAW;IAErC;;;;;;;;OAQG;IACH,YACE,WAAmB,EACnB,SAAqB,EACrB,SAA2C,EAC3C,QAAiB,EACjB,QAA8B,EAC9B,WAAoB,EACpB,iBAIC;QAED,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC1E,IAAI,CAAC,UAAU,GAAG,iBAAiB,EAAE,UAAU,IAAI,GAAG,CAAC;QACvD,IAAI,CAAC,KAAK,GAAG,iBAAiB,EAAE,KAAK,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,iBAAiB,EAAE,UAAU,CAAC;IAClD,CAAC;IACD,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,IAAW,OAAO,CAAC,KAAc;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IACD,MAAM;QACJ,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;CACF;AApDD,gFAoDC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class TranslatableError<TStringKey extends string> extends Error {
|
|
2
|
-
constructor(string: TStringKey, otherVars?: Record<string, string | number>, language?: string);
|
|
1
|
+
export declare class TranslatableError<TStringKey extends string = string> extends Error {
|
|
2
|
+
constructor(componentId: string, stringKey: TStringKey, otherVars?: Record<string, string | number>, language?: string);
|
|
3
3
|
}
|
|
4
4
|
//# sourceMappingURL=translatable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translatable.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAiB,CAAC,UAAU,SAAS,MAAM,CAAE,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"translatable.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAiB,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,KAAK;gBAE5E,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM;CAOpB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TranslatableError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const i18n_engine_1 = require("../core/i18n-engine");
|
|
5
5
|
class TranslatableError extends Error {
|
|
6
|
-
constructor(
|
|
7
|
-
const engine =
|
|
8
|
-
super(engine.safeTranslate(
|
|
6
|
+
constructor(componentId, stringKey, otherVars, language) {
|
|
7
|
+
const engine = i18n_engine_1.I18nEngine.getInstance('default');
|
|
8
|
+
super(engine.safeTranslate(componentId, stringKey, otherVars, language));
|
|
9
9
|
this.name = 'TranslatableError';
|
|
10
10
|
Object.setPrototypeOf(this, TranslatableError.prototype);
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/translatable.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEjD,MAAa,iBAAsD,SAAQ,KAAK;IAC9E,YACE,WAAmB,EACnB,SAAqB,EACrB,SAA2C,EAC3C,QAAiB;QAEjB,MAAM,MAAM,GAAG,wBAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACjD,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;CACF;AAZD,8CAYC"}
|
|
@@ -3,11 +3,12 @@ import { IHandleable } from '../interfaces/handleable';
|
|
|
3
3
|
import { HandleableErrorOptions } from '../interfaces/handleable-error-options';
|
|
4
4
|
import { CompleteReasonMap } from './typed';
|
|
5
5
|
export declare class TypedHandleableError<TEnum extends Record<string, string>, TStringKey extends string> extends HandleableError implements IHandleable {
|
|
6
|
+
readonly componentId: string;
|
|
6
7
|
readonly type: TEnum[keyof TEnum];
|
|
7
8
|
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
8
9
|
readonly language?: string;
|
|
9
10
|
readonly otherVars?: Record<string, string | number>;
|
|
10
|
-
constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>,
|
|
11
|
+
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, source: Error, options?: HandleableErrorOptions, language?: string, otherVars?: Record<string, string | number>);
|
|
11
12
|
toJSON(): Record<string, unknown>;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=typed-handleable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-handleable.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed-handleable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,qBAAa,oBAAoB,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,CAE3B,SAAQ,eACR,YAAW,WAAW;IAEtB,SAAgB,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACzC,SAAgB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAChE,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;gBAG1D,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACxB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC/C,
|
|
1
|
+
{"version":3,"file":"typed-handleable.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed-handleable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,qBAAa,oBAAoB,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,CAE3B,SAAQ,eACR,YAAW,WAAW;IAEtB,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACzC,SAAgB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAChE,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;gBAG1D,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACxB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC/C,MAAM,EAAE,KAAK,EACb,OAAO,CAAC,EAAE,sBAAsB,EAChC,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IA2C7B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOlD"}
|
|
@@ -4,17 +4,17 @@ exports.TypedHandleableError = void 0;
|
|
|
4
4
|
const core_i18n_1 = require("../core-i18n");
|
|
5
5
|
const core_string_key_1 = require("../core-string-key");
|
|
6
6
|
const handleable_1 = require("./handleable");
|
|
7
|
-
const plugin_i18n_engine_1 = require("../plugin-i18n-engine");
|
|
8
7
|
const core_1 = require("../core");
|
|
9
8
|
class TypedHandleableError extends handleable_1.HandleableError {
|
|
9
|
+
componentId;
|
|
10
10
|
type;
|
|
11
11
|
reasonMap;
|
|
12
12
|
language;
|
|
13
13
|
otherVars;
|
|
14
|
-
constructor(type, reasonMap,
|
|
14
|
+
constructor(componentId, type, reasonMap, source, options, language, otherVars) {
|
|
15
15
|
const key = reasonMap[type];
|
|
16
16
|
if (!key) {
|
|
17
|
-
const coreEngine =
|
|
17
|
+
const coreEngine = core_1.I18nEngine.getInstance();
|
|
18
18
|
throw new Error(coreEngine.translate(core_i18n_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, {
|
|
19
19
|
stringKey: key,
|
|
20
20
|
}));
|
|
@@ -29,7 +29,15 @@ class TypedHandleableError extends handleable_1.HandleableError {
|
|
|
29
29
|
catch (error) {
|
|
30
30
|
message = String(type);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// Create a new error with the translated message
|
|
33
|
+
const errorWithMessage = new Error(message);
|
|
34
|
+
if (source?.stack) {
|
|
35
|
+
errorWithMessage.stack = source.stack;
|
|
36
|
+
}
|
|
37
|
+
// Pass source as cause if not already specified in options
|
|
38
|
+
const finalOptions = options?.cause ? options : { ...options, cause: source };
|
|
39
|
+
super(errorWithMessage, finalOptions);
|
|
40
|
+
this.componentId = componentId;
|
|
33
41
|
this.type = type;
|
|
34
42
|
this.reasonMap = reasonMap;
|
|
35
43
|
this.language = language;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-handleable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed-handleable.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AACnD,wDAAmD;AACnD,6CAA+C;
|
|
1
|
+
{"version":3,"file":"typed-handleable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed-handleable.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AACnD,wDAAmD;AACnD,6CAA+C;AAK/C,kCAAqC;AAErC,MAAa,oBAIX,SAAQ,4BAAe;IAGP,WAAW,CAAS;IACpB,IAAI,CAAqB;IACzB,SAAS,CAAuC;IAChD,QAAQ,CAAU;IAClB,SAAS,CAAmC;IAE5D,YACE,WAAmB,EACnB,IAAwB,EACxB,SAA+C,EAC/C,MAAa,EACb,OAAgC,EAChC,QAAiB,EACjB,SAA2C;QAE3C,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,UAAU,GAAG,iBAAU,CAAC,WAAW,EAAE,CAAC;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,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO;YACL,GAAG,QAAQ;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAtED,oDAsEC"}
|
package/src/errors/typed.d.ts
CHANGED
|
@@ -33,7 +33,8 @@ export declare abstract class TypedError<TEnum extends Record<string, string>, T
|
|
|
33
33
|
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Component-based TypedError that works with the component registration system
|
|
37
|
+
* @deprecated Use TypedError instead - PluginTypedError is an alias for backward compatibility
|
|
37
38
|
*/
|
|
38
39
|
export declare abstract class PluginTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
|
|
39
40
|
readonly componentId: string;
|
|
@@ -43,6 +44,17 @@ export declare abstract class PluginTypedError<TEnum extends Record<string, stri
|
|
|
43
44
|
readonly otherVars?: Record<string, string | number> | undefined;
|
|
44
45
|
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Component-based TypedError that works with the component registration system
|
|
49
|
+
*/
|
|
50
|
+
export declare abstract class ComponentTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
|
|
51
|
+
readonly componentId: string;
|
|
52
|
+
readonly type: TEnum[keyof TEnum];
|
|
53
|
+
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
54
|
+
readonly language?: string | undefined;
|
|
55
|
+
readonly otherVars?: Record<string, string | number> | undefined;
|
|
56
|
+
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
57
|
+
}
|
|
46
58
|
/**
|
|
47
59
|
* Core system TypedError using the core component strings
|
|
48
60
|
*/
|
|
@@ -54,9 +66,14 @@ export declare abstract class CoreTypedError<TEnum extends Record<string, string
|
|
|
54
66
|
constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, CoreStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
55
67
|
}
|
|
56
68
|
/**
|
|
57
|
-
* Helper function to create a
|
|
69
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
70
|
+
* @deprecated Use createComponentTypedError instead
|
|
58
71
|
*/
|
|
59
72
|
export declare function createPluginTypedError<TEnum extends Record<string, string>, TStringKey extends string>(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, otherVars?: Record<string, string | number>, language?: string, instanceKey?: string): Error;
|
|
73
|
+
/**
|
|
74
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
75
|
+
*/
|
|
76
|
+
export declare function createComponentTypedError<TEnum extends Record<string, string>, TStringKey extends string>(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, otherVars?: Record<string, string | number>, language?: string, instanceKey?: string): Error;
|
|
60
77
|
/**
|
|
61
78
|
* Helper function to create a core system TypedError with automatic engine detection
|
|
62
79
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAC3B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,E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AI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACxB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,EAClD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,KAAK,CAeP;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,EAEzB,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACxB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,CAAC,EACjD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CA2BP;AAED;;GAEG"}
|
package/src/errors/typed.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoreTypedError = exports.PluginTypedError = exports.TypedError = exports.BaseTypedError = void 0;
|
|
3
|
+
exports.CoreTypedError = exports.ComponentTypedError = exports.PluginTypedError = exports.TypedError = exports.BaseTypedError = void 0;
|
|
4
4
|
exports.createPluginTypedError = createPluginTypedError;
|
|
5
|
+
exports.createComponentTypedError = createComponentTypedError;
|
|
5
6
|
exports.createCoreTypedError = createCoreTypedError;
|
|
6
7
|
exports.createTranslatedError = createTranslatedError;
|
|
7
8
|
// New plugin architecture imports
|
|
8
9
|
// CoreLanguageCode is deprecated - using string for flexibility
|
|
9
10
|
const core_string_key_1 = require("../core-string-key");
|
|
10
11
|
const core_i18n_1 = require("../core-i18n");
|
|
11
|
-
const
|
|
12
|
+
const core_1 = require("../core");
|
|
12
13
|
/**
|
|
13
14
|
* Base typed error class with common patterns
|
|
14
15
|
*/
|
|
@@ -56,10 +57,19 @@ class TypedError extends Error {
|
|
|
56
57
|
otherVars;
|
|
57
58
|
constructor(componentId, type, reasonMap, language, otherVars) {
|
|
58
59
|
const key = reasonMap[type];
|
|
59
|
-
const engine =
|
|
60
|
+
const engine = core_1.I18nEngine.getInstance('default');
|
|
60
61
|
if (!key)
|
|
61
62
|
throw new Error(engine.safeTranslate(core_i18n_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, { type }, language));
|
|
62
|
-
|
|
63
|
+
// Use translate instead of safeTranslate to get actual translations
|
|
64
|
+
let message;
|
|
65
|
+
try {
|
|
66
|
+
message = engine.translate(componentId, key, otherVars, language);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Fallback to safeTranslate if translate fails
|
|
70
|
+
message = engine.safeTranslate(componentId, key, otherVars, language);
|
|
71
|
+
}
|
|
72
|
+
super(message);
|
|
63
73
|
this.componentId = componentId;
|
|
64
74
|
this.type = type;
|
|
65
75
|
this.reasonMap = reasonMap;
|
|
@@ -70,7 +80,8 @@ class TypedError extends Error {
|
|
|
70
80
|
}
|
|
71
81
|
exports.TypedError = TypedError;
|
|
72
82
|
/**
|
|
73
|
-
*
|
|
83
|
+
* Component-based TypedError that works with the component registration system
|
|
84
|
+
* @deprecated Use TypedError instead - PluginTypedError is an alias for backward compatibility
|
|
74
85
|
*/
|
|
75
86
|
class PluginTypedError extends Error {
|
|
76
87
|
componentId;
|
|
@@ -80,7 +91,7 @@ class PluginTypedError extends Error {
|
|
|
80
91
|
otherVars;
|
|
81
92
|
constructor(componentId, type, reasonMap, language, otherVars) {
|
|
82
93
|
const key = reasonMap[type];
|
|
83
|
-
const engine =
|
|
94
|
+
const engine = core_1.I18nEngine.getInstance('default');
|
|
84
95
|
// If key is not found in the reason map, use core error message
|
|
85
96
|
if (!key) {
|
|
86
97
|
const errorMsg = engine.safeTranslate(core_i18n_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_StringKeyNotFoundTemplate, {
|
|
@@ -101,6 +112,38 @@ class PluginTypedError extends Error {
|
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
exports.PluginTypedError = PluginTypedError;
|
|
115
|
+
/**
|
|
116
|
+
* Component-based TypedError that works with the component registration system
|
|
117
|
+
*/
|
|
118
|
+
class ComponentTypedError extends Error {
|
|
119
|
+
componentId;
|
|
120
|
+
type;
|
|
121
|
+
reasonMap;
|
|
122
|
+
language;
|
|
123
|
+
otherVars;
|
|
124
|
+
constructor(componentId, type, reasonMap, language, otherVars) {
|
|
125
|
+
const key = reasonMap[type];
|
|
126
|
+
const engine = core_1.I18nEngine.getInstance('default');
|
|
127
|
+
// If key is not found in the reason map, use core error message
|
|
128
|
+
if (!key) {
|
|
129
|
+
const errorMsg = engine.safeTranslate(core_i18n_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_StringKeyNotFoundTemplate, {
|
|
130
|
+
stringKey: String(type),
|
|
131
|
+
componentId: componentId,
|
|
132
|
+
}, language);
|
|
133
|
+
throw new Error(errorMsg);
|
|
134
|
+
}
|
|
135
|
+
// Translate the error message using the component and string key
|
|
136
|
+
const translatedMessage = engine.safeTranslate(componentId, key, otherVars, language);
|
|
137
|
+
super(translatedMessage);
|
|
138
|
+
this.componentId = componentId;
|
|
139
|
+
this.type = type;
|
|
140
|
+
this.reasonMap = reasonMap;
|
|
141
|
+
this.language = language;
|
|
142
|
+
this.otherVars = otherVars;
|
|
143
|
+
this.name = this.constructor.name;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ComponentTypedError = ComponentTypedError;
|
|
104
147
|
/**
|
|
105
148
|
* Core system TypedError using the core component strings
|
|
106
149
|
*/
|
|
@@ -111,7 +154,7 @@ class CoreTypedError extends Error {
|
|
|
111
154
|
otherVars;
|
|
112
155
|
constructor(type, reasonMap, language, otherVars) {
|
|
113
156
|
const key = reasonMap[type];
|
|
114
|
-
const engine =
|
|
157
|
+
const engine = core_1.I18nEngine.getInstance('default');
|
|
115
158
|
// If key is not found in the reason map, use a fallback error
|
|
116
159
|
if (!key) {
|
|
117
160
|
const errorMsg = engine.safeTranslate(core_i18n_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_StringKeyNotFoundTemplate, {
|
|
@@ -132,26 +175,45 @@ class CoreTypedError extends Error {
|
|
|
132
175
|
}
|
|
133
176
|
exports.CoreTypedError = CoreTypedError;
|
|
134
177
|
/**
|
|
135
|
-
* Helper function to create a
|
|
178
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
179
|
+
* @deprecated Use createComponentTypedError instead
|
|
136
180
|
*/
|
|
137
181
|
function createPluginTypedError(componentId, type, reasonMap, otherVars, language, instanceKey) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
182
|
+
return createComponentTypedError(componentId, type, reasonMap, otherVars, language, instanceKey);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
186
|
+
*/
|
|
187
|
+
function createComponentTypedError(componentId, type, reasonMap, otherVars, language, instanceKey) {
|
|
188
|
+
// Get the engine to ensure it exists, but the error class will get it again
|
|
189
|
+
const engine = core_1.I18nEngine.getInstance(instanceKey || 'default');
|
|
190
|
+
const key = reasonMap[type];
|
|
191
|
+
if (!key) {
|
|
192
|
+
throw new Error(`Missing key for type ${type} in reason map`);
|
|
193
|
+
}
|
|
194
|
+
const message = engine.safeTranslate(componentId, key, otherVars, language);
|
|
195
|
+
const error = new Error(message);
|
|
196
|
+
error.type = type;
|
|
197
|
+
error.componentId = componentId;
|
|
198
|
+
error.reasonMap = reasonMap;
|
|
199
|
+
error.name = 'PluginTypedError';
|
|
200
|
+
return error;
|
|
144
201
|
}
|
|
145
202
|
/**
|
|
146
203
|
* Helper function to create a core system TypedError with automatic engine detection
|
|
147
204
|
*/
|
|
148
205
|
function createCoreTypedError(type, reasonMap, otherVars, language, instanceKey) {
|
|
149
|
-
const engine =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
206
|
+
const engine = core_1.I18nEngine.getInstance(instanceKey || 'default');
|
|
207
|
+
const key = reasonMap[type];
|
|
208
|
+
if (!key) {
|
|
209
|
+
throw new Error(`Missing key for type ${type} in reason map`);
|
|
210
|
+
}
|
|
211
|
+
const message = engine.safeTranslate(core_i18n_1.CoreI18nComponentId, key, otherVars, language);
|
|
212
|
+
const error = new Error(message);
|
|
213
|
+
error.type = type;
|
|
214
|
+
error.reasonMap = reasonMap;
|
|
215
|
+
error.name = 'CoreTypedError';
|
|
216
|
+
return error;
|
|
155
217
|
}
|
|
156
218
|
/**
|
|
157
219
|
* Create a simple error with translation support (generalized pattern from RegistryError)
|
|
@@ -198,18 +260,16 @@ const coreErrorReasonMap: CompleteReasonMap<typeof DatabaseErrorType, CoreString
|
|
|
198
260
|
|
|
199
261
|
class DatabaseError extends CoreTypedError<typeof DatabaseErrorType> {
|
|
200
262
|
constructor(
|
|
201
|
-
engine: PluginI18nEngine<CoreLanguageCode>,
|
|
202
263
|
type: DatabaseErrorType,
|
|
203
264
|
otherVars?: Record<string, string | number>,
|
|
204
|
-
language?:
|
|
265
|
+
language?: string
|
|
205
266
|
) {
|
|
206
|
-
super(
|
|
267
|
+
super(type, coreErrorReasonMap, language, otherVars);
|
|
207
268
|
}
|
|
208
269
|
}
|
|
209
270
|
|
|
210
271
|
// Usage:
|
|
211
|
-
//
|
|
212
|
-
// throw new DatabaseError(engine, DatabaseErrorType.ConnectionFailed);
|
|
272
|
+
// throw new DatabaseError(DatabaseErrorType.ConnectionFailed);
|
|
213
273
|
*/
|
|
214
274
|
// Example 2: Custom component error with custom strings
|
|
215
275
|
/*
|
|
@@ -231,20 +291,18 @@ const userErrorReasonMap: CompleteReasonMap<typeof UserErrorType, UserErrorStrin
|
|
|
231
291
|
[UserErrorType.AccountLocked]: UserErrorStringKey.AccountLockedMessage
|
|
232
292
|
};
|
|
233
293
|
|
|
234
|
-
class UserError extends PluginTypedError<typeof UserErrorType, UserErrorStringKey
|
|
294
|
+
class UserError extends PluginTypedError<typeof UserErrorType, UserErrorStringKey> {
|
|
235
295
|
constructor(
|
|
236
|
-
engine: PluginI18nEngine<string>,
|
|
237
296
|
type: UserErrorType,
|
|
238
297
|
otherVars?: Record<string, string | number>,
|
|
239
298
|
language?: string
|
|
240
299
|
) {
|
|
241
|
-
super(
|
|
300
|
+
super('user-system', type, userErrorReasonMap, language, otherVars);
|
|
242
301
|
}
|
|
243
302
|
}
|
|
244
303
|
|
|
245
304
|
// Usage:
|
|
246
|
-
//
|
|
247
|
-
// throw new UserError(engine, UserErrorType.UserNotFound, { username: 'john_doe' });
|
|
305
|
+
// throw new UserError(UserErrorType.UserNotFound, { username: 'john_doe' });
|
|
248
306
|
*/
|
|
249
307
|
// Example 3: Using helper functions for simpler error creation
|
|
250
308
|
/*
|
package/src/errors/typed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed.ts"],"names":[],"mappings":";;;AAmQA,wDAYC;AAKD,8DA2BC;AAKD,oDAqBC;AAKD,sDAuCC;AArXD,kCAAkC;AAClC,gEAAgE;AAChE,wDAAmD;AAEnD,4CAAmD;AACnD,kCAAqC;AAYrC;;GAEG;AACH,MAAsB,cAEpB,SAAQ,KAAK;IAEK;IAEA;IAHlB,YACkB,IAAwB,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,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAChD,EAAE,CAAC;IACL,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,GAAG,SAAS,IAAI,iBAAiB,CAAC;IAC3C,KAAa,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AAEH,mDAAmD;AACnD;;;;;;;;;;;;;;;;;;;;;;;;;EAyBE;AAEF,wDAAwD;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BE;AAEF,+DAA+D;AAC/D;;;;;;;;;;;;;;;;;;;EAmBE;AAEF,4DAA4D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-active-context.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/global-active-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAGL,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,qBAAa,mBAAmB,CAC9B,SAAS,SAAS,MAAM,EACxB,cAAc,SAAS,cAAc,CAAC,SAAS,CAAC,CAChD,YAAW,oBAAoB,CAAC,SAAS,EAAE,cAAc,CAAC;IAE1D,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAa;IAC3E,gBAAuB,iBAAiB,aAAa;IACrD,gBAAuB,eAAe,EAAE,MAAM,CAAW;IAEzD,OAAO,CAAC,MAAM,CAAC,SAAS,CAA4C;IACpE,WAAkB,QAAQ,IAAI,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAM1D;
|
|
1
|
+
{"version":3,"file":"global-active-context.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/global-active-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAGL,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,qBAAa,mBAAmB,CAC9B,SAAS,SAAS,MAAM,EACxB,cAAc,SAAS,cAAc,CAAC,SAAS,CAAC,CAChD,YAAW,oBAAoB,CAAC,SAAS,EAAE,cAAc,CAAC;IAE1D,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAa;IAC3E,gBAAuB,iBAAiB,aAAa;IACrD,gBAAuB,eAAe,EAAE,MAAM,CAAW;IAEzD,OAAO,CAAC,MAAM,CAAC,SAAS,CAA4C;IACpE,WAAkB,QAAQ,IAAI,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAM1D;WAQa,WAAW,CACvB,SAAS,SAAS,MAAM,EACxB,cAAc,SAAS,cAAc,CAAC,SAAS,CAAC,KAC7C,mBAAmB,CAAC,SAAS,EAAE,cAAc,CAAC;WAOrC,gBAAgB,CAC5B,QAAQ,EAAE,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,GACtC,IAAI;IAIA,aAAa,CAClB,eAAe,EAAE,SAAS,EAC1B,oBAAoB,GAAE,SAA2B,EACjD,GAAG,GAAE,MAA8C,GAClD,cAAc;IA6BV,UAAU,CACf,GAAG,GAA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+18,12 @@ class GlobalActiveContext {
|
|
|
18
18
|
}
|
|
19
19
|
return this._instance;
|
|
20
20
|
}
|
|
21
|
+
// Register in globalThis for cross-module access
|
|
22
|
+
static {
|
|
23
|
+
if (typeof globalThis !== 'undefined') {
|
|
24
|
+
globalThis.GlobalActiveContext = GlobalActiveContext;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
21
27
|
static getInstance() {
|
|
22
28
|
if (!this._instance) {
|
|
23
29
|
this._instance = new GlobalActiveContext();
|