@aidc-toolkit/gs1 0.9.20-beta → 1.0.22-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/character-set.d.ts +4 -4
- package/dist/character-set.d.ts.map +1 -1
- package/dist/character-set.js +7 -7
- package/dist/character-set.js.map +1 -1
- package/dist/gtin-creator.d.ts +68 -0
- package/dist/gtin-creator.d.ts.map +1 -0
- package/dist/gtin-creator.js +158 -0
- package/dist/gtin-creator.js.map +1 -0
- package/dist/gtin-validator.d.ts +202 -0
- package/dist/gtin-validator.d.ts.map +1 -0
- package/dist/gtin-validator.js +470 -0
- package/dist/gtin-validator.js.map +1 -0
- package/dist/identifier-creator.d.ts +72 -0
- package/dist/identifier-creator.d.ts.map +1 -0
- package/dist/identifier-creator.js +50 -0
- package/dist/identifier-creator.js.map +1 -0
- package/dist/identifier-type.d.ts +58 -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 +174 -0
- package/dist/identifier-validator.d.ts.map +1 -0
- package/dist/identifier-validator.js +145 -0
- package/dist/identifier-validator.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/locale/en/locale-strings.d.ts +3 -3
- package/dist/locale/en/locale-strings.js +3 -3
- package/dist/locale/en/locale-strings.js.map +1 -1
- package/dist/locale/fr/locale-strings.d.ts +3 -3
- package/dist/locale/fr/locale-strings.js +3 -3
- package/dist/locale/fr/locale-strings.js.map +1 -1
- package/dist/non-gtin-numeric-identifier-creator.d.ts +30 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.js +30 -0
- package/dist/non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts +41 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.js +40 -0
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -0
- package/dist/non-numeric-identifier-creator.d.ts +55 -0
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-creator.js +93 -0
- package/dist/non-numeric-identifier-creator.js.map +1 -0
- package/dist/non-numeric-identifier-validator.d.ts +78 -0
- package/dist/non-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-validator.js +95 -0
- package/dist/non-numeric-identifier-validator.js.map +1 -0
- package/dist/numeric-identifier-creator.d.ts +121 -0
- package/dist/numeric-identifier-creator.d.ts.map +1 -0
- package/dist/numeric-identifier-creator.js +135 -0
- package/dist/numeric-identifier-creator.js.map +1 -0
- package/dist/numeric-identifier-validator.d.ts +76 -0
- package/dist/numeric-identifier-validator.d.ts.map +1 -0
- package/dist/numeric-identifier-validator.js +84 -0
- package/dist/numeric-identifier-validator.js.map +1 -0
- package/dist/prefix-manager.d.ts +224 -0
- package/dist/prefix-manager.d.ts.map +1 -0
- package/dist/prefix-manager.js +369 -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 +22 -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 +58 -0
- package/dist/prefix-validator.d.ts.map +1 -0
- package/dist/prefix-validator.js +154 -0
- package/dist/prefix-validator.js.map +1 -0
- package/dist/serializable-numeric-identifier-creator.d.ts +86 -0
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-creator.js +116 -0
- package/dist/serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/serializable-numeric-identifier-validator.d.ts +79 -0
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-validator.js +99 -0
- package/dist/serializable-numeric-identifier-validator.js.map +1 -0
- package/gs1.iml +4 -1
- package/package.json +2 -3
- package/src/character-set.ts +7 -7
- package/src/gtin-creator.ts +195 -0
- package/src/gtin-validator.ts +564 -0
- package/src/identifier-creator.ts +97 -0
- package/src/identifier-type.ts +69 -0
- package/src/identifier-validator.ts +235 -0
- package/src/index.ts +16 -1
- package/src/locale/en/locale-strings.ts +3 -3
- package/src/locale/fr/locale-strings.ts +3 -3
- package/src/non-gtin-numeric-identifier-creator.ts +33 -0
- package/src/non-gtin-numeric-identifier-validator.ts +54 -0
- package/src/non-numeric-identifier-creator.ts +111 -0
- package/src/non-numeric-identifier-validator.ts +128 -0
- package/src/numeric-identifier-creator.ts +200 -0
- package/src/numeric-identifier-validator.ts +128 -0
- package/src/prefix-manager.ts +446 -0
- package/src/prefix-provider.ts +31 -0
- package/src/prefix-type.ts +24 -0
- package/src/prefix-validator.ts +191 -0
- package/src/serializable-numeric-identifier-creator.ts +128 -0
- package/src/serializable-numeric-identifier-validator.ts +124 -0
- package/test/check.test.ts +0 -4
- package/test/creator.test.ts +30 -0
- package/test/gtin-creator.ts +239 -0
- package/test/gtin-validator.test.ts +149 -0
- package/test/identifier-creator.ts +84 -0
- package/test/identifier-validator.ts +8 -0
- package/test/non-gtin-numeric-identifier-creator.ts +98 -0
- package/test/non-gtin-numeric-identifier-validator.ts +6 -0
- package/test/non-numeric-identifier-validator.ts +24 -0
- package/test/numeric-identifier-creator.ts +132 -0
- package/test/numeric-identifier-validator.ts +23 -0
- package/test/prefix-manager.test.ts +112 -0
- package/test/serializable-numeric-identifier-creator.ts +56 -0
- package/test/serializable-numeric-identifier-validator.ts +24 -0
- package/test/setup.ts +4 -0
- package/test/sparse.test.ts +56 -0
- package/test/utility.ts +22 -0
- package/test/validator.test.ts +52 -0
- package/test/variable-measure-rcn.test.ts +201 -0
- package/vitest.config.ts +7 -0
- package/dist/idkey.d.ts +0 -1346
- package/dist/idkey.d.ts.map +0 -1
- package/dist/idkey.js +0 -2024
- package/dist/idkey.js.map +0 -1
- package/src/idkey.ts +0 -2532
- package/test/idkey.test.ts +0 -1247
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-type.d.ts","sourceRoot":"","sources":["../src/identifier-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe;IACxB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifier types.
|
|
3
|
+
*/
|
|
4
|
+
export const IdentifierTypes = {
|
|
5
|
+
/**
|
|
6
|
+
* Global Trade Item Number.
|
|
7
|
+
*/
|
|
8
|
+
GTIN: "GTIN",
|
|
9
|
+
/**
|
|
10
|
+
* Global Location Number.
|
|
11
|
+
*/
|
|
12
|
+
GLN: "GLN",
|
|
13
|
+
/**
|
|
14
|
+
* Serial Shipping Container Code.
|
|
15
|
+
*/
|
|
16
|
+
SSCC: "SSCC",
|
|
17
|
+
/**
|
|
18
|
+
* Global Returnable Asset Identifier.
|
|
19
|
+
*/
|
|
20
|
+
GRAI: "GRAI",
|
|
21
|
+
/**
|
|
22
|
+
* Global Individual Asset Identifier.
|
|
23
|
+
*/
|
|
24
|
+
GIAI: "GIAI",
|
|
25
|
+
/**
|
|
26
|
+
* Global Service Relation Number.
|
|
27
|
+
*/
|
|
28
|
+
GSRN: "GSRN",
|
|
29
|
+
/**
|
|
30
|
+
* Global Document Type Identifier.
|
|
31
|
+
*/
|
|
32
|
+
GDTI: "GDTI",
|
|
33
|
+
/**
|
|
34
|
+
* Global Identification Number for Consignment.
|
|
35
|
+
*/
|
|
36
|
+
GINC: "GINC",
|
|
37
|
+
/**
|
|
38
|
+
* Global Shipment Identification Number.
|
|
39
|
+
*/
|
|
40
|
+
GSIN: "GSIN",
|
|
41
|
+
/**
|
|
42
|
+
* Global Coupon Number.
|
|
43
|
+
*/
|
|
44
|
+
GCN: "GCN",
|
|
45
|
+
/**
|
|
46
|
+
* Component/Part Identifier.
|
|
47
|
+
*/
|
|
48
|
+
CPID: "CPID",
|
|
49
|
+
/**
|
|
50
|
+
* Global Model Number.
|
|
51
|
+
*/
|
|
52
|
+
GMN: "GMN"
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=identifier-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-type.js","sourceRoot":"","sources":["../src/identifier-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,GAAG,EAAE,KAAK;IAEV;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,GAAG,EAAE,KAAK;IAEV;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,GAAG,EAAE,KAAK;CACJ,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { type CharacterSetCreator, type StringValidation, type StringValidator } from "@aidc-toolkit/utility";
|
|
2
|
+
import type { IdentifierType } from "./identifier-type.js";
|
|
3
|
+
import type { PrefixType } from "./prefix-type.js";
|
|
4
|
+
/**
|
|
5
|
+
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ContentCharacterSets: {
|
|
8
|
+
/**
|
|
9
|
+
* Numeric.
|
|
10
|
+
*/
|
|
11
|
+
readonly Numeric: "Numeric";
|
|
12
|
+
/**
|
|
13
|
+
* GS1 AI encodable character set 82.
|
|
14
|
+
*/
|
|
15
|
+
readonly AI82: "AI82";
|
|
16
|
+
/**
|
|
17
|
+
* GS1 AI encodable character set 39.
|
|
18
|
+
*/
|
|
19
|
+
readonly AI39: "AI39";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Content character set.
|
|
23
|
+
*/
|
|
24
|
+
export type ContentCharacterSet = typeof ContentCharacterSets[keyof typeof ContentCharacterSets];
|
|
25
|
+
/**
|
|
26
|
+
* Identifier validation parameters.
|
|
27
|
+
*/
|
|
28
|
+
export interface IdentifierValidation extends StringValidation {
|
|
29
|
+
/**
|
|
30
|
+
* Position offset within a larger string. Strings are sometimes composed of multiple substrings; this parameter
|
|
31
|
+
* ensures that the error notes the proper position in the string.
|
|
32
|
+
*/
|
|
33
|
+
positionOffset?: number | undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Identifier validator. Validates an identifier against its definition in section 3 of the {@link
|
|
37
|
+
* https://www.gs1.org/genspecs | GS1 General Specifications}.
|
|
38
|
+
*
|
|
39
|
+
* @template TIdentifierValidation
|
|
40
|
+
* Identifier validation type.
|
|
41
|
+
*/
|
|
42
|
+
export interface IdentifierValidator<TIdentifierValidation extends IdentifierValidation = IdentifierValidation> extends StringValidator<TIdentifierValidation> {
|
|
43
|
+
/**
|
|
44
|
+
* Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining
|
|
45
|
+
* properties.
|
|
46
|
+
*/
|
|
47
|
+
get identifierType(): IdentifierType;
|
|
48
|
+
/**
|
|
49
|
+
* Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is
|
|
50
|
+
* {@linkcode PrefixTypes.GS1CompanyPrefix}. For the GTIN, the prefix type determines the length.
|
|
51
|
+
*/
|
|
52
|
+
get prefixType(): PrefixType;
|
|
53
|
+
/**
|
|
54
|
+
* Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length
|
|
55
|
+
* is the maximum.
|
|
56
|
+
*/
|
|
57
|
+
get length(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Get the reference character set.
|
|
60
|
+
*/
|
|
61
|
+
get referenceCharacterSet(): ContentCharacterSet;
|
|
62
|
+
/**
|
|
63
|
+
* Get the reference creator.
|
|
64
|
+
*/
|
|
65
|
+
get referenceCreator(): CharacterSetCreator;
|
|
66
|
+
/**
|
|
67
|
+
* Validate an identifier and throw an error if validation fails.
|
|
68
|
+
*
|
|
69
|
+
* @param identifier
|
|
70
|
+
* Identifier.
|
|
71
|
+
*
|
|
72
|
+
* @param validation
|
|
73
|
+
* Identifier validation parameters.
|
|
74
|
+
*/
|
|
75
|
+
validate: (identifier: string, validation?: TIdentifierValidation) => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Abstract identifier validator. Implements common functionality for an identifier validator.
|
|
79
|
+
*/
|
|
80
|
+
export declare abstract class AbstractIdentifierValidator<TIdentifierValidation extends IdentifierValidation = IdentifierValidation> implements IdentifierValidator<TIdentifierValidation> {
|
|
81
|
+
private static readonly CHARACTER_SET_CREATORS;
|
|
82
|
+
/**
|
|
83
|
+
* Identifier type.
|
|
84
|
+
*/
|
|
85
|
+
private readonly _identifierType;
|
|
86
|
+
/**
|
|
87
|
+
* Prefix type.
|
|
88
|
+
*/
|
|
89
|
+
private readonly _prefixType;
|
|
90
|
+
/**
|
|
91
|
+
* Length.
|
|
92
|
+
*/
|
|
93
|
+
private readonly _length;
|
|
94
|
+
/**
|
|
95
|
+
* Reference character set.
|
|
96
|
+
*/
|
|
97
|
+
private readonly _referenceCharacterSet;
|
|
98
|
+
/**
|
|
99
|
+
* Reference creator.
|
|
100
|
+
*/
|
|
101
|
+
private readonly _referenceCreator;
|
|
102
|
+
/**
|
|
103
|
+
* Get the character set creator for a character set.
|
|
104
|
+
*
|
|
105
|
+
* @param characterSet
|
|
106
|
+
* Character set.
|
|
107
|
+
*
|
|
108
|
+
* @returns
|
|
109
|
+
* Character set creator.
|
|
110
|
+
*/
|
|
111
|
+
protected static creatorFor(characterSet: ContentCharacterSet): CharacterSetCreator;
|
|
112
|
+
/**
|
|
113
|
+
* Constructor.
|
|
114
|
+
*
|
|
115
|
+
* @param identifierType
|
|
116
|
+
* Identifier type.
|
|
117
|
+
*
|
|
118
|
+
* @param prefixType
|
|
119
|
+
* Prefix type.
|
|
120
|
+
*
|
|
121
|
+
* @param length
|
|
122
|
+
* Length.
|
|
123
|
+
*
|
|
124
|
+
* @param referenceCharacterSet
|
|
125
|
+
* Reference character set.
|
|
126
|
+
*/
|
|
127
|
+
protected constructor(identifierType: IdentifierType, prefixType: PrefixType, length: number, referenceCharacterSet: ContentCharacterSet);
|
|
128
|
+
/**
|
|
129
|
+
* @inheritDoc
|
|
130
|
+
*/
|
|
131
|
+
get identifierType(): IdentifierType;
|
|
132
|
+
/**
|
|
133
|
+
* @inheritDoc
|
|
134
|
+
*/
|
|
135
|
+
get prefixType(): PrefixType;
|
|
136
|
+
/**
|
|
137
|
+
* @inheritDoc
|
|
138
|
+
*/
|
|
139
|
+
get length(): number;
|
|
140
|
+
/**
|
|
141
|
+
* @inheritDoc
|
|
142
|
+
*/
|
|
143
|
+
get referenceCharacterSet(): ContentCharacterSet;
|
|
144
|
+
/**
|
|
145
|
+
* @inheritDoc
|
|
146
|
+
*/
|
|
147
|
+
get referenceCreator(): CharacterSetCreator;
|
|
148
|
+
/**
|
|
149
|
+
* Pad an identifier on the left with zero-value character for validation purposes. This is done to align an
|
|
150
|
+
* identifier with a position offset for any error message that may be thrown by the reference validator.
|
|
151
|
+
*
|
|
152
|
+
* @param identifier
|
|
153
|
+
* Identifier.
|
|
154
|
+
*
|
|
155
|
+
* @param validation
|
|
156
|
+
* Identifier validation parameters.
|
|
157
|
+
*
|
|
158
|
+
* @returns
|
|
159
|
+
* Padded identifier.
|
|
160
|
+
*/
|
|
161
|
+
protected padIdentifier(identifier: string, validation: IdentifierValidation | undefined): string;
|
|
162
|
+
/**
|
|
163
|
+
* Validate the prefix within an identifier.
|
|
164
|
+
*
|
|
165
|
+
* @param partialIdentifier
|
|
166
|
+
* Partial identifier.
|
|
167
|
+
*
|
|
168
|
+
* @param positionOffset
|
|
169
|
+
* Position offset within a larger string.
|
|
170
|
+
*/
|
|
171
|
+
protected validatePrefix(partialIdentifier: string, positionOffset?: number): void;
|
|
172
|
+
abstract validate(identifier: string, validation?: TIdentifierValidation): void;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=identifier-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-validator.d.ts","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,mBAAmB,EAExB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAC7B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEG,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,oBAAoB,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB,CAAC,qBAAqB,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,eAAe,CAAC,qBAAqB,CAAC;IAC1J;;;OAGG;IACH,IAAI,cAAc,IAAI,cAAc,CAAC;IAErC;;;OAGG;IACH,IAAI,UAAU,IAAI,UAAU,CAAC;IAE7B;;;OAGG;IACH,IAAI,MAAM,IAAI,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,qBAAqB,IAAI,mBAAmB,CAAC;IAEjD;;OAEG;IACH,IAAI,gBAAgB,IAAI,mBAAmB,CAAC;IAE5C;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAC9E;AAED;;GAEG;AACH,8BAAsB,2BAA2B,CAAC,qBAAqB,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,YAAW,mBAAmB,CAAC,qBAAqB,CAAC;IAC9K,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAI5C;IAEF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAEjD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAsB;IAE7D;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsB;IAExD;;;;;;;;OAQG;IACH,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,mBAAmB,GAAG,mBAAmB;IAInF;;;;;;;;;;;;;;OAcG;IACH,SAAS,aAAa,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB;IAQxI;;OAEG;IACH,IAAI,cAAc,IAAI,cAAc,CAEnC;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,qBAAqB,IAAI,mBAAmB,CAE/C;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,mBAAmB,CAE1C;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,SAAS,GAAG,MAAM;IAKjG;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,CAAC,iBAAiB,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAKlF,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,qBAAqB,GAAG,IAAI;CAClF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
+
import { AI39_CREATOR, AI82_CREATOR } from "./character-set.js";
|
|
3
|
+
import { PrefixValidator } from "./prefix-validator.js";
|
|
4
|
+
/**
|
|
5
|
+
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
|
6
|
+
*/
|
|
7
|
+
export const ContentCharacterSets = {
|
|
8
|
+
/**
|
|
9
|
+
* Numeric.
|
|
10
|
+
*/
|
|
11
|
+
Numeric: "Numeric",
|
|
12
|
+
/**
|
|
13
|
+
* GS1 AI encodable character set 82.
|
|
14
|
+
*/
|
|
15
|
+
AI82: "AI82",
|
|
16
|
+
/**
|
|
17
|
+
* GS1 AI encodable character set 39.
|
|
18
|
+
*/
|
|
19
|
+
AI39: "AI39"
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Abstract identifier validator. Implements common functionality for an identifier validator.
|
|
23
|
+
*/
|
|
24
|
+
export class AbstractIdentifierValidator {
|
|
25
|
+
static CHARACTER_SET_CREATORS = {
|
|
26
|
+
[ContentCharacterSets.Numeric]: NUMERIC_CREATOR,
|
|
27
|
+
[ContentCharacterSets.AI82]: AI82_CREATOR,
|
|
28
|
+
[ContentCharacterSets.AI39]: AI39_CREATOR
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Identifier type.
|
|
32
|
+
*/
|
|
33
|
+
_identifierType;
|
|
34
|
+
/**
|
|
35
|
+
* Prefix type.
|
|
36
|
+
*/
|
|
37
|
+
_prefixType;
|
|
38
|
+
/**
|
|
39
|
+
* Length.
|
|
40
|
+
*/
|
|
41
|
+
_length;
|
|
42
|
+
/**
|
|
43
|
+
* Reference character set.
|
|
44
|
+
*/
|
|
45
|
+
_referenceCharacterSet;
|
|
46
|
+
/**
|
|
47
|
+
* Reference creator.
|
|
48
|
+
*/
|
|
49
|
+
_referenceCreator;
|
|
50
|
+
/**
|
|
51
|
+
* Get the character set creator for a character set.
|
|
52
|
+
*
|
|
53
|
+
* @param characterSet
|
|
54
|
+
* Character set.
|
|
55
|
+
*
|
|
56
|
+
* @returns
|
|
57
|
+
* Character set creator.
|
|
58
|
+
*/
|
|
59
|
+
static creatorFor(characterSet) {
|
|
60
|
+
return AbstractIdentifierValidator.CHARACTER_SET_CREATORS[characterSet];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Constructor.
|
|
64
|
+
*
|
|
65
|
+
* @param identifierType
|
|
66
|
+
* Identifier type.
|
|
67
|
+
*
|
|
68
|
+
* @param prefixType
|
|
69
|
+
* Prefix type.
|
|
70
|
+
*
|
|
71
|
+
* @param length
|
|
72
|
+
* Length.
|
|
73
|
+
*
|
|
74
|
+
* @param referenceCharacterSet
|
|
75
|
+
* Reference character set.
|
|
76
|
+
*/
|
|
77
|
+
constructor(identifierType, prefixType, length, referenceCharacterSet) {
|
|
78
|
+
this._identifierType = identifierType;
|
|
79
|
+
this._prefixType = prefixType;
|
|
80
|
+
this._length = length;
|
|
81
|
+
this._referenceCharacterSet = referenceCharacterSet;
|
|
82
|
+
this._referenceCreator = AbstractIdentifierValidator.creatorFor(referenceCharacterSet);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @inheritDoc
|
|
86
|
+
*/
|
|
87
|
+
get identifierType() {
|
|
88
|
+
return this._identifierType;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @inheritDoc
|
|
92
|
+
*/
|
|
93
|
+
get prefixType() {
|
|
94
|
+
return this._prefixType;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* @inheritDoc
|
|
98
|
+
*/
|
|
99
|
+
get length() {
|
|
100
|
+
return this._length;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @inheritDoc
|
|
104
|
+
*/
|
|
105
|
+
get referenceCharacterSet() {
|
|
106
|
+
return this._referenceCharacterSet;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @inheritDoc
|
|
110
|
+
*/
|
|
111
|
+
get referenceCreator() {
|
|
112
|
+
return this._referenceCreator;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Pad an identifier on the left with zero-value character for validation purposes. This is done to align an
|
|
116
|
+
* identifier with a position offset for any error message that may be thrown by the reference validator.
|
|
117
|
+
*
|
|
118
|
+
* @param identifier
|
|
119
|
+
* Identifier.
|
|
120
|
+
*
|
|
121
|
+
* @param validation
|
|
122
|
+
* Identifier validation parameters.
|
|
123
|
+
*
|
|
124
|
+
* @returns
|
|
125
|
+
* Padded identifier.
|
|
126
|
+
*/
|
|
127
|
+
padIdentifier(identifier, validation) {
|
|
128
|
+
// Identifier is returned as is if position offset is undefined.
|
|
129
|
+
return validation?.positionOffset === undefined ? identifier : this.referenceCreator.character(0).repeat(validation.positionOffset).concat(identifier);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Validate the prefix within an identifier.
|
|
133
|
+
*
|
|
134
|
+
* @param partialIdentifier
|
|
135
|
+
* Partial identifier.
|
|
136
|
+
*
|
|
137
|
+
* @param positionOffset
|
|
138
|
+
* Position offset within a larger string.
|
|
139
|
+
*/
|
|
140
|
+
validatePrefix(partialIdentifier, positionOffset) {
|
|
141
|
+
// Delegate to prefix validator with support for U.P.C. Company Prefix but not GS1-8 Prefix.
|
|
142
|
+
PrefixValidator.validate(this.prefixType, true, false, partialIdentifier, true, this.referenceCharacterSet === ContentCharacterSets.Numeric, positionOffset);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=identifier-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier-validator.js","sourceRoot":"","sources":["../src/identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,eAAe,EAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;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;AAkEX;;GAEG;AACH,MAAM,OAAgB,2BAA2B;IACrC,MAAM,CAAU,sBAAsB,GAAqD;QAC/F,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,eAAe;QAC/C,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY;QACzC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,YAAY;KAC5C,CAAC;IAEF;;OAEG;IACc,eAAe,CAAiB;IAEjD;;OAEG;IACc,WAAW,CAAa;IAEzC;;OAEG;IACc,OAAO,CAAS;IAEjC;;OAEG;IACc,sBAAsB,CAAsB;IAE7D;;OAEG;IACc,iBAAiB,CAAsB;IAExD;;;;;;;;OAQG;IACO,MAAM,CAAC,UAAU,CAAC,YAAiC;QACzD,OAAO,2BAA2B,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,YAAsB,cAA8B,EAAE,UAAsB,EAAE,MAAc,EAAE,qBAA0C;QACpI,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAC;QACpD,IAAI,CAAC,iBAAiB,GAAG,2BAA2B,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAC3F,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,qBAAqB;QACrB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,aAAa,CAAC,UAAkB,EAAE,UAA4C;QACpF,gEAAgE;QAChE,OAAO,UAAU,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3J,CAAC;IAED;;;;;;;;OAQG;IACO,cAAc,CAAC,iBAAyB,EAAE,cAAuB;QACvE,4FAA4F;QAC5F,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB,KAAK,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACjK,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,20 @@
|
|
|
17
17
|
export * from "./locale/i18n.js";
|
|
18
18
|
export * from "./character-set.js";
|
|
19
19
|
export * from "./check.js";
|
|
20
|
-
export * from "./
|
|
20
|
+
export * from "./prefix-type.js";
|
|
21
|
+
export * from "./prefix-validator.js";
|
|
22
|
+
export * from "./identifier-type.js";
|
|
23
|
+
export * from "./identifier-validator.js";
|
|
24
|
+
export * from "./numeric-identifier-validator.js";
|
|
25
|
+
export * from "./gtin-validator.js";
|
|
26
|
+
export * from "./non-gtin-numeric-identifier-validator.js";
|
|
27
|
+
export * from "./serializable-numeric-identifier-validator.js";
|
|
28
|
+
export * from "./non-numeric-identifier-validator.js";
|
|
29
|
+
export * from "./identifier-creator.js";
|
|
30
|
+
export * from "./numeric-identifier-creator.js";
|
|
31
|
+
export * from "./gtin-creator.js";
|
|
32
|
+
export * from "./non-gtin-numeric-identifier-creator.js";
|
|
33
|
+
export * from "./serializable-numeric-identifier-creator.js";
|
|
34
|
+
export * from "./non-numeric-identifier-creator.js";
|
|
35
|
+
export * from "./prefix-manager.js";
|
|
21
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,5 +17,20 @@
|
|
|
17
17
|
export * from "./locale/i18n.js";
|
|
18
18
|
export * from "./character-set.js";
|
|
19
19
|
export * from "./check.js";
|
|
20
|
-
export * from "./
|
|
20
|
+
export * from "./prefix-type.js";
|
|
21
|
+
export * from "./prefix-validator.js";
|
|
22
|
+
export * from "./identifier-type.js";
|
|
23
|
+
export * from "./identifier-validator.js";
|
|
24
|
+
export * from "./numeric-identifier-validator.js";
|
|
25
|
+
export * from "./gtin-validator.js";
|
|
26
|
+
export * from "./non-gtin-numeric-identifier-validator.js";
|
|
27
|
+
export * from "./serializable-numeric-identifier-validator.js";
|
|
28
|
+
export * from "./non-numeric-identifier-validator.js";
|
|
29
|
+
export * from "./identifier-creator.js";
|
|
30
|
+
export * from "./numeric-identifier-creator.js";
|
|
31
|
+
export * from "./gtin-creator.js";
|
|
32
|
+
export * from "./non-gtin-numeric-identifier-creator.js";
|
|
33
|
+
export * from "./serializable-numeric-identifier-creator.js";
|
|
34
|
+
export * from "./non-numeric-identifier-creator.js";
|
|
35
|
+
export * from "./prefix-manager.js";
|
|
21
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC"}
|
|
@@ -4,8 +4,8 @@ export declare const localeStrings: {
|
|
|
4
4
|
readonly priceOrWeightComponent: "price or weight";
|
|
5
5
|
readonly lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "Length {{length, number}} of string for check character pair must be less than or equal to {{maximumLength, number}}";
|
|
6
6
|
};
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
7
|
+
readonly Identifier: {
|
|
8
|
+
readonly identifierTypeLength: "{{identifierType}} must be {{length, number}} digits long";
|
|
9
9
|
readonly invalidCheckDigit: "Invalid check digit";
|
|
10
10
|
readonly invalidGTINLength: "GTIN must be 13, 12, 8, or 14 digits long";
|
|
11
11
|
readonly invalidGTIN14Length: "GTIN must be 14 digits long";
|
|
@@ -36,7 +36,7 @@ export declare const localeStrings: {
|
|
|
36
36
|
readonly gs1CompanyPrefixCantStartWith000000: "GS1 Company Prefix can't start with \"000000\"";
|
|
37
37
|
readonly upcCompanyPrefixCantStartWith0000: "U.P.C. Company Prefix can't start with \"0000\"";
|
|
38
38
|
readonly gs18PrefixCantStartWith0: "GS1-8 Prefix can't start with \"0\"";
|
|
39
|
-
readonly
|
|
39
|
+
readonly identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} not supported by GS1-8 Prefix";
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=locale-strings.d.ts.map
|
|
@@ -4,8 +4,8 @@ export const localeStrings = {
|
|
|
4
4
|
priceOrWeightComponent: "price or weight",
|
|
5
5
|
lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "Length {{length, number}} of string for check character pair must be less than or equal to {{maximumLength, number}}"
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Identifier: {
|
|
8
|
+
identifierTypeLength: "{{identifierType}} must be {{length, number}} digits long",
|
|
9
9
|
invalidCheckDigit: "Invalid check digit",
|
|
10
10
|
invalidGTINLength: "GTIN must be 13, 12, 8, or 14 digits long",
|
|
11
11
|
invalidGTIN14Length: "GTIN must be 14 digits long",
|
|
@@ -36,7 +36,7 @@ export const localeStrings = {
|
|
|
36
36
|
gs1CompanyPrefixCantStartWith000000: "GS1 Company Prefix can't start with \"000000\"",
|
|
37
37
|
upcCompanyPrefixCantStartWith0000: "U.P.C. Company Prefix can't start with \"0000\"",
|
|
38
38
|
gs18PrefixCantStartWith0: "GS1-8 Prefix can't start with \"0\"",
|
|
39
|
-
|
|
39
|
+
identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} not supported by GS1-8 Prefix"
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=locale-strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-strings.js","sourceRoot":"","sources":["../../../src/locale/en/locale-strings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,KAAK,EAAE;QACH,2CAA2C,EAAE,wEAAwE;QACrH,sBAAsB,EAAE,iBAAiB;QACzC,0DAA0D,EAAE,sHAAsH;KACrL;IACD,
|
|
1
|
+
{"version":3,"file":"locale-strings.js","sourceRoot":"","sources":["../../../src/locale/en/locale-strings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,KAAK,EAAE;QACH,2CAA2C,EAAE,wEAAwE;QACrH,sBAAsB,EAAE,iBAAiB;QACzC,0DAA0D,EAAE,sHAAsH;KACrL;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,2DAA2D;QACjF,iBAAiB,EAAE,qBAAqB;QACxC,iBAAiB,EAAE,2CAA2C;QAC9D,mBAAmB,EAAE,6BAA6B;QAClD,2BAA2B,EAAE,iCAAiC;QAC9D,6BAA6B,EAAE,+BAA+B;QAC9D,mCAAmC,EAAE,4CAA4C;QACjF,mCAAmC,EAAE,4CAA4C;QACjF,qBAAqB,EAAE,mEAAmE;QAC1F,mBAAmB,EAAE,wDAAwD;QAC7E,4BAA4B,EAAE,mEAAmE;QACjG,gBAAgB,EAAE,qCAAqC;QACvD,+BAA+B,EAAE,qCAAqC;QACtE,+BAA+B,EAAE,qCAAqC;QACtE,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,iBAAiB;QACjC,eAAe,EAAE,kBAAkB;QACnC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,gCAAgC;QAC3D,yBAAyB,EAAE,8BAA8B;KAC5D;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,oBAAoB;QACtC,gBAAgB,EAAE,uBAAuB;QACzC,UAAU,EAAE,cAAc;QAC1B,iBAAiB,EAAE,qBAAqB;QACxC,8BAA8B,EAAE,2CAA2C;QAC3E,kCAAkC,EAAE,+CAA+C;QACnF,mCAAmC,EAAE,gDAAgD;QACrF,iCAAiC,EAAE,iDAAiD;QACpF,wBAAwB,EAAE,qCAAqC;QAC/D,sCAAsC,EAAE,kDAAkD;KAC7F;CACK,CAAC"}
|
|
@@ -4,8 +4,8 @@ export declare const localeStrings: {
|
|
|
4
4
|
readonly priceOrWeightComponent: "prix ou poids";
|
|
5
5
|
readonly lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "La longueur {{length, number}} de la chaîne pour la paire de caractères de vérification doit être inférieure ou égale à {{maximum Length}}";
|
|
6
6
|
};
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
7
|
+
readonly Identifier: {
|
|
8
|
+
readonly identifierTypeLength: "{{identifierType}} doit comporter {{length, number}} chiffres";
|
|
9
9
|
readonly invalidCheckDigit: "Chiffre de contrôle non valide";
|
|
10
10
|
readonly invalidGTINLength: "Le GTIN doit comporter 13, 12, 8 ou 14 chiffres";
|
|
11
11
|
readonly invalidGTIN14Length: "Le GTIN doit comporter 14 chiffres";
|
|
@@ -36,7 +36,7 @@ export declare const localeStrings: {
|
|
|
36
36
|
readonly gs1CompanyPrefixCantStartWith000000: "Le préfixe de l'entreprise GS1 ne peut pas commencer par \"000000\"";
|
|
37
37
|
readonly upcCompanyPrefixCantStartWith0000: "Le préfixe de l'entreprise U.P.C. ne peut pas commencer par \"0000\"";
|
|
38
38
|
readonly gs18PrefixCantStartWith0: "Le préfixe GS1-8 ne peut pas commencer par \"0\"";
|
|
39
|
-
readonly
|
|
39
|
+
readonly identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} non pris en charge par le préfixe GS1-8";
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=locale-strings.d.ts.map
|
|
@@ -4,8 +4,8 @@ export const localeStrings = {
|
|
|
4
4
|
priceOrWeightComponent: "prix ou poids",
|
|
5
5
|
lengthOfStringForCheckCharacterPairMustBeLessThanOrEqualTo: "La longueur {{length, number}} de la chaîne pour la paire de caractères de vérification doit être inférieure ou égale à {{maximum Length}}"
|
|
6
6
|
},
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Identifier: {
|
|
8
|
+
identifierTypeLength: "{{identifierType}} doit comporter {{length, number}} chiffres",
|
|
9
9
|
invalidCheckDigit: "Chiffre de contrôle non valide",
|
|
10
10
|
invalidGTINLength: "Le GTIN doit comporter 13, 12, 8 ou 14 chiffres",
|
|
11
11
|
invalidGTIN14Length: "Le GTIN doit comporter 14 chiffres",
|
|
@@ -36,7 +36,7 @@ export const localeStrings = {
|
|
|
36
36
|
gs1CompanyPrefixCantStartWith000000: "Le préfixe de l'entreprise GS1 ne peut pas commencer par \"000000\"",
|
|
37
37
|
upcCompanyPrefixCantStartWith0000: "Le préfixe de l'entreprise U.P.C. ne peut pas commencer par \"0000\"",
|
|
38
38
|
gs18PrefixCantStartWith0: "Le préfixe GS1-8 ne peut pas commencer par \"0\"",
|
|
39
|
-
|
|
39
|
+
identifierTypeNotSupportedByGS18Prefix: "{{identifierType}} non pris en charge par le préfixe GS1-8"
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=locale-strings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-strings.js","sourceRoot":"","sources":["../../../src/locale/fr/locale-strings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,KAAK,EAAE;QACH,2CAA2C,EAAE,uFAAuF;QACpI,sBAAsB,EAAE,eAAe;QACvC,0DAA0D,EAAE,4IAA4I;KAC3M;IACD,
|
|
1
|
+
{"version":3,"file":"locale-strings.js","sourceRoot":"","sources":["../../../src/locale/fr/locale-strings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,KAAK,EAAE;QACH,2CAA2C,EAAE,uFAAuF;QACpI,sBAAsB,EAAE,eAAe;QACvC,0DAA0D,EAAE,4IAA4I;KAC3M;IACD,UAAU,EAAE;QACR,oBAAoB,EAAE,+DAA+D;QACrF,iBAAiB,EAAE,gCAAgC;QACnD,iBAAiB,EAAE,iDAAiD;QACpE,mBAAmB,EAAE,oCAAoC;QACzD,2BAA2B,EAAE,4CAA4C;QACzE,6BAA6B,EAAE,+CAA+C;QAC9E,mCAAmC,EAAE,2DAA2D;QAChG,mCAAmC,EAAE,2DAA2D;QAChG,qBAAqB,EAAE,4FAA4F;QACnH,mBAAmB,EAAE,mFAAmF;QACxG,4BAA4B,EAAE,qGAAqG;QACnI,gBAAgB,EAAE,8DAA8D;QAChF,+BAA+B,EAAE,0CAA0C;QAC3E,+BAA+B,EAAE,2CAA2C;QAC5E,mCAAmC,EAAE,0CAA0C;QAC/E,cAAc,EAAE,oBAAoB;QACpC,eAAe,EAAE,iBAAiB;QAClC,SAAS,EAAE,WAAW;QACtB,yBAAyB,EAAE,qDAAqD;QAChF,yBAAyB,EAAE,4CAA4C;KAC1E;IACD,MAAM,EAAE;QACJ,gBAAgB,EAAE,6BAA6B;QAC/C,gBAAgB,EAAE,gCAAgC;QAClD,UAAU,EAAE,eAAe;QAC3B,iBAAiB,EAAE,0BAA0B;QAC7C,8BAA8B,EAAE,gEAAgE;QAChG,kCAAkC,EAAE,oEAAoE;QACxG,mCAAmC,EAAE,qEAAqE;QAC1G,iCAAiC,EAAE,sEAAsE;QACzG,wBAAwB,EAAE,kDAAkD;QAC5E,sCAAsC,EAAE,4DAA4D;KACvG;CACK,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IdentifierType } from "./identifier-type.js";
|
|
2
|
+
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
3
|
+
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator.js";
|
|
4
|
+
import { type LeaderType } from "./numeric-identifier-validator.js";
|
|
5
|
+
import type { PrefixProvider } from "./prefix-provider";
|
|
6
|
+
declare const NonGTINNumericIdentifierCreator_base: import("ts-mixer/dist/types/types.js").Class<any[], NonGTINNumericIdentifierValidator & AbstractNumericIdentifierCreator, typeof NonGTINNumericIdentifierValidator & typeof AbstractNumericIdentifierCreator>;
|
|
7
|
+
/**
|
|
8
|
+
* Non-GTIN numeric identifier creator.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NonGTINNumericIdentifierCreator extends NonGTINNumericIdentifierCreator_base {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix
|
|
13
|
+
* provider type.
|
|
14
|
+
*
|
|
15
|
+
* @param prefixProvider
|
|
16
|
+
* Prefix provider.
|
|
17
|
+
*
|
|
18
|
+
* @param identifierType
|
|
19
|
+
* Identifier type.
|
|
20
|
+
*
|
|
21
|
+
* @param length
|
|
22
|
+
* Length.
|
|
23
|
+
*
|
|
24
|
+
* @param leaderType
|
|
25
|
+
* Leader type.
|
|
26
|
+
*/
|
|
27
|
+
constructor(prefixProvider: PrefixProvider, identifierType: IdentifierType, length: number, leaderType?: LeaderType);
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=non-gtin-numeric-identifier-creator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-gtin-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-gtin-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;;AAExD;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,oCAA0E;IAC3H;;;;;;;;;;;;;;;OAeG;gBACS,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAE,UAA6B;CAKxI"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Mixin } from "ts-mixer";
|
|
2
|
+
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
3
|
+
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator.js";
|
|
4
|
+
import { LeaderTypes } from "./numeric-identifier-validator.js";
|
|
5
|
+
/**
|
|
6
|
+
* Non-GTIN numeric identifier creator.
|
|
7
|
+
*/
|
|
8
|
+
export class NonGTINNumericIdentifierCreator extends Mixin(NonGTINNumericIdentifierValidator, AbstractNumericIdentifierCreator) {
|
|
9
|
+
/**
|
|
10
|
+
* Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix
|
|
11
|
+
* provider type.
|
|
12
|
+
*
|
|
13
|
+
* @param prefixProvider
|
|
14
|
+
* Prefix provider.
|
|
15
|
+
*
|
|
16
|
+
* @param identifierType
|
|
17
|
+
* Identifier type.
|
|
18
|
+
*
|
|
19
|
+
* @param length
|
|
20
|
+
* Length.
|
|
21
|
+
*
|
|
22
|
+
* @param leaderType
|
|
23
|
+
* Leader type.
|
|
24
|
+
*/
|
|
25
|
+
constructor(prefixProvider, identifierType, length, leaderType = LeaderTypes.None) {
|
|
26
|
+
super(identifierType, length, leaderType);
|
|
27
|
+
this.init(prefixProvider, prefixProvider.gs1CompanyPrefix);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=non-gtin-numeric-identifier-creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-gtin-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-gtin-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAmB,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGjF;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,KAAK,CAAC,iCAAiC,EAAE,gCAAgC,CAAC;IAC3H;;;;;;;;;;;;;;;OAeG;IACH,YAAY,cAA8B,EAAE,cAA8B,EAAE,MAAc,EAAE,aAAyB,WAAW,CAAC,IAAI;QACjI,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAE1C,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC/D,CAAC;CACJ"}
|