@aidc-toolkit/app-extension 1.0.49 → 1.0.50

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 (53) hide show
  1. package/dist/{character-set-proxy-BOW94WCe.d.cts → character-set-proxy-CQCOcqR3.d.cts} +92 -92
  2. package/dist/{character-set-proxy-BOW94WCe.d.ts → character-set-proxy-CQCOcqR3.d.ts} +92 -92
  3. package/dist/chunk-46ONQV2V.js +1 -0
  4. package/dist/chunk-4BTJEN4N.js +1 -0
  5. package/dist/chunk-WLXID4YR.js +1 -0
  6. package/dist/{descriptor-D6tZH-vc.d.cts → descriptor-Df-lif4q.d.cts} +1 -1
  7. package/dist/{descriptor-D6tZH-vc.d.ts → descriptor-Df-lif4q.d.ts} +1 -1
  8. package/dist/generator/index.cjs +1 -1
  9. package/dist/generator/index.d.cts +2 -18
  10. package/dist/generator/index.d.ts +2 -18
  11. package/dist/generator/index.js +1 -1
  12. package/dist/gs1/index.cjs +1 -1
  13. package/dist/gs1/index.d.cts +106 -106
  14. package/dist/gs1/index.d.ts +106 -106
  15. package/dist/gs1/index.js +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +16 -31
  18. package/dist/index.d.ts +16 -31
  19. package/dist/index.js +1 -1
  20. package/package.json +5 -5
  21. package/src/app-extension-options.ts +61 -0
  22. package/src/app-extension.ts +22 -32
  23. package/src/app-helper-proxy.ts +21 -33
  24. package/src/generator/functions-generator.ts +14 -45
  25. package/src/generator/generator.ts +28 -18
  26. package/src/generator/locale-resources-generator.ts +79 -52
  27. package/src/gs1/character-set-proxy.ts +6 -7
  28. package/src/gs1/check-proxy.ts +8 -8
  29. package/src/gs1/gcp-length-proxy.ts +8 -8
  30. package/src/gs1/gtin-creator-proxy.ts +4 -4
  31. package/src/gs1/gtin-validator-proxy.ts +12 -12
  32. package/src/gs1/identifier-creator-proxy.ts +14 -14
  33. package/src/gs1/identifier-validator-proxy.ts +10 -10
  34. package/src/gs1/non-gtin-creator-proxy.ts +22 -23
  35. package/src/gs1/non-gtin-validator-proxy.ts +22 -23
  36. package/src/gs1/prefix-manager-proxy.ts +2 -2
  37. package/src/gs1/variable-measure-proxy.ts +4 -4
  38. package/src/gs1/verified-by-gs1-proxy.ts +5 -11
  39. package/src/index.ts +1 -0
  40. package/src/lib-proxy.ts +27 -43
  41. package/src/locale/en/locale-resources.ts +1 -1
  42. package/src/proxy.ts +12 -15
  43. package/src/streaming.ts +3 -3
  44. package/src/type.ts +3 -22
  45. package/src/utility/character-set-proxy.ts +17 -16
  46. package/src/utility/reg-exp-proxy.ts +2 -2
  47. package/src/utility/string-proxy.ts +2 -2
  48. package/src/utility/transformer-proxy.ts +6 -5
  49. package/src/version.ts +1 -1
  50. package/tsconfig-src.tsbuildinfo +1 -1
  51. package/dist/chunk-22IRLVWO.js +0 -1
  52. package/dist/chunk-MR63TJ3B.js +0 -1
  53. package/dist/chunk-TWX7TPRC.js +0 -1
@@ -71,6 +71,11 @@ export abstract class FunctionsGenerator extends Generator {
71
71
  [Types.Any]: "any"
72
72
  };
73
73
 
