@aidc-toolkit/app-extension 1.0.49 → 1.0.50-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.
- package/dist/app-extension-options.d.ts +52 -0
- package/dist/app-extension-options.d.ts.map +1 -0
- package/dist/app-extension-options.js +2 -0
- package/dist/app-extension-options.js.map +1 -0
- package/dist/app-extension.d.ts +194 -0
- package/dist/app-extension.d.ts.map +1 -0
- package/dist/app-extension.js +141 -0
- package/dist/app-extension.js.map +1 -0
- package/dist/app-helper-proxy.d.ts +57 -0
- package/dist/app-helper-proxy.d.ts.map +1 -0
- package/dist/app-helper-proxy.js +369 -0
- package/dist/app-helper-proxy.js.map +1 -0
- package/dist/{descriptor-D6tZH-vc.d.cts → descriptor.d.ts} +13 -13
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +44 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/generator/functions-generator.d.ts +103 -0
- package/dist/generator/functions-generator.d.ts.map +1 -0
- package/dist/generator/functions-generator.js +179 -0
- package/dist/generator/functions-generator.js.map +1 -0
- package/dist/generator/generator.d.ts +121 -0
- package/dist/generator/generator.d.ts.map +1 -0
- package/dist/generator/generator.js +186 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/index.d.ts +18 -239
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +3 -1
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/locale-resources-generator.d.ts +2 -0
- package/dist/generator/locale-resources-generator.d.ts.map +1 -0
- package/dist/generator/locale-resources-generator.js +333 -0
- package/dist/generator/locale-resources-generator.js.map +1 -0
- package/dist/gs1/character-set-proxy.d.ts +12 -0
- package/dist/gs1/character-set-proxy.d.ts.map +1 -0
- package/dist/gs1/character-set-proxy.js +126 -0
- package/dist/gs1/character-set-proxy.js.map +1 -0
- package/dist/gs1/check-proxy.d.ts +11 -0
- package/dist/gs1/check-proxy.d.ts.map +1 -0
- package/dist/gs1/check-proxy.js +163 -0
- package/dist/gs1/check-proxy.js.map +1 -0
- package/dist/gs1/gcp-length-proxy.d.ts +11 -0
- package/dist/gs1/gcp-length-proxy.d.ts.map +1 -0
- package/dist/gs1/gcp-length-proxy.js +187 -0
- package/dist/gs1/gcp-length-proxy.js.map +1 -0
- package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
- package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-creator-proxy.js +85 -0
- package/dist/gs1/gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/gtin-descriptor.d.ts +3 -0
- package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
- package/dist/gs1/gtin-descriptor.js +8 -0
- package/dist/gs1/gtin-descriptor.js.map +1 -0
- package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
- package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-validator-proxy.js +256 -0
- package/dist/gs1/gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
- package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-creator-proxy.js +318 -0
- package/dist/gs1/identifier-creator-proxy.js.map +1 -0
- package/dist/gs1/identifier-descriptor.d.ts +4 -0
- package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
- package/dist/gs1/identifier-descriptor.js +14 -0
- package/dist/gs1/identifier-descriptor.js.map +1 -0
- package/dist/gs1/identifier-type.d.ts +22 -0
- package/dist/gs1/identifier-type.d.ts.map +1 -0
- package/dist/gs1/identifier-type.js +34 -0
- package/dist/gs1/identifier-type.js.map +1 -0
- package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
- package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-validator-proxy.js +212 -0
- package/dist/gs1/identifier-validator-proxy.js.map +1 -0
- package/dist/gs1/index.d.ts +11 -185
- package/dist/gs1/index.d.ts.map +1 -0
- package/dist/gs1/index.js +11 -1
- package/dist/gs1/index.js.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts +37 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.js +301 -0
- package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts +36 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.js +302 -0
- package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.js +16 -0
- package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
- package/dist/gs1/prefix-manager-proxy.d.ts +8 -0
- package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
- package/dist/gs1/prefix-manager-proxy.js +94 -0
- package/dist/gs1/prefix-manager-proxy.js.map +1 -0
- package/dist/gs1/variable-measure-proxy.d.ts +7 -0
- package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
- package/dist/gs1/variable-measure-proxy.js +114 -0
- package/dist/gs1/variable-measure-proxy.js.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts +7 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.js +100 -0
- package/dist/gs1/verified-by-gs1-proxy.js.map +1 -0
- package/dist/index.d.ts +22 -862
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -0
- package/dist/lib-proxy.d.ts +121 -0
- package/dist/lib-proxy.d.ts.map +1 -0
- package/dist/lib-proxy.js +259 -0
- package/dist/lib-proxy.js.map +1 -0
- package/dist/{index.d.cts → locale/en/locale-resources.d.ts} +2 -113
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +754 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +755 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +754 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +36 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/proxy.d.ts +135 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +291 -0
- package/dist/proxy.js.map +1 -0
- package/dist/streaming.d.ts +10 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +2 -0
- package/dist/streaming.js.map +1 -0
- package/dist/type.d.ts +72 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/utility/character-set-descriptor.d.ts +6 -0
- package/dist/utility/character-set-descriptor.d.ts.map +1 -0
- package/dist/utility/character-set-descriptor.js +28 -0
- package/dist/utility/character-set-descriptor.js.map +1 -0
- package/dist/utility/character-set-proxy.d.ts +32 -0
- package/dist/utility/character-set-proxy.d.ts.map +1 -0
- package/dist/utility/character-set-proxy.js +278 -0
- package/dist/utility/character-set-proxy.js.map +1 -0
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.d.ts.map +1 -0
- package/dist/utility/index.js +4 -0
- package/dist/utility/index.js.map +1 -0
- package/dist/utility/reg-exp-proxy.d.ts +8 -0
- package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
- package/dist/utility/reg-exp-proxy.js +103 -0
- package/dist/utility/reg-exp-proxy.js.map +1 -0
- package/dist/utility/string-descriptor.d.ts +4 -0
- package/dist/utility/string-descriptor.d.ts.map +1 -0
- package/dist/utility/string-descriptor.js +12 -0
- package/dist/utility/string-descriptor.js.map +1 -0
- package/dist/utility/string-proxy.d.ts +7 -0
- package/dist/utility/string-proxy.d.ts.map +1 -0
- package/dist/utility/string-proxy.js +63 -0
- package/dist/utility/string-proxy.js.map +1 -0
- package/dist/utility/transformer-descriptor.d.ts +6 -0
- package/dist/utility/transformer-descriptor.d.ts.map +1 -0
- package/dist/utility/transformer-descriptor.js +24 -0
- package/dist/utility/transformer-descriptor.js.map +1 -0
- package/dist/utility/transformer-proxy.d.ts +10 -0
- package/dist/utility/transformer-proxy.d.ts.map +1 -0
- package/dist/utility/transformer-proxy.js +111 -0
- package/dist/utility/transformer-proxy.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +5 -5
- package/src/app-extension-options.ts +61 -0
- package/src/app-extension.ts +22 -32
- package/src/app-helper-proxy.ts +21 -33
- package/src/generator/functions-generator.ts +14 -45
- package/src/generator/generator.ts +28 -18
- package/src/generator/locale-resources-generator.ts +79 -52
- package/src/gs1/character-set-proxy.ts +6 -7
- package/src/gs1/check-proxy.ts +8 -8
- package/src/gs1/gcp-length-proxy.ts +8 -8
- package/src/gs1/gtin-creator-proxy.ts +4 -4
- package/src/gs1/gtin-validator-proxy.ts +12 -12
- package/src/gs1/identifier-creator-proxy.ts +14 -14
- package/src/gs1/identifier-validator-proxy.ts +10 -10
- package/src/gs1/non-gtin-creator-proxy.ts +22 -23
- package/src/gs1/non-gtin-validator-proxy.ts +22 -23
- package/src/gs1/prefix-manager-proxy.ts +2 -2
- package/src/gs1/variable-measure-proxy.ts +4 -4
- package/src/gs1/verified-by-gs1-proxy.ts +5 -11
- package/src/index.ts +1 -0
- package/src/lib-proxy.ts +27 -43
- package/src/locale/en/locale-resources.ts +1 -1
- package/src/proxy.ts +12 -15
- package/src/streaming.ts +3 -3
- package/src/type.ts +3 -22
- package/src/utility/character-set-proxy.ts +17 -16
- package/src/utility/reg-exp-proxy.ts +2 -2
- package/src/utility/string-proxy.ts +2 -2
- package/src/utility/transformer-proxy.ts +6 -5
- package/src/version.ts +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/character-set-proxy-BOW94WCe.d.cts +0 -473
- package/dist/character-set-proxy-BOW94WCe.d.ts +0 -473
- package/dist/chunk-22IRLVWO.js +0 -1
- package/dist/chunk-MR63TJ3B.js +0 -1
- package/dist/chunk-TWX7TPRC.js +0 -1
- package/dist/descriptor-D6tZH-vc.d.ts +0 -185
- package/dist/generator/index.cjs +0 -17
- package/dist/generator/index.d.cts +0 -240
- package/dist/gs1/index.cjs +0 -1
- package/dist/gs1/index.d.cts +0 -185
- package/dist/index.cjs +0 -17
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
*
|
|
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 #
|
|
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
|
-
|
|
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 --
|
|
219
|
-
return localizationCallback(locale, i18nextAppExtension.t(key
|
|
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
|
|
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
|
-
|
|
277
|
-
|
|
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.#
|
|
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.#
|
|
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
|
-
*
|
|
73
|
+
* Template parameters locale resources.
|
|
74
74
|
*/
|
|
75
|
-
readonly #
|
|
75
|
+
readonly #templateParametersLocaleResources: LocaleResources = {};
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Template functions locale resources.
|
|
79
79
|
*/
|
|
80
|
-
readonly #
|
|
80
|
+
readonly #templateFunctionsLocaleResources: LocaleResources = {};
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Template locale resources.
|
|
84
84
|
*/
|
|
85
|
-
readonly #
|
|
86
|
-
Parameters: this.#
|
|
87
|
-
Functions: this.#
|
|
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.#
|
|
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
|
|
237
|
+
* Merge template locale resources into existing import locale resources.
|
|
238
|
+
*
|
|
239
|
+
* @param mergedLocaleResources
|
|
240
|
+
* Merged locale resources.
|
|
238
241
|
*
|
|
239
|
-
* @param
|
|
240
|
-
* If true,
|
|
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
|
|
246
|
-
*
|
|
248
|
+
* @param templateLocaleResources
|
|
249
|
+
* Template locale resources.
|
|
247
250
|
*
|
|
248
|
-
* @param
|
|
249
|
-
*
|
|
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
|
-
*
|
|
258
|
+
* True if any changes.
|
|
256
259
|
*/
|
|
257
|
-
#merge(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
277
|
-
if (!(key in
|
|
294
|
+
for (const [key, templateValue] of Object.entries(templateLocaleResources)) {
|
|
295
|
+
if (!(key in importLocaleResources)) {
|
|
278
296
|
if (addMissing) {
|
|
279
|
-
if (
|
|
297
|
+
if (isDefaultLocale) {
|
|
280
298
|
this.logger.info(`Adding ${parentKey}${key}...`);
|
|
281
299
|
}
|
|
282
300
|
|
|
283
|
-
|
|
301
|
+
patchMergedLocaleResources[key] = templateValue;
|
|
302
|
+
|
|
303
|
+
anyChanges = true;
|
|
284
304
|
}
|
|
285
305
|
} else {
|
|
286
|
-
const
|
|
306
|
+
const importValue = importLocaleResources[key];
|
|
287
307
|
|
|
288
|
-
if (typeof
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
|
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.#
|
|
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} ${
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
22
|
-
constructor(appExtension: AppExtension
|
|
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
|
|
38
|
-
constructor(appExtension: AppExtension
|
|
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
|
|
48
|
-
constructor(appExtension: AppExtension
|
|
46
|
+
export class AI64Proxy extends CharacterSetValidatorProxy {
|
|
47
|
+
constructor(appExtension: AppExtension) {
|
|
49
48
|
super(appExtension, AI64_VALIDATOR);
|
|
50
49
|
}
|
|
51
50
|
}
|
package/src/gs1/check-proxy.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
103
|
+
export class GCPLengthProxy extends LibProxy {
|
|
104
104
|
readonly #gcpLength: GCPLength;
|
|
105
105
|
|
|
106
|
-
constructor(appExtension: AppExtension
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
25
|
-
constructor(appExtension: AppExtension
|
|
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
|
|
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(() =>
|
|
@@ -4,7 +4,7 @@ import type { AppExtension } from "../app-extension.js";
|
|
|
4
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
|
-
import type {
|
|
7
|
+
import type { Matrix, MatrixResult } from "../type.js";
|
|
8
8
|
import { indicatorDigitParameterDescriptor } from "./gtin-descriptor.js";
|
|
9
9
|
import { identifierParameterDescriptor } from "./identifier-descriptor.js";
|
|
10
10
|
import { GTINValidatorProxy } from "./identifier-validator-proxy.js";
|
|
@@ -12,8 +12,8 @@ import { GTINValidatorProxy } from "./identifier-validator-proxy.js";
|
|
|
12
12
|
@proxy.describeClass(false, {
|
|
13
13
|
methodInfix: "GTIN13"
|
|
14
14
|
})
|
|
15
|
-
export class GTIN13ValidatorProxy
|
|
16
|
-
constructor(appExtension: AppExtension
|
|
15
|
+
export class GTIN13ValidatorProxy extends GTINValidatorProxy {
|
|
16
|
+
constructor(appExtension: AppExtension) {
|
|
17
17
|
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN13]);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -21,8 +21,8 @@ export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends Err
|
|
|
21
21
|
@proxy.describeClass(false, {
|
|
22
22
|
methodInfix: "GTIN12"
|
|
23
23
|
})
|
|
24
|
-
export class GTIN12ValidatorProxy
|
|
25
|
-
constructor(appExtension: AppExtension
|
|
24
|
+
export class GTIN12ValidatorProxy extends GTINValidatorProxy {
|
|
25
|
+
constructor(appExtension: AppExtension) {
|
|
26
26
|
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN12]);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -30,8 +30,8 @@ export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends Err
|
|
|
30
30
|
@proxy.describeClass(false, {
|
|
31
31
|
methodInfix: "GTIN8"
|
|
32
32
|
})
|
|
33
|
-
export class GTIN8ValidatorProxy
|
|
34
|
-
constructor(appExtension: AppExtension
|
|
33
|
+
export class GTIN8ValidatorProxy extends GTINValidatorProxy {
|
|
34
|
+
constructor(appExtension: AppExtension) {
|
|
35
35
|
super(appExtension, IdentifierValidators.GTIN[GTINLengths.GTIN8]);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -77,13 +77,13 @@ const validateGTIN14ParameterDescriptor: ExtendsParameterDescriptor = {
|
|
|
77
77
|
namespace: "GS1",
|
|
78
78
|
category: "identifierValidation"
|
|
79
79
|
})
|
|
80
|
-
export class GTINValidatorStaticProxy
|
|
80
|
+
export class GTINValidatorStaticProxy extends LibProxy {
|
|
81
81
|
@proxy.describeMethod({
|
|
82
82
|
type: Types.String,
|
|
83
83
|
multiplicity: Multiplicities.Matrix,
|
|
84
84
|
parameterDescriptors: [zeroSuppressibleGTIN12ParameterDescriptor]
|
|
85
85
|
})
|
|
86
|
-
zeroSuppressGTIN12(matrixGTIN12s: Matrix<string>): MatrixResult<string
|
|
86
|
+
zeroSuppressGTIN12(matrixGTIN12s: Matrix<string>): MatrixResult<string> {
|
|
87
87
|
return this.matrixResult(matrixGTIN12s, gtin12 => GTINValidator.zeroSuppress(gtin12));
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
|
|
|
92
92
|
multiplicity: Multiplicities.Matrix,
|
|
93
93
|
parameterDescriptors: [zeroSuppressedGTIN12ParameterDescriptor]
|
|
94
94
|
})
|
|
95
|
-
zeroExpandGTIN12(matrixZeroSuppressedGTIN12s: Matrix<string>): MatrixResult<string
|
|
95
|
+
zeroExpandGTIN12(matrixZeroSuppressedGTIN12s: Matrix<string>): MatrixResult<string> {
|
|
96
96
|
return this.matrixResult(matrixZeroSuppressedGTIN12s, zeroSuppressedGTIN12 => GTINValidator.zeroExpand(zeroSuppressedGTIN12));
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -101,7 +101,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
|
|
|
101
101
|
multiplicity: Multiplicities.Matrix,
|
|
102
102
|
parameterDescriptors: [indicatorDigitParameterDescriptor, convertGTINParameterDescriptor]
|
|
103
103
|
})
|
|
104
|
-
convertToGTIN14(indicatorDigit: string, matrixGTINs: Matrix<string>): MatrixResult<string
|
|
104
|
+
convertToGTIN14(indicatorDigit: string, matrixGTINs: Matrix<string>): MatrixResult<string> {
|
|
105
105
|
return this.matrixResult(matrixGTINs, gtin => GTINValidator.convertToGTIN14(indicatorDigit, gtin));
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -110,7 +110,7 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
|
|
|
110
110
|
multiplicity: Multiplicities.Matrix,
|
|
111
111
|
parameterDescriptors: [normalizeGTINParameterDescriptor]
|
|
112
112
|
})
|
|
113
|
-
normalizeGTIN(matrixGTINs: Matrix<string>): MatrixResult<string
|
|
113
|
+
normalizeGTIN(matrixGTINs: Matrix<string>): MatrixResult<string> {
|
|
114
114
|
return this.matrixResult(matrixGTINs, gtin => GTINValidator.normalize(gtin));
|
|
115
115
|
}
|
|
116
116
|
|