@aidc-toolkit/gs1 1.0.23-beta → 1.0.24-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/index.cjs +4624 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1588 -0
- package/dist/index.d.ts +1588 -36
- package/dist/index.js +4541 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -8
- package/src/character-set.ts +16 -1
- package/src/check.ts +2 -2
- package/src/gtin-creator.ts +4 -4
- package/src/gtin-validator.ts +6 -6
- package/src/identifier-creator.ts +3 -3
- package/src/identifier-validator.ts +4 -4
- package/src/index.ts +19 -19
- package/src/locale/i18n.ts +3 -5
- package/src/locale/i18next.d.ts +1 -1
- package/src/non-gtin-numeric-identifier-creator.ts +4 -4
- package/src/non-gtin-numeric-identifier-validator.ts +3 -3
- package/src/non-numeric-identifier-creator.ts +6 -6
- package/src/non-numeric-identifier-validator.ts +6 -6
- package/src/numeric-identifier-creator.ts +3 -3
- package/src/numeric-identifier-validator.ts +5 -5
- package/src/prefix-manager.ts +16 -16
- package/src/prefix-provider.ts +1 -1
- package/src/prefix-validator.ts +2 -2
- package/src/serializable-numeric-identifier-creator.ts +4 -4
- package/src/serializable-numeric-identifier-validator.ts +5 -5
- package/test/creator.test.ts +3 -3
- package/test/gtin-creator.ts +1 -1
- package/test/gtin-validator.test.ts +1 -1
- package/test/identifier-creator.ts +4 -4
- package/test/non-gtin-numeric-identifier-creator.ts +1 -1
- package/test/non-gtin-numeric-identifier-validator.ts +1 -1
- package/test/non-numeric-identifier-validator.ts +2 -2
- package/test/numeric-identifier-creator.ts +1 -1
- package/test/numeric-identifier-validator.ts +1 -1
- package/test/prefix-manager.test.ts +1 -1
- package/test/serializable-numeric-identifier-creator.ts +1 -1
- package/test/serializable-numeric-identifier-validator.ts +2 -2
- package/test/validator.test.ts +4 -4
- package/tsup.config.ts +3 -0
- package/typedoc.json +1 -3
- package/dist/character-set.d.ts +0 -22
- package/dist/character-set.d.ts.map +0 -1
- package/dist/character-set.js +0 -36
- package/dist/character-set.js.map +0 -1
- package/dist/check.d.ts +0 -81
- package/dist/check.d.ts.map +0 -1
- package/dist/check.js +0 -218
- package/dist/check.js.map +0 -1
- package/dist/gtin-creator.d.ts +0 -68
- package/dist/gtin-creator.d.ts.map +0 -1
- package/dist/gtin-creator.js +0 -158
- package/dist/gtin-creator.js.map +0 -1
- package/dist/gtin-validator.d.ts +0 -202
- package/dist/gtin-validator.d.ts.map +0 -1
- package/dist/gtin-validator.js +0 -470
- package/dist/gtin-validator.js.map +0 -1
- package/dist/identifier-creator.d.ts +0 -72
- package/dist/identifier-creator.d.ts.map +0 -1
- package/dist/identifier-creator.js +0 -50
- package/dist/identifier-creator.js.map +0 -1
- package/dist/identifier-type.d.ts +0 -58
- package/dist/identifier-type.d.ts.map +0 -1
- package/dist/identifier-type.js +0 -54
- package/dist/identifier-type.js.map +0 -1
- package/dist/identifier-validator.d.ts +0 -174
- package/dist/identifier-validator.d.ts.map +0 -1
- package/dist/identifier-validator.js +0 -145
- package/dist/identifier-validator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/locale/en/locale-resources.d.ts +0 -43
- package/dist/locale/en/locale-resources.d.ts.map +0 -1
- package/dist/locale/en/locale-resources.js +0 -42
- package/dist/locale/en/locale-resources.js.map +0 -1
- package/dist/locale/fr/locale-resources.d.ts +0 -43
- package/dist/locale/fr/locale-resources.d.ts.map +0 -1
- package/dist/locale/fr/locale-resources.js +0 -42
- package/dist/locale/fr/locale-resources.js.map +0 -1
- package/dist/locale/i18n.d.ts +0 -27
- package/dist/locale/i18n.d.ts.map +0 -1
- package/dist/locale/i18n.js +0 -37
- package/dist/locale/i18n.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-creator.d.ts +0 -30
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-creator.js +0 -30
- package/dist/non-gtin-numeric-identifier-creator.js.map +0 -1
- package/dist/non-gtin-numeric-identifier-validator.d.ts +0 -41
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/non-gtin-numeric-identifier-validator.js +0 -40
- package/dist/non-gtin-numeric-identifier-validator.js.map +0 -1
- package/dist/non-numeric-identifier-creator.d.ts +0 -55
- package/dist/non-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/non-numeric-identifier-creator.js +0 -93
- package/dist/non-numeric-identifier-creator.js.map +0 -1
- package/dist/non-numeric-identifier-validator.d.ts +0 -78
- package/dist/non-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/non-numeric-identifier-validator.js +0 -95
- package/dist/non-numeric-identifier-validator.js.map +0 -1
- package/dist/numeric-identifier-creator.d.ts +0 -121
- package/dist/numeric-identifier-creator.d.ts.map +0 -1
- package/dist/numeric-identifier-creator.js +0 -135
- package/dist/numeric-identifier-creator.js.map +0 -1
- package/dist/numeric-identifier-validator.d.ts +0 -76
- package/dist/numeric-identifier-validator.d.ts.map +0 -1
- package/dist/numeric-identifier-validator.js +0 -84
- package/dist/numeric-identifier-validator.js.map +0 -1
- package/dist/prefix-manager.d.ts +0 -224
- package/dist/prefix-manager.d.ts.map +0 -1
- package/dist/prefix-manager.js +0 -369
- package/dist/prefix-manager.js.map +0 -1
- package/dist/prefix-provider.d.ts +0 -27
- package/dist/prefix-provider.d.ts.map +0 -1
- package/dist/prefix-provider.js +0 -2
- package/dist/prefix-provider.js.map +0 -1
- package/dist/prefix-type.d.ts +0 -22
- package/dist/prefix-type.d.ts.map +0 -1
- package/dist/prefix-type.js +0 -18
- package/dist/prefix-type.js.map +0 -1
- package/dist/prefix-validator.d.ts +0 -58
- package/dist/prefix-validator.d.ts.map +0 -1
- package/dist/prefix-validator.js +0 -154
- package/dist/prefix-validator.js.map +0 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +0 -86
- package/dist/serializable-numeric-identifier-creator.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-creator.js +0 -116
- package/dist/serializable-numeric-identifier-creator.js.map +0 -1
- package/dist/serializable-numeric-identifier-validator.d.ts +0 -79
- package/dist/serializable-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/serializable-numeric-identifier-validator.js +0 -99
- package/dist/serializable-numeric-identifier-validator.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/gs1",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24-beta",
|
|
4
4
|
"description": "GS1 AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"homepage": "https://aidc-toolkit.com/",
|
|
8
|
-
"repository":
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/aidc-toolkit/gs1.git"
|
|
11
|
-
},
|
|
8
|
+
"repository": "aidc-toolkit/gs1",
|
|
12
9
|
"bugs": {
|
|
13
10
|
"url": "https://github.com/aidc-toolkit/gs1/issues"
|
|
14
11
|
},
|
|
@@ -20,9 +17,8 @@
|
|
|
20
17
|
},
|
|
21
18
|
"scripts": {
|
|
22
19
|
"lint": "eslint",
|
|
23
|
-
"build:
|
|
24
|
-
"build:
|
|
25
|
-
"build:release": "npm run build:core -- node_modules/@aidc-toolkit/dev/tsconfig-build.json",
|
|
20
|
+
"build:dev": "tsup --define.mode=dev",
|
|
21
|
+
"build:release": "tsup",
|
|
26
22
|
"build:doc": "npm run build:dev",
|
|
27
23
|
"test": "vitest run"
|
|
28
24
|
},
|
package/src/character-set.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CharacterSetCreator,
|
|
1
|
+
import { CharacterSetCreator, CharacterSetValidator, Exclusions } from "@aidc-toolkit/utility";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1
|
|
@@ -37,3 +37,18 @@ export const AI39_CREATOR = new CharacterSetCreator([
|
|
|
37
37
|
* GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
38
38
|
*/
|
|
39
39
|
export const AI39_VALIDATOR = AI39_CREATOR as CharacterSetValidator;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* GS1 AI encodable character set 64 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |
|
|
43
|
+
* GS1 General Specifications}. Doesn't support any exclusions.
|
|
44
|
+
*/
|
|
45
|
+
export const AI64_VALIDATOR = new CharacterSetValidator([
|
|
46
|
+
"-",
|
|
47
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
|
48
|
+
"=",
|
|
49
|
+
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
|
|
50
|
+
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
51
|
+
"_",
|
|
52
|
+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
|
53
|
+
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
|
|
54
|
+
]);
|
package/src/check.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NUMERIC_CREATOR, utilityNS } from "@aidc-toolkit/utility";
|
|
2
|
-
import { AI82_CREATOR } from "./character-set
|
|
3
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
2
|
+
import { AI82_CREATOR } from "./character-set";
|
|
3
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Results of multiplying digits by 3.
|
package/src/gtin-creator.ts
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
type TransformerOutput
|
|
7
7
|
} from "@aidc-toolkit/utility";
|
|
8
8
|
import { Mixin } from "ts-mixer";
|
|
9
|
-
import { checkDigit, priceOrWeightCheckDigit } from "./check
|
|
10
|
-
import { type GTINType, GTINTypes, GTINValidator } from "./gtin-validator
|
|
11
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
12
|
-
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
9
|
+
import { checkDigit, priceOrWeightCheckDigit } from "./check";
|
|
10
|
+
import { type GTINType, GTINTypes, GTINValidator } from "./gtin-validator";
|
|
11
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
12
|
+
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
13
13
|
import type { PrefixProvider } from "./prefix-provider";
|
|
14
14
|
|
|
15
15
|
/**
|
package/src/gtin-validator.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type CharacterSetValidation, NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
-
import { checkDigit, hasValidCheckDigit, isValidPriceOrWeightCheckDigit } from "./check
|
|
3
|
-
import { IdentifierTypes } from "./identifier-type
|
|
4
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
5
|
-
import { AbstractNumericIdentifierValidator, LeaderTypes } from "./numeric-identifier-validator
|
|
6
|
-
import { type PrefixType, PrefixTypes } from "./prefix-type
|
|
7
|
-
import { PrefixValidator } from "./prefix-validator
|
|
2
|
+
import { checkDigit, hasValidCheckDigit, isValidPriceOrWeightCheckDigit } from "./check";
|
|
3
|
+
import { IdentifierTypes } from "./identifier-type";
|
|
4
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
5
|
+
import { AbstractNumericIdentifierValidator, LeaderTypes } from "./numeric-identifier-validator";
|
|
6
|
+
import { type PrefixType, PrefixTypes } from "./prefix-type";
|
|
7
|
+
import { PrefixValidator } from "./prefix-validator";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* GTIN types. The numeric values are equal to the lengths of the GTIN types.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CharacterSetCreator } from "@aidc-toolkit/utility";
|
|
2
|
-
import type { IdentifierType } from "./identifier-type
|
|
3
|
-
import type { ContentCharacterSet, IdentifierValidation, IdentifierValidator } from "./identifier-validator
|
|
2
|
+
import type { IdentifierType } from "./identifier-type";
|
|
3
|
+
import type { ContentCharacterSet, IdentifierValidation, IdentifierValidator } from "./identifier-validator";
|
|
4
4
|
import type { PrefixProvider } from "./prefix-provider";
|
|
5
|
-
import type { PrefixType } from "./prefix-type
|
|
5
|
+
import type { PrefixType } from "./prefix-type";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Identifier creator. Creates an identifier based on its definition in section 3 of the {@link
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
type StringValidation,
|
|
5
5
|
type StringValidator
|
|
6
6
|
} from "@aidc-toolkit/utility";
|
|
7
|
-
import { AI39_CREATOR, AI82_CREATOR } from "./character-set
|
|
8
|
-
import type { IdentifierType } from "./identifier-type
|
|
9
|
-
import type { PrefixType } from "./prefix-type
|
|
10
|
-
import { PrefixValidator } from "./prefix-validator
|
|
7
|
+
import { AI39_CREATOR, AI82_CREATOR } from "./character-set";
|
|
8
|
+
import type { IdentifierType } from "./identifier-type";
|
|
9
|
+
import type { PrefixType } from "./prefix-type";
|
|
10
|
+
import { PrefixValidator } from "./prefix-validator";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Character sets supported by the reference portion of an identifier or the serial component of a numeric identifier.
|
package/src/index.ts
CHANGED
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export * from "./locale/i18n
|
|
18
|
-
export * from "./character-set
|
|
19
|
-
export * from "./check
|
|
20
|
-
export * from "./prefix-type
|
|
21
|
-
export * from "./prefix-validator
|
|
22
|
-
export * from "./identifier-type
|
|
23
|
-
export * from "./identifier-validator
|
|
24
|
-
export * from "./numeric-identifier-validator
|
|
25
|
-
export * from "./gtin-validator
|
|
26
|
-
export * from "./non-gtin-numeric-identifier-validator
|
|
27
|
-
export * from "./serializable-numeric-identifier-validator
|
|
28
|
-
export * from "./non-numeric-identifier-validator
|
|
29
|
-
export * from "./identifier-creator
|
|
30
|
-
export * from "./numeric-identifier-creator
|
|
31
|
-
export * from "./gtin-creator
|
|
32
|
-
export * from "./non-gtin-numeric-identifier-creator
|
|
33
|
-
export * from "./serializable-numeric-identifier-creator
|
|
34
|
-
export * from "./non-numeric-identifier-creator
|
|
35
|
-
export * from "./prefix-manager
|
|
17
|
+
export * from "./locale/i18n";
|
|
18
|
+
export * from "./character-set";
|
|
19
|
+
export * from "./check";
|
|
20
|
+
export * from "./prefix-type";
|
|
21
|
+
export * from "./prefix-validator";
|
|
22
|
+
export * from "./identifier-type";
|
|
23
|
+
export * from "./identifier-validator";
|
|
24
|
+
export * from "./numeric-identifier-validator";
|
|
25
|
+
export * from "./gtin-validator";
|
|
26
|
+
export * from "./non-gtin-numeric-identifier-validator";
|
|
27
|
+
export * from "./serializable-numeric-identifier-validator";
|
|
28
|
+
export * from "./non-numeric-identifier-validator";
|
|
29
|
+
export * from "./identifier-creator";
|
|
30
|
+
export * from "./numeric-identifier-creator";
|
|
31
|
+
export * from "./gtin-creator";
|
|
32
|
+
export * from "./non-gtin-numeric-identifier-creator";
|
|
33
|
+
export * from "./serializable-numeric-identifier-creator";
|
|
34
|
+
export * from "./non-numeric-identifier-creator";
|
|
35
|
+
export * from "./prefix-manager";
|
package/src/locale/i18n.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i18nCoreInit, type I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
2
|
import { i18nUtilityInit, utilityResources } from "@aidc-toolkit/utility";
|
|
3
3
|
import i18next, { type i18n, type Resource } from "i18next";
|
|
4
|
-
import enLocaleResources from "./en/locale-resources
|
|
5
|
-
import frLocaleResources from "./fr/locale-resources
|
|
4
|
+
import enLocaleResources from "./en/locale-resources";
|
|
5
|
+
import frLocaleResources from "./fr/locale-resources";
|
|
6
6
|
|
|
7
7
|
export const gs1NS = "aidct_gs1";
|
|
8
8
|
|
|
@@ -11,8 +11,6 @@ export const gs1NS = "aidct_gs1";
|
|
|
11
11
|
*/
|
|
12
12
|
export type GS1LocaleResources = typeof enLocaleResources;
|
|
13
13
|
|
|
14
|
-
i18nAssertValidResources(enLocaleResources, "fr", frLocaleResources);
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* GS1 resources.
|
|
18
16
|
*/
|
package/src/locale/i18next.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Mixin } from "ts-mixer";
|
|
2
|
-
import type { IdentifierType } from "./identifier-type
|
|
3
|
-
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator
|
|
4
|
-
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
5
|
-
import { type LeaderType, LeaderTypes } from "./numeric-identifier-validator
|
|
2
|
+
import type { IdentifierType } from "./identifier-type";
|
|
3
|
+
import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator";
|
|
4
|
+
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
5
|
+
import { type LeaderType, LeaderTypes } from "./numeric-identifier-validator";
|
|
6
6
|
import type { PrefixProvider } from "./prefix-provider";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type IdentifierType, IdentifierTypes } from "./identifier-type
|
|
1
|
+
import { type IdentifierType, IdentifierTypes } from "./identifier-type";
|
|
2
2
|
import {
|
|
3
3
|
AbstractNumericIdentifierValidator,
|
|
4
4
|
type LeaderType,
|
|
5
5
|
LeaderTypes,
|
|
6
6
|
type NumericIdentifierType
|
|
7
|
-
} from "./numeric-identifier-validator
|
|
8
|
-
import { PrefixTypes } from "./prefix-type
|
|
7
|
+
} from "./numeric-identifier-validator";
|
|
8
|
+
import { PrefixTypes } from "./prefix-type";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Non-GTIN numeric identifier type.
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
type TransformerOutput
|
|
6
6
|
} from "@aidc-toolkit/utility";
|
|
7
7
|
import { Mixin } from "ts-mixer";
|
|
8
|
-
import { checkCharacterPair } from "./check
|
|
9
|
-
import { AbstractIdentifierCreator } from "./identifier-creator
|
|
10
|
-
import type { IdentifierType } from "./identifier-type
|
|
11
|
-
import type { ContentCharacterSet } from "./identifier-validator
|
|
12
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
13
|
-
import { NonNumericIdentifierValidator } from "./non-numeric-identifier-validator
|
|
8
|
+
import { checkCharacterPair } from "./check";
|
|
9
|
+
import { AbstractIdentifierCreator } from "./identifier-creator";
|
|
10
|
+
import type { IdentifierType } from "./identifier-type";
|
|
11
|
+
import type { ContentCharacterSet } from "./identifier-validator";
|
|
12
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
13
|
+
import { NonNumericIdentifierValidator } from "./non-numeric-identifier-validator";
|
|
14
14
|
import type { PrefixProvider } from "./prefix-provider";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Exclusions, RegExpValidator } from "@aidc-toolkit/utility";
|
|
2
|
-
import { hasValidCheckCharacterPair } from "./check
|
|
3
|
-
import { type IdentifierType, IdentifierTypes } from "./identifier-type
|
|
2
|
+
import { hasValidCheckCharacterPair } from "./check";
|
|
3
|
+
import { type IdentifierType, IdentifierTypes } from "./identifier-type";
|
|
4
4
|
import {
|
|
5
5
|
AbstractIdentifierValidator,
|
|
6
6
|
type ContentCharacterSet,
|
|
7
7
|
ContentCharacterSets,
|
|
8
8
|
type IdentifierValidation
|
|
9
|
-
} from "./identifier-validator
|
|
10
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
11
|
-
import type { NumericIdentifierType } from "./numeric-identifier-validator
|
|
12
|
-
import { PrefixTypes } from "./prefix-type
|
|
9
|
+
} from "./identifier-validator";
|
|
10
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
11
|
+
import type { NumericIdentifierType } from "./numeric-identifier-validator";
|
|
12
|
+
import { PrefixTypes } from "./prefix-type";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Non-numeric identifier type.
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
type TransformerInput,
|
|
6
6
|
type TransformerOutput
|
|
7
7
|
} from "@aidc-toolkit/utility";
|
|
8
|
-
import { checkDigit, checkDigitSum } from "./check
|
|
9
|
-
import { AbstractIdentifierCreator, type IdentifierCreator } from "./identifier-creator
|
|
10
|
-
import { type LeaderType, LeaderTypes, type NumericIdentifierValidator } from "./numeric-identifier-validator
|
|
8
|
+
import { checkDigit, checkDigitSum } from "./check";
|
|
9
|
+
import { AbstractIdentifierCreator, type IdentifierCreator } from "./identifier-creator";
|
|
10
|
+
import { type LeaderType, LeaderTypes, type NumericIdentifierValidator } from "./numeric-identifier-validator";
|
|
11
11
|
import type { PrefixProvider } from "./prefix-provider";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { hasValidCheckDigit } from "./check
|
|
2
|
-
import type { IdentifierType, IdentifierTypes } from "./identifier-type
|
|
1
|
+
import { hasValidCheckDigit } from "./check";
|
|
2
|
+
import type { IdentifierType, IdentifierTypes } from "./identifier-type";
|
|
3
3
|
import {
|
|
4
4
|
AbstractIdentifierValidator,
|
|
5
5
|
ContentCharacterSets,
|
|
6
6
|
type IdentifierValidation,
|
|
7
7
|
type IdentifierValidator
|
|
8
|
-
} from "./identifier-validator
|
|
9
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
10
|
-
import type { PrefixType } from "./prefix-type
|
|
8
|
+
} from "./identifier-validator";
|
|
9
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
10
|
+
import type { PrefixType } from "./prefix-type";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Numeric identifier type.
|
package/src/prefix-manager.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { GTINCreator } from "./gtin-creator
|
|
2
|
-
import { type GTINType, GTINTypes } from "./gtin-validator
|
|
3
|
-
import type { IdentifierCreator } from "./identifier-creator
|
|
4
|
-
import { type IdentifierType, IdentifierTypes } from "./identifier-type
|
|
5
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
6
|
-
import { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator
|
|
1
|
+
import { GTINCreator } from "./gtin-creator";
|
|
2
|
+
import { type GTINType, GTINTypes } from "./gtin-validator";
|
|
3
|
+
import type { IdentifierCreator } from "./identifier-creator";
|
|
4
|
+
import { type IdentifierType, IdentifierTypes } from "./identifier-type";
|
|
5
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
6
|
+
import { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator";
|
|
7
7
|
import {
|
|
8
8
|
GLN_VALIDATOR,
|
|
9
9
|
GSIN_VALIDATOR,
|
|
10
10
|
GSRN_VALIDATOR,
|
|
11
11
|
type NonGTINNumericIdentifierValidator,
|
|
12
12
|
SSCC_VALIDATOR
|
|
13
|
-
} from "./non-gtin-numeric-identifier-validator
|
|
14
|
-
import { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator
|
|
13
|
+
} from "./non-gtin-numeric-identifier-validator";
|
|
14
|
+
import { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator";
|
|
15
15
|
import {
|
|
16
16
|
CPID_VALIDATOR,
|
|
17
17
|
GIAI_VALIDATOR,
|
|
18
18
|
GINC_VALIDATOR,
|
|
19
19
|
GMN_VALIDATOR,
|
|
20
20
|
type NonNumericIdentifierValidator
|
|
21
|
-
} from "./non-numeric-identifier-validator
|
|
22
|
-
import type { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
23
|
-
import type { NumericIdentifierType } from "./numeric-identifier-validator
|
|
24
|
-
import type { PrefixProvider } from "./prefix-provider
|
|
25
|
-
import { type PrefixType, PrefixTypes } from "./prefix-type
|
|
26
|
-
import { PrefixValidator } from "./prefix-validator
|
|
27
|
-
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator
|
|
21
|
+
} from "./non-numeric-identifier-validator";
|
|
22
|
+
import type { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
23
|
+
import type { NumericIdentifierType } from "./numeric-identifier-validator";
|
|
24
|
+
import type { PrefixProvider } from "./prefix-provider";
|
|
25
|
+
import { type PrefixType, PrefixTypes } from "./prefix-type";
|
|
26
|
+
import { PrefixValidator } from "./prefix-validator";
|
|
27
|
+
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator";
|
|
28
28
|
import {
|
|
29
29
|
GCN_VALIDATOR,
|
|
30
30
|
GDTI_VALIDATOR,
|
|
31
31
|
GRAI_VALIDATOR,
|
|
32
32
|
type SerializableNumericIdentifierValidator
|
|
33
|
-
} from "./serializable-numeric-identifier-validator
|
|
33
|
+
} from "./serializable-numeric-identifier-validator";
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Prefix manager. This is the core class for identifier creation.
|
package/src/prefix-provider.ts
CHANGED
package/src/prefix-validator.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CharacterSetValidation, NUMERIC_CREATOR } from "@aidc-toolkit/utility";
|
|
2
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
3
|
-
import { type PrefixType, PrefixTypes } from "./prefix-type
|
|
2
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
3
|
+
import { type PrefixType, PrefixTypes } from "./prefix-type";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Prefix validation parameters.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mapIterable, type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
2
|
import { Mixin } from "ts-mixer";
|
|
3
|
-
import type { IdentifierType } from "./identifier-type
|
|
4
|
-
import type { ContentCharacterSet } from "./identifier-validator
|
|
5
|
-
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
3
|
+
import type { IdentifierType } from "./identifier-type";
|
|
4
|
+
import type { ContentCharacterSet } from "./identifier-validator";
|
|
5
|
+
import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
6
6
|
import type { PrefixProvider } from "./prefix-provider";
|
|
7
|
-
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator
|
|
7
|
+
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Serializable numeric identifier creator.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CharacterSetCreator, CharacterSetValidation } from "@aidc-toolkit/utility";
|
|
2
|
-
import { type IdentifierType, IdentifierTypes } from "./identifier-type
|
|
3
|
-
import { type ContentCharacterSet, ContentCharacterSets, type IdentifierValidation } from "./identifier-validator
|
|
4
|
-
import { i18nextGS1 } from "./locale/i18n
|
|
2
|
+
import { type IdentifierType, IdentifierTypes } from "./identifier-type";
|
|
3
|
+
import { type ContentCharacterSet, ContentCharacterSets, type IdentifierValidation } from "./identifier-validator";
|
|
4
|
+
import { i18nextGS1 } from "./locale/i18n";
|
|
5
5
|
import {
|
|
6
6
|
type NonGTINNumericIdentifierType,
|
|
7
7
|
NonGTINNumericIdentifierValidator
|
|
8
|
-
} from "./non-gtin-numeric-identifier-validator
|
|
9
|
-
import { LeaderTypes } from "./numeric-identifier-validator
|
|
8
|
+
} from "./non-gtin-numeric-identifier-validator";
|
|
9
|
+
import { LeaderTypes } from "./numeric-identifier-validator";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Serializable numeric identifier type.
|
package/test/creator.test.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe } from "vitest";
|
|
2
2
|
import { PrefixManager, PrefixTypes } from "../src";
|
|
3
|
-
import { testGTINCreator } from "./gtin-creator
|
|
3
|
+
import { testGTINCreator } from "./gtin-creator";
|
|
4
4
|
import {
|
|
5
5
|
testNonGTINNumericIdentifierCreator,
|
|
6
6
|
testNonNumericIdentifierCreator
|
|
7
|
-
} from "./non-gtin-numeric-identifier-creator
|
|
8
|
-
import { testSerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator
|
|
7
|
+
} from "./non-gtin-numeric-identifier-creator";
|
|
8
|
+
import { testSerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator";
|
|
9
9
|
|
|
10
10
|
describe("Creators", () => {
|
|
11
11
|
testGTINCreator(PrefixManager.get(PrefixTypes.GS1CompanyPrefix, "952123456").gtinCreator);
|
package/test/gtin-creator.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CharacterSetCreator, Sequence } from "@aidc-toolkit/utility";
|
|
2
2
|
import { expect, test } from "vitest";
|
|
3
3
|
import { type GTINCreator, GTINTypes, GTINValidator, hasValidCheckDigit, PrefixTypes } from "../src";
|
|
4
|
-
import { testNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
4
|
+
import { testNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
5
5
|
|
|
6
6
|
export function testGTINCreator(creator: GTINCreator): void {
|
|
7
7
|
testNumericIdentifierCreator(creator, () => {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type PrefixType,
|
|
10
10
|
PrefixTypes
|
|
11
11
|
} from "../src";
|
|
12
|
-
import { validateNumericIdentifierValidator } from "./numeric-identifier-validator
|
|
12
|
+
import { validateNumericIdentifierValidator } from "./numeric-identifier-validator";
|
|
13
13
|
|
|
14
14
|
export function validateGTINValidator(validator: GTINValidator, isCreator: boolean, gtinType: GTINType): void {
|
|
15
15
|
let prefixType: PrefixType;
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
type PrefixManager,
|
|
9
9
|
PrefixTypes
|
|
10
10
|
} from "../src";
|
|
11
|
-
import { validateGTINValidator } from "./gtin-validator.test
|
|
12
|
-
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator
|
|
13
|
-
import { validateNonNumericIdentifierValidator } from "./non-numeric-identifier-validator
|
|
14
|
-
import { validateSerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator
|
|
11
|
+
import { validateGTINValidator } from "./gtin-validator.test";
|
|
12
|
+
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator";
|
|
13
|
+
import { validateNonNumericIdentifierValidator } from "./non-numeric-identifier-validator";
|
|
14
|
+
import { validateSerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator";
|
|
15
15
|
|
|
16
16
|
export function validateIdentifierCreators(prefixManager: PrefixManager): void {
|
|
17
17
|
let gtinType: GTINType;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type NonGTINNumericIdentifierCreator,
|
|
6
6
|
type NonNumericIdentifierCreator
|
|
7
7
|
} from "../src";
|
|
8
|
-
import { testNumericIdentifierCreator } from "./numeric-identifier-creator
|
|
8
|
+
import { testNumericIdentifierCreator } from "./numeric-identifier-creator";
|
|
9
9
|
|
|
10
10
|
export function testNonGTINNumericIdentifierCreator(creator: NonGTINNumericIdentifierCreator, preTestCallback?: () => void, postTestCallback?: () => void): void {
|
|
11
11
|
testNumericIdentifierCreator(creator, preTestCallback, postTestCallback);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IdentifierType, type LeaderType, type NonGTINNumericIdentifierValidator, PrefixTypes } from "../src";
|
|
2
|
-
import { validateNumericIdentifierValidator } from "./numeric-identifier-validator
|
|
2
|
+
import { validateNumericIdentifierValidator } from "./numeric-identifier-validator";
|
|
3
3
|
|
|
4
4
|
export function validateNonGTINNumericIdentifierValidator(validator: NonGTINNumericIdentifierValidator, isCreator: boolean, identifierType: IdentifierType, length: number, leaderType: LeaderType): void {
|
|
5
5
|
validateNumericIdentifierValidator(validator, isCreator, identifierType, PrefixTypes.GS1CompanyPrefix, length, leaderType);
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type NonNumericIdentifierValidator,
|
|
7
7
|
PrefixTypes
|
|
8
8
|
} from "../src";
|
|
9
|
-
import { validateIdentifierValidator } from "./identifier-validator
|
|
10
|
-
import { creatorFor } from "./utility
|
|
9
|
+
import { validateIdentifierValidator } from "./identifier-validator";
|
|
10
|
+
import { creatorFor } from "./utility";
|
|
11
11
|
|
|
12
12
|
export function validateNonNumericIdentifierValidator(validator: NonNumericIdentifierValidator, isCreator: boolean, identifierType: IdentifierType, length: number, referenceCharacterSet: ContentCharacterSet, requiresCheckCharacterPair: boolean): void {
|
|
13
13
|
validateIdentifierValidator(validator, identifierType, PrefixTypes.GS1CompanyPrefix, length);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CharacterSetCreator, Sequence } from "@aidc-toolkit/utility";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
3
|
import { hasValidCheckDigit, IdentifierTypes, LeaderTypes, type NumericIdentifierCreator } from "../src";
|
|
4
|
-
import { testIdentifierCreatorCallback } from "./identifier-creator
|
|
4
|
+
import { testIdentifierCreatorCallback } from "./identifier-creator";
|
|
5
5
|
|
|
6
6
|
export function testNumericIdentifierCreator(creator: NumericIdentifierCreator, preTestCallback?: () => void, postTestCallback?: () => void): void {
|
|
7
7
|
describe(creator.identifierType === IdentifierTypes.GTIN ? `${creator.identifierType}-${creator.length}` : creator.identifierType, () => {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type NumericIdentifierValidator,
|
|
9
9
|
type PrefixType
|
|
10
10
|
} from "../src";
|
|
11
|
-
import { validateIdentifierValidator } from "./identifier-validator
|
|
11
|
+
import { validateIdentifierValidator } from "./identifier-validator";
|
|
12
12
|
|
|
13
13
|
export function validateNumericIdentifierValidator(validator: NumericIdentifierValidator, isCreator: boolean, identifierType: IdentifierType, prefixType: PrefixType, length: number, leaderType: LeaderType): void {
|
|
14
14
|
validateIdentifierValidator(validator, identifierType, prefixType, length);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import { PrefixManager, PrefixTypes } from "../src";
|
|
3
|
-
import { validateIdentifierCreators } from "./identifier-creator
|
|
3
|
+
import { validateIdentifierCreators } from "./identifier-creator";
|
|
4
4
|
|
|
5
5
|
describe("Prefix manager", () => {
|
|
6
6
|
let prefixManager: PrefixManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect, test } from "vitest";
|
|
2
2
|
import { ContentCharacterSets, type SerializableNumericIdentifierCreator } from "../src";
|
|
3
|
-
import { testNonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator
|
|
3
|
+
import { testNonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator";
|
|
4
4
|
|
|
5
5
|
export function testSerializableNumericIdentifierCreator(creator: SerializableNumericIdentifierCreator): void {
|
|
6
6
|
testNonGTINNumericIdentifierCreator(creator, undefined, () => {
|
|
@@ -6,8 +6,8 @@ import type {
|
|
|
6
6
|
SerializableNumericIdentifierCreator,
|
|
7
7
|
SerializableNumericIdentifierValidator
|
|
8
8
|
} from "../src";
|
|
9
|
-
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator
|
|
10
|
-
import { creatorFor } from "./utility
|
|
9
|
+
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator";
|
|
10
|
+
import { creatorFor } from "./utility";
|
|
11
11
|
|
|
12
12
|
export function validateSerializableNumericIdentifierValidator(validator: SerializableNumericIdentifierValidator, isCreator: boolean, identifierType: IdentifierType, length: number, leaderType: LeaderType, serialLength: number, serialCharacterSet: ContentCharacterSet): void {
|
|
13
13
|
validateNonGTINNumericIdentifierValidator(validator, isCreator, identifierType, length, leaderType);
|
package/test/validator.test.ts
CHANGED
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
PrefixTypes,
|
|
22
22
|
SSCC_VALIDATOR
|
|
23
23
|
} from "../src";
|
|
24
|
-
import { validateGTINValidator } from "./gtin-validator.test
|
|
25
|
-
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator
|
|
26
|
-
import { validateNonNumericIdentifierValidator } from "./non-numeric-identifier-validator
|
|
27
|
-
import { validateSerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator
|
|
24
|
+
import { validateGTINValidator } from "./gtin-validator.test";
|
|
25
|
+
import { validateNonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator";
|
|
26
|
+
import { validateNonNumericIdentifierValidator } from "./non-numeric-identifier-validator";
|
|
27
|
+
import { validateSerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator";
|
|
28
28
|
|
|
29
29
|
describe("Validators", () => {
|
|
30
30
|
test("GTIN", () => {
|
package/tsup.config.ts
ADDED
package/typedoc.json
CHANGED
package/dist/character-set.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CharacterSetCreator, type CharacterSetValidator } from "@aidc-toolkit/utility";
|
|
2
|
-
/**
|
|
3
|
-
* GS1 AI encodable character set 82 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1
|
|
4
|
-
* General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AI82_CREATOR: CharacterSetCreator;
|
|
7
|
-
/**
|
|
8
|
-
* GS1 AI encodable character set 82 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |
|
|
9
|
-
* GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
10
|
-
*/
|
|
11
|
-
export declare const AI82_VALIDATOR: CharacterSetValidator;
|
|
12
|
-
/**
|
|
13
|
-
* GS1 AI encodable character set 39 creator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs | GS1
|
|
14
|
-
* General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
15
|
-
*/
|
|
16
|
-
export declare const AI39_CREATOR: CharacterSetCreator;
|
|
17
|
-
/**
|
|
18
|
-
* GS1 AI encodable character set 39 validator as defined in section 7.11 of the {@link https://www.gs1.org/genspecs |
|
|
19
|
-
* GS1 General Specifications}. Supports {@linkcode Exclusions.AllNumeric}.
|
|
20
|
-
*/
|
|
21
|
-
export declare const AI39_VALIDATOR: CharacterSetValidator;
|
|
22
|
-
//# sourceMappingURL=character-set.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"character-set.d.ts","sourceRoot":"","sources":["../src/character-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,qBAAqB,EAAc,MAAM,uBAAuB,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,YAAY,qBASA,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAmB,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,YAAY,qBAKA,CAAC;AAE1B;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAmB,qBAAqB,CAAC"}
|