@aidc-toolkit/gs1 1.0.25-beta → 1.0.26-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 +75 -0
- package/dist/abstract-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-identifier-creator.js +56 -0
- package/dist/abstract-identifier-creator.js.map +1 -0
- package/dist/abstract-identifier-validator.d.ts +95 -0
- package/dist/abstract-identifier-validator.d.ts.map +1 -0
- package/dist/abstract-identifier-validator.js +123 -0
- package/dist/abstract-identifier-validator.js.map +1 -0
- package/dist/abstract-numeric-identifier-creator.d.ts +92 -0
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-numeric-identifier-creator.js +137 -0
- package/dist/abstract-numeric-identifier-creator.js.map +1 -0
- package/dist/abstract-numeric-identifier-validator.d.ts +35 -0
- package/dist/abstract-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/abstract-numeric-identifier-validator.js +61 -0
- package/dist/abstract-numeric-identifier-validator.js.map +1 -0
- package/dist/character-set.d.ts +27 -0
- package/dist/character-set.d.ts.map +1 -0
- package/dist/character-set.js +50 -0
- package/dist/character-set.js.map +1 -0
- package/dist/check.d.ts +81 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +218 -0
- package/dist/check.js.map +1 -0
- package/dist/content-character-set.d.ts +26 -0
- package/dist/content-character-set.d.ts.map +1 -0
- package/dist/content-character-set.js +18 -0
- package/dist/content-character-set.js.map +1 -0
- package/dist/creators.d.ts +81 -0
- package/dist/creators.d.ts.map +1 -0
- package/dist/creators.js +62 -0
- package/dist/creators.js.map +1 -0
- package/dist/descriptors.d.ts +96 -0
- package/dist/descriptors.d.ts.map +1 -0
- package/dist/descriptors.js +266 -0
- package/dist/descriptors.js.map +1 -0
- package/dist/gtin-creator.d.ts +69 -0
- package/dist/gtin-creator.d.ts.map +1 -0
- package/dist/gtin-creator.js +159 -0
- package/dist/gtin-creator.js.map +1 -0
- package/dist/gtin-descriptor.d.ts +17 -0
- package/dist/gtin-descriptor.d.ts.map +1 -0
- package/dist/gtin-descriptor.js +2 -0
- package/dist/gtin-descriptor.js.map +1 -0
- package/dist/gtin-type.d.ts +39 -0
- package/dist/gtin-type.d.ts.map +1 -0
- package/dist/gtin-type.js +31 -0
- package/dist/gtin-type.js.map +1 -0
- package/dist/gtin-validator.d.ts +191 -0
- package/dist/gtin-validator.d.ts.map +1 -0
- package/dist/gtin-validator.js +450 -0
- package/dist/gtin-validator.js.map +1 -0
- package/dist/identifier-creator.d.ts +31 -0
- package/dist/identifier-creator.d.ts.map +1 -0
- package/dist/identifier-creator.js +2 -0
- package/dist/identifier-creator.js.map +1 -0
- package/dist/identifier-descriptor.d.ts +27 -0
- package/dist/identifier-descriptor.d.ts.map +1 -0
- package/dist/identifier-descriptor.js +2 -0
- package/dist/identifier-descriptor.js.map +1 -0
- package/dist/identifier-type.d.ts +62 -0
- package/dist/identifier-type.d.ts.map +1 -0
- package/dist/identifier-type.js +54 -0
- package/dist/identifier-type.js.map +1 -0
- package/dist/identifier-validator.d.ts +53 -0
- package/dist/identifier-validator.d.ts.map +1 -0
- package/dist/identifier-validator.js +2 -0
- package/dist/identifier-validator.js.map +1 -0
- package/dist/index.d.ts +52 -1949
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -4727
- package/dist/index.js.map +1 -1
- package/dist/locale/en/locale-resources.d.ts +42 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +41 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +42 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +41 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +36 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts +24 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.js +23 -0
- package/dist/non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts +22 -0
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-descriptor.js +2 -0
- package/dist/non-gtin-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-type.d.ts +7 -0
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-type.js +2 -0
- package/dist/non-gtin-numeric-identifier-type.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts +17 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.js +17 -0
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -0
- package/dist/non-numeric-identifier-creator.d.ts +45 -0
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-creator.js +84 -0
- package/dist/non-numeric-identifier-creator.js.map +1 -0
- package/dist/non-numeric-identifier-descriptor.d.ts +26 -0
- package/dist/non-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-numeric-identifier-descriptor.js +2 -0
- package/dist/non-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-numeric-identifier-type.d.ts +7 -0
- package/dist/non-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-numeric-identifier-type.js +2 -0
- package/dist/non-numeric-identifier-type.js.map +1 -0
- package/dist/non-numeric-identifier-validator.d.ts +49 -0
- package/dist/non-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-validator.js +69 -0
- package/dist/non-numeric-identifier-validator.js.map +1 -0
- package/dist/numeric-identifier-creator.d.ts +53 -0
- package/dist/numeric-identifier-creator.d.ts.map +1 -0
- package/dist/numeric-identifier-creator.js +2 -0
- package/dist/numeric-identifier-creator.js.map +1 -0
- package/dist/numeric-identifier-descriptor.d.ts +21 -0
- package/dist/numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/numeric-identifier-descriptor.js +2 -0
- package/dist/numeric-identifier-descriptor.js.map +1 -0
- package/dist/numeric-identifier-type.d.ts +31 -0
- package/dist/numeric-identifier-type.d.ts.map +1 -0
- package/dist/numeric-identifier-type.js +18 -0
- package/dist/numeric-identifier-type.js.map +1 -0
- package/dist/numeric-identifier-validator.d.ts +24 -0
- package/dist/numeric-identifier-validator.d.ts.map +1 -0
- package/dist/numeric-identifier-validator.js +2 -0
- package/dist/numeric-identifier-validator.js.map +1 -0
- package/dist/prefix-manager.d.ts +232 -0
- package/dist/prefix-manager.d.ts.map +1 -0
- package/dist/prefix-manager.js +334 -0
- package/dist/prefix-manager.js.map +1 -0
- package/dist/prefix-provider.d.ts +27 -0
- package/dist/prefix-provider.d.ts.map +1 -0
- package/dist/prefix-provider.js +2 -0
- package/dist/prefix-provider.js.map +1 -0
- package/dist/prefix-type.d.ts +26 -0
- package/dist/prefix-type.d.ts.map +1 -0
- package/dist/prefix-type.js +18 -0
- package/dist/prefix-type.js.map +1 -0
- package/dist/prefix-validator.d.ts +70 -0
- package/dist/prefix-validator.d.ts.map +1 -0
- package/dist/prefix-validator.js +208 -0
- package/dist/prefix-validator.js.map +1 -0
- package/dist/serializable-numeric-identifier-creator.d.ts +76 -0
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-creator.js +107 -0
- package/dist/serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/serializable-numeric-identifier-descriptor.d.ts +26 -0
- package/dist/serializable-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-descriptor.js +2 -0
- package/dist/serializable-numeric-identifier-descriptor.js.map +1 -0
- package/dist/serializable-numeric-identifier-type.d.ts +6 -0
- package/dist/serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-type.js +2 -0
- package/dist/serializable-numeric-identifier-type.js.map +1 -0
- package/dist/serializable-numeric-identifier-validator.d.ts +56 -0
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-validator.js +77 -0
- package/dist/serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/validators.d.ts +96 -0
- package/dist/validators.d.ts.map +1 -0
- package/dist/validators.js +140 -0
- package/dist/validators.js.map +1 -0
- package/package.json +11 -7
- package/src/abstract-identifier-creator.ts +4 -4
- package/src/abstract-identifier-validator.ts +6 -6
- package/src/abstract-numeric-identifier-creator.ts +7 -7
- package/src/abstract-numeric-identifier-validator.ts +6 -6
- package/src/check.ts +2 -2
- package/src/creators.ts +11 -11
- package/src/descriptors.ts +14 -14
- package/src/gtin-creator.ts +6 -6
- package/src/gtin-descriptor.ts +3 -3
- package/src/gtin-type.ts +2 -2
- package/src/gtin-validator.ts +8 -8
- package/src/identifier-creator.ts +3 -3
- package/src/identifier-descriptor.ts +3 -3
- package/src/identifier-validator.ts +1 -1
- package/src/index.ts +44 -43
- package/src/locale/i18n.ts +3 -3
- package/src/locale/i18next.d.ts +1 -1
- package/src/non-gtin-numeric-identifier-creator.ts +5 -5
- package/src/non-gtin-numeric-identifier-descriptor.ts +4 -4
- package/src/non-gtin-numeric-identifier-type.ts +2 -2
- package/src/non-gtin-numeric-identifier-validator.ts +5 -5
- package/src/non-numeric-identifier-creator.ts +6 -6
- package/src/non-numeric-identifier-descriptor.ts +4 -4
- package/src/non-numeric-identifier-type.ts +2 -2
- package/src/non-numeric-identifier-validator.ts +7 -7
- package/src/numeric-identifier-creator.ts +3 -3
- package/src/numeric-identifier-descriptor.ts +3 -3
- package/src/numeric-identifier-type.ts +1 -1
- package/src/numeric-identifier-validator.ts +2 -2
- package/src/prefix-manager.ts +16 -16
- package/src/prefix-provider.ts +1 -1
- package/src/prefix-validator.ts +3 -3
- package/src/serializable-numeric-identifier-creator.ts +4 -4
- package/src/serializable-numeric-identifier-descriptor.ts +4 -4
- package/src/serializable-numeric-identifier-type.ts +1 -1
- package/src/serializable-numeric-identifier-validator.ts +7 -7
- package/src/validators.ts +12 -12
- package/test/check.test.ts +1 -1
- package/test/creator.test.ts +5 -5
- package/test/gtin-creator.ts +2 -2
- package/test/gtin-validator.test.ts +2 -2
- package/test/identifier-creator.ts +5 -5
- package/test/identifier-validator.ts +1 -1
- package/test/non-gtin-numeric-identifier-creator.ts +3 -3
- package/test/non-gtin-numeric-identifier-validator.ts +2 -2
- package/test/non-numeric-identifier-creator.ts +1 -1
- package/test/non-numeric-identifier-validator.ts +3 -3
- package/test/numeric-identifier-creator.ts +2 -2
- package/test/numeric-identifier-validator.ts +2 -2
- package/test/prefix-manager.test.ts +2 -2
- package/test/serializable-numeric-identifier-creator.ts +2 -2
- package/test/serializable-numeric-identifier-validator.ts +3 -3
- package/test/setup.ts +1 -1
- package/test/sparse.test.ts +1 -1
- package/test/utility.ts +1 -1
- package/test/validator.test.ts +5 -5
- package/test/variable-measure-rcn.test.ts +1 -1
- package/tsconfig-config.json +4 -0
- package/tsconfig-src.json +8 -0
- package/tsconfig-test.json +9 -0
- package/tsconfig.json +12 -1
- package/tsup.config.ts +3 -2
- package/dist/index.cjs +0 -4813
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1949
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AbstractIdentifierValidator } from "./abstract-identifier-validator.js";
|
|
2
|
+
import { hasValidCheckDigit } from "./check.js";
|
|
3
|
+
import { i18nextGS1 } from "./locale/i18n.js";
|
|
4
|
+
import { LeaderTypes } from "./numeric-identifier-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract numeric identifier validator.
|
|
7
|
+
*
|
|
8
|
+
* @template TNumericIdentifierDescriptor
|
|
9
|
+
* Numeric identifier descriptor type.
|
|
10
|
+
*/
|
|
11
|
+
export class AbstractNumericIdentifierValidator extends AbstractIdentifierValidator {
|
|
12
|
+
/**
|
|
13
|
+
* Leader type.
|
|
14
|
+
*/
|
|
15
|
+
_leaderType;
|
|
16
|
+
/**
|
|
17
|
+
* Prefix position, determined by the leader type.
|
|
18
|
+
*/
|
|
19
|
+
_prefixPosition;
|
|
20
|
+
/**
|
|
21
|
+
* Constructor.
|
|
22
|
+
*
|
|
23
|
+
* @param identifierDescriptor
|
|
24
|
+
* Identifier descriptor.
|
|
25
|
+
*/
|
|
26
|
+
constructor(identifierDescriptor) {
|
|
27
|
+
super(identifierDescriptor);
|
|
28
|
+
this._leaderType = identifierDescriptor.leaderType;
|
|
29
|
+
this._prefixPosition = Number(this.leaderType === LeaderTypes.ExtensionDigit);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
get leaderType() {
|
|
35
|
+
return this._leaderType;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
validate(identifier, validation) {
|
|
41
|
+
// Validate the prefix, with care taken for its position within the identifier.
|
|
42
|
+
if (this._prefixPosition === 0) {
|
|
43
|
+
super.validatePrefix(identifier, validation?.positionOffset);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
super.validatePrefix(identifier.substring(this._prefixPosition), validation?.positionOffset === undefined ? this._prefixPosition : validation.positionOffset + this._prefixPosition);
|
|
47
|
+
}
|
|
48
|
+
// Validate the length.
|
|
49
|
+
if (identifier.length !== this.length) {
|
|
50
|
+
throw new RangeError(i18nextGS1.t("Identifier.identifierTypeLength", {
|
|
51
|
+
identifierType: this.identifierType,
|
|
52
|
+
length: this.length
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
// Validating the check digit will also validate the characters.
|
|
56
|
+
if (!hasValidCheckDigit(this.padIdentifier(identifier, validation?.positionOffset))) {
|
|
57
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidCheckDigit"));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=abstract-numeric-identifier-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-numeric-identifier-validator.js","sourceRoot":"","sources":["../src/abstract-numeric-identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,OAAgB,kCAAqG,SAAQ,2BAAsF;IACrN;;OAEG;IACc,WAAW,CAA6C;IAEzE;;OAEG;IACc,eAAe,CAAS;IAEzC;;;;;OAKG;IACH,YAAY,oBAAiD;QACzD,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAE5B,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC,UAAU,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,KAAK,WAAW,CAAC,cAAc,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,UAAkB,EAAE,UAAwC;QACjE,+EAA+E;QAC/E,IAAI,IAAI,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;QACzL,CAAC;QAED,uBAAuB;QACvB,IAAI,UAAU,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,iCAAiC,EAAE;gBACjE,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,MAAM,EAAE,IAAI,CAAC,MAAM;aACtB,CAAC,CAAC,CAAC;QACR,CAAC;QAED,gEAAgE;QAChE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YAClF,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-set.d.ts","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAc,MAAM,uBAAuB,CAAC;AAE/F;;;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;AAEpE;;;GAGG;AACH,eAAO,MAAM,cAAc,uBASzB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CharacterSetCreator, CharacterSetValidator, Exclusions } 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 const AI82_CREATOR = new CharacterSetCreator([
|
|
7
|
+
"!", "\"", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/",
|
|
8
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
9
|
+
":", ";", "<", "=", ">", "?",
|
|
10
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
11
|
+
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
12
|
+
"_",
|
|
13
|
+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
|
14
|
+
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
|
|
15
|
+
], Exclusions.AllNumeric);
|
|
16
|
+
/**
|
|
17
|
+
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link
|
|
18
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
19
|
+
*/
|
|
20
|
+
export const AI82_VALIDATOR = AI82_CREATOR;
|
|
21
|
+
/**
|
|
22
|
+
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link
|
|
23
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
24
|
+
*/
|
|
25
|
+
export const AI39_CREATOR = new CharacterSetCreator([
|
|
26
|
+
"#", "-", "/",
|
|
27
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
28
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
29
|
+
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
|
|
30
|
+
], Exclusions.AllNumeric);
|
|
31
|
+
/**
|
|
32
|
+
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link
|
|
33
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
34
|
+
*/
|
|
35
|
+
export const AI39_VALIDATOR = AI39_CREATOR;
|
|
36
|
+
/**
|
|
37
|
+
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link
|
|
38
|
+
* https://ref.gs1.org/standards/genspecs/ | GS1 General Specifications}. Doesn't support any exclusions.
|
|
39
|
+
*/
|
|
40
|
+
export const AI64_VALIDATOR = new CharacterSetValidator([
|
|
41
|
+
"-",
|
|
42
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
43
|
+
"=",
|
|
44
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
45
|
+
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
46
|
+
"_",
|
|
47
|
+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
|
48
|
+
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
|
|
49
|
+
]);
|
|
50
|
+
//# sourceMappingURL=character-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-set.js","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE/F;;;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,E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GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CAClE,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,YAAqC,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,qBAAqB,CAAC;IACpD,GAAG;IACH,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IAChD,GAAG;IACH,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,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;CAClE,CAAC,CAAC"}
|
package/dist/check.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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C5F,MAAM,qBAAqB,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAS,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE;QACjH,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,kDAAkD,EAAE;gBAClF,EAAE,EAAE,SAAS;gBACb,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAClB,QAAQ,EAAE,KAAK,GAAG,CAAC;aACtB,CAAC,CAAC,CAAC;QACR,CAAC;QAED,OAAO,WAAW,GAAG,cAAc,GAAG,uBAAuB,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;IAC5F,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAEb,MAAM,0BAA0B,GAAG,qBAAqB,GAAG,EAAE,CAAC;IAE9D,kIAAkI;IAClI,OAAO,gBAAgB,CAAC,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;AACtI,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,CAAS;IAChD,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7C,OAAO,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
|
3
|
+
*/
|
|
4
|
+
export const ContentCharacterSets = {
|
|
5
|
+
/**
|
|
6
|
+
* Numeric.
|
|
7
|
+
*/
|
|
8
|
+
Numeric: "Numeric",
|
|
9
|
+
/**
|
|
10
|
+
* GS1 AI encodable character set 82.
|
|
11
|
+
*/
|
|
12
|
+
AI82: "AI82",
|
|
13
|
+
/**
|
|
14
|
+
* GS1 AI encodable character set 39.
|
|
15
|
+
*/
|
|
16
|
+
AI39: "AI39"
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=content-character-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-character-set.js","sourceRoot":"","sources":["../src/content-character-set.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;CACN,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { GTINCreator } from "./gtin-creator.js";
|
|
2
|
+
import type { IdentifierCreator } from "./identifier-creator.js";
|
|
3
|
+
import type { IdentifierType, IdentifierTypes } from "./identifier-type.js";
|
|
4
|
+
import type { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator.js";
|
|
5
|
+
import type { NonGTINNumericIdentifierType } from "./non-gtin-numeric-identifier-type.js";
|
|
6
|
+
import type { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator.js";
|
|
7
|
+
import type { NonNumericIdentifierType } from "./non-numeric-identifier-type.js";
|
|
8
|
+
import type { NumericIdentifierCreator } from "./numeric-identifier-creator.js";
|
|
9
|
+
import type { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
10
|
+
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
11
|
+
/**
|
|
12
|
+
* Determine the identifier creator type for an identifier type.
|
|
13
|
+
*
|
|
14
|
+
* @template TIdentifierType
|
|
15
|
+
* Identifier type type.
|
|
16
|
+
*/
|
|
17
|
+
export type IdentifierTypeCreator<TIdentifierType extends IdentifierType> = TIdentifierType extends NonNumericIdentifierType ? NonNumericIdentifierCreator : TIdentifierType extends SerializableNumericIdentifierType ? SerializableNumericIdentifierCreator : TIdentifierType extends NonGTINNumericIdentifierType ? NonGTINNumericIdentifierCreator : TIdentifierType extends typeof IdentifierTypes.GTIN ? GTINCreator : IdentifierCreator;
|
|
18
|
+
/**
|
|
19
|
+
* Identifier creators entry type based on identifier type type.
|
|
20
|
+
*
|
|
21
|
+
* @template TIdentifierType
|
|
22
|
+
* Identifier type type.
|
|
23
|
+
*/
|
|
24
|
+
export type IdentifierCreatorsEntry<TIdentifierType extends IdentifierType> = IdentifierTypeCreator<TIdentifierType>;
|
|
25
|
+
/**
|
|
26
|
+
* Identifier creators record type.
|
|
27
|
+
*/
|
|
28
|
+
export type IdentifierCreatorsRecord = {
|
|
29
|
+
[TIdentifierType in IdentifierType]: IdentifierCreatorsEntry<TIdentifierType>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Determine if identifier creator is a numeric identifier creator.
|
|
33
|
+
*
|
|
34
|
+
* @param identifierCreator
|
|
35
|
+
* Identifier creator.
|
|
36
|
+
*
|
|
37
|
+
* @returns
|
|
38
|
+
* True if identifier creator is a numeric identifier creator.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NumericIdentifierCreator;
|
|
41
|
+
/**
|
|
42
|
+
* Determine if identifier creator is a GTIN creator.
|
|
43
|
+
*
|
|
44
|
+
* @param identifierCreator
|
|
45
|
+
* Identifier creator.
|
|
46
|
+
*
|
|
47
|
+
* @returns
|
|
48
|
+
* True if identifier creator is a GTIN creator.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isGTINCreator(identifierCreator: IdentifierCreator): identifierCreator is GTINCreator;
|
|
51
|
+
/**
|
|
52
|
+
* Determine if identifier creator is a non-GTIN numeric identifier creator.
|
|
53
|
+
*
|
|
54
|
+
* @param identifierCreator
|
|
55
|
+
* Identifier creator.
|
|
56
|
+
*
|
|
57
|
+
* @returns
|
|
58
|
+
* True if identifier creator is a non-GTIN numeric identifier creator.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isNonGTINNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonGTINNumericIdentifierCreator;
|
|
61
|
+
/**
|
|
62
|
+
* Determine if identifier creator is a serializable numeric identifier creator.
|
|
63
|
+
*
|
|
64
|
+
* @param identifierCreator
|
|
65
|
+
* Identifier creator.
|
|
66
|
+
*
|
|
67
|
+
* @returns
|
|
68
|
+
* True if identifier creator is a serializable numeric identifier creator.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isSerializableNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is SerializableNumericIdentifierCreator;
|
|
71
|
+
/**
|
|
72
|
+
* Determine if identifier creator is a non-numeric identifier creator.
|
|
73
|
+
*
|
|
74
|
+
* @param identifierCreator
|
|
75
|
+
* Identifier creator.
|
|
76
|
+
*
|
|
77
|
+
* @returns
|
|
78
|
+
* True if identifier creator is a non-numeric identifier creator.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isNonNumericIdentifierCreator(identifierCreator: IdentifierCreator): identifierCreator is NonNumericIdentifierCreator;
|
|
81
|
+
//# sourceMappingURL=creators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creators.d.ts","sourceRoot":"","sources":["../src/creators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AACzG,OAAO,KAAK,EAAE,i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