@aidc-toolkit/app-extension 1.0.32-beta → 1.0.33-beta

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 (39) hide show
  1. package/dist/index.cjs +1 -6528
  2. package/dist/index.d.cts +105 -106
  3. package/dist/index.d.ts +105 -106
  4. package/dist/index.js +1 -6508
  5. package/package.json +12 -12
  6. package/src/app-extension.ts +26 -47
  7. package/src/{app-utility-proxy.ts → app-helper-proxy.ts} +21 -19
  8. package/src/descriptor.ts +43 -2
  9. package/src/generator/generator.ts +116 -91
  10. package/src/generator/locale-resources-generator.ts +26 -14
  11. package/src/gs1/check-proxy.ts +12 -11
  12. package/src/gs1/gtin-creator-proxy.ts +2 -3
  13. package/src/gs1/gtin-descriptor.ts +2 -2
  14. package/src/gs1/gtin-validator-proxy.ts +12 -14
  15. package/src/gs1/identifier-creator-proxy.ts +19 -21
  16. package/src/gs1/identifier-descriptor.ts +3 -3
  17. package/src/gs1/identifier-validator-proxy.ts +15 -16
  18. package/src/gs1/non-gtin-creator-proxy.ts +0 -11
  19. package/src/gs1/non-gtin-validator-proxy.ts +0 -11
  20. package/src/gs1/prefix-definition-descriptor.ts +2 -2
  21. package/src/gs1/prefix-manager-proxy.ts +80 -120
  22. package/src/gs1/service-proxy.ts +6 -5
  23. package/src/gs1/variable-measure-proxy.ts +9 -8
  24. package/src/index.ts +1 -2
  25. package/src/locale/en/locale-resources.ts +28 -15
  26. package/src/locale/fr/locale-resources.ts +28 -15
  27. package/src/locale/i18n.ts +10 -9
  28. package/src/locale/i18next.d.ts +2 -0
  29. package/src/proxy.ts +64 -40
  30. package/src/utility/character-set-descriptor.ts +2 -2
  31. package/src/utility/character-set-proxy.ts +7 -7
  32. package/src/utility/reg-exp-proxy.ts +5 -5
  33. package/src/utility/string-descriptor.ts +2 -2
  34. package/src/utility/string-proxy.ts +4 -0
  35. package/src/utility/transformer-descriptor.ts +5 -5
  36. package/src/utility/transformer-proxy.ts +6 -5
  37. package/dist/index.cjs.map +0 -1
  38. package/dist/index.js.map +0 -1
  39. package/src/app-data.ts +0 -94
@@ -1,9 +1,10 @@
1
- import { I18nEnvironments, type Promisable } from "@aidc-toolkit/core";
2
- import type { ParseKeys } from "i18next";
3
- import { AppUtilityProxy } from "../app-utility-proxy.js";
1
+ import { getLogger, I18nEnvironments, type Promisable } from "@aidc-toolkit/core";
2
+ import type { DefaultNamespace, ParseKeys } from "i18next";
3
+ import type { Logger } from "tslog";
4
+ import { AppHelperProxy } from "../app-helper-proxy.js";
4
5
  import type { ClassDescriptor, MethodDescriptor } from "../descriptor.js";
5
6
  import * as GS1 from "../gs1/index.js";