74
+ /**
75
+ * Dummy value passed to invocation context and streaming context parameters if context is not supported.
76
+ */
77
+ static readonly #DUMMY_VALUE = "0";
78
+
74
79
  protected static readonly BASE_IMPORTS = [
75
80
  "import * as AppExtension from \"@aidc-toolkit/app-extension\";",
76
81
  "import { appExtension } from \"./app-extension.js\";"
@@ -86,21 +91,6 @@ export abstract class FunctionsGenerator extends Generator {
86
91
  */
87
92
  readonly #supportsContext: boolean;
88
93
 
89
- /**
90
- * Invocation context type name.
91
- */
92
- readonly #invocationContextTypeName: string;
93
-
94
- /**
95
- * Streaming invocation context type name.
96
- */
97
- readonly #streamingInvocationContextTypeName: string;
98
-
99
- /**
100
- * Template declaration for type alias.
101
- */
102
- readonly #templateDeclaration: string;
103
-
104
94
  /**
105
95
  * Current class type alias.
106
96
  */
@@ -115,35 +105,14 @@ export abstract class FunctionsGenerator extends Generator {
115
105
  * @param inline
116
106
  * If true, functions are declared inline rather than using `function`.
117
107
  *
118
- * @param throwError
119
- * If true, errors are reported through the throw/catch mechanism.
120
- *
121
- * @param errorTypeName
122
- * Error type name.
123
- *
124
108
  * @param supportsContext
125
109
  * If true, application extension supports context.
126
- *
127
- * Big integer type name.
128
- * @param invocationContextTypeName
129
- * Invocation context type name.
130
- *
131
- * @param streamingInvocationContextTypeName
132
- * Streaming invocation context type name.
133
- *
134
- * @param bigIntTypeName
135
- * Big integer type name.
136
110
  */
137
- constructor(version: string, inline: boolean, throwError: boolean, errorTypeName: string, supportsContext: boolean, invocationContextTypeName: string, streamingInvocationContextTypeName: string, bigIntTypeName: string) {
111
+ constructor(version: string, inline: boolean, supportsContext: boolean) {
138
112
  super(version, true);
139
113
 
140
114
  this.#inline = inline;
141
-
142
115
  this.#supportsContext = supportsContext;
143
- this.#invocationContextTypeName = invocationContextTypeName;
144
- this.#streamingInvocationContextTypeName = streamingInvocationContextTypeName;
145
-
146
- this.#templateDeclaration = `<${throwError}, ${errorTypeName}, ${invocationContextTypeName}, ${streamingInvocationContextTypeName}, ${bigIntTypeName}>`;
147
116
  }
148
117
 
149
118
  /**
@@ -173,7 +142,7 @@ export abstract class FunctionsGenerator extends Generator {
173
142
  const classDescriptorNamespace = classDescriptor.namespace ?? "";
174
143
  const name = `${classDescriptorNamespace}${classDescriptor.name}`;
175
144
  const getter = `get${name}()`;
176
- const implementation = `AppExtension${classDescriptorNamespace}.${classDescriptor.name}${this.#templateDeclaration}`;
145
+ const implementation = `AppExtension${classDescriptorNamespace}.${classDescriptor.name}`;
177
146
 
178
147
  this.#classTypeAlias = {
179
148
  name,
@@ -241,26 +210,26 @@ export abstract class FunctionsGenerator extends Generator {
241
210
  parameterLocalizations.push({
242
211
  name: "invocationContext",
243
212
  description: "Invocation context.",
244
- javaScriptType: this.#invocationContextTypeName
213
+ javaScriptType: "InvocationContext"
245
214
  });
246
215
  }
247
216
 
248
217
  if (methodDescriptor.isStream === true) {
249
218
  parameterLocalizations.push({
250
- name: "streamingInvocationContext",
251
- description: "Streaming invocation context.",
252
- javaScriptType: this.#streamingInvocationContextTypeName
219
+ name: "streamingContext",
220
+ description: "Streaming context.",
221
+ javaScriptType: "StreamingContext"
253
222
  });
254
223
  }
255
224
  } else {
256
225
  if (methodDescriptor.requiresContext === true) {
257
226
  // Invocation context type name represents a literal dummy value.
258
- dummyParameters.push(this.#invocationContextTypeName);
227
+ dummyParameters.push(FunctionsGenerator.#DUMMY_VALUE);
259
228
  }
260
229
 
261
230
  if (methodDescriptor.isStream === true) {
262
- // Streaming invocation context type name represents a literal dummy value.
263
- dummyParameters.push(this.#streamingInvocationContextTypeName);
231
+ // Streaming context type name represents a literal dummy value.
232
+ dummyParameters.push(FunctionsGenerator.#DUMMY_VALUE);
264
233
  }
265
234
  }
266
235
 
@@ -1,5 +1,11 @@
1
- import { ALPHA_URL, getLogger, I18nLanguageDetectors, type Promisable, websiteURL } from "@aidc-toolkit/core";
2
- import type { DefaultNamespace, ParseKeys } from "i18next";
1
+ import {
2
+ ALPHA_URL,
3
+ getLogger,
4
+ I18nLanguageDetectors,
5
+ isI18nParseKey,
6
+ type Promisable,
7
+ websiteURL
8
+ } from "@aidc-toolkit/core";
3
9
  import type { Logger } from "tslog";
4
10
  import { AppHelperProxy } from "../app-helper-proxy.js";
5
11
  import type { ClassDescriptor, MethodDescriptor } from "../descriptor.js";
@@ -185,7 +191,7 @@ export abstract class Generator {
185
191
  protected abstract finalize(success: boolean): Promisable<void>;
186
192
 
187
193
  /**
188
- * Generate a localization.
194
+ * Get a localization.
189
195
  *
190
196
  * @template TLocalization
191
197
  * Localization type.
@@ -202,21 +208,18 @@ export abstract class Generator {
202
208
  * @returns
203
209
  * Localization.
204
210
  */
205
- static #generateLocalization<TLocalization extends Localization>(locale: string, key: string, localizationCallback: (locale: string, localization: Localization & Partial<TLocalization>) => TLocalization): TLocalization {
211
+ static #getLocalization<TLocalization extends Localization>(locale: string, key: string, localizationCallback: (locale: string, localization: Localization & Partial<TLocalization>) => TLocalization): TLocalization {
206
212
  const lngReturnObjectsOption = {
207
213
  lng: locale,
208
214
  returnObjects: true
209
215
  } as const;
210
216
 
211
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Assume localized key exists.
212
- const parseKey = key as ParseKeys<DefaultNamespace, typeof lngReturnObjectsOption>;
213
-
214
- if (!i18nextAppExtension.exists(parseKey, lngReturnObjectsOption)) {
217
+ if (!isI18nParseKey(i18nextAppExtension, key, lngReturnObjectsOption)) {
215
218
  throw new Error(`Missing localization for ${key} in ${locale}`);
216
219
  }
217
220
 
218
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists and return type is Localization & Partial<TLocalization>.
219
- return localizationCallback(locale, i18nextAppExtension.t(key as ParseKeys<DefaultNamespace, typeof lngReturnObjectsOption>, lngReturnObjectsOption) as Localization & Partial<TLocalization>);
221
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Return type is Localization & Partial<TLocalization>.
222
+ return localizationCallback(locale, i18nextAppExtension.t(key, lngReturnObjectsOption) as Localization & Partial<TLocalization>);
220
223
  }
221
224
 
222
225
  /**
@@ -263,18 +266,25 @@ export abstract class Generator {
263
266
  this.createNamespace(namespace);
264
267
 
265
268
  for (const [category, classDescriptors] of categoryHierarchy) {
266
- const namespaceCategory = `${namespacePrefix}${category}`;
267
-
268
- const categoriesKey = `Categories.${category}`;
269
- const namespaceCategoriesKey = `Categories.${namespaceCategory}`;
269
+ const categoryKey = `Categories.${category}`;
270
+ const namespaceCategoryKey = `Categories.${namespacePrefix}${category}`;
270
271
 
271
272
  const categoryLocalizationsMap = new Map(this.locales.map((locale) => {
272
273
  const lngOption = {
273
274
  lng: locale
274
275
  } as const;
275
276
 
276
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
277
- return [locale, i18nextAppExtension.t((i18nextAppExtension.exists(namespaceCategoriesKey, lngOption) ? namespaceCategoriesKey : categoriesKey) as ParseKeys, lngOption)];
277
+ let key = namespaceCategoryKey;
278
+
279
+ if (!isI18nParseKey(i18nextAppExtension, key)) {
280
+ key = categoryKey;
281
+
282
+ if (!isI18nParseKey(i18nextAppExtension, key, lngOption)) {
283
+ throw new Error(`Missing localization for ${key} in ${locale}`);
284
+ }
285
+ }
286
+
287
+ return [locale, i18nextAppExtension.t(key, lngOption)];
278
288
  }));
279
289
 
280
290
  this.createCategory(namespace, category, categoryLocalizationsMap);
@@ -295,13 +305,13 @@ export abstract class Generator {
295
305
  for (const methodDescriptor of classDescriptor.methodDescriptors) {
296
306
  const functionLocalizationsMap = new Map(methodDescriptor.isHidden !== true ?
297
307
  this.locales.map(locale =>
298
- [locale, Generator.#generateLocalization<FunctionLocalization>(locale, `Functions.${namespacePrefix}${methodDescriptor.functionName}`, (locale, localization) => ({
308
+ [locale, Generator.#getLocalization<FunctionLocalization>(locale, `Functions.${namespacePrefix}${methodDescriptor.functionName}`, (locale, localization) => ({
299
309
  ...localization,
300
310
  titleCaseName: localization.titleCaseName ?? localization.name.replace(/^[a-z]/u, c => c.toUpperCase()),
301
311
  documentationURL: `${documentationBaseURL}/${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
302
312
  parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
303
313
  // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
304
- [parameterDescriptor.name, Generator.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]
314
+ [parameterDescriptor.name, Generator.#getLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]
305
315
  ))
306
316
  }))]
307
317
  ) :
@@ -70,21 +70,21 @@ class LocaleResourcesGenerator extends Generator {
70
70
  readonly #parametersSequencer: ParametersSequencer = {};
71
71
 
72
72
  /**
73
- * Parameters locale resources.
73
+ * Template parameters locale resources.
74
74
  */
75
- readonly #parametersLocaleResources: LocaleResources = {};
75
+ readonly #templateParametersLocaleResources: LocaleResources = {};
76
76
 
77
77
  /**
78
- * Functions locale resources.
78
+ * Template functions locale resources.
79
79
  */
80
- readonly #functionsLocaleResources: LocaleResources = {};
80
+ readonly #templateFunctionsLocaleResources: LocaleResources = {};
81
81
 
82
82
  /**
83
- * Locale resources.
83
+ * Template locale resources.
84
84
  */
85
- readonly #LocaleResources: LocaleResources = {
86
- Parameters: this.#parametersLocaleResources,
87
- Functions: this.#functionsLocaleResources
85
+ readonly #templateLocaleResources: LocaleResources = {
86
+ Parameters: this.#templateParametersLocaleResources,
87
+ Functions: this.#templateFunctionsLocaleResources
88
88
  };
89
89
 
90
90
  /**
@@ -201,7 +201,7 @@ class LocaleResourcesGenerator extends Generator {
201
201
  this.#saveParameterSequence(parameterDescriptor, true);
202
202
  }
203
203
 
204
- let functionsLocaleResources = this.#functionsLocaleResources;
204
+ let functionsLocaleResources = this.#templateFunctionsLocaleResources;
205
205
 
206
206
  const namespace = classDescriptor.namespace;
207
207
 
@@ -234,68 +234,92 @@ class LocaleResourcesGenerator extends Generator {
234
234
  }
235
235
 
236
236
  /**
237
- * Merge source locale resources into existing destination locale resources.
237
+ * Merge template locale resources into existing import locale resources.
238
+ *
239
+ * @param mergedLocaleResources
240
+ * Merged locale resources.
238
241
  *
239
- * @param logChanges
240
- * If true, changes are logged. Limits output when processing multiple sources.
242
+ * @param isDefaultLocale
243
+ * If true, locale being merged is the default.
241
244
  *
242
245
  * @param parentKey
243
246
  * Parent key for logging purposes.
244
247
  *
245
- * @param sourceLocaleResources
246
- * Source locale resources.
248
+ * @param templateLocaleResources
249
+ * Template locale resources.
247
250
  *
248
- * @param destinationLocaleResources
249
- * Destination locale resources.
251
+ * @param importLocaleResources
252
+ * Import locale resources.
250
253
  *
251
254
  * @param addMissing
252
255
  * Add missing if true; applies to locale resources that are not regional.
253
256
  *
254
257
  * @returns
255
- * Merged locale resources.
258
+ * True if any changes.
256
259
  */
257
- #merge(logChanges: boolean, parentKey: string, sourceLocaleResources: LocaleResources, destinationLocaleResources: LocaleResources, addMissing: boolean): LocaleResources {
260
+ #merge(mergedLocaleResources: LocaleResources, isDefaultLocale: boolean, parentKey: string, templateLocaleResources: LocaleResources, importLocaleResources: LocaleResources, addMissing: boolean): boolean {
261
+ let anyChanges = false;
262
+
258
263
  // Some entries at the root are not part of the generator output.
259
264
  const atRoot = parentKey === "";
260
265
 
261
- const atFunction = parentKey.startsWith("Functions.");
266
+ if (parentKey.startsWith("Functions.") && "titleCaseName" in importLocaleResources && !("titleCaseName" in templateLocaleResources)) {
267
+ const description = templateLocaleResources["description"];
268
+
269
+ const patchTemplateLocaleResources = templateLocaleResources;
270
+
271
+ // Patch template locale resources to preserve required position of titleCaseName.
272
+ delete patchTemplateLocaleResources["description"];
273
+ patchTemplateLocaleResources["titleCaseName"] = undefined;
274
+ patchTemplateLocaleResources["description"] = description;
275
+ }
276
+
277
+ const patchMergedLocaleResources = mergedLocaleResources;
262
278
 
263
- const newDestinationLocaleResources: LocaleResources = {};
279
+ // Copy over or delete any import keys that are not in template.
280
+ for (const [key, importValue] of Object.entries(importLocaleResources)) {
281
+ if (!(key in templateLocaleResources)) {
282
+ if (atRoot) {
283
+ patchMergedLocaleResources[key] = importValue;
284
+ } else {
285
+ if (isDefaultLocale) {
286
+ this.logger.info(`Deleting ${parentKey}${key}...`);
287
+ }
264
288
 
265
- // Copy over or delete any destination keys that are not in source.
266
- for (const [key, destinationValue] of Object.entries(destinationLocaleResources)) {
267
- if (!(key in sourceLocaleResources)) {
268
- if (atRoot || (atFunction && key === "titleCaseName")) {
269
- newDestinationLocaleResources[key] = destinationValue;
270
- } else if (logChanges) {
271
- this.logger.info(`Deleting ${parentKey}${key}...`);
289
+ anyChanges = true;
272
290
  }
273
291
  }
274
292
  }
275
293
 
276
- for (const [key, sourceValue] of Object.entries(sourceLocaleResources)) {
277
- if (!(key in destinationLocaleResources)) {
294
+ for (const [key, templateValue] of Object.entries(templateLocaleResources)) {
295
+ if (!(key in importLocaleResources)) {
278
296
  if (addMissing) {
279
- if (logChanges) {
297
+ if (isDefaultLocale) {
280
298
  this.logger.info(`Adding ${parentKey}${key}...`);
281
299
  }
282
300
 
283
- newDestinationLocaleResources[key] = sourceValue;
301
+ patchMergedLocaleResources[key] = templateValue;
302
+
303
+ anyChanges = true;
284
304
  }
285
305
  } else {
286
- const destinationValue = destinationLocaleResources[key];
306
+ const importValue = importLocaleResources[key];
287
307
 
288
- if (typeof sourceValue === "object" && typeof destinationValue === "object") {
289
- newDestinationLocaleResources[key] = this.#merge(logChanges, `${parentKey}${key}.`, sourceValue, destinationValue, addMissing);
290
- } else if (typeof sourceValue === "string" && typeof destinationValue === "string") {
291
- newDestinationLocaleResources[key] = destinationValue;
308
+ if (typeof templateValue === "object" && typeof importValue === "object") {
309
+ patchMergedLocaleResources[key] = {};
310
+
311
+ if (this.#merge(patchMergedLocaleResources[key], isDefaultLocale, `${parentKey}${key}.`, templateValue, importValue, addMissing)) {
312
+ anyChanges = true;
313
+ }
314
+ } else if ((typeof templateValue === "string" || typeof templateValue === "undefined") && (typeof importValue === "string" || typeof importValue === "undefined" || typeof importValue === "object")) {
315
+ patchMergedLocaleResources[key] = importValue;
292
316
  } else {
293
317
  throw new Error(`Mismatched types at ${parentKey}${key}`);
294
318
  }
295
319
  }
296
320
  }
297
321
 
298
- return newDestinationLocaleResources;
322
+ return anyChanges;
299
323
  }
300
324
 
301
325
  /**
@@ -336,7 +360,7 @@ class LocaleResourcesGenerator extends Generator {
336
360
 
337
361
  for (const [parameterName, parametersSequencerEntry] of entries) {
338
362
  if (parametersSequencerEntry.isUsed) {
339
- this.#parametersLocaleResources[parameterName] = {
363
+ this.#templateParametersLocaleResources[parameterName] = {
340
364
  name: parameterName,
341
365
  description: "*** LOCALIZATION REQUIRED ***"
342
366
  };
@@ -363,13 +387,14 @@ class LocaleResourcesGenerator extends Generator {
363
387
  * @returns
364
388
  * Output string.
365
389
  */
366
- static #buildOutput(prefix: string, value: LocaleResources | string, indentLevel: number): string {
367
- return `${" ".repeat(indentLevel)}${prefix} ${typeof value === "object" ?
368
- `{\n${
369
- Object.entries(value).map(entry => LocaleResourcesGenerator.#buildOutput(`${entry[0]}:`, entry[1], indentLevel + 1)).join(",\n")
370
- }\n${" ".repeat(indentLevel)}}` :
371
- // JSON.stringify() will apply quotes as appropriate.
372
- JSON.stringify(value)
390
+ static #buildOutput(prefix: string, value: LocaleResources | string | undefined, indentLevel: number): string {
391
+ return `${" ".repeat(indentLevel)}${prefix} ${
392
+ typeof value === "object" ?
393
+ `{\n${
394
+ Object.entries(value).map(entry => LocaleResourcesGenerator.#buildOutput(`${entry[0]}:`, entry[1], indentLevel + 1)).join(",\n")
395
+ }\n${" ".repeat(indentLevel)}}` :
396
+ // JSON.stringify() will apply quotes as appropriate.
397
+ JSON.stringify(value)
373
398
  }`;
374
399
  }
375
400
 
@@ -380,18 +405,20 @@ class LocaleResourcesGenerator extends Generator {
380
405
  if (success) {
381
406
  this.#buildParametersLocaleResources(this.#parametersSequencer);
382
407
 
383
- await Promise.all(fs.readdirSync(LocaleResourcesGenerator.#IMPORT_PATH, {
408
+ await Promise.all(await fs.promises.readdir(LocaleResourcesGenerator.#IMPORT_PATH, {
384
409
  withFileTypes: true
385
- }).filter(entry => entry.isDirectory()).map(async (entry) => {
410
+ }).then(entries => entries.filter(entry => entry.isDirectory()).map(async (entry) => {
386
411
  const localeResourcesSource = path.resolve(LocaleResourcesGenerator.#IMPORT_PATH, entry.name, "locale-resources.ts");
387
412
 
388
- return import(localeResourcesSource).then((module) => {
389
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Module format is known.
390
- const localeResources = this.#merge(entry.name === "en", "", this.#LocaleResources, (module as LocaleResourcesModule).default, !entry.name.includes("-"));
413
+ return import(localeResourcesSource).then(async (module) => {
414
+ const mergedLocaleResources: LocaleResources = {};
391
415
 
392
- fs.writeFileSync(localeResourcesSource, `${LocaleResourcesGenerator.#buildOutput("export default", localeResources, 0)};\n`);
416
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Module format is known.
417
+ return this.#merge(mergedLocaleResources, entry.name === "en", "", this.#templateLocaleResources, (module as LocaleResourcesModule).default, !entry.name.includes("-")) ?
418
+ fs.promises.writeFile(localeResourcesSource, `${LocaleResourcesGenerator.#buildOutput("export default", mergedLocaleResources, 0)};\n`) :
419
+ undefined;
393
420
  });
394
- }));
421
+ })));
395
422
  }
396
423
  }
