@aidc-toolkit/app-extension 0.9.19-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 (112) hide show
  1. package/LICENSE +174 -0
  2. package/README.md +17 -0
  3. package/app-extension.iml +9 -0
  4. package/dist/app-extension.d.ts +169 -0
  5. package/dist/app-extension.d.ts.map +1 -0
  6. package/dist/app-extension.js +148 -0
  7. package/dist/app-extension.js.map +1 -0
  8. package/dist/app-utility-proxy.d.ts +66 -0
  9. package/dist/app-utility-proxy.d.ts.map +1 -0
  10. package/dist/app-utility-proxy.js +233 -0
  11. package/dist/app-utility-proxy.js.map +1 -0
  12. package/dist/descriptor.d.ts +168 -0
  13. package/dist/descriptor.d.ts.map +1 -0
  14. package/dist/descriptor.js +175 -0
  15. package/dist/descriptor.js.map +1 -0
  16. package/dist/gs1/character-set-proxy.d.ts +10 -0
  17. package/dist/gs1/character-set-proxy.d.ts.map +1 -0
  18. package/dist/gs1/character-set-proxy.js +47 -0
  19. package/dist/gs1/character-set-proxy.js.map +1 -0
  20. package/dist/gs1/check-proxy.d.ts +11 -0
  21. package/dist/gs1/check-proxy.d.ts.map +1 -0
  22. package/dist/gs1/check-proxy.js +120 -0
  23. package/dist/gs1/check-proxy.js.map +1 -0
  24. package/dist/gs1/idkey-proxy.d.ts +135 -0
  25. package/dist/gs1/idkey-proxy.d.ts.map +1 -0
  26. package/dist/gs1/idkey-proxy.js +779 -0
  27. package/dist/gs1/idkey-proxy.js.map +1 -0
  28. package/dist/gs1/index.d.ts +4 -0
  29. package/dist/gs1/index.d.ts.map +1 -0
  30. package/dist/gs1/index.js +4 -0
  31. package/dist/gs1/index.js.map +1 -0
  32. package/dist/index.d.ts +25 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +25 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/lib-proxy.d.ts +135 -0
  37. package/dist/lib-proxy.d.ts.map +1 -0
  38. package/dist/lib-proxy.js +235 -0
  39. package/dist/lib-proxy.js.map +1 -0
  40. package/dist/locale/en/locale-strings.d.ts +616 -0
  41. package/dist/locale/en/locale-strings.d.ts.map +1 -0
  42. package/dist/locale/en/locale-strings.js +616 -0
  43. package/dist/locale/en/locale-strings.js.map +1 -0
  44. package/dist/locale/fr/locale-strings.d.ts +616 -0
  45. package/dist/locale/fr/locale-strings.d.ts.map +1 -0
  46. package/dist/locale/fr/locale-strings.js +616 -0
  47. package/dist/locale/fr/locale-strings.js.map +1 -0
  48. package/dist/locale/i18n.d.ts +27 -0
  49. package/dist/locale/i18n.d.ts.map +1 -0
  50. package/dist/locale/i18n.js +39 -0
  51. package/dist/locale/i18n.js.map +1 -0
  52. package/dist/types.d.ts +127 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +13 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utility/character-set-descriptor.d.ts +6 -0
  57. package/dist/utility/character-set-descriptor.d.ts.map +1 -0
  58. package/dist/utility/character-set-descriptor.js +28 -0
  59. package/dist/utility/character-set-descriptor.js.map +1 -0
  60. package/dist/utility/character-set-proxy.d.ts +26 -0
  61. package/dist/utility/character-set-proxy.d.ts.map +1 -0
  62. package/dist/utility/character-set-proxy.js +167 -0
  63. package/dist/utility/character-set-proxy.js.map +1 -0
  64. package/dist/utility/index.d.ts +4 -0
  65. package/dist/utility/index.d.ts.map +1 -0
  66. package/dist/utility/index.js +4 -0
  67. package/dist/utility/index.js.map +1 -0
  68. package/dist/utility/reg-exp-proxy.d.ts +7 -0
  69. package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
  70. package/dist/utility/reg-exp-proxy.js +61 -0
  71. package/dist/utility/reg-exp-proxy.js.map +1 -0
  72. package/dist/utility/string-descriptor.d.ts +4 -0
  73. package/dist/utility/string-descriptor.d.ts.map +1 -0
  74. package/dist/utility/string-descriptor.js +12 -0
  75. package/dist/utility/string-descriptor.js.map +1 -0
  76. package/dist/utility/string-proxy.d.ts +8 -0
  77. package/dist/utility/string-proxy.d.ts.map +1 -0
  78. package/dist/utility/string-proxy.js +12 -0
  79. package/dist/utility/string-proxy.js.map +1 -0
  80. package/dist/utility/transformer-descriptor.d.ts +6 -0
  81. package/dist/utility/transformer-descriptor.d.ts.map +1 -0
  82. package/dist/utility/transformer-descriptor.js +24 -0
  83. package/dist/utility/transformer-descriptor.js.map +1 -0
  84. package/dist/utility/transformer-proxy.d.ts +8 -0
  85. package/dist/utility/transformer-proxy.d.ts.map +1 -0
  86. package/dist/utility/transformer-proxy.js +74 -0
  87. package/dist/utility/transformer-proxy.js.map +1 -0
  88. package/eslint.config.ts +21 -0
  89. package/package.json +37 -0
  90. package/src/app-extension.ts +244 -0
  91. package/src/app-utility-proxy.ts +266 -0
  92. package/src/descriptor.ts +314 -0
  93. package/src/gs1/character-set-proxy.ts +41 -0
  94. package/src/gs1/check-proxy.ts +122 -0
  95. package/src/gs1/idkey-proxy.ts +815 -0
  96. package/src/gs1/index.ts +3 -0
  97. package/src/index.ts +24 -0
  98. package/src/lib-proxy.ts +256 -0
  99. package/src/locale/en/locale-strings.ts +615 -0
  100. package/src/locale/fr/locale-strings.ts +615 -0
  101. package/src/locale/i18n.ts +48 -0
  102. package/src/locale/i18next.d.ts +20 -0
  103. package/src/types.ts +144 -0
  104. package/src/utility/character-set-descriptor.ts +32 -0
  105. package/src/utility/character-set-proxy.ts +185 -0
  106. package/src/utility/index.ts +3 -0
  107. package/src/utility/reg-exp-proxy.ts +51 -0
  108. package/src/utility/string-descriptor.ts +13 -0
  109. package/src/utility/string-proxy.ts +15 -0
  110. package/src/utility/transformer-descriptor.ts +27 -0
  111. package/src/utility/transformer-proxy.ts +72 -0
  112. package/tsconfig.json +6 -0
