@digitaldefiance/i18n-lib 3.8.1 → 3.8.3
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/package.json +7 -6
- package/src/{active-context.ts → active-context.d.ts} +1 -0
- package/src/active-context.d.ts.map +1 -0
- package/src/active-context.js +3 -0
- package/src/active-context.js.map +1 -0
- package/src/builders/i18n-builder.d.ts +26 -0
- package/src/builders/i18n-builder.d.ts.map +1 -0
- package/src/builders/i18n-builder.js +70 -0
- package/src/builders/i18n-builder.js.map +1 -0
- package/src/builders/{index.ts → index.d.ts} +1 -1
- package/src/builders/index.d.ts.map +1 -0
- package/src/builders/index.js +8 -0
- package/src/builders/index.js.map +1 -0
- package/src/component-definition.d.ts +12 -0
- package/src/component-definition.d.ts.map +1 -0
- package/src/component-definition.js +3 -0
- package/src/component-definition.js.map +1 -0
- package/src/component-registration.d.ts +22 -0
- package/src/component-registration.d.ts.map +1 -0
- package/src/component-registration.js +3 -0
- package/src/component-registration.js.map +1 -0
- package/src/component-registry.d.ts +102 -0
- package/src/component-registry.d.ts.map +1 -0
- package/src/component-registry.js +282 -0
- package/src/component-registry.js.map +1 -0
- package/src/context-error-type.d.ts +8 -0
- package/src/context-error-type.d.ts.map +1 -0
- package/src/context-error-type.js +12 -0
- package/src/context-error-type.js.map +1 -0
- package/src/core/component-store.d.ts +93 -0
- package/src/core/component-store.d.ts.map +1 -0
- package/src/core/component-store.js +198 -0
- package/src/core/component-store.js.map +1 -0
- package/src/core/context-manager.d.ts +72 -0
- package/src/core/context-manager.d.ts.map +1 -0
- package/src/core/context-manager.js +98 -0
- package/src/core/context-manager.js.map +1 -0
- package/src/core/enum-registry.d.ts +48 -0
- package/src/core/enum-registry.d.ts.map +1 -0
- package/src/core/enum-registry.js +85 -0
- package/src/core/enum-registry.js.map +1 -0
- package/src/core/i18n-engine.d.ts +241 -0
- package/src/core/i18n-engine.d.ts.map +1 -0
- package/src/core/i18n-engine.js +568 -0
- package/src/core/i18n-engine.js.map +1 -0
- package/src/core/{index.ts → index.d.ts} +1 -4
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.js +21 -0
- package/src/core/index.js.map +1 -0
- package/src/core/language-registry.d.ts +180 -0
- package/src/core/language-registry.d.ts.map +1 -0
- package/src/core/language-registry.js +298 -0
- package/src/core/language-registry.js.map +1 -0
- package/src/{core-component-id.ts → core-component-id.d.ts} +2 -1
- package/src/core-component-id.d.ts.map +1 -0
- package/src/core-component-id.js +9 -0
- package/src/core-component-id.js.map +1 -0
- package/src/core-i18n.d.ts +69 -0
- package/src/core-i18n.d.ts.map +1 -0
- package/src/core-i18n.js +219 -0
- package/src/core-i18n.js.map +1 -0
- package/src/core-plugin-factory.d.ts +28 -0
- package/src/core-plugin-factory.d.ts.map +1 -0
- package/src/core-plugin-factory.js +80 -0
- package/src/core-plugin-factory.js.map +1 -0
- package/src/core-string-key.d.ts +52 -0
- package/src/core-string-key.d.ts.map +1 -0
- package/src/core-string-key.js +61 -0
- package/src/core-string-key.js.map +1 -0
- package/src/create-translation-adapter.d.ts +33 -0
- package/src/create-translation-adapter.d.ts.map +1 -0
- package/src/create-translation-adapter.js +72 -0
- package/src/create-translation-adapter.js.map +1 -0
- package/src/enum-registry.d.ts +65 -0
- package/src/enum-registry.d.ts.map +1 -0
- package/src/enum-registry.js +123 -0
- package/src/enum-registry.js.map +1 -0
- package/src/errors/{base.ts → base.d.ts} +1 -1
- package/src/errors/base.d.ts.map +1 -0
- package/src/errors/base.js +11 -0
- package/src/errors/base.js.map +1 -0
- package/src/errors/context-error.d.ts +50 -0
- package/src/errors/context-error.d.ts.map +1 -0
- package/src/errors/context-error.js +93 -0
- package/src/errors/context-error.js.map +1 -0
- package/src/errors/enhanced-error-base.d.ts +125 -0
- package/src/errors/enhanced-error-base.d.ts.map +1 -0
- package/src/errors/enhanced-error-base.js +165 -0
- package/src/errors/enhanced-error-base.js.map +1 -0
- package/src/errors/handleable.d.ts +83 -0
- package/src/errors/handleable.d.ts.map +1 -0
- package/src/errors/handleable.js +136 -0
- package/src/errors/handleable.js.map +1 -0
- package/src/errors/i18n-error.d.ts +211 -0
- package/src/errors/i18n-error.d.ts.map +1 -0
- package/src/errors/i18n-error.js +358 -0
- package/src/errors/i18n-error.js.map +1 -0
- package/src/errors/{index.ts → index.d.ts} +1 -4
- package/src/errors/index.d.ts.map +1 -0
- package/src/errors/index.js +17 -0
- package/src/errors/index.js.map +1 -0
- package/src/errors/simple-typed-error.d.ts +53 -0
- package/src/errors/simple-typed-error.d.ts.map +1 -0
- package/src/errors/simple-typed-error.js +51 -0
- package/src/errors/simple-typed-error.js.map +1 -0
- package/src/errors/{translatable-exports.ts → translatable-exports.d.ts} +1 -1
- package/src/errors/translatable-exports.d.ts.map +1 -0
- package/src/errors/translatable-exports.js +15 -0
- package/src/errors/translatable-exports.js.map +1 -0
- package/src/errors/translatable-generic.d.ts +87 -0
- package/src/errors/translatable-generic.d.ts.map +1 -0
- package/src/errors/translatable-generic.js +139 -0
- package/src/errors/translatable-generic.js.map +1 -0
- package/src/errors/translatable-handleable-generic.d.ts +116 -0
- package/src/errors/translatable-handleable-generic.d.ts.map +1 -0
- package/src/errors/translatable-handleable-generic.js +121 -0
- package/src/errors/translatable-handleable-generic.js.map +1 -0
- package/src/errors/translatable.d.ts +63 -0
- package/src/errors/translatable.d.ts.map +1 -0
- package/src/errors/translatable.js +85 -0
- package/src/errors/translatable.js.map +1 -0
- package/src/errors/typed-handleable.d.ts +62 -0
- package/src/errors/typed-handleable.d.ts.map +1 -0
- package/src/errors/typed-handleable.js +108 -0
- package/src/errors/typed-handleable.js.map +1 -0
- package/src/errors/typed.d.ts +206 -0
- package/src/errors/typed.d.ts.map +1 -0
- package/src/errors/typed.js +458 -0
- package/src/errors/typed.js.map +1 -0
- package/src/gender/{gender-categories.ts → gender-categories.d.ts} +2 -6
- package/src/gender/gender-categories.d.ts.map +1 -0
- package/src/gender/gender-categories.js +15 -0
- package/src/gender/gender-categories.js.map +1 -0
- package/src/gender/gender-resolver.d.ts +14 -0
- package/src/gender/gender-resolver.d.ts.map +1 -0
- package/src/gender/gender-resolver.js +35 -0
- package/src/gender/gender-resolver.js.map +1 -0
- package/src/gender/{index.ts → index.d.ts} +1 -0
- package/src/gender/index.d.ts.map +1 -0
- package/src/gender/index.js +6 -0
- package/src/gender/index.js.map +1 -0
- package/src/global-active-context.d.ts +50 -0
- package/src/global-active-context.d.ts.map +1 -0
- package/src/global-active-context.js +185 -0
- package/src/global-active-context.js.map +1 -0
- package/src/icu/ast.d.ts +48 -0
- package/src/icu/ast.d.ts.map +1 -0
- package/src/icu/ast.js +16 -0
- package/src/icu/ast.js.map +1 -0
- package/src/icu/compiler.d.ts +16 -0
- package/src/icu/compiler.d.ts.map +1 -0
- package/src/icu/compiler.js +87 -0
- package/src/icu/compiler.js.map +1 -0
- package/src/icu/formatter-registry.d.ts +10 -0
- package/src/icu/formatter-registry.d.ts.map +1 -0
- package/src/icu/formatter-registry.js +34 -0
- package/src/icu/formatter-registry.js.map +1 -0
- package/src/icu/formatters/base-formatter.d.ts +8 -0
- package/src/icu/formatters/base-formatter.d.ts.map +1 -0
- package/src/icu/formatters/base-formatter.js +3 -0
- package/src/icu/formatters/base-formatter.js.map +1 -0
- package/src/icu/formatters/date-formatter.d.ts +5 -0
- package/src/icu/formatters/date-formatter.d.ts.map +1 -0
- package/src/icu/formatters/date-formatter.js +31 -0
- package/src/icu/formatters/date-formatter.js.map +1 -0
- package/src/icu/formatters/number-formatter.d.ts +5 -0
- package/src/icu/formatters/number-formatter.d.ts.map +1 -0
- package/src/icu/formatters/number-formatter.js +33 -0
- package/src/icu/formatters/number-formatter.js.map +1 -0
- package/src/icu/formatters/plural-formatter.d.ts +5 -0
- package/src/icu/formatters/plural-formatter.d.ts.map +1 -0
- package/src/icu/formatters/plural-formatter.js +15 -0
- package/src/icu/formatters/plural-formatter.js.map +1 -0
- package/src/icu/formatters/select-formatter.d.ts +5 -0
- package/src/icu/formatters/select-formatter.d.ts.map +1 -0
- package/src/icu/formatters/select-formatter.js +10 -0
- package/src/icu/formatters/select-formatter.js.map +1 -0
- package/src/icu/formatters/selectordinal-formatter.d.ts +5 -0
- package/src/icu/formatters/selectordinal-formatter.d.ts.map +1 -0
- package/src/icu/formatters/selectordinal-formatter.js +22 -0
- package/src/icu/formatters/selectordinal-formatter.js.map +1 -0
- package/src/icu/formatters/time-formatter.d.ts +5 -0
- package/src/icu/formatters/time-formatter.d.ts.map +1 -0
- package/src/icu/formatters/time-formatter.js +31 -0
- package/src/icu/formatters/time-formatter.js.map +1 -0
- package/src/icu/helpers.d.ts +9 -0
- package/src/icu/helpers.d.ts.map +1 -0
- package/src/icu/helpers.js +31 -0
- package/src/icu/helpers.js.map +1 -0
- package/src/icu/parser.d.ts +31 -0
- package/src/icu/parser.d.ts.map +1 -0
- package/src/icu/parser.js +203 -0
- package/src/icu/parser.js.map +1 -0
- package/src/icu/runtime.d.ts +10 -0
- package/src/icu/runtime.d.ts.map +1 -0
- package/src/icu/runtime.js +33 -0
- package/src/icu/runtime.js.map +1 -0
- package/src/icu/tokenizer.d.ts +37 -0
- package/src/icu/tokenizer.d.ts.map +1 -0
- package/src/icu/tokenizer.js +187 -0
- package/src/icu/tokenizer.js.map +1 -0
- package/src/icu/validator.d.ts +11 -0
- package/src/icu/validator.d.ts.map +1 -0
- package/src/icu/validator.js +140 -0
- package/src/icu/validator.js.map +1 -0
- package/src/{index.ts → index.d.ts} +6 -38
- package/src/index.d.ts.map +1 -0
- package/src/index.js +76 -0
- package/src/index.js.map +1 -0
- package/src/interfaces/active-context.interface.d.ts +36 -0
- package/src/interfaces/active-context.interface.d.ts.map +1 -0
- package/src/interfaces/active-context.interface.js +3 -0
- package/src/interfaces/active-context.interface.js.map +1 -0
- package/src/interfaces/component-config.interface.d.ts +16 -0
- package/src/interfaces/component-config.interface.d.ts.map +1 -0
- package/src/interfaces/component-config.interface.js +6 -0
- package/src/interfaces/component-config.interface.js.map +1 -0
- package/src/interfaces/engine-config.interface.d.ts +22 -0
- package/src/interfaces/engine-config.interface.d.ts.map +1 -0
- package/src/interfaces/engine-config.interface.js +6 -0
- package/src/interfaces/engine-config.interface.js.map +1 -0
- package/src/interfaces/global-active-context.d.ts +23 -0
- package/src/interfaces/global-active-context.d.ts.map +1 -0
- package/src/interfaces/global-active-context.js +3 -0
- package/src/interfaces/global-active-context.js.map +1 -0
- package/src/interfaces/handleable-error-options.d.ts +14 -0
- package/src/interfaces/handleable-error-options.d.ts.map +1 -0
- package/src/interfaces/handleable-error-options.js +3 -0
- package/src/interfaces/handleable-error-options.js.map +1 -0
- package/src/interfaces/handleable.d.ts +21 -0
- package/src/interfaces/handleable.d.ts.map +1 -0
- package/src/interfaces/handleable.js +3 -0
- package/src/interfaces/handleable.js.map +1 -0
- package/src/interfaces/i18n-engine.interface.d.ts +46 -0
- package/src/interfaces/i18n-engine.interface.d.ts.map +1 -0
- package/src/interfaces/i18n-engine.interface.js +6 -0
- package/src/interfaces/i18n-engine.interface.js.map +1 -0
- package/src/interfaces/{index.ts → index.d.ts} +1 -1
- package/src/interfaces/index.d.ts.map +1 -0
- package/src/interfaces/index.js +7 -0
- package/src/interfaces/index.js.map +1 -0
- package/src/interfaces/language-definition.interface.d.ts +17 -0
- package/src/interfaces/language-definition.interface.d.ts.map +1 -0
- package/src/interfaces/language-definition.interface.js +6 -0
- package/src/interfaces/language-definition.interface.js.map +1 -0
- package/src/interfaces/translation-options.interface.d.ts +15 -0
- package/src/interfaces/translation-options.interface.d.ts.map +1 -0
- package/src/interfaces/translation-options.interface.js +6 -0
- package/src/interfaces/translation-options.interface.js.map +1 -0
- package/src/interfaces/validation-result.interface.d.ts +24 -0
- package/src/interfaces/validation-result.interface.d.ts.map +1 -0
- package/src/interfaces/validation-result.interface.js +6 -0
- package/src/interfaces/validation-result.interface.js.map +1 -0
- package/src/language-codes.d.ts +28 -0
- package/src/language-codes.d.ts.map +1 -0
- package/src/language-codes.js +32 -0
- package/src/language-codes.js.map +1 -0
- package/src/language-definition.d.ts +14 -0
- package/src/language-definition.d.ts.map +1 -0
- package/src/language-definition.js +3 -0
- package/src/language-definition.js.map +1 -0
- package/src/plugin-i18n-engine.d.ts +164 -0
- package/src/plugin-i18n-engine.d.ts.map +1 -0
- package/src/plugin-i18n-engine.js +493 -0
- package/src/plugin-i18n-engine.js.map +1 -0
- package/src/pluralization/{index.ts → index.d.ts} +1 -1
- package/src/pluralization/index.d.ts.map +1 -0
- package/src/pluralization/index.js +10 -0
- package/src/pluralization/index.js.map +1 -0
- package/src/pluralization/language-plural-map.d.ts +29 -0
- package/src/pluralization/language-plural-map.d.ts.map +1 -0
- package/src/pluralization/language-plural-map.js +155 -0
- package/src/pluralization/language-plural-map.js.map +1 -0
- package/src/pluralization/{plural-categories.ts → plural-categories.d.ts} +3 -5
- package/src/pluralization/plural-categories.d.ts.map +1 -0
- package/src/pluralization/plural-categories.js +8 -0
- package/src/pluralization/plural-categories.js.map +1 -0
- package/src/pluralization/plural-rules.d.ts +102 -0
- package/src/pluralization/plural-rules.d.ts.map +1 -0
- package/src/pluralization/plural-rules.js +263 -0
- package/src/pluralization/plural-rules.js.map +1 -0
- package/src/registry-config.d.ts +16 -0
- package/src/registry-config.d.ts.map +1 -0
- package/src/registry-config.js +3 -0
- package/src/registry-config.js.map +1 -0
- package/src/registry-error-type.d.ts +20 -0
- package/src/registry-error-type.d.ts.map +1 -0
- package/src/registry-error-type.js +24 -0
- package/src/registry-error-type.js.map +1 -0
- package/src/registry-error.d.ts +25 -0
- package/src/registry-error.d.ts.map +1 -0
- package/src/registry-error.js +63 -0
- package/src/registry-error.js.map +1 -0
- package/src/strict-types.d.ts +19 -0
- package/src/strict-types.d.ts.map +1 -0
- package/src/strict-types.js +18 -0
- package/src/strict-types.js.map +1 -0
- package/src/strings/de.d.ts +3 -0
- package/src/strings/de.d.ts.map +1 -0
- package/src/strings/de.js +57 -0
- package/src/strings/de.js.map +1 -0
- package/src/strings/en-GB.d.ts +3 -0
- package/src/strings/en-GB.d.ts.map +1 -0
- package/src/strings/en-GB.js +57 -0
- package/src/strings/en-GB.js.map +1 -0
- package/src/strings/en-US.d.ts +3 -0
- package/src/strings/en-US.d.ts.map +1 -0
- package/src/strings/en-US.js +57 -0
- package/src/strings/en-US.js.map +1 -0
- package/src/strings/es.d.ts +3 -0
- package/src/strings/es.d.ts.map +1 -0
- package/src/strings/es.js +57 -0
- package/src/strings/es.js.map +1 -0
- package/src/strings/fr.d.ts +3 -0
- package/src/strings/fr.d.ts.map +1 -0
- package/src/strings/fr.js +57 -0
- package/src/strings/fr.js.map +1 -0
- package/src/strings/ja.d.ts +3 -0
- package/src/strings/ja.d.ts.map +1 -0
- package/src/strings/ja.js +57 -0
- package/src/strings/ja.js.map +1 -0
- package/src/strings/uk.d.ts +3 -0
- package/src/strings/uk.d.ts.map +1 -0
- package/src/strings/uk.js +57 -0
- package/src/strings/uk.js.map +1 -0
- package/src/strings/zh-CN.d.ts +3 -0
- package/src/strings/zh-CN.d.ts.map +1 -0
- package/src/strings/zh-CN.js +57 -0
- package/src/strings/zh-CN.js.map +1 -0
- package/src/template.d.ts +13 -0
- package/src/template.d.ts.map +1 -0
- package/src/template.js +40 -0
- package/src/template.js.map +1 -0
- package/src/translation-engine.d.ts +9 -0
- package/src/translation-engine.d.ts.map +1 -0
- package/src/translation-engine.js +3 -0
- package/src/translation-engine.js.map +1 -0
- package/src/translation-request.d.ts +10 -0
- package/src/translation-request.d.ts.map +1 -0
- package/src/translation-request.js +3 -0
- package/src/translation-request.js.map +1 -0
- package/src/translation-response.d.ts +9 -0
- package/src/translation-response.d.ts.map +1 -0
- package/src/translation-response.js +3 -0
- package/src/translation-response.js.map +1 -0
- package/src/types/engine.d.ts +47 -0
- package/src/types/engine.d.ts.map +1 -0
- package/src/types/engine.js +8 -0
- package/src/types/engine.js.map +1 -0
- package/src/types/{index.ts → index.d.ts} +1 -1
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +9 -0
- package/src/types/index.js.map +1 -0
- package/src/types/{plural-types.ts → plural-types.d.ts} +3 -29
- package/src/types/plural-types.d.ts.map +1 -0
- package/src/types/plural-types.js +39 -0
- package/src/types/plural-types.js.map +1 -0
- package/src/{types.ts → types.d.ts} +21 -72
- package/src/types.d.ts.map +1 -0
- package/src/types.js +23 -0
- package/src/types.js.map +1 -0
- package/src/utils/currency.d.ts +81 -0
- package/src/utils/currency.d.ts.map +1 -0
- package/src/utils/currency.js +99 -0
- package/src/utils/currency.js.map +1 -0
- package/src/utils/html-escape.d.ts +22 -0
- package/src/utils/html-escape.d.ts.map +1 -0
- package/src/utils/html-escape.js +53 -0
- package/src/utils/html-escape.js.map +1 -0
- package/src/utils/{index.ts → index.d.ts} +1 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/index.js +12 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/lru-cache.d.ts +42 -0
- package/src/utils/lru-cache.d.ts.map +1 -0
- package/src/utils/lru-cache.js +73 -0
- package/src/utils/lru-cache.js.map +1 -0
- package/src/utils/{plural-helpers.ts → plural-helpers.d.ts} +4 -14
- package/src/utils/plural-helpers.d.ts.map +1 -0
- package/src/utils/plural-helpers.js +35 -0
- package/src/utils/plural-helpers.js.map +1 -0
- package/src/utils/safe-object.d.ts +39 -0
- package/src/utils/safe-object.d.ts.map +1 -0
- package/src/utils/{safe-object.ts → safe-object.js} +34 -37
- package/src/utils/safe-object.js.map +1 -0
- package/src/utils/string-utils.d.ts +28 -0
- package/src/utils/string-utils.d.ts.map +1 -0
- package/src/utils/string-utils.js +63 -0
- package/src/utils/string-utils.js.map +1 -0
- package/src/utils/timezone.d.ts +50 -0
- package/src/utils/timezone.d.ts.map +1 -0
- package/src/utils/timezone.js +74 -0
- package/src/utils/timezone.js.map +1 -0
- package/src/utils/validation.d.ts +40 -0
- package/src/utils/validation.d.ts.map +1 -0
- package/src/utils/validation.js +69 -0
- package/src/utils/validation.js.map +1 -0
- package/src/utils.d.ts +65 -0
- package/src/utils.d.ts.map +1 -0
- package/src/utils.js +129 -0
- package/src/utils.js.map +1 -0
- package/src/validation/{index.ts → index.d.ts} +1 -0
- package/src/validation/index.d.ts.map +1 -0
- package/src/validation/index.js +5 -0
- package/src/validation/index.js.map +1 -0
- package/src/validation/plural-validator.d.ts +46 -0
- package/src/validation/plural-validator.d.ts.map +1 -0
- package/src/validation/plural-validator.js +123 -0
- package/src/validation/plural-validator.js.map +1 -0
- package/src/validation-config.d.ts +12 -0
- package/src/validation-config.d.ts.map +1 -0
- package/src/validation-config.js +3 -0
- package/src/validation-config.js.map +1 -0
- package/src/validation-result.d.ts +13 -0
- package/src/validation-result.d.ts.map +1 -0
- package/src/validation-result.js +3 -0
- package/src/validation-result.js.map +1 -0
- package/LICENSE +0 -21
- package/src/builders/i18n-builder.ts +0 -82
- package/src/component-definition.ts +0 -11
- package/src/component-registration.ts +0 -29
- package/src/component-registry.ts +0 -432
- package/src/context-error-type.ts +0 -7
- package/src/core/component-store.ts +0 -241
- package/src/core/context-manager.ts +0 -113
- package/src/core/enum-registry.ts +0 -106
- package/src/core/i18n-engine.ts +0 -710
- package/src/core/language-registry.ts +0 -345
- package/src/core-i18n.ts +0 -270
- package/src/core-plugin-factory.ts +0 -111
- package/src/core-string-key.ts +0 -59
- package/src/create-translation-adapter.ts +0 -93
- package/src/enum-registry.ts +0 -152
- package/src/errors/context-error.ts +0 -122
- package/src/errors/enhanced-error-base.ts +0 -260
- package/src/errors/handleable.ts +0 -152
- package/src/errors/i18n-error.ts +0 -494
- package/src/errors/simple-typed-error.ts +0 -81
- package/src/errors/translatable-generic.ts +0 -245
- package/src/errors/translatable-handleable-generic.ts +0 -222
- package/src/errors/translatable.ts +0 -138
- package/src/errors/typed-handleable.ts +0 -138
- package/src/errors/typed.ts +0 -617
- package/src/gender/gender-resolver.ts +0 -40
- package/src/global-active-context.ts +0 -266
- package/src/icu/ast.ts +0 -56
- package/src/icu/compiler.ts +0 -96
- package/src/icu/formatter-registry.ts +0 -36
- package/src/icu/formatters/base-formatter.ts +0 -8
- package/src/icu/formatters/date-formatter.ts +0 -30
- package/src/icu/formatters/number-formatter.ts +0 -32
- package/src/icu/formatters/plural-formatter.ts +0 -12
- package/src/icu/formatters/select-formatter.ts +0 -7
- package/src/icu/formatters/selectordinal-formatter.ts +0 -17
- package/src/icu/formatters/time-formatter.ts +0 -30
- package/src/icu/helpers.ts +0 -34
- package/src/icu/parser.ts +0 -242
- package/src/icu/runtime.ts +0 -37
- package/src/icu/tokenizer.ts +0 -212
- package/src/icu/validator.ts +0 -163
- package/src/interfaces/active-context.interface.ts +0 -41
- package/src/interfaces/component-config.interface.ts +0 -17
- package/src/interfaces/engine-config.interface.ts +0 -22
- package/src/interfaces/global-active-context.ts +0 -39
- package/src/interfaces/handleable-error-options.ts +0 -13
- package/src/interfaces/handleable.ts +0 -20
- package/src/interfaces/i18n-engine.interface.ts +0 -57
- package/src/interfaces/language-definition.interface.ts +0 -17
- package/src/interfaces/translation-options.interface.ts +0 -15
- package/src/interfaces/validation-result.interface.ts +0 -24
- package/src/language-codes.ts +0 -40
- package/src/language-definition.ts +0 -13
- package/src/plugin-i18n-engine.ts +0 -707
- package/src/pluralization/language-plural-map.ts +0 -186
- package/src/pluralization/plural-rules.ts +0 -228
- package/src/registry-config.ts +0 -16
- package/src/registry-error-type.ts +0 -19
- package/src/registry-error.ts +0 -100
- package/src/strict-types.ts +0 -35
- package/src/strings/de.ts +0 -75
- package/src/strings/en-GB.ts +0 -74
- package/src/strings/en-US.ts +0 -74
- package/src/strings/es.ts +0 -74
- package/src/strings/fr.ts +0 -75
- package/src/strings/ja.ts +0 -73
- package/src/strings/uk.ts +0 -73
- package/src/strings/zh-CN.ts +0 -72
- package/src/template.ts +0 -72
- package/src/translation-engine.ts +0 -18
- package/src/translation-request.ts +0 -12
- package/src/translation-response.ts +0 -8
- package/src/types/engine.ts +0 -55
- package/src/utils/currency.ts +0 -141
- package/src/utils/html-escape.ts +0 -55
- package/src/utils/lru-cache.ts +0 -76
- package/src/utils/string-utils.ts +0 -77
- package/src/utils/timezone.ts +0 -76
- package/src/utils/validation.ts +0 -66
- package/src/utils.ts +0 -215
- package/src/validation/plural-validator.ts +0 -168
- package/src/validation-config.ts +0 -11
- package/src/validation-result.ts +0 -12
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypedHandleableError = void 0;
|
|
4
|
+
const core_component_id_1 = require("../core-component-id");
|
|
5
|
+
const core_string_key_1 = require("../core-string-key");
|
|
6
|
+
const i18n_engine_1 = require("../core/i18n-engine");
|
|
7
|
+
const handleable_1 = require("./handleable");
|
|
8
|
+
/**
|
|
9
|
+
* TypedHandleableError with full i18n feature support.
|
|
10
|
+
*
|
|
11
|
+
* Combines typed errors with handleable error patterns and full i18n capabilities.
|
|
12
|
+
*
|
|
13
|
+
* **Supported i18n Features** (via translation strings):
|
|
14
|
+
* - ICU MessageFormat: plural, select, selectordinal
|
|
15
|
+
* - Pluralization: 37 languages with CLDR rules
|
|
16
|
+
* - Gender support: male, female, neutral, other
|
|
17
|
+
* - Number formatting: integer, currency, percent
|
|
18
|
+
* - Nested messages: up to 4 levels deep
|
|
19
|
+
*
|
|
20
|
+
* **Translation String Examples:**
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Define error types
|
|
23
|
+
* enum NetworkError {
|
|
24
|
+
* Timeout = 'timeout',
|
|
25
|
+
* RateLimit = 'rateLimit'
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Register translations with ICU
|
|
29
|
+
* engine.registerComponent({
|
|
30
|
+
* component: { id: 'network', stringKeys: ['timeout', 'rateLimit'] },
|
|
31
|
+
* strings: {
|
|
32
|
+
* 'en-US': {
|
|
33
|
+
* timeout: \"{count, plural, one {# request timed out} other {# requests timed out}} after {seconds, number, integer} seconds\",
|
|
34
|
+
* rateLimit: \"Rate limit exceeded. {remaining, number, integer} requests remaining. Resets in {minutes, number, integer} minutes.\"
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Use typed handleable error
|
|
40
|
+
* try {
|
|
41
|
+
* await apiCall();
|
|
42
|
+
* } catch (error) {
|
|
43
|
+
* throw new TypedHandleableError(
|
|
44
|
+
* 'network',
|
|
45
|
+
* NetworkError.Timeout,
|
|
46
|
+
* reasonMap,
|
|
47
|
+
* error,
|
|
48
|
+
* { retryable: true },
|
|
49
|
+
* 'en-US',
|
|
50
|
+
* { count: 1, seconds: 30 }
|
|
51
|
+
* );
|
|
52
|
+
* }
|
|
53
|
+
* // Result: \"1 request timed out after 30 seconds\"
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
class TypedHandleableError extends handleable_1.HandleableError {
|
|
57
|
+
componentId;
|
|
58
|
+
type;
|
|
59
|
+
reasonMap;
|
|
60
|
+
language;
|
|
61
|
+
otherVars;
|
|
62
|
+
constructor(componentId, type, reasonMap, source, options, language, otherVars) {
|
|
63
|
+
const key = reasonMap[type];
|
|
64
|
+
// Lazy initialization: getInstance() is only called when error is constructed
|
|
65
|
+
let message = String(type);
|
|
66
|
+
try {
|
|
67
|
+
if (!key) {
|
|
68
|
+
const coreEngine = i18n_engine_1.I18nEngine.getInstance();
|
|
69
|
+
throw new Error(coreEngine.translate(core_component_id_1.CoreI18nComponentId, core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, {
|
|
70
|
+
stringKey: key,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const keyString = key;
|
|
74
|
+
const engine = i18n_engine_1.I18nEngine.getInstance('default');
|
|
75
|
+
const translated = engine.translate(componentId, keyString, otherVars, language);
|
|
76
|
+
message = String(translated || type);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// Fallback if engine not available
|
|
80
|
+
message = key ? `[${componentId}.${key}]` : String(type);
|
|
81
|
+
}
|
|
82
|
+
// Create a new error with the translated message
|
|
83
|
+
const errorWithMessage = new Error(message);
|
|
84
|
+
if (source?.stack) {
|
|
85
|
+
errorWithMessage.stack = source.stack;
|
|
86
|
+
}
|
|
87
|
+
// Pass source as cause if not already specified in options
|
|
88
|
+
const finalOptions = options?.cause
|
|
89
|
+
? options
|
|
90
|
+
: { ...options, cause: source };
|
|
91
|
+
super(errorWithMessage, finalOptions);
|
|
92
|
+
this.componentId = componentId;
|
|
93
|
+
this.type = type;
|
|
94
|
+
this.reasonMap = reasonMap;
|
|
95
|
+
this.language = language;
|
|
96
|
+
this.otherVars = otherVars;
|
|
97
|
+
this.name = 'TypedHandleableError';
|
|
98
|
+
}
|
|
99
|
+
toJSON() {
|
|
100
|
+
const baseJson = super.toJSON();
|
|
101
|
+
return {
|
|
102
|
+
...baseJson,
|
|
103
|
+
type: this.type,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.TypedHandleableError = TypedHandleableError;
|
|
108
|
+
//# sourceMappingURL=typed-handleable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-handleable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed-handleable.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAC3D,wDAAmD;AACnD,qDAAiD;AAGjD,6CAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAa,oBAIX,SAAQ,4BAAe;IAGE,WAAW,CAAS;IACpB,IAAI,CAAqB;IACzB,SAAS,CAAuC;IACzD,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;QAE5B,8EAA8E;QAC9E,IAAI,OAAO,GAAW,MAAM,CAAC,IAAI,CAA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AS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;IAEe,MAAM;QACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO;YACL,GAAG,QAAQ;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAjFD,oDAiFC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { CoreStringKey } from '../core-string-key';
|
|
2
|
+
import { TranslationEngine } from '../translation-engine';
|
|
3
|
+
import { TypedError as SimpleTypedError } from './simple-typed-error';
|
|
4
|
+
export type { TranslationEngine };
|
|
5
|
+
/**
|
|
6
|
+
* Type constraint to ensure reasonMap has entries for all enum values
|
|
7
|
+
*/
|
|
8
|
+
export type CompleteReasonMap<TEnum extends Record<string, string | number>, TStringKey extends string> = Record<TEnum[keyof TEnum], TStringKey>;
|
|
9
|
+
/**
|
|
10
|
+
* Base typed error class with full i18n feature support.
|
|
11
|
+
*
|
|
12
|
+
* **Supported i18n Features** (via translation strings):
|
|
13
|
+
* - ICU MessageFormat: plural, select, selectordinal
|
|
14
|
+
* - Pluralization: 37 languages with CLDR rules
|
|
15
|
+
* - Gender support: male, female, neutral, other
|
|
16
|
+
* - Number formatting: integer, currency, percent
|
|
17
|
+
* - Date/Time formatting: short, medium, long, full
|
|
18
|
+
* - Nested messages: up to 4 levels deep
|
|
19
|
+
*
|
|
20
|
+
* **Translation String Examples:**
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Register translations with ICU features
|
|
23
|
+
* engine.registerComponent({
|
|
24
|
+
* component: { id: 'errors', name: 'Errors', stringKeys: ['invalidCount'] },
|
|
25
|
+
* strings: {
|
|
26
|
+
* 'en-US': {
|
|
27
|
+
* invalidCount: "{count, plural, one {# item is invalid} other {# items are invalid}}"
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Use with typed error
|
|
33
|
+
* throw BaseTypedError.createTranslated(
|
|
34
|
+
* engine, 'errors', ErrorType.InvalidCount, reasonMap,
|
|
35
|
+
* { count: 5 }, 'en-US'
|
|
36
|
+
* );
|
|
37
|
+
* // Result: "5 items are invalid"
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare abstract class BaseTypedError<TEnum extends Record<string, string>> extends Error {
|
|
41
|
+
readonly type: TEnum[keyof TEnum];
|
|
42
|
+
readonly metadata?: Record<string, any> | undefined;
|
|
43
|
+
constructor(type: TEnum[keyof TEnum], message: string, metadata?: Record<string, any> | undefined);
|
|
44
|
+
/**
|
|
45
|
+
* Create a simple typed error without engine dependency
|
|
46
|
+
*/
|
|
47
|
+
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;
|
|
48
|
+
/**
|
|
49
|
+
* Create a typed error with translation support
|
|
50
|
+
*/
|
|
51
|
+
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, componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, variables?: Record<string, string | number>, language?: string, metadata?: Record<string, any>): TError;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* AbstractTypedError with complete enum coverage and full i18n feature support.
|
|
55
|
+
* @deprecated Use SimpleTypedError from './simple-typed-error' for new code
|
|
56
|
+
*
|
|
57
|
+
* **Supported i18n Features** (via translation strings):
|
|
58
|
+
* - ICU MessageFormat: plural, select, selectordinal
|
|
59
|
+
* - Pluralization: 37 languages with CLDR rules
|
|
60
|
+
* - Gender support: male, female, neutral, other
|
|
61
|
+
* - Number formatting: integer, currency, percent
|
|
62
|
+
* - Nested messages: up to 4 levels deep
|
|
63
|
+
*
|
|
64
|
+
* **Translation String Examples:**
|
|
65
|
+
* ```typescript
|
|
66
|
+
* // Define error types
|
|
67
|
+
* enum ValidationError {
|
|
68
|
+
* InvalidCount = 'invalidCount',
|
|
69
|
+
* ThresholdExceeded = 'thresholdExceeded'
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* // Register translations with ICU
|
|
73
|
+
* engine.registerComponent({
|
|
74
|
+
* component: { id: 'validation', stringKeys: ['invalidCount', 'thresholdExceeded'] },
|
|
75
|
+
* strings: {
|
|
76
|
+
* 'en-US': {
|
|
77
|
+
* invalidCount: "{count, plural, one {# error found} other {# errors found}}",
|
|
78
|
+
* thresholdExceeded: "Value {value, number, integer} exceeds limit"
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // Use typed error
|
|
84
|
+
* throw new MyTypedError('validation', ValidationError.InvalidCount, reasonMap, 'en-US', { count: 3 });
|
|
85
|
+
* // Result: "3 errors found"
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare abstract class AbstractTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
|
|
89
|
+
readonly componentId: string;
|
|
90
|
+
readonly type: TEnum[keyof TEnum];
|
|
91
|
+
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
92
|
+
readonly language?: string | undefined;
|
|
93
|
+
readonly otherVars?: Record<string, string | number> | undefined;
|
|
94
|
+
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Component-based TypedError that works with the component registration system
|
|
98
|
+
* @deprecated Use TypedError instead - PluginTypedError is an alias for backward compatibility
|
|
99
|
+
*/
|
|
100
|
+
export declare abstract class PluginTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
|
|
101
|
+
readonly componentId: string;
|
|
102
|
+
readonly type: TEnum[keyof TEnum];
|
|
103
|
+
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
104
|
+
readonly language?: string | undefined;
|
|
105
|
+
readonly otherVars?: Record<string, string | number> | undefined;
|
|
106
|
+
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Component-based TypedError with full i18n feature support.
|
|
110
|
+
*
|
|
111
|
+
* **Supported i18n Features** (via translation strings):
|
|
112
|
+
* - ICU MessageFormat: plural, select, selectordinal
|
|
113
|
+
* - Pluralization: 37 languages with CLDR rules
|
|
114
|
+
* - Gender support: male, female, neutral, other
|
|
115
|
+
* - Number formatting: integer, currency, percent
|
|
116
|
+
* - SelectOrdinal: 1st, 2nd, 3rd formatting
|
|
117
|
+
* - Nested messages: complex multi-level patterns
|
|
118
|
+
*
|
|
119
|
+
* **Translation String Examples:**
|
|
120
|
+
* ```typescript
|
|
121
|
+
* // Define component errors
|
|
122
|
+
* enum UserError {
|
|
123
|
+
* AccountLocked = 'accountLocked',
|
|
124
|
+
* TooManyAttempts = 'tooManyAttempts'
|
|
125
|
+
* }
|
|
126
|
+
*
|
|
127
|
+
* // Register with ICU features
|
|
128
|
+
* engine.registerComponent({
|
|
129
|
+
* component: { id: 'user', stringKeys: ['accountLocked', 'tooManyAttempts'] },
|
|
130
|
+
* strings: {
|
|
131
|
+
* 'en-US': {
|
|
132
|
+
* accountLocked: "{gender, select, male {His account} female {Her account} other {Their account}} is locked",
|
|
133
|
+
* tooManyAttempts: "{count, plural, one {# attempt} other {# attempts}} failed. Try again in {minutes, number, integer} minutes."
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
* });
|
|
137
|
+
*
|
|
138
|
+
* // Use component error
|
|
139
|
+
* throw new MyComponentError('user', UserError.TooManyAttempts, reasonMap, 'en-US', { count: 5, minutes: 10 });
|
|
140
|
+
* // Result: "5 attempts failed. Try again in 10 minutes."
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare abstract class ComponentTypedError<TEnum extends Record<string, string>, TStringKey extends string> extends Error {
|
|
144
|
+
readonly componentId: string;
|
|
145
|
+
readonly type: TEnum[keyof TEnum];
|
|
146
|
+
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
147
|
+
readonly language?: string | undefined;
|
|
148
|
+
readonly otherVars?: Record<string, string | number> | undefined;
|
|
149
|
+
constructor(componentId: string, type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Core system TypedError using core component strings with full i18n support.
|
|
153
|
+
*
|
|
154
|
+
* **Supported i18n Features** (via CoreStringKey translations):
|
|
155
|
+
* - ICU MessageFormat: plural, select, selectordinal
|
|
156
|
+
* - Pluralization: 37 languages with CLDR rules
|
|
157
|
+
* - Gender support: male, female, neutral, other
|
|
158
|
+
* - Number formatting: integer, currency, percent
|
|
159
|
+
* - Nested messages: complex patterns
|
|
160
|
+
*
|
|
161
|
+
* **Usage Example:**
|
|
162
|
+
* ```typescript
|
|
163
|
+
* // Define core error types
|
|
164
|
+
* enum CoreErrorType {
|
|
165
|
+
* InvalidOperation = 'invalidOperation',
|
|
166
|
+
* ResourceNotFound = 'resourceNotFound'
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* // Core strings already registered with ICU features
|
|
170
|
+
* const reasonMap: CompleteReasonMap<typeof CoreErrorType, CoreStringKey> = {
|
|
171
|
+
* [CoreErrorType.InvalidOperation]: CoreStringKey.Error_InvalidOperation,
|
|
172
|
+
* [CoreErrorType.ResourceNotFound]: CoreStringKey.Error_ResourceNotFound
|
|
173
|
+
* };
|
|
174
|
+
*
|
|
175
|
+
* // Use core typed error
|
|
176
|
+
* throw new MyCoreError(CoreErrorType.ResourceNotFound, reasonMap, 'en-US', { resource: 'user', id: 123 });
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export declare abstract class CoreTypedError<TEnum extends Record<string, string>> extends Error {
|
|
180
|
+
readonly type: TEnum[keyof TEnum];
|
|
181
|
+
readonly reasonMap: CompleteReasonMap<TEnum, CoreStringKey>;
|
|
182
|
+
readonly language?: string | undefined;
|
|
183
|
+
readonly otherVars?: Record<string, string | number> | undefined;
|
|
184
|
+
constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, CoreStringKey>, language?: string | undefined, otherVars?: Record<string, string | number> | undefined);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
188
|
+
* @deprecated Use createComponentTypedError instead
|
|
189
|
+
*/
|
|
190
|
+
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;
|
|
191
|
+
/**
|
|
192
|
+
* Helper function to create a component-based TypedError with automatic engine detection
|
|
193
|
+
*/
|
|
194
|
+
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): SimpleTypedError;
|
|
195
|
+
/**
|
|
196
|
+
* Helper function to create a core system TypedError with automatic engine detection
|
|
197
|
+
*/
|
|
198
|
+
export declare function createCoreTypedError<TEnum extends Record<string, string>>(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, CoreStringKey>, otherVars?: Record<string, string | number>, language?: string, instanceKey?: string): SimpleTypedError;
|
|
199
|
+
/**
|
|
200
|
+
* Create a simple error with translation support (generalized pattern from RegistryError)
|
|
201
|
+
*/
|
|
202
|
+
export declare function createTranslatedError<TEnum extends Record<string, string>, TStringKey extends string>(engine: TranslationEngine, componentId: string, type: TEnum[keyof TEnum], reasonMap: Record<TEnum[keyof TEnum], TStringKey>, variables?: Record<string, string | number>, language?: string, metadata?: Record<string, any>, errorName?: string): SimpleTypedError;
|
|
203
|
+
/**
|
|
204
|
+
* Example usage of the new plugin-based TypedError system
|
|
205
|
+
*/
|
|
206
|
+
//# sourceMappingURL=typed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/typed.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAC3B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC7C,UAAU,SAAS,MAAM,IACvB,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,8BAAsB,cAAc,CAClC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CACpC,SAAQ,KAAK;aAEc,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC;aAExB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAF9B,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACjD,OAAO,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