@aidc-toolkit/app-extension 1.0.27-beta → 1.0.28-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 (37) hide show
  1. package/dist/index.cjs +1102 -877
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +79 -241
  4. package/dist/index.d.ts +79 -241
  5. package/dist/index.js +1100 -870
  6. package/dist/index.js.map +1 -1
  7. package/package.json +5 -5
  8. package/src/app-extension.ts +5 -5
  9. package/src/app-utility-proxy.ts +18 -24
  10. package/src/descriptor.ts +29 -259
  11. package/src/generator/generator.ts +86 -132
  12. package/src/generator/index.ts +0 -1
  13. package/src/generator/locale-resources-generator.ts +39 -14
  14. package/src/gs1/character-set-proxy.ts +5 -5
  15. package/src/gs1/check-proxy.ts +35 -42
  16. package/src/gs1/gtin-creator-proxy.ts +58 -0
  17. package/src/gs1/gtin-descriptor.ts +29 -0
  18. package/src/gs1/gtin-validator-proxy.ts +161 -0
  19. package/src/gs1/identifier-creator-proxy.ts +227 -0
  20. package/src/gs1/identifier-validator-proxy.ts +87 -0
  21. package/src/gs1/index.ts +5 -1
  22. package/src/gs1/non-gtin-creator-proxy.ts +119 -0
  23. package/src/gs1/non-gtin-validator-proxy.ts +119 -0
  24. package/src/gs1/prefix-definition-descriptor.ts +18 -0
  25. package/src/gs1/prefix-manager-proxy.ts +42 -0
  26. package/src/index.ts +1 -0
  27. package/src/lib-proxy.ts +1 -1
  28. package/src/proxy.ts +509 -0
  29. package/src/utility/character-set-descriptor.ts +5 -5
  30. package/src/utility/character-set-proxy.ts +31 -47
  31. package/src/utility/reg-exp-proxy.ts +11 -15
  32. package/src/utility/string-descriptor.ts +2 -2
  33. package/src/utility/transformer-descriptor.ts +3 -3
  34. package/src/utility/transformer-proxy.ts +16 -26
  35. package/tsconfig-src.json +1 -4
  36. package/src/generator/descriptor.ts +0 -125
  37. package/src/gs1/identifier-proxy.ts +0 -826
@@ -1,17 +1,11 @@
1
1
  import { I18nEnvironments } from "@aidc-toolkit/core";
2
2
  import type { ParseKeys } from "i18next";
3
3
  import { AppUtilityProxy } from "../app-utility-proxy.js";
4
- import { expandParameterDescriptor, getClassDescriptorsMap } from "../descriptor.js";
4
+ import type { ClassDescriptor, MethodDescriptor } from "../descriptor.js";
5
5
  import * as GS1 from "../gs1/index.js";
