@digitaldefiance/i18n-lib 3.6.4 → 3.7.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.
Files changed (48) hide show
  1. package/README.md +120 -3
  2. package/package.json +1 -1
  3. package/src/errors/context-error.d.ts +33 -1
  4. package/src/errors/context-error.d.ts.map +1 -1
  5. package/src/errors/context-error.js +46 -3
  6. package/src/errors/context-error.js.map +1 -1
  7. package/src/errors/enhanced-error-base.d.ts +120 -0
  8. package/src/errors/enhanced-error-base.d.ts.map +1 -0
  9. package/src/errors/enhanced-error-base.js +165 -0
  10. package/src/errors/enhanced-error-base.js.map +1 -0
  11. package/src/errors/handleable.d.ts +38 -2
  12. package/src/errors/handleable.d.ts.map +1 -1
  13. package/src/errors/handleable.js +38 -2
  14. package/src/errors/handleable.js.map +1 -1
  15. package/src/errors/i18n-error.d.ts +91 -27
  16. package/src/errors/i18n-error.d.ts.map +1 -1
  17. package/src/errors/i18n-error.js +150 -40
  18. package/src/errors/i18n-error.js.map +1 -1
  19. package/src/errors/index.d.ts +1 -0
  20. package/src/errors/index.d.ts.map +1 -1
  21. package/src/errors/index.js +1 -0
  22. package/src/errors/index.js.map +1 -1
  23. package/src/errors/translatable-generic.d.ts +55 -1
  24. package/src/errors/translatable-generic.d.ts.map +1 -1
  25. package/src/errors/translatable-generic.js +64 -1
  26. package/src/errors/translatable-generic.js.map +1 -1
  27. package/src/errors/translatable-handleable-generic.d.ts +88 -1
  28. package/src/errors/translatable-handleable-generic.d.ts.map +1 -1
  29. package/src/errors/translatable-handleable-generic.js +77 -1
  30. package/src/errors/translatable-handleable-generic.js.map +1 -1
  31. package/src/errors/translatable.d.ts +55 -0
  32. package/src/errors/translatable.d.ts.map +1 -1
  33. package/src/errors/translatable.js +66 -0
  34. package/src/errors/translatable.js.map +1 -1
  35. package/src/errors/typed-handleable.d.ts +48 -0
  36. package/src/errors/typed-handleable.d.ts.map +1 -1
  37. package/src/errors/typed-handleable.js +48 -0
  38. package/src/errors/typed-handleable.js.map +1 -1
  39. package/src/errors/typed.d.ts +120 -4
  40. package/src/errors/typed.d.ts.map +1 -1
  41. package/src/errors/typed.js +120 -4
  42. package/src/errors/typed.js.map +1 -1
  43. package/src/icu/compiler.d.ts.map +1 -1
  44. package/src/icu/compiler.js +8 -2
  45. package/src/icu/compiler.js.map +1 -1
  46. package/src/icu/formatters/number-formatter.d.ts.map +1 -1
  47. package/src/icu/formatters/number-formatter.js +3 -0
  48. package/src/icu/formatters/number-formatter.js.map +1 -1
@@ -2,9 +2,45 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HandleableError = void 0;
4
4
  /**
5
- * Base error class that implements IHandleable interface.
5
+ * Base error class that implements IHandleable interface with full i18n support.
6
+ *
6
7
  * Provides enhanced error handling capabilities including status codes, handled state tracking,
7
- * and source data preservation.
8
+ * and source data preservation. Fully compatible with all i18n features when used with
9
+ * translation strings.
10
+ *
11
+ * **Supported i18n Features** (via translation strings in derived classes):
12
+ * - ICU MessageFormat: plural, select, selectordinal
13
+ * - Pluralization: 37 languages with CLDR rules
14
+ * - Gender support: male, female, neutral, other
15
+ * - Number formatting: integer, currency, percent
16
+ * - Nested messages: complex patterns
17
+ *
18
+ * **Usage Pattern:**
19
+ * ```typescript
20
+ * // Extend HandleableError with translated messages
21
+ * class MyHandleableError extends HandleableError {
22
+ * constructor(componentId: string, stringKey: string, variables?: Record<string, any>) {
23
+ * const engine = I18nEngine.getInstance();
24
+ * const message = engine.translate(componentId, stringKey, variables);
25
+ * const error = new Error(message);
26
+ * super(error, { statusCode: 400 });
27
+ * }
28
+ * }
29
+ *
30
+ * // Register translation with ICU features
31
+ * engine.registerComponent({
32
+ * component: { id: 'api', stringKeys: ['validationError'] },
33
+ * strings: {
34
+ * 'en-US': {
35
+ * validationError: \"{count, plural, one {# field is invalid} other {# fields are invalid}}\"
36
+ * }
37
+ * }
38
+ * });
39
+ *
40
+ * // Use with i18n features
41
+ * throw new MyHandleableError('api', 'validationError', { count: 3 });
42
+ * // Result: \"3 fields are invalid\"
43
+ * ```
8
44
  */
