@aidc-toolkit/gs1 1.0.43-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/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.d.ts +0 -97
- package/dist/gcp-length.d.ts.map +0 -1
- package/dist/gcp-length.js +0 -368
- 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
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { CharacterSetCreator, Exclusions, NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
-
import { MixinAbstractIdentifierCreator } from "./abstract-identifier-creator.js";
|
|
3
|
-
import { checkDigit, checkDigitSum } from "./check.js";
|
|
4
|
-
import { LeaderTypes } from "./leader-type.js";
|
|
5
|
-
/**
|
|
6
|
-
* Mixin implementation of {@linkcode NumericIdentifierCreator} with an appropriate numeric identifier validator base.
|
|
7
|
-
*
|
|
8
|
-
* @template TNumericIdentifierType
|
|
9
|
-
* Numeric identifier type type.
|
|
10
|
-
*
|
|
11
|
-
* @param NumericIdentifierValidatorConstructor
|
|
12
|
-
* Numeric identifier validator base.
|
|
13
|
-
*
|
|
14
|
-
* @returns
|
|
15
|
-
* Numeric identifier creator class.
|
|
16
|
-
*/
|
|
17
|
-
export function MixinAbstractNumericIdentifierCreator(NumericIdentifierValidatorConstructor) {
|
|
18
|
-
/**
|
|
19
|
-
* Abstract numeric identifier creator. Implements common functionality for a numeric identifier creator, mixed in
|
|
20
|
-
* with a matching numeric identifier validator.
|
|
21
|
-
*/
|
|
22
|
-
class AbstractNumericIdentifierCreator extends MixinAbstractIdentifierCreator(NumericIdentifierValidatorConstructor) {
|
|
23
|
-
/**
|
|
24
|
-
* Capacity.
|
|
25
|
-
*/
|
|
26
|
-
#capacity;
|
|
27
|
-
/**
|
|
28
|
-
* Tweak for sparse creation.
|
|
29
|
-
*/
|
|
30
|
-
#tweak = 0n;
|
|
31
|
-
/**
|
|
32
|
-
* Constructor.
|
|
33
|
-
*
|
|
34
|
-
* @param prefixProvider
|
|
35
|
-
* Prefix provider.
|
|
36
|
-
*
|
|
37
|
-
* @param prefix
|
|
38
|
-
* Prefix within prefix provider to use to calculate reference length.
|
|
39
|
-
*
|
|
40
|
-
* @param args
|
|
41
|
-
* Originating constructor arguments.
|
|
42
|
-
*/
|
|
43
|
-
constructor(prefixProvider, prefix, ...args) {
|
|
44
|
-
super(prefixProvider, prefix, 1, ...args);
|
|
45
|
-
// Capacity is always in number range.
|
|
46
|
-
this.#capacity = Number(CharacterSetCreator.powerOf10(this.referenceLength));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @inheritDoc
|
|
50
|
-
*/
|
|
51
|
-
get capacity() {
|
|
52
|
-
return this.#capacity;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @inheritDoc
|
|
56
|
-
*/
|
|
57
|
-
get tweak() {
|
|
58
|
-
return this.#tweak;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @inheritDoc
|
|
62
|
-
*/
|
|
63
|
-
set tweak(value) {
|
|
64
|
-
this.#tweak = value;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Build an identifier from a reference by merging it with the prefix and adding the check digit.
|
|
68
|
-
*
|
|
69
|
-
* @param reference
|
|
70
|
-
* Identifier reference.
|
|
71
|
-
*
|
|
72
|
-
* @returns
|
|
73
|
-
* Identifier.
|
|
74
|
-
*/
|
|
75
|
-
#buildIdentifier(reference) {
|
|
76
|
-
const partialIdentifier = this.leaderType === LeaderTypes.ExtensionDigit ? reference.substring(0, 1) + this.prefix + reference.substring(1) : this.prefix + reference;
|
|
77
|
-
return partialIdentifier + checkDigit(partialIdentifier);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @inheritDoc
|
|
81
|
-
*/
|
|
82
|
-
create(valueOrValues, sparse = false) {
|
|
83
|
-
return NUMERIC_CREATOR.create(this.referenceLength, valueOrValues, Exclusions.None, sparse ? this.tweak : undefined, reference => this.#buildIdentifier(reference));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Create all identifiers from a partial identifier. Call is recursive until remaining reference
|
|
87
|
-
* length is 0.
|
|
88
|
-
*
|
|
89
|
-
* @param partialIdentifier
|
|
90
|
-
* Partial identifier. Initial value is `this.prefix`.
|
|
91
|
-
*
|
|
92
|
-
* @param remainingReferenceLength
|
|
93
|
-
* Remaining reference length. Initial value is `this.referenceLength`.
|
|
94
|
-
*
|
|
95
|
-
* @param extensionWeight
|
|
96
|
-
* If this value is not zero, the identifier has an extension digit, this call is setting it, and this value is
|
|
97
|
-
* applied to the calculation of the check digit.
|
|
98
|
-
*
|
|
99
|
-
* @param weight
|
|
100
|
-
* If the extension weight is zero, this value is applied to the calculation of the check digit.
|
|
101
|
-
*
|
|
102
|
-
* @param partialCheckDigitSum
|
|
103
|
-
* Partial check digit sum for the partial identifier.
|
|
104
|
-
*
|
|
105
|
-
* @yields
|
|
106
|
-
* Identifier.
|
|
107
|
-
*/
|
|
108
|
-
static *createAllPartial(partialIdentifier, remainingReferenceLength, extensionWeight, weight, partialCheckDigitSum) {
|
|
109
|
-
if (remainingReferenceLength === 0) {
|
|
110
|
-
// Finalize check digit calculation and append.
|
|
111
|
-
yield partialIdentifier + NUMERIC_CREATOR.character(9 - (partialCheckDigitSum + 9) % 10);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
const nextRemainingReferenceLength = remainingReferenceLength - 1;
|
|
115
|
-
let nextPartialCheckDigitSum = partialCheckDigitSum;
|
|
116
|
-
if (extensionWeight !== 0) {
|
|
117
|
-
// Apply every digit to the extension digit.
|
|
118
|
-
for (const c of NUMERIC_CREATOR.characterSet) {
|
|
119
|
-
yield* AbstractNumericIdentifierCreator.createAllPartial(c + partialIdentifier, nextRemainingReferenceLength, 0, weight, nextPartialCheckDigitSum);
|
|
120
|
-
nextPartialCheckDigitSum += extensionWeight;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
const nextWeight = 4 - weight;
|
|
125
|
-
// Apply every digit to the current character in the identifier.
|
|
126
|
-
for (const c of NUMERIC_CREATOR.characterSet) {
|
|
127
|
-
yield* AbstractNumericIdentifierCreator.createAllPartial(partialIdentifier + c, nextRemainingReferenceLength, 0, nextWeight, nextPartialCheckDigitSum);
|
|
128
|
-
nextPartialCheckDigitSum += weight;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @inheritDoc
|
|
135
|
-
*/
|
|
136
|
-
createAll() {
|
|
137
|
-
const hasExtensionDigit = this.leaderType === LeaderTypes.ExtensionDigit;
|
|
138
|
-
const prefix = this.prefix;
|
|
139
|
-
const length = this.length;
|
|
140
|
-
const referenceLength = this.referenceLength;
|
|
141
|
-
// Start weight is for reference excluding extension digit, which has its weight calculated separately.
|
|
142
|
-
const startWeight = 3 - 2 * ((referenceLength + 1 - Number(hasExtensionDigit)) % 2);
|
|
143
|
-
// Returning separate Iterable object makes iteration repeatable.
|
|
144
|
-
return {
|
|
145
|
-
[Symbol.iterator]() {
|
|
146
|
-
return AbstractNumericIdentifierCreator.createAllPartial(prefix, referenceLength, hasExtensionDigit ? 3 - 2 * length % 2 : 0, startWeight, checkDigitSum(startWeight === 3, prefix));
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Base class was upcast to type with statically known members for mixin, downcast result.
|
|
152
|
-
return AbstractNumericIdentifierCreator;
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=abstract-numeric-identifier-creator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/abstract-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,eAAe,EAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAqC,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuB/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qCAAqC,CAEnD,qCAGD;IAIG;;;OAGG;IACH,MAAe,gCAAiC,SAC5C,8BAA8B,CAAC,qCAAqC,CAKvE;QACG;;WAEG;QACM,SAAS,CAAS;QAE3B;;WAEG;QACH,MAAM,GAAG,EAAE,CAAC;QAEZ;;;;;;;;;;;WAWG;QACH,YAAY,cAA8B,EAAE,MAAc,EAAE,GAAG,IAAyF;YACpJ,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;YAE1C,sCAAsC;YACtC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QACjF,CAAC;QAED;;WAEG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pF,iEAAiE;YACjE,OAAO;gBACH,CAAC,MAAM,CAAC,QAAQ,CAAC;oBACb,OAAO,gCAAgC,CAAC,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,WAAW,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;gBACzL,CAAC;aACJ,CAAC;QACN,CAAC;KACJ;IAED,kKAAkK;IAClK,OAAO,gCAMN,CAAC;AACN,CAAC"}
|
package/dist/character-set.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { CharacterSetCreator, CharacterSetValidator } from "@aidc-toolkit/utility";
|
|
2
|
-
/**
|
|
3
|
-
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link
|
|
4
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AI82_CREATOR: CharacterSetCreator;
|
|
7
|
-
/**
|
|
8
|
-
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link
|
|
9
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
10
|
-
*/
|
|
11
|
-
export declare const AI82_VALIDATOR: CharacterSetValidator;
|
|
12
|
-
/**
|
|
13
|
-
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link
|
|
14
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
15
|
-
*/
|
|
16
|
-
export declare const AI39_CREATOR: CharacterSetCreator;
|
|
17
|
-
/**
|
|
18
|
-
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link
|
|
19
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
20
|
-
*/
|
|
21
|
-
export declare const AI39_VALIDATOR: CharacterSetValidator;
|
|
22
|
-
/**
|
|
23
|
-
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
|
|
24
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Doesn't support any exclusions.
|
|
25
|
-
*/
|
|
26
|
-
export declare const AI64_VALIDATOR: CharacterSetValidator;
|
|
27
|
-
//# sourceMappingURL=character-set.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"character-set.d.ts","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EAEnB,qBAAqB,EAExB,MAAM,uBAAuB,CAAC;AAG/B;;;GAGG;AACH,eAAO,MAAM,YAAY,qBASA,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAmB,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,YAAY,qBAKA,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAmB,qBAAqB,CAAC;AAiDpE;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,qBAAuD,CAAC"}
|
package/dist/character-set.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { CharacterSetCreator, CharacterSetValidator, Exclusions, utilityNS } from "@aidc-toolkit/utility";
|
|
2
|
-
import { i18nextGS1 } from "./locale/i18n.js";
|
|
3
|
-
/**
|
|
4
|
-
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link
|
|
5
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
6
|
-
*/
|
|
7
|
-
export const AI82_CREATOR = new CharacterSetCreator([
|
|
8
|
-
"!", "\"", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/",
|
|
9
|
-
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
10
|
-
":", ";", "<", "=", ">", "?",
|
|
11
|
-
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
12
|
-
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
13
|
-
"_",
|
|
14
|
-
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
|
15
|
-
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
|
|
16
|
-
], Exclusions.AllNumeric);
|
|
17
|
-
/**
|
|
18
|
-
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link
|
|
19
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
20
|
-
*/
|
|
21
|
-
export const AI82_VALIDATOR = AI82_CREATOR;
|
|
22
|
-
/**
|
|
23
|
-
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link
|
|
24
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
25
|
-
*/
|
|
26
|
-
export const AI39_CREATOR = new CharacterSetCreator([
|
|
27
|
-
"#", "-", "/",
|
|
28
|
-
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
29
|
-
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
30
|
-
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
|
|
31
|
-
], Exclusions.AllNumeric);
|
|
32
|
-
/**
|
|
33
|
-
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link
|
|
34
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
35
|
-
*/
|
|
36
|
-
export const AI39_VALIDATOR = AI39_CREATOR;
|
|
37
|
-
/**
|
|
38
|
-
* GS1 AI encodable character set 64 validator with additional base64 validation of length (multiple of 4) and position
|
|
39
|
-
* of equal sign (last or last two characters).
|
|
40
|
-
*/
|
|
41
|
-
class AI64CharacterSetValidator extends CharacterSetValidator {
|
|
42
|
-
/**
|
|
43
|
-
* Constructor.
|
|
44
|
-
*/
|
|
45
|
-
constructor() {
|
|
46
|
-
super(([
|
|
47
|
-
"-",
|
|
48
|
-
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
49
|
-
"=",
|
|
50
|
-
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
51
|
-
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
52
|
-
"_",
|
|
53
|
-
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
|
54
|
-
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
|
|
55
|
-
]));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
validate(s, validation) {
|
|
61
|
-
super.validate(s, validation);
|
|
62
|
-
const length = s.length;
|
|
63
|
-
if (length % 4 !== 0) {
|
|
64
|
-
throw new RangeError(i18nextGS1.t("AI64CharacterSetValidator.lengthMustBeMultipleOf4", {
|
|
65
|
-
length
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
const equalIndex = s.search(/={1,2}/u);
|
|
69
|
-
if (equalIndex !== -1 && equalIndex < length - 2) {
|
|
70
|
-
throw new RangeError(i18nextGS1.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
71
|
-
ns: utilityNS,
|
|
72
|
-
c: "=",
|
|
73
|
-
position: equalIndex
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
|
|
80
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Doesn't support any exclusions.
|
|
81
|
-
*/
|
|
82
|
-
export const AI64_VALIDATOR = new AI64CharacterSetValidator();
|
|
83
|
-
//# sourceMappingURL=character-set.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"character-set.js","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EAEnB,qBAAqB,EACrB,UAAU,EAAE,SAAS,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,mBAAmB,CAAC;IAChD,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAChE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAChD,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAC5B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAC/D,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAC/D,GAAG;IACH,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAA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AAE,UAAU;aACvB,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAA0B,IAAI,yBAAyB,EAAE,CAAC"}
|
package/dist/check.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link
|
|
3
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
4
|
-
*
|
|
5
|
-
* @param exchangeWeights
|
|
6
|
-
* If true, start the weights at 1 instead of 3 on the right.
|
|
7
|
-
*
|
|
8
|
-
* @param s
|
|
9
|
-
* Numeric string.
|
|
10
|
-
*
|
|
11
|
-
* @returns
|
|
12
|
-
* Accumulated sum of each digit multiplied by the weight at its position.
|
|
13
|
-
*/
|
|
14
|
-
export declare function checkDigitSum(exchangeWeights: boolean, s: string): number;
|
|
15
|
-
/**
|
|
16
|
-
* Calculate the check digit for a numeric string as per section 7.9.1 of the {@link
|
|
17
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
18
|
-
*
|
|
19
|
-
* @param s
|
|
20
|
-
* Numeric string.
|
|
21
|
-
*
|
|
22
|
-
* @returns
|
|
23
|
-
* Check digit 0-9 as a string.
|
|
24
|
-
*/
|
|
25
|
-
export declare function checkDigit(s: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Determine if a numeric string has a valid check digit.
|
|
28
|
-
*
|
|
29
|
-
* @param s
|
|
30
|
-
* Numeric string with check digit.
|
|
31
|
-
*
|
|
32
|
-
* @returns
|
|
33
|
-
* True if the check digit is valid.
|
|
34
|
-
*/
|
|
35
|
-
export declare function hasValidCheckDigit(s: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Calculate the price or weight check digit for a four-or five-digit numeric string as per sections 7.9.2-7.9.4 of the
|
|
38
|
-
* {@link https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
39
|
-
*
|
|
40
|
-
* @param s
|
|
41
|
-
* Numeric string exactly four or five characters long.
|
|
42
|
-
*
|
|
43
|
-
* @returns
|
|
44
|
-
* Check digit 0-9 as a string.
|
|
45
|
-
*/
|
|
46
|
-
export declare function priceOrWeightCheckDigit(s: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Determine if a price or weight check digit is valid for numeric string.
|
|
49
|
-
*
|
|
50
|
-
* @param s
|
|
51
|
-
* Numeric string exactly four or five characters long.
|
|
52
|
-
*
|
|
53
|
-
* @param checkDigit
|
|
54
|
-
* Price or weight check digit.
|
|
55
|
-
*
|
|
56
|
-
* @returns
|
|
57
|
-
* True if the check digit is valid.
|
|
58
|
-
*/
|
|
59
|
-
export declare function isValidPriceOrWeightCheckDigit(s: string, checkDigit: string): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Calculate the check character for a GS1 AI encodable character set 82 string as per section 7.9.5 of the {@link
|
|
62
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
63
|
-
*
|
|
64
|
-
* @param s
|
|
65
|
-
* GS1 AI encodable character set 82 string.
|
|
66
|
-
*
|
|
67
|
-
* @returns
|
|
68
|
-
* Check character pair.
|
|
69
|
-
*/
|
|
70
|
-
export declare function checkCharacterPair(s: string): string;
|
|
71
|
-
/**
|
|
72
|
-
* Determine if a GS1 AI encodable character set 82 string has a valid check character pair.
|
|
73
|
-
*
|
|
74
|
-
* @param s
|
|
75
|
-
* GS1 AI encodable character set 82 string with check character pair.
|
|
76
|
-
*
|
|
77
|
-
* @returns
|
|
78
|
-
* True if the check character pair is valid.
|
|
79
|
-
*/
|
|
80
|
-
export declare function hasValidCheckCharacterPair(s: string): boolean;
|
|
81
|
-
//# sourceMappingURL=check.d.ts.map
|
package/dist/check.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAGrD;AA+BD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAErF;AAiBD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CA4BpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAI7D"}
|
package/dist/check.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { NUMERIC_CREATOR, utilityNS } from "@aidc-toolkit/utility";
|
|
2
|
-
import { AI82_CREATOR } from "./character-set.js";
|
|
3
|
-
import { i18nextGS1 } from "./locale/i18n.js";
|
|
4
|
-
/**
|
|
5
|
-
* Results of multiplying digits by 3.
|
|
6
|
-
*/
|
|
7
|
-
const THREE_WEIGHT_RESULTS = [
|
|
8
|
-
0, 3, 6, 9, 12, 15, 18, 21, 24, 27
|
|
9
|
-
];
|
|
10
|
-
/**
|
|
11
|
-
* Results of multiplying digits by 2, subtracting tens digit, and extracting units digit.
|
|
12
|
-
*/
|
|
13
|
-
const TWO_MINUS_WEIGHT_RESULTS = [
|
|
14
|
-
0, 2, 4, 6, 8, 9, 1, 3, 5, 7
|
|
15
|
-
];
|
|
16
|
-
/**
|
|
17
|
-
* Results of multiplying digits by 5, adding tens digit, and extracting units digit.
|
|
18
|
-
*/
|
|
19
|
-
const FIVE_PLUS_WEIGHT_RESULTS = [
|
|
20
|
-
0, 5, 1, 6, 2, 7, 3, 8, 4, 9
|
|
21
|
-
];
|
|
22
|
-
/**
|
|
23
|
-
* Results of multiplying digits by 5, subtracting tens digit, and extracting units digit.
|
|
24
|
-
*/
|
|
25
|
-
const FIVE_MINUS_WEIGHT_RESULTS = [
|
|
26
|
-
0, 5, 9, 4, 8, 3, 7, 2, 6, 1
|
|
27
|
-
];
|
|
28
|
-
/**
|
|
29
|
-
* Inverse mapping of FIVE_MINUS_WEIGHT_RESULTS.
|
|
30
|
-
*/
|
|
31
|
-
const INVERSE_FIVE_MINUS_WEIGHT_RESULTS = [
|
|
32
|
-
0, 9, 7, 5, 3, 1, 8, 6, 4, 2
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Calculate the check digit sum for a numeric string as per section 7.9.1 of the {@link
|
|
36
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
37
|
-
*
|
|
38
|
-
* @param exchangeWeights
|
|
39
|
-
* If true, start the weights at 1 instead of 3 on the right.
|
|
40
|
-
*
|
|
41
|
-
* @param s
|
|
42
|
-
* Numeric string.
|
|
43
|
-
*
|
|
44
|
-
* @returns
|
|
45
|
-
* Accumulated sum of each digit multiplied by the weight at its position.
|
|
46
|
-
*/
|
|
47
|
-
export function checkDigitSum(exchangeWeights, s) {
|
|
48
|
-
// Initial setting will be the opposite of that used for first character because it gets flipped before being used.
|
|
49
|
-
let weight3 = (s.length + Number(exchangeWeights)) % 2 === 0;
|
|
50
|
-
// Calculate sum of each character value multiplied by the weight at its position.
|
|
51
|
-
return NUMERIC_CREATOR.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
|
|
52
|
-
if (characterIndex === undefined) {
|
|
53
|
-
throw new RangeError(i18nextGS1.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
54
|
-
ns: utilityNS,
|
|
55
|
-
c: s.charAt(index),
|
|
56
|
-
position: index + 1
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
weight3 = !weight3;
|
|
60
|
-
return accumulator + (weight3 ? THREE_WEIGHT_RESULTS[characterIndex] : characterIndex);
|
|
61
|
-
}, 0);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Calculate the check digit for a numeric string as per section 7.9.1 of the {@link
|
|
65
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
66
|
-
*
|
|
67
|
-
* @param s
|
|
68
|
-
* Numeric string.
|
|
69
|
-
*
|
|
70
|
-
* @returns
|
|
71
|
-
* Check digit 0-9 as a string.
|
|
72
|
-
*/
|
|
73
|
-
export function checkDigit(s) {
|
|
74
|
-
// Check digit is the difference from the equal or next of multiple of 10.
|
|
75
|
-
return NUMERIC_CREATOR.character(9 - (checkDigitSum(false, s) + 9) % 10);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Determine if a numeric string has a valid check digit.
|
|
79
|
-
*
|
|
80
|
-
* @param s
|
|
81
|
-
* Numeric string with check digit.
|
|
82
|
-
*
|
|
83
|
-
* @returns
|
|
84
|
-
* True if the check digit is valid.
|
|
85
|
-
*/
|
|
86
|
-
export function hasValidCheckDigit(s) {
|
|
87
|
-
// Check digit is valid if the check digit sum with the weights exchanged is a multiple of 10.
|
|
88
|
-
return checkDigitSum(true, s) % 10 === 0;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Calculate the price or weight sum for a numeric string.
|
|
92
|
-
*
|
|
93
|
-
* @param weightsResults
|
|
94
|
-
* Array of weight results arrays to apply to each digit.
|
|
95
|
-
*
|
|
96
|
-
* @param s
|
|
97
|
-
* Numeric string the same length as the weightsResults array.
|
|
98
|
-
*
|
|
99
|
-
* @returns
|
|
100
|
-
* Accumulated sum of the weight result for each digit at the digit's position.
|
|
101
|
-
*/
|
|
102
|
-
function priceOrWeightSum(weightsResults, s) {
|
|
103
|
-
// Calculate sum of each weight result for each digit at its position.
|
|
104
|
-
return NUMERIC_CREATOR.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
|
|
105
|
-
if (characterIndex === undefined) {
|
|
106
|
-
throw new RangeError(i18nextGS1.t("CharacterSetValidator.invalidCharacterAtPositionOfComponent", {
|
|
107
|
-
ns: utilityNS,
|
|
108
|
-
c: s.charAt(index),
|
|
109
|
-
position: index + 1,
|
|
110
|
-
component: i18nextGS1.t("Check.priceOrWeightComponent")
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
// Add the weight result of the character index to the accumulator.
|
|
114
|
-
return accumulator + weightsResults[index][characterIndex];
|
|
115
|
-
}, 0);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Calculate the price or weight check digit for a four-or five-digit numeric string as per sections 7.9.2-7.9.4 of the
|
|
119
|
-
* {@link https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
120
|
-
*
|
|
121
|
-
* @param s
|
|
122
|
-
* Numeric string exactly four or five characters long.
|
|
123
|
-
*
|
|
124
|
-
* @returns
|
|
125
|
-
* Check digit 0-9 as a string.
|
|
126
|
-
*/
|
|
127
|
-
export function priceOrWeightCheckDigit(s) {
|
|
128
|
-
let checkDigit;
|
|
129
|
-
switch (s.length) {
|
|
130
|
-
case 4:
|
|
131
|
-
checkDigit = NUMERIC_CREATOR.character(priceOrWeightSum([TWO_MINUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS, THREE_WEIGHT_RESULTS, FIVE_MINUS_WEIGHT_RESULTS], s) * 3 % 10);
|
|
132
|
-
break;
|
|
133
|
-
case 5:
|
|
134
|
-
checkDigit = NUMERIC_CREATOR.character(INVERSE_FIVE_MINUS_WEIGHT_RESULTS[9 - (priceOrWeightSum([FIVE_PLUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS, FIVE_MINUS_WEIGHT_RESULTS, FIVE_PLUS_WEIGHT_RESULTS, TWO_MINUS_WEIGHT_RESULTS], s) + 9) % 10]);
|
|
135
|
-
break;
|
|
136
|
-
default:
|
|
137
|
-
throw new RangeError(i18nextGS1.t("Check.lengthOfStringForPriceOrWeightMustBeExactly", {
|
|
138
|
-
length: s.length
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
141
|
-
return checkDigit;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Determine if a price or weight check digit is valid for numeric string.
|
|
145
|
-
*
|
|
146
|
-
* @param s
|
|
147
|
-
* Numeric string exactly four or five characters long.
|
|
148
|
-
*
|
|
149
|
-
* @param checkDigit
|
|
150
|
-
* Price or weight check digit.
|
|
151
|
-
*
|
|
152
|
-
* @returns
|
|
153
|
-
* True if the check digit is valid.
|
|
154
|
-
*/
|
|
155
|
-
export function isValidPriceOrWeightCheckDigit(s, checkDigit) {
|
|
156
|
-
return priceOrWeightCheckDigit(s) === checkDigit;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Weights for check character pair calculation.
|
|
160
|
-
*/
|
|
161
|
-
const CHECK_CHARACTER_WEIGHTS = [
|
|
162
|
-
107, 103, 101, 97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2
|
|
163
|
-
];
|
|
164
|
-
/**
|
|
165
|
-
* Characters used to build check character pair.
|
|
166
|
-
*/
|
|
167
|
-
const CHECK_CHARACTERS = [
|
|
168
|
-
"2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H",
|
|
169
|
-
"J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
|
|
170
|
-
];
|
|
171
|
-
/**
|
|
172
|
-
* Calculate the check character for a GS1 AI encodable character set 82 string as per section 7.9.5 of the {@link
|
|
173
|
-
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}.
|
|
174
|
-
*
|
|
175
|
-
* @param s
|
|
176
|
-
* GS1 AI encodable character set 82 string.
|
|
177
|
-
*
|
|
178
|
-
* @returns
|
|
179
|
-
* Check character pair.
|
|
180
|
-
*/
|
|
181
|
-
export function checkCharacterPair(s) {
|
|
182
|
-
// Weights are applied from right to left.
|
|
183
|
-
const weightIndexStart = CHECK_CHARACTER_WEIGHTS.length - s.length;
|
|
184
|
-
if (weightIndexStart < 0) {
|
|
185
|
-
throw new RangeError(i18nextGS1.t("Check.lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo", {
|
|
186
|
-
length: s.length,
|
|
187
|
-
maximumLength: CHECK_CHARACTER_WEIGHTS.length
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
|
-
// Calculate sum of each character value multiplied by the weight at its position, mod 1021.
|
|
191
|
-
const checkCharacterPairSum = AI82_CREATOR.characterIndexes(s).reduce((accumulator, characterIndex, index) => {
|
|
192
|
-
if (characterIndex === undefined) {
|
|
193
|
-
throw new RangeError(i18nextGS1.t("CharacterSetValidator.invalidCharacterAtPosition", {
|
|
194
|
-
ns: utilityNS,
|
|
195
|
-
c: s.charAt(index),
|
|
196
|
-
position: index + 1
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
return accumulator + characterIndex * CHECK_CHARACTER_WEIGHTS[weightIndexStart + index];
|
|
200
|
-
}, 0) % 1021;
|
|
201
|
-
const checkCharacterPairSumMod32 = checkCharacterPairSum % 32;
|
|
202
|
-
// Check character pair is the concatenation of the character at position sum div 32 and the character at the position sum mod 32.
|
|
203
|
-
return CHECK_CHARACTERS[(checkCharacterPairSum - checkCharacterPairSumMod32) / 32] + CHECK_CHARACTERS[checkCharacterPairSumMod32];
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Determine if a GS1 AI encodable character set 82 string has a valid check character pair.
|
|
207
|
-
*
|
|
208
|
-
* @param s
|
|
209
|
-
* GS1 AI encodable character set 82 string with check character pair.
|
|
210
|
-
*
|
|
211
|
-
* @returns
|
|
212
|
-
* True if the check character pair is valid.
|
|
213
|
-
*/
|
|
214
|
-
export function hasValidCheckCharacterPair(s) {
|
|
215
|
-
const checkCharacterPairIndex = s.length - 2;
|
|
216
|
-
return checkCharacterPair(s.substring(0, checkCharacterPairIndex)) === s.substring(checkCharacterPairIndex);
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=check.js.map
|
package/dist/check.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,oBAAoB,GAAsB;IAC5C,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAsB;IAChD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAsB;IAChD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,yBAAyB,GAAsB;IACjD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,iCAAiC,GAAsB;IACzD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EA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AAC,CAAC,SAAS,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;AAChH,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type CharacterSetCreator } from "@aidc-toolkit/utility";
|
|
2
|
-
import { type ContentCharacterSet } from "./content-character-set.js";
|
|
3
|
-
export declare const CONTENT_CHARACTER_SET_CREATORS: Record<ContentCharacterSet, CharacterSetCreator>;
|
|
4
|
-
//# sourceMappingURL=content-character-set-creators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-character-set-creators.d.ts","sourceRoot":"","sources":["../src/content-character-set-creators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAmB,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,KAAK,mBAAmB,EAAwB,MAAM,4BAA4B,CAAC;AAE5F,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAI3F,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
-
import { AI39_CREATOR, AI82_CREATOR } from "./character-set.js";
|
|
3
|
-
import { ContentCharacterSets } from "./content-character-set.js";
|
|
4
|
-
export const CONTENT_CHARACTER_SET_CREATORS = {
|
|
5
|
-
[ContentCharacterSets.Numeric]: NUMERIC_CREATOR,
|
|
6
|
-
[ContentCharacterSets.AI82]: AI82_CREATOR,
|
|
7
|
-
[ContentCharacterSets.AI39]: AI39_CREATOR
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=content-character-set-creators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-character-set-creators.js","sourceRoot":"","sources":["../src/content-character-set-creators.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAA4B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,MAAM,CAAC,MAAM,8BAA8B,GAAqD;IAC5F,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,eAAe;IAC/C,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY;IACzC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY;CAC5C,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
|
3
|
-
*/
|
|
4
|
-
export declare const ContentCharacterSets: {
|
|
5
|
-
/**
|
|
6
|
-
* Numeric.
|
|
7
|
-
*/
|
|
8
|
-
readonly Numeric: "Numeric";
|
|
9
|
-
/**
|
|
10
|
-
* GS1 AI encodable character set 82.
|
|
11
|
-
*/
|
|
12
|
-
readonly AI82: "AI82";
|
|
13
|
-
/**
|
|
14
|
-
* GS1 AI encodable character set 39.
|
|
15
|
-
*/
|
|
16
|
-
readonly AI39: "AI39";
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Content character set key.
|
|
20
|
-
*/
|
|
21
|
-
export type ContentCharacterSetKey = keyof typeof ContentCharacterSets;
|
|
22
|
-
/**
|
|
23
|
-
* Content character set.
|
|
24
|
-
*/
|
|
25
|
-
export type ContentCharacterSet = typeof ContentCharacterSets[ContentCharacterSetKey];
|
|
26
|
-
//# sourceMappingURL=content-character-set.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-character-set.d.ts","sourceRoot":"","sources":["../src/content-character-set.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAC7B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,sBAAsB,CAAC,CAAC"}
|