6
6
  import { appExtensionResources, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
7
+ import { proxy } from "../proxy.js";
7
8
  import * as Utility from "../utility/index.js";
8
- import type {
9
- FunctionLocalization,
10
- Localization,
11
- ParameterLocalization,
12
- ProxyFunctionDescriptor,
13
- ProxyObjectDescriptor
14
- } from "./descriptor.js";
15
9
 
16
10
  /**
17
11
  * Dummy method to force proxies to register their decorators.
@@ -23,6 +17,35 @@ function registerProxies(..._proxies: unknown[]): void {
23
17
  }
24
18
 
25
19
  registerProxies(AppUtilityProxy, Utility, GS1);
20
+ /**
21
+ * Localization.
22
+ */
23
+ export interface Localization {
24
+ /**
25
+ * Name.
26
+ */
27
+ name: string;
28
+
29
+ /**
30
+ * Description.
31
+ */
32
+ description: string;
33
+ }
34
+
35
+ /**
36
+ * Function localization.
37
+ */
38
+ export interface FunctionLocalization extends Localization {
39
+ /**
40
+ * Documentation URL.
41
+ */
42
+ documentationURL: string;
43
+
44
+ /**
45
+ * Parameters map.
46
+ */
47
+ parametersMap: Map<string, Localization>;
48
+ }
26
49
 
27
50
  /**
28
51
  * Abstract generator.
@@ -53,15 +76,6 @@ export abstract class Generator {
53
76
  */
54
77
  readonly #functionLocalizationsMapsMap = new Map<string, ReadonlyMap<string, FunctionLocalization>>();
55
78
 
56
- /**
57
- * Map of parameter localizations maps by namespace function parameter name.
58
- */
59
- readonly #parameterLocalizationsMapsMap = new Map<string, ReadonlyMap<string, ParameterLocalization>>();
60
-
61
- /**
62
- *
63
- */
64
-
65
79
  /**
66
80
  * Constructor.
67
81
  *
@@ -90,16 +104,16 @@ export abstract class Generator {
90
104
  /**
91
105
  * Get function localization.
92
106
  *
93
- * @param namespaceFunctionName
94
- * Namespace function name.
95
- *
96
107
  * @param locale
97
108
  * Locale.
98
109
  *
110
+ * @param namespaceFunctionName
111
+ * Namespace function name.
112
+ *
99
113
  * @returns
100
114
  * Function localization.
101
115
  */
102
- protected getFunctionLocalization(namespaceFunctionName: string, locale: string): FunctionLocalization {
116
+ protected getFunctionLocalization(locale: string, namespaceFunctionName: string): FunctionLocalization {
103
117
  const functionLocalization = this.#functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
104
118
 
105
119
  if (functionLocalization === undefined) {
@@ -112,20 +126,20 @@ export abstract class Generator {
112
126
  /**
113
127
  * Get parameter localization.
114
128
  *
129
+ * @param locale
130
+ * Locale.
131
+ *
115
132
  * @param namespaceFunctionName
116
133
  * Namespace function name.
117
134
  *
118
135
  * @param parameterName
119
136
  * Parameter name.
120
137
  *
121
- * @param locale
122
- * Locale.
123
- *
124
138
  * @returns
125
- * Function localization.
139
+ * Parameter localization.
126
140
  */
127
- protected getParameterLocalization(namespaceFunctionName: string, parameterName: string, locale: string): ParameterLocalization {
128
- const parameterLocalization = this.#parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
141
+ protected getParameterLocalization(locale: string, namespaceFunctionName: string, parameterName: string): Localization {
142
+ const parameterLocalization = this.getFunctionLocalization(locale, namespaceFunctionName).parametersMap.get(parameterName);
129
143
 
130
144
  if (parameterLocalization === undefined) {
131
145
  throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
@@ -140,20 +154,26 @@ export abstract class Generator {
140
154
  protected abstract initialize(): void;
141
155
 
142
156
  /**
143
- * Create a proxy object.
157
+ * Create a proxy object for a class.
144
158
  *
145
- * @param proxyObjectDescriptor
146
- * Proxy object descriptor.
159
+ * @param classDescriptor
160
+ * Class descriptor.
147
161
  */
148
- protected abstract createProxyObject(proxyObjectDescriptor: ProxyObjectDescriptor): void;
162
+ protected abstract createProxyObject(classDescriptor: ClassDescriptor): void;
149
163
 
150
164
  /**
151
- * Create a proxy function.
165
+ * Create a proxy function for a class and method.
166
+ *
167
+ * @param classDescriptor
168
+ * Class descriptor.
152
169
  *
153
- * @param proxyFunctionDescriptor
154
- * Proxy function descriptor.
170
+ * @param methodDescriptor
171
+ * Method descriptor.
172
+ *
173
+ * @param functionLocalizationsMap
174
+ * Localizations map.
155
175
  */
156
- protected abstract createProxyFunction(proxyFunctionDescriptor: ProxyFunctionDescriptor): void;
176
+ protected abstract createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor, functionLocalizationsMap: ReadonlyMap<string, FunctionLocalization>): void;
157
177
 
158
178
  /**
159
179
  * Finalize the generation of the output.
@@ -164,11 +184,14 @@ export abstract class Generator {
164
184
  protected abstract finalize(success: boolean): void | Promise<void>;
165
185
 
166
186
  /**
167
- * Generate localizations map.
187
+ * Generate a localization.
168
188
  *
169
189
  * @template TLocalization
170
190
  * Localization type.
171
191
  *
192
+ * @param locale
193
+ * Locale.
194
+ *
172
195
  * @param localizedKeyPrefix
173
196
  * Localized key prefix.
174
197
  *
@@ -176,21 +199,19 @@ export abstract class Generator {
176
199
  * Callback to finalize localization.
177
200
  *
178
201
  * @returns
179
- * Localization map.
202
+ * Localization.
180
203
  */
181
- #generateLocalizationsMap<TLocalization extends Localization>(localizedKeyPrefix: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): ReadonlyMap<string, TLocalization> {
182
- return new Map(this.#locales.map((locale) => {
183
- const lngOption = {
184
- lng: locale
185
- };
186
-
187
- return [locale, localizationCallback(locale, {
188
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
189
- name: i18nextAppExtension.t(`${localizedKeyPrefix}name` as ParseKeys, lngOption),
190
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
191
- description: i18nextAppExtension.t(`${localizedKeyPrefix}description` as ParseKeys, lngOption)
192
- })];
193
- }));
204
+ #generateLocalization<TLocalization extends Localization>(locale: string, localizedKeyPrefix: string, localizationCallback: (locale: string, localization: Localization) => TLocalization): TLocalization {
205
+ const lngOption = {
206
+ lng: locale
207
+ };
208
+
209
+ return localizationCallback(locale, {
210
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
211
+ name: i18nextAppExtension.t(`${localizedKeyPrefix}name` as ParseKeys, lngOption),
212
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
213
+ description: i18nextAppExtension.t(`${localizedKeyPrefix}description` as ParseKeys, lngOption)
214
+ });
194
215
  }
195
216
 
196
217
  /**
@@ -208,95 +229,28 @@ export abstract class Generator {
208
229
  this.initialize();
209
230
 
210
231
  try {
211
- for (const classDescriptor of getClassDescriptorsMap().values()) {
232
+ for (const [_namespaceClassName, classDescriptor] of proxy.classDescriptorsMap.entries()) {
212
233
  const namespace = classDescriptor.namespace;
213
- const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
214
- const className = classDescriptor.name;
215
- const methodInfix = classDescriptor.methodInfix;
216
-
217
- // Namespace-qualified class name is used to construct object name.
218
- const namespaceClassName = `${namespacePrefix}${className}`;
219
-
220
- // First capture group is:
221
- // - one or more uppercase letters followed by zero or more numbers; or
222
- // - single uppercase letter followed by zero or more characters except uppercase letters or period.
223
- // Second capture group is:
224
- // - single uppercase letter followed by zero or more characters except period; or
225
- // - zero characters (empty string).
226
- // Third capture group, separated by optional period, is:
227
- // - single uppercase letter followed by zero or more characters (remainder of string); or
228
- // - zero characters (empty string).
229
- const classNameMatch = /^([A-Z]+[0-9]*|[A-Z][^A-Z.]*)([A-Z][^.]*|)\.?([A-Z].*|)$/.exec(namespaceClassName);
230
-
231
- if (classNameMatch === null) {
232
- throw new Error(`${namespaceClassName} is not a valid namespace-qualified class name`);
233
- }
234
-
235
- const proxyObjectDescriptor: ProxyObjectDescriptor = {
236
- namespace,
237
- className,
238
- namespaceClassName,
239
- classDescriptor,
240
- objectName: `${classNameMatch[1].toLowerCase()}${classNameMatch[2]}${classNameMatch[3]}`
241
- };
242
234
 
243
- this.createProxyObject(proxyObjectDescriptor);
235
+ this.createProxyObject(classDescriptor);
244
236
 
245
237
  for (const methodDescriptor of classDescriptor.methodDescriptors) {
246
- const methodName = methodDescriptor.name;
247
- const infixBefore = methodDescriptor.infixBefore;
248
-
249
- let functionName: string;
250
-
251
- if (methodInfix === undefined || methodDescriptor.ignoreInfix === true) {
252
- // No other classes in the hierarchy or no infix required.
253
- functionName = methodName;
254
- } else if (infixBefore === undefined) {
255
- // Other classes in the hierarchy and infix is postfix.
256
- functionName = `${methodName}${methodInfix}`;
257
- } else {
258
- const insertIndex = methodName.indexOf(infixBefore);
259
-
260
- if (insertIndex === -1) {
261
- throw new Error(`Cannot find "${infixBefore}" in method ${methodName}`);
262
- }
263
-
264
- // Other classes in the hierarchy and infix is in the middle of the string.
265
- functionName = `${methodName.substring(0, insertIndex)}${methodInfix}${methodName.substring(insertIndex)}`;
266
- }
267
-
268
- const namespaceFunctionName = `${namespacePrefix}${functionName}`;
269
-
270
- const functionLocalizationsMap = this.#generateLocalizationsMap<FunctionLocalization>(`Functions.${namespaceFunctionName}.`, (locale, localization) => ({
271
- ...localization,
272
- documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespace === undefined ? "" : `${namespace}/`}${localization.name}.html`
273
- }));
238
+ const namespaceFunctionName = methodDescriptor.namespaceFunctionName;
239
+
240
+ const functionLocalizationsMap = new Map(this.#locales.map(locale =>
241
+ [locale, this.#generateLocalization<FunctionLocalization>(locale, `Functions.${namespaceFunctionName}.`, (locale, localization) => ({
242
+ ...localization,
243
+ documentationURL: `${Generator.#DOCUMENTATION_BASE_URL}${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespace === undefined ? "" : `${namespace}/`}${localization.name}.html`,
244
+ parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
245
+ // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
246
+ [parameterDescriptor.name, this.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}.`, (_locale, localization) => localization)]
247
+ ))
248
+ }))]
249
+ ));
274
250
 
275
251
  this.#functionLocalizationsMapsMap.set(namespaceFunctionName, functionLocalizationsMap);
276
252
 
277
- this.createProxyFunction({
278
- ...proxyObjectDescriptor,
279
- functionName,
280
- namespaceFunctionName,
281
- localizationsMap: functionLocalizationsMap,
282
- proxyParameterDescriptors: methodDescriptor.parameterDescriptors.map((parameterDescriptor) => {
283
- const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
284
-
285
- const parameterName = expandedParameterDescriptor.name;
286
-
287
- const parameterLocalizationsMap = this.#generateLocalizationsMap(`Parameters.${parameterName}.`, (_locale, localization) => localization);
288
-
289
- this.#parameterLocalizationsMapsMap.set(`${namespaceFunctionName}.${parameterName}`, parameterLocalizationsMap);
290
-
291
- return {
292
- namespace,
293
- parameterName,
294
- localizationsMap: parameterLocalizationsMap,
295
- parameterDescriptor: expandedParameterDescriptor
296
- };
297
- }),
298
- methodDescriptor
299
- });
253
+ this.createProxyFunction(classDescriptor, methodDescriptor, functionLocalizationsMap);
300
254
  }
301
255
  }
302
256
 
@@ -1,2 +1 @@
1
- export type * from "./descriptor.js";
2
1
  export * from "./generator.js";
@@ -1,8 +1,12 @@
1
1
  import { getLogger, type LocaleResources } from "@aidc-toolkit/core";
2
2
  import * as fs from "node:fs";
3
3
  import * as path from "node:path";
4
- import { expandParameterDescriptor, type ParameterDescriptor } from "../descriptor.js";
5
- import type { ProxyFunctionDescriptor } from "./descriptor.js";
4
+ import type {
5
+ ClassDescriptor,
6
+ ExtendsParameterDescriptor,
7
+ MethodDescriptor,
8
+ ParameterDescriptor
9
+ } from "../descriptor.js";
6
10
  import { Generator } from "./generator.js";
7
11
 
8
12
  /**
@@ -17,7 +21,17 @@ interface ParametersSequencerEntry {
17
21
  /**
18
22
  * Parameter descriptor.
19
23
  */
20
- parameterDescriptor: ParameterDescriptor;
24
+ parameterDescriptor: ParameterDescriptor | ExtendsParameterDescriptor;
25
+
26
+ /**
27
+ * Parameter name.
28
+ */
29
+ parameterName: string;
30
+
31
+ /**
32
+ * Base parameter name.
33
+ */
34
+ baseParameterName: string;
21
35
 
22
36
  /**
23
37
  * True if parameter is actually used and not just a base.
@@ -28,6 +42,7 @@ interface ParametersSequencerEntry {
28
42
  /**
29
43
  * Parameters sequencer for keeping similar (extended) parameters together.
30
44
  */
45
+ // TODO Replace with map.
31
46
  type ParametersSequencer = Record<string, ParametersSequencerEntry>;
32
47
 
33
48
  /**
@@ -108,7 +123,7 @@ class LocaleResourcesGenerator extends Generator {
108
123
  * @returns
109
124
  * Parameters sequencer entry.
110
125
  */
111
- #saveParameterSequence(parameterDescriptor: ParameterDescriptor, isUsed: boolean): ParametersSequencerEntry {
126
+ #saveParameterSequence(parameterDescriptor: ParameterDescriptor | ExtendsParameterDescriptor, isUsed: boolean): ParametersSequencerEntry {
112
127
  let parametersSequencerEntry: ParametersSequencerEntry;
113
128
 
114
129
  if (!("extendsDescriptor" in parameterDescriptor)) {
@@ -119,6 +134,8 @@ class LocaleResourcesGenerator extends Generator {
119
134
  parametersSequencerEntry = {
120
135
  parametersSequencerOrNull: null,
121
136
  parameterDescriptor,
137
+ parameterName,
138
+ baseParameterName: parameterName,
122
139
  isUsed
123
140
  };
124
141
 
@@ -129,10 +146,18 @@ class LocaleResourcesGenerator extends Generator {
129
146
  } else {
130
147
  const baseParametersSequencerEntry = this.#saveParameterSequence(parameterDescriptor.extendsDescriptor, false);
131
148
 
132
- const expandedParameterDescriptor = expandParameterDescriptor(parameterDescriptor);
133
- const parameterName = expandedParameterDescriptor.name;
149
+ let parameterName: string;
150
+ let baseParameterName: string | null;
134
151
 
135
- if (parameterName !== expandParameterDescriptor(parameterDescriptor.extendsDescriptor).name) {
152
+ if (parameterDescriptor.name !== undefined) {
153
+ parameterName = parameterDescriptor.name;
154
+ baseParameterName = baseParametersSequencerEntry.parameterName;
155
+ } else {
156
+ parameterName = baseParametersSequencerEntry.parameterName;
157
+ baseParameterName = baseParametersSequencerEntry.baseParameterName;
158
+ }
159
+
160
+ if (parameterName !== baseParameterName) {
136
161
  // Make sure that base parameters sequencer entry refers to a record type.
137
162
  baseParametersSequencerEntry.parametersSequencerOrNull ??= {};
138
163
 
@@ -140,6 +165,8 @@ class LocaleResourcesGenerator extends Generator {
140
165
  parametersSequencerEntry = {
141
166
  parametersSequencerOrNull: null,
142
167
  parameterDescriptor,
168
+ parameterName,
169
+ baseParameterName,
143
170
  isUsed
144
171
  };
145
172
 
@@ -159,13 +186,7 @@ class LocaleResourcesGenerator extends Generator {
159
186
  /**
160
187
  * @inheritDoc
161
188
  */
162
- protected createProxyFunction(proxyFunctionDescriptor: ProxyFunctionDescriptor): void {
163
- const {
164
- namespace,
165
- functionName,
166
- methodDescriptor
167
- } = proxyFunctionDescriptor;
168
-
189
+ protected createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor): void {
169
190
  // Add any parameters that are not already known.
170
191
  for (const parameterDescriptor of methodDescriptor.parameterDescriptors) {
171
192
  this.#saveParameterSequence(parameterDescriptor, true);
@@ -173,6 +194,8 @@ class LocaleResourcesGenerator extends Generator {
173
194
 
174
195
  let functionsLocaleResources = this.#functionsLocaleResources;
175
196
 
197
+ const namespace = classDescriptor.namespace;
198
+
176
199
  if (namespace !== undefined) {
177
200
  if (!(namespace in functionsLocaleResources)) {
178
201
  const namespaceFunctionsLocaleResources: LocaleResources = {};
@@ -187,6 +210,8 @@ class LocaleResourcesGenerator extends Generator {
187
210
  }
188
211
  }
189
212
 
213
+ const functionName = methodDescriptor.functionName;
214
+
190
215
  if (functionName in functionsLocaleResources) {
191
216
  throw new Error(`Duplicate function ${functionName}`);
192
217
  }
@@ -1,14 +1,14 @@
1
1
  import { AI39_CREATOR, AI64_VALIDATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
2
2
  import type { AppExtension } from "../app-extension.js";
3
- import { expandParameterDescriptor, ProxyClass } from "../descriptor.js";
3
+ import { expandParameterDescriptor, proxy } from "../proxy.js";
4
4
  import type { ErrorExtends } from "../type.js";
5
- import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility/index.js";
6
5
  import {
7
6
  exclusionAllNumericParameterDescriptor,
8
7
  exclusionNoneParameterDescriptor
9
8
  } from "../utility/character-set-descriptor.js";
9
+ import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility/index.js";
10
10
 
11
- @ProxyClass({
11
+ @proxy.describeClass(false, {
12
12
  namespace: "GS1",
13
13
  methodInfix: "AI82",
14
14
  replaceParameterDescriptors: [
@@ -24,7 +24,7 @@ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
24
24
  }
25
25
  }
26
26
 
27
- @ProxyClass({
27
+ @proxy.describeClass(false, {
28
28
  namespace: "GS1",
29
29
  methodInfix: "AI39",
30
30
  replaceParameterDescriptors: [
@@ -40,7 +40,7 @@ export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
40
40
  }
41
41
  }
42
42
 
43
- @ProxyClass({
43
+ @proxy.describeClass(false, {
44
44
  namespace: "GS1",
45
45
  methodInfix: "AI64"
46
46
  })
@@ -6,8 +6,9 @@ import {
6
6
  isValidPriceOrWeightCheckDigit,
7
7
  priceOrWeightCheckDigit
8
8
  } from "@aidc-toolkit/gs1";
9
- import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor.js";
9
+ import { type ExtendsParameterDescriptor, type ParameterDescriptor, Types } from "../descriptor.js";
10
10
  import { LibProxy } from "../lib-proxy.js";
11
+ import { proxy } from "../proxy.js";
11
12
  import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "../type.js";
12
13
 
13
14
  const checkSParameterDescriptor: ParameterDescriptor = {
@@ -17,106 +18,98 @@ const checkSParameterDescriptor: ParameterDescriptor = {
17
18
  isRequired: true
18
19
  };
19
20
 
20
- const numericSParameterDescriptor: ParameterDescriptor = {
21
+ const numericSParameterDescriptor: ExtendsParameterDescriptor = {
21
22
  extendsDescriptor: checkSParameterDescriptor,
22
23
  name: "numericS"
23
24
  };
24
25
 
25
- const numericSFourOrFiveDigitsParameterDescriptor: ParameterDescriptor = {
26
+ const numericSFourOrFiveDigitsParameterDescriptor: ExtendsParameterDescriptor = {
26
27
  extendsDescriptor: numericSParameterDescriptor,
27
28
  sortOrder: 0,
28
29
  name: "numericSFourOrFiveDigits"
29
30
  };
30
31
 
31
- const numericSWithCheckDigitParameterDescriptor: ParameterDescriptor = {
32
+ const numericSWithCheckDigitParameterDescriptor: ExtendsParameterDescriptor = {
32
33
  extendsDescriptor: numericSParameterDescriptor,
33
34
  sortOrder: 1,
34
35
  name: "numericSWithCheckDigit"
35
36
  };
36
37
 
37
- const checkDigitParameterDescriptor: ParameterDescriptor = {
38
+ const checkDigitParameterDescriptor: ExtendsParameterDescriptor = {
38
39
  extendsDescriptor: numericSParameterDescriptor,
39
40
  sortOrder: 2,
40
41
  name: "checkDigit",
41
42
  isMatrix: false
42
43
  };
43
44
 
44
- const ai82SParameterDescriptor: ParameterDescriptor = {
45
+ const ai82SParameterDescriptor: ExtendsParameterDescriptor = {
45
46
  extendsDescriptor: checkSParameterDescriptor,
46
47
  name: "ai82S"
47
48
  };
48
49
 
49
- // eslint-disable-next-line no-useless-assignment -- ESLint bug.
50
- const ai82SWithCheckCharacterPairParameterDescriptor: ParameterDescriptor = {
50
+ const ai82SWithCheckCharacterPairParameterDescriptor: ExtendsParameterDescriptor = {
51
51
  extendsDescriptor: ai82SParameterDescriptor,
52
52
  name: "ai82SWithCheckCharacterPair"
53
53
  };
54
54
 
55
- @ProxyClass({
55
+ @proxy.describeClass(false, {
56
56
  namespace: "GS1"
57
57
  })
58
58
  export class CheckProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
59
- @ProxyMethod({
59
+ @proxy.describeMethod({
60
60
  type: Types.String,
61
- isMatrix: true
61
+ isMatrix: true,
62
+ parameterDescriptors: [numericSParameterDescriptor]
62
63
  })
63
- checkDigit(
64
- @ProxyParameter(numericSParameterDescriptor) matrixSs: Matrix<string>
65
- ): MatrixResultError<string, ThrowError, TError> {
64
+ checkDigit(matrixSs: Matrix<string>): MatrixResultError<string, ThrowError, TError> {
66
65
  return this.mapMatrix(matrixSs, s => checkDigit(s));
67
66
  }
68
67
 
69
- @ProxyMethod({
68
+ @proxy.describeMethod({
70
69
  type: Types.String,
71
- isMatrix: true
70
+ isMatrix: true,
71
+ parameterDescriptors: [numericSWithCheckDigitParameterDescriptor]
72
72
  })
73
- hasValidCheckDigit(
74
- @ProxyParameter(numericSWithCheckDigitParameterDescriptor) matrixSs: Matrix<string>
75
- ): MatrixResultError<boolean, ThrowError, TError> {
73
+ hasValidCheckDigit(matrixSs: Matrix<string>): MatrixResultError<boolean, ThrowError, TError> {
76
74
  return this.mapMatrix(matrixSs, s => hasValidCheckDigit(s));
77
75
  }
78
76
 
79
- @ProxyMethod({
77
+ @proxy.describeMethod({
80
78
  type: Types.String,
81
- isMatrix: true
79
+ isMatrix: true,
80
+ parameterDescriptors: [numericSFourOrFiveDigitsParameterDescriptor]
82
81
  })
83
- priceOrWeightCheckDigit(
84
- @ProxyParameter(numericSFourOrFiveDigitsParameterDescriptor) matrixSs: Matrix<string>
85
- ): MatrixResultError<string, ThrowError, TError> {
82
+ priceOrWeightCheckDigit(matrixSs: Matrix<string>): MatrixResultError<string, ThrowError, TError> {
86
83
  return this.mapMatrix(matrixSs, s => priceOrWeightCheckDigit(s));
87
84
  }
88
85
 
89
- @ProxyMethod({
86
+ @proxy.describeMethod({
90
87
  type: Types.String,
91
- isMatrix: false
92
- })
93
- isValidPriceOrWeightCheckDigit(
94
- @ProxyParameter({
88
+ isMatrix: false,
89
+ parameterDescriptors: [{
95
90
  ...numericSFourOrFiveDigitsParameterDescriptor,
96
91
  isMatrix: false
97
- }) s: string,
98
- @ProxyParameter(checkDigitParameterDescriptor) checkDigit: string
99
- ): ResultError<boolean, ThrowError, TError> {
92
+ }, checkDigitParameterDescriptor]
93
+ })
94
+ isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): ResultError<boolean, ThrowError, TError> {
100
95
  return isValidPriceOrWeightCheckDigit(s, checkDigit);
101
96
  }
102
97
 
103
- @ProxyMethod({
98
+ @proxy.describeMethod({
104
99
  type: Types.String,
105
- isMatrix: true
100
+ isMatrix: true,
101
+ parameterDescriptors: [ai82SParameterDescriptor]
106
102
  })
107
- checkCharacterPair(
108
- @ProxyParameter(ai82SParameterDescriptor) matrixSs: Matrix<string>
109
- ): MatrixResultError<string, ThrowError, TError> {
103
+ checkCharacterPair(matrixSs: Matrix<string>): MatrixResultError<string, ThrowError, TError> {
110
104
  return this.mapMatrix(matrixSs, s => checkCharacterPair(s));
111
105
  }
112
106
 
113
- @ProxyMethod({
107
+ @proxy.describeMethod({
114
108
  type: Types.String,
115
- isMatrix: true
109
+ isMatrix: true,
110
+ parameterDescriptors: [ai82SWithCheckCharacterPairParameterDescriptor]
116
111
  })
117
- hasValidCheckCharacterPair(
118
- @ProxyParameter(ai82SWithCheckCharacterPairParameterDescriptor) matrixSs: Matrix<string>
119
- ): MatrixResultError<boolean, ThrowError, TError> {
112
+ hasValidCheckCharacterPair(matrixSs: Matrix<string>): MatrixResultError<boolean, ThrowError, TError> {
120
113
  return this.mapMatrix(matrixSs, s => hasValidCheckCharacterPair(s));
121
114
  }
122
115
  }