9
45
  class HandleableError extends Error {
10
46
  /** The original error that caused this error */
@@ -1 +1 @@
1
- {"version":3,"file":"handleable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/handleable.ts"],"names":[],"mappings":";;;AAUA;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,KAAK;IACxC,gDAAgD;IACvB,KAAK,CAAS;IACvC,kDAAkD;IAClC,UAAU,CAAS;IACnC,gDAAgD;IAChC,UAAU,CAAW;IACrC,+DAA+D;IACvD,QAAQ,CAAU;IAE1B;;;;OAIG;IACH,YAAY,MAAa,EAAE,OAAgC;QACzD,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAE9B,sEAAsE;QACtE,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,CAAC;aAAM,IAAK,KAAmC,CAAC,iBAAiB,EAAE,CAAC;YACjE,KAAmC,CAAC,iBAAiB,EAAE,CACtD,IAAI,EACJ,IAAI,CAAC,WAAW,CACjB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;QACjC,CAAC;IACH,CAAC;IAED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AI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;YACtC,GAAG,CAAC,IAAI,CAAC,UAAU;gBACjB,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACtD,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;CACF;AApGD,0CAoGC"}
1
+ {"version":3,"file":"handleable.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/handleable.ts"],"names":[],"mappings":";;;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAa,eAAgB,SAAQ,KAAK;IACxC,gDAAgD;IACvB,KAAK,CAAS;IACvC,kDAAkD;IAClC,UAAU,CAAS;IACnC,gDAAgD;IAChC,UAAU,CAAW;IACrC,+DAA+D;IACvD,QAAQ,CAAU;IAE1B;;;;OAIG;IACH,YAAY,MAAa,EAAE,OAAgC;QACzD,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,GAAG,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAE9B,sEAAsE;QACtE,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,CAAC;aAAM,IAAK,KAAmC,CAAC,iBAAiB,EAAE,CAAC;YACjE,KAAmC,CAAC,iBAAiB,E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AI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;YACtC,GAAG,CAAC,IAAI,CAAC,UAAU;gBACjB,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACtD,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;CACF;AApGD,0CAoGC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Unified error class for i18n library
2
+ * Unified error class for i18n library with ICU MessageFormat support
3
3
  */
4
4
  /**
5
5
  * Error codes used throughout the i18n library.
@@ -33,6 +33,14 @@ export declare const I18nErrorCode: {
33
33
  readonly INVALID_PLURAL_CATEGORY: "INVALID_PLURAL_CATEGORY";
34
34
  /** Count variable missing for plural translation */
35
35
  readonly MISSING_COUNT_VARIABLE: "MISSING_COUNT_VARIABLE";
36
+ /** Validation threshold exceeded */
37
+ readonly VALIDATION_THRESHOLD_EXCEEDED: "VALIDATION_THRESHOLD_EXCEEDED";
38
+ /** Operation failed at specific step */
39
+ readonly OPERATION_STEP_FAILED: "OPERATION_STEP_FAILED";
40
+ /** Rate limit exceeded */
41
+ readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
42
+ /** Nested validation error with context */
43
+ readonly NESTED_VALIDATION_ERROR: "NESTED_VALIDATION_ERROR";
36
44
  };
37
45
  /**
38
46
  * Type representing all possible i18n error codes.
@@ -53,32 +61,36 @@ export declare class I18nError extends Error {
53
61
  */
54
62
  constructor(code: I18nErrorCode, message: string, metadata?: Record<string, any> | undefined);
55
63
  /**
56
- * Creates an error for when a component is not found.
64
+ * Creates an error for when a component is not found with nested ICU select formatting.
57
65
  * @param componentId - The ID of the component that was not found
66
+ * @param language - Optional language code for message formatting
58
67
  * @returns An I18nError instance
59
68
  */
60
- static componentNotFound(componentId: string): I18nError;
69
+ static componentNotFound(componentId: string, language?: string): I18nError;
61
70
  /**
62
- * Creates an error for when a string key is not found in a component.
71
+ * Creates an error for when a string key is not found in a component with nested ICU formatting.
63
72
  * @param componentId - The ID of the component
64
73
  * @param stringKey - The string key that was not found
74
+ * @param language - Optional language code for message formatting
65
75
  * @returns An I18nError instance
66
76
  */
67
- static stringKeyNotFound(componentId: string, stringKey: string): I18nError;
77
+ static stringKeyNotFound(componentId: string, stringKey: string, language?: string): I18nError;
68
78
  /**
69
- * Creates an error for when a language is not found.
79
+ * Creates an error for when a language is not found with ICU formatting.
70
80
  * @param language - The language code that was not found
81
+ * @param messageLanguage - Optional language code for error message formatting
71
82
  * @returns An I18nError instance
72
83
  */
73
- static languageNotFound(language: string): I18nError;
84
+ static languageNotFound(language: string, messageLanguage?: string): I18nError;
74
85
  /**
75
- * Creates an error for when a translation is missing.
86
+ * Creates an error for when a translation is missing with nested ICU formatting.
76
87
  * @param componentId - The ID of the component
77
88
  * @param stringKey - The string key
78
- * @param language - The language code
89
+ * @param language - The language code where translation is missing
90
+ * @param messageLanguage - Optional language code for error message formatting
79
91
  * @returns An I18nError instance
80
92
  */
81
- static translationMissing(componentId: string, stringKey: string, language: string): I18nError;
93
+ static translationMissing(componentId: string, stringKey: string, language: string, messageLanguage?: string): I18nError;
82
94
  /**
83
95
  * Creates an error for invalid configuration.
84
96
  * @param reason - The reason why the configuration is invalid
@@ -86,43 +98,49 @@ export declare class I18nError extends Error {
86
98
  */
