@aidc-toolkit/gs1 1.0.42-beta → 1.0.43
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 +19 -0
- package/dist/index.d.cts +2205 -0
- package/dist/index.d.ts +2205 -63
- package/dist/index.js +3 -36
- package/package.json +4 -4
- package/src/gcp-length.ts +55 -18
- package/test/gcp-length.test.ts +12 -7
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/abstract-identifier-creator.d.ts +0 -41
- package/dist/abstract-identifier-creator.d.ts.map +0 -1
- package/dist/abstract-identifier-creator.js +0 -73
- package/dist/abstract-identifier-creator.js.map +0 -1
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts +0 -36
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/abstract-non-gtin-numeric-identifier-creator.js +0 -37
- package/dist/abstract-non-gtin-numeric-identifier-creator.js.map +0 -1
- package/dist/abstract-numeric-identifier-creator.d.ts +0 -34
- package/dist/abstract-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/abstract-numeric-identifier-creator.js +0 -154
- package/dist/abstract-numeric-identifier-creator.js.map +0 -1
- package/dist/character-set.d.ts +0 -27
- package/dist/character-set.d.ts.map +0 -1
- package/dist/character-set.js +0 -83
- package/dist/character-set.js.map +0 -1
- package/dist/check.d.ts +0 -81
- package/dist/check.d.ts.map +0 -1
- package/dist/check.js +0 -218
- package/dist/check.js.map +0 -1
- package/dist/content-character-set-creators.d.ts +0 -4
- package/dist/content-character-set-creators.d.ts.map +0 -1
- package/dist/content-character-set-creators.js +0 -9
- package/dist/content-character-set-creators.js.map +0 -1
- package/dist/content-character-set.d.ts +0 -26
- package/dist/content-character-set.d.ts.map +0 -1
- package/dist/content-character-set.js +0 -18
- package/dist/content-character-set.js.map +0 -1
- package/dist/gcp-length-cache.d.ts +0 -86
- package/dist/gcp-length-cache.d.ts.map +0 -1
- package/dist/gcp-length-cache.js +0 -237
- package/dist/gcp-length-cache.js.map +0 -1
- package/dist/gcp-length-data.d.ts +0 -108
- package/dist/gcp-length-data.d.ts.map +0 -1
- package/dist/gcp-length-data.js +0 -53
- package/dist/gcp-length-data.js.map +0 -1
- package/dist/gcp-length-tree.d.ts +0 -33
- package/dist/gcp-length-tree.d.ts.map +0 -1
- package/dist/gcp-length-tree.js +0 -13
- package/dist/gcp-length-tree.js.map +0 -1
- package/dist/gcp-length.d.ts +0 -75
- package/dist/gcp-length.d.ts.map +0 -1
- package/dist/gcp-length.js +0 -357
- package/dist/gcp-length.js.map +0 -1
- package/dist/gtin-creator.d.ts +0 -47
- package/dist/gtin-creator.d.ts.map +0 -1
- package/dist/gtin-creator.js +0 -64
- package/dist/gtin-creator.js.map +0 -1
- package/dist/gtin-descriptor.d.ts +0 -22
- package/dist/gtin-descriptor.d.ts.map +0 -1
- package/dist/gtin-descriptor.js +0 -2
- package/dist/gtin-descriptor.js.map +0 -1
- package/dist/gtin-length.d.ts +0 -64
- package/dist/gtin-length.d.ts.map +0 -1
- package/dist/gtin-length.js +0 -36
- package/dist/gtin-length.js.map +0 -1
- package/dist/gtin-type.d.ts +0 -26
- package/dist/gtin-type.d.ts.map +0 -1
- package/dist/gtin-type.js +0 -7
- package/dist/gtin-type.js.map +0 -1
- package/dist/gtin-validator.d.ts +0 -132
- package/dist/gtin-validator.d.ts.map +0 -1
- package/dist/gtin-validator.js +0 -349
- package/dist/gtin-validator.js.map +0 -1
- package/dist/identifier-creator.d.ts +0 -31
- package/dist/identifier-creator.d.ts.map +0 -1
- package/dist/identifier-creator.js +0 -2
- package/dist/identifier-creator.js.map +0 -1
- package/dist/identifier-creators.d.ts +0 -118
- package/dist/identifier-creators.d.ts.map +0 -1
- package/dist/identifier-creators.js +0 -92
- package/dist/identifier-creators.js.map +0 -1
- package/dist/identifier-descriptor.d.ts +0 -27
- package/dist/identifier-descriptor.d.ts.map +0 -1
- package/dist/identifier-descriptor.js +0 -2
- package/dist/identifier-descriptor.js.map +0 -1
- package/dist/identifier-descriptors.d.ts +0 -106
- package/dist/identifier-descriptors.d.ts.map +0 -1
- package/dist/identifier-descriptors.js +0 -262
- package/dist/identifier-descriptors.js.map +0 -1
- package/dist/identifier-extension.d.ts +0 -82
- package/dist/identifier-extension.d.ts.map +0 -1
- package/dist/identifier-extension.js +0 -79
- package/dist/identifier-extension.js.map +0 -1
- package/dist/identifier-type.d.ts +0 -62
- package/dist/identifier-type.d.ts.map +0 -1
- package/dist/identifier-type.js +0 -54
- package/dist/identifier-type.js.map +0 -1
- package/dist/identifier-validator.d.ts +0 -85
- package/dist/identifier-validator.d.ts.map +0 -1
- package/dist/identifier-validator.js +0 -107
- package/dist/identifier-validator.js.map +0 -1
- package/dist/identifier-validators.d.ts +0 -131
- package/dist/identifier-validators.d.ts.map +0 -1
- package/dist/identifier-validators.js +0 -167
- package/dist/identifier-validators.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/leader-type.d.ts +0 -26
- package/dist/leader-type.d.ts.map +0 -1
- package/dist/leader-type.js +0 -18
- package/dist/leader-type.js.map +0 -1
- package/dist/locale/en/locale-resources.d.ts +0 -48
- package/dist/locale/en/locale-resources.d.ts.map +0 -1
- package/dist/locale/en/locale-resources.js +0 -47
- package/dist/locale/en/locale-resources.js.map +0 -1
- package/dist/locale/fr/locale-resources.d.ts +0 -48
- package/dist/locale/fr/locale-resources.d.ts.map +0 -1
- package/dist/locale/fr/locale-resources.js +0 -47
- package/dist/locale/fr/locale-resources.js.map +0 -1
- package/dist/locale/i18n.d.ts +0 -27
- package/dist/locale/i18n.d.ts.map +0 -1
- package/dist/locale/i18n.js +0 -35
- package/dist/locale/i18n.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-creator.d.ts +0 -12
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-creator.js +0 -2
- package/dist/non-gtin-numeric-identifier-creator.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts +0 -22
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-descriptor.js +0 -2
- package/dist/non-gtin-numeric-identifier-descriptor.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-type.d.ts +0 -26
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-type.js +0 -8
- package/dist/non-gtin-numeric-identifier-type.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-validator.d.ts +0 -12
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-validator.js +0 -10
- package/dist/non-gtin-numeric-identifier-validator.js.map +0 -1
- package/dist/non-numeric-identifier-creator.d.ts +0 -40
- package/dist/non-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/non-numeric-identifier-creator.js +0 -82
- package/dist/non-numeric-identifier-creator.js.map +0 -1
- package/dist/non-numeric-identifier-descriptor.d.ts +0 -26
- package/dist/non-numeric-identifier-descriptor.d.ts.map +0 -1
- package/dist/non-numeric-identifier-descriptor.js +0 -2
- package/dist/non-numeric-identifier-descriptor.js.map +0 -1
- package/dist/non-numeric-identifier-type.d.ts +0 -26
- package/dist/non-numeric-identifier-type.d.ts.map +0 -1
- package/dist/non-numeric-identifier-type.js +0 -8
- package/dist/non-numeric-identifier-type.js.map +0 -1
- package/dist/non-numeric-identifier-validator.d.ts +0 -41
- package/dist/non-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/non-numeric-identifier-validator.js +0 -69
- package/dist/non-numeric-identifier-validator.js.map +0 -1
- package/dist/non-serializable-numeric-identifier-creator.d.ts +0 -10
- package/dist/non-serializable-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/non-serializable-numeric-identifier-creator.js +0 -8
- package/dist/non-serializable-numeric-identifier-creator.js.map +0 -1
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts +0 -12
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts.map +0 -1
- package/dist/non-serializable-numeric-identifier-descriptor.js +0 -2
- package/dist/non-serializable-numeric-identifier-descriptor.js.map +0 -1
- package/dist/non-serializable-numeric-identifier-type.d.ts +0 -26
- package/dist/non-serializable-numeric-identifier-type.d.ts.map +0 -1
- package/dist/non-serializable-numeric-identifier-type.js +0 -7
- package/dist/non-serializable-numeric-identifier-type.js.map +0 -1
- package/dist/non-serializable-numeric-identifier-validator.d.ts +0 -16
- package/dist/non-serializable-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/non-serializable-numeric-identifier-validator.js +0 -17
- package/dist/non-serializable-numeric-identifier-validator.js.map +0 -1
- package/dist/numeric-identifier-creator.d.ts +0 -53
- package/dist/numeric-identifier-creator.d.ts.map +0 -1
- package/dist/numeric-identifier-creator.js +0 -2
- package/dist/numeric-identifier-creator.js.map +0 -1
- package/dist/numeric-identifier-descriptor.d.ts +0 -22
- package/dist/numeric-identifier-descriptor.d.ts.map +0 -1
- package/dist/numeric-identifier-descriptor.js +0 -2
- package/dist/numeric-identifier-descriptor.js.map +0 -1
- package/dist/numeric-identifier-type.d.ts +0 -26
- package/dist/numeric-identifier-type.d.ts.map +0 -1
- package/dist/numeric-identifier-type.js +0 -7
- package/dist/numeric-identifier-type.js.map +0 -1
- package/dist/numeric-identifier-validator.d.ts +0 -38
- package/dist/numeric-identifier-validator.d.ts.map +0 -1
- package/dist/numeric-identifier-validator.js +0 -61
- package/dist/numeric-identifier-validator.js.map +0 -1
- package/dist/prefix-manager.d.ts +0 -151
- package/dist/prefix-manager.d.ts.map +0 -1
- package/dist/prefix-manager.js +0 -297
- package/dist/prefix-manager.js.map +0 -1
- package/dist/prefix-provider.d.ts +0 -27
- package/dist/prefix-provider.d.ts.map +0 -1
- package/dist/prefix-provider.js +0 -2
- package/dist/prefix-provider.js.map +0 -1
- package/dist/prefix-type.d.ts +0 -26
- package/dist/prefix-type.d.ts.map +0 -1
- package/dist/prefix-type.js +0 -18
- package/dist/prefix-type.js.map +0 -1
- package/dist/prefix-validator.d.ts +0 -71
- package/dist/prefix-validator.d.ts.map +0 -1
- package/dist/prefix-validator.js +0 -204
- package/dist/prefix-validator.js.map +0 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +0 -48
- package/dist/serializable-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-creator.js +0 -93
- package/dist/serializable-numeric-identifier-creator.js.map +0 -1
- package/dist/serializable-numeric-identifier-descriptor.d.ts +0 -26
- package/dist/serializable-numeric-identifier-descriptor.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-descriptor.js +0 -2
- package/dist/serializable-numeric-identifier-descriptor.js.map +0 -1
- package/dist/serializable-numeric-identifier-type.d.ts +0 -26
- package/dist/serializable-numeric-identifier-type.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-type.js +0 -8
- package/dist/serializable-numeric-identifier-type.js.map +0 -1
- package/dist/serializable-numeric-identifier-validator.d.ts +0 -67
- package/dist/serializable-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-validator.js +0 -97
- package/dist/serializable-numeric-identifier-validator.js.map +0 -1
- package/dist/variable-measure.d.ts +0 -68
- package/dist/variable-measure.d.ts.map +0 -1
- package/dist/variable-measure.js +0 -210
- package/dist/variable-measure.js.map +0 -1
- package/dist/verified-by-gs1.d.ts +0 -22
- package/dist/verified-by-gs1.d.ts.map +0 -1
- package/dist/verified-by-gs1.js +0 -46
- package/dist/verified-by-gs1.js.map +0 -1
- package/src/gcp-length-tree.ts +0 -39
package/dist/gtin-type.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { pick } from "@aidc-toolkit/core";
|
|
2
|
-
import { NumericIdentifierTypes } from "./numeric-identifier-type.js";
|
|
3
|
-
/**
|
|
4
|
-
* GTIN types.
|
|
5
|
-
*/
|
|
6
|
-
export const GTINTypes = pick(NumericIdentifierTypes, NumericIdentifierTypes.GTIN);
|
|
7
|
-
//# sourceMappingURL=gtin-type.js.map
|
package/dist/gtin-type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gtin-type.js","sourceRoot":"","sources":["../src/gtin-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAChD,sBAAsB,CAAC,IAAI,CAC9B,CAAC"}
|
package/dist/gtin-validator.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { GTINDescriptor } from "./gtin-descriptor.js";
|
|
2
|
-
import { type GTINBaseLength } from "./gtin-length.js";
|
|
3
|
-
import type { GTINType } from "./gtin-type.js";
|
|
4
|
-
import { NumericIdentifierValidator } from "./numeric-identifier-validator.js";
|
|
5
|
-
import { type PrefixType } from "./prefix-type.js";
|
|
6
|
-
/**
|
|
7
|
-
* Levels at which GTIN is to be validated.
|
|
8
|
-
*/
|
|
9
|
-
export declare const GTINLevels: {
|
|
10
|
-
/**
|
|
11
|
-
* Any level (level is ignored).
|
|
12
|
-
*/
|
|
13
|
-
readonly Any: 0;
|
|
14
|
-
/**
|
|
15
|
-
* Retail consumer trade item level, supporting GTIN-13, GTIN-12 (optionally zero-suppressed), and GTIN-8.
|
|
16
|
-
*/
|
|
17
|
-
readonly RetailConsumer: 1;
|
|
18
|
-
/**
|
|
19
|
-
* Other than retail consumer trade item level, supporting GTIN-13, GTIN-12 (not zero-suppressed), and GTIN-14.
|
|
20
|
-
*/
|
|
21
|
-
readonly OtherThanRetailConsumer: 2;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* GTIN level key.
|
|
25
|
-
*/
|
|
26
|
-
export type GTINLevelKey = keyof typeof GTINLevels;
|
|
27
|
-
/**
|
|
28
|
-
* GTIN level.
|
|
29
|
-
*/
|
|
30
|
-
export type GTINLevel = typeof GTINLevels[GTINLevelKey];
|
|
31
|
-
/**
|
|
32
|
-
* GTIN validator.
|
|
33
|
-
*/
|
|
34
|
-
export declare class GTINValidator extends NumericIdentifierValidator<GTINType> implements GTINDescriptor {
|
|
35
|
-
#private;
|
|
36
|
-
/**
|
|
37
|
-
* Constructor.
|
|
38
|
-
*
|
|
39
|
-
* @param gtinBaseLength
|
|
40
|
-
* GTIN base length (all except GTIN-14).
|
|
41
|
-
*/
|
|
42
|
-
constructor(gtinBaseLength: GTINBaseLength);
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
get prefixType(): PrefixType;
|
|
47
|
-
/**
|
|
48
|
-
* @inheritDoc
|
|
49
|
-
*/
|
|
50
|
-
protected validatePrefix(partialIdentifier: string): void;
|
|
51
|
-
/**
|
|
52
|
-
* Zero suppress a GTIN-12.
|
|
53
|
-
*
|
|
54
|
-
* @param gtin12
|
|
55
|
-
* GTIN-12.
|
|
56
|
-
*
|
|
57
|
-
* @returns
|
|
58
|
-
* Zero-suppressed GTIN-12.
|
|
59
|
-
*/
|
|
60
|
-
static zeroSuppress(gtin12: string): string;
|
|
61
|
-
/**
|
|
62
|
-
* Zero expand a zero-suppressed GTIN-12.
|
|
63
|
-
*
|
|
64
|
-
* @param zeroSuppressedGTIN12
|
|
65
|
-
* Zero-suppressed GTIN-12.
|
|
66
|
-
*
|
|
67
|
-
* @returns
|
|
68
|
-
* GTIN-12.
|
|
69
|
-
*/
|
|
70
|
-
static zeroExpand(zeroSuppressedGTIN12: string): string;
|
|
71
|
-
/**
|
|
72
|
-
* Convert a GTIN of any length to a GTIN-14 with an optional indicator digit.
|
|
73
|
-
*
|
|
74
|
-
* @param indicatorDigit
|
|
75
|
-
* Indicator digit. If blank, assumes "0" if the GTIN is not already a GTIN-14.
|
|
76
|
-
*
|
|
77
|
-
* @param gtin
|
|
78
|
-
* GTIN.
|
|
79
|
-
*
|
|
80
|
-
* @returns
|
|
81
|
-
* GTIN-14.
|
|
82
|
-
*/
|
|
83
|
-
static convertToGTIN14(indicatorDigit: string, gtin: string): string;
|
|
84
|
-
/**
|
|
85
|
-
* Normalize a GTIN of any length.
|
|
86
|
-
* - A GTIN-14 that starts with six zeros or a GTIN-13 that starts with five zeros is normalized to GTIN-8.
|
|
87
|
-
* - A GTIN-14 that starts with two zeros or a GTIN-13 that starts with one zero is normalized to GTIN-12.
|
|
88
|
-
* - A GTIN-14 that starts with one zero is normalized to GTIN-13.
|
|
89
|
-
* - Otherwise, the GTIN is unchanged.
|
|
90
|
-
*
|
|
91
|
-
* @param gtin
|
|
92
|
-
* GTIN.
|
|
93
|
-
*
|
|
94
|
-
* @returns
|
|
95
|
-
* Normalized GTIN.
|
|
96
|
-
*/
|
|
97
|
-
static normalize(gtin: string): string;
|
|
98
|
-
/**
|
|
99
|
-
* Validate any GTIN, optionally against a level.
|
|
100
|
-
*
|
|
101
|
-
* @param gtin
|
|
102
|
-
* GTIN.
|
|
103
|
-
*
|
|
104
|
-
* @param gtinLevel
|
|
105
|
-
* Level at which GTIN is to be validated.
|
|
106
|
-
*/
|
|
107
|
-
static validateAny(gtin: string, gtinLevel?: GTINLevel): void;
|
|
108
|
-
/**
|
|
109
|
-
* Validate a GTIN-14.
|
|
110
|
-
*
|
|
111
|
-
* @param gtin14
|
|
112
|
-
* GTIN-14.
|
|
113
|
-
*/
|
|
114
|
-
static validateGTIN14(gtin14: string): void;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* GTIN-13 validator.
|
|
118
|
-
*/
|
|
119
|
-
export declare const GTIN13_VALIDATOR: GTINValidator;
|
|
120
|
-
/**
|
|
121
|
-
* GTIN-12 validator.
|
|
122
|
-
*/
|
|
123
|
-
export declare const GTIN12_VALIDATOR: GTINValidator;
|
|
124
|
-
/**
|
|
125
|
-
* GTIN-8 validator.
|
|
126
|
-
*/
|
|
127
|
-
export declare const GTIN8_VALIDATOR: GTINValidator;
|
|
128
|
-
/**
|
|
129
|
-
* GTIN validators indexed by prefix type.
|
|
130
|
-
*/
|
|
131
|
-
export declare const GTIN_VALIDATORS: Readonly<Record<GTINBaseLength, GTINValidator>>;
|
|
132
|
-
//# sourceMappingURL=gtin-validator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gtin-validator.d.ts","sourceRoot":"","sources":["../src/gtin-validator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAGhE;;GAEG;AACH,eAAO,MAAM,UAAU;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,qBAAa,aAAc,SAAQ,0BAA0B,CAAC,QAAQ,CAAE,YAAW,cAAc;;IA6B7F;;;;;OAKG;gBACS,cAAc,EAAE,cAAc;IAQ1C;;OAEG;IACH,IAAa,UAAU,IAAI,UAAU,CAEpC;IAED;;OAEG;cACgB,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI;IAKlE;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IA4B3C;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM;IA+BvD;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAgBpE;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAgEtC;;;;;;;;OAQG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,SAA0B,GAAG,IAAI;IAkE7E;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAO9C;AAED;;GAEG;AAEH,eAAO,MAAM,gBAAgB,eAAwC,CAAC;AAEtE;;GAEG;AAEH,eAAO,MAAM,gBAAgB,eAAwC,CAAC;AAEtE;;GAEG;AAEH,eAAO,MAAM,eAAe,eAAuC,CAAC;AAEpE;;GAEG;AAEH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,aAAa,CAAC,CAI3E,CAAC"}
|
package/dist/gtin-validator.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import { NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
-
import { checkDigit, hasValidCheckDigit } from "./check.js";
|
|
3
|
-
import { GTINLengths } from "./gtin-length.js";
|
|
4
|
-
import { IdentifierDescriptors } from "./identifier-descriptors.js";
|
|
5
|
-
import { i18nextGS1 } from "./locale/i18n.js";
|
|
6
|
-
import { NumericIdentifierValidator } from "./numeric-identifier-validator.js";
|
|
7
|
-
import { PrefixTypes } from "./prefix-type.js";
|
|
8
|
-
import { PrefixValidator } from "./prefix-validator.js";
|
|
9
|
-
/**
|
|
10
|
-
* Levels at which GTIN is to be validated.
|
|
11
|
-
*/
|
|
12
|
-
export const GTINLevels = {
|
|
13
|
-
/**
|
|
14
|
-
* Any level (level is ignored).
|
|
15
|
-
*/
|
|
16
|
-
Any: 0,
|
|
17
|
-
/**
|
|
18
|
-
* Retail consumer trade item level, supporting GTIN-13, GTIN-12 (optionally zero-suppressed), and GTIN-8.
|
|
19
|
-
*/
|
|
20
|
-
RetailConsumer: 1,
|
|
21
|
-
/**
|
|
22
|
-
* Other than retail consumer trade item level, supporting GTIN-13, GTIN-12 (not zero-suppressed), and GTIN-14.
|
|
23
|
-
*/
|
|
24
|
-
OtherThanRetailConsumer: 2
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* GTIN validator.
|
|
28
|
-
*/
|
|
29
|
-
export class GTINValidator extends NumericIdentifierValidator {
|
|
30
|
-
/**
|
|
31
|
-
* Validation parameters for optional indicator digit.
|
|
32
|
-
*/
|
|
33
|
-
static #OPTIONAL_INDICATOR_DIGIT_VALIDATION = {
|
|
34
|
-
minimumLength: 0,
|
|
35
|
-
maximumLength: 1,
|
|
36
|
-
component: () => i18nextGS1.t("Identifier.indicatorDigit")
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Validation parameters for zero-suppressed GTIN-12.
|
|
40
|
-
*/
|
|
41
|
-
static #ZERO_SUPPRESSED_GTIN12_VALIDATION = {
|
|
42
|
-
minimumLength: 8,
|
|
43
|
-
maximumLength: 8
|
|
44
|
-
};
|
|
45
|
-
static #ERROR_MESSAGE_PARSE_KEYS = {
|
|
46
|
-
[GTINLevels.Any]: undefined,
|
|
47
|
-
[GTINLevels.RetailConsumer]: "Identifier.invalidGTINAtRetail",
|
|
48
|
-
[GTINLevels.OtherThanRetailConsumer]: "Identifier.invalidGTINAtOtherThanRetail"
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Prefix type.
|
|
52
|
-
*/
|
|
53
|
-
#prefixType;
|
|
54
|
-
/**
|
|
55
|
-
* Constructor.
|
|
56
|
-
*
|
|
57
|
-
* @param gtinBaseLength
|
|
58
|
-
* GTIN base length (all except GTIN-14).
|
|
59
|
-
*/
|
|
60
|
-
constructor(gtinBaseLength) {
|
|
61
|
-
const identifierDescriptor = IdentifierDescriptors.GTIN[gtinBaseLength];
|
|
62
|
-
super(identifierDescriptor);
|
|
63
|
-
this.#prefixType = identifierDescriptor.prefixType;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* @inheritDoc
|
|
67
|
-
*/
|
|
68
|
-
get prefixType() {
|
|
69
|
-
return this.#prefixType;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @inheritDoc
|
|
73
|
-
*/
|
|
74
|
-
validatePrefix(partialIdentifier) {
|
|
75
|
-
// Delegate to prefix validator requiring exact match for prefix type.
|
|
76
|
-
PrefixValidator.validate(this.prefixType, false, false, partialIdentifier, true, true);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Zero suppress a GTIN-12.
|
|
80
|
-
*
|
|
81
|
-
* @param gtin12
|
|
82
|
-
* GTIN-12.
|
|
83
|
-
*
|
|
84
|
-
* @returns
|
|
85
|
-
* Zero-suppressed GTIN-12.
|
|
86
|
-
*/
|
|
87
|
-
static zeroSuppress(gtin12) {
|
|
88
|
-
GTIN12_VALIDATOR.validate(gtin12);
|
|
89
|
-
// Convert to individual digits.
|
|
90
|
-
const d = Array.from(gtin12);
|
|
91
|
-
let zeroSuppressedGTIN12;
|
|
92
|
-
// All rules require that digits in positions 1, 5, and 6 be zero.
|
|
93
|
-
if (d[0] === "0" && d[6] === "0" && d[7] === "0") {
|
|
94
|
-
if (d[10] >= "5" && d[8] === "0" && d[9] === "0" && d[5] !== "0") {
|
|
95
|
-
zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[5]}${d[10]}${d[11]}`;
|
|
96
|
-
}
|
|
97
|
-
else if (d[5] === "0" && d[8] === "0" && d[9] === "0" && d[4] !== "0") {
|
|
98
|
-
zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[10]}4${d[11]}`;
|
|
99
|
-
}
|
|
100
|
-
else if (d[3] <= "2" && d[4] === "0" && d[5] === "0") {
|
|
101
|
-
zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[8]}${d[9]}${d[10]}${d[3]}${d[11]}`;
|
|
102
|
-
}
|
|
103
|
-
else if (d[3] >= "3" && d[4] === "0" && d[5] === "0" && d[8] === "0") {
|
|
104
|
-
zeroSuppressedGTIN12 = `0${d[1]}${d[2]}${d[3]}${d[9]}${d[10]}3${d[11]}`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (zeroSuppressedGTIN12 === undefined) {
|
|
108
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidZeroSuppressibleGTIN12"));
|
|
109
|
-
}
|
|
110
|
-
return zeroSuppressedGTIN12;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Zero expand a zero-suppressed GTIN-12.
|
|
114
|
-
*
|
|
115
|
-
* @param zeroSuppressedGTIN12
|
|
116
|
-
* Zero-suppressed GTIN-12.
|
|
117
|
-
*
|
|
118
|
-
* @returns
|
|
119
|
-
* GTIN-12.
|
|
120
|
-
*/
|
|
121
|
-
static zeroExpand(zeroSuppressedGTIN12) {
|
|
122
|
-
NUMERIC_CREATOR.validate(zeroSuppressedGTIN12, GTINValidator.#ZERO_SUPPRESSED_GTIN12_VALIDATION);
|
|
123
|
-
// Convert to individual digits.
|
|
124
|
-
const d = Array.from(zeroSuppressedGTIN12);
|
|
125
|
-
let gtin12;
|
|
126
|
-
// Zero-suppressed GTIN-12 always starts with 0.
|
|
127
|
-
if (d[0] === "0") {
|
|
128
|
-
if (d[6] >= "5" && d[5] !== "0") {
|
|
129
|
-
gtin12 = `0${d[1]}${d[2]}${d[3]}${d[4]}${d[5]}0000${d[6]}${d[7]}`;
|
|
130
|
-
}
|
|
131
|
-
else if (d[6] === "4" && d[4] !== "0") {
|
|
132
|
-
gtin12 = `0${d[1]}${d[2]}${d[3]}${d[4]}00000${d[5]}${d[7]}`;
|
|
133
|
-
}
|
|
134
|
-
else if (d[6] <= "2") {
|
|
135
|
-
gtin12 = `0${d[1]}${d[2]}${d[6]}0000${d[3]}${d[4]}${d[5]}${d[7]}`;
|
|
136
|
-
}
|
|
137
|
-
else if (d[6] === "3" && d[3] >= "3") {
|
|
138
|
-
gtin12 = `0${d[1]}${d[2]}${d[3]}00000${d[4]}${d[5]}${d[7]}`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (gtin12 === undefined) {
|
|
142
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidZeroSuppressedGTIN12"));
|
|
143
|
-
}
|
|
144
|
-
// Make sure that resulting GTIN-12 is valid.
|
|
145
|
-
GTIN12_VALIDATOR.validate(gtin12);
|
|
146
|
-
return gtin12;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Convert a GTIN of any length to a GTIN-14 with an optional indicator digit.
|
|
150
|
-
*
|
|
151
|
-
* @param indicatorDigit
|
|
152
|
-
* Indicator digit. If blank, assumes "0" if the GTIN is not already a GTIN-14.
|
|
153
|
-
*
|
|
154
|
-
* @param gtin
|
|
155
|
-
* GTIN.
|
|
156
|
-
*
|
|
157
|
-
* @returns
|
|
158
|
-
* GTIN-14.
|
|
159
|
-
*/
|
|
160
|
-
static convertToGTIN14(indicatorDigit, gtin) {
|
|
161
|
-
NUMERIC_CREATOR.validate(indicatorDigit, GTINValidator.#OPTIONAL_INDICATOR_DIGIT_VALIDATION);
|
|
162
|
-
// Check digit doesn't change by prepending zeros.
|
|
163
|
-
let gtin14 = GTINValidator.normalize(gtin).padStart(GTINLengths.GTIN14, "0");
|
|
164
|
-
// If indicator digit provided and is different, recalculate the check digit.
|
|
165
|
-
if (indicatorDigit.length !== 0 && !gtin14.startsWith(indicatorDigit)) {
|
|
166
|
-
const partialGTIN14 = `${indicatorDigit}${gtin14.substring(1, GTINLengths.GTIN14 - 1)}`;
|
|
167
|
-
gtin14 = `${partialGTIN14}${checkDigit(partialGTIN14)}`;
|
|
168
|
-
}
|
|
169
|
-
return gtin14;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Normalize a GTIN of any length.
|
|
173
|
-
* - A GTIN-14 that starts with six zeros or a GTIN-13 that starts with five zeros is normalized to GTIN-8.
|
|
174
|
-
* - A GTIN-14 that starts with two zeros or a GTIN-13 that starts with one zero is normalized to GTIN-12.
|
|
175
|
-
* - A GTIN-14 that starts with one zero is normalized to GTIN-13.
|
|
176
|
-
* - Otherwise, the GTIN is unchanged.
|
|
177
|
-
*
|
|
178
|
-
* @param gtin
|
|
179
|
-
* GTIN.
|
|
180
|
-
*
|
|
181
|
-
* @returns
|
|
182
|
-
* Normalized GTIN.
|
|
183
|
-
*/
|
|
184
|
-
static normalize(gtin) {
|
|
185
|
-
const gtinLength = gtin.length;
|
|
186
|
-
let normalizedGTIN;
|
|
187
|
-
switch (gtinLength) {
|
|
188
|
-
case GTINLengths.GTIN13:
|
|
189
|
-
if (!gtin.startsWith("0")) {
|
|
190
|
-
// GTIN is GTIN-13.
|
|
191
|
-
normalizedGTIN = gtin;
|
|
192
|
-
}
|
|
193
|
-
else if (!gtin.startsWith("00000")) {
|
|
194
|
-
// GTIN is GTIN-12.
|
|
195
|
-
normalizedGTIN = gtin.substring(1);
|
|
196
|
-
}
|
|
197
|
-
else if (!gtin.startsWith("000000")) {
|
|
198
|
-
// GTIN is GTIN-8.
|
|
199
|
-
normalizedGTIN = gtin.substring(5);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidZeroSuppressedGTIN12AsGTIN13"));
|
|
203
|
-
}
|
|
204
|
-
break;
|
|
205
|
-
case GTINLengths.GTIN12:
|
|
206
|
-
// GTIN is GTIN-12.
|
|
207
|
-
normalizedGTIN = gtin;
|
|
208
|
-
break;
|
|
209
|
-
case GTINLengths.GTIN8:
|
|
210
|
-
if (!gtin.startsWith("0")) {
|
|
211
|
-
// GTIN is GTIN-8.
|
|
212
|
-
normalizedGTIN = gtin;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
// GTIN is zero-suppressed GTIN-12.
|
|
216
|
-
normalizedGTIN = GTINValidator.zeroExpand(gtin);
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
case GTINLengths.GTIN14:
|
|
220
|
-
if (!gtin.startsWith("0")) {
|
|
221
|
-
// GTIN is GTIN-14.
|
|
222
|
-
normalizedGTIN = gtin;
|
|
223
|
-
}
|
|
224
|
-
else if (!gtin.startsWith("00")) {
|
|
225
|
-
// GTIN is GTIN-13.
|
|
226
|
-
normalizedGTIN = gtin.substring(1);
|
|
227
|
-
}
|
|
228
|
-
else if (!gtin.startsWith("000000")) {
|
|
229
|
-
// GTIN is GTIN-12.
|
|
230
|
-
normalizedGTIN = gtin.substring(2);
|
|
231
|
-
}
|
|
232
|
-
else if (!gtin.startsWith("0000000")) {
|
|
233
|
-
// GTIN is GTIN-8.
|
|
234
|
-
normalizedGTIN = gtin.substring(6);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidZeroSuppressedGTIN12AsGTIN14"));
|
|
238
|
-
}
|
|
239
|
-
break;
|
|
240
|
-
default:
|
|
241
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidGTINLength"));
|
|
242
|
-
}
|
|
243
|
-
// Validation applies to the normalized GTIN.
|
|
244
|
-
GTINValidator.validateAny(normalizedGTIN);
|
|
245
|
-
return normalizedGTIN;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Validate any GTIN, optionally against a level.
|
|
249
|
-
*
|
|
250
|
-
* @param gtin
|
|
251
|
-
* GTIN.
|
|
252
|
-
*
|
|
253
|
-
* @param gtinLevel
|
|
254
|
-
* Level at which GTIN is to be validated.
|
|
255
|
-
*/
|
|
256
|
-
static validateAny(gtin, gtinLevel = GTINLevels.Any) {
|
|
257
|
-
// Assume length-validated GTIN is the GTIN (true for all except zero-suppressed GTIN-12).
|
|
258
|
-
let lengthValidatedGTIN = gtin;
|
|
259
|
-
let prefixType;
|
|
260
|
-
let allowUPCCompanyPrefix = false;
|
|
261
|
-
let allowGS18Prefix = false;
|
|
262
|
-
let validatePrefix = gtin;
|
|
263
|
-
let gtinLevelRestriction;
|
|
264
|
-
switch (gtin.length) {
|
|
265
|
-
case GTINLengths.GTIN13:
|
|
266
|
-
// Validate prefix with restrictions on prefix type depending on GTIN level.
|
|
267
|
-
prefixType = PrefixTypes.GS1CompanyPrefix;
|
|
268
|
-
allowUPCCompanyPrefix = gtinLevel !== GTINLevels.RetailConsumer;
|
|
269
|
-
allowGS18Prefix = gtinLevel === GTINLevels.Any;
|
|
270
|
-
gtinLevelRestriction = GTINLevels.Any;
|
|
271
|
-
break;
|
|
272
|
-
case GTINLengths.GTIN12:
|
|
273
|
-
// Validate prefix requiring exact match for prefix type.
|
|
274
|
-
prefixType = PrefixTypes.UPCCompanyPrefix;
|
|
275
|
-
gtinLevelRestriction = GTINLevels.Any;
|
|
276
|
-
break;
|
|
277
|
-
case GTINLengths.GTIN8:
|
|
278
|
-
// Zero-suppressed GTIN-12 always starts with 0.
|
|
279
|
-
if (!gtin.startsWith("0")) {
|
|
280
|
-
// Validate prefix requiring exact match for prefix type.
|
|
281
|
-
prefixType = PrefixTypes.GS18Prefix;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
lengthValidatedGTIN = GTINValidator.zeroExpand(gtin);
|
|
285
|
-
prefixType = undefined;
|
|
286
|
-
}
|
|
287
|
-
gtinLevelRestriction = GTINLevels.RetailConsumer;
|
|
288
|
-
break;
|
|
289
|
-
case GTINLengths.GTIN14:
|
|
290
|
-
// Validate prefix with restrictions on prefix type depending on GTIN level.
|
|
291
|
-
prefixType = PrefixTypes.GS1CompanyPrefix;
|
|
292
|
-
allowUPCCompanyPrefix = true;
|
|
293
|
-
allowGS18Prefix = gtinLevel !== GTINLevels.OtherThanRetailConsumer || !gtin.startsWith("0");
|
|
294
|
-
validatePrefix = gtin.substring(1);
|
|
295
|
-
gtinLevelRestriction = GTINLevels.OtherThanRetailConsumer;
|
|
296
|
-
break;
|
|
297
|
-
default:
|
|
298
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidGTINLength"));
|
|
299
|
-
}
|
|
300
|
-
if (prefixType !== undefined) {
|
|
301
|
-
PrefixValidator.validate(prefixType, allowUPCCompanyPrefix, allowGS18Prefix, validatePrefix, true, true, GTINValidator.#ERROR_MESSAGE_PARSE_KEYS[gtinLevel]);
|
|
302
|
-
}
|
|
303
|
-
// Validating the check digit will also validate the characters.
|
|
304
|
-
if (!hasValidCheckDigit(lengthValidatedGTIN)) {
|
|
305
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidCheckDigit"));
|
|
306
|
-
}
|
|
307
|
-
// Validate against level if required.
|
|
308
|
-
if (gtinLevel !== GTINLevels.Any && gtinLevelRestriction !== GTINLevels.Any && gtinLevelRestriction !== gtinLevel) {
|
|
309
|
-
throw new RangeError(i18nextGS1.t(gtinLevel === GTINLevels.RetailConsumer ? "Identifier.invalidGTINAtRetail" : "Identifier.invalidGTINAtOtherThanRetail"));
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Validate a GTIN-14.
|
|
314
|
-
*
|
|
315
|
-
* @param gtin14
|
|
316
|
-
* GTIN-14.
|
|
317
|
-
*/
|
|
318
|
-
static validateGTIN14(gtin14) {
|
|
319
|
-
if (gtin14.length !== GTINLengths.GTIN14) {
|
|
320
|
-
throw new RangeError(i18nextGS1.t("Identifier.invalidGTIN14Length"));
|
|
321
|
-
}
|
|
322
|
-
GTINValidator.validateAny(gtin14);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* GTIN-13 validator.
|
|
327
|
-
*/
|
|
328
|
-
// Defined here because of circular reference.
|
|
329
|
-
export const GTIN13_VALIDATOR = new GTINValidator(GTINLengths.GTIN13);
|
|
330
|
-
/**
|
|
331
|
-
* GTIN-12 validator.
|
|
332
|
-
*/
|
|
333
|
-
// Defined here because of circular reference.
|
|
334
|
-
export const GTIN12_VALIDATOR = new GTINValidator(GTINLengths.GTIN12);
|
|
335
|
-
/**
|
|
336
|
-
* GTIN-8 validator.
|
|
337
|
-
*/
|
|
338
|
-
// Defined here because of circular reference.
|
|
339
|
-
export const GTIN8_VALIDATOR = new GTINValidator(GTINLengths.GTIN8);
|
|
340
|
-
/**
|
|
341
|
-
* GTIN validators indexed by prefix type.
|
|
342
|
-
*/
|
|
343
|
-
// Defined here because of circular reference.
|
|
344
|
-
export const GTIN_VALIDATORS = {
|
|
345
|
-
[GTINLengths.GTIN13]: GTIN13_VALIDATOR,
|
|
346
|
-
[GTINLengths.GTIN12]: GTIN12_VALIDATOR,
|
|
347
|
-
[GTINLengths.GTIN8]: GTIN8_VALIDATOR
|
|
348
|
-
};
|
|
349
|
-
//# sourceMappingURL=gtin-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gtin-validator.js","sourceRoot":"","sources":["../src/gtin-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAuB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB;;OAEG;IACH,GAAG,EAAE,CAAC;IAEN;;OAEG;IACH,cAAc,EAAE,CAAC;IAEjB;;OAEG;IACH,uBAAuB,EAAE,CAAC;CACpB,CAAC;AAYX;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,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idation, IdentifierValidator } from "./identifier-validator.js";
|
|
3
|
-
import type { PrefixProvider } from "./prefix-provider.js";
|
|
4
|
-
/**
|
|
5
|
-
* Identifier creator. Creates an identifier based on its definition in section 3 of the {@link
|
|
6
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
7
|
-
*
|
|
8
|
-
* Keys are created based on a prefix defined in a prefix provider to which the identifier creator is bound.
|
|
9
|
-
*
|
|
10
|
-
* @template TIdentifierType
|
|
11
|
-
* Identifier type type.
|
|
12
|
-
*
|
|
13
|
-
* @template TIdentifierValidation
|
|
14
|
-
* Identifier validation type.
|
|
15
|
-
*/
|
|
16
|
-
export interface IdentifierCreator<TIdentifierType extends IdentifierType = IdentifierType, TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends IdentifierValidator<TIdentifierType, TIdentifierValidation> {
|
|
17
|
-
/**
|
|
18
|
-
* Get the prefix provider to which this identifier creator is bound.
|
|
19
|
-
*/
|
|
20
|
-
get prefixProvider(): PrefixProvider;
|
|
21
|
-
/**
|
|
22
|
-
* Get the prefix, equivalent to calling {@linkcode PrefixProvider.prefix | prefixProvider.prefix} for a GTIN or
|
|
23
|
-
* {@linkcode PrefixProvider.gs1CompanyPrefix | prefixProvider.gs1CompanyPrefix} for all other identifier types.
|
|
24
|
-
*/
|
|
25
|
-
get prefix(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get the reference length.
|
|
28
|
-
*/
|
|
29
|
-
get referenceLength(): number;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=identifier-creator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-creator.d.ts","sourceRoot":"","sources":["../src/identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB,CAAC,eAAe,SAAS,cAAc,GAAG,cAAc,EAAE,qBAAqB,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,mBAAmB,CAAC,eAAe,EAAE,qBAAqB,CAAC;IACtO;;OAEG;IACH,IAAI,cAAc,IAAI,cAAc,CAAC;IAErC;;;OAGG;IACH,IAAI,MAAM,IAAI,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAAC;CACjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-creator.js","sourceRoot":"","sources":["../src/identifier-creator.ts"],"names":[],"mappings":""}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { GTINCreator } from "./gtin-creator.js";
|
|
2
|
-
import type { GTINBaseLength } from "./gtin-length.js";
|
|
3
|
-
import type { GTINType } from "./gtin-type.js";
|
|
4
|
-
import type { IdentifierCreator } from "./identifier-creator.js";
|
|
5
|
-
import { type IdentifierTypeExtension } from "./identifier-extension.js";
|
|
6
|
-
import type { IdentifierType } from "./identifier-type.js";
|
|
7
|
-
import type { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator.js";
|
|
8
|
-
import { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator.js";
|
|
9
|
-
import { NonSerializableNumericIdentifierCreator } from "./non-serializable-numeric-identifier-creator.js";
|
|
10
|
-
import type { NumericIdentifierCreator } from "./numeric-identifier-creator.js";
|
|
11
|
-
import type { PrefixProvider } from "./prefix-provider.js";
|
|
12
|
-
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
13
|
-
/**
|
|
14
|
-
* Identifier creator type based on identifier type type.
|
|
15
|
-
*
|
|
16
|
-
* @template TIdentifierType
|
|
17
|
-
* Identifier type type.
|
|
18
|
-
*/
|
|
19
|
-
export type IdentifierTypeCreator<TIdentifierType extends IdentifierType> = IdentifierTypeExtension<TIdentifierType, IdentifierCreator, NumericIdentifierCreator, GTINCreator, NonGTINNumericIdentifierCreator, NonSerializableNumericIdentifierCreator, SerializableNumericIdentifierCreator, NonNumericIdentifierCreator>;
|
|
20
|
-
/**
|
|
21
|
-
* Identifier creators entry type based on identifier type type.
|
|
22
|
-
*
|
|
23
|
-
* @template TIdentifierType
|
|
24
|
-
* Identifier type type.
|
|
25
|
-
*/
|
|
26
|
-
export type IdentifierCreatorsEntry<TIdentifierType extends IdentifierType> = IdentifierTypeCreator<TIdentifierType>;
|
|
27
|
-
/**
|
|
28
|
-
* Identifier creators record type.
|
|
29
|
-
*/
|
|
30
|
-
export type IdentifierCreatorsRecord = {
|
|
31
|
-
[TIdentifierType in IdentifierType]: IdentifierCreatorsEntry<TIdentifierType>;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* GTIN creator constructor type.
|
|
35
|
-
*/
|
|
36
|
-
export type GTINCreatorConstructor = new (prefixProvider: PrefixProvider, gtinBaseLength: GTINBaseLength) => GTINCreator;
|
|
37
|
-
/**
|
|
38
|
-
* Non-GTIN creator constructor type.
|
|
39
|
-
*
|
|
40
|
-
* @template TIdentifierType
|
|
41
|
-
* Identifier type type.
|
|
42
|
-
*/
|
|
43
|
-
export type NonGTINCreatorConstructor<TIdentifierType extends Exclude<IdentifierType, GTINType>> = new (prefixProvider: PrefixProvider, identifierType: TIdentifierType) => IdentifierCreatorsRecord[TIdentifierType];
|
|
44
|
-
/**
|
|
45
|
-
* Identifier creator constructors entry type based on identifier type type.
|
|
46
|
-
*
|
|
47
|
-
* @template TIdentifierType
|
|
48
|
-
* Identifier type type.
|
|
49
|
-
*/
|
|
50
|
-
export type IdentifierCreatorConstructorsEntry<TIdentifierType extends IdentifierType> = TIdentifierType extends GTINType ? GTINCreatorConstructor : NonGTINCreatorConstructor<Exclude<TIdentifierType, GTINType>>;
|
|
51
|
-
/**
|
|
52
|
-
* Identifier creator constructors record type.
|
|
53
|
-
*/
|
|
54
|
-
export type IdentifierCreatorConstructorsRecord = {
|
|
55
|
-
readonly [TIdentifierType in IdentifierType]: IdentifierCreatorConstructorsEntry<TIdentifierType>;
|
|
56
|
-
};
|
|
57
|
-
export declare const IdentifierCreatorConstructors: IdentifierCreatorConstructorsRecord;
|
|
58
|
-
/**
|
|
59
|
-
* Determine if identifier creator is a numeric identifier creator.
|
|
60
|
-
*
|
|
61
|
-
* @param identifierCreator
|
|
62
|
-
* Identifier creator.
|
|
63
|
-
*
|
|
64
|
-
* @returns
|
|
65
|
-
* True if identifier creator is a numeric identifier creator.
|
|
66
|
-
*/
|
|
67
|
-
export declare function isNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NumericIdentifierCreator;
|
|
68
|
-
/**
|
|
69
|
-
* Determine if identifier creator is a GTIN creator.
|
|
70
|
-
*
|
|
71
|
-
* @param identifierCreator
|
|
72
|
-
* Identifier creator.
|
|
73
|
-
*
|
|
74
|
-
* @returns
|
|
75
|
-
* True if identifier creator is a GTIN creator.
|
|
76
|
-
*/
|
|
77
|
-
export declare function isGTINCreator(identifierCreator: IdentifierCreator): identifierCreator is GTINCreator;
|
|
78
|
-
/**
|
|
79
|
-
* Determine if identifier creator is a non-GTIN numeric identifier creator.
|
|
80
|
-
*
|
|
81
|
-
* @param identifierCreator
|
|
82
|
-
* Identifier creator.
|
|
83
|
-
*
|
|
84
|
-
* @returns
|
|
85
|
-
* True if identifier creator is a non-GTIN numeric identifier creator.
|
|
86
|
-
*/
|
|
87
|
-
export declare function isNonGTINNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonGTINNumericIdentifierCreator;
|
|
88
|
-
/**
|
|
89
|
-
* Determine if identifier creator is a non-serializable numeric identifier creator.
|
|
90
|
-
*
|
|
91
|
-
* @param identifierCreator
|
|
92
|
-
* Identifier creator.
|
|
93
|
-
*
|
|
94
|
-
* @returns
|
|
95
|
-
* True if identifier creator is a non-serializable numeric identifier creator.
|
|
96
|
-
*/
|
|
97
|
-
export declare function isNonSerializableNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonSerializableNumericIdentifierCreator;
|
|
98
|
-
/**
|
|
99
|
-
* Determine if identifier creator is a serializable numeric identifier creator.
|
|
100
|
-
*
|
|
101
|
-
* @param identifierCreator
|
|
102
|
-
* Identifier creator.
|
|
103
|
-
*
|
|
104
|
-
* @returns
|
|
105
|
-
* True if identifier creator is a serializable numeric identifier creator.
|
|
106
|
-
*/
|
|
107
|
-
export declare function isSerializableNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is SerializableNumericIdentifierCreator;
|
|
108
|
-
/**
|
|
109
|
-
* Determine if identifier creator is a non-numeric identifier creator.
|
|
110
|
-
*
|
|
111
|
-
* @param identifierCreator
|
|
112
|
-
* Identifier creator.
|
|
113
|
-
*
|
|
114
|
-
* @returns
|
|
115
|
-
* True if identifier creator is a non-numeric identifier creator.
|
|
116
|
-
*/
|
|
117
|
-
export declare function isNonNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonNumericIdentifierCreator;
|
|
118
|
-
//# sourceMappingURL=identifier-creators.d.ts.map
|