397
424
  }
@@ -1,7 +1,6 @@
1
1
  import { AI39_CREATOR, AI64_VALIDATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
2
2
  import type { AppExtension } from "../app-extension.js";
3
3
  import { expandParameterDescriptor, proxy } from "../proxy.js";
4
- import type { ErrorExtends } from "../type.js";
5
4
  import {
6
5
  exclusionAllNumericParameterDescriptor,
7
6
  exclusionNoneParameterDescriptor
@@ -18,8 +17,8 @@ import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility
18
17
  }
19
18
  ]
20
19
  })
21
- export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
22
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
20
+ export class AI82Proxy extends CharacterSetCreatorProxy {
21
+ constructor(appExtension: AppExtension) {
23
22
  super(appExtension, AI82_CREATOR);
24
23
  }
25
24
  }
@@ -34,8 +33,8 @@ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
34
33
  }
35
34
  ]
36
35
  })
37
- export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
38
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
36
+ export class AI39Proxy extends CharacterSetCreatorProxy {
37
+ constructor(appExtension: AppExtension) {
39
38
  super(appExtension, AI39_CREATOR);
40
39
  }
41
40
  }
@@ -44,8 +43,8 @@ export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
44
43
  namespace: "GS1",
45
44
  methodInfix: "AI64"