87
99
  static invalidConfig(reason: string): I18nError;
88
100
  /**
89
- * Creates an error for duplicate component registration.
101
+ * Creates an error for duplicate component registration with nested ICU select formatting.
90
102
  * @param componentId - The ID of the duplicate component
103
+ * @param language - Optional language code for message formatting
91
104
  * @returns An I18nError instance
92
105
  */
93
- static duplicateComponent(componentId: string): I18nError;
106
+ static duplicateComponent(componentId: string, language?: string): I18nError;
94
107
  /**
95
- * Creates an error for duplicate language registration.
108
+ * Creates an error for duplicate language registration with ICU formatting.
96
109
  * @param language - The language code that is duplicate
110
+ * @param messageLanguage - Optional language code for error message formatting
97
111
  * @returns An I18nError instance
98
112
  */
99
- static duplicateLanguage(language: string): I18nError;
113
+ static duplicateLanguage(language: string, messageLanguage?: string): I18nError;
100
114
  /**
101
- * Creates an error for validation failure.
115
+ * Creates an error for validation failure with ICU plural formatting and number formatting.
102
116
  * @param errors - Array of validation error messages
117
+ * @param language - Optional language code for message formatting
103
118
  * @returns An I18nError instance
104
119
  */
105
- static validationFailed(errors: string[]): I18nError;
120
+ static validationFailed(errors: string[], language?: string): I18nError;
106
121
  /**
107
- * Creates an error for when an i18n instance is not found.
122
+ * Creates an error for when an i18n instance is not found with nested ICU select formatting.
108
123
  * @param key - The instance key that was not found
124
+ * @param language - Optional language code for message formatting
109
125
  * @returns An I18nError instance
110
126
  */
111
- static instanceNotFound(key: string): I18nError;
127
+ static instanceNotFound(key: string, language?: string): I18nError;
112
128
  /**
113
- * Creates an error for when an i18n instance already exists.
129
+ * Creates an error for when an i18n instance already exists with nested ICU select formatting.
114
130
  * @param key - The instance key that already exists
131
+ * @param language - Optional language code for message formatting
115
132
  * @returns An I18nError instance
116
133
  */
117
- static instanceExists(key: string): I18nError;
134
+ static instanceExists(key: string, language?: string): I18nError;
118
135
  /**
119
- * Creates an error for an invalid context key.
136
+ * Creates an error for an invalid context key with ICU formatting.
120
137
  * @param contextKey - The invalid context key
138
+ * @param language - Optional language code for message formatting
121
139
  * @returns An I18nError instance
122
140
  */
123
- static invalidContext(contextKey: string): I18nError;
141
+ static invalidContext(contextKey: string, language?: string): I18nError;
124
142
  /**
125
- * Creates an error for when a plural form is not found.
143
+ * Creates an error for when a plural form is not found with nested ICU select and plural formatting.
126
144
  * @param category - The plural category that was not found
127
145
  * @param language - The language code
128
146
  * @param key - The translation key
@@ -131,17 +149,63 @@ export declare class I18nError extends Error {
131
149
  */
132
150
  static pluralFormNotFound(category: string, language: string, key: string, availableForms: string[]): I18nError;
133
151
  /**
134
- * Creates an error for an invalid plural category.
152
+ * Creates an error for an invalid plural category with nested ICU plural and number formatting.
135
153
  * @param category - The invalid category
136
154
  * @param validCategories - Array of valid categories
155
+ * @param language - Optional language code for message formatting
137
156
  * @returns An I18nError instance
138
157
  */
139
- static invalidPluralCategory(category: string, validCategories: string[]): I18nError;
158
+ static invalidPluralCategory(category: string, validCategories: string[], language?: string): I18nError;
140
159
  /**
141
- * Creates an error for when the count variable is missing for plural forms.
160
+ * Creates an error for when the count variable is missing for plural forms with ICU formatting.
142
161
  * @param key - The translation key that requires a count variable
162
+ * @param language - Optional language code for message formatting
163
+ * @returns An I18nError instance
164
+ */
165
+ static missingCountVariable(key: string, language?: string): I18nError;
166
+ /**
167
+ * Creates an error for validation threshold violations with ICU number formatting.
168
+ * Demonstrates currency, percent, and integer formatting based on threshold type.
169
+ * @param fieldName - The field that exceeded the threshold
170
+ * @param value - The actual value
171
+ * @param threshold - The maximum allowed value
172
+ * @param thresholdType - Type of threshold: 'currency', 'percent', or 'integer'
173
+ * @param language - Optional language code for message formatting
174
+ * @returns An I18nError instance
175
+ */
176
+ static validationThresholdExceeded(fieldName: string, value: number, threshold: number, thresholdType?: 'currency' | 'percent' | 'integer', language?: string): I18nError;
177
+ /**
178
+ * Creates an error for operation failures at specific steps with ICU selectordinal formatting.
179
+ * Demonstrates 1st, 2nd, 3rd, etc. formatting for step numbers.
180
+ * @param stepNumber - The step number where the operation failed (1-based)
181
+ * @param operationName - The name of the operation
182
+ * @param reason - The reason for failure
183
+ * @param language - Optional language code for message formatting
184
+ * @returns An I18nError instance
185
+ */
186
+ static operationStepFailed(stepNumber: number, operationName: string, reason: string, language?: string): I18nError;
187
+ /**
188
+ * Creates an error for rate limit violations with nested ICU messages.
189
+ * Demonstrates nested plural, number formatting, and conditional messages.
190
+ * @param requestCount - Number of requests made
191
+ * @param limit - Maximum allowed requests
192
+ * @param windowSeconds - Time window in seconds
193
+ * @param retryAfterSeconds - Seconds until retry is allowed
194
+ * @param language - Optional language code for message formatting
195
+ * @returns An I18nError instance
196
+ */
197
+ static rateLimitExceeded(requestCount: number, limit: number, windowSeconds: number, retryAfterSeconds: number, language?: string): I18nError;
198
+ /**
199
+ * Creates a nested validation error with multiple layers of context.
200
+ * Demonstrates 4-level deep nested ICU messages with plural, select, and number formatting.
201
+ * @param componentId - The component being validated
202
+ * @param fieldPath - Nested field path (e.g., 'user.profile.settings.theme')
203
+ * @param errorCount - Number of errors found
204
+ * @param errorType - Type of validation error
205
+ * @param severity - Error severity level
206
+ * @param language - Optional language code for message formatting
143
207
  * @returns An I18nError instance
144
208
  */
