@digitaldefiance/i18n-lib 1.3.11 → 1.3.12

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 CHANGED
@@ -2274,6 +2274,10 @@ For issues, questions, or contributions:
2274
2274
 
2275
2275
  ## ChangeLog
2276
2276
 
2277
+ ### Version 1.3.12
2278
+
2279
+ - Update typed-handleable to plugin i18n
2280
+
2277
2281
  ### Version 1.3.11
2278
2282
 
2279
2283
  - Export i18nconfig
@@ -11,18 +11,18 @@ export type CompleteReasonMap<TEnum extends Record<string, string | number>, TSt
11
11
  /**
12
12
  * Base typed error class with common patterns
13
13
  */
14
- export declare abstract class BaseTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
14
+ export declare abstract class BaseTypedError<TEnum extends Record<string, string>> extends Error {
15
15
  readonly type: TEnum[keyof TEnum];
16
16
  readonly metadata?: Record<string, any> | undefined;
17
17
  constructor(type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any> | undefined);
18
18
  /**
19
19
  * Create a simple typed error without engine dependency
20
20
  */
21
- static createSimple<TEnum extends Record<string, string>, TStringKey extends string, TError extends BaseTypedError<TEnum, TStringKey>>(this: new (type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>) => TError, type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>): TError;
21
+ static createSimple<TEnum extends Record<string, string>, TError extends BaseTypedError<TEnum>>(this: new (type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>) => TError, type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>): TError;
22
22
  /**
23
23
  * Create a typed error with translation support
24
24
  */
25
- static createTranslated<TEnum extends Record<string, string>, TStringKey extends string, TError extends BaseTypedError<TEnum, TStringKey>>(this: new (type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>) => TError, engine: TranslationEngine, componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, variables?: Record<string, string | number>, language?: string, metadata?: Record<string, any>): TError;
25
+ static createTranslated<TEnum extends Record<string, string>, TStringKey extends string, TError extends BaseTypedError<TEnum>>(this: new (type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any>) => TError, engine: TranslationEngine, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, variables?: Record<string, string | number>, language?: string, metadata?: Record<string, any>): TError;
26
26
  }
27
27
  /**
28
28
  * Legacy TypedError that ensures complete enum coverage (for backward compatibility)
@@ -29,7 +29,7 @@ class BaseTypedError extends Error {
29
29
  /**
30
30
  * Create a typed error with translation support
31
31
  */
32
- static createTranslated(engine, componentId, type, reasonMap, variables, language, metadata) {
32
+ static createTranslated(engine, type, reasonMap, variables, language, metadata) {
33
33
  const key = reasonMap[type];
34
34
  let message;
35
35
  if (key && engine) {
@@ -2,13 +2,13 @@ import { HandleableErrorOptions } from './i-handleable-error-options';
2
2
  import { IHandleable } from './i-handleable';
3
3
  import { HandleableError } from './handleable';
4
4
  import { CompleteReasonMap, TranslationEngine } from './typed-error';
5
- import { Language } from './default-config';
6
- export declare class TypedHandleableError<TEnum extends Record<string, string>, TStringKey extends string> extends HandleableError implements IHandleable {
5
+ import { CoreLanguageCode } from './core-i18n';
6
+ export declare class TypedHandleableError<TEnum extends Record<string, string>, TStringKey extends string, TLanguage extends CoreLanguageCode = CoreLanguageCode> extends HandleableError implements IHandleable {
7
7
  readonly type: TEnum[keyof TEnum];
8
8
  readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
9
9
  readonly engine: TranslationEngine<TStringKey>;
10
- readonly language?: Language;
10
+ readonly language?: TLanguage;
11
11
  readonly otherVars?: Record<string, string | number>;
12
- constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, engine: TranslationEngine<TStringKey>, language?: Language, otherVars?: Record<string, string | number>, options?: HandleableErrorOptions);
12
+ constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, engine: TranslationEngine<TStringKey>, language?: TLanguage, otherVars?: Record<string, string | number>, options?: HandleableErrorOptions);
13
13
  toJSON(): Record<string, unknown>;
14
14
  }
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TypedHandleableError = void 0;
4
4
  const handleable_1 = require("./handleable");
5
- const i18n_engine_1 = require("./i18n-engine");
5
+ const plugin_i18n_engine_1 = require("./plugin-i18n-engine");
6
6
  const core_string_key_1 = require("./core-string-key");
7
7
  class TypedHandleableError extends handleable_1.HandleableError {
8
8
  constructor(type, reasonMap, engine, language, otherVars, options) {
9
9
  const key = reasonMap[type];
10
10
  if (!key) {
11
- const coreEngine = i18n_engine_1.I18nEngine.getInstance();
12
- throw new Error(coreEngine.translate(core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, {
11
+ const coreEngine = plugin_i18n_engine_1.PluginI18nEngine.getInstance();
12
+ throw new Error(coreEngine.translate('core', core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, {
13
13
  stringKey: key,
14
14
  }));
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/i18n-lib",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "Generic i18n library with enum translation support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",