@aidc-toolkit/gs1 1.0.24-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 -1588
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -4541
- 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 +12 -8
- package/src/abstract-identifier-creator.ts +97 -0
- package/src/abstract-identifier-validator.ts +140 -0
- package/src/abstract-numeric-identifier-creator.ts +168 -0
- package/src/abstract-numeric-identifier-validator.ts +69 -0
- package/src/character-set.ts +10 -10
- package/src/check.ts +9 -9
- package/src/content-character-set.ts +29 -0
- package/src/creators.ts +113 -0
- package/src/descriptors.ts +332 -0
- package/src/gtin-creator.ts +10 -9
- package/src/gtin-descriptor.ts +18 -0
- package/src/gtin-type.ts +50 -0
- package/src/gtin-validator.ts +40 -64
- package/src/identifier-creator.ts +12 -76
- package/src/identifier-descriptor.ts +30 -0
- package/src/identifier-type.ts +6 -1
- package/src/identifier-validator.ts +12 -188
- package/src/index.ts +44 -19
- package/src/locale/en/locale-resources.ts +0 -1
- package/src/locale/fr/locale-resources.ts +0 -1
- package/src/locale/i18n.ts +3 -3
- package/src/locale/i18next.d.ts +1 -1
- package/src/non-gtin-numeric-identifier-creator.ts +7 -13
- package/src/non-gtin-numeric-identifier-descriptor.ts +24 -0
- package/src/non-gtin-numeric-identifier-type.ts +7 -0
- package/src/non-gtin-numeric-identifier-validator.ts +8 -42
- package/src/non-numeric-identifier-creator.ts +9 -19
- package/src/non-numeric-identifier-descriptor.ts +29 -0
- package/src/non-numeric-identifier-type.ts +7 -0
- package/src/non-numeric-identifier-validator.ts +17 -55
- package/src/numeric-identifier-creator.ts +20 -163
- package/src/numeric-identifier-descriptor.ts +23 -0
- package/src/numeric-identifier-type.ts +44 -0
- package/src/numeric-identifier-validator.ts +13 -116
- package/src/prefix-manager.ts +94 -152
- package/src/prefix-provider.ts +3 -3
- package/src/prefix-type.ts +6 -1
- package/src/prefix-validator.ts +143 -81
- package/src/serializable-numeric-identifier-creator.ts +6 -16
- package/src/serializable-numeric-identifier-descriptor.ts +29 -0
- package/src/serializable-numeric-identifier-type.ts +9 -0
- package/src/serializable-numeric-identifier-validator.ts +18 -46
- package/src/validators.ts +203 -0
- package/test/check.test.ts +1 -1
- package/test/creator.test.ts +5 -7
- package/test/gtin-creator.ts +6 -2
- package/test/gtin-validator.test.ts +7 -10
- package/test/identifier-creator.ts +6 -5
- package/test/identifier-validator.ts +2 -2
- package/test/non-gtin-numeric-identifier-creator.ts +9 -93
- package/test/non-gtin-numeric-identifier-validator.ts +3 -3
- package/test/non-numeric-identifier-creator.ts +93 -0
- package/test/non-numeric-identifier-validator.ts +3 -3
- package/test/numeric-identifier-creator.ts +11 -5
- package/test/numeric-identifier-validator.ts +5 -9
- package/test/prefix-manager.test.ts +2 -2
- package/test/serializable-numeric-identifier-creator.ts +11 -3
- 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 +64 -40
- 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 -4624
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1588
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-creator.js","sourceRoot":"","sources":["../src/gtin-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EACV,eAAe,EAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,M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,CAAC;wBACtB,MAAM;oBAEV,KAAK,GAAG;wBACJ,2DAA2D;wBAC3D,WAAW,GAAG,CAAC,gCAAgC,CAAC;wBAEhD,qBAAqB,GAAG,KAAK,CAAC;wBAC9B,qBAAqB,GAAG,KAAK,CAAC;wBAE9B,gCAAgC,GAAG,IAAI,CAAC;wBAExC,WAAW,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;wBACjD,MAAM;oBAEV;wBACI,WAAW,GAAG,KAAK,CAAC;wBACpB,MAAM;gBACd,CAAC;YACL,CAAC;QACL,CAAC;QAED,WAAW,KAAK,mBAAmB,KAAK,CAAC,IAAI,mBAAmB,KAAK,CAAC,CAAC;QAEvE,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC;QACrF,CAAC;QAED,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;QACjF,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;QAEjF,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAEpC,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IdentifierTypes } from "./identifier-type.js";
|
|
2
|
+
import type { NumericIdentifierDescriptor } from "./numeric-identifier-descriptor.js";
|
|
3
|
+
import type { LeaderTypes } from "./numeric-identifier-type.js";
|
|
4
|
+
/**
|
|
5
|
+
* GTIN descriptor.
|
|
6
|
+
*/
|
|
7
|
+
export interface GTINDescriptor extends NumericIdentifierDescriptor {
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
readonly identifierType: typeof IdentifierTypes.GTIN;
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
readonly leaderType: typeof LeaderTypes.IndicatorDigit;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=gtin-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-descriptor.d.ts","sourceRoot":"","sources":["../src/gtin-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,2BAA2B;IAC/D;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,eAAe,CAAC,IAAI,CAAC;IAErD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,WAAW,CAAC,cAAc,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-descriptor.js","sourceRoot":"","sources":["../src/gtin-descriptor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type PrefixType } from "./prefix-type.js";
|
|
2
|
+
/**
|
|
3
|
+
* GTIN types. The numeric values are equal to the lengths of the GTIN types.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GTINTypes: {
|
|
6
|
+
/**
|
|
7
|
+
* GTIN-13.
|
|
8
|
+
*/
|
|
9
|
+
readonly GTIN13: 13;
|
|
10
|
+
/**
|
|
11
|
+
* GTIN-12.
|
|
12
|
+
*/
|
|
13
|
+
readonly GTIN12: 12;
|
|
14
|
+
/**
|
|
15
|
+
* GTIN-8.
|
|
16
|
+
*/
|
|
17
|
+
readonly GTIN8: 8;
|
|
18
|
+
/**
|
|
19
|
+
* GTIN-14.
|
|
20
|
+
*/
|
|
21
|
+
readonly GTIN14: 14;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* GTIN type key.
|
|
25
|
+
*/
|
|
26
|
+
export type GTINTypeKey = keyof typeof GTINTypes;
|
|
27
|
+
/**
|
|
28
|
+
* GTIN type.
|
|
29
|
+
*/
|
|
30
|
+
export type GTINType = typeof GTINTypes[GTINTypeKey];
|
|
31
|
+
/**
|
|
32
|
+
* GTIN base type (all except GTIN-14).
|
|
33
|
+
*/
|
|
34
|
+
export type GTINBaseType = Exclude<GTINType, typeof GTINTypes.GTIN14>;
|
|
35
|
+
/**
|
|
36
|
+
* GTIN base types by prefix type. Used to determine the GTIN type supported by a prefix type.
|
|
37
|
+
*/
|
|
38
|
+
export declare const GTIN_BASE_TYPES: Readonly<Record<PrefixType, GTINBaseType>>;
|
|
39
|
+
//# sourceMappingURL=gtin-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-type.d.ts","sourceRoot":"","sources":["../src/gtin-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,SAAS;IAClB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAItE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PrefixTypes } from "./prefix-type.js";
|
|
2
|
+
/**
|
|
3
|
+
* GTIN types. The numeric values are equal to the lengths of the GTIN types.
|
|
4
|
+
*/
|
|
5
|
+
export const GTINTypes = {
|
|
6
|
+
/**
|
|
7
|
+
* GTIN-13.
|
|
8
|
+
*/
|
|
9
|
+
GTIN13: 13,
|
|
10
|
+
/**
|
|
11
|
+
* GTIN-12.
|
|
12
|
+
*/
|
|
13
|
+
GTIN12: 12,
|
|
14
|
+
/**
|
|
15
|
+
* GTIN-8.
|
|
16
|
+
*/
|
|
17
|
+
GTIN8: 8,
|
|
18
|
+
/**
|
|
19
|
+
* GTIN-14.
|
|
20
|
+
*/
|
|
21
|
+
GTIN14: 14
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* GTIN base types by prefix type. Used to determine the GTIN type supported by a prefix type.
|
|
25
|
+
*/
|
|
26
|
+
export const GTIN_BASE_TYPES = {
|
|
27
|
+
[PrefixTypes.GS1CompanyPrefix]: GTINTypes.GTIN13,
|
|
28
|
+
[PrefixTypes.UPCCompanyPrefix]: GTINTypes.GTIN12,
|
|
29
|
+
[PrefixTypes.GS18Prefix]: GTINTypes.GTIN8
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=gtin-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-type.js","sourceRoot":"","sources":["../src/gtin-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB;;OAEG;IACH,MAAM,EAAE,EAAE;IAEV;;OAEG;IACH,MAAM,EAAE,EAAE;IAEV;;OAEG;IACH,KAAK,EAAE,CAAC;IAER;;OAEG;IACH,MAAM,EAAE,EAAE;CACJ,CAAC;AAiBX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA+C;IACvE,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,MAAM;IAChD,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC,MAAM;IAChD,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,KAAK;CAC5C,CAAC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { AbstractNumericIdentifierValidator } from "./abstract-numeric-identifier-validator.js";
|
|
2
|
+
import type { GTINDescriptor } from "./gtin-descriptor.js";
|
|
3
|
+
import { type GTINBaseType, type GTINType } from "./gtin-type.js";
|
|
4
|
+
import { type PrefixType } from "./prefix-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Levels at which GTIN is to be validated.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GTINLevels: {
|
|
9
|
+
/**
|
|
10
|
+
* Any level (level is ignored).
|
|
11
|
+
*/
|
|
12
|
+
readonly Any: 0;
|
|
13
|
+
/**
|
|
14
|
+
* Retail consumer trade item level, supporting GTIN-13, GTIN-12 (optionally zero-suppressed), and GTIN-8.
|
|
15
|
+
*/
|
|
16
|
+
readonly RetailConsumer: 1;
|
|
17
|
+
/**
|
|
18
|
+
* Other than retail consumer trade item level, supporting GTIN-13, GTIN-12 (not zero-suppressed), and GTIN-14.
|
|
19
|
+
*/
|
|
20
|
+
readonly OtherThanRetailConsumer: 2;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* GTIN level key.
|
|
24
|
+
*/
|
|
25
|
+
export type GTINLevelKey = keyof typeof GTINLevels;
|
|
26
|
+
/**
|
|
27
|
+
* GTIN level.
|
|
28
|
+
*/
|
|
29
|
+
export type GTINLevel = typeof GTINLevels[GTINLevelKey];
|
|
30
|
+
/**
|
|
31
|
+
* Restricted Circulation Number reference.
|
|
32
|
+
*/
|
|
33
|
+
export interface RCNReference {
|
|
34
|
+
/**
|
|
35
|
+
* Item reference.
|
|
36
|
+
*/
|
|
37
|
+
itemReference: number;
|
|
38
|
+
/**
|
|
39
|
+
* Price or weight (whole number only).
|
|
40
|
+
*/
|
|
41
|
+
priceOrWeight: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* GTIN validator.
|
|
45
|
+
*/
|
|
46
|
+
export declare class GTINValidator extends AbstractNumericIdentifierValidator<GTINDescriptor> {
|
|
47
|
+
/**
|
|
48
|
+
* Validation parameters for optional indicator digit.
|
|
49
|
+
*/
|
|
50
|
+
private static readonly OPTIONAL_INDICATOR_DIGIT_VALIDATION;
|
|
51
|
+
/**
|
|
52
|
+
* Validation parameters for zero-suppressed GTIN-12.
|
|
53
|
+
*/
|
|
54
|
+
private static readonly ZERO_SUPPRESSED_GTIN12_VALIDATION;
|
|
55
|
+
/**
|
|
56
|
+
* Prefix type.
|
|
57
|
+
*/
|
|
58
|
+
private readonly _prefixType;
|
|
59
|
+
/**
|
|
60
|
+
* Constructor.
|
|
61
|
+
*
|
|
62
|
+
* @param gtinBaseType
|
|
63
|
+
* GTIN base type (all except GTIN-14).
|
|
64
|
+
*/
|
|
65
|
+
constructor(gtinBaseType: GTINBaseType);
|
|
66
|
+
/**
|
|
67
|
+
* @inheritDoc
|
|
68
|
+
*/
|
|
69
|
+
get prefixType(): PrefixType;
|
|
70
|
+
/**
|
|
71
|
+
* @inheritDoc
|
|
72
|
+
*/
|
|
73
|
+
get gtinType(): GTINType;
|
|
74
|
+
/**
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/
|
|
77
|
+
protected validatePrefix(partialIdentifier: string, positionOffset?: number): void;
|
|
78
|
+
/**
|
|
79
|
+
* Zero suppress a GTIN-12.
|
|
80
|
+
*
|
|
81
|
+
* @param gtin12
|
|
82
|
+
* GTIN-12.
|
|
83
|
+
*
|
|
84
|
+
* @returns
|
|
85
|
+
* Zero-suppressed GTIN-12.
|
|
86
|
+
*/
|
|
87
|
+
static zeroSuppress(gtin12: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Zero expand a zero-suppressed GTIN-12.
|
|
90
|
+
*
|
|
91
|
+
* @param zeroSuppressedGTIN12
|
|
92
|
+
* Zero-suppressed GTIN-12.
|
|
93
|
+
*
|
|
94
|
+
* @returns
|
|
95
|
+
* GTIN-12.
|
|
96
|
+
*/
|
|
97
|
+
static zeroExpand(zeroSuppressedGTIN12: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* Convert a GTIN of any length to a GTIN-14 with an optional indicator digit.
|
|
100
|
+
*
|
|
101
|
+
* @param indicatorDigit
|
|
102
|
+
* Indicator digit. If blank, assumes "0" if the GTIN is not already a GTIN-14.
|
|
103
|
+
*
|
|
104
|
+
* @param gtin
|
|
105
|
+
* GTIN.
|
|
106
|
+
*
|
|
107
|
+
* @returns
|
|
108
|
+
* GTIN-14.
|
|
109
|
+
*/
|
|
110
|
+
static convertToGTIN14(indicatorDigit: string, gtin: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Normalize a GTIN of any length.
|
|
113
|
+
* - A GTIN-14 that starts with six zeros or a GTIN-13 that starts with five zeros is normalized to GTIN-8.
|
|
114
|
+
* - A GTIN-14 that starts with two zeros or a GTIN-13 that starts with one zero is normalized to GTIN-12.
|
|
115
|
+
* - A GTIN-14 that starts with one zero is normalized to GTIN-13.
|
|
116
|
+
* - Otherwise, the GTIN is unchanged.
|
|
117
|
+
*
|
|
118
|
+
* @param gtin
|
|
119
|
+
* GTIN.
|
|
120
|
+
*
|
|
121
|
+
* @returns
|
|
122
|
+
* Normalized GTIN.
|
|
123
|
+
*/
|
|
124
|
+
static normalize(gtin: string): string;
|
|
125
|
+
/**
|
|
126
|
+
* Validate any GTIN, optionally against a level.
|
|
127
|
+
*
|
|
128
|
+
* @param gtin
|
|
129
|
+
* GTIN.
|
|
130
|
+
*
|
|
131
|
+
* @param gtinLevel
|
|
132
|
+
* Level at which GTIN is to be validated.
|
|
133
|
+
*/
|
|
134
|
+
static validateAny(gtin: string, gtinLevel?: GTINLevel): void;
|
|
135
|
+
/**
|
|
136
|
+
* Validate a GTIN-14.
|
|
137
|
+
*
|
|
138
|
+
* @param gtin14
|
|
139
|
+
* GTIN-14.
|
|
140
|
+
*/
|
|
141
|
+
static validateGTIN14(gtin14: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Parse a Restricted Circulation Number (RCN) using a variable measure trade item format. The format is a 12- or
|
|
144
|
+
* 13-character string (for RCN-12 or RCN-13 respectively), containing the following:
|
|
145
|
+
*
|
|
146
|
+
* - '2' - The first character of the RCN.
|
|
147
|
+
* - '0'-'9' - The second character of the RCN (RCN-13 only).
|
|
148
|
+
* - 'I' - One or more, in sequence, for the item reference.
|
|
149
|
+
* - 'P' - One or more, in sequence, for the price or weight.
|
|
150
|
+
* - 'V' - Zero or one, for the price or weight check digit.
|
|
151
|
+
* - 'C' - The check digit of the entire RCN.
|
|
152
|
+
*
|
|
153
|
+
* The 'I', 'P', and 'V' formats may be in any order.
|
|
154
|
+
*
|
|
155
|
+
* Some examples:
|
|
156
|
+
*
|
|
157
|
+
* - 2IIIIIVPPPPC - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
|
|
158
|
+
* or weight.
|
|
159
|
+
* - 23IIIIVPPPPPC - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
|
|
160
|
+
* or weight.
|
|
161
|
+
* - 2IIIIIIPPPPC - RCN-12 with a six-digit item reference and a four-digit price or eight.
|
|
162
|
+
* - 29IIIIIPPPPPC - RCN-13 with a five-digit item reference and a five-digit price or weight.
|
|
163
|
+
*
|
|
164
|
+
* @param format
|
|
165
|
+
* Format.
|
|
166
|
+
*
|
|
167
|
+
* @param rcn
|
|
168
|
+
* RCN.
|
|
169
|
+
*
|
|
170
|
+
* @returns
|
|
171
|
+
* RCN reference.
|
|
172
|
+
*/
|
|
173
|
+
static parseVariableMeasureRCN(format: string, rcn: string): RCNReference;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* GTIN-13 validator.
|
|
177
|
+
*/
|
|
178
|
+
export declare const GTIN13_VALIDATOR: GTINValidator;
|
|
179
|
+
/**
|
|
180
|
+
* GTIN-12 validator.
|
|
181
|
+
*/
|
|
182
|
+
export declare const GTIN12_VALIDATOR: GTINValidator;
|
|
183
|
+
/**
|
|
184
|
+
* GTIN-8 validator.
|
|
185
|
+
*/
|
|
186
|
+
export declare const GTIN8_VALIDATOR: GTINValidator;
|
|
187
|
+
/**
|
|
188
|
+
* GTIN validators indexed by prefix type.
|
|
189
|
+
*/
|
|
190
|
+
export declare const GTIN_VALIDATORS: Readonly<Record<GTINBaseType, GTINValidator>>;
|
|
191
|
+
//# sourceMappingURL=gtin-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gtin-validator.d.ts","sourceRoot":"","sources":["../src/gtin-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAGhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAa,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAGhE;;GAEG;AACH,eAAO,MAAM,UAAU;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,kCAAkC,CAAC,cAAc,CAAC;IACjF;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAIzD;IAEF;;OAEG;IACH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