@@ -0,0 +1,779 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { CPID_VALIDATOR, GCN_VALIDATOR, GDTI_VALIDATOR, GIAI_VALIDATOR, GINC_VALIDATOR, GLN_VALIDATOR, GMN_VALIDATOR, GRAI_VALIDATOR, GSIN_VALIDATOR, GSRN_VALIDATOR, GTIN12_VALIDATOR, GTIN13_VALIDATOR, GTIN8_VALIDATOR, GTINCreator, GTINValidator, PrefixManager, PrefixType, SSCC_VALIDATOR } from "@aidc-toolkit/gs1";
11
+ import { Sequence } from "@aidc-toolkit/utility";
12
+ import { expandParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Type } from "../descriptor.js";
13
+ import { LibProxy } from "../lib-proxy.js";
14
+ import { i18nextAppExtension } from "../locale/i18n.js";
15
+ import { isNullish } from "../types.js";
16
+ import { exclusionAllNumericParameterDescriptor } from "../utility/character-set-descriptor.js";
17
+ import { StringProxy } from "../utility/string-proxy.js";
18
+ import { countParameterDescriptor, startValueParameterDescriptor, valueParameterDescriptor } from "../utility/transformer-descriptor.js";
19
+ const identificationKeyParameterDescriptor = {
20
+ name: "identificationKey",
21
+ type: Type.String,
22
+ isMatrix: true,
23
+ isRequired: true
24
+ };
25
+ const validateIdentificationKeyParameterDescriptor = {
26
+ extendsDescriptor: identificationKeyParameterDescriptor,
27
+ sortOrder: 0,
28
+ name: "validateIdentificationKey"
29
+ };
30
+ class IdentificationKeyValidatorProxy extends StringProxy {
31
+ _validator;
32
+ constructor(appExtension, validator) {
33
+ super(appExtension);
34
+ this._validator = validator;
35
+ }
36
+ get validator() {
37
+ return this._validator;
38
+ }
39
+ }
40
+ class NumericIdentificationKeyValidatorProxy extends IdentificationKeyValidatorProxy {
41
+ validate(matrixIdentificationKeys) {
42
+ return this.validateString(this.validator, matrixIdentificationKeys);
43
+ }
44
+ }
45
+ __decorate([
46
+ ProxyMethod({
47
+ type: Type.String,
48
+ isMatrix: true
49
+ }),
50
+ __param(0, ProxyParameter(validateIdentificationKeyParameterDescriptor))
51
+ ], NumericIdentificationKeyValidatorProxy.prototype, "validate", null);
52
+ class GTINValidatorProxy extends NumericIdentificationKeyValidatorProxy {
53
+ }
54
+ class NonGTINNumericIdentificationKeyValidatorProxy extends NumericIdentificationKeyValidatorProxy {
55
+ }
56
+ class SerializableNumericIdentificationKeyValidatorProxy extends NonGTINNumericIdentificationKeyValidatorProxy {
57
+ }
58
+ class NonNumericIdentificationKeyValidatorProxy extends IdentificationKeyValidatorProxy {
59
+ validate(matrixIdentificationKeys, exclusion) {
60
+ return this.validateString(this.validator, matrixIdentificationKeys, {
61
+ exclusion: exclusion ?? undefined
62
+ });
63
+ }
64
+ }
65
+ __decorate([
66
+ ProxyMethod({
67
+ type: Type.String,
68
+ isMatrix: true
69
+ }),
70
+ __param(0, ProxyParameter(validateIdentificationKeyParameterDescriptor)),
71
+ __param(1, ProxyParameter(exclusionAllNumericParameterDescriptor))
72
+ ], NonNumericIdentificationKeyValidatorProxy.prototype, "validate", null);
73
+ let GTIN13ValidatorProxy = class GTIN13ValidatorProxy extends GTINValidatorProxy {
74
+ constructor(appExtension) {
75
+ super(appExtension, GTIN13_VALIDATOR);
76
+ }
77
+ };
78
+ GTIN13ValidatorProxy = __decorate([
79
+ ProxyClass({
80
+ namespace: "GS1",
81
+ methodInfix: "GTIN13"
82
+ })
83
+ ], GTIN13ValidatorProxy);
84
+ export { GTIN13ValidatorProxy };
85
+ let GTIN12ValidatorProxy = class GTIN12ValidatorProxy extends GTINValidatorProxy {
86
+ constructor(appExtension) {
87
+ super(appExtension, GTIN12_VALIDATOR);
88
+ }
89
+ };
90
+ GTIN12ValidatorProxy = __decorate([
91
+ ProxyClass({
92
+ namespace: "GS1",
93
+ methodInfix: "GTIN12"
94
+ })
95
+ ], GTIN12ValidatorProxy);
96
+ export { GTIN12ValidatorProxy };
97
+ let GTIN8ValidatorProxy = class GTIN8ValidatorProxy extends GTINValidatorProxy {
98
+ constructor(appExtension) {
99
+ super(appExtension, GTIN8_VALIDATOR);
100
+ }
101
+ };
102
+ GTIN8ValidatorProxy = __decorate([
103
+ ProxyClass({
104
+ namespace: "GS1",
105
+ methodInfix: "GTIN8"
106
+ })
107
+ ], GTIN8ValidatorProxy);
108
+ export { GTIN8ValidatorProxy };
109
+ const zeroSuppressibleGTIN12ParameterDescriptor = {
110
+ extendsDescriptor: identificationKeyParameterDescriptor,
111
+ name: "zeroSuppressibleGTIN12"
112
+ };
113
+ const zeroSuppressedGTIN12ParameterDescriptor = {
114
+ extendsDescriptor: identificationKeyParameterDescriptor,
115
+ name: "zeroSuppressedGTIN12"
116
+ };
117
+ const indicatorDigitParameterDescriptor = {
118
+ name: "indicatorDigit",
119
+ type: Type.String,
120
+ isMatrix: false,
121
+ isRequired: true
122
+ };
123
+ const convertGTINParameterDescriptor = {
124
+ extendsDescriptor: identificationKeyParameterDescriptor,
125
+ name: "convertGTIN"
126
+ };
127
+ const normalizeGTINParameterDescriptor = {
128
+ extendsDescriptor: identificationKeyParameterDescriptor,
129
+ name: "normalizeGTIN"
130
+ };
131
+ const validateGTINParameterDescriptor = {
132
+ extendsDescriptor: identificationKeyParameterDescriptor,
133
+ name: "validateGTIN"
134
+ };
135
+ const gtinLevelParameterDescriptor = {
136
+ name: "gtinLevel",
137
+ type: Type.Number,
138
+ isMatrix: false,
139
+ isRequired: false
140
+ };
141
+ const validateGTIN14ParameterDescriptor = {
142
+ extendsDescriptor: identificationKeyParameterDescriptor,
143
+ name: "validateGTIN14"
144
+ };
145
+ const rcnFormatParameterDescriptor = {
146
+ name: "rcnFormat",
147
+ type: Type.String,
148
+ isMatrix: false,
149
+ isRequired: true
150
+ };
151
+ const rcnParameterDescriptor = {
152
+ name: "rcn",
153
+ type: Type.String,
154
+ isMatrix: true,
155
+ isRequired: true
156
+ };
157
+ const rcnItemReferenceParameterDescriptor = {
158
+ name: "rcnItemReference",
159
+ type: Type.Number,
160
+ isMatrix: false,
161
+ isRequired: true
162
+ };
163
+ const rcnPriceOrWeightParameterDescriptor = {
164
+ name: "rcnPriceOrWeight",
165
+ type: Type.Number,
166
+ isMatrix: true,
167
+ isRequired: true
168
+ };
169
+ let GTINValidatorStaticProxy = class GTINValidatorStaticProxy extends LibProxy {
170
+ zeroSuppressGTIN12(matrixGTIN12s) {
171
+ return this.mapMatrix(matrixGTIN12s, gtin12 => GTINValidator.zeroSuppress(gtin12));
172
+ }
173
+ zeroExpandGTIN12(matrixZeroSuppressedGTIN12s) {
174
+ return this.mapMatrix(matrixZeroSuppressedGTIN12s, zeroSuppressedGTIN12 => GTINValidator.zeroExpand(zeroSuppressedGTIN12));
175
+ }
176
+ convertToGTIN14(indicatorDigit, matrixGTINs) {
177
+ return this.mapMatrix(matrixGTINs, gtin => GTINValidator.convertToGTIN14(indicatorDigit, gtin));
178
+ }
179
+ normalizeGTIN(matrixGTINs) {
180
+ return this.mapMatrix(matrixGTINs, gtin => GTINValidator.normalize(gtin));
181
+ }
182
+ validateGTIN(matrixGTINs, gtinLevel) {
183
+ const gtinLevelOrUndefined = gtinLevel ?? undefined;
184
+ return LibProxy.mapMatrixRangeError(matrixGTINs, (gtin) => {
185
+ GTINValidator.validateAny(gtin, gtinLevelOrUndefined);
186
+ });
187
+ }
188
+ validateGTIN14(matrixGTIN14s) {
189
+ return LibProxy.mapMatrixRangeError(matrixGTIN14s, (gtin14) => {
190
+ GTINValidator.validateGTIN14(gtin14);
191
+ });
192
+ }
193
+ parseVariableMeasureRCN(format, matrixRCNs) {
194
+ return this.mapArray(matrixRCNs, (rcn) => {
195
+ const rcnReference = GTINValidator.parseVariableMeasureRCN(format, rcn);
196
+ return [rcnReference.itemReference, rcnReference.priceOrWeight];
197
+ });
198
+ }
199
+ };
200
+ __decorate([
201
+ ProxyMethod({
202
+ type: Type.String,
203
+ isMatrix: true
204
+ }),
205
+ __param(0, ProxyParameter(zeroSuppressibleGTIN12ParameterDescriptor))
206
+ ], GTINValidatorStaticProxy.prototype, "zeroSuppressGTIN12", null);
207
+ __decorate([
208
+ ProxyMethod({
209
+ type: Type.String,
210
+ isMatrix: true
211
+ }),
212
+ __param(0, ProxyParameter(zeroSuppressedGTIN12ParameterDescriptor))
213
+ ], GTINValidatorStaticProxy.prototype, "zeroExpandGTIN12", null);
214
+ __decorate([
215
+ ProxyMethod({
216
+ type: Type.String,
217
+ isMatrix: true
218
+ }),
219
+ __param(0, ProxyParameter(indicatorDigitParameterDescriptor)),
220
+ __param(1, ProxyParameter(convertGTINParameterDescriptor))
221
+ ], GTINValidatorStaticProxy.prototype, "convertToGTIN14", null);
222
+ __decorate([
223
+ ProxyMethod({
224
+ type: Type.String,
225
+ isMatrix: true
226
+ }),
227
+ __param(0, ProxyParameter(normalizeGTINParameterDescriptor))
228
+ ], GTINValidatorStaticProxy.prototype, "normalizeGTIN", null);
229
+ __decorate([
230
+ ProxyMethod({
231
+ type: Type.String,
232
+ isMatrix: true
233
+ }),
234
+ __param(0, ProxyParameter(validateGTINParameterDescriptor)),
235
+ __param(1, ProxyParameter(gtinLevelParameterDescriptor))
236
+ ], GTINValidatorStaticProxy.prototype, "validateGTIN", null);
237
+ __decorate([
238
+ ProxyMethod({
239
+ type: Type.String,
240
+ isMatrix: true
241
+ }),
242
+ __param(0, ProxyParameter(validateGTIN14ParameterDescriptor))
243
+ ], GTINValidatorStaticProxy.prototype, "validateGTIN14", null);
244
+ __decorate([
245
+ ProxyMethod({
246
+ type: Type.Number,
247
+ isMatrix: true
248
+ }),
249
+ __param(0, ProxyParameter(rcnFormatParameterDescriptor)),
250
+ __param(1, ProxyParameter(rcnParameterDescriptor))
251
+ ], GTINValidatorStaticProxy.prototype, "parseVariableMeasureRCN", null);
252
+ GTINValidatorStaticProxy = __decorate([
253
+ ProxyClass({
254
+ namespace: "GS1"
255
+ })
256
+ ], GTINValidatorStaticProxy);
257
+ export { GTINValidatorStaticProxy };
258
+ let GLNValidatorProxy = class GLNValidatorProxy extends NonGTINNumericIdentificationKeyValidatorProxy {
259
+ constructor(appExtension) {
260
+ super(appExtension, GLN_VALIDATOR);
261
+ }
262
+ };
263
+ GLNValidatorProxy = __decorate([
264
+ ProxyClass({
265
+ namespace: "GS1",
266
+ methodInfix: "GLN"
267
+ })
268
+ ], GLNValidatorProxy);
269
+ export { GLNValidatorProxy };
270
+ let SSCCValidatorProxy = class SSCCValidatorProxy extends NonGTINNumericIdentificationKeyValidatorProxy {
271
+ constructor(appExtension) {
272
+ super(appExtension, SSCC_VALIDATOR);
273
+ }
274
+ };
275
+ SSCCValidatorProxy = __decorate([
276
+ ProxyClass({
277
+ namespace: "GS1",
278
+ methodInfix: "SSCC"
279
+ })
280
+ ], SSCCValidatorProxy);
281
+ export { SSCCValidatorProxy };
282
+ let GRAIValidatorProxy = class GRAIValidatorProxy extends SerializableNumericIdentificationKeyValidatorProxy {
283
+ constructor(appExtension) {
284
+ super(appExtension, GRAI_VALIDATOR);
285
+ }
286
+ };
287
+ GRAIValidatorProxy = __decorate([
288
+ ProxyClass({
289
+ namespace: "GS1",
290
+ methodInfix: "GRAI"
291
+ })
292
+ ], GRAIValidatorProxy);
293
+ export { GRAIValidatorProxy };
294
+ let GIAIValidatorProxy = class GIAIValidatorProxy extends NonNumericIdentificationKeyValidatorProxy {
295
+ constructor(appExtension) {
296
+ super(appExtension, GIAI_VALIDATOR);
297
+ }
298
+ };
299
+ GIAIValidatorProxy = __decorate([
300
+ ProxyClass({
301
+ namespace: "GS1",
302
+ methodInfix: "GIAI"
303
+ })
304
+ ], GIAIValidatorProxy);
305
+ export { GIAIValidatorProxy };
306
+ let GSRNValidatorProxy = class GSRNValidatorProxy extends NonGTINNumericIdentificationKeyValidatorProxy {
307
+ constructor(appExtension) {
308
+ super(appExtension, GSRN_VALIDATOR);
309
+ }
310
+ };
311
+ GSRNValidatorProxy = __decorate([
312
+ ProxyClass({
313
+ namespace: "GS1",
314
+ methodInfix: "GSRN"
315
+ })
316
+ ], GSRNValidatorProxy);
317
+ export { GSRNValidatorProxy };
318
+ let GDTIValidatorProxy = class GDTIValidatorProxy extends SerializableNumericIdentificationKeyValidatorProxy {
319
+ constructor(appExtension) {
320
+ super(appExtension, GDTI_VALIDATOR);
321
+ }
322
+ };
323
+ GDTIValidatorProxy = __decorate([
324
+ ProxyClass({
325
+ namespace: "GS1",
326
+ methodInfix: "GDTI"
327
+ })
328
+ ], GDTIValidatorProxy);
329
+ export { GDTIValidatorProxy };
330
+ let GINCValidatorProxy = class GINCValidatorProxy extends NonNumericIdentificationKeyValidatorProxy {
331
+ constructor(appExtension) {
332
+ super(appExtension, GINC_VALIDATOR);
333
+ }
334
+ };
335
+ GINCValidatorProxy = __decorate([
336
+ ProxyClass({
337
+ namespace: "GS1",
338
+ methodInfix: "GINC"
339
+ })
340
+ ], GINCValidatorProxy);
341
+ export { GINCValidatorProxy };
342
+ let GSINValidatorProxy = class GSINValidatorProxy extends NonGTINNumericIdentificationKeyValidatorProxy {
343
+ constructor(appExtension) {
344
+ super(appExtension, GSIN_VALIDATOR);
345
+ }
346
+ };
347
+ GSINValidatorProxy = __decorate([
348
+ ProxyClass({
349
+ namespace: "GS1",
350
+ methodInfix: "GSIN"
351
+ })
352
+ ], GSINValidatorProxy);
353
+ export { GSINValidatorProxy };
354
+ let GCNValidatorProxy = class GCNValidatorProxy extends SerializableNumericIdentificationKeyValidatorProxy {
355
+ constructor(appExtension) {
356
+ super(appExtension, GCN_VALIDATOR);
357
+ }
358
+ };
359
+ GCNValidatorProxy = __decorate([
360
+ ProxyClass({
361
+ namespace: "GS1",
362
+ methodInfix: "GCN"
363
+ })
364
+ ], GCNValidatorProxy);
365
+ export { GCNValidatorProxy };
366
+ let CPIDValidatorProxy = class CPIDValidatorProxy extends NonNumericIdentificationKeyValidatorProxy {
367
+ constructor(appExtension) {
368
+ super(appExtension, CPID_VALIDATOR);
369
+ }
370
+ };
371
+ CPIDValidatorProxy = __decorate([
372
+ ProxyClass({
373
+ namespace: "GS1",
374
+ methodInfix: "CPID"
375
+ })
376
+ ], CPIDValidatorProxy);
377
+ export { CPIDValidatorProxy };
378
+ let GMNValidatorProxy = class GMNValidatorProxy extends NonNumericIdentificationKeyValidatorProxy {
379
+ constructor(appExtension) {
380
+ super(appExtension, GMN_VALIDATOR);
381
+ }
382
+ };
383
+ GMNValidatorProxy = __decorate([
384
+ ProxyClass({
385
+ namespace: "GS1",
386
+ methodInfix: "GMN"
387
+ })
388
+ ], GMNValidatorProxy);
389
+ export { GMNValidatorProxy };
390
+ const prefixParameterDescriptor = {
391
+ name: "prefix",
392
+ type: Type.String,
393
+ isMatrix: false,
394
+ isRequired: true
395
+ };
396
+ const prefixTypeParameterDescriptor = {
397
+ name: "prefixType",
398
+ type: Type.Number,
399
+ isMatrix: false,
400
+ isRequired: false
401
+ };
402
+ const tweakFactorParameterDescriptor = {
403
+ name: "tweakFactor",
404
+ type: Type.Number,
405
+ isMatrix: false,
406
+ isRequired: false
407
+ };
408
+ const prefixDefinitionParameterDescriptor = {
409
+ name: "prefixDefinition",
410
+ type: Type.Any,
411
+ isMatrix: true,
412
+ isRequired: true
413
+ };
414
+ const prefixDefinitionGS1UPCParameterDescriptor = {
415
+ extendsDescriptor: prefixDefinitionParameterDescriptor,
416
+ name: "prefixDefinitionGS1UPC"
417
+ };
418
+ const prefixDefinitionAnyParameterDescriptor = {
419
+ extendsDescriptor: prefixDefinitionParameterDescriptor,
420
+ name: "prefixDefinitionAny"
421
+ };
422
+ let PrefixManagerProxy = class PrefixManagerProxy extends LibProxy {
423
+ definePrefix(prefix, prefixType, tweakFactor) {
424
+ // Parameters will be validated by IdentificationKeyCreatorProxy.getCreator().
425
+ return [[prefix, prefixType, tweakFactor]];
426
+ }
427
+ };
428
+ __decorate([
429
+ ProxyMethod({
430
+ type: Type.Any,
431
+ isMatrix: true
432
+ }),
433
+ __param(0, ProxyParameter(prefixParameterDescriptor)),
434
+ __param(1, ProxyParameter(prefixTypeParameterDescriptor)),
435
+ __param(2, ProxyParameter(tweakFactorParameterDescriptor))
436
+ ], PrefixManagerProxy.prototype, "definePrefix", null);
437
+ PrefixManagerProxy = __decorate([
438
+ ProxyClass({
439
+ namespace: "GS1"
440
+ })
441
+ ], PrefixManagerProxy);
442
+ export { PrefixManagerProxy };
443
+ class IdentificationKeyCreatorProxy extends LibProxy {
444
+ _getCreator;
445
+ constructor(appExtension, getCreator) {
446
+ super(appExtension);
447
+ this._getCreator = getCreator;
448
+ }
449
+ getCreator(prefixDefinition) {
450
+ const reducedPrefixDefinition = prefixDefinition.length === 1 ?
451
+ // Prefix definition is horizontal.
452
+ prefixDefinition[0] :
453
+ // Prefix definition is vertical.
454
+ prefixDefinition.map((prefixDefinitionRow) => {
455
+ if (prefixDefinitionRow.length !== 1) {
456
+ throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixDefinitionMustBeOneDimensional"));
457
+ }
458
+ return prefixDefinitionRow[0];
459
+ });
460
+ if (reducedPrefixDefinition.length > 3) {
461
+ throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixDefinitionMustHaveMaximumThreeElements"));
462
+ }
463
+ const prefix = reducedPrefixDefinition[0];
464
+ if (typeof prefix !== "string") {
465
+ throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixMustBeString"));
466
+ }
467
+ const prefixType = reducedPrefixDefinition[1] ?? PrefixType.GS1CompanyPrefix;
468
+ if (typeof prefixType !== "number") {
469
+ throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixTypeMustBeNumber"));
470
+ }
471
+ const prefixManager = PrefixManager.get(prefixType, prefix);
472
+ const tweakFactor = reducedPrefixDefinition[2];
473
+ if (!isNullish(tweakFactor)) {
474
+ if (typeof tweakFactor !== "number") {
475
+ throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.tweakFactorMustBeNumber"));
476
+ }
477
+ prefixManager.tweakFactor = tweakFactor;
478
+ }
479
+ else {
480
+ prefixManager.resetTweakFactor();
481
+ }
482
+ return this._getCreator(prefixManager);
483
+ }
484
+ }
485
+ const sparseParameterDescriptor = {
486
+ name: "sparse",
487
+ type: Type.Boolean,
488
+ isMatrix: false,
489
+ isRequired: false
490
+ };
491
+ class NumericIdentificationKeyCreatorProxy extends IdentificationKeyCreatorProxy {
492
+ create(prefixDefinition, matrixValues, sparse) {
493
+ const creator = this.getCreator(prefixDefinition);
494
+ const sparseOrUndefined = sparse ?? undefined;
495
+ return this.mapMatrix(matrixValues, value => creator.create(value, sparseOrUndefined));
496
+ }
497
+ createSequence(prefixDefinition, startValue, count, sparse) {
498
+ this.appExtension.validateSequenceCount(count);
499
+ return LibProxy.matrixResult(this.getCreator(prefixDefinition).create(new Sequence(startValue, count), sparse ?? undefined));
500
+ }
501
+ createAll(prefixDefinition) {
502
+ const creator = this.getCreator(prefixDefinition);
503
+ this.appExtension.validateSequenceCount(creator.capacity);
504
+ return LibProxy.matrixResult(creator.createAll());
505
+ }
506
+ }
507
+ __decorate([
508
+ ProxyMethod({
509
+ type: Type.String,
510
+ isMatrix: true
511
+ }),
512
+ __param(0, ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor)),
513
+ __param(1, ProxyParameter(valueParameterDescriptor)),
514
+ __param(2, ProxyParameter(sparseParameterDescriptor))
515
+ ], NumericIdentificationKeyCreatorProxy.prototype, "create", null);
516
+ __decorate([
517
+ ProxyMethod({
518
+ infixBefore: "Sequence",
519
+ type: Type.String,
520
+ isMatrix: true
521
+ }),
522
+ __param(0, ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor)),
523
+ __param(1, ProxyParameter(startValueParameterDescriptor)),
524
+ __param(2, ProxyParameter(countParameterDescriptor)),
525
+ __param(3, ProxyParameter(sparseParameterDescriptor))
526
+ ], NumericIdentificationKeyCreatorProxy.prototype, "createSequence", null);
527
+ __decorate([
528
+ ProxyMethod({
529
+ type: Type.String,
530
+ isMatrix: true
531
+ }),
532
+ __param(0, ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor))
533
+ ], NumericIdentificationKeyCreatorProxy.prototype, "createAll", null);
534
+ class NonGTINNumericIdentificationKeyCreatorProxy extends NumericIdentificationKeyCreatorProxy {
535
+ }
536
+ const singleValueParameterDescriptor = {
537
+ extendsDescriptor: valueParameterDescriptor,
538
+ isMatrix: false
539
+ };
540
+ const baseIdentificationKeyParameterDescriptor = {
541
+ extendsDescriptor: identificationKeyParameterDescriptor,
542
+ name: "baseIdentificationKey",
543
+ isMatrix: false
544
+ };
545
+ const serialComponentParameterDescriptor = {
546
+ name: "serialComponent",
547
+ type: Type.String,
548
+ isMatrix: true,
549
+ isRequired: true
550
+ };
551
+ class SerializableNumericIdentificationKeyCreatorProxy extends NonGTINNumericIdentificationKeyCreatorProxy {
552
+ createSerialized(prefixDefinition, value, matrixSerialComponents, sparse) {
553
+ const creator = this.getCreator(prefixDefinition);
554
+ const sparseOrUndefined = sparse ?? undefined;
555
+ return this.mapMatrix(matrixSerialComponents, serialComponent => creator.createSerialized(value, serialComponent, sparseOrUndefined));
556
+ }
557
+ concatenate(baseIdentificationKey, matrixSerialComponents) {
558
+ const creator = this.getCreator([[baseIdentificationKey.substring(0, !baseIdentificationKey.startsWith("0") ? PrefixManager.GS1_COMPANY_PREFIX_MINIMUM_LENGTH : PrefixManager.UPC_COMPANY_PREFIX_MINIMUM_LENGTH + 1), PrefixType.GS1CompanyPrefix]]);
559
+ return this.mapMatrix(matrixSerialComponents, serialComponent => creator.concatenate(baseIdentificationKey, serialComponent));
560
+ }
561
+ }
562
+ __decorate([
563
+ ProxyMethod({
564
+ type: Type.String,
565
+ isMatrix: true
566
+ }),
567
+ __param(0, ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor)),
568
+ __param(1, ProxyParameter(singleValueParameterDescriptor)),
569
+ __param(2, ProxyParameter(serialComponentParameterDescriptor)),
570
+ __param(3, ProxyParameter(sparseParameterDescriptor))
571
+ ], SerializableNumericIdentificationKeyCreatorProxy.prototype, "createSerialized", null);
572
+ __decorate([
573
+ ProxyMethod({
574
+ type: Type.String,
575
+ isMatrix: true
576
+ }),
577
+ __param(0, ProxyParameter(baseIdentificationKeyParameterDescriptor)),
578
+ __param(1, ProxyParameter(serialComponentParameterDescriptor))
579
+ ], SerializableNumericIdentificationKeyCreatorProxy.prototype, "concatenate", null);
580
+ const referenceParameterDescriptor = {
581
+ name: "reference",
582
+ type: Type.String,
583
+ isMatrix: true,
584
+ isRequired: true
585
+ };
586
+ class NonNumericIdentificationKeyCreatorProxy extends IdentificationKeyCreatorProxy {
587
+ create(prefixDefinition, matrixReferences) {
588
+ const creator = this.getCreator(prefixDefinition);
589
+ return this.mapMatrix(matrixReferences, reference => creator.create(reference));
590
+ }
591
+ }
592
+ __decorate([
593
+ ProxyMethod({
594
+ type: Type.String,
595
+ isMatrix: true
596
+ }),
597
+ __param(0, ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor)),
598
+ __param(1, ProxyParameter(referenceParameterDescriptor))
599
+ ], NonNumericIdentificationKeyCreatorProxy.prototype, "create", null);
600
+ let GTINCreatorProxy = class GTINCreatorProxy extends NumericIdentificationKeyCreatorProxy {
601
+ constructor(appExtension) {
602
+ super(appExtension, prefixManager => prefixManager.gtinCreator);
603
+ }
604
+ createGTIN14(indicatorDigit, prefixDefinition, matrixValues, sparse) {
605
+ const creator = this.getCreator(prefixDefinition);
606
+ const sparseOrUndefined = sparse ?? undefined;
607
+ return this.mapMatrix(matrixValues, value => creator.createGTIN14(indicatorDigit, value, sparseOrUndefined));
608
+ }
609
+ createVariableMeasureRCN(format, itemReference, matrixPricesOrWeights) {
610
+ return this.mapMatrix(matrixPricesOrWeights, priceOrWeight => GTINCreator.createVariableMeasureRCN(format, itemReference, priceOrWeight));
611
+ }
612
+ };
613
+ __decorate([
614
+ ProxyMethod({
615
+ type: Type.String,
616
+ isMatrix: true,
617
+ ignoreInfix: true
618
+ }),
619
+ __param(0, ProxyParameter(indicatorDigitParameterDescriptor)),
620
+ __param(1, ProxyParameter(prefixDefinitionAnyParameterDescriptor)),
621
+ __param(2, ProxyParameter(valueParameterDescriptor)),
622
+ __param(3, ProxyParameter(sparseParameterDescriptor))
623
+ ], GTINCreatorProxy.prototype, "createGTIN14", null);
624
+ __decorate([
625
+ ProxyMethod({
626
+ type: Type.String,
627
+ isMatrix: true,
628
+ ignoreInfix: true
629
+ }),
630
+ __param(0, ProxyParameter(rcnFormatParameterDescriptor)),
631
+ __param(1, ProxyParameter(rcnItemReferenceParameterDescriptor)),
632
+ __param(2, ProxyParameter(rcnPriceOrWeightParameterDescriptor))
633
+ ], GTINCreatorProxy.prototype, "createVariableMeasureRCN", null);
634
+ GTINCreatorProxy = __decorate([
635
+ ProxyClass({
636
+ namespace: "GS1",
637
+ methodInfix: "GTIN",
638
+ replaceParameterDescriptors: [
639
+ {
640
+ name: expandParameterDescriptor(prefixDefinitionGS1UPCParameterDescriptor).name,
641
+ replacement: prefixDefinitionAnyParameterDescriptor
642
+ }
643
+ ]
644
+ })
645
+ ], GTINCreatorProxy);
646
+ export { GTINCreatorProxy };
647
+ let GLNCreatorProxy = class GLNCreatorProxy extends NonGTINNumericIdentificationKeyCreatorProxy {
648
+ constructor(appExtension) {
649
+ super(appExtension, prefixManager => prefixManager.glnCreator);
650
+ }
651
+ };
652
+ GLNCreatorProxy = __decorate([
653
+ ProxyClass({
654
+ namespace: "GS1",
655
+ methodInfix: "GLN"
656
+ })
657
+ ], GLNCreatorProxy);
658
+ export { GLNCreatorProxy };
659
+ let SSCCCreatorProxy = class SSCCCreatorProxy extends NonGTINNumericIdentificationKeyCreatorProxy {
660
+ constructor(appExtension) {
661
+ super(appExtension, prefixManager => prefixManager.ssccCreator);
662
+ }
663
+ };
664
+ SSCCCreatorProxy = __decorate([
665
+ ProxyClass({
666
+ namespace: "GS1",
667
+ methodInfix: "SSCC"
668
+ })
669
+ ], SSCCCreatorProxy);
670
+ export { SSCCCreatorProxy };
671
+ let GRAICreatorProxy = class GRAICreatorProxy extends SerializableNumericIdentificationKeyCreatorProxy {
672
+ constructor(appExtension) {
673
+ super(appExtension, prefixManager => prefixManager.graiCreator);
674
+ }
675
+ };
676
+ GRAICreatorProxy = __decorate([
677
+ ProxyClass({
678
+ namespace: "GS1",
679
+ methodInfix: "GRAI"
680
+ })
681
+ ], GRAICreatorProxy);
682
+ export { GRAICreatorProxy };
683
+ let GIAICreatorProxy = class GIAICreatorProxy extends NonNumericIdentificationKeyCreatorProxy {
684
+ constructor(appExtension) {
685
+ super(appExtension, prefixManager => prefixManager.giaiCreator);
686
+ }
687
+ };
688
+ GIAICreatorProxy = __decorate([
689
+ ProxyClass({
690
+ namespace: "GS1",
691
+ methodInfix: "GIAI"
692
+ })
693
+ ], GIAICreatorProxy);
694
+ export { GIAICreatorProxy };
695
+ let GSRNCreatorProxy = class GSRNCreatorProxy extends NonGTINNumericIdentificationKeyCreatorProxy {
696
+ constructor(appExtension) {
697
+ super(appExtension, prefixManager => prefixManager.gsrnCreator);
698
+ }
699
+ };
700
+ GSRNCreatorProxy = __decorate([
701
+ ProxyClass({
702
+ namespace: "GS1",
703
+ methodInfix: "GSRN"
704
+ })
705
+ ], GSRNCreatorProxy);
706
+ export { GSRNCreatorProxy };
707
+ let GDTICreatorProxy = class GDTICreatorProxy extends SerializableNumericIdentificationKeyCreatorProxy {
708
+ constructor(appExtension) {
709
+ super(appExtension, prefixManager => prefixManager.gdtiCreator);
710
+ }
711
+ };
712
+ GDTICreatorProxy = __decorate([
713
+ ProxyClass({
714
+ namespace: "GS1",
715
+ methodInfix: "GDTI"
716
+ })
717
+ ], GDTICreatorProxy);
718
+ export { GDTICreatorProxy };
719
+ let GINCCreatorProxy = class GINCCreatorProxy extends NonNumericIdentificationKeyCreatorProxy {
720
+ constructor(appExtension) {
721
+ super(appExtension, prefixManager => prefixManager.gincCreator);
722
+ }
723
+ };
724
+ GINCCreatorProxy = __decorate([
725
+ ProxyClass({
726
+ namespace: "GS1",
727
+ methodInfix: "GINC"
728
+ })
729
+ ], GINCCreatorProxy);
730
+ export { GINCCreatorProxy };
731
+ let GSINCreatorProxy = class GSINCreatorProxy extends NonGTINNumericIdentificationKeyCreatorProxy {
732
+ constructor(appExtension) {
733
+ super(appExtension, prefixManager => prefixManager.gsinCreator);
734
+ }
735
+ };
736
+ GSINCreatorProxy = __decorate([
737
+ ProxyClass({
738
+ namespace: "GS1",
739
+ methodInfix: "GSIN"
740
+ })
741
+ ], GSINCreatorProxy);
742
+ export { GSINCreatorProxy };
743
+ let GCNCreatorProxy = class GCNCreatorProxy extends SerializableNumericIdentificationKeyCreatorProxy {
744
+ constructor(appExtension) {
745
+ super(appExtension, prefixManager => prefixManager.gcnCreator);
746
+ }
747
+ };
748
+ GCNCreatorProxy = __decorate([
749
+ ProxyClass({
750
+ namespace: "GS1",
751
+ methodInfix: "GCN"
752
+ })
753
+ ], GCNCreatorProxy);
754
+ export { GCNCreatorProxy };
755
+ let CPIDCreatorProxy = class CPIDCreatorProxy extends NonNumericIdentificationKeyCreatorProxy {
756
+ constructor(appExtension) {
757
+ super(appExtension, prefixManager => prefixManager.cpidCreator);
758
+ }
759
+ };
760
+ CPIDCreatorProxy = __decorate([
761
+ ProxyClass({
762
+ namespace: "GS1",
763
+ methodInfix: "CPID"
764
+ })
765
+ ], CPIDCreatorProxy);
766
+ export { CPIDCreatorProxy };
767
+ let GMNCreatorProxy = class GMNCreatorProxy extends NonNumericIdentificationKeyCreatorProxy {
768
+ constructor(appExtension) {
769
+ super(appExtension, prefixManager => prefixManager.gmnCreator);
770
+ }
771
+ };
772
+ GMNCreatorProxy = __decorate([
773
+ ProxyClass({
774
+ namespace: "GS1",
775
+ methodInfix: "GMN"
776
+ })
777
+ ], GMNCreatorProxy);
778
+ export { GMNCreatorProxy };
779
+ //# sourceMappingURL=idkey-proxy.js.map