@aidc-toolkit/gs1 1.0.26-beta → 1.0.27-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/abstract-identifier-creator.d.ts +66 -66
- package/dist/abstract-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-identifier-creator.js +68 -45
- package/dist/abstract-identifier-creator.js.map +1 -1
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts +42 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js +40 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/abstract-numeric-identifier-creator.d.ts +37 -86
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-numeric-identifier-creator.js +144 -121
- package/dist/abstract-numeric-identifier-creator.js.map +1 -1
- package/dist/content-character-set-creators.d.ts +4 -0
- package/dist/content-character-set-creators.d.ts.map +1 -0
- package/dist/content-character-set-creators.js +9 -0
- package/dist/content-character-set-creators.js.map +1 -0
- package/dist/gtin-creator.d.ts +7 -12
- package/dist/gtin-creator.d.ts.map +1 -1
- package/dist/gtin-creator.js +11 -14
- package/dist/gtin-creator.js.map +1 -1
- package/dist/gtin-descriptor.d.ts +8 -3
- package/dist/gtin-descriptor.d.ts.map +1 -1
- package/dist/gtin-length.d.ts +64 -0
- package/dist/gtin-length.d.ts.map +1 -0
- package/dist/gtin-length.js +36 -0
- package/dist/gtin-length.js.map +1 -0
- package/dist/gtin-type.d.ts +15 -28
- package/dist/gtin-type.d.ts.map +1 -1
- package/dist/gtin-type.js +4 -28
- package/dist/gtin-type.js.map +1 -1
- package/dist/gtin-validator.d.ts +9 -23
- package/dist/gtin-validator.d.ts.map +1 -1
- package/dist/gtin-validator.js +32 -39
- package/dist/gtin-validator.js.map +1 -1
- package/dist/identifier-creator.d.ts +4 -4
- package/dist/identifier-creator.d.ts.map +1 -1
- package/dist/{creators.d.ts → identifier-creators.d.ts} +16 -7
- package/dist/identifier-creators.d.ts.map +1 -0
- package/dist/{creators.js → identifier-creators.js} +19 -7
- package/dist/identifier-creators.js.map +1 -0
- package/dist/{descriptors.d.ts → identifier-descriptors.d.ts} +20 -10
- package/dist/identifier-descriptors.d.ts.map +1 -0
- package/dist/{descriptors.js → identifier-descriptors.js} +27 -31
- package/dist/identifier-descriptors.js.map +1 -0
- package/dist/identifier-extension.d.ts +82 -0
- package/dist/identifier-extension.d.ts.map +1 -0
- package/dist/identifier-extension.js +79 -0
- package/dist/identifier-extension.js.map +1 -0
- package/dist/identifier-validator.d.ts +44 -9
- package/dist/identifier-validator.d.ts.map +1 -1
- package/dist/identifier-validator.js +109 -1
- package/dist/identifier-validator.js.map +1 -1
- package/dist/{validators.d.ts → identifier-validators.d.ts} +21 -11
- package/dist/identifier-validators.d.ts.map +1 -0
- package/dist/{validators.js → identifier-validators.js} +25 -12
- package/dist/identifier-validators.js.map +1 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/leader-type.d.ts +26 -0
- package/dist/leader-type.d.ts.map +1 -0
- package/dist/leader-type.js +18 -0
- package/dist/leader-type.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts +7 -19
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-creator.js +1 -22
- package/dist/non-gtin-numeric-identifier-creator.js.map +1 -1
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts +1 -1
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-type.d.ts +22 -3
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-type.js +7 -1
- package/dist/non-gtin-numeric-identifier-type.js.map +1 -1
- package/dist/non-gtin-numeric-identifier-validator.d.ts +5 -10
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-validator.js +5 -12
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -1
- package/dist/non-numeric-identifier-creator.d.ts +4 -9
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-creator.js +8 -10
- package/dist/non-numeric-identifier-creator.js.map +1 -1
- package/dist/non-numeric-identifier-type.d.ts +22 -3
- package/dist/non-numeric-identifier-type.d.ts.map +1 -1
- package/dist/non-numeric-identifier-type.js +7 -1
- package/dist/non-numeric-identifier-type.js.map +1 -1
- package/dist/non-numeric-identifier-validator.d.ts +3 -11
- package/dist/non-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-validator.js +8 -8
- package/dist/non-numeric-identifier-validator.js.map +1 -1
- package/dist/non-serializable-numeric-identifier-creator.d.ts +10 -0
- package/dist/non-serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-creator.js +8 -0
- package/dist/non-serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts +7 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js +2 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts +26 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.js +7 -0
- package/dist/non-serializable-numeric-identifier-type.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts +16 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.js +17 -0
- package/dist/non-serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/numeric-identifier-creator.d.ts +6 -6
- package/dist/numeric-identifier-creator.d.ts.map +1 -1
- package/dist/numeric-identifier-descriptor.d.ts +2 -1
- package/dist/numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/numeric-identifier-type.d.ts +19 -24
- package/dist/numeric-identifier-type.d.ts.map +1 -1
- package/dist/numeric-identifier-type.js +4 -15
- package/dist/numeric-identifier-type.js.map +1 -1
- package/dist/numeric-identifier-validator.d.ts +20 -6
- package/dist/numeric-identifier-validator.d.ts.map +1 -1
- package/dist/numeric-identifier-validator.js +60 -1
- package/dist/numeric-identifier-validator.js.map +1 -1
- package/dist/prefix-manager.d.ts +6 -102
- package/dist/prefix-manager.d.ts.map +1 -1
- package/dist/prefix-manager.js +65 -60
- package/dist/prefix-manager.js.map +1 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +3 -31
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-creator.js +7 -21
- package/dist/serializable-numeric-identifier-creator.js.map +1 -1
- package/dist/serializable-numeric-identifier-descriptor.d.ts +1 -1
- package/dist/serializable-numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-type.d.ts +22 -2
- package/dist/serializable-numeric-identifier-type.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-type.js +7 -1
- package/dist/serializable-numeric-identifier-type.js.map +1 -1
- package/dist/serializable-numeric-identifier-validator.d.ts +3 -18
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-validator.js +17 -16
- package/dist/serializable-numeric-identifier-validator.js.map +1 -1
- package/package.json +4 -5
- package/src/abstract-identifier-creator.ts +155 -74
- package/src/abstract-non-gtin-numeric-identifier-creator.ts +86 -0
- package/src/abstract-numeric-identifier-creator.ts +202 -133
- package/src/content-character-set-creators.ts +9 -0
- package/src/gtin-creator.ts +16 -15
- package/src/gtin-descriptor.ts +9 -3
- package/src/gtin-length.ts +61 -0
- package/src/gtin-type.ts +6 -37
- package/src/gtin-validator.ts +34 -41
- package/src/identifier-creator.ts +4 -4
- package/src/{creators.ts → identifier-creators.ts} +40 -26
- package/src/{descriptors.ts → identifier-descriptors.ts} +56 -54
- package/src/identifier-extension.ts +155 -0
- package/src/identifier-validator.ts +93 -10
- package/src/{validators.ts → identifier-validators.ts} +51 -36
- package/src/index.ts +15 -9
- package/src/leader-type.ts +29 -0
- package/src/non-gtin-numeric-identifier-creator.ts +7 -22
- package/src/non-gtin-numeric-identifier-descriptor.ts +1 -1
- package/src/non-gtin-numeric-identifier-type.ts +14 -3
- package/src/non-gtin-numeric-identifier-validator.ts +5 -13
- package/src/non-numeric-identifier-creator.ts +17 -12
- package/src/non-numeric-identifier-type.ts +14 -3
- package/src/non-numeric-identifier-validator.ts +8 -9
- package/src/non-serializable-numeric-identifier-creator.ts +12 -0
- package/src/non-serializable-numeric-identifier-descriptor.ts +7 -0
- package/src/non-serializable-numeric-identifier-type.ts +22 -0
- package/src/non-serializable-numeric-identifier-validator.ts +19 -0
- package/src/numeric-identifier-creator.ts +7 -6
- package/src/numeric-identifier-descriptor.ts +2 -1
- package/src/numeric-identifier-type.ts +17 -35
- package/src/numeric-identifier-validator.ts +61 -6
- package/src/prefix-manager.ts +67 -64
- package/src/serializable-numeric-identifier-creator.ts +11 -25
- package/src/serializable-numeric-identifier-descriptor.ts +1 -1
- package/src/serializable-numeric-identifier-type.ts +14 -5
- package/src/serializable-numeric-identifier-validator.ts +17 -16
- package/test/gtin-creator.ts +9 -2
- package/test/gtin-validator.test.ts +8 -10
- package/test/identifier-creator.ts +7 -7
- package/test/non-gtin-numeric-identifier-validator.ts +7 -2
- package/test/non-serializable-numeric-identifier-creator.ts +64 -0
- package/test/non-serializable-numeric-identifier-validator.ts +6 -0
- package/test/numeric-identifier-creator.ts +7 -2
- package/test/validator.test.ts +11 -10
- package/test/variable-measure-rcn.test.ts +23 -23
- package/dist/abstract-identifier-validator.d.ts +0 -95
- package/dist/abstract-identifier-validator.d.ts.map +0 -1
- package/dist/abstract-identifier-validator.js +0 -123
- package/dist/abstract-identifier-validator.js.map +0 -1
- package/dist/abstract-numeric-identifier-validator.d.ts +0 -35
- package/dist/abstract-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/abstract-numeric-identifier-validator.js +0 -61
- package/dist/abstract-numeric-identifier-validator.js.map +0 -1
- package/dist/creators.d.ts.map +0 -1
- package/dist/creators.js.map +0 -1
- package/dist/descriptors.d.ts.map +0 -1
- package/dist/descriptors.js.map +0 -1
- package/dist/validators.d.ts.map +0 -1
- package/dist/validators.js.map +0 -1
- package/src/abstract-identifier-validator.ts +0 -140
- package/src/abstract-numeric-identifier-validator.ts +0 -69
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ContentCharacterSets } from "./content-character-set.js";
|
|
2
|
-
import {
|
|
2
|
+
import { GTINBaseLengths } from "./gtin-length.js";
|
|
3
|
+
import { isGTINExtension, isNonGTINNumericIdentifierExtension, isNonNumericIdentifierExtension, isNonSerializableNumericIdentifierExtension, isNumericIdentifierExtension, isSerializableNumericIdentifierExtension } from "./identifier-extension.js";
|
|
3
4
|
import { IdentifierTypes } from "./identifier-type.js";
|
|
4
|
-
import { LeaderTypes } from "./
|
|
5
|
+
import { LeaderTypes } from "./leader-type.js";
|
|
5
6
|
import { PrefixTypes } from "./prefix-type.js";
|
|
6
7
|
/**
|
|
7
8
|
* GTIN-13 descriptor.
|
|
@@ -9,7 +10,7 @@ import { PrefixTypes } from "./prefix-type.js";
|
|
|
9
10
|
const GTIN13_DESCRIPTOR = {
|
|
10
11
|
identifierType: IdentifierTypes.GTIN,
|
|
11
12
|
prefixType: PrefixTypes.GS1CompanyPrefix,
|
|
12
|
-
length:
|
|
13
|
+
length: GTINBaseLengths.GTIN13,
|
|
13
14
|
referenceCharacterSet: ContentCharacterSets.Numeric,
|
|
14
15
|
leaderType: LeaderTypes.IndicatorDigit
|
|
15
16
|
};
|
|
@@ -19,7 +20,7 @@ const GTIN13_DESCRIPTOR = {
|
|
|
19
20
|
const GTIN12_DESCRIPTOR = {
|
|
20
21
|
identifierType: IdentifierTypes.GTIN,
|
|
21
22
|
prefixType: PrefixTypes.UPCCompanyPrefix,
|
|
22
|
-
length:
|
|
23
|
+
length: GTINBaseLengths.GTIN12,
|
|
23
24
|
referenceCharacterSet: ContentCharacterSets.Numeric,
|
|
24
25
|
leaderType: LeaderTypes.IndicatorDigit
|
|
25
26
|
};
|
|
@@ -29,7 +30,7 @@ const GTIN12_DESCRIPTOR = {
|
|
|
29
30
|
const GTIN8_DESCRIPTOR = {
|
|
30
31
|
identifierType: IdentifierTypes.GTIN,
|
|
31
32
|
prefixType: PrefixTypes.GS18Prefix,
|
|
32
|
-
length:
|
|
33
|
+
length: GTINBaseLengths.GTIN8,
|
|
33
34
|
referenceCharacterSet: ContentCharacterSets.Numeric,
|
|
34
35
|
leaderType: LeaderTypes.IndicatorDigit
|
|
35
36
|
};
|
|
@@ -37,9 +38,9 @@ const GTIN8_DESCRIPTOR = {
|
|
|
37
38
|
* GTIN descriptors indexed by prefix type.
|
|
38
39
|
*/
|
|
39
40
|
const GTIN_DESCRIPTORS = {
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
41
|
+
[GTINBaseLengths.GTIN13]: GTIN13_DESCRIPTOR,
|
|
42
|
+
[GTINBaseLengths.GTIN12]: GTIN12_DESCRIPTOR,
|
|
43
|
+
[GTINBaseLengths.GTIN8]: GTIN8_DESCRIPTOR
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* GLN descriptor.
|
|
@@ -186,22 +187,6 @@ export const IdentifierDescriptors = {
|
|
|
186
187
|
export function isGTINDescriptors(identifierDescriptorsOrDescriptor) {
|
|
187
188
|
return !("identifierType" in identifierDescriptorsOrDescriptor);
|
|
188
189
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Determine if an array of identifier types includes a given identifier type.
|
|
191
|
-
*
|
|
192
|
-
* @param identifierTypes
|
|
193
|
-
* Identifier types.
|
|
194
|
-
*
|
|
195
|
-
* @param identifierType
|
|
196
|
-
* Identifier type.
|
|
197
|
-
*
|
|
198
|
-
* @returns
|
|
199
|
-
* True if element is included in the array.
|
|
200
|
-
*/
|
|
201
|
-
function identifierTypesIncludes(identifierTypes, identifierType) {
|
|
202
|
-
return identifierTypes.includes(identifierType);
|
|
203
|
-
}
|
|
204
|
-
const NUMERIC_IDENTIFIER_TYPES = [IdentifierTypes.GTIN, IdentifierTypes.GLN, IdentifierTypes.SSCC, IdentifierTypes.GRAI, IdentifierTypes.GSRN, IdentifierTypes.GDTI, IdentifierTypes.GSIN, IdentifierTypes.GCN];
|
|
205
190
|
/**
|
|
206
191
|
* Determine if identifier descriptor is a numeric identifier descriptor.
|
|
207
192
|
*
|
|
@@ -212,7 +197,7 @@ const NUMERIC_IDENTIFIER_TYPES = [IdentifierTypes.GTIN, IdentifierTypes.GLN, Ide
|
|
|
212
197
|
* True if identifier descriptor is a numeric identifier descriptor.
|
|
213
198
|
*/
|
|
214
199
|
export function isNumericIdentifierDescriptor(identifierDescriptor) {
|
|
215
|
-
return
|
|
200
|
+
return isNumericIdentifierExtension(identifierDescriptor);
|
|
216
201
|
}
|
|
217
202
|
/**
|
|
218
203
|
* Determine if identifier descriptor is a GTIN descriptor.
|
|
@@ -224,7 +209,7 @@ export function isNumericIdentifierDescriptor(identifierDescriptor) {
|
|
|
224
209
|
* True if identifier descriptor is a GTIN descriptor.
|
|
225
210
|
*/
|
|
226
211
|
export function isGTINDescriptor(identifierDescriptor) {
|
|
227
|
-
return identifierDescriptor
|
|
212
|
+
return isGTINExtension(identifierDescriptor);
|
|
228
213
|
}
|
|
229
214
|
/**
|
|
230
215
|
* Determine if identifier descriptor is a non-GTIN numeric identifier descriptor.
|
|
@@ -236,9 +221,20 @@ export function isGTINDescriptor(identifierDescriptor) {
|
|
|
236
221
|
* True if identifier descriptor is a non-GTIN numeric identifier descriptor.
|
|
237
222
|
*/
|
|
238
223
|
export function isNonGTINNumericIdentifierDescriptor(identifierDescriptor) {
|
|
239
|
-
return
|
|
224
|
+
return isNonGTINNumericIdentifierExtension(identifierDescriptor);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Determine if identifier descriptor is a non-serializable numeric identifier descriptor.
|
|
228
|
+
*
|
|
229
|
+
* @param identifierDescriptor
|
|
230
|
+
* Identifier descriptor.
|
|
231
|
+
*
|
|
232
|
+
* @returns
|
|
233
|
+
* True if identifier descriptor is a non-serializable numeric identifier descriptor.
|
|
234
|
+
*/
|
|
235
|
+
export function isNonSerializableNumericIdentifierDescriptor(identifierDescriptor) {
|
|
236
|
+
return isNonSerializableNumericIdentifierExtension(identifierDescriptor);
|
|
240
237
|
}
|
|
241
|
-
const SERIALIZABLE_NUMERIC_IDENTIFIER_TYPES = [IdentifierTypes.GRAI, IdentifierTypes.GDTI, IdentifierTypes.GCN];
|
|
242
238
|
/**
|
|
243
239
|
* Determine if identifier descriptor is a serializable numeric identifier descriptor.
|
|
244
240
|
*
|
|
@@ -249,7 +245,7 @@ const SERIALIZABLE_NUMERIC_IDENTIFIER_TYPES = [IdentifierTypes.GRAI, IdentifierT
|
|
|
249
245
|
* True if identifier descriptor is a serializable numeric identifier descriptor.
|
|
250
246
|
*/
|
|
251
247
|
export function isSerializableNumericIdentifierDescriptor(identifierDescriptor) {
|
|
252
|
-
return
|
|
248
|
+
return isSerializableNumericIdentifierExtension(identifierDescriptor);
|
|
253
249
|
}
|
|
254
250
|
/**
|
|
255
251
|
* Determine if identifier descriptor is a non-numeric identifier descriptor.
|
|
@@ -261,6 +257,6 @@ export function isSerializableNumericIdentifierDescriptor(identifierDescriptor)
|
|
|
261
257
|
* True if identifier descriptor is a non-numeric identifier descriptor.
|
|
262
258
|
*/
|
|
263
259
|
export function isNonNumericIdentifierDescriptor(identifierDescriptor) {
|
|
264
|
-
return
|
|
260
|
+
return isNonNumericIdentifierExtension(identifierDescriptor);
|
|
265
261
|
}
|
|
266
|
-
//# sourceMappingURL=descriptors.js.map
|
|
262
|
+
//# sourceMappingURL=identifier-descriptors.js.map
|
|
@@ -0,0 +1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C;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,oBAA0C;IACvE,OAAO,eAAe,CAAC,oBAAoB,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oCAAoC,CAAC,oBAA0C;IAC3F,OAAO,mCAAmC,CAAC,oBAAoB,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4CAA4C,CAAC,oBAA0C;IACnG,OAAO,2CAA2C,CAAC,oBAAoB,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,yCAAyC,CAAC,oBAA0C;IAChG,OAAO,wCAAwC,CAAC,oBAAoB,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAAC,oBAA0C;IACvF,OAAO,+BAA+B,CAAC,oBAAoB,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { GTINDescriptor } from "./gtin-descriptor.js";
|
|
2
|
+
import { type GTINType } from "./gtin-type.js";
|
|
3
|
+
import type { IdentifierDescriptor } from "./identifier-descriptor.js";
|
|
4
|
+
import type { IdentifierType } from "./identifier-type.js";
|
|
5
|
+
import type { NonGTINNumericIdentifierDescriptor } from "./non-gtin-numeric-identifier-descriptor.js";
|
|
6
|
+
import { type NonGTINNumericIdentifierType } from "./non-gtin-numeric-identifier-type.js";
|
|
7
|
+
import type { NonNumericIdentifierDescriptor } from "./non-numeric-identifier-descriptor.js";
|
|
8
|
+
import { type NonNumericIdentifierType } from "./non-numeric-identifier-type.js";
|
|
9
|
+
import type { NonSerializableNumericIdentifierDescriptor } from "./non-serializable-numeric-identifier-descriptor.js";
|
|
10
|
+
import { type NonSerializableNumericIdentifierType } from "./non-serializable-numeric-identifier-type.js";
|
|
11
|
+
import type { NumericIdentifierDescriptor } from "./numeric-identifier-descriptor.js";
|
|
12
|
+
import { type NumericIdentifierType } from "./numeric-identifier-type.js";
|
|
13
|
+
import type { SerializableNumericIdentifierDescriptor } from "./serializable-numeric-identifier-descriptor.js";
|
|
14
|
+
import { type SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
15
|
+
/**
|
|
16
|
+
* Identifier extension type based on identifier type type.
|
|
17
|
+
*
|
|
18
|
+
* @template TIdentifierType
|
|
19
|
+
* Identifier type type.
|
|
20
|
+
*/
|
|
21
|
+
export type IdentifierTypeExtension<TIdentifierType extends IdentifierType, TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor, TGTINExtension extends TNumericIdentifierExtension & GTINDescriptor, TNonGTINNumericIdentifierExtension extends TNumericIdentifierExtension & NonGTINNumericIdentifierDescriptor, TNonSerializableNumericIdentifierExtension extends TNonGTINNumericIdentifierExtension & NonSerializableNumericIdentifierDescriptor, TSerializableNumericIdentifierExtension extends TNonGTINNumericIdentifierExtension & SerializableNumericIdentifierDescriptor, TNonNumericIdentifierExtension extends TIdentifierExtension & NonNumericIdentifierDescriptor> = TIdentifierType extends NumericIdentifierType ? TIdentifierType extends GTINType ? TGTINExtension : TIdentifierType extends NonGTINNumericIdentifierType ? TIdentifierType extends NonSerializableNumericIdentifierType ? TNonSerializableNumericIdentifierExtension : TIdentifierType extends SerializableNumericIdentifierType ? TSerializableNumericIdentifierExtension : TNonGTINNumericIdentifierExtension : TNumericIdentifierExtension : TIdentifierType extends NonNumericIdentifierType ? TNonNumericIdentifierExtension : TIdentifierExtension;
|
|
22
|
+
/**
|
|
23
|
+
* Determine if identifier extension is a numeric identifier extension.
|
|
24
|
+
*
|
|
25
|
+
* @param identifierDescriptor
|
|
26
|
+
* Identifier extension.
|
|
27
|
+
*
|
|
28
|
+
* @returns
|
|
29
|
+
* True if identifier extension is a numeric identifier extension.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isNumericIdentifierExtension<TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TNumericIdentifierExtension;
|
|
32
|
+
/**
|
|
33
|
+
* Determine if identifier extension is a GTIN extension.
|
|
34
|
+
*
|
|
35
|
+
* @param identifierDescriptor
|
|
36
|
+
* Identifier extension.
|
|
37
|
+
*
|
|
38
|
+
* @returns
|
|
39
|
+
* True if identifier extension is a GTIN extension.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isGTINExtension<TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor, TGTINExtension extends TNumericIdentifierExtension & GTINDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TGTINExtension;
|
|
42
|
+
/**
|
|
43
|
+
* Determine if identifier extension is a non-GTIN numeric identifier extension.
|
|
44
|
+
*
|
|
45
|
+
* @param identifierDescriptor
|
|
46
|
+
* Identifier extension.
|
|
47
|
+
*
|
|
48
|
+
* @returns
|
|
49
|
+
* True if identifier extension is a non-GTIN numeric identifier extension.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isNonGTINNumericIdentifierExtension<TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor, TNonGTINNumericIdentifierExtension extends TNumericIdentifierExtension & NonGTINNumericIdentifierDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TNonGTINNumericIdentifierExtension;
|
|
52
|
+
/**
|
|
53
|
+
* Determine if identifier extension is a non-serializable numeric identifier extension.
|
|
54
|
+
*
|
|
55
|
+
* @param identifierDescriptor
|
|
56
|
+
* Identifier extension.
|
|
57
|
+
*
|
|
58
|
+
* @returns
|
|
59
|
+
* True if identifier extension is a non-serializable numeric identifier extension.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isNonSerializableNumericIdentifierExtension<TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor, TNonGTINNumericIdentifierExtension extends TNumericIdentifierExtension & NonGTINNumericIdentifierDescriptor, TNonSerializableNumericIdentifierExtension extends TNonGTINNumericIdentifierExtension & NonSerializableNumericIdentifierDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TNonSerializableNumericIdentifierExtension;
|
|
62
|
+
/**
|
|
63
|
+
* Determine if identifier extension is a serializable numeric identifier extension.
|
|
64
|
+
*
|
|
65
|
+
* @param identifierDescriptor
|
|
66
|
+
* Identifier extension.
|
|
67
|
+
*
|
|
68
|
+
* @returns
|
|
69
|
+
* True if identifier extension is a serializable numeric identifier extension.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isSerializableNumericIdentifierExtension<TIdentifierExtension extends IdentifierDescriptor, TNumericIdentifierExtension extends TIdentifierExtension & NumericIdentifierDescriptor, TNonGTINNumericIdentifierExtension extends TNumericIdentifierExtension & NonGTINNumericIdentifierDescriptor, TSerializableNumericIdentifierExtension extends TNonGTINNumericIdentifierExtension & SerializableNumericIdentifierDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TSerializableNumericIdentifierExtension;
|
|
72
|
+
/**
|
|
73
|
+
* Determine if identifier extension is a non-numeric identifier extension.
|
|
74
|
+
*
|
|
75
|
+
* @param identifierDescriptor
|
|
76
|
+
* Identifier extension.
|
|
77
|
+
*
|
|
78
|
+
* @returns
|
|
79
|
+
* True if identifier extension is a non-numeric identifier extension.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isNonNumericIdentifierExtension<TIdentifierExtension extends IdentifierDescriptor, TNonNumericIdentifierExtension extends TIdentifierExtension & NonNumericIdentifierDescriptor>(identifierDescriptor: IdentifierDescriptor): identifierDescriptor is TNonNumericIdentifierExtension;
|
|
82
|
+
//# sourceMappingURL=identifier-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-extension.d.ts","sourceRoot":"","sources":["../src/identifier-extension.ts"],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tF,kCAAkC,SAAS,2BAA2B,GAAG,kCAAkC,EAC3G,uCAAuC,SAAS,kCAAkC,GAAG,uCAAuC,EAC9H,oBAAoB,EAAE,oBAAoB,GAAG,oBAAoB,IAAI,uCAAuC,CAE7G;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC3C,oBAAoB,SAAS,oBAAoB,EACjD,8BAA8B,SAAS,oBAAoB,GAAG,8BAA8B,EAC9F,oBAAoB,EAAE,oBAAoB,GAAG,oBAAoB,IAAI,8BAA8B,CAEpG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { GTINTypes } from "./gtin-type.js";
|
|
2
|
+
import { NonGTINNumericIdentifierTypes } from "./non-gtin-numeric-identifier-type.js";
|
|
3
|
+
import { NonNumericIdentifierTypes } from "./non-numeric-identifier-type.js";
|
|
4
|
+
import { NonSerializableNumericIdentifierTypes } from "./non-serializable-numeric-identifier-type.js";
|
|
5
|
+
import { NumericIdentifierTypes } from "./numeric-identifier-type.js";
|
|
6
|
+
import { SerializableNumericIdentifierTypes } from "./serializable-numeric-identifier-type.js";
|
|
7
|
+
/**
|
|
8
|
+
* Determine if identifier extension is a numeric identifier extension.
|
|
9
|
+
*
|
|
10
|
+
* @param identifierDescriptor
|
|
11
|
+
* Identifier extension.
|
|
12
|
+
*
|
|
13
|
+
* @returns
|
|
14
|
+
* True if identifier extension is a numeric identifier extension.
|
|
15
|
+
*/
|
|
16
|
+
export function isNumericIdentifierExtension(identifierDescriptor) {
|
|
17
|
+
return identifierDescriptor.identifierType in NumericIdentifierTypes;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Determine if identifier extension is a GTIN extension.
|
|
21
|
+
*
|
|
22
|
+
* @param identifierDescriptor
|
|
23
|
+
* Identifier extension.
|
|
24
|
+
*
|
|
25
|
+
* @returns
|
|
26
|
+
* True if identifier extension is a GTIN extension.
|
|
27
|
+
*/
|
|
28
|
+
export function isGTINExtension(identifierDescriptor) {
|
|
29
|
+
return identifierDescriptor.identifierType in GTINTypes;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Determine if identifier extension is a non-GTIN numeric identifier extension.
|
|
33
|
+
*
|
|
34
|
+
* @param identifierDescriptor
|
|
35
|
+
* Identifier extension.
|
|
36
|
+
*
|
|
37
|
+
* @returns
|
|
38
|
+
* True if identifier extension is a non-GTIN numeric identifier extension.
|
|
39
|
+
*/
|
|
40
|
+
export function isNonGTINNumericIdentifierExtension(identifierDescriptor) {
|
|
41
|
+
return identifierDescriptor.identifierType in NonGTINNumericIdentifierTypes;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Determine if identifier extension is a non-serializable numeric identifier extension.
|
|
45
|
+
*
|
|
46
|
+
* @param identifierDescriptor
|
|
47
|
+
* Identifier extension.
|
|
48
|
+
*
|
|
49
|
+
* @returns
|
|
50
|
+
* True if identifier extension is a non-serializable numeric identifier extension.
|
|
51
|
+
*/
|
|
52
|
+
export function isNonSerializableNumericIdentifierExtension(identifierDescriptor) {
|
|
53
|
+
return identifierDescriptor.identifierType in NonSerializableNumericIdentifierTypes;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Determine if identifier extension is a serializable numeric identifier extension.
|
|
57
|
+
*
|
|
58
|
+
* @param identifierDescriptor
|
|
59
|
+
* Identifier extension.
|
|
60
|
+
*
|
|
61
|
+
* @returns
|
|
62
|
+
* True if identifier extension is a serializable numeric identifier extension.
|
|
63
|
+
*/
|
|
64
|
+
export function isSerializableNumericIdentifierExtension(identifierDescriptor) {
|
|
65
|
+
return identifierDescriptor.identifierType in SerializableNumericIdentifierTypes;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determine if identifier extension is a non-numeric identifier extension.
|
|
69
|
+
*
|
|
70
|
+
* @param identifierDescriptor
|
|
71
|
+
* Identifier extension.
|
|
72
|
+
*
|
|
73
|
+
* @returns
|
|
74
|
+
* True if identifier extension is a non-numeric identifier extension.
|
|
75
|
+
*/
|
|
76
|
+
export function isNonNumericIdentifierExtension(identifierDescriptor) {
|
|
77
|
+
return identifierDescriptor.identifierType in NonNumericIdentifierTypes;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=identifier-extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-extension.js","sourceRoot":"","sources":["../src/identifier-extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,EAEH,6BAA6B,EAChC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAiC,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE5G,OAAO,EAEH,qCAAqC,EACxC,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAA8B,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAElG,OAAO,EAEH,kCAAkC,EACrC,MAAM,2CAA2C,CAAC;AAgCnD;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAG1C,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,sBAAsB,CAAC;AACzE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAI7B,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,SAAS,CAAC;AAC5D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mCAAmC,CAIjD,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,6BAA6B,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,2CAA2C,CAKzD,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,qCAAqC,CAAC;AACxF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wCAAwC,CAKtD,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,kCAAkC,CAAC;AACrF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B,CAG7C,oBAA0C;IACxC,OAAO,oBAAoB,CAAC,cAAc,IAAI,yBAAyB,CAAC;AAC5E,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { CharacterSetCreator, StringValidation, StringValidator } from "@aidc-toolkit/utility";
|
|
2
2
|
import type { IdentifierDescriptor } from "./identifier-descriptor.js";
|
|
3
|
+
import type { IdentifierTypeDescriptor } from "./identifier-descriptors.js";
|
|
4
|
+
import type { IdentifierType } from "./identifier-type.js";
|
|
3
5
|
/**
|
|
4
6
|
* Identifier validation parameters.
|
|
5
7
|
*/
|
|
@@ -7,38 +9,71 @@ export interface IdentifierValidation extends StringValidation {
|
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Identifier validator. Validates an identifier against its definition in section 3 of the {@link
|
|
10
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
12
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Implements common functionality for an
|
|
13
|
+
* identifier validator.
|
|
11
14
|
*
|
|
12
|
-
* @template
|
|
13
|
-
* Identifier
|
|
15
|
+
* @template TIdentifierType
|
|
16
|
+
* Identifier type type.
|
|
14
17
|
*
|
|
15
18
|
* @template TIdentifierValidation
|
|
16
19
|
* Identifier validation type.
|
|
17
20
|
*/
|
|
18
|
-
export
|
|
21
|
+
export declare abstract class IdentifierValidator<TIdentifierType extends IdentifierType = IdentifierType, TIdentifierValidation extends IdentifierValidation = IdentifierValidation> implements IdentifierDescriptor, StringValidator<TIdentifierValidation> {
|
|
22
|
+
#private;
|
|
23
|
+
/**
|
|
24
|
+
* Constructor.
|
|
25
|
+
*
|
|
26
|
+
* @param identifierDescriptor
|
|
27
|
+
* Identifier descriptor.
|
|
28
|
+
*/
|
|
29
|
+
protected constructor(identifierDescriptor: IdentifierTypeDescriptor<TIdentifierType>);
|
|
19
30
|
/**
|
|
20
31
|
* Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining
|
|
21
32
|
* properties.
|
|
22
33
|
*/
|
|
23
|
-
get identifierType():
|
|
34
|
+
get identifierType(): IdentifierTypeDescriptor<TIdentifierType>["identifierType"];
|
|
24
35
|
/**
|
|
25
36
|
* Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1
|
|
26
37
|
* Company Prefix. For the GTIN, the prefix type determines the length.
|
|
27
38
|
*/
|
|
28
|
-
get prefixType():
|
|
39
|
+
get prefixType(): IdentifierTypeDescriptor<TIdentifierType>["prefixType"];
|
|
29
40
|
/**
|
|
30
41
|
* Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length
|
|
31
42
|
* is the maximum.
|
|
32
43
|
*/
|
|
33
|
-
get length():
|
|
44
|
+
get length(): IdentifierTypeDescriptor<TIdentifierType>["length"];
|
|
34
45
|
/**
|
|
35
46
|
* Get the reference character set.
|
|
36
47
|
*/
|
|
37
|
-
get referenceCharacterSet():
|
|
48
|
+
get referenceCharacterSet(): IdentifierTypeDescriptor<TIdentifierType>["referenceCharacterSet"];
|
|
38
49
|
/**
|
|
39
50
|
* Get the reference creator.
|
|
40
51
|
*/
|
|
41
52
|
get referenceCreator(): CharacterSetCreator;
|
|
53
|
+
/**
|
|
54
|
+
* Pad an identifier on the left with zero-value character for validation purposes. This is done to align an
|
|
55
|
+
* identifier with a position offset for any error message that may be thrown by the reference validator.
|
|
56
|
+
*
|
|
57
|
+
* @param identifier
|
|
58
|
+
* Identifier.
|
|
59
|
+
*
|
|
60
|
+
* @param positionOffset
|
|
61
|
+
* Position offset within a larger string.
|
|
62
|
+
*
|
|
63
|
+
* @returns
|
|
64
|
+
* Padded identifier.
|
|
65
|
+
*/
|
|
66
|
+
protected padIdentifier(identifier: string, positionOffset?: number): string;
|
|
67
|
+
/**
|
|
68
|
+
* Validate the prefix within an identifier.
|
|
69
|
+
*
|
|
70
|
+
* @param partialIdentifier
|
|
71
|
+
* Partial identifier.
|
|
72
|
+
*
|
|
73
|
+
* @param positionOffset
|
|
74
|
+
* Position offset within a larger string.
|
|
75
|
+
*/
|
|
76
|
+
protected validatePrefix(partialIdentifier: string, positionOffset?: number): void;
|
|
42
77
|
/**
|
|
43
78
|
* Validate an identifier and throw an error if validation fails.
|
|
44
79
|
*
|
|
@@ -48,6 +83,6 @@ export interface IdentifierValidator<TIdentifierDescriptor extends IdentifierDes
|
|
|
48
83
|
* @param validation
|
|
49
84
|
* Identifier validation parameters.
|
|
50
85
|
*/
|
|
51
|
-
validate
|
|
86
|
+
abstract validate(identifier: string, validation?: TIdentifierValidation): void;
|
|
52
87
|
}
|
|
53
88
|
//# sourceMappingURL=identifier-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-validator.d.ts","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"identifier-validator.d.ts","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGpG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;CAC7D;AAED;;;;;;;;;;GAUG;AACH,8BAAsB,mBAAmB,CAAC,eAAe,SAAS,cAAc,GAAG,cAAc,EAAE,qBAAqB,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,YAAW,oBAAoB,EAAE,eAAe,CAAC,qBAAqB,CAAC;;IAqBjP;;;;;OAKG;IACH,SAAS,aAAa,oBAAoB,EAAE,wBAAwB,CAAC,eAAe,CAAC;IAOrF;;;OAGG;IACH,IAAI,cAAc,IAAI,wBAAwB,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,CAEhF;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,wBAAwB,CAAC,eAAe,CAAC,CAAC,YAAY,CAAC,CAGxE;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,wBAAwB,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAEhE;IAED;;OAEG;IACH,IAAI,qBAAqB,IAAI,wBAAwB,CAAC,eAAe,CAAC,CAAC,uBAAuB,CAAC,CAE9F;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,mBAAmB,CAE1C;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM;IAK5E;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAKlF;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,qBAAqB,GAAG,IAAI;CAClF"}
|
|
@@ -1,2 +1,110 @@
|
|
|
1
|
-
|
|
1
|
+
import { CONTENT_CHARACTER_SET_CREATORS } from "./content-character-set-creators.js";
|
|
2
|
+
import { ContentCharacterSets } from "./content-character-set.js";
|
|
3
|
+
import { PrefixTypes } from "./prefix-type.js";
|
|
4
|
+
import { PrefixValidator } from "./prefix-validator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Identifier validator. Validates an identifier against its definition in section 3 of the {@link
|
|
7
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Implements common functionality for an
|
|
8
|
+
* identifier validator.
|
|
9
|
+
*
|
|
10
|
+
* @template TIdentifierType
|
|
11
|
+
* Identifier type type.
|
|
12
|
+
*
|
|
13
|
+
* @template TIdentifierValidation
|
|
14
|
+
* Identifier validation type.
|
|
15
|
+
*/
|
|
16
|
+
export class IdentifierValidator {
|
|
17
|
+
/**
|
|
18
|
+
* Identifier type.
|
|
19
|
+
*/
|
|
20
|
+
#identifierType;
|
|
21
|
+
/**
|
|
22
|
+
* Length.
|
|
23
|
+
*/
|
|
24
|
+
#length;
|
|
25
|
+
/**
|
|
26
|
+
* Reference character set.
|
|
27
|
+
*/
|
|
28
|
+
#referenceCharacterSet;
|
|
29
|
+
/**
|
|
30
|
+
* Reference creator.
|
|
31
|
+
*/
|
|
32
|
+
#referenceCreator;
|
|
33
|
+
/**
|
|
34
|
+
* Constructor.
|
|
35
|
+
*
|
|
36
|
+
* @param identifierDescriptor
|
|
37
|
+
* Identifier descriptor.
|
|
38
|
+
*/
|
|
39
|
+
constructor(identifierDescriptor) {
|
|
40
|
+
this.#identifierType = identifierDescriptor.identifierType;
|
|
41
|
+
this.#length = identifierDescriptor.length;
|
|
42
|
+
this.#referenceCharacterSet = identifierDescriptor.referenceCharacterSet;
|
|
43
|
+
this.#referenceCreator = CONTENT_CHARACTER_SET_CREATORS[identifierDescriptor.referenceCharacterSet];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining
|
|
47
|
+
* properties.
|
|
48
|
+
*/
|
|
49
|
+
get identifierType() {
|
|
50
|
+
return this.#identifierType;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1
|
|
54
|
+
* Company Prefix. For the GTIN, the prefix type determines the length.
|
|
55
|
+
*/
|
|
56
|
+
get prefixType() {
|
|
57
|
+
// All identifier types except GTIN support only the GS1 Company Prefix.
|
|
58
|
+
return PrefixTypes.GS1CompanyPrefix;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length
|
|
62
|
+
* is the maximum.
|
|
63
|
+
*/
|
|
64
|
+
get length() {
|
|
65
|
+
return this.#length;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the reference character set.
|
|
69
|
+
*/
|
|
70
|
+
get referenceCharacterSet() {
|
|
71
|
+
return this.#referenceCharacterSet;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the reference creator.
|
|
75
|
+
*/
|
|
76
|
+
get referenceCreator() {
|
|
77
|
+
return this.#referenceCreator;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Pad an identifier on the left with zero-value character for validation purposes. This is done to align an
|
|
81
|
+
* identifier with a position offset for any error message that may be thrown by the reference validator.
|
|
82
|
+
*
|
|
83
|
+
* @param identifier
|
|
84
|
+
* Identifier.
|
|
85
|
+
*
|
|
86
|
+
* @param positionOffset
|
|
87
|
+
* Position offset within a larger string.
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
90
|
+
* Padded identifier.
|
|
91
|
+
*/
|
|
92
|
+
padIdentifier(identifier, positionOffset) {
|
|
93
|
+
// Identifier is returned as is if position offset is undefined.
|
|
94
|
+
return positionOffset === undefined ? identifier : this.referenceCreator.character(0).repeat(positionOffset).concat(identifier);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validate the prefix within an identifier.
|
|
98
|
+
*
|
|
99
|
+
* @param partialIdentifier
|
|
100
|
+
* Partial identifier.
|
|
101
|
+
*
|
|
102
|
+
* @param positionOffset
|
|
103
|
+
* Position offset within a larger string.
|
|
104
|
+
*/
|
|
105
|
+
validatePrefix(partialIdentifier, positionOffset) {
|
|
106
|
+
// Delegate to prefix validator with support for U.P.C. Company Prefix but not GS1-8 Prefix.
|
|
107
|
+
PrefixValidator.validate(this.prefixType, true, false, partialIdentifier, true, this.referenceCharacterSet === ContentCharacterSets.Numeric, positionOffset);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
2
110
|
//# sourceMappingURL=identifier-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier-validator.js","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"identifier-validator.js","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIlE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,mBAAmB;IACrC;;OAEG;IACM,eAAe,CAA8D;IAEtF;;OAEG;IACM,OAAO,CAAsD;IAEtE;;OAEG;IACM,sBAAsB,CAAqE;IAEpG;;OAEG;IACM,iBAAiB,CAAsB;IAEhD;;;;;OAKG;IACH,YAAsB,oBAA+D;QACjF,IAAI,CAAC,eAAe,GAAG,oBAAoB,CAAC,cAAc,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,sBAAsB,GAAG,oBAAoB,CAAC,qBAAqB,CAAC;QACzE,IAAI,CAAC,iBAAiB,GAAG,8BAA8B,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IACxG,CAAC;IAED;;;OAGG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,IAAI,UAAU;QACV,wEAAwE;QACxE,OAAO,WAAW,CAAC,gBAAgB,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,qBAAqB;QACrB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,aAAa,CAAC,UAAkB,EAAE,cAAuB;QAC/D,gEAAgE;QAChE,OAAO,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACpI,CAAC;IAED;;;;;;;;OAQG;IACO,cAAc,CAAC,iBAAyB,EAAE,cAAuB;QACvE,4FAA4F;QAC5F,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB,KAAK,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACjK,CAAC;CAYJ"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GTINBaseLength } from "./gtin-length.js";
|
|
2
|
+
import type { GTINType } from "./gtin-type.js";
|
|
2
3
|
import { type GTINValidator } from "./gtin-validator.js";
|
|
3
|
-
import { type
|
|
4
|
+
import { type IdentifierTypeExtension } from "./identifier-extension.js";
|
|
5
|
+
import { type IdentifierType } from "./identifier-type.js";
|
|
4
6
|
import type { IdentifierValidator } from "./identifier-validator.js";
|
|
5
|
-
import type {
|
|
6
|
-
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
7
|
-
import type { NonNumericIdentifierType } from "./non-numeric-identifier-type.js";
|
|
7
|
+
import type { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
8
8
|
import { NonNumericIdentifierValidator } from "./non-numeric-identifier-validator.js";
|
|
9
|
+
import { NonSerializableNumericIdentifierValidator } from "./non-serializable-numeric-identifier-validator.js";
|
|
9
10
|
import type { NumericIdentifierValidator } from "./numeric-identifier-validator.js";
|
|
10
|
-
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
11
11
|
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
12
12
|
/**
|
|
13
13
|
* Identifier validator type based on identifier type type.
|
|
@@ -15,19 +15,19 @@ import { SerializableNumericIdentifierValidator } from "./serializable-numeric-i
|
|
|
15
15
|
* @template TIdentifierType
|
|
16
16
|
* Identifier type type.
|
|
17
17
|
*/
|
|
18
|
-
export type IdentifierTypeValidator<TIdentifierType extends IdentifierType> = TIdentifierType
|
|
18
|
+
export type IdentifierTypeValidator<TIdentifierType extends IdentifierType> = IdentifierTypeExtension<TIdentifierType, IdentifierValidator, NumericIdentifierValidator, GTINValidator, NonGTINNumericIdentifierValidator, NonSerializableNumericIdentifierValidator, SerializableNumericIdentifierValidator, NonNumericIdentifierValidator>;
|
|
19
19
|
/**
|
|
20
20
|
* Identifier validators entry type based on identifier type type.
|
|
21
21
|
*
|
|
22
22
|
* @template TIdentifierType
|
|
23
23
|
* Identifier type type.
|
|
24
24
|
*/
|
|
25
|
-
export type IdentifierValidatorsEntry<TIdentifierType extends IdentifierType> = TIdentifierType extends
|
|
25
|
+
export type IdentifierValidatorsEntry<TIdentifierType extends IdentifierType> = TIdentifierType extends GTINType ? Readonly<Record<GTINBaseLength, GTINValidator>> : IdentifierTypeValidator<TIdentifierType>;
|
|
26
26
|
/**
|
|
27
27
|
* Identifier validators record type.
|
|
28
28
|
*/
|
|
29
29
|
export type IdentifierValidatorsRecord = {
|
|
30
|
-
[TIdentifierType in IdentifierType]: IdentifierValidatorsEntry<TIdentifierType>;
|
|
30
|
+
readonly [TIdentifierType in IdentifierType]: IdentifierValidatorsEntry<TIdentifierType>;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Identifier validators for all identifier types.
|
|
@@ -42,7 +42,7 @@ export declare const IdentifierValidators: IdentifierValidatorsRecord;
|
|
|
42
42
|
* @returns
|
|
43
43
|
* True if GTIN validators.
|
|
44
44
|
*/
|
|
45
|
-
export declare function isGTINValidators(identifierValidatorsOrValidator: IdentifierValidatorsEntry<IdentifierType>): identifierValidatorsOrValidator is Readonly<Record<
|
|
45
|
+
export declare function isGTINValidators(identifierValidatorsOrValidator: IdentifierValidatorsEntry<IdentifierType>): identifierValidatorsOrValidator is Readonly<Record<GTINBaseLength, GTINValidator>>;
|
|
46
46
|
/**
|
|
47
47
|
* Determine if identifier validator is a numeric identifier validator.
|
|
48
48
|
*
|
|
@@ -73,6 +73,16 @@ export declare function isGTINValidator(identifierValidator: IdentifierValidator
|
|
|
73
73
|
* True if identifier validator is a non-GTIN numeric identifier validator.
|
|
74
74
|
*/
|
|
75
75
|
export declare function isNonGTINNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NonGTINNumericIdentifierValidator;
|
|
76
|
+
/**
|
|
77
|
+
* Determine if identifier validator is a non-serializable numeric identifier validator.
|
|
78
|
+
*
|
|
79
|
+
* @param identifierValidator
|
|
80
|
+
* Identifier validator.
|
|
81
|
+
*
|
|
82
|
+
* @returns
|
|
83
|
+
* True if identifier validator is a non-serializable numeric identifier validator.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isNonSerializableNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NonSerializableNumericIdentifierValidator;
|
|
76
86
|
/**
|
|
77
87
|
* Determine if identifier validator is a serializable numeric identifier validator.
|
|
78
88
|
*
|
|
@@ -93,4 +103,4 @@ export declare function isSerializableNumericIdentifierValidator(identifierValid
|
|
|
93
103
|
* True if identifier validator is a non-numeric identifier validator.
|
|
94
104
|
*/
|
|
95
105
|
export declare function isNonNumericIdentifierValidator(identifierValidator: IdentifierValidator): identifierValidator is NonNumericIdentifierValidator;
|
|
96
|
-
//# sourceMappingURL=validators.d.ts.map
|
|
106
|
+
//# sourceMappingURL=identifier-validators.d.ts.map
|
|
@@ -0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