145
- static missingCountVariable(key: string): I18nError;
209
+ static nestedValidationError(componentId: string, fieldPath: string, errorCount: number, errorType: 'type' | 'range' | 'format' | 'required', severity: 'low' | 'medium' | 'high' | 'critical', language?: string): I18nError;
146
210
  }
147
211
  //# sourceMappingURL=i18n-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-error.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/i18n-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB,sCAAsC;;IAEtC,wCAAwC;;IAExC,qCAAqC;;IAErC,yDAAyD;;IAEzD,qCAAqC;;IAErC,8CAA8C;;IAE9C,6CAA6C;;IAE7C,4CAA4C;;IAE5C,8BAA8B;;IAE9B,mCAAmC;;IAEnC,mCAAmC;;IAEnC,sDAAsD;;IAEtD,uCAAuC;;IAEvC,oDAAoD;;CAE5C,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;aAQhB,IAAI,EAAE,aAAa;aAEnB,QAAQ,CAAC,EAAE,MA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AAE,EAAE,QAAQ,SAAU,GAAG,SAAS;IAkBxG;;;;;OAKG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAU,GAAG,SAAS;IAavE;;;;;;;;;OASG;IACH,MAAM,CAAC,2BAA2B,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,aAAa,GAAE,UAAU,GAAG,SAAS,GAAG,SAAqB,EAC7D,QAAQ,SAAU,GACjB,SAAS;IAaZ;;;;;;;;OAQG;IACH,MAAM,CAAC,mBAAmB,CACxB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAU,GACjB,SAAS;IAaZ;;;;;;;;;OASG;IACH,MAAM,CAAC,iBAAiB,CACtB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,QAAQ,SAAU,GACjB,SAAS;IAaZ;;;;;;;;;;OAUG;IACH,MAAM,CAAC,qBAAqB,CAC1B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,EACnD,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,EAChD,QAAQ,SAAU,GACjB,SAAS;CAYb"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  /**
3
- * Unified error class for i18n library
3
+ * Unified error class for i18n library with ICU MessageFormat support
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.I18nError = exports.I18nErrorCode = void 0;
7
+ const helpers_1 = require("../icu/helpers");
7
8
  /**
8
9
  * Error codes used throughout the i18n library.
9
10
  */
@@ -36,6 +37,14 @@ exports.I18nErrorCode = {
36
37
  INVALID_PLURAL_CATEGORY: 'INVALID_PLURAL_CATEGORY',
37
38
  /** Count variable missing for plural translation */
38
39
  MISSING_COUNT_VARIABLE: 'MISSING_COUNT_VARIABLE',
40
+ /** Validation threshold exceeded */
41
+ VALIDATION_THRESHOLD_EXCEEDED: 'VALIDATION_THRESHOLD_EXCEEDED',
42
+ /** Operation failed at specific step */
43
+ OPERATION_STEP_FAILED: 'OPERATION_STEP_FAILED',
44
+ /** Rate limit exceeded */
45
+ RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
46
+ /** Nested validation error with context */
47
+ NESTED_VALIDATION_ERROR: 'NESTED_VALIDATION_ERROR',
39
48
  };
40
49
  /**
41
50
  * Main error class for i18n-related errors.
@@ -58,39 +67,51 @@ class I18nError extends Error {
58
67
  Object.setPrototypeOf(this, I18nError.prototype);
59
68
  }
60
69
  /**
61
- * Creates an error for when a component is not found.
70
+ * Creates an error for when a component is not found with nested ICU select formatting.
62
71
  * @param componentId - The ID of the component that was not found
72
+ * @param language - Optional language code for message formatting
63
73
  * @returns An I18nError instance
64
74
  */
