@aidc-toolkit/gs1 1.0.24-beta → 1.0.25-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/index.cjs +562 -373
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +776 -415
- package/dist/index.d.ts +776 -415
- package/dist/index.js +549 -363
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/abstract-identifier-creator.ts +97 -0
- package/src/abstract-identifier-validator.ts +140 -0
- package/src/abstract-numeric-identifier-creator.ts +168 -0
- package/src/abstract-numeric-identifier-validator.ts +69 -0
- package/src/character-set.ts +10 -10
- package/src/check.ts +7 -7
- package/src/content-character-set.ts +29 -0
- package/src/creators.ts +113 -0
- package/src/descriptors.ts +332 -0
- package/src/gtin-creator.ts +7 -6
- package/src/gtin-descriptor.ts +18 -0
- package/src/gtin-type.ts +50 -0
- package/src/gtin-validator.ts +36 -60
- package/src/identifier-creator.ts +11 -75
- package/src/identifier-descriptor.ts +30 -0
- package/src/identifier-type.ts +6 -1
- package/src/identifier-validator.ts +12 -188
- package/src/index.ts +29 -5
- package/src/locale/en/locale-resources.ts +0 -1
- package/src/locale/fr/locale-resources.ts +0 -1
- package/src/non-gtin-numeric-identifier-creator.ts +5 -11
- package/src/non-gtin-numeric-identifier-descriptor.ts +24 -0
- package/src/non-gtin-numeric-identifier-type.ts +7 -0
- package/src/non-gtin-numeric-identifier-validator.ts +8 -42
- package/src/non-numeric-identifier-creator.ts +5 -15
- package/src/non-numeric-identifier-descriptor.ts +29 -0
- package/src/non-numeric-identifier-type.ts +7 -0
- package/src/non-numeric-identifier-validator.ts +15 -53
- package/src/numeric-identifier-creator.ts +20 -163
- package/src/numeric-identifier-descriptor.ts +23 -0
- package/src/numeric-identifier-type.ts +44 -0
- package/src/numeric-identifier-validator.ts +13 -116
- package/src/prefix-manager.ts +84 -142
- package/src/prefix-provider.ts +2 -2
- package/src/prefix-type.ts +6 -1
- package/src/prefix-validator.ts +141 -79
- package/src/serializable-numeric-identifier-creator.ts +4 -14
- package/src/serializable-numeric-identifier-descriptor.ts +29 -0
- package/src/serializable-numeric-identifier-type.ts +9 -0
- package/src/serializable-numeric-identifier-validator.ts +17 -45
- package/src/validators.ts +203 -0
- package/test/creator.test.ts +2 -4
- package/test/gtin-creator.ts +5 -1
- package/test/gtin-validator.test.ts +5 -8
- package/test/identifier-creator.ts +1 -0
- package/test/identifier-validator.ts +2 -2
- package/test/non-gtin-numeric-identifier-creator.ts +8 -92
- package/test/non-gtin-numeric-identifier-validator.ts +1 -1
- package/test/non-numeric-identifier-creator.ts +93 -0
- package/test/numeric-identifier-creator.ts +9 -3
- package/test/numeric-identifier-validator.ts +3 -7
- package/test/serializable-numeric-identifier-creator.ts +10 -2
- package/test/validator.test.ts +59 -35
package/dist/index.d.cts
CHANGED
|
@@ -35,7 +35,6 @@ declare const _default: {
|
|
|
35
35
|
readonly gs1CompanyPrefix: "GS1 Company Prefix";
|
|
36
36
|
readonly upcCompanyPrefix: "U.P.C. Company Prefix";
|
|
37
37
|
readonly gs18Prefix: "GS1-8 Prefix";
|
|
38
|
-
readonly invalidPrefixType: "Invalid prefix type";
|
|
39
38
|
readonly gs1CompanyPrefixCantStartWith0: "GS1 Company Prefix can't start with \"0\"";
|
|
40
39
|
readonly gs1CompanyPrefixCantStartWith00000: "GS1 Company Prefix can't start with \"00000\"";
|
|
41
40
|
readonly gs1CompanyPrefixCantStartWith000000: "GS1 Company Prefix can't start with \"000000\"";
|
|
@@ -70,34 +69,34 @@ declare const i18nextGS1: i18n;
|
|
|
70
69
|
declare function i18nGS1Init(environment: I18nEnvironment, debug?: boolean): Promise<void>;
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
|
-
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link
|
|
74
|
-
* General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
72
|
+
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link
|
|
73
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
75
74
|
*/
|
|
76
75
|
declare const AI82_CREATOR: CharacterSetCreator;
|
|
77
76
|
/**
|
|
78
|
-
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link
|
|
79
|
-
* GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
77
|
+
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link
|
|
78
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
80
79
|
*/
|
|
81
80
|
declare const AI82_VALIDATOR: CharacterSetValidator;
|
|
82
81
|
/**
|
|
83
|
-
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link
|
|
84
|
-
* General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
82
|
+
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link
|
|
83
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
85
84
|
*/
|
|
86
85
|
declare const AI39_CREATOR: CharacterSetCreator;
|
|
87
86
|
/**
|
|
88
|
-
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link
|
|
89
|
-
* GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
87
|
+
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link
|
|
88
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
90
89
|
*/
|
|
91
90
|
declare const AI39_VALIDATOR: CharacterSetValidator;
|
|
92
91
|
/**
|
|
93
|
-
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
|
|
94
|
-
* GS1 General Specifications}. Doesn't support any exclusions.
|
|
92
|
+
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
|
|
93
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Doesn't support any exclusions.
|
|
95
94
|
*/
|
|
96
95
|
declare const AI64_VALIDATOR: CharacterSetValidator;
|
|
97
96
|
|
|
98
97
|
/**
|
|
99
|
-
* Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link
|
|
100
|
-
* GS1 General Specifications}.
|
|
98
|
+
* Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link
|
|
99
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
101
100
|
*
|
|
102
101
|
* @param exchangeWeights
|
|
103
102
|
* If true, start the weights at 1 instead of 3 on the right.
|
|
@@ -110,8 +109,8 @@ declare const AI64_VALIDATOR: CharacterSetValidator;
|
|
|
110
109
|
*/
|
|
111
110
|
declare function checkDigitSum(exchangeWeights: boolean, s: string): number;
|
|
112
111
|
/**
|
|
113
|
-
* Calculate the check digit for a numeric string as per section 7.9.1 of the {@link
|
|
114
|
-
* General Specifications}.
|
|
112
|
+
* Calculate the check digit for a numeric string as per section 7.9.1 of the {@link
|
|
113
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
115
114
|
*
|
|
116
115
|
* @param s
|
|
117
116
|
* Numeric string.
|
|
@@ -131,8 +130,8 @@ declare function checkDigit(s: string): string;
|
|
|
131
130
|
*/
|
|
132
131
|
declare function hasValidCheckDigit(s: string): boolean;
|
|
133
132
|
/**
|
|
134
|
-
* Calculate the price or weight check digit for a four-or five-digit numeric string as per
|
|
135
|
-
* https://
|
|
133
|
+
* Calculate the price or weight check digit for a four-or five-digit numeric string as per sections 7.9.2-7.9.4 of the
|
|
134
|
+
* {@link https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
136
135
|
*
|
|
137
136
|
* @param s
|
|
138
137
|
* Numeric string exactly four or five characters long.
|
|
@@ -156,7 +155,7 @@ declare function priceOrWeightCheckDigit(s: string): string;
|
|
|
156
155
|
declare function isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): boolean;
|
|
157
156
|
/**
|
|
158
157
|
* Calculate the check character for a GS1 AI encodable character set 82 string as per section 7.9.5 of the {@link
|
|
159
|
-
* https://
|
|
158
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
160
159
|
*
|
|
161
160
|
* @param s
|
|
162
161
|
* GS1 AI encodable character set 82 string.
|
|
@@ -193,10 +192,40 @@ declare const PrefixTypes: {
|
|
|
193
192
|
*/
|
|
194
193
|
readonly GS18Prefix: "GS1-8 Prefix";
|
|
195
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* Prefix type key.
|
|
197
|
+
*/
|
|
198
|
+
type PrefixTypeKey = keyof typeof PrefixTypes;
|
|
196
199
|
/**
|
|
197
200
|
* Prefix type.
|
|
198
201
|
*/
|
|
199
|
-
type PrefixType = typeof PrefixTypes[
|
|
202
|
+
type PrefixType = typeof PrefixTypes[PrefixTypeKey];
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Prefix provider.
|
|
206
|
+
*/
|
|
207
|
+
interface PrefixProvider {
|
|
208
|
+
/**
|
|
209
|
+
* Prefix type.
|
|
210
|
+
*/
|
|
211
|
+
readonly prefixType: PrefixType;
|
|
212
|
+
/**
|
|
213
|
+
* Prefix appropriate to the prefix type.
|
|
214
|
+
*/
|
|
215
|
+
readonly prefix: string;
|
|
216
|
+
/**
|
|
217
|
+
* Prefix as GS1 Company Prefix.
|
|
218
|
+
*/
|
|
219
|
+
readonly gs1CompanyPrefix: string;
|
|
220
|
+
/**
|
|
221
|
+
* Prefix as U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix} or undefined if not.
|
|
222
|
+
*/
|
|
223
|
+
readonly upcCompanyPrefix: string | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Prefix as GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix} or undefined if not.
|
|
226
|
+
*/
|
|
227
|
+
readonly gs18Prefix: string | undefined;
|
|
228
|
+
}
|
|
200
229
|
|
|
201
230
|
/**
|
|
202
231
|
* Prefix validation parameters.
|
|
@@ -215,31 +244,6 @@ interface PrefixValidation extends CharacterSetValidation {
|
|
|
215
244
|
*/
|
|
216
245
|
component: () => string;
|
|
217
246
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Validate a prefix.
|
|
220
|
-
*
|
|
221
|
-
* @param prefixType
|
|
222
|
-
* Prefix type.
|
|
223
|
-
*
|
|
224
|
-
* @param allowUPCCompanyPrefix
|
|
225
|
-
* If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
|
|
226
|
-
*
|
|
227
|
-
* @param allowGS18Prefix
|
|
228
|
-
* If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
|
|
229
|
-
*
|
|
230
|
-
* @param prefix
|
|
231
|
-
* Prefix.
|
|
232
|
-
*
|
|
233
|
-
* @param isFromIdentifier
|
|
234
|
-
* If true, the prefix is from an identifier and should be trimmed before its character set is validated.
|
|
235
|
-
*
|
|
236
|
-
* @param isNumericIdentifier
|
|
237
|
-
* If true, the prefix is from a numeric identifier and its character set will be validated by the caller.
|
|
238
|
-
*
|
|
239
|
-
* @param positionOffset
|
|
240
|
-
* Position offset within a larger string.
|
|
241
|
-
*/
|
|
242
|
-
declare function validate(prefixType: PrefixType, allowUPCCompanyPrefix: boolean, allowGS18Prefix: boolean, prefix: string, isFromIdentifier?: boolean, isNumericIdentifier?: boolean, positionOffset?: number): void;
|
|
243
247
|
/**
|
|
244
248
|
* Prefix validator.
|
|
245
249
|
*/
|
|
@@ -250,8 +254,71 @@ declare const PrefixValidator: {
|
|
|
250
254
|
readonly UPC_COMPANY_PREFIX_MAXIMUM_LENGTH: 11;
|
|
251
255
|
readonly GS1_8_PREFIX_MINIMUM_LENGTH: 2;
|
|
252
256
|
readonly GS1_8_PREFIX_MAXIMUM_LENGTH: 7;
|
|
253
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Validate a prefix.
|
|
259
|
+
*
|
|
260
|
+
* @param prefixType
|
|
261
|
+
* Prefix type.
|
|
262
|
+
*
|
|
263
|
+
* @param allowUPCCompanyPrefix
|
|
264
|
+
* If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
|
|
265
|
+
*
|
|
266
|
+
* @param allowGS18Prefix
|
|
267
|
+
* If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
|
|
268
|
+
*
|
|
269
|
+
* @param prefix
|
|
270
|
+
* Prefix.
|
|
271
|
+
*
|
|
272
|
+
* @param isFromIdentifier
|
|
273
|
+
* If true, the prefix is from an identifier and should be trimmed before its character set is validated.
|
|
274
|
+
*
|
|
275
|
+
* @param isNumericIdentifier
|
|
276
|
+
* If true, the prefix is from a numeric identifier and its character set will be validated by the caller.
|
|
277
|
+
*
|
|
278
|
+
* @param positionOffset
|
|
279
|
+
* Position offset within a larger string.
|
|
280
|
+
*/
|
|
281
|
+
readonly validate: (prefixType: PrefixType, allowUPCCompanyPrefix: boolean, allowGS18Prefix: boolean, prefix: string, isFromIdentifier?: boolean, isNumericIdentifier?: boolean, positionOffset?: number) => void;
|
|
282
|
+
/**
|
|
283
|
+
* Normalize a prefix.
|
|
284
|
+
*
|
|
285
|
+
* @param prefixType
|
|
286
|
+
* Prefix type.
|
|
287
|
+
*
|
|
288
|
+
* @param prefix
|
|
289
|
+
* Prefix.
|
|
290
|
+
*
|
|
291
|
+
* @returns
|
|
292
|
+
* Prefix provider with normalized prefix type and prefix.
|
|
293
|
+
*/
|
|
294
|
+
readonly normalize: (prefixType: PrefixType, prefix: string) => PrefixProvider;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
|
299
|
+
*/
|
|
300
|
+
declare const ContentCharacterSets: {
|
|
301
|
+
/**
|
|
302
|
+
* Numeric.
|
|
303
|
+
*/
|
|
304
|
+
readonly Numeric: "Numeric";
|
|
305
|
+
/**
|
|
306
|
+
* GS1 AI encodable character set 82.
|
|
307
|
+
*/
|
|
308
|
+
readonly AI82: "AI82";
|
|
309
|
+
/**
|
|
310
|
+
* GS1 AI encodable character set 39.
|
|
311
|
+
*/
|
|
312
|
+
readonly AI39: "AI39";
|
|
254
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* Content character set key.
|
|
316
|
+
*/
|
|
317
|
+
type ContentCharacterSetKey = keyof typeof ContentCharacterSets;
|
|
318
|
+
/**
|
|
319
|
+
* Content character set.
|
|
320
|
+
*/
|
|
321
|
+
type ContentCharacterSet = typeof ContentCharacterSets[ContentCharacterSetKey];
|
|
255
322
|
|
|
256
323
|
/**
|
|
257
324
|
* Identifier types.
|
|
@@ -306,60 +373,327 @@ declare const IdentifierTypes: {
|
|
|
306
373
|
*/
|
|
307
374
|
readonly GMN: "GMN";
|
|
308
375
|
};
|
|
376
|
+
/**
|
|
377
|
+
* Identifier type key.
|
|
378
|
+
*/
|
|
379
|
+
type IdentifierTypeKey = keyof typeof IdentifierTypes;
|
|
309
380
|
/**
|
|
310
381
|
* Identifier type.
|
|
311
382
|
*/
|
|
312
|
-
type IdentifierType = typeof IdentifierTypes[
|
|
383
|
+
type IdentifierType = typeof IdentifierTypes[IdentifierTypeKey];
|
|
313
384
|
|
|
314
385
|
/**
|
|
315
|
-
*
|
|
386
|
+
* Numeric identifier type.
|
|
316
387
|
*/
|
|
317
|
-
|
|
388
|
+
type NumericIdentifierType = typeof IdentifierTypes.GTIN | typeof IdentifierTypes.GLN | typeof IdentifierTypes.SSCC | typeof IdentifierTypes.GRAI | typeof IdentifierTypes.GSRN | typeof IdentifierTypes.GDTI | typeof IdentifierTypes.GSIN | typeof IdentifierTypes.GCN;
|
|
389
|
+
/**
|
|
390
|
+
* Leader type.
|
|
391
|
+
*/
|
|
392
|
+
declare const LeaderTypes: {
|
|
318
393
|
/**
|
|
319
|
-
*
|
|
394
|
+
* No leader.
|
|
320
395
|
*/
|
|
321
|
-
readonly
|
|
396
|
+
readonly None: "None";
|
|
322
397
|
/**
|
|
323
|
-
*
|
|
398
|
+
* Indicator digit (GTIN only).
|
|
324
399
|
*/
|
|
325
|
-
readonly
|
|
400
|
+
readonly IndicatorDigit: "Indicator digit";
|
|
326
401
|
/**
|
|
327
|
-
*
|
|
402
|
+
* Extension digit (SSCC only).
|
|
328
403
|
*/
|
|
329
|
-
readonly
|
|
404
|
+
readonly ExtensionDigit: "Extension digit";
|
|
330
405
|
};
|
|
331
406
|
/**
|
|
332
|
-
*
|
|
407
|
+
* Leader type key.
|
|
333
408
|
*/
|
|
334
|
-
type
|
|
409
|
+
type LeaderTypeKey = keyof typeof LeaderTypes;
|
|
335
410
|
/**
|
|
336
|
-
*
|
|
411
|
+
* Leader type.
|
|
337
412
|
*/
|
|
338
|
-
|
|
413
|
+
type LeaderType = typeof LeaderTypes[LeaderTypeKey];
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* GTIN types. The numeric values are equal to the lengths of the GTIN types.
|
|
417
|
+
*/
|
|
418
|
+
declare const GTINTypes: {
|
|
339
419
|
/**
|
|
340
|
-
*
|
|
341
|
-
* ensures that the error notes the proper position in the string.
|
|
420
|
+
* GTIN-13.
|
|
342
421
|
*/
|
|
343
|
-
|
|
422
|
+
readonly GTIN13: 13;
|
|
423
|
+
/**
|
|
424
|
+
* GTIN-12.
|
|
425
|
+
*/
|
|
426
|
+
readonly GTIN12: 12;
|
|
427
|
+
/**
|
|
428
|
+
* GTIN-8.
|
|
429
|
+
*/
|
|
430
|
+
readonly GTIN8: 8;
|
|
431
|
+
/**
|
|
432
|
+
* GTIN-14.
|
|
433
|
+
*/
|
|
434
|
+
readonly GTIN14: 14;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* GTIN type key.
|
|
438
|
+
*/
|
|
439
|
+
type GTINTypeKey = keyof typeof GTINTypes;
|
|
440
|
+
/**
|
|
441
|
+
* GTIN type.
|
|
442
|
+
*/
|
|
443
|
+
type GTINType = typeof GTINTypes[GTINTypeKey];
|
|
444
|
+
/**
|
|
445
|
+
* GTIN base type (all except GTIN-14).
|
|
446
|
+
*/
|
|
447
|
+
type GTINBaseType = Exclude<GTINType, typeof GTINTypes.GTIN14>;
|
|
448
|
+
/**
|
|
449
|
+
* GTIN base types by prefix type.
|
|
450
|
+
*/
|
|
451
|
+
declare const GTIN_BASE_TYPES: Readonly<Record<PrefixType, GTINBaseType>>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Non-GTIN numeric identifier type.
|
|
455
|
+
*/
|
|
456
|
+
type NonGTINNumericIdentifierType = Exclude<NumericIdentifierType, typeof IdentifierTypes.GTIN>;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Serializable numeric identifier type.
|
|
460
|
+
*/
|
|
461
|
+
type SerializableNumericIdentifierType = typeof IdentifierTypes.GRAI | typeof IdentifierTypes.GDTI | typeof IdentifierTypes.GCN;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Non-numeric identifier type.
|
|
465
|
+
*/
|
|
466
|
+
type NonNumericIdentifierType = Exclude<IdentifierType, NumericIdentifierType>;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Identifier descriptor. Instantiations of this type are used to parameterize validators and creators.
|
|
470
|
+
*/
|
|
471
|
+
interface IdentifierDescriptor {
|
|
472
|
+
/**
|
|
473
|
+
* Identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.
|
|
474
|
+
*/
|
|
475
|
+
readonly identifierType: IdentifierType;
|
|
476
|
+
/**
|
|
477
|
+
* Prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1 Company
|
|
478
|
+
* Prefix. For the GTIN, the prefix type determines the length.
|
|
479
|
+
*/
|
|
480
|
+
readonly prefixType: PrefixType;
|
|
481
|
+
/**
|
|
482
|
+
* Length. For numeric identifier types, the length is fixed; for non-numeric identifier types, the length is the
|
|
483
|
+
* maximum.
|
|
484
|
+
*/
|
|
485
|
+
readonly length: number;
|
|
486
|
+
/**
|
|
487
|
+
* Reference character set.
|
|
488
|
+
*/
|
|
489
|
+
readonly referenceCharacterSet: ContentCharacterSet;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Numeric identifier descriptor.
|
|
494
|
+
*/
|
|
495
|
+
interface NumericIdentifierDescriptor extends IdentifierDescriptor {
|
|
496
|
+
/**
|
|
497
|
+
* @inheritDoc
|
|
498
|
+
*/
|
|
499
|
+
readonly identifierType: NumericIdentifierType;
|
|
500
|
+
/**
|
|
501
|
+
* @inheritDoc
|
|
502
|
+
*/
|
|
503
|
+
readonly referenceCharacterSet: typeof ContentCharacterSets.Numeric;
|
|
504
|
+
/**
|
|
505
|
+
* Leader type.
|
|
506
|
+
*/
|
|
507
|
+
readonly leaderType: LeaderType;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* GTIN descriptor.
|
|
512
|
+
*/
|
|
513
|
+
interface GTINDescriptor extends NumericIdentifierDescriptor {
|
|
514
|
+
/**
|
|
515
|
+
* @inheritDoc
|
|
516
|
+
*/
|
|
517
|
+
readonly identifierType: typeof IdentifierTypes.GTIN;
|
|
518
|
+
/**
|
|
519
|
+
* @inheritDoc
|
|
520
|
+
*/
|
|
521
|
+
readonly leaderType: typeof LeaderTypes.IndicatorDigit;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Non-GTIN numeric identifier descriptor.
|
|
526
|
+
*/
|
|
527
|
+
interface NonGTINNumericIdentifierDescriptor extends NumericIdentifierDescriptor {
|
|
528
|
+
/**
|
|
529
|
+
* @inheritDoc
|
|
530
|
+
*/
|
|
531
|
+
readonly identifierType: NonGTINNumericIdentifierType;
|
|
532
|
+
/**
|
|
533
|
+
* @inheritDoc
|
|
534
|
+
*/
|
|
535
|
+
readonly prefixType: typeof PrefixTypes.GS1CompanyPrefix;
|
|
536
|
+
/**
|
|
537
|
+
* @inheritDoc
|
|
538
|
+
*/
|
|
539
|
+
readonly leaderType: Exclude<LeaderType, typeof LeaderTypes.IndicatorDigit>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Serializable numeric identifier descriptor.
|
|
544
|
+
*/
|
|
545
|
+
interface SerializableNumericIdentifierDescriptor extends NonGTINNumericIdentifierDescriptor {
|
|
546
|
+
/**
|
|
547
|
+
* @inheritDoc
|
|
548
|
+
*/
|
|
549
|
+
readonly identifierType: SerializableNumericIdentifierType;
|
|
550
|
+
/**
|
|
551
|
+
* @inheritDoc
|
|
552
|
+
*/
|
|
553
|
+
readonly leaderType: typeof LeaderTypes.None;
|
|
554
|
+
/**
|
|
555
|
+
* Serial component length.
|
|
556
|
+
*/
|
|
557
|
+
readonly serialComponentLength: number;
|
|
558
|
+
/**
|
|
559
|
+
* Serial component character set.
|
|
560
|
+
*/
|
|
561
|
+
readonly serialComponentCharacterSet: ContentCharacterSet;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Non-numeric identifier descriptor.
|
|
566
|
+
*/
|
|
567
|
+
interface NonNumericIdentifierDescriptor extends IdentifierDescriptor {
|
|
568
|
+
/**
|
|
569
|
+
* @inheritDoc
|
|
570
|
+
*/
|
|
571
|
+
readonly identifierType: NonNumericIdentifierType;
|
|
572
|
+
/**
|
|
573
|
+
* @inheritDoc
|
|
574
|
+
*/
|
|
575
|
+
readonly prefixType: typeof PrefixTypes.GS1CompanyPrefix;
|
|
576
|
+
/**
|
|
577
|
+
* @inheritDoc
|
|
578
|
+
*/
|
|
579
|
+
readonly referenceCharacterSet: Exclude<ContentCharacterSet, typeof ContentCharacterSets.Numeric>;
|
|
580
|
+
/**
|
|
581
|
+
* True if identifier requires a check character pair.
|
|
582
|
+
*/
|
|
583
|
+
readonly requiresCheckCharacterPair: boolean;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Identifier descriptor type based on identifier type type.
|
|
588
|
+
*
|
|
589
|
+
* @template TIdentifierType
|
|
590
|
+
* Identifier type type.
|
|
591
|
+
*/
|
|
592
|
+
type IdentifierTypeDescriptor<TIdentifierType extends IdentifierType> = TIdentifierType extends NonNumericIdentifierType ? NonNumericIdentifierDescriptor : TIdentifierType extends SerializableNumericIdentifierType ? SerializableNumericIdentifierDescriptor : TIdentifierType extends NonGTINNumericIdentifierType ? NonGTINNumericIdentifierDescriptor : TIdentifierType extends typeof IdentifierTypes.GTIN ? GTINDescriptor : IdentifierDescriptor;
|
|
593
|
+
/**
|
|
594
|
+
* Identifier descriptors entry type based on identifier type type.
|
|
595
|
+
*
|
|
596
|
+
* @template TIdentifierType
|
|
597
|
+
* Identifier type type.
|
|
598
|
+
*/
|
|
599
|
+
type IdentifierDescriptorsEntry<TIdentifierType extends IdentifierType> = TIdentifierType extends typeof IdentifierTypes.GTIN ? Readonly<Record<GTINBaseType, GTINDescriptor>> : IdentifierTypeDescriptor<TIdentifierType>;
|
|
600
|
+
/**
|
|
601
|
+
* Identifier descriptors record type.
|
|
602
|
+
*/
|
|
603
|
+
type IdentifierDescriptorsRecord = {
|
|
604
|
+
[TIdentifierType in IdentifierType]: IdentifierDescriptorsEntry<TIdentifierType>;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Identifier descriptors for all identifier types.
|
|
608
|
+
*/
|
|
609
|
+
declare const IdentifierDescriptors: IdentifierDescriptorsRecord;
|
|
610
|
+
/**
|
|
611
|
+
* Determine if identifier descriptors or descriptor is GTIN descriptors.
|
|
612
|
+
*
|
|
613
|
+
* @param identifierDescriptorsOrDescriptor
|
|
614
|
+
* Identifier descriptors or descriptor.
|
|
615
|
+
*
|
|
616
|
+
* @returns
|
|
617
|
+
* True if GTIN descriptors.
|
|
618
|
+
*/
|
|
619
|
+
declare function isGTINDescriptors(identifierDescriptorsOrDescriptor: IdentifierDescriptorsEntry<IdentifierType>): identifierDescriptorsOrDescriptor is Readonly<Record<GTINBaseType, GTINDescriptor>>;
|
|
620
|
+
/**
|
|
621
|
+
* Determine if identifier descriptor is a numeric identifier descriptor.
|
|
622
|
+
*
|
|
623
|
+
* @param identifierDescriptor
|
|
624
|
+
* Identifier descriptor.
|
|
625
|
+
*
|
|
626
|
+
* @returns
|
|
627
|
+
* True if identifier descriptor is a numeric identifier descriptor.
|
|
628
|
+
*/
|
|
629
|
+
declare function isNumericIdentifierDescriptor(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is NumericIdentifierDescriptor;
|
|
630
|
+
/**
|
|
631
|
+
* Determine if identifier descriptor is a GTIN descriptor.
|
|
632
|
+
*
|
|
633
|
+
* @param identifierDescriptor
|
|
634
|
+
* Identifier descriptor.
|
|
635
|
+
*
|
|
636
|
+
* @returns
|
|
637
|
+
* True if identifier descriptor is a GTIN descriptor.
|
|
638
|
+
*/
|
|
639
|
+
declare function isGTINDescriptor(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is GTINDescriptor;
|
|
640
|
+
/**
|
|
641
|
+
* Determine if identifier descriptor is a non-GTIN numeric identifier descriptor.
|
|
642
|
+
*
|
|
643
|
+
* @param identifierDescriptor
|
|
644
|
+
* Identifier descriptor.
|
|
645
|
+
*
|
|
646
|
+
* @returns
|
|
647
|
+
* True if identifier descriptor is a non-GTIN numeric identifier descriptor.
|
|
648
|
+
*/
|
|
649
|
+
declare function isNonGTINNumericIdentifierDescriptor(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is NonGTINNumericIdentifierDescriptor;
|
|
650
|
+
/**
|
|
651
|
+
* Determine if identifier descriptor is a serializable numeric identifier descriptor.
|
|
652
|
+
*
|
|
653
|
+
* @param identifierDescriptor
|
|
654
|
+
* Identifier descriptor.
|
|
655
|
+
*
|
|
656
|
+
* @returns
|
|
657
|
+
* True if identifier descriptor is a serializable numeric identifier descriptor.
|
|
658
|
+
*/
|
|
659
|
+
declare function isSerializableNumericIdentifierDescriptor(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is SerializableNumericIdentifierDescriptor;
|
|
660
|
+
/**
|
|
661
|
+
* Determine if identifier descriptor is a non-numeric identifier descriptor.
|
|
662
|
+
*
|
|
663
|
+
* @param identifierDescriptor
|
|
664
|
+
* Identifier descriptor.
|
|
665
|
+
*
|
|
666
|
+
* @returns
|
|
667
|
+
* True if identifier descriptor is a non-numeric identifier descriptor.
|
|
668
|
+
*/
|
|
669
|
+
declare function isNonNumericIdentifierDescriptor(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is NonNumericIdentifierDescriptor;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Identifier validation parameters.
|
|
673
|
+
*/
|
|
674
|
+
interface IdentifierValidation extends StringValidation {
|
|
344
675
|
}
|
|
345
676
|
/**
|
|
346
677
|
* Identifier validator. Validates an identifier against its definition in section 3 of the {@link
|
|
347
|
-
* https://
|
|
678
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
679
|
+
*
|
|
680
|
+
* @template TIdentifierDescriptor
|
|
681
|
+
* Identifier descriptor type.
|
|
348
682
|
*
|
|
349
683
|
* @template TIdentifierValidation
|
|
350
684
|
* Identifier validation type.
|
|
351
685
|
*/
|
|
352
|
-
interface IdentifierValidator<TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends StringValidator<TIdentifierValidation> {
|
|
686
|
+
interface IdentifierValidator<TIdentifierDescriptor extends IdentifierDescriptor = IdentifierDescriptor, TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends StringValidator<TIdentifierValidation> {
|
|
353
687
|
/**
|
|
354
688
|
* Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining
|
|
355
689
|
* properties.
|
|
356
690
|
*/
|
|
357
|
-
get identifierType():
|
|
691
|
+
get identifierType(): TIdentifierDescriptor["identifierType"];
|
|
358
692
|
/**
|
|
359
|
-
* Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is
|
|
360
|
-
*
|
|
693
|
+
* Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1
|
|
694
|
+
* Company Prefix. For the GTIN, the prefix type determines the length.
|
|
361
695
|
*/
|
|
362
|
-
get prefixType():
|
|
696
|
+
get prefixType(): TIdentifierDescriptor["prefixType"];
|
|
363
697
|
/**
|
|
364
698
|
* Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length
|
|
365
699
|
* is the maximum.
|
|
@@ -368,7 +702,7 @@ interface IdentifierValidator<TIdentifierValidation extends IdentifierValidation
|
|
|
368
702
|
/**
|
|
369
703
|
* Get the reference character set.
|
|
370
704
|
*/
|
|
371
|
-
get referenceCharacterSet():
|
|
705
|
+
get referenceCharacterSet(): TIdentifierDescriptor["referenceCharacterSet"];
|
|
372
706
|
/**
|
|
373
707
|
* Get the reference creator.
|
|
374
708
|
*/
|
|
@@ -384,19 +718,44 @@ interface IdentifierValidator<TIdentifierValidation extends IdentifierValidation
|
|
|
384
718
|
*/
|
|
385
719
|
validate: (identifier: string, validation?: TIdentifierValidation) => void;
|
|
386
720
|
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Numeric identifier validation parameters.
|
|
724
|
+
*/
|
|
725
|
+
interface NumericIdentifierValidation extends IdentifierValidation {
|
|
726
|
+
/**
|
|
727
|
+
* Position offset within a larger string. Some numeric identifier types have the prefix offset by one.
|
|
728
|
+
*/
|
|
729
|
+
positionOffset?: number | undefined;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Numeric identifier validator.
|
|
733
|
+
*
|
|
734
|
+
* @template TNumericIdentifierDescriptor
|
|
735
|
+
* Numeric identifier descriptor type.
|
|
736
|
+
*/
|
|
737
|
+
interface NumericIdentifierValidator<TNumericIdentifierDescriptor extends NumericIdentifierDescriptor = NumericIdentifierDescriptor> extends IdentifierValidator<TNumericIdentifierDescriptor, NumericIdentifierValidation> {
|
|
738
|
+
/**
|
|
739
|
+
* Get the leader type.
|
|
740
|
+
*/
|
|
741
|
+
get leaderType(): TNumericIdentifierDescriptor["leaderType"];
|
|
742
|
+
}
|
|
743
|
+
|
|
387
744
|
/**
|
|
388
745
|
* Abstract identifier validator. Implements common functionality for an identifier validator.
|
|
746
|
+
*
|
|
747
|
+
* @template TIdentifierDescriptor
|
|
748
|
+
* Identifier descriptor type.
|
|
749
|
+
*
|
|
750
|
+
* @template TIdentifierValidation
|
|
751
|
+
* Identifier validation type.
|
|
389
752
|
*/
|
|
390
|
-
declare abstract class AbstractIdentifierValidator<
|
|
753
|
+
declare abstract class AbstractIdentifierValidator<TIdentifierDescriptor extends IdentifierDescriptor, TIdentifierValidation extends IdentifierValidation> implements IdentifierValidator<TIdentifierDescriptor, TIdentifierValidation> {
|
|
391
754
|
private static readonly CHARACTER_SET_CREATORS;
|
|
392
755
|
/**
|
|
393
756
|
* Identifier type.
|
|
394
757
|
*/
|
|
395
758
|
private readonly _identifierType;
|
|
396
|
-
/**
|
|
397
|
-
* Prefix type.
|
|
398
|
-
*/
|
|
399
|
-
private readonly _prefixType;
|
|
400
759
|
/**
|
|
401
760
|
* Length.
|
|
402
761
|
*/
|
|
@@ -422,27 +781,18 @@ declare abstract class AbstractIdentifierValidator<TIdentifierValidation extends
|
|
|
422
781
|
/**
|
|
423
782
|
* Constructor.
|
|
424
783
|
*
|
|
425
|
-
* @param
|
|
426
|
-
* Identifier
|
|
427
|
-
*
|
|
428
|
-
* @param prefixType
|
|
429
|
-
* Prefix type.
|
|
430
|
-
*
|
|
431
|
-
* @param length
|
|
432
|
-
* Length.
|
|
433
|
-
*
|
|
434
|
-
* @param referenceCharacterSet
|
|
435
|
-
* Reference character set.
|
|
784
|
+
* @param identifierDescriptor
|
|
785
|
+
* Identifier descriptor.
|
|
436
786
|
*/
|
|
437
|
-
protected constructor(
|
|
787
|
+
protected constructor(identifierDescriptor: IdentifierDescriptor);
|
|
438
788
|
/**
|
|
439
789
|
* @inheritDoc
|
|
440
790
|
*/
|
|
441
|
-
get identifierType():
|
|
791
|
+
get identifierType(): TIdentifierDescriptor["identifierType"];
|
|
442
792
|
/**
|
|
443
793
|
* @inheritDoc
|
|
444
794
|
*/
|
|
445
|
-
get prefixType():
|
|
795
|
+
get prefixType(): TIdentifierDescriptor["prefixType"];
|
|
446
796
|
/**
|
|
447
797
|
* @inheritDoc
|
|
448
798
|
*/
|
|
@@ -450,7 +800,7 @@ declare abstract class AbstractIdentifierValidator<TIdentifierValidation extends
|
|
|
450
800
|
/**
|
|
451
801
|
* @inheritDoc
|
|
452
802
|
*/
|
|
453
|
-
get referenceCharacterSet():
|
|
803
|
+
get referenceCharacterSet(): TIdentifierDescriptor["referenceCharacterSet"];
|
|
454
804
|
/**
|
|
455
805
|
* @inheritDoc
|
|
456
806
|
*/
|
|
@@ -462,13 +812,13 @@ declare abstract class AbstractIdentifierValidator<TIdentifierValidation extends
|
|
|
462
812
|
* @param identifier
|
|
463
813
|
* Identifier.
|
|
464
814
|
*
|
|
465
|
-
* @param
|
|
466
|
-
*
|
|
815
|
+
* @param positionOffset
|
|
816
|
+
* Position offset within a larger string.
|
|
467
817
|
*
|
|
468
818
|
* @returns
|
|
469
819
|
* Padded identifier.
|
|
470
820
|
*/
|
|
471
|
-
protected padIdentifier(identifier: string,
|
|
821
|
+
protected padIdentifier(identifier: string, positionOffset?: number): string;
|
|
472
822
|
/**
|
|
473
823
|
* Validate the prefix within an identifier.
|
|
474
824
|
*
|
|
@@ -483,44 +833,12 @@ declare abstract class AbstractIdentifierValidator<TIdentifierValidation extends
|
|
|
483
833
|
}
|
|
484
834
|
|
|
485
835
|
/**
|
|
486
|
-
*
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
* Leader type.
|
|
491
|
-
*/
|
|
492
|
-
declare const LeaderTypes: {
|
|
493
|
-
/**
|
|
494
|
-
* No leader.
|
|
495
|
-
*/
|
|
496
|
-
None: string;
|
|
497
|
-
/**
|
|
498
|
-
* Indicator digit (GTIN only).
|
|
499
|
-
*/
|
|
500
|
-
IndicatorDigit: string;
|
|
501
|
-
/**
|
|
502
|
-
* Extension digit (SSCC only).
|
|
503
|
-
*/
|
|
504
|
-
ExtensionDigit: string;
|
|
505
|
-
};
|
|
506
|
-
/**
|
|
507
|
-
* Leader type.
|
|
508
|
-
*/
|
|
509
|
-
type LeaderType = typeof LeaderTypes[keyof typeof LeaderTypes];
|
|
510
|
-
/**
|
|
511
|
-
* Numeric identifier validator. Validates a numeric identifier.
|
|
512
|
-
*/
|
|
513
|
-
interface NumericIdentifierValidator extends IdentifierValidator {
|
|
514
|
-
/**
|
|
515
|
-
* Get the leader type.
|
|
516
|
-
*/
|
|
517
|
-
get leaderType(): LeaderType;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Abstract numeric identifier validator. Implements common functionality for a numeric identifier
|
|
521
|
-
* validator.
|
|
836
|
+
* Abstract numeric identifier validator.
|
|
837
|
+
*
|
|
838
|
+
* @template TNumericIdentifierDescriptor
|
|
839
|
+
* Numeric identifier descriptor type.
|
|
522
840
|
*/
|
|
523
|
-
declare abstract class AbstractNumericIdentifierValidator extends AbstractIdentifierValidator implements NumericIdentifierValidator {
|
|
841
|
+
declare abstract class AbstractNumericIdentifierValidator<TNumericIdentifierDescriptor extends NumericIdentifierDescriptor> extends AbstractIdentifierValidator<TNumericIdentifierDescriptor, NumericIdentifierValidation> implements NumericIdentifierValidator<TNumericIdentifierDescriptor> {
|
|
524
842
|
/**
|
|
525
843
|
* Leader type.
|
|
526
844
|
*/
|
|
@@ -532,54 +850,20 @@ declare abstract class AbstractNumericIdentifierValidator extends AbstractIdenti
|
|
|
532
850
|
/**
|
|
533
851
|
* Constructor.
|
|
534
852
|
*
|
|
535
|
-
* @param
|
|
536
|
-
* Identifier
|
|
537
|
-
*
|
|
538
|
-
* @param prefixType
|
|
539
|
-
* Prefix type.
|
|
540
|
-
*
|
|
541
|
-
* @param length
|
|
542
|
-
* Length.
|
|
543
|
-
*
|
|
544
|
-
* @param leaderType
|
|
545
|
-
* Leader type.
|
|
853
|
+
* @param identifierDescriptor
|
|
854
|
+
* Identifier descriptor.
|
|
546
855
|
*/
|
|
547
|
-
|
|
856
|
+
constructor(identifierDescriptor: NumericIdentifierDescriptor);
|
|
548
857
|
/**
|
|
549
858
|
* @inheritDoc
|
|
550
859
|
*/
|
|
551
|
-
get leaderType():
|
|
860
|
+
get leaderType(): TNumericIdentifierDescriptor["leaderType"];
|
|
552
861
|
/**
|
|
553
862
|
* @inheritDoc
|
|
554
863
|
*/
|
|
555
|
-
validate(identifier: string, validation?:
|
|
864
|
+
validate(identifier: string, validation?: NumericIdentifierValidation): void;
|
|
556
865
|
}
|
|
557
866
|
|
|
558
|
-
/**
|
|
559
|
-
* GTIN types. The numeric values are equal to the lengths of the GTIN types.
|
|
560
|
-
*/
|
|
561
|
-
declare const GTINTypes: {
|
|
562
|
-
/**
|
|
563
|
-
* GTIN-13.
|
|
564
|
-
*/
|
|
565
|
-
readonly GTIN13: 13;
|
|
566
|
-
/**
|
|
567
|
-
* GTIN-12.
|
|
568
|
-
*/
|
|
569
|
-
readonly GTIN12: 12;
|
|
570
|
-
/**
|
|
571
|
-
* GTIN-8.
|
|
572
|
-
*/
|
|
573
|
-
readonly GTIN8: 8;
|
|
574
|
-
/**
|
|
575
|
-
* GTIN-14.
|
|
576
|
-
*/
|
|
577
|
-
readonly GTIN14: 14;
|
|
578
|
-
};
|
|
579
|
-
/**
|
|
580
|
-
* GTIN type.
|
|
581
|
-
*/
|
|
582
|
-
type GTINType = typeof GTINTypes[keyof typeof GTINTypes];
|
|
583
867
|
/**
|
|
584
868
|
* Levels at which GTIN is to be validated.
|
|
585
869
|
*/
|
|
@@ -597,10 +881,14 @@ declare const GTINLevels: {
|
|
|
597
881
|
*/
|
|
598
882
|
readonly OtherThanRetailConsumer: 2;
|
|
599
883
|
};
|
|
884
|
+
/**
|
|
885
|
+
* GTIN level key.
|
|
886
|
+
*/
|
|
887
|
+
type GTINLevelKey = keyof typeof GTINLevels;
|
|
600
888
|
/**
|
|
601
889
|
* GTIN level.
|
|
602
890
|
*/
|
|
603
|
-
type GTINLevel = typeof GTINLevels[
|
|
891
|
+
type GTINLevel = typeof GTINLevels[GTINLevelKey];
|
|
604
892
|
/**
|
|
605
893
|
* Restricted Circulation Number reference.
|
|
606
894
|
*/
|
|
@@ -617,7 +905,7 @@ interface RCNReference {
|
|
|
617
905
|
/**
|
|
618
906
|
* GTIN validator.
|
|
619
907
|
*/
|
|
620
|
-
declare class GTINValidator extends AbstractNumericIdentifierValidator {
|
|
908
|
+
declare class GTINValidator extends AbstractNumericIdentifierValidator<GTINDescriptor> {
|
|
621
909
|
/**
|
|
622
910
|
* Validation parameters for optional indicator digit.
|
|
623
911
|
*/
|
|
@@ -626,13 +914,21 @@ declare class GTINValidator extends AbstractNumericIdentifierValidator {
|
|
|
626
914
|
* Validation parameters for zero-suppressed GTIN-12.
|
|
627
915
|
*/
|
|
628
916
|
private static readonly ZERO_SUPPRESSED_GTIN12_VALIDATION;
|
|
917
|
+
/**
|
|
918
|
+
* Prefix type.
|
|
919
|
+
*/
|
|
920
|
+
private readonly _prefixType;
|
|
629
921
|
/**
|
|
630
922
|
* Constructor.
|
|
631
923
|
*
|
|
632
|
-
* @param
|
|
633
|
-
* GTIN type.
|
|
924
|
+
* @param gtinBaseType
|
|
925
|
+
* GTIN base type (all except GTIN-14).
|
|
634
926
|
*/
|
|
635
|
-
constructor(
|
|
927
|
+
constructor(gtinBaseType: GTINBaseType);
|
|
928
|
+
/**
|
|
929
|
+
* @inheritDoc
|
|
930
|
+
*/
|
|
931
|
+
get prefixType(): PrefixType;
|
|
636
932
|
/**
|
|
637
933
|
* @inheritDoc
|
|
638
934
|
*/
|
|
@@ -738,71 +1034,25 @@ declare class GTINValidator extends AbstractNumericIdentifierValidator {
|
|
|
738
1034
|
*/
|
|
739
1035
|
static parseVariableMeasureRCN(format: string, rcn: string): RCNReference;
|
|
740
1036
|
}
|
|
741
|
-
/**
|
|
742
|
-
* GTIN-13 validator.
|
|
743
|
-
*/
|
|
744
|
-
declare const GTIN13_VALIDATOR: GTINValidator;
|
|
745
|
-
/**
|
|
746
|
-
* GTIN-12 validator.
|
|
747
|
-
*/
|
|
748
|
-
declare const GTIN12_VALIDATOR: GTINValidator;
|
|
749
|
-
/**
|
|
750
|
-
* GTIN-8 validator.
|
|
751
|
-
*/
|
|
752
|
-
declare const GTIN8_VALIDATOR: GTINValidator;
|
|
753
|
-
/**
|
|
754
|
-
* GTIN validators indexed by prefix type.
|
|
755
|
-
*/
|
|
756
|
-
declare const GTIN_VALIDATORS: Record<PrefixType, GTINValidator>;
|
|
757
1037
|
|
|
758
|
-
/**
|
|
759
|
-
* Non-GTIN numeric identifier type.
|
|
760
|
-
*/
|
|
761
|
-
type NonGTINNumericIdentifierType = Exclude<NumericIdentifierType, typeof IdentifierTypes.GTIN>;
|
|
762
1038
|
/**
|
|
763
1039
|
* Non-GTIN numeric identifier validator.
|
|
764
1040
|
*/
|
|
765
|
-
declare class NonGTINNumericIdentifierValidator extends AbstractNumericIdentifierValidator {
|
|
1041
|
+
declare class NonGTINNumericIdentifierValidator extends AbstractNumericIdentifierValidator<NonGTINNumericIdentifierDescriptor> {
|
|
766
1042
|
/**
|
|
767
1043
|
* Constructor.
|
|
768
1044
|
*
|
|
769
1045
|
* @param identifierType
|
|
770
1046
|
* Identifier type.
|
|
771
|
-
*
|
|
772
|
-
* @param length
|
|
773
|
-
* Length.
|
|
774
|
-
*
|
|
775
|
-
* @param leaderType
|
|
776
|
-
* Leader type.
|
|
777
1047
|
*/
|
|
778
|
-
constructor(identifierType:
|
|
1048
|
+
constructor(identifierType: Exclude<NonGTINNumericIdentifierType, SerializableNumericIdentifierType>);
|
|
779
1049
|
}
|
|
780
|
-
/**
|
|
781
|
-
* GLN validator.
|
|
782
|
-
*/
|
|
783
|
-
declare const GLN_VALIDATOR: NonGTINNumericIdentifierValidator;
|
|
784
|
-
/**
|
|
785
|
-
* SSCC validator.
|
|
786
|
-
*/
|
|
787
|
-
declare const SSCC_VALIDATOR: NonGTINNumericIdentifierValidator;
|
|
788
|
-
/**
|
|
789
|
-
* GSRN validator.
|
|
790
|
-
*/
|
|
791
|
-
declare const GSRN_VALIDATOR: NonGTINNumericIdentifierValidator;
|
|
792
|
-
/**
|
|
793
|
-
* GSIN validator.
|
|
794
|
-
*/
|
|
795
|
-
declare const GSIN_VALIDATOR: NonGTINNumericIdentifierValidator;
|
|
796
1050
|
|
|
797
1051
|
/**
|
|
798
|
-
* Serializable numeric identifier
|
|
799
|
-
|
|
800
|
-
type SerializableNumericIdentifierType = Exclude<NonGTINNumericIdentifierType, typeof IdentifierTypes.GLN | typeof IdentifierTypes.SSCC | typeof IdentifierTypes.GSRN | typeof IdentifierTypes.GSIN>;
|
|
801
|
-
/**
|
|
802
|
-
* Serializable numeric identifier validator. Validates both serialized and non-serialized forms of
|
|
803
|
-
* numeric identifiers that support serialization.
|
|
1052
|
+
* Serializable numeric identifier validator. Validates both serialized and non-serialized forms of numeric identifiers
|
|
1053
|
+
* that support serialization.
|
|
804
1054
|
*/
|
|
805
|
-
declare class SerializableNumericIdentifierValidator extends
|
|
1055
|
+
declare class SerializableNumericIdentifierValidator extends AbstractNumericIdentifierValidator<SerializableNumericIdentifierDescriptor> {
|
|
806
1056
|
/**
|
|
807
1057
|
* Serial component length.
|
|
808
1058
|
*/
|
|
@@ -824,17 +1074,8 @@ declare class SerializableNumericIdentifierValidator extends NonGTINNumericIdent
|
|
|
824
1074
|
*
|
|
825
1075
|
* @param identifierType
|
|
826
1076
|
* Identifier type.
|
|
827
|
-
*
|
|
828
|
-
* @param length
|
|
829
|
-
* Length.
|
|
830
|
-
*
|
|
831
|
-
* @param serialComponentLength
|
|
832
|
-
* Serial component length.
|
|
833
|
-
*
|
|
834
|
-
* @param serialComponentCharacterSet
|
|
835
|
-
* Serial component character set.
|
|
836
1077
|
*/
|
|
837
|
-
constructor(identifierType:
|
|
1078
|
+
constructor(identifierType: SerializableNumericIdentifierType);
|
|
838
1079
|
/**
|
|
839
1080
|
* Get the serial component length.
|
|
840
1081
|
*/
|
|
@@ -856,37 +1097,20 @@ declare class SerializableNumericIdentifierValidator extends NonGTINNumericIdent
|
|
|
856
1097
|
*/
|
|
857
1098
|
validate(identifier: string, validation?: IdentifierValidation): void;
|
|
858
1099
|
}
|
|
859
|
-
/**
|
|
860
|
-
* GRAI validator.
|
|
861
|
-
*/
|
|
862
|
-
declare const GRAI_VALIDATOR: SerializableNumericIdentifierValidator;
|
|
863
|
-
/**
|
|
864
|
-
* GDTI validator.
|
|
865
|
-
*/
|
|
866
|
-
declare const GDTI_VALIDATOR: SerializableNumericIdentifierValidator;
|
|
867
|
-
/**
|
|
868
|
-
* GCN validator.
|
|
869
|
-
*/
|
|
870
|
-
declare const GCN_VALIDATOR: SerializableNumericIdentifierValidator;
|
|
871
1100
|
|
|
872
|
-
/**
|
|
873
|
-
* Non-numeric identifier type.
|
|
874
|
-
*/
|
|
875
|
-
type NonNumericIdentifierType = Exclude<IdentifierType, NumericIdentifierType>;
|
|
876
1101
|
/**
|
|
877
1102
|
* Non-numeric identifier validation parameters.
|
|
878
1103
|
*/
|
|
879
1104
|
interface NonNumericIdentifierValidation extends IdentifierValidation {
|
|
880
1105
|
/**
|
|
881
|
-
* Exclusion support for reference. Prevents non-numeric identifier from being mistaken for numeric
|
|
882
|
-
* identifier.
|
|
1106
|
+
* Exclusion support for reference. Prevents non-numeric identifier from being mistaken for numeric identifier.
|
|
883
1107
|
*/
|
|
884
1108
|
exclusion?: typeof Exclusions.None | typeof Exclusions.AllNumeric | undefined;
|
|
885
1109
|
}
|
|
886
1110
|
/**
|
|
887
1111
|
* Non-numeric identifier validator.
|
|
888
1112
|
*/
|
|
889
|
-
declare class NonNumericIdentifierValidator extends AbstractIdentifierValidator<NonNumericIdentifierValidation> {
|
|
1113
|
+
declare class NonNumericIdentifierValidator extends AbstractIdentifierValidator<NonNumericIdentifierDescriptor, NonNumericIdentifierValidation> {
|
|
890
1114
|
/**
|
|
891
1115
|
* Validator to ensure that an identifier (minus check character pair) is not all numeric.
|
|
892
1116
|
*/
|
|
@@ -900,17 +1124,8 @@ declare class NonNumericIdentifierValidator extends AbstractIdentifierValidator<
|
|
|
900
1124
|
*
|
|
901
1125
|
* @param identifierType
|
|
902
1126
|
* Identifier type.
|
|
903
|
-
*
|
|
904
|
-
* @param length
|
|
905
|
-
* Length.
|
|
906
|
-
*
|
|
907
|
-
* @param referenceCharacterSet
|
|
908
|
-
* Reference character set.
|
|
909
|
-
*
|
|
910
|
-
* @param requiresCheckCharacterPair
|
|
911
|
-
* True if the identifier requires a check character pair.
|
|
912
1127
|
*/
|
|
913
|
-
constructor(identifierType:
|
|
1128
|
+
constructor(identifierType: NonNumericIdentifierType);
|
|
914
1129
|
/**
|
|
915
1130
|
* Determine if the identifier requires a check character pair.
|
|
916
1131
|
*/
|
|
@@ -926,56 +1141,105 @@ declare class NonNumericIdentifierValidator extends AbstractIdentifierValidator<
|
|
|
926
1141
|
*/
|
|
927
1142
|
validate(identifier: string, validation?: NonNumericIdentifierValidation): void;
|
|
928
1143
|
}
|
|
1144
|
+
|
|
929
1145
|
/**
|
|
930
|
-
*
|
|
1146
|
+
* Identifier validator type based on identifier type type.
|
|
1147
|
+
*
|
|
1148
|
+
* @template TIdentifierType
|
|
1149
|
+
* Identifier type type.
|
|
931
1150
|
*/
|
|
932
|
-
|
|
1151
|
+
type IdentifierTypeValidator<TIdentifierType extends IdentifierType> = TIdentifierType extends NonNumericIdentifierType ? NonNumericIdentifierValidator : TIdentifierType extends SerializableNumericIdentifierType ? SerializableNumericIdentifierValidator : TIdentifierType extends NonGTINNumericIdentifierType ? NonGTINNumericIdentifierValidator : TIdentifierType extends typeof IdentifierTypes.GTIN ? GTINValidator : IdentifierValidator;
|
|
933
1152
|
/**
|
|
934
|
-
*
|
|
1153
|
+
* Identifier validators entry type based on identifier type type.
|
|
1154
|
+
*
|
|
1155
|
+
* @template TIdentifierType
|
|
1156
|
+
* Identifier type type.
|
|
935
1157
|
*/
|
|
936
|
-
|
|
1158
|
+
type IdentifierValidatorsEntry<TIdentifierType extends IdentifierType> = TIdentifierType extends typeof IdentifierTypes.GTIN ? Readonly<Record<GTINBaseType, GTINValidator>> : IdentifierTypeValidator<TIdentifierType>;
|
|
937
1159
|
/**
|
|
938
|
-
*
|
|
1160
|
+
* Identifier validators record type.
|
|
939
1161
|
*/
|
|
940
|
-
|
|
1162
|
+
type IdentifierValidatorsRecord = {
|
|
1163
|
+
[TIdentifierType in IdentifierType]: IdentifierValidatorsEntry<TIdentifierType>;
|
|
1164
|
+
};
|
|
941
1165
|
/**
|
|
942
|
-
*
|
|
1166
|
+
* Identifier validators for all identifier types.
|
|
943
1167
|
*/
|
|
944
|
-
declare const
|
|
945
|
-
|
|
1168
|
+
declare const IdentifierValidators: IdentifierValidatorsRecord;
|
|
946
1169
|
/**
|
|
947
|
-
*
|
|
1170
|
+
* Determine if identifier validators or validator is GTIN validators.
|
|
1171
|
+
*
|
|
1172
|
+
* @param identifierValidatorsOrValidator
|
|
1173
|
+
* Identifier validators or validator.
|
|
1174
|
+
*
|
|
1175
|
+
* @returns
|
|
1176
|
+
* True if GTIN validators.
|
|
948
1177
|
*/
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1178
|
+
declare function isGTINValidators(identifierValidatorsOrValidator: IdentifierValidatorsEntry<IdentifierType>): identifierValidatorsOrValidator is Readonly<Record<GTINBaseType, GTINValidator>>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Determine if identifier validator is a numeric identifier validator.
|
|
1181
|
+
*
|
|
1182
|
+
* @param identifierValidator
|
|
1183
|
+
* Identifier validator.
|
|
1184
|
+
*
|
|
1185
|
+
* @returns
|
|
1186
|
+
* True if identifier validator is a numeric identifier validator.
|
|
1187
|
+
*/
|
|
1188
|
+
declare function isNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NumericIdentifierValidator;
|
|
1189
|
+
/**
|
|
1190
|
+
* Determine if identifier validator is a GTIN validator.
|
|
1191
|
+
*
|
|
1192
|
+
* @param identifierValidator
|
|
1193
|
+
* Identifier validator.
|
|
1194
|
+
*
|
|
1195
|
+
* @returns
|
|
1196
|
+
* True if identifier validator is a GTIN validator.
|
|
1197
|
+
*/
|
|
1198
|
+
declare function isGTINValidator(identifierValidator: IdentifierValidator): identifierValidator is GTINValidator;
|
|
1199
|
+
/**
|
|
1200
|
+
* Determine if identifier validator is a non-GTIN numeric identifier validator.
|
|
1201
|
+
*
|
|
1202
|
+
* @param identifierValidator
|
|
1203
|
+
* Identifier validator.
|
|
1204
|
+
*
|
|
1205
|
+
* @returns
|
|
1206
|
+
* True if identifier validator is a non-GTIN numeric identifier validator.
|
|
1207
|
+
*/
|
|
1208
|
+
declare function isNonGTINNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NonGTINNumericIdentifierValidator;
|
|
1209
|
+
/**
|
|
1210
|
+
* Determine if identifier validator is a serializable numeric identifier validator.
|
|
1211
|
+
*
|
|
1212
|
+
* @param identifierValidator
|
|
1213
|
+
* Identifier validator.
|
|
1214
|
+
*
|
|
1215
|
+
* @returns
|
|
1216
|
+
* True if identifier validator is a serializable numeric identifier validator.
|
|
1217
|
+
*/
|
|
1218
|
+
declare function isSerializableNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is SerializableNumericIdentifierValidator;
|
|
1219
|
+
/**
|
|
1220
|
+
* Determine if identifier validator is a non-numeric identifier validator.
|
|
1221
|
+
*
|
|
1222
|
+
* @param identifierValidator
|
|
1223
|
+
* Identifier validator.
|
|
1224
|
+
*
|
|
1225
|
+
* @returns
|
|
1226
|
+
* True if identifier validator is a non-numeric identifier validator.
|
|
1227
|
+
*/
|
|
1228
|
+
declare function isNonNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NonNumericIdentifierValidator;
|
|
971
1229
|
|
|
972
1230
|
/**
|
|
973
1231
|
* Identifier creator. Creates an identifier based on its definition in section 3 of the {@link
|
|
974
|
-
* https://
|
|
1232
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
1233
|
+
*
|
|
1234
|
+
* Keys are created based on a prefix defined in a prefix provider to which the identifier creator is bound.
|
|
975
1235
|
*
|
|
976
|
-
*
|
|
1236
|
+
* @template TIdentifierDescriptor
|
|
1237
|
+
* Identifier descriptor type.
|
|
1238
|
+
*
|
|
1239
|
+
* @template TIdentifierValidation
|
|
1240
|
+
* Identifier validation type.
|
|
977
1241
|
*/
|
|
978
|
-
interface IdentifierCreator extends IdentifierValidator {
|
|
1242
|
+
interface IdentifierCreator<TIdentifierDescriptor extends IdentifierDescriptor = IdentifierDescriptor, TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends IdentifierValidator<TIdentifierDescriptor, TIdentifierValidation> {
|
|
979
1243
|
/**
|
|
980
1244
|
* Get the prefix provider to which this identifier creator is bound.
|
|
981
1245
|
*/
|
|
@@ -990,11 +1254,67 @@ interface IdentifierCreator extends IdentifierValidator {
|
|
|
990
1254
|
*/
|
|
991
1255
|
get referenceLength(): number;
|
|
992
1256
|
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Numeric identifier creator. Creates one or many numeric identifiers.
|
|
1260
|
+
*
|
|
1261
|
+
* @template TNumericIdentifierDescriptor
|
|
1262
|
+
* Numeric identifier descriptor type.
|
|
1263
|
+
*/
|
|
1264
|
+
interface NumericIdentifierCreator<TNumericIdentifierDescriptor extends NumericIdentifierDescriptor = NumericIdentifierDescriptor> extends NumericIdentifierValidator<TNumericIdentifierDescriptor>, IdentifierCreator<TNumericIdentifierDescriptor, NumericIdentifierValidation> {
|
|
1265
|
+
/**
|
|
1266
|
+
* Get the capacity (`10**referenceLength`).
|
|
1267
|
+
*/
|
|
1268
|
+
get capacity(): number;
|
|
1269
|
+
/**
|
|
1270
|
+
* Get the tweak for sparse creation.
|
|
1271
|
+
*/
|
|
1272
|
+
get tweak(): bigint;
|
|
1273
|
+
/**
|
|
1274
|
+
* Set the tweak for sparse creation.
|
|
1275
|
+
*/
|
|
1276
|
+
set tweak(value: bigint);
|
|
1277
|
+
/**
|
|
1278
|
+
* Create identifier(s) with reference(s) based on numeric value(s). The value(s) is/are converted to references of
|
|
1279
|
+
* the appropriate length using the numeric creator.
|
|
1280
|
+
*
|
|
1281
|
+
* @template TTransformerInput
|
|
1282
|
+
* Transformer input type.
|
|
1283
|
+
*
|
|
1284
|
+
* @param valueOrValues
|
|
1285
|
+
* Numeric value(s).
|
|
1286
|
+
*
|
|
1287
|
+
* @param sparse
|
|
1288
|
+
* If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.
|
|
1289
|
+
*
|
|
1290
|
+
* @returns
|
|
1291
|
+
* Identifier(s).
|
|
1292
|
+
*/
|
|
1293
|
+
create: <TTransformerInput extends TransformerInput<number | bigint>>(valueOrValues: TTransformerInput, sparse?: boolean) => TransformerOutput<TTransformerInput, string>;
|
|
1294
|
+
/**
|
|
1295
|
+
* Create all identifiers for the prefix from `0` to `capacity - 1`.
|
|
1296
|
+
*
|
|
1297
|
+
* The implementation creates the strings only as needed using an internal generator function. Although the result
|
|
1298
|
+
* is equivalent to calling `creator.create(new Sequence(0, creator.capacity))`, this method is significantly
|
|
1299
|
+
* faster.
|
|
1300
|
+
*
|
|
1301
|
+
* @returns
|
|
1302
|
+
* All identifiers for the prefix.
|
|
1303
|
+
*/
|
|
1304
|
+
createAll: () => Iterable<string>;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
993
1307
|
/**
|
|
994
|
-
* Abstract identifier creator. Implements common functionality for an identifier creator, bound to a
|
|
995
|
-
*
|
|
1308
|
+
* Abstract identifier creator. Implements common functionality for an identifier creator, bound to a {@link
|
|
1309
|
+
* PrefixProvider | prefix provider}.
|
|
1310
|
+
*
|
|
1311
|
+
* @template TIdentifierDescriptor
|
|
1312
|
+
* Identifier descriptor type.
|
|
1313
|
+
*
|
|
1314
|
+
* @template TIdentifierValidation
|
|
1315
|
+
* Identifier validation type.
|
|
996
1316
|
*/
|
|
997
|
-
declare abstract class AbstractIdentifierCreator implements IdentifierCreator {
|
|
1317
|
+
declare abstract class AbstractIdentifierCreator<TIdentifierDescriptor extends IdentifierDescriptor, TIdentifierValidation extends IdentifierValidation> implements IdentifierCreator<TIdentifierDescriptor, TIdentifierValidation> {
|
|
998
1318
|
/**
|
|
999
1319
|
* Prefix provider.
|
|
1000
1320
|
*/
|
|
@@ -1004,80 +1324,63 @@ declare abstract class AbstractIdentifierCreator implements IdentifierCreator {
|
|
|
1004
1324
|
*/
|
|
1005
1325
|
private _referenceLength;
|
|
1006
1326
|
/**
|
|
1007
|
-
* Initialize the prefix
|
|
1327
|
+
* Initialize the prefix provider. This method is in lieu of a constructor due to the mixin architecture.
|
|
1008
1328
|
*
|
|
1009
1329
|
* @param prefixProvider
|
|
1010
1330
|
* Prefix provider.
|
|
1011
1331
|
*
|
|
1012
1332
|
* @param prefix
|
|
1013
|
-
* Prefix within prefix
|
|
1333
|
+
* Prefix within prefix provider to use to calculate reference length.
|
|
1014
1334
|
*
|
|
1015
1335
|
* @param checkAllowance
|
|
1016
1336
|
* Number of characters to allow for check digit or check character pair.
|
|
1017
1337
|
*/
|
|
1018
1338
|
protected init(prefixProvider: PrefixProvider, prefix: string, checkAllowance: number): void;
|
|
1019
|
-
|
|
1020
|
-
|
|
1339
|
+
/**
|
|
1340
|
+
* @inheritDoc
|
|
1341
|
+
*/
|
|
1342
|
+
abstract get identifierType(): TIdentifierDescriptor["identifierType"];
|
|
1343
|
+
/**
|
|
1344
|
+
* @inheritDoc
|
|
1345
|
+
*/
|
|
1346
|
+
abstract get prefixType(): TIdentifierDescriptor["prefixType"];
|
|
1347
|
+
/**
|
|
1348
|
+
* @inheritDoc
|
|
1349
|
+
*/
|
|
1021
1350
|
abstract get length(): number;
|
|
1022
|
-
abstract get referenceCharacterSet(): ContentCharacterSet;
|
|
1023
|
-
abstract get referenceCreator(): CharacterSetCreator;
|
|
1024
1351
|
/**
|
|
1025
1352
|
* @inheritDoc
|
|
1026
1353
|
*/
|
|
1027
|
-
get
|
|
1354
|
+
abstract get referenceCharacterSet(): TIdentifierDescriptor["referenceCharacterSet"];
|
|
1028
1355
|
/**
|
|
1029
1356
|
* @inheritDoc
|
|
1030
1357
|
*/
|
|
1031
|
-
get
|
|
1358
|
+
abstract get referenceCreator(): CharacterSetCreator;
|
|
1032
1359
|
/**
|
|
1033
1360
|
* @inheritDoc
|
|
1034
1361
|
*/
|
|
1035
|
-
get
|
|
1036
|
-
abstract validate(identifier: string, validation?: IdentifierValidation): void;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
* Numeric identifier creator. Creates one or many numeric identifiers.
|
|
1041
|
-
*/
|
|
1042
|
-
interface NumericIdentifierCreator extends NumericIdentifierValidator, IdentifierCreator {
|
|
1362
|
+
get prefixProvider(): PrefixProvider;
|
|
1043
1363
|
/**
|
|
1044
|
-
*
|
|
1364
|
+
* @inheritDoc
|
|
1045
1365
|
*/
|
|
1046
|
-
get
|
|
1366
|
+
get prefix(): string;
|
|
1047
1367
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
* references of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
1050
|
-
*
|
|
1051
|
-
* @template TTransformerInput
|
|
1052
|
-
* Transformer input type.
|
|
1053
|
-
*
|
|
1054
|
-
* @param valueOrValues
|
|
1055
|
-
* Numeric value(s).
|
|
1056
|
-
*
|
|
1057
|
-
* @param sparse
|
|
1058
|
-
* If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.
|
|
1059
|
-
*
|
|
1060
|
-
* @returns
|
|
1061
|
-
* Identifier(s).
|
|
1368
|
+
* @inheritDoc
|
|
1062
1369
|
*/
|
|
1063
|
-
|
|
1370
|
+
get referenceLength(): number;
|
|
1064
1371
|
/**
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
* The implementation creates the strings only as needed using an internal generator function. Although the result
|
|
1068
|
-
* is equivalent to calling `creator.create(new Sequence(0, creator.capacity))`, this method is significantly
|
|
1069
|
-
* faster.
|
|
1070
|
-
*
|
|
1071
|
-
* @returns
|
|
1072
|
-
* All identifiers for the prefix.
|
|
1372
|
+
* @inheritDoc
|
|
1073
1373
|
*/
|
|
1074
|
-
|
|
1374
|
+
abstract validate(identifier: string, validation?: TIdentifierValidation): void;
|
|
1075
1375
|
}
|
|
1376
|
+
|
|
1076
1377
|
/**
|
|
1077
|
-
* Abstract numeric identifier creator. Implements common functionality for a numeric identifier
|
|
1078
|
-
*
|
|
1378
|
+
* Abstract numeric identifier creator. Implements common functionality for a numeric identifier creator.
|
|
1379
|
+
*
|
|
1380
|
+
* @template TNumericIdentifierDescriptor
|
|
1381
|
+
* Numeric identifier descriptor type.
|
|
1079
1382
|
*/
|
|
1080
|
-
declare abstract class AbstractNumericIdentifierCreator extends AbstractIdentifierCreator implements NumericIdentifierCreator {
|
|
1383
|
+
declare abstract class AbstractNumericIdentifierCreator<TNumericIdentifierDescriptor extends NumericIdentifierDescriptor> extends AbstractIdentifierCreator<TNumericIdentifierDescriptor, NumericIdentifierValidation> implements NumericIdentifierCreator<TNumericIdentifierDescriptor> {
|
|
1081
1384
|
/**
|
|
1082
1385
|
* Capacity.
|
|
1083
1386
|
*/
|
|
@@ -1096,17 +1399,20 @@ declare abstract class AbstractNumericIdentifierCreator extends AbstractIdentifi
|
|
|
1096
1399
|
* Prefix within prefix manager to use to calculate reference length.
|
|
1097
1400
|
*/
|
|
1098
1401
|
protected init(prefixProvider: PrefixProvider, prefix: string): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Get the leader type.
|
|
1404
|
+
*/
|
|
1099
1405
|
abstract get leaderType(): LeaderType;
|
|
1100
1406
|
/**
|
|
1101
1407
|
* @inheritDoc
|
|
1102
1408
|
*/
|
|
1103
1409
|
get capacity(): number;
|
|
1104
1410
|
/**
|
|
1105
|
-
*
|
|
1411
|
+
* @inheritDoc
|
|
1106
1412
|
*/
|
|
1107
1413
|
get tweak(): bigint;
|
|
1108
1414
|
/**
|
|
1109
|
-
*
|
|
1415
|
+
* @inheritDoc
|
|
1110
1416
|
*/
|
|
1111
1417
|
set tweak(value: bigint);
|
|
1112
1418
|
/**
|
|
@@ -1134,8 +1440,8 @@ declare abstract class AbstractNumericIdentifierCreator extends AbstractIdentifi
|
|
|
1134
1440
|
* Remaining reference length. Initial value is `this.referenceLength`.
|
|
1135
1441
|
*
|
|
1136
1442
|
* @param extensionWeight
|
|
1137
|
-
* If this value is not zero, the identifier has an extension digit, this call is setting it, and this value
|
|
1138
|
-
*
|
|
1443
|
+
* If this value is not zero, the identifier has an extension digit, this call is setting it, and this value is
|
|
1444
|
+
* applied to the calculation of the check digit.
|
|
1139
1445
|
*
|
|
1140
1446
|
* @param weight
|
|
1141
1447
|
* If the extension weight is zero, this value is applied to the calculation of the check digit.
|
|
@@ -1153,7 +1459,7 @@ declare abstract class AbstractNumericIdentifierCreator extends AbstractIdentifi
|
|
|
1153
1459
|
createAll(): Iterable<string>;
|
|
1154
1460
|
}
|
|
1155
1461
|
|
|
1156
|
-
declare const GTINCreator_base: ts_mixer_dist_types_types.Class<any[], GTINValidator & AbstractNumericIdentifierCreator
|
|
1462
|
+
declare const GTINCreator_base: ts_mixer_dist_types_types.Class<any[], GTINValidator & AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>, typeof GTINValidator & (abstract new () => AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>)>;
|
|
1157
1463
|
/**
|
|
1158
1464
|
* GTIN creator. Applicable to GTIN-13, GTIN-12, and GTIN-8 types; no applicable to GTIN-14 type.
|
|
1159
1465
|
*/
|
|
@@ -1169,10 +1475,10 @@ declare class GTINCreator extends GTINCreator_base {
|
|
|
1169
1475
|
* @param prefixProvider
|
|
1170
1476
|
* Prefix provider.
|
|
1171
1477
|
*
|
|
1172
|
-
* @param
|
|
1173
|
-
* GTIN type.
|
|
1478
|
+
* @param gtinBaseType
|
|
1479
|
+
* GTIN base type (all except GTIN-14).
|
|
1174
1480
|
*/
|
|
1175
|
-
constructor(prefixProvider: PrefixProvider,
|
|
1481
|
+
constructor(prefixProvider: PrefixProvider, gtinBaseType: GTINBaseType);
|
|
1176
1482
|
/**
|
|
1177
1483
|
* @inheritDoc
|
|
1178
1484
|
*/
|
|
@@ -1216,7 +1522,7 @@ declare class GTINCreator extends GTINCreator_base {
|
|
|
1216
1522
|
static createVariableMeasureRCN(format: string, itemReference: number, priceOrWeight: number): string;
|
|
1217
1523
|
}
|
|
1218
1524
|
|
|
1219
|
-
declare const NonGTINNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], NonGTINNumericIdentifierValidator & AbstractNumericIdentifierCreator
|
|
1525
|
+
declare const NonGTINNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], NonGTINNumericIdentifierValidator & AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>, typeof NonGTINNumericIdentifierValidator & (abstract new () => AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>)>;
|
|
1220
1526
|
/**
|
|
1221
1527
|
* Non-GTIN numeric identifier creator.
|
|
1222
1528
|
*/
|
|
@@ -1230,17 +1536,11 @@ declare class NonGTINNumericIdentifierCreator extends NonGTINNumericIdentifierCr
|
|
|
1230
1536
|
*
|
|
1231
1537
|
* @param identifierType
|
|
1232
1538
|
* Identifier type.
|
|
1233
|
-
*
|
|
1234
|
-
* @param length
|
|
1235
|
-
* Length.
|
|
1236
|
-
*
|
|
1237
|
-
* @param leaderType
|
|
1238
|
-
* Leader type.
|
|
1239
1539
|
*/
|
|
1240
|
-
constructor(prefixProvider: PrefixProvider, identifierType:
|
|
1540
|
+
constructor(prefixProvider: PrefixProvider, identifierType: Exclude<NonGTINNumericIdentifierType, SerializableNumericIdentifierType>);
|
|
1241
1541
|
}
|
|
1242
1542
|
|
|
1243
|
-
declare const SerializableNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], SerializableNumericIdentifierValidator & AbstractNumericIdentifierCreator
|
|
1543
|
+
declare const SerializableNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], SerializableNumericIdentifierValidator & AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>, typeof SerializableNumericIdentifierValidator & (abstract new () => AbstractNumericIdentifierCreator<NumericIdentifierDescriptor>)>;
|
|
1244
1544
|
/**
|
|
1245
1545
|
* Serializable numeric identifier creator.
|
|
1246
1546
|
*/
|
|
@@ -1254,17 +1554,8 @@ declare class SerializableNumericIdentifierCreator extends SerializableNumericId
|
|
|
1254
1554
|
*
|
|
1255
1555
|
* @param identifierType
|
|
1256
1556
|
* Identifier type.
|
|
1257
|
-
*
|
|
1258
|
-
* @param length
|
|
1259
|
-
* Length.
|
|
1260
|
-
*
|
|
1261
|
-
* @param serialComponentLength
|
|
1262
|
-
* Serial component length.
|
|
1263
|
-
*
|
|
1264
|
-
* @param serialComponentCharacterSet
|
|
1265
|
-
* Serial component character set.
|
|
1266
1557
|
*/
|
|
1267
|
-
constructor(prefixProvider: PrefixProvider, identifierType:
|
|
1558
|
+
constructor(prefixProvider: PrefixProvider, identifierType: SerializableNumericIdentifierType);
|
|
1268
1559
|
/**
|
|
1269
1560
|
* Concatenate a validated base identifier with serial component(s).
|
|
1270
1561
|
*
|
|
@@ -1319,7 +1610,7 @@ declare class SerializableNumericIdentifierCreator extends SerializableNumericId
|
|
|
1319
1610
|
concatenate<TTransformerInput extends TransformerInput<string>>(baseIdentifier: string, serialComponentOrComponents: TTransformerInput): TransformerOutput<TTransformerInput, string>;
|
|
1320
1611
|
}
|
|
1321
1612
|
|
|
1322
|
-
declare const NonNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], NonNumericIdentifierValidator & AbstractIdentifierCreator, typeof NonNumericIdentifierValidator &
|
|
1613
|
+
declare const NonNumericIdentifierCreator_base: ts_mixer_dist_types_types.Class<any[], NonNumericIdentifierValidator & AbstractIdentifierCreator<IdentifierDescriptor, IdentifierValidation>, typeof NonNumericIdentifierValidator & (abstract new () => AbstractIdentifierCreator<IdentifierDescriptor, IdentifierValidation>)>;
|
|
1323
1614
|
/**
|
|
1324
1615
|
* Non-numeric identifier creator.
|
|
1325
1616
|
*/
|
|
@@ -1337,17 +1628,8 @@ declare class NonNumericIdentifierCreator extends NonNumericIdentifierCreator_ba
|
|
|
1337
1628
|
*
|
|
1338
1629
|
* @param identifierType
|
|
1339
1630
|
* Identifier type.
|
|
1340
|
-
*
|
|
1341
|
-
* @param length
|
|
1342
|
-
* Length.
|
|
1343
|
-
*
|
|
1344
|
-
* @param referenceCharacterSet
|
|
1345
|
-
* Reference character set.
|
|
1346
|
-
*
|
|
1347
|
-
* @param requiresCheckCharacterPair
|
|
1348
|
-
* True if the identifier requires a check character pair.
|
|
1349
1631
|
*/
|
|
1350
|
-
constructor(prefixProvider: PrefixProvider, identifierType:
|
|
1632
|
+
constructor(prefixProvider: PrefixProvider, identifierType: NonNumericIdentifierType);
|
|
1351
1633
|
/**
|
|
1352
1634
|
* Get the reference validation parameters.
|
|
1353
1635
|
*/
|
|
@@ -1367,26 +1649,96 @@ declare class NonNumericIdentifierCreator extends NonNumericIdentifierCreator_ba
|
|
|
1367
1649
|
create<TTransformerInput extends TransformerInput<string>>(referenceOrReferences: TTransformerInput): TransformerOutput<TTransformerInput, string>;
|
|
1368
1650
|
}
|
|
1369
1651
|
|
|
1652
|
+
/**
|
|
1653
|
+
* Determine the identifier creator type for an identifier type.
|
|
1654
|
+
*
|
|
1655
|
+
* @template TIdentifierType
|
|
1656
|
+
* Identifier type type.
|
|
1657
|
+
*/
|
|
1658
|
+
type IdentifierTypeCreator<TIdentifierType extends IdentifierType> = TIdentifierType extends NonNumericIdentifierType ? NonNumericIdentifierCreator : TIdentifierType extends SerializableNumericIdentifierType ? SerializableNumericIdentifierCreator : TIdentifierType extends NonGTINNumericIdentifierType ? NonGTINNumericIdentifierCreator : TIdentifierType extends typeof IdentifierTypes.GTIN ? GTINCreator : IdentifierCreator;
|
|
1659
|
+
/**
|
|
1660
|
+
* Identifier creators entry type based on identifier type type.
|
|
1661
|
+
*
|
|
1662
|
+
* @template TIdentifierType
|
|
1663
|
+
* Identifier type type.
|
|
1664
|
+
*/
|
|
1665
|
+
type IdentifierCreatorsEntry<TIdentifierType extends IdentifierType> = IdentifierTypeCreator<TIdentifierType>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Identifier creators record type.
|
|
1668
|
+
*/
|
|
1669
|
+
type IdentifierCreatorsRecord = {
|
|
1670
|
+
[TIdentifierType in IdentifierType]: IdentifierCreatorsEntry<TIdentifierType>;
|
|
1671
|
+
};
|
|
1672
|
+
/**
|
|
1673
|
+
* Determine if identifier creator is a numeric identifier creator.
|
|
1674
|
+
*
|
|
1675
|
+
* @param identifierCreator
|
|
1676
|
+
* Identifier creator.
|
|
1677
|
+
*
|
|
1678
|
+
* @returns
|
|
1679
|
+
* True if identifier creator is a numeric identifier creator.
|
|
1680
|
+
*/
|
|
1681
|
+
declare function isNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NumericIdentifierCreator;
|
|
1682
|
+
/**
|
|
1683
|
+
* Determine if identifier creator is a GTIN creator.
|
|
1684
|
+
*
|
|
1685
|
+
* @param identifierCreator
|
|
1686
|
+
* Identifier creator.
|
|
1687
|
+
*
|
|
1688
|
+
* @returns
|
|
1689
|
+
* True if identifier creator is a GTIN creator.
|
|
1690
|
+
*/
|
|
1691
|
+
declare function isGTINCreator(identifierCreator: IdentifierCreator): identifierCreator is GTINCreator;
|
|
1692
|
+
/**
|
|
1693
|
+
* Determine if identifier creator is a non-GTIN numeric identifier creator.
|
|
1694
|
+
*
|
|
1695
|
+
* @param identifierCreator
|
|
1696
|
+
* Identifier creator.
|
|
1697
|
+
*
|
|
1698
|
+
* @returns
|
|
1699
|
+
* True if identifier creator is a non-GTIN numeric identifier creator.
|
|
1700
|
+
*/
|
|
1701
|
+
declare function isNonGTINNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonGTINNumericIdentifierCreator;
|
|
1702
|
+
/**
|
|
1703
|
+
* Determine if identifier creator is a serializable numeric identifier creator.
|
|
1704
|
+
*
|
|
1705
|
+
* @param identifierCreator
|
|
1706
|
+
* Identifier creator.
|
|
1707
|
+
*
|
|
1708
|
+
* @returns
|
|
1709
|
+
* True if identifier creator is a serializable numeric identifier creator.
|
|
1710
|
+
*/
|
|
1711
|
+
declare function isSerializableNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is SerializableNumericIdentifierCreator;
|
|
1712
|
+
/**
|
|
1713
|
+
* Determine if identifier creator is a non-numeric identifier creator.
|
|
1714
|
+
*
|
|
1715
|
+
* @param identifierCreator
|
|
1716
|
+
* Identifier creator.
|
|
1717
|
+
*
|
|
1718
|
+
* @returns
|
|
1719
|
+
* True if identifier creator is a non-numeric identifier creator.
|
|
1720
|
+
*/
|
|
1721
|
+
declare function isNonNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonNumericIdentifierCreator;
|
|
1722
|
+
|
|
1370
1723
|
/**
|
|
1371
1724
|
* Prefix manager. This is the core class for identifier creation.
|
|
1372
1725
|
*
|
|
1373
|
-
* A prefix manager may be
|
|
1374
|
-
*
|
|
1726
|
+
* A prefix manager may be constructed for any {@link PrefixType | prefix type}. Construction may be done directly or
|
|
1727
|
+
* via the static {@linkcode PrefixManager.get | get()} method, which allows for caching and reuse. As most applications
|
|
1728
|
+
* work with a limited number of prefixes for creating identifiers, caching and reuse may be a more efficient option.
|
|
1375
1729
|
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
* prefix equal to "614141".
|
|
1730
|
+
* The prefix type and prefix are normalized before the prefix manager is constructed, so they may not match the input
|
|
1731
|
+
* values. For example, the GS1 Company Prefix 0614141 is equivalent to U.P.C. Company Prefix 614141; both result in a
|
|
1732
|
+
* prefix manager with prefix type equal to {@linkcode PrefixTypes.UPCCompanyPrefix} and prefix equal to "614141".
|
|
1380
1733
|
*
|
|
1381
|
-
* To support the creation of sparse identifiers, a prefix manager maintains a {@link tweakFactor | tweak
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1389
|
-
* sequence.
|
|
1734
|
+
* To support the creation of sparse identifiers, a prefix manager maintains a {@link tweakFactor | tweak factor} which
|
|
1735
|
+
* is used, along with a type-specific multiplier, as the tweak when creating numeric identifiers. The default tweak
|
|
1736
|
+
* factor is the numeric value of the GS1 Company Prefix representation of the prefix preceded by '1' to ensure
|
|
1737
|
+
* uniqueness (i.e., so that prefixes 0 N1 N2 N3... and N1 N2 N3... produce different tweak factors). This is usually
|
|
1738
|
+
* sufficient for obfuscation, but as the sparse creation algorithm is reversible and as the GS1 Company Prefix is
|
|
1739
|
+
* discoverable via {@link https://www.gs1.org/services/verified-by-gs1 | Verified by GS1}, a user-defined tweak factor
|
|
1740
|
+
* should be used if a higher degree of obfuscation is required. When using a tweak factor other than the default, care
|
|
1741
|
+
* should be taken to restore it when resuming the application. A tweak factor of 0 creates a straight sequence.
|
|
1390
1742
|
*/
|
|
1391
1743
|
declare class PrefixManager implements PrefixProvider {
|
|
1392
1744
|
/**
|
|
@@ -1411,11 +1763,11 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1411
1763
|
*/
|
|
1412
1764
|
private readonly _gs1CompanyPrefix;
|
|
1413
1765
|
/**
|
|
1414
|
-
* U.P.C. Company Prefix if prefix type is {@
|
|
1766
|
+
* U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix}.
|
|
1415
1767
|
*/
|
|
1416
1768
|
private readonly _upcCompanyPrefix;
|
|
1417
1769
|
/**
|
|
1418
|
-
* GS1-8 Prefix if prefix type is {@
|
|
1770
|
+
* GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix}.
|
|
1419
1771
|
*/
|
|
1420
1772
|
private readonly _gs18Prefix;
|
|
1421
1773
|
/**
|
|
@@ -1433,10 +1785,13 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1433
1785
|
/**
|
|
1434
1786
|
* Constructor.
|
|
1435
1787
|
*
|
|
1436
|
-
* @param
|
|
1437
|
-
*
|
|
1788
|
+
* @param prefixType
|
|
1789
|
+
* Prefix type.
|
|
1790
|
+
*
|
|
1791
|
+
* @param prefix
|
|
1792
|
+
* Prefix.
|
|
1438
1793
|
*/
|
|
1439
|
-
|
|
1794
|
+
constructor(prefixType: PrefixType, prefix: string);
|
|
1440
1795
|
/**
|
|
1441
1796
|
* Get the prefix type.
|
|
1442
1797
|
*/
|
|
@@ -1450,17 +1805,17 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1450
1805
|
*/
|
|
1451
1806
|
get gs1CompanyPrefix(): string;
|
|
1452
1807
|
/**
|
|
1453
|
-
* Get the U.P.C. Company Prefix if prefix type is {@
|
|
1808
|
+
* Get the U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix} or undefined if not.
|
|
1454
1809
|
*/
|
|
1455
1810
|
get upcCompanyPrefix(): string | undefined;
|
|
1456
1811
|
/**
|
|
1457
|
-
* Get the GS1-8 Prefix if prefix type is {@
|
|
1812
|
+
* Get the GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix} or undefined if not.
|
|
1458
1813
|
*/
|
|
1459
1814
|
get gs18Prefix(): string | undefined;
|
|
1460
1815
|
/**
|
|
1461
1816
|
* Set the tweak for an identifier creator if it's a numeric identifier creator.
|
|
1462
1817
|
*
|
|
1463
|
-
* @param
|
|
1818
|
+
* @param identifierCreator
|
|
1464
1819
|
* Identifier creator.
|
|
1465
1820
|
*/
|
|
1466
1821
|
private setCreatorTweak;
|
|
@@ -1495,10 +1850,16 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1495
1850
|
/**
|
|
1496
1851
|
* Get an identifier creator.
|
|
1497
1852
|
*
|
|
1853
|
+
* @template TIdentifierType
|
|
1854
|
+
* Identifier type type.
|
|
1855
|
+
*
|
|
1498
1856
|
* @param identifierType
|
|
1499
|
-
* Identifier type.
|
|
1857
|
+
* Identifier type used to construct identifier creator.
|
|
1500
1858
|
*
|
|
1501
|
-
* @param
|
|
1859
|
+
* @param constructorParameter
|
|
1860
|
+
* Second constructor parameter passed to constructor callback alongside this.
|
|
1861
|
+
*
|
|
1862
|
+
* @param ConstructorCallback
|
|
1502
1863
|
* Constructor callback.
|
|
1503
1864
|
*
|
|
1504
1865
|
* @returns
|
|
@@ -1508,8 +1869,8 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1508
1869
|
/**
|
|
1509
1870
|
* Get non-GTIN numeric identifier creator.
|
|
1510
1871
|
*
|
|
1511
|
-
* @param
|
|
1512
|
-
*
|
|
1872
|
+
* @param identifierType
|
|
1873
|
+
* Identifier type used to construct identifier creator.
|
|
1513
1874
|
*
|
|
1514
1875
|
* @returns
|
|
1515
1876
|
* Identifier creator.
|
|
@@ -1518,8 +1879,8 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1518
1879
|
/**
|
|
1519
1880
|
* Get serialized numeric identifier creator.
|
|
1520
1881
|
*
|
|
1521
|
-
* @param
|
|
1522
|
-
*
|
|
1882
|
+
* @param identifierType
|
|
1883
|
+
* Identifier type used to construct identifier creator.
|
|
1523
1884
|
*
|
|
1524
1885
|
* @returns
|
|
1525
1886
|
* Identifier creator.
|
|
@@ -1528,8 +1889,8 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1528
1889
|
/**
|
|
1529
1890
|
* Get non-numeric identifier creator.
|
|
1530
1891
|
*
|
|
1531
|
-
* @param
|
|
1532
|
-
*
|
|
1892
|
+
* @param identifierType
|
|
1893
|
+
* Identifier type used to construct identifier creator.
|
|
1533
1894
|
*
|
|
1534
1895
|
* @returns
|
|
1535
1896
|
* Identifier creator.
|
|
@@ -1585,4 +1946,4 @@ declare class PrefixManager implements PrefixProvider {
|
|
|
1585
1946
|
get gmnCreator(): NonNumericIdentifierCreator;
|
|
1586
1947
|
}
|
|
1587
1948
|
|
|
1588
|
-
export { AI39_CREATOR, AI39_VALIDATOR, AI64_VALIDATOR, AI82_CREATOR, AI82_VALIDATOR,
|
|
1949
|
+
export { AI39_CREATOR, AI39_VALIDATOR, AI64_VALIDATOR, AI82_CREATOR, AI82_VALIDATOR, type ContentCharacterSet, type ContentCharacterSetKey, ContentCharacterSets, type GS1LocaleResources, type GTINBaseType, GTINCreator, type GTINDescriptor, type GTINLevel, GTINLevels, type GTINType, type GTINTypeKey, GTINTypes, GTINValidator, GTIN_BASE_TYPES, type IdentifierCreator, type IdentifierCreatorsEntry, type IdentifierCreatorsRecord, type IdentifierDescriptor, IdentifierDescriptors, type IdentifierDescriptorsEntry, type IdentifierDescriptorsRecord, type IdentifierType, type IdentifierTypeCreator, type IdentifierTypeDescriptor, type IdentifierTypeKey, type IdentifierTypeValidator, IdentifierTypes, type IdentifierValidation, type IdentifierValidator, IdentifierValidators, type IdentifierValidatorsEntry, type IdentifierValidatorsRecord, type LeaderType, type LeaderTypeKey, LeaderTypes, NonGTINNumericIdentifierCreator, type NonGTINNumericIdentifierDescriptor, type NonGTINNumericIdentifierType, NonGTINNumericIdentifierValidator, NonNumericIdentifierCreator, type NonNumericIdentifierDescriptor, type NonNumericIdentifierType, type NonNumericIdentifierValidation, NonNumericIdentifierValidator, type NumericIdentifierCreator, type NumericIdentifierDescriptor, type NumericIdentifierType, type NumericIdentifierValidation, type NumericIdentifierValidator, PrefixManager, type PrefixType, type PrefixTypeKey, PrefixTypes, type PrefixValidation, PrefixValidator, type RCNReference, SerializableNumericIdentifierCreator, type SerializableNumericIdentifierDescriptor, type SerializableNumericIdentifierType, SerializableNumericIdentifierValidator, checkCharacterPair, checkDigit, checkDigitSum, gs1NS, gs1Resources, hasValidCheckCharacterPair, hasValidCheckDigit, i18nGS1Init, i18nextGS1, isGTINCreator, isGTINDescriptor, isGTINDescriptors, isGTINValidator, isGTINValidators, isNonGTINNumericIdentifierCreator, isNonGTINNumericIdentifierDescriptor, isNonGTINNumericIdentifierValidator, isNonNumericIdentifierCreator, isNonNumericIdentifierDescriptor, isNonNumericIdentifierValidator, isNumericIdentifierCreator, isNumericIdentifierDescriptor, isNumericIdentifierValidator, isSerializableNumericIdentifierCreator, isSerializableNumericIdentifierDescriptor, isSerializableNumericIdentifierValidator, isValidPriceOrWeightCheckDigit, priceOrWeightCheckDigit };
|