6
- import { appExtensionResources, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
7
+ import { appExtensionResourceBundle, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
7
8
  import { proxy } from "../proxy.js";
8
9
  import * as Utility from "../utility/index.js";
9
10
 
@@ -16,7 +17,7 @@ import * as Utility from "../utility/index.js";
16
17
  function registerProxies(..._proxies: unknown[]): void {
17
18
  }
18
19
 
19
- registerProxies(AppUtilityProxy, Utility, GS1);
20
+ registerProxies(AppHelperProxy, Utility, GS1);
20
21
 
21
22
  /**
22
23
  * Localization.
@@ -25,27 +26,32 @@ export interface Localization {
25
26
  /**
26
27
  * Name.
27
28
  */
28
- name: string;
29
+ readonly name: string;
29
30
 
30
31
  /**
31
32
  * Description.
32
33
  */
33
- description: string;
34
+ readonly description: string;
34
35
  }
35
36
 
36
37
  /**
37
38
  * Function localization.
38
39
  */
39
40
  export interface FunctionLocalization extends Localization {
41
+ /**
42
+ * Namespace function name.
43
+ */
44
+ readonly namespaceFunctionName: string;
45
+
40
46
  /**
41
47
  * Documentation URL.
42
48
  */
43
- documentationURL: string;
49
+ readonly documentationURL: string;
44
50
 
45
51
  /**
46
52
  * Parameters map.
47
53
  */
48
- parametersMap: Map<string, Localization>;
54
+ readonly parametersMap: ReadonlyMap<string, Localization>;
49
55
  }
50
56
 
51
57
  /**
@@ -62,6 +68,11 @@ export abstract class Generator {
62
68
  */
63
69
  static readonly #DOCUMENTATION_PATH = "app-extension/";
64
70
 
71
+ /**
72
+ * Logger.
73
+ */
74
+ readonly #logger = getLogger();
75
+
65
76
  /**
66
77
  * Locales.
67
78
  */
@@ -72,11 +83,6 @@ export abstract class Generator {
72
83
  */
73
84
  readonly #defaultLocale: string;
74
85
 
75
- /**
76
- * Map of function localizations maps by namespace function name.
77
- */
78
- readonly #functionLocalizationsMapsMap = new Map<string, ReadonlyMap<string, FunctionLocalization>>();
79
-
80
86
  /**
81
87
  * Constructor.
82
88
  *
@@ -84,10 +90,17 @@ export abstract class Generator {
84
90
  * Include localizations if true.
85
91
  */
86
92
  constructor(includeLocalizations = true) {
87
- this.#locales = includeLocalizations ? Object.keys(appExtensionResources) : [];
93
+ this.#locales = includeLocalizations ? Object.keys(appExtensionResourceBundle) : [];
88
94
  this.#defaultLocale = this.#locales[0] ?? "";
89
95
  }
90
96
 
97
+ /**
98
+ * Get the logger.
99
+ */
100
+ get logger(): Logger<object> {
101
+ return this.#logger;
102
+ }
103
+
91
104
  /**
92
105
  * Get the locales.
93
106
  */
@@ -103,56 +116,31 @@ export abstract class Generator {
103
116
  }
104
117
 
105
118
  /**
106
- * Get function localization.
107
- *
108
- * @param locale
109
- * Locale.
110
- *
111
- * @param namespaceFunctionName
112
- * Namespace function name.
113
- *
114
- * @returns
115
- * Function localization.
119
+ * Initialize the generation of the output.
116
120
  */
117
- protected getFunctionLocalization(locale: string, namespaceFunctionName: string): FunctionLocalization {
118
- const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
119
-
120
- if (functionLocalization === undefined) {
121
- throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
122
- }
123
-
124
- return functionLocalization;
125
- }
121
+ protected abstract initialize(): void;
126
122
 
127
123
  /**
128
- * Get parameter localization.
129
- *
130
- * @param locale
131
- * Locale.
124
+ * Create a namespace.
132
125
  *
133
- * @param namespaceFunctionName
134
- * Namespace function name.
135
- *
136
- * @param parameterName
137
- * Parameter name.
138
- *
139
- * @returns
140
- * Parameter localization.
126
+ * @param namespace
127
+ * Namespace.
141
128
  */
142
- protected getParameterLocalization(locale: string, namespaceFunctionName: string, parameterName: string): Localization {
143
- const parameterLocalization = this.getFunctionLocalization(locale, namespaceFunctionName).parametersMap.get(parameterName);
144
-
145
- if (parameterLocalization === undefined) {
146
- throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
147
- }
148
-
149
- return parameterLocalization;
150
- }
129
+ protected abstract createNamespace(namespace: string | undefined): void;
151
130
 
152
131
  /**
153
- * Initialize the generation of the output.
132
+ * Create a category.
133
+ *
134
+ * @param namespace
135
+ * Namespace.
136
+ *
137
+ * @param category
138
+ * Category.
139
+ *
140
+ * @param categoryLocalizationsMap
141
+ * Category localizations map.
154
142
  */
155
- protected abstract initialize(): void;
143
+ protected abstract createCategory(namespace: string | undefined, category: string, categoryLocalizationsMap: ReadonlyMap<string, string>): void;
156
144
 
157
145
  /**
158
146
  * Create a proxy object for a class.
@@ -172,7 +160,7 @@ export abstract class Generator {
172
160
  * Method descriptor.
173
161
  *
174
162
  * @param functionLocalizationsMap
175
- * Localizations map.
163
+ * Function localizations map.
176
164
  */
177
165
  protected abstract createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor, functionLocalizationsMap: ReadonlyMap<string, FunctionLocalization>): void;
178
166
 
@@ -193,11 +181,8 @@ export abstract class Generator {
193
181
  * @param locale
194
182
  * Locale.
195
183
  *
196
- * @param localizedKeyPrefix
197
- * Localized key prefix.
198
- *
199
- * @param namespacePrefix
200
- * Namespace prefix to be appended to name.
184
+ * @param key
185
+ * Key.
201
186
  *
202
187
  * @param localizationCallback
203
188
  * Callback to finalize localization.
@@ -205,17 +190,14 @@ export abstract class Generator {
205
190
  * @returns
206
191
  * Localization.
207
192
  */
208
- #generateLocalization<TLocalization extends Localization>(locale: string, localizedKeyPrefix: string, namespacePrefix: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): TLocalization {
209
- const lngOption = {
210
- lng: locale
211
- };
212
-
213
- return localizationCallback(locale, {
214
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
215
- name: `${namespacePrefix}${i18nextAppExtension.t(`${localizedKeyPrefix}name` as ParseKeys, lngOption)}`,
216
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
217
- description: i18nextAppExtension.t(`${localizedKeyPrefix}description` as ParseKeys, lngOption)
218
- });
193
+ static #generateLocalization<TLocalization extends Localization>(locale: string, key: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): TLocalization {
194
+ const lngReturnObjectsOption = {
195
+ lng: locale,
196
+ returnObjects: true
197
+ } as const;
198
+
199
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists and return type is Localization.
200
+ return localizationCallback(locale, i18nextAppExtension.t(key as ParseKeys<DefaultNamespace, typeof lngReturnObjectsOption>, lngReturnObjectsOption) as Localization);
219
201
  }
220
202
 
221
203
  /**
@@ -228,30 +210,73 @@ export abstract class Generator {
228
210
 
229
211
  this.initialize();
230
212
 
213
+ const namespaceHierarchy = new Map<string | undefined, Map<string, ClassDescriptor[]>>();
214
+
215
+ // Organize class descriptors by namespace and category.
216
+ for (const classDescriptor of proxy.classDescriptors) {
217
+ const namespace = classDescriptor.namespace;
218
+ const category = classDescriptor.category;
219
+
220
+ let categoryHierarchy = namespaceHierarchy.get(namespace);
221
+
222
+ if (categoryHierarchy === undefined) {
223
+ categoryHierarchy = new Map();
224
+ namespaceHierarchy.set(namespace, categoryHierarchy);
225
+ }
226
+
227
+ let classDescriptors = categoryHierarchy.get(category);
228
+
229
+ if (classDescriptors === undefined) {
230
+ classDescriptors = [];
231
+ categoryHierarchy.set(category, classDescriptors);
232
+ }
233
+
234
+ classDescriptors.push(classDescriptor);
235
+ }
236
+
231
237
  try {
232
- for (const [_namespaceClassName, classDescriptor] of proxy.classDescriptorsMap.entries()) {
233
- const namespace = classDescriptor.namespace;
238
+ for (const [namespace, categoryHierarchy] of namespaceHierarchy) {
234
239
  const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
235
240
  const namespacePath = namespace === undefined ? "" : `${namespace}/`;
236
241
 
237
- this.createProxyObject(classDescriptor);
242
+ this.createNamespace(namespace);
243
+
244
+ for (const [category, classDescriptors] of categoryHierarchy) {
245
+ const namespaceCategory = `${namespacePrefix}${category}`;
246
+
247
+ const categoriesKey = `Categories.${category}`;
248
+ const namespaceCategoriesKey = `Categories.${namespaceCategory}`;
249
+
250
+ const categoryLocalizationsMap = new Map(this.locales.map((locale) => {
251
+ const lngOption = {
252
+ lng: locale
253
+ } as const;
254
+
255
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
256
+ return [locale, i18nextAppExtension.t((i18nextAppExtension.exists(namespaceCategoriesKey, lngOption) ? namespaceCategoriesKey : categoriesKey) as ParseKeys, lngOption)];
257
+ }));
258
+
259
+ this.createCategory(namespace, category, categoryLocalizationsMap);
238
260
 
239
- for (const methodDescriptor of classDescriptor.methodDescriptors) {
240
- const namespaceFunctionName = methodDescriptor.namespaceFunctionName;
241
- const functionLocalizationsMap = new Map(this.#locales.map(locale =>
242
- [locale, this.#generateLocalization<FunctionLocalization>(locale, `Functions.${namespaceFunctionName}.`, namespacePrefix, (locale, localization) => ({
243
- ...localization,
244
- documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
245
- parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
246
- // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
247
- [parameterDescriptor.name, this.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}.`, "", (_locale, localization) => localization)]
248
- ))
249
- }))]
250
- ));
261
+ for (const classDescriptor of classDescriptors) {
262
+ this.createProxyObject(classDescriptor);
251
263
 
252
- this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
264
+ for (const methodDescriptor of classDescriptor.methodDescriptors) {
265
+ const functionLocalizationsMap = new Map(this.locales.map(locale =>
266
+ [locale, Generator.#generateLocalization<FunctionLocalization>(locale, `Functions.${methodDescriptor.namespaceFunctionName}`, (locale, localization) => ({
267
+ ...localization,
268
+ namespaceFunctionName: `${namespacePrefix}${localization.name}`,
269
+ documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
270
+ parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
271
+ // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
272
+ [parameterDescriptor.name, Generator.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]
273
+ ))
274
+ }))]
275
+ ));
253
276
 
254
- this.createProxyFunction(classDescriptor, methodDescriptor, functionLocalizationsMap);
277
+ this.createProxyFunction(classDescriptor, methodDescriptor, functionLocalizationsMap);
278
+ }
279
+ }
255
280
  }
256
281
  }
257
282
 
@@ -1,4 +1,4 @@
1
- import { getLogger, type LocaleResources } from "@aidc-toolkit/core";
1
+ import type { LocaleResources } from "@aidc-toolkit/core";
2
2
  import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
4
  import type {
@@ -63,11 +63,6 @@ class LocaleResourcesGenerator extends Generator {
63
63
  */
64
64
  static readonly #IMPORT_PATH = "../app-extension/src/locale";
65
65
 
66
- /**
67
- * Logger.
68
- */
69
- readonly #logger = getLogger();
70
-
71
66
  /**
72
67
  * Parameters sequencer.
73
68
  */
@@ -101,13 +96,25 @@ class LocaleResourcesGenerator extends Generator {
101
96
  /**
102
97
  * @inheritDoc
103
98
  */
104
- protected initialize(): void {
99
+ protected override initialize(): void {
100
+ }
101
+
102
+ /**
103
+ * @inheritDoc
104
+ */
105
+ protected override createNamespace(): void {
105
106
  }
106
107
 
107
108
  /**
108
109
  * @inheritDoc
109
110
  */
110
- protected createProxyObject(): void {
111
+ protected override createCategory(): void {
112
+ }
113
+
114
+ /**
115
+ * @inheritDoc
116
+ */
117
+ protected override createProxyObject(): void {
111
118
  }
112
119
 
113
120
  /**
@@ -185,7 +192,7 @@ class LocaleResourcesGenerator extends Generator {
185
192
  /**
186
193
  * @inheritDoc
187
194
  */
188
- protected createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor): void {
195
+ protected override createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor): void {
189
196
  // Hidden functions aren't localized.
190
197
  if (!(methodDescriptor.isHidden ?? false)) {
191
198
  // Add any parameters that are not already known.
@@ -258,7 +265,7 @@ class LocaleResourcesGenerator extends Generator {
258
265
  if (!deleteMissing) {
259
266
  newDestinationLocaleResources[key] = destinationValue;
260
267
  } else if (logChanges) {
261
- this.#logger.info(`Deleting ${parentKey}${key}...`);
268
+ this.logger.info(`Deleting ${parentKey}${key}...`);
262
269
  }
263
270
  }
264
271
  }
@@ -267,7 +274,7 @@ class LocaleResourcesGenerator extends Generator {
267
274
  if (!(key in destinationLocaleResources)) {
268
275
  if (addMissing) {
269
276
  if (logChanges) {
270
- this.#logger.info(`Adding ${parentKey}${key}...`);
277
+ this.logger.info(`Adding ${parentKey}${key}...`);
271
278
  }
272
279
 
273
280
  newDestinationLocaleResources[key] = sourceValue;
@@ -366,7 +373,7 @@ class LocaleResourcesGenerator extends Generator {
366
373
  /**
367
374
  * @inheritDoc
368
375
  */
369
- protected async finalize(success: boolean): Promise<void> {
376
+ protected override async finalize(success: boolean): Promise<void> {
370
377
  if (success) {
371
378
  this.#buildParametersLocaleResources(this.#parametersSequencer);
372
379
 
@@ -375,7 +382,7 @@ class LocaleResourcesGenerator extends Generator {
375
382
  }).filter(entry => entry.isDirectory()).map(async (entry) => {
376
383
  const localeResourcesSource = path.resolve(LocaleResourcesGenerator.#IMPORT_PATH, entry.name, "locale-resources.ts");
377
384
 
378
- await import(localeResourcesSource).then((module) => {
385
+ return import(localeResourcesSource).then((module) => {
379
386
  // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Module format is known.
380
387
  const localeResources = this.#merge(entry.name === "en", "", this.#LocaleResources, (module as LocaleResourcesModule).default, !entry.name.includes("-"));
381
388
 
@@ -386,4 +393,9 @@ class LocaleResourcesGenerator extends Generator {
386
393
  }
387
394
  }
388
395
 
389
- await new LocaleResourcesGenerator().generate();
396
+ const generator = new LocaleResourcesGenerator();
397
+
398
+ generator.generate().catch((e: unknown) => {
399
+ generator.logger.error(e);
400
+ process.exit(1);
401
+ });
@@ -6,7 +6,7 @@ import {
6
6
  isValidPriceOrWeightCheckDigit,
7
7
  priceOrWeightCheckDigit
8
8
  } from "@aidc-toolkit/gs1";
9
- import { type ExtendsParameterDescriptor, type ParameterDescriptor, Types } from "../descriptor.js";
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
12
  import type { ErrorExtends, Matrix, MatrixResult, SingletonResult } from "../type.js";
@@ -14,7 +14,7 @@ import type { ErrorExtends, Matrix, MatrixResult, SingletonResult } from "../typ
14
14
  const checkSParameterDescriptor: ParameterDescriptor = {
15
15
  name: "checkS",
16
16
  type: Types.String,
17
- isMatrix: true,
17
+ multiplicity: Multiplicities.Matrix,
18
18
  isRequired: true
19
19
  };
20
20
 
@@ -39,7 +39,7 @@ const checkDigitParameterDescriptor: ExtendsParameterDescriptor = {
39
39
  extendsDescriptor: numericSParameterDescriptor,
40
40
  sortOrder: 2,
41
41
  name: "checkDigit",
42
- isMatrix: false
42
+ multiplicity: Multiplicities.Singleton
43
43
  };
44
44
 
45
45
  const ai82SParameterDescriptor: ExtendsParameterDescriptor = {
@@ -53,12 +53,13 @@ const ai82SWithCheckCharacterPairParameterDescriptor: ExtendsParameterDescriptor
53
53
  };
54
54
 
55
55
  @proxy.describeClass(false, {
56
- namespace: "GS1"
56
+ namespace: "GS1",
57
+ category: "checkCharacter"
57
58
  })
58
59
  export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
59
60
  @proxy.describeMethod({
60
61
  type: Types.String,
61
- isMatrix: true,
62
+ multiplicity: Multiplicities.Matrix,
62
63
  parameterDescriptors: [numericSParameterDescriptor]
63
64
  })
64
65
  checkDigit(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -67,7 +68,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
67
68
 
68
69
  @proxy.describeMethod({
69
70
  type: Types.String,
70
- isMatrix: true,
71
+ multiplicity: Multiplicities.Matrix,
71
72
  parameterDescriptors: [numericSWithCheckDigitParameterDescriptor]
72
73
  })
73
74
  hasValidCheckDigit(matrixSs: Matrix<string>): MatrixResult<boolean, ThrowError, TError> {
@@ -76,7 +77,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
76
77
 
77
78
  @proxy.describeMethod({
78
79
  type: Types.String,
79
- isMatrix: true,
80
+ multiplicity: Multiplicities.Matrix,
80
81
  parameterDescriptors: [numericSFourOrFiveDigitsParameterDescriptor]
81
82
  })
82
83
  priceOrWeightCheckDigit(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -85,10 +86,10 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
85
86
 
86
87
  @proxy.describeMethod({
87
88
  type: Types.String,
88
- isMatrix: false,
89
+ multiplicity: Multiplicities.Singleton,
89
90
  parameterDescriptors: [{
90
91
  ...numericSFourOrFiveDigitsParameterDescriptor,
91
- isMatrix: false
92
+ multiplicity: Multiplicities.Singleton
92
93
  }, checkDigitParameterDescriptor]
93
94
  })
94
95
  isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): SingletonResult<boolean, ThrowError, TError> {
@@ -97,7 +98,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
97
98
 
98
99
  @proxy.describeMethod({
99
100
  type: Types.String,
100
- isMatrix: true,
101
+ multiplicity: Multiplicities.Matrix,
101
102
  parameterDescriptors: [ai82SParameterDescriptor]
102
103
  })
103
104
  checkCharacterPair(matrixSs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -106,7 +107,7 @@ export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<
106
107
 
107
108
  @proxy.describeMethod({
108
109
  type: Types.String,
109
- isMatrix: true,
110
+ multiplicity: Multiplicities.Matrix,
110
111
  parameterDescriptors: [ai82SWithCheckCharacterPairParameterDescriptor]
111
112
  })
112
113
  hasValidCheckCharacterPair(matrixSs: Matrix<string>): MatrixResult<boolean, ThrowError, TError> {
@@ -1,7 +1,7 @@
1
1
  import type { Nullishable } from "@aidc-toolkit/core";
2
2
  import type { GTINCreator, GTINType } from "@aidc-toolkit/gs1";
3
3
  import type { AppExtension } from "../app-extension.js";
4
- import { Types } from "../descriptor.js";
4
+ import { Multiplicities, Types } from "../descriptor.js";
5
5
  import { expandParameterDescriptor, proxy } from "../proxy.js";
6
6
  import type { ErrorExtends, Matrix, MatrixResult } from "../type.js";
7
7
  import { valueParameterDescriptor } from "../utility/transformer-descriptor.js";
@@ -13,7 +13,6 @@ import {
13
13
  } from "./prefix-definition-descriptor.js";
14
14
 
15
15
  @proxy.describeClass(false, {
16
- namespace: "GS1",
17
16
  methodInfix: "GTIN",
18
17
  replacementParameterDescriptors: [
19
18
  {
@@ -29,7 +28,7 @@ export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
29
28
 
30
29
  @proxy.describeMethod({
31
30
  type: Types.String,
32
- isMatrix: true,
31
+ multiplicity: Multiplicities.Matrix,
33
32
  ignoreInfix: true,
34
33
  parameterDescriptors: [indicatorDigitParameterDescriptor, prefixDefinitionAnyParameterDescriptor, valueParameterDescriptor, sparseParameterDescriptor]
35
34
  })
@@ -1,8 +1,8 @@
1
- import { type ParameterDescriptor, Types } from "../descriptor.js";
1
+ import { Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
2
2
 
3
3
  export const indicatorDigitParameterDescriptor: ParameterDescriptor = {
4
4
  name: "indicatorDigit",
5
5
  type: Types.String,
6
- isMatrix: false,
6
+ multiplicity: Multiplicities.Singleton,
7
7
  isRequired: true
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import type { Nullishable } from "@aidc-toolkit/core";
2
2
  import { GTINLengths, type GTINLevel, GTINValidator, IdentifierValidators } from "@aidc-toolkit/gs1";
3
3
  import type { AppExtension } from "../app-extension.js";
4
- import { type ExtendsParameterDescriptor, type ParameterDescriptor, Types } from "../descriptor.js";
4
+ import { type ExtendsParameterDescriptor, Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
5
5
  import { LibProxy } from "../lib-proxy.js";
6
6
  import { proxy } from "../proxy.js";
7
7
  import type { ErrorExtends, Matrix, MatrixResult } from "../type.js";
@@ -10,7 +10,6 @@ import { identifierParameterDescriptor } from "./identifier-descriptor.js";
10
10
  import { GTINValidatorProxy } from "./identifier-validator-proxy.js";
11
11
 
12
12
  @proxy.describeClass(false, {
13
- namespace: "GS1",
14
13
  methodInfix: "GTIN13"
15
14
  })
16
15
  export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
@@ -20,7 +19,6 @@ export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends Err
20
19
  }
21
20
 
22
21
  @proxy.describeClass(false, {
23
- namespace: "GS1",
24
22
  methodInfix: "GTIN12"
25
23
  })
26
24
  export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
@@ -30,7 +28,6 @@ export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends Err
30
28
  }
31
29
 
32
30
  @proxy.describeClass(false, {
33
- namespace: "GS1",
34
31
  methodInfix: "GTIN8"
35
32
  })
36
33
  export class GTIN8ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
@@ -67,7 +64,7 @@ const validateGTINParameterDescriptor: ExtendsParameterDescriptor = {
67
64
  const gtinLevelParameterDescriptor: ParameterDescriptor = {
68
65
  name: "gtinLevel",
69
66
  type: Types.Number,
70
- isMatrix: false,
67
+ multiplicity: Multiplicities.Singleton,
71
68
  isRequired: false
72
69
  };
73
70
 
@@ -77,12 +74,13 @@ const validateGTIN14ParameterDescriptor: ExtendsParameterDescriptor = {
77
74
  };
78
75
 
79
76
  @proxy.describeClass(false, {
80
- namespace: "GS1"
77
+ namespace: "GS1",
78
+ category: "identifierValidation"
81
79
  })
82
80
  export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
83
81
  @proxy.describeMethod({
84
82
  type: Types.String,
85
- isMatrix: true,
83
+ multiplicity: Multiplicities.Matrix,
86
84
  parameterDescriptors: [zeroSuppressibleGTIN12ParameterDescriptor]
87
85
  })
88
86
  zeroSuppressGTIN12(matrixGTIN12s: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -91,7 +89,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
91
89
 
92
90
  @proxy.describeMethod({
93
91
  type: Types.String,
94
- isMatrix: true,
92
+ multiplicity: Multiplicities.Matrix,
95
93
  parameterDescriptors: [zeroSuppressedGTIN12ParameterDescriptor]
96
94
  })
97
95
  zeroExpandGTIN12(matrixZeroSuppressedGTIN12s: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -100,7 +98,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
100
98
 
101
99
  @proxy.describeMethod({
102
100
  type: Types.String,
103
- isMatrix: true,
101
+ multiplicity: Multiplicities.Matrix,
104
102
  parameterDescriptors: [indicatorDigitParameterDescriptor, convertGTINParameterDescriptor]
105
103
  })
106
104
  convertToGTIN14(indicatorDigit: string, matrixGTINs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -109,7 +107,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
109
107
 
110
108
  @proxy.describeMethod({
111
109
  type: Types.String,
112
- isMatrix: true,
110
+ multiplicity: Multiplicities.Matrix,
113
111
  parameterDescriptors: [normalizeGTINParameterDescriptor]
114
112
  })
115
113
  normalizeGTIN(matrixGTINs: Matrix<string>): MatrixResult<string, ThrowError, TError> {
@@ -118,7 +116,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
118
116
 
119
117
  @proxy.describeMethod({
120
118
  type: Types.String,
121
- isMatrix: true,
119
+ multiplicity: Multiplicities.Matrix,
122
120
  parameterDescriptors: [validateGTINParameterDescriptor, gtinLevelParameterDescriptor]
123
121
  })
124
122
  validateGTIN(matrixGTINs: Matrix<string>, gtinLevel: Nullishable<GTINLevel>): Matrix<string> {
@@ -131,7 +129,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
131
129
 
132
130
  @proxy.describeMethod({
133
131
  type: Types.String,
134
- isMatrix: true,
132
+ multiplicity: Multiplicities.Matrix,
135
133
  parameterDescriptors: [validateGTINParameterDescriptor, gtinLevelParameterDescriptor]
136
134
  })
137
135
  isValidGTIN(matrixGTINs: Matrix<string>, gtinLevel: Nullishable<GTINLevel>): Matrix<boolean> {
@@ -140,7 +138,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
140
138
 
141
139
  @proxy.describeMethod({
142
140
  type: Types.String,
143
- isMatrix: true,
141
+ multiplicity: Multiplicities.Matrix,
144
142
  parameterDescriptors: [validateGTIN14ParameterDescriptor]
145
143
  })
146
144
  validateGTIN14(matrixGTIN14s: Matrix<string>): Matrix<string> {
@@ -151,7 +149,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
151
149
 
152
150
  @proxy.describeMethod({
153
151
  type: Types.String,
154
- isMatrix: true,
152
+ multiplicity: Multiplicities.Matrix,
155
153
  parameterDescriptors: [validateGTIN14ParameterDescriptor]
156
154
  })
157
155
  isValidGTIN14(matrixGTIN14s: Matrix<string>): Matrix<boolean> {