65
- static componentNotFound(componentId) {
66
- return new I18nError(exports.I18nErrorCode.COMPONENT_NOT_FOUND, `Component '${componentId}' not found`, { componentId });
75
+ static componentNotFound(componentId, language = 'en-US') {
76
+ const hasNamespace = componentId.includes('.');
77
+ const message = (0, helpers_1.formatICUMessage)("{hasNamespace, select, true {Namespaced component {componentId}} other {Component {componentId}}} not found in registry", { componentId, hasNamespace: hasNamespace ? 'true' : 'false' }, language);
78
+ return new I18nError(exports.I18nErrorCode.COMPONENT_NOT_FOUND, message, { componentId });
67
79
  }
68
80
  /**
69
- * Creates an error for when a string key is not found in a component.
81
+ * Creates an error for when a string key is not found in a component with nested ICU formatting.
70
82
  * @param componentId - The ID of the component
71
83
  * @param stringKey - The string key that was not found
84
+ * @param language - Optional language code for message formatting
72
85
  * @returns An I18nError instance
73
86
  */
74
- static stringKeyNotFound(componentId, stringKey) {
75
- return new I18nError(exports.I18nErrorCode.STRING_KEY_NOT_FOUND, `String key '${stringKey}' not found in component '${componentId}'`, { componentId, stringKey });
87
+ static stringKeyNotFound(componentId, stringKey, language = 'en-US') {
88
+ const depth = stringKey.split('.').length;
89
+ const isNested = depth > 1;
90
+ const message = (0, helpers_1.formatICUMessage)("{isNested, select, true {Nested string key at {depth, selectordinal, one {#st} two {#nd} few {#rd} other {#th}} level {stringKey}} other {String key {stringKey}}} not found in component {componentId}", { componentId, stringKey, depth, isNested: isNested ? 'true' : 'false' }, language);
91
+ return new I18nError(exports.I18nErrorCode.STRING_KEY_NOT_FOUND, message, { componentId, stringKey });
76
92
  }
77
93
  /**
78
- * Creates an error for when a language is not found.
94
+ * Creates an error for when a language is not found with ICU formatting.
79
95
  * @param language - The language code that was not found
96
+ * @param messageLanguage - Optional language code for error message formatting
80
97
  * @returns An I18nError instance
81
98
  */
82
- static languageNotFound(language) {
83
- return new I18nError(exports.I18nErrorCode.LANGUAGE_NOT_FOUND, `Language '${language}' not found`, { language });
99
+ static languageNotFound(language, messageLanguage = 'en-US') {
100
+ const message = (0, helpers_1.formatICUMessage)("Language {language} not found", { language }, messageLanguage);
101
+ return new I18nError(exports.I18nErrorCode.LANGUAGE_NOT_FOUND, message, { language });
84
102
  }
85
103
  /**
86
- * Creates an error for when a translation is missing.
104
+ * Creates an error for when a translation is missing with nested ICU formatting.
87
105
  * @param componentId - The ID of the component
88
106
  * @param stringKey - The string key
89
- * @param language - The language code
107
+ * @param language - The language code where translation is missing
108
+ * @param messageLanguage - Optional language code for error message formatting
90
109
  * @returns An I18nError instance
91
110
  */
92
- static translationMissing(componentId, stringKey, language) {
93
- return new I18nError(exports.I18nErrorCode.TRANSLATION_MISSING, `Translation missing for '${componentId}.${stringKey}' in language '${language}'`, { componentId, stringKey, language });
111
+ static translationMissing(componentId, stringKey, language, messageLanguage = 'en-US') {
112
+ const hasNestedKey = stringKey.includes('.');
113
+ const message = (0, helpers_1.formatICUMessage)("Translation missing: {hasNested, select, true {nested path} other {key}} {componentId}.{stringKey} not found in language {language}", { componentId, stringKey, language, hasNested: hasNestedKey ? 'true' : 'false' }, messageLanguage);
114
+ return new I18nError(exports.I18nErrorCode.TRANSLATION_MISSING, message, { componentId, stringKey, language });
94
115
  }
95
116
  /**
96
117
  * Creates an error for invalid configuration.
@@ -101,55 +122,70 @@ class I18nError extends Error {
101
122
  return new I18nError(exports.I18nErrorCode.INVALID_CONFIG, reason);
102
123
  }
103
124
  /**
104
- * Creates an error for duplicate component registration.
125
+ * Creates an error for duplicate component registration with nested ICU select formatting.
105
126
  * @param componentId - The ID of the duplicate component
127
+ * @param language - Optional language code for message formatting
106
128
  * @returns An I18nError instance
107
129
  */
108
- static duplicateComponent(componentId) {
109
- return new I18nError(exports.I18nErrorCode.DUPLICATE_COMPONENT, `Component '${componentId}' already registered`, { componentId });
130
+ static duplicateComponent(componentId, language = 'en-US') {
131
+ const hasNamespace = componentId.includes('.');
132
+ const message = (0, helpers_1.formatICUMessage)("{hasNamespace, select, true {Namespaced component {componentId}} other {Component {componentId}}} is already registered {hasNamespace, select, true {in this namespace} other {in the registry}}", { componentId, hasNamespace: hasNamespace ? 'true' : 'false' }, language);
133
+ return new I18nError(exports.I18nErrorCode.DUPLICATE_COMPONENT, message, { componentId });
110
134
  }
111
135
  /**
112
- * Creates an error for duplicate language registration.
136
+ * Creates an error for duplicate language registration with ICU formatting.
113
137
  * @param language - The language code that is duplicate
138
+ * @param messageLanguage - Optional language code for error message formatting
114
139
  * @returns An I18nError instance
115
140
  */
116
- static duplicateLanguage(language) {
117
- return new I18nError(exports.I18nErrorCode.DUPLICATE_LANGUAGE, `Language '${language}' already registered`, { language });
141
+ static duplicateLanguage(language, messageLanguage = 'en-US') {
142
+ const message = `Language '${language}' already registered`;
143
+ return new I18nError(exports.I18nErrorCode.DUPLICATE_LANGUAGE, message, { language });
118
144
  }
119
145
  /**
120
- * Creates an error for validation failure.
146
+ * Creates an error for validation failure with ICU plural formatting and number formatting.
121
147
  * @param errors - Array of validation error messages
148
+ * @param language - Optional language code for message formatting
122
149
  * @returns An I18nError instance
123
150
  */
124
- static validationFailed(errors) {
125
- return new I18nError(exports.I18nErrorCode.VALIDATION_FAILED, `Validation failed: ${errors.join(', ')}`, { errors });
151
+ static validationFailed(errors, language = 'en-US') {
152
+ const message = (0, helpers_1.formatICUMessage)('Validation failed with {count, plural, one {{count, number, integer} error} other {{count, number, integer} errors}}: {details}', { count: errors.length, details: errors.join(', ') }, language);
153
+ return new I18nError(exports.I18nErrorCode.VALIDATION_FAILED, message, { errors, count: errors.length });
126
154
  }
127
155
  /**
128
- * Creates an error for when an i18n instance is not found.
156
+ * Creates an error for when an i18n instance is not found with nested ICU select formatting.
129
157
  * @param key - The instance key that was not found
158
+ * @param language - Optional language code for message formatting
130
159
  * @returns An I18nError instance
131
160
  */
132
- static instanceNotFound(key) {
133
- return new I18nError(exports.I18nErrorCode.INSTANCE_NOT_FOUND, `I18n instance '${key}' not found`, { key });
161
+ static instanceNotFound(key, language = 'en-US') {
162
+ const isDefault = key === 'default' || key === '';
163
+ const message = (0, helpers_1.formatICUMessage)("{isDefault, select, true {Default i18n instance not found} other {I18n instance {key} not found}} in registry", { key, isDefault: isDefault ? 'true' : 'false' }, language);
164
+ return new I18nError(exports.I18nErrorCode.INSTANCE_NOT_FOUND, message, { key });
134
165
  }
135
166
  /**
136
- * Creates an error for when an i18n instance already exists.
167
+ * Creates an error for when an i18n instance already exists with nested ICU select formatting.
137
168
  * @param key - The instance key that already exists
169
+ * @param language - Optional language code for message formatting
138
170
  * @returns An I18nError instance
139
171
  */
140
- static instanceExists(key) {
141
- return new I18nError(exports.I18nErrorCode.INSTANCE_EXISTS, `I18n instance '${key}' already exists`, { key });
172
+ static instanceExists(key, language = 'en-US') {
173
+ const isDefault = key === 'default' || key === '';
174
+ const message = (0, helpers_1.formatICUMessage)("{isDefault, select, true {Default i18n instance 'default' already exists. Use a different key or remove the existing instance first.} other {I18n instance {key} already exists in registry}}", { key, isDefault: isDefault ? 'true' : 'false' }, language);
175
+ return new I18nError(exports.I18nErrorCode.INSTANCE_EXISTS, message, { key });
142
176
  }
143
177
  /**
144
- * Creates an error for an invalid context key.
178
+ * Creates an error for an invalid context key with ICU formatting.
145
179
  * @param contextKey - The invalid context key
180
+ * @param language - Optional language code for message formatting
146
181
  * @returns An I18nError instance
147
182
  */
148
- static invalidContext(contextKey) {
149
- return new I18nError(exports.I18nErrorCode.INVALID_CONTEXT, `Invalid context key '${contextKey}'`, { contextKey });
183
+ static invalidContext(contextKey, language = 'en-US') {
184
+ const message = (0, helpers_1.formatICUMessage)("Invalid context key {contextKey}", { contextKey }, language);
185
+ return new I18nError(exports.I18nErrorCode.INVALID_CONTEXT, message, { contextKey });
150
186
  }
151
187
  /**
152
- * Creates an error for when a plural form is not found.
188
+ * Creates an error for when a plural form is not found with nested ICU select and plural formatting.
153
189
  * @param category - The plural category that was not found
154
190
  * @param language - The language code
155
191
  * @param key - The translation key
@@ -157,24 +193,98 @@ class I18nError extends Error {
157
193
  * @returns An I18nError instance
158
194
  */
159
195
  static pluralFormNotFound(category, language, key, availableForms) {
160
- return new I18nError(exports.I18nErrorCode.PLURAL_FORM_NOT_FOUND, `Plural form '${category}' not found for language '${language}' in key '${key}'. Available forms: ${availableForms.join(', ')}`, { category, language, key, availableForms });
196
+ const formCount = availableForms.length;
197
+ const message = (0, helpers_1.formatICUMessage)("Plural form {category} not found for language {language}{hasKey, select, true { in key {keyName}} other {}}. {formCount, plural, one {Available form} other {Available forms}} ({formCount, number, integer}): {forms}", {
198
+ category,
199
+ language,
200
+ keyName: key,
201
+ hasKey: key ? 'true' : 'false',
202
+ forms: availableForms.join(', '),
203
+ formCount
204
+ }, language);
205
+ return new I18nError(exports.I18nErrorCode.PLURAL_FORM_NOT_FOUND, message, { category, language, key, availableForms, formCount });
161
206
  }
162
207
  /**
163
- * Creates an error for an invalid plural category.
208
+ * Creates an error for an invalid plural category with nested ICU plural and number formatting.
164
209
  * @param category - The invalid category
165
210
  * @param validCategories - Array of valid categories
211
+ * @param language - Optional language code for message formatting
166
212
  * @returns An I18nError instance
167
213
  */
168
- static invalidPluralCategory(category, validCategories) {
169
- return new I18nError(exports.I18nErrorCode.INVALID_PLURAL_CATEGORY, `Invalid plural category '${category}'. Valid categories: ${validCategories.join(', ')}`, { category, validCategories });
214
+ static invalidPluralCategory(category, validCategories, language = 'en-US') {
215
+ const count = validCategories.length;
216
+ const message = (0, helpers_1.formatICUMessage)("Invalid plural category {category}. {count, plural, one {Valid category ({count, number, integer})} other {Valid categories ({count, number, integer})}}: {categories}", {
217
+ category,
218
+ categories: validCategories.join(', '),
219
+ count
220
+ }, language);
221
+ return new I18nError(exports.I18nErrorCode.INVALID_PLURAL_CATEGORY, message, { category, validCategories, count });
170
222
  }
171
223
  /**
172
- * Creates an error for when the count variable is missing for plural forms.
224
+ * Creates an error for when the count variable is missing for plural forms with ICU formatting.
173
225
  * @param key - The translation key that requires a count variable
226
+ * @param language - Optional language code for message formatting
227
+ * @returns An I18nError instance
228
+ */
229
+ static missingCountVariable(key, language = 'en-US') {
230
+ const message = (0, helpers_1.formatICUMessage)("Plural forms used in key {key} but no 'count' variable provided", { key }, language);
231
+ return new I18nError(exports.I18nErrorCode.MISSING_COUNT_VARIABLE, message, { key });
232
+ }
233
+ /**
234
+ * Creates an error for validation threshold violations with ICU number formatting.
235
+ * Demonstrates currency, percent, and integer formatting based on threshold type.
236
+ * @param fieldName - The field that exceeded the threshold
237
+ * @param value - The actual value
238
+ * @param threshold - The maximum allowed value
239
+ * @param thresholdType - Type of threshold: 'currency', 'percent', or 'integer'
240
+ * @param language - Optional language code for message formatting
241
+ * @returns An I18nError instance
242
+ */
243
+ static validationThresholdExceeded(fieldName, value, threshold, thresholdType = 'integer', language = 'en-US') {
244
+ const message = (0, helpers_1.formatICUMessage)("Validation failed for {fieldName}: value {value, number, " + thresholdType + "} exceeds maximum threshold of {threshold, number, " + thresholdType + "}", { fieldName, value, threshold }, language);
245
+ return new I18nError(exports.I18nErrorCode.VALIDATION_THRESHOLD_EXCEEDED, message, { fieldName, value, threshold, thresholdType });
246
+ }
247
+ /**
248
+ * Creates an error for operation failures at specific steps with ICU selectordinal formatting.
249
+ * Demonstrates 1st, 2nd, 3rd, etc. formatting for step numbers.
250
+ * @param stepNumber - The step number where the operation failed (1-based)
251
+ * @param operationName - The name of the operation
252
+ * @param reason - The reason for failure
253
+ * @param language - Optional language code for message formatting
254
+ * @returns An I18nError instance
255
+ */
256
+ static operationStepFailed(stepNumber, operationName, reason, language = 'en-US') {
257
+ const message = (0, helpers_1.formatICUMessage)("Operation {operationName} failed at {stepNumber, selectordinal, one {#st} two {#nd} few {#rd} other {#th}} step: {reason}", { stepNumber, operationName, reason }, language);
258
+ return new I18nError(exports.I18nErrorCode.OPERATION_STEP_FAILED, message, { stepNumber, operationName, reason });
259
+ }
260
+ /**
261
+ * Creates an error for rate limit violations with nested ICU messages.
262
+ * Demonstrates nested plural, number formatting, and conditional messages.
263
+ * @param requestCount - Number of requests made
264
+ * @param limit - Maximum allowed requests
265
+ * @param windowSeconds - Time window in seconds
266
+ * @param retryAfterSeconds - Seconds until retry is allowed
267
+ * @param language - Optional language code for message formatting
268
+ * @returns An I18nError instance
269
+ */
270
+ static rateLimitExceeded(requestCount, limit, windowSeconds, retryAfterSeconds, language = 'en-US') {
271
+ const message = (0, helpers_1.formatICUMessage)("Rate limit exceeded: {requestCount, plural, one {# request} other {# requests}} made, exceeding limit of {limit, number, integer} {limit, plural, one {request} other {requests}} per {windowSeconds, number, integer} {windowSeconds, plural, one {second} other {seconds}}. {hasRetry, select, true {Retry after {retryAfterSeconds, number, integer} {retryAfterSeconds, plural, one {second} other {seconds}}.} other {Retry immediately.}}", { requestCount, limit, windowSeconds, retryAfterSeconds, hasRetry: retryAfterSeconds > 0 ? 'true' : 'false' }, language);
272
+ return new I18nError(exports.I18nErrorCode.RATE_LIMIT_EXCEEDED, message, { requestCount, limit, windowSeconds, retryAfterSeconds });
273
+ }
274
+ /**
275
+ * Creates a nested validation error with multiple layers of context.
276
+ * Demonstrates 4-level deep nested ICU messages with plural, select, and number formatting.
277
+ * @param componentId - The component being validated
278
+ * @param fieldPath - Nested field path (e.g., 'user.profile.settings.theme')
279
+ * @param errorCount - Number of errors found
280
+ * @param errorType - Type of validation error
281
+ * @param severity - Error severity level
282
+ * @param language - Optional language code for message formatting
174
283
  * @returns An I18nError instance
175
284
  */
176
- static missingCountVariable(key) {
177
- return new I18nError(exports.I18nErrorCode.MISSING_COUNT_VARIABLE, `Plural forms used in key '${key}' but no 'count' variable provided`, { key });
285
+ static nestedValidationError(componentId, fieldPath, errorCount, errorType, severity, language = 'en-US') {
286
+ const message = (0, helpers_1.formatICUMessage)("Validation error in component {componentId}: {severity, select, low {Minor issue} medium {Moderate issue} high {Serious issue} critical {Critical issue} other {Issue}} detected in nested field {fieldPath} - {errorType, select, type {Type mismatch} range {Value out of range} format {Invalid format} required {Required field missing} other {Validation error}} with {errorCount, plural, one {# occurrence} other {# occurrences}}", { componentId, fieldPath, errorCount, errorType, severity }, language);
287
+ return new I18nError(exports.I18nErrorCode.NESTED_VALIDATION_ERROR, message, { componentId, fieldPath, errorCount, errorType, severity });
178
288
  }
179
289
  }
180
290
  exports.I18nError = I18nError;
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-error.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/i18n-error.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACU,QAAA,aAAa,GAAG;IAC3B,sCAAsC;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,wCAAwC;IACxC,oBAAoB,EAAE,sBAAsB;IAC5C,qCAAqC;IACrC,kBAAkB,EAAE,oBAAoB;IACxC,yDAAyD;IACzD,mBAAmB,EAAE,qBAAqB;IAC1C,qCAAqC;IACrC,cAAc,EAAE,gBAAgB;IAChC,8CAA8C;IAC9C,mBAAmB,EAAE,qBAAqB;IAC1C,6CAA6C;IAC7C,kBAAkB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IAAI,SAAS,CAClB,qBAAa,CAAC,eAAe,EAC7B,kBAAkB,GAAG,kBAAkB,EACvC,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAkB;QACtC,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,eAAe,EAC7B,wBAAwB,UAAU,GAAG,EACrC,EAAE,UAAU,EAAE,CACf,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CACvB,QAAgB,EAChB,QAAgB,EAChB,GAAW,EACX,cAAwB;QAExB,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,qBAAqB,EACnC,gBAAgB,QAAQ,6BAA6B,QAAQ,aAAa,GAAG,uBAAuB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC/H,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,CAC5C,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAgB,EAAE,eAAyB;QACtE,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,uBAAuB,EACrC,4BAA4B,QAAQ,wBAAwB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACxF,EAAE,QAAQ,EAAE,eAAe,EAAE,CAC9B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,GAAW;QACrC,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,sBAAsB,EACpC,6BAA6B,GAAG,oCAAoC,EACpE,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC;CACF;AAlND,8BAkNC"}
1
+ {"version":3,"file":"i18n-error.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/i18n-error.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,4CAAkD;AAElD;;GAEG;AACU,QAAA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UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,CACtC,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,iBAAiB,CACtB,YAAoB,EACpB,KAAa,EACb,aAAqB,EACrB,iBAAyB,EACzB,QAAQ,GAAG,OAAO;QAElB,MAAM,OAAO,GAAG,IAAA,0BAAgB,EAC9B,ibAAib,EACjb,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,EAC7G,QAAQ,CACT,CAAC;QACF,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,mBAAmB,EACjC,OAAO,EACP,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAC1D,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,qBAAqB,CAC1B,WAAmB,EACnB,SAAiB,EACjB,UAAkB,EAClB,SAAmD,EACnD,QAAgD,EAChD,QAAQ,GAAG,OAAO;QAElB,MAAM,OAAO,GAAG,IAAA,0BAAgB,EAC9B,4aAA4a,EAC5a,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAC3D,QAAQ,CACT,CAAC;QACF,OAAO,IAAI,SAAS,CAClB,qBAAa,CAAC,uBAAuB,EACrC,OAAO,EACP,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAC5D,CAAC;IACJ,CAAC;CACF;AApaD,8BAoaC"}
@@ -2,6 +2,7 @@
2
2
  * Error exports
3
3
  */
4
4
  export * from './context-error';
5
+ export * from './enhanced-error-base';
5
6
  export * from './handleable';
6
7
  export * from './i18n-error';
7
8
  export * from './translatable-generic';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
@@ -5,6 +5,7 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tslib_1 = require("tslib");
7
7
  tslib_1.__exportStar(require("./context-error"), exports);
8
+ tslib_1.__exportStar(require("./enhanced-error-base"), exports);
8
9
  tslib_1.__exportStar(require("./handleable"), exports);
9
10
  tslib_1.__exportStar(require("./i18n-error"), exports);
10
11
  tslib_1.__exportStar(require("./translatable-generic"), exports);
@@ -1 +1 @@
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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/errors/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,0DAAgC;AAChC,gEAAsC;AACtC,uDAA6B;AAC7B,uDAA6B;AAC7B,iEAAuC;AACvC,4EAAkD;AAClD,yDAA+B;AAC/B,6DAAmC;AACnC,kDAAwB"}