46
45
  })
47
- export class AI64Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
48
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
46
+ export class AI64Proxy extends CharacterSetValidatorProxy {
47
+ constructor(appExtension: AppExtension) {
49
48
  super(appExtension, AI64_VALIDATOR);
50
49
  }
51
50
  }
@@ -9,7 +9,7 @@ import {
9
9
  import { type ExtendsParameterDescriptor, Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
10
10
  import { LibProxy } from "../lib-proxy.js";
11
11
  import { proxy } from "../proxy.js";
12
- import type { ErrorExtends, Matrix, MatrixResult, SingletonResult } from "../type.js";
12
+ import type { Matrix, MatrixResult, SingletonResult } from "../type.js";
13
13
 
14
14
  const checkSParameterDescriptor: ParameterDescriptor = {
15
15
  name: "checkS",
@@ -56,13 +56,13 @@ const ai82SWithCheckCharacterPairParameterDescriptor: ExtendsParameterDescriptor
56
56
  namespace: "GS1",
57
57
  category: "checkCharacter"
58
58
  })
59
- export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
59
+ export class CheckProxy extends LibProxy {
60
60
  @proxy.describeMethod({
61
61
  type: Types.String,
62
62
  multiplicity: Multiplicities.Matrix,
63
63
  parameterDescriptors: [numericSParameterDescriptor]
64
64
  })
65
- checkDigit(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
65
+ checkDigit(matrixSs: Matrix<string>): MatrixResult<string> {
66
66
  return this.matrixResult(matrixSs, s => checkDigit(s));
67
67
  }
68
68
 
@@ -71,7 +71,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
71
71
  multiplicity: Multiplicities.Matrix,
72
72
  parameterDescriptors: [numericSWithCheckDigitParameterDescriptor]
73
73
  })
74
- hasValidCheckDigit(matrixSs: Matrix<string>): MatrixResult<boolean, ThrowError, TError> {
74
+ hasValidCheckDigit(matrixSs: Matrix<string>): MatrixResult<boolean> {
75
75
  return this.matrixResult(matrixSs, s => hasValidCheckDigit(s));
76
76
  }
77
77
 
@@ -80,7 +80,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
80
80
  multiplicity: Multiplicities.Matrix,
81
81
  parameterDescriptors: [numericSFourOrFiveDigitsParameterDescriptor]
82
82
  })
