@aidc-toolkit/gs1 1.0.43 → 1.0.44-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 +41 -0
- package/dist/abstract-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-identifier-creator.js +73 -0
- package/dist/abstract-identifier-creator.js.map +1 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts +36 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js +37 -0
- package/dist/abstract-non-gtin-numeric-identifier-creator.js.map +1 -0
- package/dist/abstract-numeric-identifier-creator.d.ts +34 -0
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/abstract-numeric-identifier-creator.js +154 -0
- package/dist/abstract-numeric-identifier-creator.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 +83 -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-creators.d.ts +4 -0
- package/dist/content-character-set-creators.d.ts.map +1 -0
- package/dist/content-character-set-creators.js +9 -0
- package/dist/content-character-set-creators.js.map +1 -0
- package/dist/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/gcp-length-cache.d.ts +89 -0
- package/dist/gcp-length-cache.d.ts.map +1 -0
- package/dist/gcp-length-cache.js +240 -0
- package/dist/gcp-length-cache.js.map +1 -0
- package/dist/gcp-length-data.d.ts +108 -0
- package/dist/gcp-length-data.d.ts.map +1 -0
- package/dist/gcp-length-data.js +53 -0
- package/dist/gcp-length-data.js.map +1 -0
- package/dist/gcp-length.d.ts +97 -0
- package/dist/gcp-length.d.ts.map +1 -0
- package/dist/gcp-length.js +368 -0
- package/dist/gcp-length.js.map +1 -0
- package/dist/gtin-creator.d.ts +47 -0
- package/dist/gtin-creator.d.ts.map +1 -0
- package/dist/gtin-creator.js +64 -0
- package/dist/gtin-creator.js.map +1 -0
- package/dist/gtin-descriptor.d.ts +22 -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-length.d.ts +64 -0
- package/dist/gtin-length.d.ts.map +1 -0
- package/dist/gtin-length.js +36 -0
- package/dist/gtin-length.js.map +1 -0
- package/dist/gtin-type.d.ts +26 -0
- package/dist/gtin-type.d.ts.map +1 -0
- package/dist/gtin-type.js +7 -0
- package/dist/gtin-type.js.map +1 -0
- package/dist/gtin-validator.d.ts +132 -0
- package/dist/gtin-validator.d.ts.map +1 -0
- package/dist/gtin-validator.js +349 -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-creators.d.ts +118 -0
- package/dist/identifier-creators.d.ts.map +1 -0
- package/dist/identifier-creators.js +92 -0
- package/dist/identifier-creators.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-descriptors.d.ts +106 -0
- package/dist/identifier-descriptors.d.ts.map +1 -0
- package/dist/identifier-descriptors.js +262 -0
- package/dist/identifier-descriptors.js.map +1 -0
- package/dist/identifier-extension.d.ts +82 -0
- package/dist/identifier-extension.d.ts.map +1 -0
- package/dist/identifier-extension.js +79 -0
- package/dist/identifier-extension.js.map +1 -0
- package/dist/identifier-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 +85 -0
- package/dist/identifier-validator.d.ts.map +1 -0
- package/dist/identifier-validator.js +107 -0
- package/dist/identifier-validator.js.map +1 -0
- package/dist/identifier-validators.d.ts +131 -0
- package/dist/identifier-validators.d.ts.map +1 -0
- package/dist/identifier-validators.js +167 -0
- package/dist/identifier-validators.js.map +1 -0
- package/dist/index.d.ts +63 -2205
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -3
- package/dist/index.js.map +1 -0
- package/dist/leader-type.d.ts +26 -0
- package/dist/leader-type.d.ts.map +1 -0
- package/dist/leader-type.js +18 -0
- package/dist/leader-type.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +48 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +47 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +48 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +47 -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 +35 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts +12 -0
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-creator.js +2 -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 +26 -0
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-type.js +8 -0
- package/dist/non-gtin-numeric-identifier-type.js.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts +12 -0
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-gtin-numeric-identifier-validator.js +10 -0
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -0
- package/dist/non-numeric-identifier-creator.d.ts +40 -0
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-numeric-identifier-creator.js +82 -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 +26 -0
- package/dist/non-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-numeric-identifier-type.js +8 -0
- package/dist/non-numeric-identifier-type.js.map +1 -0
- package/dist/non-numeric-identifier-validator.d.ts +41 -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/non-serializable-numeric-identifier-creator.d.ts +10 -0
- package/dist/non-serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-creator.js +8 -0
- package/dist/non-serializable-numeric-identifier-creator.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts +12 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js +2 -0
- package/dist/non-serializable-numeric-identifier-descriptor.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts +26 -0
- package/dist/non-serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-type.js +7 -0
- package/dist/non-serializable-numeric-identifier-type.js.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts +16 -0
- package/dist/non-serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/non-serializable-numeric-identifier-validator.js +17 -0
- package/dist/non-serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/numeric-identifier-creator.d.ts +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 +22 -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 +26 -0
- package/dist/numeric-identifier-type.d.ts.map +1 -0
- package/dist/numeric-identifier-type.js +7 -0
- package/dist/numeric-identifier-type.js.map +1 -0
- package/dist/numeric-identifier-validator.d.ts +38 -0
- package/dist/numeric-identifier-validator.d.ts.map +1 -0
- package/dist/numeric-identifier-validator.js +61 -0
- package/dist/numeric-identifier-validator.js.map +1 -0
- package/dist/prefix-manager.d.ts +151 -0
- package/dist/prefix-manager.d.ts.map +1 -0
- package/dist/prefix-manager.js +297 -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 +71 -0
- package/dist/prefix-validator.d.ts.map +1 -0
- package/dist/prefix-validator.js +204 -0
- package/dist/prefix-validator.js.map +1 -0
- package/dist/serializable-numeric-identifier-creator.d.ts +48 -0
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-creator.js +93 -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 +26 -0
- package/dist/serializable-numeric-identifier-type.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-type.js +8 -0
- package/dist/serializable-numeric-identifier-type.js.map +1 -0
- package/dist/serializable-numeric-identifier-validator.d.ts +67 -0
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -0
- package/dist/serializable-numeric-identifier-validator.js +97 -0
- package/dist/serializable-numeric-identifier-validator.js.map +1 -0
- package/dist/variable-measure.d.ts +68 -0
- package/dist/variable-measure.d.ts.map +1 -0
- package/dist/variable-measure.js +210 -0
- package/dist/variable-measure.js.map +1 -0
- package/dist/verified-by-gs1.d.ts +22 -0
- package/dist/verified-by-gs1.d.ts.map +1 -0
- package/dist/verified-by-gs1.js +46 -0
- package/dist/verified-by-gs1.js.map +1 -0
- package/package.json +4 -4
- package/src/gcp-length-cache.ts +7 -2
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/index.cjs +0 -19
- package/dist/index.d.cts +0 -2205
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
+
import { checkDigit, hasValidCheckDigit, isValidPriceOrWeightCheckDigit, priceOrWeightCheckDigit } from "./check.js";
|
|
3
|
+
import { i18nextGS1 } from "./locale/i18n.js";
|
|
4
|
+
/**
|
|
5
|
+
* Variable measure trade item support functions.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- Wrapper for future functionality.
|
|
8
|
+
export class VariableMeasure {
|
|
9
|
+
/**
|
|
10
|
+
* Parse a Restricted Circulation Number (RCN) using a variable measure trade item format. The format is a 12- or
|
|
11
|
+
* 13-character string (for RCN-12 or RCN-13 respectively), containing the following:
|
|
12
|
+
*
|
|
13
|
+
* - '2' - The first character of the RCN.
|
|
14
|
+
* - '0'-'9' - The second character of the RCN (RCN-13 only).
|
|
15
|
+
* - 'I' - One or more, in sequence, for the item reference.
|
|
16
|
+
* - 'P' - One or more, in sequence, for the price or weight.
|
|
17
|
+
* - 'V' - Zero or one, for the price or weight check digit.
|
|
18
|
+
* - 'C' - The check digit of the entire RCN.
|
|
19
|
+
*
|
|
20
|
+
* The 'I', 'P', and 'V' formats may be in any order.
|
|
21
|
+
*
|
|
22
|
+
* Some examples:
|
|
23
|
+
*
|
|
24
|
+
* - `2IIIIIVPPPPC` - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price
|
|
25
|
+
* or weight.
|
|
26
|
+
* - `23IIIIVPPPPPC` - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price
|
|
27
|
+
* or weight.
|
|
28
|
+
* - `2IIIIIIPPPPC` - RCN-12 with a six-digit item reference and a four-digit price or eight.
|
|
29
|
+
* - `29IIIIIPPPPPC` - RCN-13 with a five-digit item reference and a five-digit price or weight.
|
|
30
|
+
*
|
|
31
|
+
* @param format
|
|
32
|
+
* Format.
|
|
33
|
+
*
|
|
34
|
+
* @param rcn
|
|
35
|
+
* RCN.
|
|
36
|
+
*
|
|
37
|
+
* @returns
|
|
38
|
+
* RCN reference.
|
|
39
|
+
*/
|
|
40
|
+
static parseRCN(format, rcn) {
|
|
41
|
+
const formatLength = format.length;
|
|
42
|
+
if (rcn.length !== formatLength) {
|
|
43
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidRCNLength"));
|
|
44
|
+
}
|
|
45
|
+
let validFormat = formatLength === 12 || formatLength === 13;
|
|
46
|
+
let validRCNPrefix = true;
|
|
47
|
+
let buildingItemReference = false;
|
|
48
|
+
let itemReference = "";
|
|
49
|
+
let buildingPriceOrWeight = false;
|
|
50
|
+
let priceOrWeight = "";
|
|
51
|
+
let priceOrWeightCheckDigit = "";
|
|
52
|
+
for (let index = 0; validFormat && index < formatLength; index++) {
|
|
53
|
+
const formatChar = format.charAt(index);
|
|
54
|
+
const rcnChar = rcn.charAt(index);
|
|
55
|
+
if (index === 0) {
|
|
56
|
+
validFormat = formatChar === "2";
|
|
57
|
+
validRCNPrefix = rcnChar === "2";
|
|
58
|
+
}
|
|
59
|
+
else if (formatLength === 13 && index === 1) {
|
|
60
|
+
validFormat = NUMERIC_CREATOR.characterIndex(formatChar) !== undefined;
|
|
61
|
+
validRCNPrefix = rcnChar === formatChar;
|
|
62
|
+
}
|
|
63
|
+
else if (index === formatLength - 1) {
|
|
64
|
+
validFormat = formatChar === "C";
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
switch (formatChar) {
|
|
68
|
+
case "I":
|
|
69
|
+
if (!buildingItemReference) {
|
|
70
|
+
// Item reference can't appear more than once.
|
|
71
|
+
validFormat = itemReference === "";
|
|
72
|
+
buildingItemReference = true;
|
|
73
|
+
buildingPriceOrWeight = false;
|
|
74
|
+
}
|
|
75
|
+
itemReference += rcnChar;
|
|
76
|
+
break;
|
|
77
|
+
case "P":
|
|
78
|
+
if (!buildingPriceOrWeight) {
|
|
79
|
+
// Price or weight can't appear more than once.
|
|
80
|
+
validFormat = priceOrWeight === "";
|
|
81
|
+
buildingPriceOrWeight = true;
|
|
82
|
+
buildingItemReference = false;
|
|
83
|
+
}
|
|
84
|
+
priceOrWeight += rcnChar;
|
|
85
|
+
break;
|
|
86
|
+
case "V":
|
|
87
|
+
// Price or weight check digit can't appear more than once.
|
|
88
|
+
validFormat = priceOrWeightCheckDigit === "";
|
|
89
|
+
buildingItemReference = false;
|
|
90
|
+
buildingPriceOrWeight = false;
|
|
91
|
+
priceOrWeightCheckDigit = rcnChar;
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
validFormat = false;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
validFormat &&= itemReference !== "" && priceOrWeight !== "";
|
|
100
|
+
if (!validFormat) {
|
|
101
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidVariableMeasureRCNFormat"));
|
|
102
|
+
}
|
|
103
|
+
if (!validRCNPrefix) {
|
|
104
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidVariableMeasureRCNPrefix"));
|
|
105
|
+
}
|
|
106
|
+
if (priceOrWeightCheckDigit !== "" && !isValidPriceOrWeightCheckDigit(priceOrWeight, priceOrWeightCheckDigit)) {
|
|
107
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidVariableMeasurePriceOrWeight"));
|
|
108
|
+
}
|
|
109
|
+
if (!hasValidCheckDigit(rcn)) {
|
|
110
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidCheckDigit"));
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
itemReference: Number(itemReference),
|
|
114
|
+
priceOrWeight: Number(priceOrWeight)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a Restricted Circulation Number (RCN) using a variable measure trade item format. See {@linkcode parseRCN}
|
|
119
|
+
* for format details.
|
|
120
|
+
*
|
|
121
|
+
* @param format
|
|
122
|
+
* Format.
|
|
123
|
+
*
|
|
124
|
+
* @param itemReference
|
|
125
|
+
* Item reference.
|
|
126
|
+
*
|
|
127
|
+
* @param priceOrWeight
|
|
128
|
+
* Price or weight (whole number only).
|
|
129
|
+
*
|
|
130
|
+
* @returns
|
|
131
|
+
* RCN-12 or RCN-13.
|
|
132
|
+
*/
|
|
133
|
+
static createRCN(format, itemReference, priceOrWeight) {
|
|
134
|
+
const formatLength = format.length;
|
|
135
|
+
let validFormat = formatLength === 12 || formatLength === 13;
|
|
136
|
+
let rcnPrefix = "";
|
|
137
|
+
let buildingItemReference = false;
|
|
138
|
+
let itemReferenceString = "";
|
|
139
|
+
let itemReferenceLength = 0;
|
|
140
|
+
let buildingPriceOrWeight = false;
|
|
141
|
+
let priceOrWeightString = "";
|
|
142
|
+
let priceOrWeightLength = 0;
|
|
143
|
+
let calculatePriceOrWeightCheckDigit = false;
|
|
144
|
+
// RCN may be built in almost any order, so defer to builders that will be in ordered array.
|
|
145
|
+
const rcnPrefixBuilder = (partialRCN) => partialRCN + rcnPrefix;
|
|
146
|
+
const itemReferenceBuilder = (partialRCN) => partialRCN + itemReferenceString;
|
|
147
|
+
const priceOrWeightBuilder = (partialRCN) => partialRCN + priceOrWeightString;
|
|
148
|
+
const priceOrWeightCheckDigitBuilder = (partialRCN) => partialRCN + priceOrWeightCheckDigit(priceOrWeightString);
|
|
149
|
+
const checkDigitBuilder = (partialRCN) => partialRCN + checkDigit(partialRCN);
|
|
150
|
+
const rcnBuilders = [rcnPrefixBuilder];
|
|
151
|
+
for (let index = 0; validFormat && index < formatLength; index++) {
|
|
152
|
+
const formatChar = format.charAt(index);
|
|
153
|
+
if (index === 0) {
|
|
154
|
+
validFormat = formatChar === "2";
|
|
155
|
+
rcnPrefix = formatChar;
|
|
156
|
+
}
|
|
157
|
+
else if (formatLength === 13 && index === 1) {
|
|
158
|
+
validFormat = NUMERIC_CREATOR.characterIndex(formatChar) !== undefined;
|
|
159
|
+
rcnPrefix += formatChar;
|
|
160
|
+
}
|
|
161
|
+
else if (index === formatLength - 1) {
|
|
162
|
+
validFormat = formatChar === "C";
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
switch (formatChar) {
|
|
166
|
+
case "I":
|
|
167
|
+
if (!buildingItemReference) {
|
|
168
|
+
// Item reference can't appear more than once.
|
|
169
|
+
validFormat = itemReferenceLength === 0;
|
|
170
|
+
buildingItemReference = true;
|
|
171
|
+
buildingPriceOrWeight = false;
|
|
172
|
+
rcnBuilders.push(itemReferenceBuilder);
|
|
173
|
+
}
|
|
174
|
+
itemReferenceLength++;
|
|
175
|
+
break;
|
|
176
|
+
case "P":
|
|
177
|
+
if (!buildingPriceOrWeight) {
|
|
178
|
+
// Price or weight can't appear more than once.
|
|
179
|
+
validFormat = priceOrWeightLength === 0;
|
|
180
|
+
buildingPriceOrWeight = true;
|
|
181
|
+
buildingItemReference = false;
|
|
182
|
+
rcnBuilders.push(priceOrWeightBuilder);
|
|
183
|
+
}
|
|
184
|
+
priceOrWeightLength++;
|
|
185
|
+
break;
|
|
186
|
+
case "V":
|
|
187
|
+
// Price or weight check digit can't appear more than once.
|
|
188
|
+
validFormat = !calculatePriceOrWeightCheckDigit;
|
|
189
|
+
buildingItemReference = false;
|
|
190
|
+
buildingPriceOrWeight = false;
|
|
191
|
+
calculatePriceOrWeightCheckDigit = true;
|
|
192
|
+
rcnBuilders.push(priceOrWeightCheckDigitBuilder);
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
validFormat = false;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
validFormat &&= itemReferenceLength !== 0 && priceOrWeightLength !== 0;
|
|
201
|
+
if (!validFormat) {
|
|
202
|
+
throw new RangeError(i18nextGS1.t("Identifier.invalidVariableMeasureRCNFormat"));
|
|
203
|
+
}
|
|
204
|
+
itemReferenceString = NUMERIC_CREATOR.create(itemReferenceLength, itemReference);
|
|
205
|
+
priceOrWeightString = NUMERIC_CREATOR.create(priceOrWeightLength, priceOrWeight);
|
|
206
|
+
rcnBuilders.push(checkDigitBuilder);
|
|
207
|
+
return rcnBuilders.reduce((partialRCN, rcnBuilder) => rcnBuilder(partialRCN), "");
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=variable-measure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-measure.js","sourceRoot":"","sources":["../src/variable-measure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE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
1
|
+
import type { Hyperlink } from "@aidc-toolkit/core";
|
|
2
|
+
import { type IdentifierType } from "./identifier-type.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a Verified by GS1 hyperlink.
|
|
5
|
+
*
|
|
6
|
+
* @param identifierType
|
|
7
|
+
* Identifier type.
|
|
8
|
+
*
|
|
9
|
+
* @param identifier
|
|
10
|
+
* Identifier.
|
|
11
|
+
*
|
|
12
|
+
* @param text
|
|
13
|
+
* Text for hyperlink. If not provided, the identifier is used.
|
|
14
|
+
*
|
|
15
|
+
* @param details
|
|
16
|
+
* Details to display when hovering over hyperlink.
|
|
17
|
+
*
|
|
18
|
+
* @returns
|
|
19
|
+
* Verified by GS1 hyperlink.
|
|
20
|
+
*/
|
|
21
|
+
export declare function verifiedByGS1(identifierType: IdentifierType, identifier: string, text?: string | undefined, details?: string): Hyperlink;
|
|
22
|
+
//# sourceMappingURL=verified-by-gs1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verified-by-gs1.d.ts","sourceRoot":"","sources":["../src/verified-by-gs1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAK5E;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,aAAa,CAAC,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,GAAG,SAAqB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CA2BnJ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GTINValidator } from "./gtin-validator.js";
|
|
2
|
+
import { IdentifierTypes } from "./identifier-type.js";
|
|
3
|
+
import { IdentifierValidators } from "./identifier-validators.js";
|
|
4
|
+
const VERIFIED_BY_GS1_REFERENCE_BASE = "https://www.gs1.org/services/verified-by-gs1/results?";
|
|
5
|
+
/**
|
|
6
|
+
* Create a Verified by GS1 hyperlink.
|
|
7
|
+
*
|
|
8
|
+
* @param identifierType
|
|
9
|
+
* Identifier type.
|
|
10
|
+
*
|
|
11
|
+
* @param identifier
|
|
12
|
+
* Identifier.
|
|
13
|
+
*
|
|
14
|
+
* @param text
|
|
15
|
+
* Text for hyperlink. If not provided, the identifier is used.
|
|
16
|
+
*
|
|
17
|
+
* @param details
|
|
18
|
+
* Details to display when hovering over hyperlink.
|
|
19
|
+
*
|
|
20
|
+
* @returns
|
|
21
|
+
* Verified by GS1 hyperlink.
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-useless-default-assignment -- Undefined is necessary to allow bypass of text.
|
|
24
|
+
export function verifiedByGS1(identifierType, identifier, text = undefined, details) {
|
|
25
|
+
let normalizedIdentifier;
|
|
26
|
+
let useKeyTypeParameter;
|
|
27
|
+
if (identifierType === IdentifierTypes.GTIN) {
|
|
28
|
+
// Normalization will validate resulting GTIN.
|
|
29
|
+
normalizedIdentifier = GTINValidator.normalize(identifier);
|
|
30
|
+
useKeyTypeParameter = true;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const identifierValidator = IdentifierValidators[identifierType];
|
|
34
|
+
identifierValidator.validate(identifier);
|
|
35
|
+
normalizedIdentifier = identifier;
|
|
36
|
+
useKeyTypeParameter = identifierType === IdentifierTypes.GLN;
|
|
37
|
+
}
|
|
38
|
+
const lowerCaseIdentifierType = identifierType.toLowerCase();
|
|
39
|
+
const reference = useKeyTypeParameter ? `${VERIFIED_BY_GS1_REFERENCE_BASE}${lowerCaseIdentifierType}=${normalizedIdentifier}` : `${VERIFIED_BY_GS1_REFERENCE_BASE}key=${normalizedIdentifier}&key_type=${lowerCaseIdentifierType}`;
|
|
40
|
+
return {
|
|
41
|
+
reference,
|
|
42
|
+
text: text ?? identifier,
|
|
43
|
+
details
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=verified-by-gs1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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/gs1",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44-beta",
|
|
4
4
|
"description": "GS1 AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"test": "tsc --project tsconfig-test.json --noEmit && vitest run"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aidc-toolkit/dev": "
|
|
32
|
+
"@aidc-toolkit/dev": "1.0.41-beta",
|
|
33
33
|
"vitest": "^4.0.18"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aidc-toolkit/core": "
|
|
37
|
-
"@aidc-toolkit/utility": "
|
|
36
|
+
"@aidc-toolkit/core": "1.0.42-beta",
|
|
37
|
+
"@aidc-toolkit/utility": "1.0.43-beta"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/gcp-length-cache.ts
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
type AppData,
|
|
3
3
|
type AppDataStorage,
|
|
4
4
|
Cache,
|
|
5
|
+
defaultHTTPFetch,
|
|
6
|
+
type HTTPFetch,
|
|
5
7
|
omit,
|
|
6
8
|
RemoteAppDataStorage,
|
|
7
9
|
WEBSITE_BASE_URL
|
|
@@ -197,11 +199,14 @@ export class RemoteGCPLengthCache extends GCPLengthCache {
|
|
|
197
199
|
* @param baseURL
|
|
198
200
|
* Base URL. The URL must not end with a slash and must host the `gcp-length-header.json` and `gcp-length-data.bin`
|
|
199
201
|
* files.
|
|
202
|
+
*
|
|
203
|
+
* @param httpFetch
|
|
204
|
+
* HTTP fetch function.
|
|
200
205
|
*/
|
|
201
|
-
constructor(appDataStorage: AppDataStorage<boolean>, baseURL: string = RemoteGCPLengthCache.DEFAULT_BASE_URL) {
|
|
206
|
+
constructor(appDataStorage: AppDataStorage<boolean>, baseURL: string = RemoteGCPLengthCache.DEFAULT_BASE_URL, httpFetch: HTTPFetch = defaultHTTPFetch) {
|
|
202
207
|
super(appDataStorage);
|
|
203
208
|
|
|
204
|
-
this.#remoteAppDataStorage = new RemoteAppDataStorage(baseURL);
|
|
209
|
+
this.#remoteAppDataStorage = new RemoteAppDataStorage(baseURL, httpFetch);
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
/**
|