@aidc-toolkit/gs1 0.9.3 → 0.9.5

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.
@@ -0,0 +1,1436 @@
1
+ import { CharacterSetCreator, StringValidation, StringValidator, CharacterSetValidator, CharacterSetValidation, Exclusion } from '@aidc-toolkit/utility';
2
+ import * as ts_mixer_dist_types_types_js from 'ts-mixer/dist/types/types.js';
3
+
4
+ /**
5
+ * GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1
6
+ * General Specifications}. Supports {@linkcode Exclusion.AllNumeric}.
7
+ */
8
+ declare const AI82_CREATOR: CharacterSetCreator;
9
+ /**
10
+ * GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1
11
+ * General Specifications}. Supports {@linkcode Exclusion.AllNumeric}.
12
+ */
13
+ declare const AI39_CREATOR: CharacterSetCreator;
14
+
15
+ /**
16
+ * Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link https://www.gs1.org/genspecs |
17
+ * GS1 General Specifications}.
18
+ *
19
+ * @param exchangeWeights
20
+ * If true, start the weights at 1 instead of 3 on the right.
21
+ *
22
+ * @param s
23
+ * Numeric string.
24
+ *
25
+ * @returns
26
+ * Accumulated sum of each digit multiplied by the weight at its position.
27
+ */
28
+ declare function checkDigitSum(exchangeWeights: boolean, s: string): number;
29
+ /**
30
+ * Calculate the check digit for a numeric string as per section 7.9.1 of the {@link https://www.gs1.org/genspecs | GS1
31
+ * General Specifications}.
32
+ *
33
+ * @param s
34
+ * Numeric string.
35
+ *
36
+ * @returns
37
+ * Check digit 0-9 as a string.
38
+ */
39
+ declare function checkDigit(s: string): string;
40
+ /**
41
+ * Determine if a numeric string has a valid check digit.
42
+ *
43
+ * @param s
44
+ * Numeric string with check digit.
45
+ *
46
+ * @returns
47
+ * True if the check digit is valid.
48
+ */
49
+ declare function hasValidCheckDigit(s: string): boolean;
50
+ /**
51
+ * Calculate the price/weight check digit for a four-digit numeric string as per section 7.9.3 of the {@link
52
+ * https://www.gs1.org/genspecs | GS1 General Specifications}.
53
+ *
54
+ * @param s
55
+ * Numeric string exactly four characters long.
56
+ *
57
+ * @returns
58
+ * Check digit 0-9 as a string.
59
+ */
60
+ declare function fourDigitPriceWeightCheckDigit(s: string): string;
61
+ /**
62
+ * Calculate the price/weight check digit for a five-digit numeric string as per section 7.9.3 of the {@link
63
+ * https://www.gs1.org/genspecs | GS1 General Specifications}.
64
+ *
65
+ * @param s
66
+ * Numeric string exactly five characters long.
67
+ *
68
+ * @returns
69
+ * Check digit 0-9 as a string.
70
+ */
71
+ declare function fiveDigitPriceWeightCheckDigit(s: string): string;
72
+ /**
73
+ * Calculate the check character for a GS1 AI encodable character set 82 string as per section 7.9.5 of the {@link
74
+ * https://www.gs1.org/genspecs | GS1 General Specifications}.
75
+ *
76
+ * @param s
77
+ * GS1 AI encodable character set 82 string.
78
+ *
79
+ * @returns
80
+ * Check character pair.
81
+ */
82
+ declare function checkCharacterPair(s: string): string;
83
+ /**
84
+ * Determine if a GS1 AI encodable character set 82 string has a valid check character pair.
85
+ *
86
+ * @param s
87
+ * GS1 AI encodable character set 82 string with check character pair.
88
+ *
89
+ * @returns
90
+ * True if the check character pair is valid.
91
+ */
92
+ declare function hasValidCheckCharacterPair(s: string): boolean;
93
+
94
+ /**
95
+ * Identification key type.
96
+ */
97
+ declare enum IdentificationKeyType {
98
+ /**
99
+ * Global Trade Item Number.
100
+ */
101
+ GTIN = "GTIN",
102
+ /**
103
+ * Global Location Number.
104
+ */
105
+ GLN = "GLN",
106
+ /**
107
+ * Serial Shipping Container Code.
108
+ */
109
+ SSCC = "SSCC",
110
+ /**
111
+ * Global Returnable Asset Identifier.
112
+ */
113
+ GRAI = "GRAI",
114
+ /**
115
+ * Global Individual Asset Identifier.
116
+ */
117
+ GIAI = "GIAI",
118
+ /**
119
+ * Global Service Relation Number.
120
+ */
121
+ GSRN = "GSRN",
122
+ /**
123
+ * Global Document Type Identifier.
124
+ */
125
+ GDTI = "GDTI",
126
+ /**
127
+ * Global Identification Number for Consignment.
128
+ */
129
+ GINC = "GINC",
130
+ /**
131
+ * Global Shipment Identification Number.
132
+ */
133
+ GSIN = "GSIN",
134
+ /**
135
+ * Global Coupon Number.
136
+ */
137
+ GCN = "GCN",
138
+ /**
139
+ * Component/Part Identifier.
140
+ */
141
+ CPID = "CPID",
142
+ /**
143
+ * Global Model Number.
144
+ */
145
+ GMN = "GMN"
146
+ }
147
+ /**
148
+ * Prefix type.
149
+ */
150
+ declare enum PrefixType {
151
+ /**
152
+ * GS1 Company Prefix.
153
+ */
154
+ GS1CompanyPrefix = 0,
155
+ /**
156
+ * U.P.C. Company Prefix.
157
+ */
158
+ UPCCompanyPrefix = 1,
159
+ /**
160
+ * GS1-8 Prefix.
161
+ */
162
+ GS18Prefix = 2
163
+ }
164
+ /**
165
+ * Character set supported by the reference portion of an identification key or the serial component of a numeric
166
+ * identification key.
167
+ */
168
+ declare enum CharacterSet {
169
+ /**
170
+ * Numeric.
171
+ */
172
+ Numeric = 0,
173
+ /**
174
+ * GS1 AI encodable character set 82.
175
+ */
176
+ AI82 = 1,
177
+ /**
178
+ * GS1 AI encodable character set 39.
179
+ */
180
+ AI39 = 2
181
+ }
182
+ /**
183
+ * Identification key validation parameters.
184
+ */
185
+ interface IdentificationKeyValidation extends StringValidation {
186
+ /**
187
+ * Position offset within a larger string. Strings are sometimes composed of multiple substrings; this parameter
188
+ * ensures that the error notes the proper position in the string.
189
+ */
190
+ positionOffset?: number | undefined;
191
+ }
192
+ /**
193
+ * Identification key validator. Validates an identification key against its definition in section 3 of the {@link
194
+ * https://www.gs1.org/genspecs | GS1 General Specifications}.
195
+ */
196
+ interface IdentificationKeyValidator<V extends IdentificationKeyValidation = IdentificationKeyValidation> extends StringValidator<V> {
197
+ /**
198
+ * Get the identification key type. Per the GS1 General Specifications, the identification key type determines
199
+ * the remaining properties.
200
+ */
201
+ get identificationKeyType(): IdentificationKeyType;
202
+ /**
203
+ * Get the prefix type supported by the identification key type. For all identification key types except the GTIN,
204
+ * this is {@linkcode PrefixType.GS1CompanyPrefix}. For the GTIN, the prefix type determines the length.
205
+ */
206
+ get prefixType(): PrefixType;
207
+ /**
208
+ * Get the length. For numeric identification key types, the length is fixed; for alphanumeric identification key
209
+ * types, the length is the maximum.
210
+ */
211
+ get length(): number;
212
+ /**
213
+ * Get the reference character set.
214
+ */
215
+ get referenceCharacterSet(): CharacterSet;
216
+ /**
217
+ * Get the reference validator.
218
+ */
219
+ get referenceValidator(): CharacterSetValidator;
220
+ /**
221
+ * Validate an identification key and throw an error if validation fails.
222
+ *
223
+ * @param identificationKey
224
+ * Identification key.
225
+ *
226
+ * @param validation
227
+ * Identification key validation parameters.
228
+ */
229
+ validate: (identificationKey: string, validation?: V) => void;
230
+ }
231
+ /**
232
+ * Abstract identification key validator. Implements common functionality for an identification key validator.
233
+ */
234
+ declare abstract class AbstractIdentificationKeyValidator<V extends IdentificationKeyValidation = IdentificationKeyValidation> implements IdentificationKeyValidator<V> {
235
+ private static readonly CHARACTER_SET_CREATORS;
236
+ /**
237
+ * Identification key type.
238
+ */
239
+ private readonly _identificationKeyType;
240
+ /**
241
+ * Prefix type.
242
+ */
243
+ private readonly _prefixType;
244
+ /**
245
+ * Length.
246
+ */
247
+ private readonly _length;
248
+ /**
249
+ * Reference character set.
250
+ */
251
+ private readonly _referenceCharacterSet;
252
+ /**
253
+ * Reference validator.
254
+ */
255
+ private readonly _referenceValidator;
256
+ /**
257
+ * Get the character set validator for a character set.
258
+ *
259
+ * @param characterSet
260
+ * Character set.
261
+ *
262
+ * @returns
263
+ * Character set validator.
264
+ */
265
+ protected static validatorFor(characterSet: CharacterSet): CharacterSetValidator;
266
+ /**
267
+ * Constructor.
268
+ *
269
+ * @param identificationKeyType
270
+ * Identification key type.
271
+ *
272
+ * @param prefixType
273
+ * Prefix type.
274
+ *
275
+ * @param length
276
+ * Length.
277
+ *
278
+ * @param referenceCharacterSet
279
+ * Reference character set.
280
+ */
281
+ protected constructor(identificationKeyType: IdentificationKeyType, prefixType: PrefixType, length: number, referenceCharacterSet: CharacterSet);
282
+ /**
283
+ * @inheritDoc
284
+ */
285
+ get identificationKeyType(): IdentificationKeyType;
286
+ /**
287
+ * @inheritDoc
288
+ */
289
+ get prefixType(): PrefixType;
290
+ /**
291
+ * @inheritDoc
292
+ */
293
+ get length(): number;
294
+ /**
295
+ * @inheritDoc
296
+ */
297
+ get referenceCharacterSet(): CharacterSet;
298
+ /**
299
+ * @inheritDoc
300
+ */
301
+ get referenceValidator(): CharacterSetValidator;
302
+ /**
303
+ * Pad an identification key on the left with zero-value character for validation purposes. This is done to align an
304
+ * identification key with a position offset for any error message that may be thrown by the reference validator.
305
+ *
306
+ * @param identificationKey
307
+ * Identification key.
308
+ *
309
+ * @param validation
310
+ * Identification key validation parameters.
311
+ *
312
+ * @returns
313
+ * Padded identification key.
314
+ */
315
+ protected padIdentificationKey(identificationKey: string, validation: IdentificationKeyValidation | undefined): string;
316
+ /**
317
+ * Validate the prefix within an identification key.
318
+ *
319
+ * @param partialIdentificationKey
320
+ * Partial identification key.
321
+ *
322
+ * @param positionOffset
323
+ * Position offset within a larger string.
324
+ */
325
+ protected validatePrefix(partialIdentificationKey: string, positionOffset?: number): void;
326
+ abstract validate(identificationKey: string, validation?: V): void;
327
+ }
328
+ /**
329
+ * Leader type.
330
+ */
331
+ declare enum LeaderType {
332
+ /**
333
+ * No leader.
334
+ */
335
+ None = 0,
336
+ /**
337
+ * Indicator digit (GTIN only).
338
+ */
339
+ IndicatorDigit = 1,
340
+ /**
341
+ * Extension digit (SSCC only).
342
+ */
343
+ ExtensionDigit = 2
344
+ }
345
+ /**
346
+ * Numeric identification key validator. Validates a numeric identification key.
347
+ */
348
+ interface NumericIdentificationKeyValidator extends IdentificationKeyValidator {
349
+ /**
350
+ * Get the leader type.
351
+ */
352
+ get leaderType(): LeaderType;
353
+ }
354
+ /**
355
+ * Abstract numeric identification key validator. Implements common functionality for a numeric identification key
356
+ * validator.
357
+ */
358
+ declare abstract class AbstractNumericIdentificationKeyValidator extends AbstractIdentificationKeyValidator implements NumericIdentificationKeyValidator {
359
+ /**
360
+ * Leader type.
361
+ */
362
+ private readonly _leaderType;
363
+ /**
364
+ * Prefix position, determined by the leader type.
365
+ */
366
+ private readonly _prefixPosition;
367
+ /**
368
+ * Constructor.
369
+ *
370
+ * @param identificationKeyType
371
+ * Identification key type.
372
+ *
373
+ * @param prefixType
374
+ * Prefix type.
375
+ *
376
+ * @param length
377
+ * Length.
378
+ *
379
+ * @param leaderType
380
+ * Leader type.
381
+ */
382
+ protected constructor(identificationKeyType: IdentificationKeyType, prefixType: PrefixType, length: number, leaderType: LeaderType);
383
+ /**
384
+ * @inheritDoc
385
+ */
386
+ get leaderType(): LeaderType;
387
+ /**
388
+ * @inheritDoc
389
+ */
390
+ validate(identificationKey: string, validation?: IdentificationKeyValidation): void;
391
+ }
392
+ /**
393
+ * GTIN type. The numeric values of this enumeration are equal to the lengths of the GTIN types.
394
+ */
395
+ declare enum GTINType {
396
+ /**
397
+ * GTIN-13.
398
+ */
399
+ GTIN13 = 13,
400
+ /**
401
+ * GTIN-12.
402
+ */
403
+ GTIN12 = 12,
404
+ /**
405
+ * GTIN-8.
406
+ */
407
+ GTIN8 = 8,
408
+ /**
409
+ * GTIN-14.
410
+ */
411
+ GTIN14 = 14
412
+ }
413
+ /**
414
+ * Level at which GTIN is to be validated.
415
+ */
416
+ declare enum GTINLevel {
417
+ /**
418
+ * Any level (level is ignored).
419
+ */
420
+ Any = 0,
421
+ /**
422
+ * Retail consumer trade item level, supporting GTIN-13, GTIN-12 (optionally zero-suppressed), and GTIN-8.
423
+ */
424
+ RetailConsumer = 1,
425
+ /**
426
+ * Other than retail consumer trade item level, supporting GTIN-13, GTIN-12 (not zero-suppressed), and GTIN-14.
427
+ */
428
+ OtherThanRetailConsumer = 2
429
+ }
430
+ /**
431
+ * GTIN validator.
432
+ */
433
+ declare class GTINValidator extends AbstractNumericIdentificationKeyValidator {
434
+ /**
435
+ * Zero-suppressed GTIN-12 validation parameters.
436
+ */
437
+ private static readonly ZERO_SUPPRESSED_GTIN12_VALIDATION;
438
+ /**
439
+ * Constructor.
440
+ *
441
+ * @param gtinType
442
+ * GTIN type.
443
+ */
444
+ constructor(gtinType: GTINType);
445
+ /**
446
+ * @inheritDoc
447
+ */
448
+ get gtinType(): GTINType;
449
+ /**
450
+ * @inheritDoc
451
+ */
452
+ protected validatePrefix(partialIdentificationKey: string, positionOffset?: number): void;
453
+ /**
454
+ * Zero expand a zero-suppressed GTIN-12.
455
+ *
456
+ * @param zeroSuppressedGTIN12
457
+ * Zero-suppressed GTIN-12.
458
+ *
459
+ * @returns
460
+ * GTIN-12.
461
+ */
462
+ static zeroExpand(zeroSuppressedGTIN12: string): string;
463
+ /**
464
+ * Validate any GTIN, optionally against a level.
465
+ *
466
+ * @param gtin
467
+ * GTIN.
468
+ *
469
+ * @param gtinLevel
470
+ * Level at which GTIN is to be validated.
471
+ */
472
+ static validateAny(gtin: string, gtinLevel?: GTINLevel): void;
473
+ /**
474
+ * Validate a GTIN-14.
475
+ *
476
+ * @param gtin14
477
+ * GTIN-14.
478
+ */
479
+ static validateGTIN14(gtin14: string): void;
480
+ }
481
+ /**
482
+ * Non-GTIN numeric identification key validator.
483
+ */
484
+ declare class NonGTINNumericIdentificationKeyValidator extends AbstractNumericIdentificationKeyValidator {
485
+ /**
486
+ * Constructor.
487
+ *
488
+ * @param identificationKeyType
489
+ * Identification key type.
490
+ *
491
+ * @param length
492
+ * Length.
493
+ *
494
+ * @param leaderType
495
+ * Leader type.
496
+ */
497
+ constructor(identificationKeyType: IdentificationKeyType, length: number, leaderType?: LeaderType);
498
+ }
499
+ /**
500
+ * Serializable numeric identification key validator. Validates both serialized and non-serialized forms of
501
+ * numeric identification keys that support serialization.
502
+ */
503
+ declare class SerializableNumericIdentificationKeyValidator extends NonGTINNumericIdentificationKeyValidator {
504
+ /**
505
+ * Serial component length.
506
+ */
507
+ private readonly _serialComponentLength;
508
+ /**
509
+ * Serial component character set.
510
+ */
511
+ private readonly _serialComponentCharacterSet;
512
+ /**
513
+ * Serial component validation parameters.
514
+ */
515
+ private readonly _serialComponentValidation;
516
+ /**
517
+ * Serial component validator.
518
+ */
519
+ private readonly _serialComponentValidator;
520
+ /**
521
+ * Constructor.
522
+ *
523
+ * @param identificationKeyType
524
+ * Identification key type.
525
+ *
526
+ * @param length
527
+ * Length.
528
+ *
529
+ * @param serialComponentLength
530
+ * Serial component length.
531
+ *
532
+ * @param serialComponentCharacterSet
533
+ * Serial component character set.
534
+ */
535
+ constructor(identificationKeyType: IdentificationKeyType, length: number, serialComponentLength: number, serialComponentCharacterSet: CharacterSet);
536
+ /**
537
+ * Get the serial component length.
538
+ */
539
+ get serialComponentLength(): number;
540
+ /**
541
+ * Get the serial component character set.
542
+ */
543
+ get serialComponentCharacterSet(): CharacterSet;
544
+ /**
545
+ * Get the serial component validation parameters.
546
+ */
547
+ protected get serialComponentValidation(): CharacterSetValidation;
548
+ /**
549
+ * Get the serial component validator.
550
+ */
551
+ get serialComponentValidator(): CharacterSetValidator;
552
+ /**
553
+ * @inheritDoc
554
+ */
555
+ validate(identificationKey: string, validation?: IdentificationKeyValidation): void;
556
+ }
557
+ /**
558
+ * Non-numeric identification key validation parameters.
559
+ */
560
+ interface NonNumericIdentificationKeyValidation extends IdentificationKeyValidation {
561
+ /**
562
+ * Exclusion support for reference. Prevents non-numeric identification key from being mistaken for numeric
563
+ * identification key.
564
+ */
565
+ exclusion?: Exclusion.None | Exclusion.AllNumeric | undefined;
566
+ }
567
+ /**
568
+ * Non-numeric identification key validator.
569
+ */
570
+ declare class NonNumericIdentificationKeyValidator extends AbstractIdentificationKeyValidator<NonNumericIdentificationKeyValidation> {
571
+ /**
572
+ * Validator to ensure that an identification key (minus check character pair) is not all numeric.
573
+ */
574
+ private static readonly NOT_ALL_NUMERIC_VALIDATOR;
575
+ /**
576
+ * True if the identification key requires a check character pair.
577
+ */
578
+ private readonly _requiresCheckCharacterPair;
579
+ /**
580
+ * Constructor.
581
+ *
582
+ * @param identificationKeyType
583
+ * Identification key type.
584
+ *
585
+ * @param length
586
+ * Length.
587
+ *
588
+ * @param referenceCharacterSet
589
+ * Reference character set.
590
+ *
591
+ * @param requiresCheckCharacterPair
592
+ * True if the identification key requires a check character pair.
593
+ */
594
+ constructor(identificationKeyType: IdentificationKeyType, length: number, referenceCharacterSet: CharacterSet, requiresCheckCharacterPair?: boolean);
595
+ /**
596
+ * Determine if the identification key requires a check character pair.
597
+ */
598
+ get requiresCheckCharacterPair(): boolean;
599
+ /**
600
+ * Validate a non-numeric identification key and throw an error if validation fails.
601
+ *
602
+ * @param identificationKey
603
+ * Identification key.
604
+ *
605
+ * @param validation
606
+ * Validation parameters.
607
+ */
608
+ validate(identificationKey: string, validation?: NonNumericIdentificationKeyValidation): void;
609
+ }
610
+ /**
611
+ * GTIN-13 validator.
612
+ */
613
+ declare const GTIN13_VALIDATOR: GTINValidator;
614
+ /**
615
+ * GTIN-12 validator.
616
+ */
617
+ declare const GTIN12_VALIDATOR: GTINValidator;
618
+ /**
619
+ * GTIN-8 validator.
620
+ */
621
+ declare const GTIN8_VALIDATOR: GTINValidator;
622
+ /**
623
+ * GTIN validators indexed by prefix type.
624
+ */
625
+ declare const GTIN_VALIDATORS: GTINValidator[];
626
+ /**
627
+ * GLN validator.
628
+ */
629
+ declare const GLN_VALIDATOR: NonGTINNumericIdentificationKeyValidator;
630
+ /**
631
+ * SSCC validator.
632
+ */
633
+ declare const SSCC_VALIDATOR: NonGTINNumericIdentificationKeyValidator;
634
+ /**
635
+ * GRAI validator.
636
+ */
637
+ declare const GRAI_VALIDATOR: SerializableNumericIdentificationKeyValidator;
638
+ /**
639
+ * GIAI validator.
640
+ */
641
+ declare const GIAI_VALIDATOR: NonNumericIdentificationKeyValidator;
642
+ /**
643
+ * GSRN validator.
644
+ */
645
+ declare const GSRN_VALIDATOR: NonGTINNumericIdentificationKeyValidator;
646
+ /**
647
+ * GDTI validator.
648
+ */
649
+ declare const GDTI_VALIDATOR: SerializableNumericIdentificationKeyValidator;
650
+ /**
651
+ * GINC validator.
652
+ */
653
+ declare const GINC_VALIDATOR: NonNumericIdentificationKeyValidator;
654
+ /**
655
+ * GSIN validator.
656
+ */
657
+ declare const GSIN_VALIDATOR: NonGTINNumericIdentificationKeyValidator;
658
+ /**
659
+ * GCN validator.
660
+ */
661
+ declare const GCN_VALIDATOR: SerializableNumericIdentificationKeyValidator;
662
+ /**
663
+ * CPID validator.
664
+ */
665
+ declare const CPID_VALIDATOR: NonNumericIdentificationKeyValidator;
666
+ /**
667
+ * GMN validator.
668
+ */
669
+ declare const GMN_VALIDATOR: NonNumericIdentificationKeyValidator;
670
+ /**
671
+ * Identification key creator. Creates an identification key based on its definition in section 3 of the {@link
672
+ * https://www.gs1.org/genspecs | GS1 General Specifications}.
673
+ *
674
+ * Keys are created based on a prefix defined in a prefix manager to which the identification key creator is bound.
675
+ */
676
+ interface IdentificationKeyCreator extends IdentificationKeyValidator {
677
+ /**
678
+ * Get the reference creator.
679
+ */
680
+ get referenceCreator(): CharacterSetCreator;
681
+ /**
682
+ * Get the prefix manager to which this identification key creator is bound.
683
+ */
684
+ get prefixManager(): PrefixManager;
685
+ /**
686
+ * Get the prefix, equivalent to calling {@linkcode PrefixManager.prefix | prefixManager.prefix} for a GTIN or
687
+ * {@linkcode PrefixManager.gs1CompanyPrefix | prefixManager.gs1CompanyPrefix} for all other identification key
688
+ * types.
689
+ */
690
+ get prefix(): string;
691
+ /**
692
+ * Get the reference length.
693
+ */
694
+ get referenceLength(): number;
695
+ }
696
+ /**
697
+ * Abstract identification key creator. Implements common functionality for an identification key creator, bound to a
698
+ * {@link PrefixManager}.
699
+ */
700
+ declare abstract class AbstractIdentificationKeyCreator implements IdentificationKeyCreator {
701
+ /**
702
+ * Prefix manager.
703
+ */
704
+ private _prefixManager;
705
+ /**
706
+ * Reference length.
707
+ */
708
+ private _referenceLength;
709
+ /**
710
+ * Initialize the prefix manager. This method is in lieu of a constructor due to the mixin architecture.
711
+ *
712
+ * @param prefixManager
713
+ * Prefix manager.
714
+ *
715
+ * @param prefix
716
+ * Prefix within prefix manager to use to calculate reference length.
717
+ *
718
+ * @param checkAllowance
719
+ * Number of characters to allow for check digit or check character pair.
720
+ */
721
+ protected init(prefixManager: PrefixManager, prefix: string, checkAllowance: number): void;
722
+ abstract get identificationKeyType(): IdentificationKeyType;
723
+ abstract get prefixType(): PrefixType;
724
+ abstract get length(): number;
725
+ abstract get referenceCharacterSet(): CharacterSet;
726
+ abstract get referenceValidator(): CharacterSetValidator;
727
+ /**
728
+ * @inheritDoc
729
+ */
730
+ get referenceCreator(): CharacterSetCreator;
731
+ /**
732
+ * @inheritDoc
733
+ */
734
+ get prefixManager(): PrefixManager;
735
+ /**
736
+ * @inheritDoc
737
+ */
738
+ get prefix(): string;
739
+ /**
740
+ * @inheritDoc
741
+ */
742
+ get referenceLength(): number;
743
+ abstract validate(identificationKey: string, validation?: IdentificationKeyValidation): void;
744
+ }
745
+ /**
746
+ * Numeric identification key creator. Creates one or many numeric identification keys.
747
+ */
748
+ interface NumericIdentificationKeyCreator extends NumericIdentificationKeyValidator, IdentificationKeyCreator {
749
+ /**
750
+ * Get the capacity (`10**referenceLength`).
751
+ */
752
+ get capacity(): number;
753
+ create: {
754
+ /**
755
+ * Create an identification key with a reference based on a numeric value. The value is converted to a reference of
756
+ * the appropriate length using {@linkcode NUMERIC_CREATOR}.
757
+ *
758
+ * @param value
759
+ * Numeric value.
760
+ *
761
+ * @param sparse
762
+ * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
763
+ *
764
+ * @returns
765
+ * Identification key.
766
+ */
767
+ (value: number | bigint, sparse?: boolean): string;
768
+ /**
769
+ * Create identification keys with references based on numeric values. The values are converted to references of
770
+ * the appropriate length using {@linkcode NUMERIC_CREATOR}.
771
+ *
772
+ * @param values
773
+ * Numeric values.
774
+ *
775
+ * @param sparse
776
+ * If true, the values are mapped to a sparse sequence resistant to discovery. Default is false.
777
+ *
778
+ * @returns
779
+ * Identification keys.
780
+ */
781
+ (values: Iterable<number | bigint>, sparse?: boolean): IterableIterator<string>;
782
+ };
783
+ /**
784
+ * Create all identification keys for the prefix from `0` to `capacity - 1`.
785
+ *
786
+ * The implementation creates the strings as needed using an internal generator function, so the values are created
787
+ * only as needed.
788
+ *
789
+ * @returns
790
+ * Iterable iterator over created identification keys.
791
+ */
792
+ createAll: () => IterableIterator<string>;
793
+ }
794
+ /**
795
+ * Abstract numeric identification key creator. Implements common functionality for a numeric identification key creator.
796
+ */
797
+ declare abstract class AbstractNumericIdentificationKeyCreator extends AbstractIdentificationKeyCreator implements NumericIdentificationKeyCreator {
798
+ /**
799
+ * Capacity.
800
+ */
801
+ private _capacity;
802
+ /**
803
+ * Tweak for sparse creation.
804
+ */
805
+ private _tweak;
806
+ /**
807
+ * Initialize the prefix manager. This method is in lieu of a constructor due to the mixin architecture.
808
+ *
809
+ * @param prefixManager
810
+ * Prefix manager.
811
+ *
812
+ * @param prefix
813
+ * Prefix within prefix manager to use to calculate reference length.
814
+ */
815
+ protected init(prefixManager: PrefixManager, prefix: string): void;
816
+ abstract get leaderType(): LeaderType;
817
+ /**
818
+ * @inheritDoc
819
+ */
820
+ get capacity(): number;
821
+ /**
822
+ * Get the tweak for sparse creation.
823
+ */
824
+ get tweak(): bigint;
825
+ /**
826
+ * Set the tweak for sparse creation.
827
+ */
828
+ set tweak(value: bigint);
829
+ /**
830
+ * Build an identification key from a reference by merging it with the prefix and adding the check digit.
831
+ *
832
+ * @param reference
833
+ * Identification key reference.
834
+ *
835
+ * @returns
836
+ * Identification key.
837
+ */
838
+ private buildIdentificationKey;
839
+ /**
840
+ * @inheritDoc
841
+ */
842
+ create(value: number | bigint, sparse?: boolean): string;
843
+ /**
844
+ * @inheritDoc
845
+ */
846
+ create(values: Iterable<number | bigint>, sparse?: boolean): IterableIterator<string>;
847
+ /**
848
+ * Create all identification keys from a partial identification key. Call is recursive until remaining reference
849
+ * length is 0.
850
+ *
851
+ * @param partialIdentificationKey
852
+ * Partial identification key. Initial value is `this.prefix`.
853
+ *
854
+ * @param remainingReferenceLength
855
+ * Remaining reference length. Initial value is `this.referenceLength`.
856
+ *
857
+ * @param extensionWeight
858
+ * If this value is not zero, the identification key has an extension digit, this call is setting it, and this value
859
+ * is applied to the calculation of the check digit.
860
+ *
861
+ * @param weight
862
+ * If the extension weight is zero, this value is applied to the calculation of the check digit.
863
+ *
864
+ * @param partialCheckDigitSum
865
+ * Partial check digit sum for the partial identification key.
866
+ *
867
+ * @yields
868
+ * Identification key.
869
+ */
870
+ private static createAllPartial;
871
+ /**
872
+ * @inheritDoc
873
+ */
874
+ createAll(): IterableIterator<string>;
875
+ }
876
+ declare const GTINCreator_base: ts_mixer_dist_types_types_js.Class<any[], GTINValidator & AbstractNumericIdentificationKeyCreator, typeof GTINValidator & typeof AbstractNumericIdentificationKeyCreator>;
877
+ /**
878
+ * GTIN creator. Applicable to GTIN-13, GTIN-12, and GTIN-8 types; no applicable to GTIN-14 type.
879
+ */
880
+ declare class GTINCreator extends GTINCreator_base {
881
+ /**
882
+ * Validation parameters for required indicator digit.
883
+ */
884
+ private static readonly REQUIRED_INDICATOR_DIGIT_VALIDATION;
885
+ /**
886
+ * Validation parameters for optional indicator digit.
887
+ */
888
+ private static readonly OPTIONAL_INDICATOR_DIGIT_VALIDATION;
889
+ /**
890
+ * Constructor. Called internally by {@link PrefixManager.gtinCreator}; should not be called by other code.
891
+ *
892
+ * @param prefixManager
893
+ * Prefix manager.
894
+ *
895
+ * @param gtinType
896
+ * GTIN type.
897
+ */
898
+ constructor(prefixManager: PrefixManager, gtinType: GTINType);
899
+ /**
900
+ * @inheritDoc
901
+ */
902
+ get prefix(): string;
903
+ /**
904
+ * Create a GTIN-14 with an indicator digit and a reference based on a numeric value. The value is converted to a
905
+ * reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
906
+ *
907
+ * @param indicatorDigit
908
+ * Indicator digit.
909
+ *
910
+ * @param value
911
+ * Numeric value of the reference.
912
+ *
913
+ * @param sparse
914
+ * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
915
+ *
916
+ * @returns
917
+ * GTIN-14.
918
+ */
919
+ createGTIN14(indicatorDigit: string, value: number | bigint, sparse?: boolean): string;
920
+ /**
921
+ * Create multiple GTIN-14s with an indicator digit and references based on numeric values. The values are converted
922
+ * to references of the appropriate length using {@linkcode NUMERIC_CREATOR}.
923
+ *
924
+ * The implementation uses {@link CharacterSetCreator.create}, so the values are created only as needed.
925
+ *
926
+ * @param indicatorDigit
927
+ * Indicator digit.
928
+ *
929
+ * @param values
930
+ * Values.
931
+ *
932
+ * @param sparse
933
+ * If true, the values are mapped to a sparse sequence resistant to discovery. Default is false.
934
+ *
935
+ * @returns
936
+ * Iterable iterator over created GTIN-14s.
937
+ */
938
+ createGTIN14(indicatorDigit: string, values: Iterable<number | bigint>, sparse?: boolean): IterableIterator<string>;
939
+ /**
940
+ * Zero suppress a GTIN-12.
941
+ *
942
+ * @param gtin12
943
+ * GTIN-12.
944
+ *
945
+ * @returns
946
+ * Zero-suppressed GTIN-12.
947
+ */
948
+ static zeroSuppress(gtin12: string): string;
949
+ /**
950
+ * Convert a GTIN of any length to a GTIN-14 with an optional indicator digit.
951
+ *
952
+ * @param indicatorDigit
953
+ * Indicator digit. If blank, assumes "0" if the GTIN is not already a GTIN-14.
954
+ *
955
+ * @param gtin
956
+ * GTIN.
957
+ *
958
+ * @returns
959
+ * GTIN-14.
960
+ */
961
+ static convertToGTIN14(indicatorDigit: string, gtin: string): string;
962
+ /**
963
+ * Normalize a GTIN of any length.
964
+ * - A GTIN-14 that starts with six zeros or a GTIN-13 that starts with five zeros is normalized to GTIN-8.
965
+ * - A GTIN-14 that starts with two zeros or a GTIN-13 that starts with one zero is normalized to GTIN-12.
966
+ * - A GTIN-14 that starts with one zero is normalized to GTIN-13.
967
+ * - Otherwise, the GTIN is unchanged.
968
+ *
969
+ * @param gtin
970
+ * GTIN.
971
+ *
972
+ * @returns
973
+ * Normalized GTIN.
974
+ */
975
+ static normalize(gtin: string): string;
976
+ }
977
+ declare const NonGTINNumericIdentificationKeyCreator_base: ts_mixer_dist_types_types_js.Class<any[], NonGTINNumericIdentificationKeyValidator & AbstractNumericIdentificationKeyCreator, typeof NonGTINNumericIdentificationKeyValidator & typeof AbstractNumericIdentificationKeyCreator>;
978
+ /**
979
+ * Non-GTIN numeric identification key creator.
980
+ */
981
+ declare class NonGTINNumericIdentificationKeyCreator extends NonGTINNumericIdentificationKeyCreator_base {
982
+ /**
983
+ * Constructor. Called internally by {@link PrefixManager} non-GTIN numeric identification key creator getters;
984
+ * should not be called by other code.
985
+ *
986
+ * @param prefixManager
987
+ * Prefix manager.
988
+ *
989
+ * @param identificationKeyType
990
+ * Identification key type.
991
+ *
992
+ * @param length
993
+ * Length.
994
+ *
995
+ * @param leaderType
996
+ * Leader type.
997
+ */
998
+ constructor(prefixManager: PrefixManager, identificationKeyType: IdentificationKeyType, length: number, leaderType?: LeaderType);
999
+ }
1000
+ declare const SerializableNumericIdentificationKeyCreator_base: ts_mixer_dist_types_types_js.Class<any[], SerializableNumericIdentificationKeyValidator & AbstractNumericIdentificationKeyCreator, typeof SerializableNumericIdentificationKeyValidator & typeof AbstractNumericIdentificationKeyCreator>;
1001
+ /**
1002
+ * Serializable numeric identification key creator.
1003
+ */
1004
+ declare class SerializableNumericIdentificationKeyCreator extends SerializableNumericIdentificationKeyCreator_base {
1005
+ /**
1006
+ * Constructor. Called internally by {@link PrefixManager} serialized numeric identification key creator getters;
1007
+ * should not be called by other code.
1008
+ *
1009
+ * @param prefixManager
1010
+ * Prefix manager.
1011
+ *
1012
+ * @param identificationKeyType
1013
+ * Identification key type.
1014
+ *
1015
+ * @param length
1016
+ * Length.
1017
+ *
1018
+ * @param serialComponentLength
1019
+ * Serial component length.
1020
+ *
1021
+ * @param serialComponentCharacterSet
1022
+ * Serial component character set.
1023
+ */
1024
+ constructor(prefixManager: PrefixManager, identificationKeyType: IdentificationKeyType, length: number, serialComponentLength: number, serialComponentCharacterSet: CharacterSet);
1025
+ /**
1026
+ * Get the serial component creator.
1027
+ */
1028
+ get serialComponentCreator(): CharacterSetCreator;
1029
+ /**
1030
+ * Concatenate a validated base identification key with a serial component.
1031
+ *
1032
+ * @param baseIdentificationKey
1033
+ * Base identification key.
1034
+ *
1035
+ * @param serialComponent
1036
+ * Serial component.
1037
+ *
1038
+ * @returns
1039
+ * Serialized identification key.
1040
+ */
1041
+ private concatenateValidated;
1042
+ /**
1043
+ * Create a serialized identification key with a reference based on a numeric value and a serial component. The
1044
+ * value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
1045
+ *
1046
+ * @param value
1047
+ * Numeric value of the references.
1048
+ *
1049
+ * @param serialComponent
1050
+ * Serial component.
1051
+ *
1052
+ * @param sparse
1053
+ * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
1054
+ *
1055
+ * @returns
1056
+ * Serialized identification key.
1057
+ */
1058
+ createSerialized(value: number, serialComponent: string, sparse?: boolean): string;
1059
+ /**
1060
+ * Create multiple serialized identification keys with a reference based on a numeric value and multiple serial
1061
+ * components. The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
1062
+ *
1063
+ * @param value
1064
+ * Numeric value.
1065
+ *
1066
+ * @param serialComponents
1067
+ * Serial components.
1068
+ *
1069
+ * @param sparse
1070
+ * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
1071
+ *
1072
+ * @returns
1073
+ * Serialized identification keys.
1074
+ */
1075
+ createSerialized(value: number, serialComponents: Iterable<string>, sparse?: boolean): IterableIterator<string>;
1076
+ /**
1077
+ * Concatenate a base identification key with a serial component.
1078
+ *
1079
+ * @param baseIdentificationKey
1080
+ * Base identification key.
1081
+ *
1082
+ * @param serialComponent
1083
+ * Serial component.
1084
+ *
1085
+ * @returns
1086
+ * Serialized identification key.
1087
+ */
1088
+ concatenate(baseIdentificationKey: string, serialComponent: string): string;
1089
+ /**
1090
+ * Concatenate a base identification key with multiple serial components.
1091
+ *
1092
+ * @param baseIdentificationKey
1093
+ * Base identification key.
1094
+ *
1095
+ * @param serialComponents
1096
+ * Serial components.
1097
+ *
1098
+ * @returns
1099
+ * Serialized identification keys.
1100
+ */
1101
+ concatenate(baseIdentificationKey: string, serialComponents: Iterable<string>): IterableIterator<string>;
1102
+ }
1103
+ declare const NonNumericIdentificationKeyCreator_base: ts_mixer_dist_types_types_js.Class<any[], NonNumericIdentificationKeyValidator & AbstractIdentificationKeyCreator, typeof NonNumericIdentificationKeyValidator & typeof AbstractIdentificationKeyCreator>;
1104
+ /**
1105
+ * Non-numeric identification key creator.
1106
+ */
1107
+ declare class NonNumericIdentificationKeyCreator extends NonNumericIdentificationKeyCreator_base {
1108
+ /**
1109
+ * Reference validation parameters.
1110
+ */
1111
+ private readonly _referenceValidation;
1112
+ /**
1113
+ * Constructor. Called internally by {@link PrefixManager} non-numeric identification key creator getters; should
1114
+ * not be called by other code.
1115
+ *
1116
+ * @param prefixManager
1117
+ * Prefix manager.
1118
+ *
1119
+ * @param identificationKeyType
1120
+ * Identification key type.
1121
+ *
1122
+ * @param length
1123
+ * Length.
1124
+ *
1125
+ * @param referenceCharacterSet
1126
+ * Reference character set.
1127
+ *
1128
+ * @param requiresCheckCharacterPair
1129
+ * True if the identification key requires a check character pair.
1130
+ */
1131
+ constructor(prefixManager: PrefixManager, identificationKeyType: IdentificationKeyType, length: number, referenceCharacterSet: CharacterSet, requiresCheckCharacterPair?: boolean);
1132
+ /**
1133
+ * Create an identification key with a reference.
1134
+ *
1135
+ * @param reference
1136
+ * Reference.
1137
+ *
1138
+ * @returns
1139
+ * Identification key.
1140
+ */
1141
+ create(reference: string): string;
1142
+ /**
1143
+ * Create multiple identification keys with references.
1144
+ *
1145
+ * @param references
1146
+ * References.
1147
+ *
1148
+ * @returns
1149
+ * Identification keys.
1150
+ */
1151
+ create(references: Iterable<string>): IterableIterator<string>;
1152
+ }
1153
+ /**
1154
+ * Prefix manager. This is the core class for identification key creation.
1155
+ *
1156
+ * A prefix manager may be created for any {@link PrefixType | prefix type}. As most applications work with a limited
1157
+ * number of prefixes for creating identification keys, prefix managers are cached in memory and may be reused.
1158
+ *
1159
+ * Prefix managers are keyed by GS1 Company Prefix, so the prefix type that is requested may not match the prefix type
1160
+ * of the returned prefix manager. For example, the prefix manager for GS1 Company Prefix 0614141 is identical to the
1161
+ * one for U.P.C. Company Prefix 614141, with the prefix type equal to {@link PrefixType.UPCCompanyPrefix} and the
1162
+ * prefix equal to "614141".
1163
+ *
1164
+ * To support the creation of sparse identification keys, a prefix manager maintains a {@link tweakFactor | tweak
1165
+ * factor} which is used, along with a type-specific multiplier, as the tweak when creating numeric identification keys.
1166
+ * The default tweak factor is the numeric value of the GS1 Company Prefix representation of the prefix preceded by '1'
1167
+ * to ensure uniqueness (i.e., so that prefixes 0 N1 N2 N3... and N1 N2 N3... produce different tweak factors). This is
1168
+ * usually sufficient for obfuscation, but as the sparse creation algorithm is reversible and as the GS1 Company Prefix
1169
+ * is discoverable via {@link https://www.gs1.org/services/verified-by-gs1 | Verified by GS1}, a user-defined tweak
1170
+ * factor should be used if a higher degree of obfuscation is required. When using a tweak factor other than the
1171
+ * default, care should be taken to restore it when resuming the application. A tweak factor of 0 creates a straight
1172
+ * sequence.
1173
+ */
1174
+ declare class PrefixManager {
1175
+ /**
1176
+ * Cached prefix managers, keyed by GS1 Company Prefix.
1177
+ */
1178
+ private static readonly PREFIX_MANAGERS_MAP;
1179
+ /**
1180
+ * GS1 Company Prefix minimum length.
1181
+ */
1182
+ static readonly GS1_COMPANY_PREFIX_MINIMUM_LENGTH = 4;
1183
+ /**
1184
+ * GS1 Company Prefix maximum length.
1185
+ */
1186
+ static readonly GS1_COMPANY_PREFIX_MAXIMUM_LENGTH = 12;
1187
+ /**
1188
+ * U.P.C. Company Prefix minimum length.
1189
+ */
1190
+ static readonly UPC_COMPANY_PREFIX_MINIMUM_LENGTH = 6;
1191
+ /**
1192
+ * U.P.C. Company Prefix maximum length.
1193
+ */
1194
+ static readonly UPC_COMPANY_PREFIX_MAXIMUM_LENGTH = 11;
1195
+ /**
1196
+ * GS1-8 Prefix minimum length.
1197
+ */
1198
+ static readonly GS1_8_PREFIX_MINIMUM_LENGTH = 2;
1199
+ /**
1200
+ * GS1-8 Prefix maximum length.
1201
+ */
1202
+ static readonly GS1_8_PREFIX_MAXIMUM_LENGTH = 7;
1203
+ /**
1204
+ * Validation parameters for GS1 Company Prefix.
1205
+ */
1206
+ private static readonly GS1_COMPANY_PREFIX_VALIDATION;
1207
+ /**
1208
+ * Validation parameters for U.P.C. Company Prefix expressed as GS1 Company Prefix.
1209
+ */
1210
+ private static readonly UPC_COMPANY_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;
1211
+ /**
1212
+ * Validation parameters for GS1-8 Prefix expressed as GS1 Company Prefix.
1213
+ */
1214
+ private static readonly GS1_8_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;
1215
+ /**
1216
+ * Validation parameters for U.P.C. Company Prefix.
1217
+ */
1218
+ private static readonly UPC_COMPANY_PREFIX_VALIDATION;
1219
+ /**
1220
+ * Validation parameters for GS1-8 Prefix.
1221
+ */
1222
+ private static readonly GS1_8_PREFIX_VALIDATION;
1223
+ /**
1224
+ * Creator tweak factors. Different numeric identification key types have different tweak factors so that sparse
1225
+ * creation generates different sequences for each.
1226
+ */
1227
+ private static readonly CREATOR_TWEAK_FACTORS_MAP;
1228
+ /**
1229
+ * Normalized prefix type.
1230
+ */
1231
+ private readonly _prefixType;
1232
+ /**
1233
+ * Normalized prefix.
1234
+ */
1235
+ private readonly _prefix;
1236
+ /**
1237
+ * Prefix as GS1 Company Prefix.
1238
+ */
1239
+ private readonly _gs1CompanyPrefix;
1240
+ /**
1241
+ * U.P.C. Company Prefix if prefix type is {@link PrefixType.UPCCompanyPrefix}.
1242
+ */
1243
+ private readonly _upcCompanyPrefix;
1244
+ /**
1245
+ * GS1-8 Prefix if prefix type is {@link PrefixType.GS18Prefix}.
1246
+ */
1247
+ private readonly _gs18Prefix;
1248
+ /**
1249
+ * Tweak factor.
1250
+ */
1251
+ private _tweakFactor;
1252
+ /**
1253
+ * Cached identification key creators.
1254
+ */
1255
+ private readonly _identificationKeyCreatorsMap;
1256
+ /**
1257
+ * Constructor.
1258
+ *
1259
+ * @param gs1CompanyPrefix
1260
+ * GS1 Company Prefix.
1261
+ */
1262
+ private constructor();
1263
+ /**
1264
+ * Get the prefix type.
1265
+ */
1266
+ get prefixType(): PrefixType;
1267
+ /**
1268
+ * Get the prefix.
1269
+ */
1270
+ get prefix(): string;
1271
+ /**
1272
+ * Get the GS1 Company Prefix.
1273
+ */
1274
+ get gs1CompanyPrefix(): string;
1275
+ /**
1276
+ * Get the U.P.C. Company Prefix if prefix type is {@link PrefixType.UPCCompanyPrefix} or undefined if not.
1277
+ */
1278
+ get upcCompanyPrefix(): string | undefined;
1279
+ /**
1280
+ * Get the GS1-8 Prefix if prefix type is {@link PrefixType.GS18Prefix} or undefined if not.
1281
+ */
1282
+ get gs18Prefix(): string | undefined;
1283
+ /**
1284
+ * Set the tweak for an identification key creator if it's a numeric identification key creator.
1285
+ *
1286
+ * @param creator
1287
+ * Identification key creator.
1288
+ */
1289
+ private setCreatorTweak;
1290
+ /**
1291
+ * Get the tweak factor.
1292
+ */
1293
+ get tweakFactor(): bigint;
1294
+ /**
1295
+ * Set the tweak factor.
1296
+ *
1297
+ * @param value
1298
+ * Tweak factor.
1299
+ */
1300
+ set tweakFactor(value: number | bigint);
1301
+ /**
1302
+ * Reset the tweak factor to its default (numeric value of the GS1 Company Prefix preceded by '1').
1303
+ */
1304
+ resetTweakFactor(): void;
1305
+ /**
1306
+ * Get a prefix manager.
1307
+ *
1308
+ * @param prefixType
1309
+ * Prefix type.
1310
+ *
1311
+ * @param prefix
1312
+ * Prefix.
1313
+ *
1314
+ * @returns
1315
+ * Prefix manager with normalized prefix type and prefix.
1316
+ */
1317
+ static get(prefixType: PrefixType, prefix: string): PrefixManager;
1318
+ /**
1319
+ * Validate a prefix.
1320
+ *
1321
+ * @param prefixType
1322
+ * Prefix type.
1323
+ *
1324
+ * @param allowUPCCompanyPrefix
1325
+ * If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
1326
+ *
1327
+ * @param allowGS18Prefix
1328
+ * If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
1329
+ *
1330
+ * @param prefix
1331
+ * Prefix.
1332
+ *
1333
+ * @param isFromIdentificationKey
1334
+ * If true, the prefix is from an identification key and should be trimmed before its character set is validated.
1335
+ *
1336
+ * @param isNumericIdentificationKey
1337
+ * If true, the prefix is from a numeric identification key and its character set will be validated by the caller.
1338
+ *
1339
+ * @param positionOffset
1340
+ * Position offset within a larger string.
1341
+ */
1342
+ static validatePrefix(prefixType: PrefixType, allowUPCCompanyPrefix: boolean, allowGS18Prefix: boolean, prefix: string, isFromIdentificationKey?: boolean, isNumericIdentificationKey?: boolean, positionOffset?: number): void;
1343
+ /**
1344
+ * Get an identification key creator.
1345
+ *
1346
+ * @param identificationKeyType
1347
+ * Identification key type.
1348
+ *
1349
+ * @param constructorCallback
1350
+ * Constructor callback.
1351
+ *
1352
+ * @returns
1353
+ * Identification key creator.
1354
+ */
1355
+ private getIdentificationKeyCreator;
1356
+ /**
1357
+ * Get non-GTIN numeric identification key creator.
1358
+ *
1359
+ * @param validator
1360
+ * Validator on which identification key creator is based.
1361
+ *
1362
+ * @returns
1363
+ * Identification key creator.
1364
+ */
1365
+ private getNonGTINNumericIdentificationKeyCreator;
1366
+ /**
1367
+ * Get serialized numeric identification key creator.
1368
+ *
1369
+ * @param validator
1370
+ * Validator on which identification key creator is based.
1371
+ *
1372
+ * @returns
1373
+ * Identification key creator.
1374
+ */
1375
+ private getSerializableNumericIdentificationKeyCreator;
1376
+ /**
1377
+ * Get non-numeric identification key creator.
1378
+ *
1379
+ * @param validator
1380
+ * Validator on which identification key creator is based.
1381
+ *
1382
+ * @returns
1383
+ * Identification key creator.
1384
+ */
1385
+ private getNonNumericIdentificationKeyCreator;
1386
+ /**
1387
+ * Get GTIN creator.
1388
+ */
1389
+ get gtinCreator(): GTINCreator;
1390
+ /**
1391
+ * Get GLN creator.
1392
+ */
1393
+ get glnCreator(): NonGTINNumericIdentificationKeyCreator;
1394
+ /**
1395
+ * Get SSCC creator.
1396
+ */
1397
+ get ssccCreator(): NonGTINNumericIdentificationKeyCreator;
1398
+ /**
1399
+ * Get GRAI creator.
1400
+ */
1401
+ get graiCreator(): SerializableNumericIdentificationKeyCreator;
1402
+ /**
1403
+ * Get GIAI creator.
1404
+ */
1405
+ get giaiCreator(): NonNumericIdentificationKeyCreator;
1406
+ /**
1407
+ * Get GSRN creator.
1408
+ */
1409
+ get gsrnCreator(): NonGTINNumericIdentificationKeyCreator;
1410
+ /**
1411
+ * Get GDTI creator.
1412
+ */
1413
+ get gdtiCreator(): SerializableNumericIdentificationKeyCreator;
1414
+ /**
1415
+ * Get GINC creator.
1416
+ */
1417
+ get gincCreator(): NonNumericIdentificationKeyCreator;
1418
+ /**
1419
+ * Get GSIN creator.
1420
+ */
1421
+ get gsinCreator(): NonGTINNumericIdentificationKeyCreator;
1422
+ /**
1423
+ * Get GCN creator.
1424
+ */
1425
+ get gcnCreator(): SerializableNumericIdentificationKeyCreator;
1426
+ /**
1427
+ * Get CPID creator.
1428
+ */
1429
+ get cpidCreator(): NonNumericIdentificationKeyCreator;
1430
+ /**
1431
+ * Get GMN creator.
1432
+ */
1433
+ get gmnCreator(): NonNumericIdentificationKeyCreator;
1434
+ }
1435
+
1436
+ export { AI39_CREATOR, AI82_CREATOR, CPID_VALIDATOR, CharacterSet, 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, GTINLevel, GTINType, GTINValidator, GTIN_VALIDATORS, type IdentificationKeyCreator, IdentificationKeyType, type IdentificationKeyValidation, type IdentificationKeyValidator, LeaderType, NonGTINNumericIdentificationKeyCreator, NonGTINNumericIdentificationKeyValidator, NonNumericIdentificationKeyCreator, type NonNumericIdentificationKeyValidation, NonNumericIdentificationKeyValidator, type NumericIdentificationKeyCreator, type NumericIdentificationKeyValidator, PrefixManager, PrefixType, SSCC_VALIDATOR, SerializableNumericIdentificationKeyCreator, SerializableNumericIdentificationKeyValidator, checkCharacterPair, checkDigit, checkDigitSum, fiveDigitPriceWeightCheckDigit, fourDigitPriceWeightCheckDigit, hasValidCheckCharacterPair, hasValidCheckDigit };