83
- priceOrWeightCheckDigit(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
83
+ priceOrWeightCheckDigit(matrixSs: Matrix<string>): MatrixResult<string> {
84
84
  return this.matrixResult(matrixSs, s => priceOrWeightCheckDigit(s));
85
85
  }
86
86
 
@@ -92,7 +92,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
92
92
  multiplicity: Multiplicities.Singleton
93
93
  }, checkDigitParameterDescriptor]
94
94
  })
95
- isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): SingletonResult<boolean, ThrowError, TError> {
95
+ isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): SingletonResult<boolean> {
96
96
  return this.singletonResult(() => isValidPriceOrWeightCheckDigit(s, checkDigit));
97
97
  }
98
98
 
@@ -101,7 +101,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
101
101
  multiplicity: Multiplicities.Matrix,
102
102
  parameterDescriptors: [ai82SParameterDescriptor]
103
103
  })
104
- checkCharacterPair(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
104
+ checkCharacterPair(matrixSs: Matrix<string>): MatrixResult<string> {
105
105
  return this.matrixResult(matrixSs, s => checkCharacterPair(s));
106
106
  }
107
107
 
@@ -110,7 +110,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
110
110
  multiplicity: Multiplicities.Matrix,
111
111
  parameterDescriptors: [ai82SWithCheckCharacterPairParameterDescriptor]
112
112
  })
113
- hasValidCheckCharacterPair(matrixSs: Matrix<string>): MatrixResult<boolean, ThrowError, TError> {
113
+ hasValidCheckCharacterPair(matrixSs: Matrix<string>): MatrixResult<boolean> {
114
114
  return this.matrixResult(matrixSs, s => hasValidCheckCharacterPair(s));
115
115
  }
116
116
  }
@@ -4,7 +4,7 @@ import type { AppExtension } from "../app-extension.js";
4
4
  import { type ExtendsParameterDescriptor, Multiplicities, Types } from "../descriptor.js";
5
5
  import { LibProxy } from "../lib-proxy.js";
6
6
  import { proxy } from "../proxy.js";
7
- import type { ErrorExtends, Matrix, MatrixResult, SingletonResult } from "../type.js";
7
+ import type { Matrix, MatrixResult, SingletonResult } from "../type.js";
8
8
  import { identifierParameterDescriptor, identifierTypeParameterDescriptor } from "./identifier-descriptor.js";
9
9
  import { validateIdentifierType } from "./identifier-type.js";
10
10
 
@@ -16,7 +16,7 @@ const gcpLengthIdentifierParameterDescriptor: ExtendsParameterDescriptor = {
16
16
  /**
17
17
  * Application extension GCP length cache. Data is stored in application extension shared data.
18
18
  */
19
- class AppExtensionGCPLengthCache<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends RemoteGCPLengthCache {
19
+ class AppExtensionGCPLengthCache extends RemoteGCPLengthCache {
20
20
  /**
21
21
  * Logger.
22
22
  */
@@ -28,7 +28,7 @@ class AppExtensionGCPLengthCache<ThrowError extends boolean, TError extends Erro
28
28
  * @param appExtension
29
29
  * Application extension.
30
30
  */
31
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
31
+ constructor(appExtension: AppExtension) {
32
32
  super(appExtension.sharedAppDataStorage, RemoteGCPLengthCache.DEFAULT_BASE_URL, appExtension.httpFetch);
33
33
 
34
34
  this.#logger = appExtension.logger;
@@ -100,10 +100,10 @@ class AppExtensionGCPLengthCache<ThrowError extends boolean, TError extends Erro
100
100
  namespace: "GS1",
101
101
  category: "service"
102
102
  })
103
- export class GCPLengthProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
103
+ export class GCPLengthProxy extends LibProxy {
104
104
  readonly #gcpLength: GCPLength;
105
105
 
106
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
106
+ constructor(appExtension: AppExtension) {
107
107
  super(appExtension);
108
108
 
109
109
  this.#gcpLength = new GCPLength(new AppExtensionGCPLengthCache(appExtension));
@@ -128,7 +128,7 @@ export class GCPLengthProxy<ThrowError extends boolean, TError extends ErrorExte
128
128
  isAsync: true,
129
129
  parameterDescriptors: [identifierTypeParameterDescriptor, gcpLengthIdentifierParameterDescriptor]
130
130
  })
131
- async gcpLengthOf(identifierType: string, matrixIdentifiers: Matrix<string>): Promise<MatrixResult<number, ThrowError, TError>> {
131
+ async gcpLengthOf(identifierType: string, matrixIdentifiers: Matrix<string>): Promise<MatrixResult<number>> {
132
132
  return this.#loadGCPLengthData().then(() => this.setUpMatrixResult(
133
133
  () => validateIdentifierType(identifierType),
134
134
  matrixIdentifiers,
@@ -142,7 +142,7 @@ export class GCPLengthProxy<ThrowError extends boolean, TError extends ErrorExte
142
142
  isAsync: true,
143
143
  parameterDescriptors: []
144
144
  })
145
- async gcpLengthDateTime(): Promise<SingletonResult<string, ThrowError, TError>> {
145
+ async gcpLengthDateTime(): Promise<SingletonResult<string>> {
146
146
  return this.#loadGCPLengthData().then(() =>
147
147
  this.singletonResult(() => this.#gcpLength.dateTime.toISOString())
148
148
  );
@@ -154,7 +154,7 @@ export class GCPLengthProxy<ThrowError extends boolean, TError extends ErrorExte
154
154
  isAsync: true,
155
155
  parameterDescriptors: []
156
156
  })
157
- async gcpLengthDisclaimer(): Promise<SingletonResult<string, ThrowError, TError>> {
157
+ async gcpLengthDisclaimer(): Promise<SingletonResult<string>> {
158
158
  return this.#loadGCPLengthData().then(() =>
159
159
  this.singletonResult(() => this.#gcpLength.disclaimer)
160
160
  );
@@ -3,7 +3,7 @@ import type { GTINCreator, GTINType } from "@aidc-toolkit/gs1";
3
3
  import type { AppExtension } from "../app-extension.js";
4
4
  import { Multiplicities, Types } from "../descriptor.js";
5
5
  import { expandParameterDescriptor, proxy } from "../proxy.js";
6
- import type { ErrorExtends, Matrix, MatrixResult } from "../type.js";
6
+ import type { Matrix, MatrixResult } from "../type.js";
7
7
  import { valueParameterDescriptor } from "../utility/transformer-descriptor.js";
8
8
  import { indicatorDigitParameterDescriptor } from "./gtin-descriptor.js";
9
9
  import { NumericIdentifierCreatorProxy, sparseParameterDescriptor } from "./identifier-creator-proxy.js";
@@ -21,8 +21,8 @@ import {
21
21
  }
22
22
  ]
23
23
  })
24
- export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends NumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt, GTINType, GTINCreator> {
25
- constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>) {
24
+ export class GTINCreatorProxy extends NumericIdentifierCreatorProxy<GTINType, GTINCreator> {
25
+ constructor(appExtension: AppExtension) {
26
26
  super(appExtension, prefixManager => prefixManager.gtinCreator);
27
27
  }
28
28
 
@@ -32,7 +32,7 @@ export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
32
32
  ignoreInfix: true,
33
33
  parameterDescriptors: [indicatorDigitParameterDescriptor, prefixDefinitionAnyParameterDescriptor, valueParameterDescriptor, sparseParameterDescriptor]
34
34
  })
35
- createGTIN14(indicatorDigit: string, prefixDefinition: Matrix<unknown>, matrixValues: Matrix<number | bigint>, sparse: Nullishable<boolean>): MatrixResult<string, ThrowError, TError> {
35
+ createGTIN14(indicatorDigit: string, prefixDefinition: Matrix<unknown>, matrixValues: Matrix<number | bigint>, sparse: Nullishable<boolean>): MatrixResult<string> {
36
36
  const sparseOrUndefined = sparse ?? undefined;
37
37
 
38
38
  return this.setUpMatrixResult(() =>