@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.
Files changed (131) hide show
  1. package/dist/index.cjs +4624 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +1588 -0
  4. package/dist/index.d.ts +1588 -36
  5. package/dist/index.js +4541 -19
  6. package/dist/index.js.map +1 -1
  7. package/package.json +4 -8
  8. package/src/character-set.ts +16 -1
  9. package/src/check.ts +2 -2
  10. package/src/gtin-creator.ts +4 -4
  11. package/src/gtin-validator.ts +6 -6
  12. package/src/identifier-creator.ts +3 -3
  13. package/src/identifier-validator.ts +4 -4
  14. package/src/index.ts +19 -19
  15. package/src/locale/i18n.ts +3 -5
  16. package/src/locale/i18next.d.ts +1 -1
  17. package/src/non-gtin-numeric-identifier-creator.ts +4 -4
  18. package/src/non-gtin-numeric-identifier-validator.ts +3 -3
  19. package/src/non-numeric-identifier-creator.ts +6 -6
  20. package/src/non-numeric-identifier-validator.ts +6 -6
  21. package/src/numeric-identifier-creator.ts +3 -3
  22. package/src/numeric-identifier-validator.ts +5 -5
  23. package/src/prefix-manager.ts +16 -16
  24. package/src/prefix-provider.ts +1 -1
  25. package/src/prefix-validator.ts +2 -2
  26. package/src/serializable-numeric-identifier-creator.ts +4 -4
  27. package/src/serializable-numeric-identifier-validator.ts +5 -5
  28. package/test/creator.test.ts +3 -3
  29. package/test/gtin-creator.ts +1 -1
  30. package/test/gtin-validator.test.ts +1 -1
  31. package/test/identifier-creator.ts +4 -4
  32. package/test/non-gtin-numeric-identifier-creator.ts +1 -1
  33. package/test/non-gtin-numeric-identifier-validator.ts +1 -1
  34. package/test/non-numeric-identifier-validator.ts +2 -2
  35. package/test/numeric-identifier-creator.ts +1 -1
  36. package/test/numeric-identifier-validator.ts +1 -1
  37. package/test/prefix-manager.test.ts +1 -1
  38. package/test/serializable-numeric-identifier-creator.ts +1 -1
  39. package/test/serializable-numeric-identifier-validator.ts +2 -2
  40. package/test/validator.test.ts +4 -4
  41. package/tsup.config.ts +3 -0
  42. package/typedoc.json +1 -3
  43. package/dist/character-set.d.ts +0 -22
  44. package/dist/character-set.d.ts.map +0 -1
  45. package/dist/character-set.js +0 -36
  46. package/dist/character-set.js.map +0 -1
  47. package/dist/check.d.ts +0 -81
  48. package/dist/check.d.ts.map +0 -1
  49. package/dist/check.js +0 -218
  50. package/dist/check.js.map +0 -1
  51. package/dist/gtin-creator.d.ts +0 -68
  52. package/dist/gtin-creator.d.ts.map +0 -1
  53. package/dist/gtin-creator.js +0 -158
  54. package/dist/gtin-creator.js.map +0 -1
  55. package/dist/gtin-validator.d.ts +0 -202
  56. package/dist/gtin-validator.d.ts.map +0 -1
  57. package/dist/gtin-validator.js +0 -470
  58. package/dist/gtin-validator.js.map +0 -1
  59. package/dist/identifier-creator.d.ts +0 -72
  60. package/dist/identifier-creator.d.ts.map +0 -1
  61. package/dist/identifier-creator.js +0 -50
  62. package/dist/identifier-creator.js.map +0 -1
  63. package/dist/identifier-type.d.ts +0 -58
  64. package/dist/identifier-type.d.ts.map +0 -1
  65. package/dist/identifier-type.js +0 -54
  66. package/dist/identifier-type.js.map +0 -1
  67. package/dist/identifier-validator.d.ts +0 -174
  68. package/dist/identifier-validator.d.ts.map +0 -1
  69. package/dist/identifier-validator.js +0 -145
  70. package/dist/identifier-validator.js.map +0 -1
  71. package/dist/index.d.ts.map +0 -1
  72. package/dist/locale/en/locale-resources.d.ts +0 -43
  73. package/dist/locale/en/locale-resources.d.ts.map +0 -1
  74. package/dist/locale/en/locale-resources.js +0 -42
  75. package/dist/locale/en/locale-resources.js.map +0 -1
  76. package/dist/locale/fr/locale-resources.d.ts +0 -43
  77. package/dist/locale/fr/locale-resources.d.ts.map +0 -1
  78. package/dist/locale/fr/locale-resources.js +0 -42
  79. package/dist/locale/fr/locale-resources.js.map +0 -1
  80. package/dist/locale/i18n.d.ts +0 -27
  81. package/dist/locale/i18n.d.ts.map +0 -1
  82. package/dist/locale/i18n.js +0 -37
  83. package/dist/locale/i18n.js.map +0 -1
  84. package/dist/non-gtin-numeric-identifier-creator.d.ts +0 -30
  85. package/dist/non-gtin-numeric-identifier-creator.d.ts.map +0 -1
  86. package/dist/non-gtin-numeric-identifier-creator.js +0 -30
  87. package/dist/non-gtin-numeric-identifier-creator.js.map +0 -1
  88. package/dist/non-gtin-numeric-identifier-validator.d.ts +0 -41
  89. package/dist/non-gtin-numeric-identifier-validator.d.ts.map +0 -1
  90. package/dist/non-gtin-numeric-identifier-validator.js +0 -40
  91. package/dist/non-gtin-numeric-identifier-validator.js.map +0 -1
  92. package/dist/non-numeric-identifier-creator.d.ts +0 -55
  93. package/dist/non-numeric-identifier-creator.d.ts.map +0 -1
  94. package/dist/non-numeric-identifier-creator.js +0 -93
  95. package/dist/non-numeric-identifier-creator.js.map +0 -1
  96. package/dist/non-numeric-identifier-validator.d.ts +0 -78
  97. package/dist/non-numeric-identifier-validator.d.ts.map +0 -1
  98. package/dist/non-numeric-identifier-validator.js +0 -95
  99. package/dist/non-numeric-identifier-validator.js.map +0 -1
  100. package/dist/numeric-identifier-creator.d.ts +0 -121
  101. package/dist/numeric-identifier-creator.d.ts.map +0 -1
  102. package/dist/numeric-identifier-creator.js +0 -135
  103. package/dist/numeric-identifier-creator.js.map +0 -1
  104. package/dist/numeric-identifier-validator.d.ts +0 -76
  105. package/dist/numeric-identifier-validator.d.ts.map +0 -1
  106. package/dist/numeric-identifier-validator.js +0 -84
  107. package/dist/numeric-identifier-validator.js.map +0 -1
  108. package/dist/prefix-manager.d.ts +0 -224
  109. package/dist/prefix-manager.d.ts.map +0 -1
  110. package/dist/prefix-manager.js +0 -369
  111. package/dist/prefix-manager.js.map +0 -1
  112. package/dist/prefix-provider.d.ts +0 -27
  113. package/dist/prefix-provider.d.ts.map +0 -1
  114. package/dist/prefix-provider.js +0 -2
  115. package/dist/prefix-provider.js.map +0 -1
  116. package/dist/prefix-type.d.ts +0 -22
  117. package/dist/prefix-type.d.ts.map +0 -1
  118. package/dist/prefix-type.js +0 -18
  119. package/dist/prefix-type.js.map +0 -1
  120. package/dist/prefix-validator.d.ts +0 -58
  121. package/dist/prefix-validator.d.ts.map +0 -1
  122. package/dist/prefix-validator.js +0 -154
  123. package/dist/prefix-validator.js.map +0 -1
  124. package/dist/serializable-numeric-identifier-creator.d.ts +0 -86
  125. package/dist/serializable-numeric-identifier-creator.d.ts.map +0 -1
  126. package/dist/serializable-numeric-identifier-creator.js +0 -116
  127. package/dist/serializable-numeric-identifier-creator.js.map +0 -1
  128. package/dist/serializable-numeric-identifier-validator.d.ts +0 -79
  129. package/dist/serializable-numeric-identifier-validator.d.ts.map +0 -1
  130. package/dist/serializable-numeric-identifier-validator.js +0 -99
  131. package/dist/serializable-numeric-identifier-validator.js.map +0 -1
@@ -1,18 +0,0 @@
1
- /**
2
- * Prefix types.
3
- */
4
- export const PrefixTypes = {
5
- /**
6
- * GS1 Company Prefix.
7
- */
8
- GS1CompanyPrefix: "GS1 Company Prefix",
9
- /**
10
- * U.P.C. Company Prefix.
11
- */
12
- UPCCompanyPrefix: "U.P.C. Company Prefix",
13
- /**
14
- * GS1-8 Prefix.
15
- */
16
- GS18Prefix: "GS1-8 Prefix"
17
- };
18
- //# sourceMappingURL=prefix-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefix-type.js","sourceRoot":"","sources":["../src/prefix-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB;;OAEG;IACH,gBAAgB,EAAE,oBAAoB;IAEtC;;OAEG;IACH,gBAAgB,EAAE,uBAAuB;IAEzC;;OAEG;IACH,UAAU,EAAE,cAAc;CACpB,CAAC"}
@@ -1,58 +0,0 @@
1
- import { type CharacterSetValidation } from "@aidc-toolkit/utility";
2
- import { type PrefixType } from "./prefix-type.js";
3
- /**
4
- * Prefix validation parameters.
5
- */
6
- export interface PrefixValidation extends CharacterSetValidation {
7
- /**
8
- * Minimum length.
9
- */
10
- minimumLength: number;
11
- /**
12
- * Maximum length.
13
- */
14
- maximumLength: number;
15
- /**
16
- * Callback to localized prefix type name.
17
- */
18
- component: () => string;
19
- }
20
- /**
21
- * Validate a prefix.
22
- *
23
- * @param prefixType
24
- * Prefix type.
25
- *
26
- * @param allowUPCCompanyPrefix
27
- * If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
28
- *
29
- * @param allowGS18Prefix
30
- * If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
31
- *
32
- * @param prefix
33
- * Prefix.
34
- *
35
- * @param isFromIdentifier
36
- * If true, the prefix is from an identifier and should be trimmed before its character set is validated.
37
- *
38
- * @param isNumericIdentifier
39
- * If true, the prefix is from a numeric identifier and its character set will be validated by the caller.
40
- *
41
- * @param positionOffset
42
- * Position offset within a larger string.
43
- */
44
- declare function validate(prefixType: PrefixType, allowUPCCompanyPrefix: boolean, allowGS18Prefix: boolean, prefix: string, isFromIdentifier?: boolean, isNumericIdentifier?: boolean, positionOffset?: number): void;
45
- /**
46
- * Prefix validator.
47
- */
48
- export declare const PrefixValidator: {
49
- readonly GS1_COMPANY_PREFIX_MINIMUM_LENGTH: 4;
50
- readonly GS1_COMPANY_PREFIX_MAXIMUM_LENGTH: 12;
51
- readonly UPC_COMPANY_PREFIX_MINIMUM_LENGTH: 6;
52
- readonly UPC_COMPANY_PREFIX_MAXIMUM_LENGTH: 11;
53
- readonly GS1_8_PREFIX_MINIMUM_LENGTH: 2;
54
- readonly GS1_8_PREFIX_MAXIMUM_LENGTH: 7;
55
- readonly validate: typeof validate;
56
- };
57
- export {};
58
- //# sourceMappingURL=prefix-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefix-validator.d.ts","sourceRoot":"","sources":["../src/prefix-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAmB,MAAM,uBAAuB,CAAC;AAErF,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC5D;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,MAAM,CAAC;CAC3B;AA6ED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iBAAS,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,UAAQ,EAAE,mBAAmB,UAAQ,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAsDxM;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;CAQlB,CAAC"}
@@ -1,154 +0,0 @@
1
- import { NUMERIC_CREATOR } from "@aidc-toolkit/utility";
2
- import { i18nextGS1 } from "./locale/i18n.js";
3
- import { PrefixTypes } from "./prefix-type.js";
4
- /**
5
- * GS1 Company Prefix minimum length.
6
- */
7
- const GS1_COMPANY_PREFIX_MINIMUM_LENGTH = 4;
8
- /**
9
- * GS1 Company Prefix maximum length.
10
- */
11
- const GS1_COMPANY_PREFIX_MAXIMUM_LENGTH = 12;
12
- /**
13
- * U.P.C. Company Prefix minimum length.
14
- */
15
- const UPC_COMPANY_PREFIX_MINIMUM_LENGTH = 6;
16
- /**
17
- * U.P.C. Company Prefix maximum length.
18
- */
19
- const UPC_COMPANY_PREFIX_MAXIMUM_LENGTH = 11;
20
- /**
21
- * GS1-8 Prefix minimum length.
22
- */
23
- const GS1_8_PREFIX_MINIMUM_LENGTH = 2;
24
- /**
25
- * GS1-8 Prefix maximum length.
26
- */
27
- const GS1_8_PREFIX_MAXIMUM_LENGTH = 7;
28
- /**
29
- * Validation parameters for GS1 Company Prefix.
30
- */
31
- const GS1_COMPANY_PREFIX_VALIDATION = {
32
- minimumLength: GS1_COMPANY_PREFIX_MINIMUM_LENGTH,
33
- maximumLength: GS1_COMPANY_PREFIX_MAXIMUM_LENGTH,
34
- component: () => i18nextGS1.t("Prefix.gs1CompanyPrefix")
35
- };
36
- /**
37
- * Validation parameters for U.P.C. Company Prefix expressed as GS1 Company Prefix.
38
- */
39
- const UPC_COMPANY_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION = {
40
- minimumLength: UPC_COMPANY_PREFIX_MINIMUM_LENGTH + 1,
41
- maximumLength: UPC_COMPANY_PREFIX_MAXIMUM_LENGTH + 1,
42
- component: () => i18nextGS1.t("Prefix.gs1CompanyPrefix")
43
- };
44
- /**
45
- * Validation parameters for GS1-8 Prefix expressed as GS1 Company Prefix.
46
- */
47
- const GS1_8_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION = {
48
- minimumLength: GS1_8_PREFIX_MINIMUM_LENGTH + 5,
49
- maximumLength: GS1_8_PREFIX_MAXIMUM_LENGTH + 5,
50
- component: () => i18nextGS1.t("Prefix.gs1CompanyPrefix")
51
- };
52
- /**
53
- * Validation parameters for U.P.C. Company Prefix.
54
- */
55
- const UPC_COMPANY_PREFIX_VALIDATION = {
56
- minimumLength: UPC_COMPANY_PREFIX_MINIMUM_LENGTH,
57
- maximumLength: UPC_COMPANY_PREFIX_MAXIMUM_LENGTH,
58
- component: () => i18nextGS1.t("Prefix.upcCompanyPrefix")
59
- };
60
- /**
61
- * Validation parameters for GS1-8 Prefix.
62
- */
63
- const GS1_8_PREFIX_VALIDATION = {
64
- minimumLength: GS1_8_PREFIX_MINIMUM_LENGTH,
65
- maximumLength: GS1_8_PREFIX_MAXIMUM_LENGTH,
66
- component: () => i18nextGS1.t("Prefix.gs18Prefix")
67
- };
68
- /**
69
- * Validate a prefix.
70
- *
71
- * @param prefixType
72
- * Prefix type.
73
- *
74
- * @param allowUPCCompanyPrefix
75
- * If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
76
- *
77
- * @param allowGS18Prefix
78
- * If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
79
- *
80
- * @param prefix
81
- * Prefix.
82
- *
83
- * @param isFromIdentifier
84
- * If true, the prefix is from an identifier and should be trimmed before its character set is validated.
85
- *
86
- * @param isNumericIdentifier
87
- * If true, the prefix is from a numeric identifier and its character set will be validated by the caller.
88
- *
89
- * @param positionOffset
90
- * Position offset within a larger string.
91
- */
92
- function validate(prefixType, allowUPCCompanyPrefix, allowGS18Prefix, prefix, isFromIdentifier = false, isNumericIdentifier = false, positionOffset) {
93
- let baseValidation;
94
- // Validate the prefix type and determine the prefix validation parameters.
95
- switch (prefixType) {
96
- case PrefixTypes.GS1CompanyPrefix:
97
- if (!prefix.startsWith("0")) {
98
- baseValidation = GS1_COMPANY_PREFIX_VALIDATION;
99
- }
100
- else if (!prefix.startsWith("00000")) {
101
- if (!allowUPCCompanyPrefix) {
102
- throw new RangeError(i18nextGS1.t("Prefix.gs1CompanyPrefixCantStartWith0"));
103
- }
104
- baseValidation = UPC_COMPANY_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;
105
- }
106
- else if (!prefix.startsWith("000000")) {
107
- if (!allowGS18Prefix) {
108
- throw new RangeError(i18nextGS1.t("Prefix.gs1CompanyPrefixCantStartWith00000"));
109
- }
110
- baseValidation = GS1_8_PREFIX_AS_GS1_COMPANY_PREFIX_VALIDATION;
111
- }
112
- else {
113
- throw new RangeError(i18nextGS1.t("Prefix.gs1CompanyPrefixCantStartWith000000"));
114
- }
115
- break;
116
- case PrefixTypes.UPCCompanyPrefix:
117
- if (prefix.startsWith("0000")) {
118
- throw new RangeError(i18nextGS1.t("Prefix.upcCompanyPrefixCantStartWith0000"));
119
- }
120
- baseValidation = UPC_COMPANY_PREFIX_VALIDATION;
121
- break;
122
- case PrefixTypes.GS18Prefix:
123
- if (prefix.startsWith("0")) {
124
- throw new RangeError(i18nextGS1.t("Prefix.gs18PrefixCantStartWith0"));
125
- }
126
- baseValidation = GS1_8_PREFIX_VALIDATION;
127
- break;
128
- }
129
- const mergedValidation = {
130
- ...baseValidation,
131
- positionOffset
132
- };
133
- // If from key and numeric, key validation will take care of character set validation.
134
- if (!isFromIdentifier) {
135
- NUMERIC_CREATOR.validate(prefix, mergedValidation);
136
- }
137
- else if (!isNumericIdentifier) {
138
- // Validate only the minimum length, allowing at least one character for the (possibly non-numeric) reference.
139
- NUMERIC_CREATOR.validate(prefix.substring(0, Math.min(mergedValidation.minimumLength, prefix.length - 1)), mergedValidation);
140
- }
141
- }
142
- /**
143
- * Prefix validator.
144
- */
145
- export const PrefixValidator = {
146
- GS1_COMPANY_PREFIX_MINIMUM_LENGTH,
147
- GS1_COMPANY_PREFIX_MAXIMUM_LENGTH,
148
- UPC_COMPANY_PREFIX_MINIMUM_LENGTH,
149
- UPC_COMPANY_PREFIX_MAXIMUM_LENGTH,
150
- GS1_8_PREFIX_MINIMUM_LENGTH,
151
- GS1_8_PREFIX_MAXIMUM_LENGTH,
152
- validate
153
- };
154
- //# sourceMappingURL=prefix-validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefix-validator.js","sourceRoot":"","sources":["../src/prefix-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAsBhE;;GAEG;AACH,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C;;GAEG;AACH,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C;;GAEG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,6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AAc;KACjB,CAAC;IAEF,sFAAsF;IACtF,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpB,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACvD,CAAC;SAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC9B,8GAA8G;QAC9G,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACjI,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,iCAAiC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,iCAAiC;IACjC,2BAA2B;IAC3B,2BAA2B;IAC3B,QAAQ;CACF,CAAC"}
@@ -1,86 +0,0 @@
1
- import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
2
- import type { IdentifierType } from "./identifier-type.js";
3
- import type { ContentCharacterSet } from "./identifier-validator.js";
4
- import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator.js";
5
- import type { PrefixProvider } from "./prefix-provider";
6
- import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
7
- declare const SerializableNumericIdentifierCreator_base: import("ts-mixer/dist/types/types.js").Class<any[], SerializableNumericIdentifierValidator & AbstractNumericIdentifierCreator, typeof SerializableNumericIdentifierValidator & typeof AbstractNumericIdentifierCreator>;
8
- /**
9
- * Serializable numeric identifier creator.
10
- */
11
- export declare class SerializableNumericIdentifierCreator extends SerializableNumericIdentifierCreator_base {
12
- /**
13
- * Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix
14
- * provider type.
15
- *
16
- * @param prefixProvider
17
- * Prefix provider.
18
- *
19
- * @param identifierType
20
- * Identifier type.
21
- *
22
- * @param length
23
- * Length.
24
- *
25
- * @param serialComponentLength
26
- * Serial component length.
27
- *
28
- * @param serialComponentCharacterSet
29
- * Serial component character set.
30
- */
31
- constructor(prefixProvider: PrefixProvider, identifierType: IdentifierType, length: number, serialComponentLength: number, serialComponentCharacterSet: ContentCharacterSet);
32
- /**
33
- * Concatenate a validated base identifier with serial component(s).
34
- *
35
- * @template TTransformerInput
36
- * Transformer input type.
37
- *
38
- * @param baseIdentifier
39
- * Base identifier.
40
- *
41
- * @param serialComponentOrComponents
42
- * Serial component(s).
43
- *
44
- * @returns
45
- * Serialized identifier(s).
46
- */
47
- private concatenateValidated;
48
- /**
49
- * Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
50
- * The value is converted to a reference of the appropriate length using a numeric creator.
51
- *
52
- * @template TTransformerInput
53
- * Transformer input type.
54
- *
55
- * @param value
56
- * Numeric value of the reference.
57
- *
58
- * @param serialComponentOrComponents
59
- * Serial component(s).
60
- *
61
- * @param sparse
62
- * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
63
- *
64
- * @returns
65
- * Serialized identifiers.
66
- */
67
- createSerialized<TTransformerInput extends TransformerInput<string>>(value: number, serialComponentOrComponents: TTransformerInput, sparse?: boolean): TransformerOutput<TTransformerInput, string>;
68
- /**
69
- * Concatenate a base identifier with serial component(s).
70
- *
71
- * @template TTransformerInput
72
- * Transformer input type.
73
- *
74
- * @param baseIdentifier
75
- * Base identifier.
76
- *
77
- * @param serialComponentOrComponents
78
- * Serial component(s).
79
- *
80
- * @returns
81
- * Serialized identifier(s).
82
- */
83
- concatenate<TTransformerInput extends TransformerInput<string>>(baseIdentifier: string, serialComponentOrComponents: TTransformerInput): TransformerOutput<TTransformerInput, string>;
84
- }
85
- export {};
86
- //# sourceMappingURL=serializable-numeric-identifier-creator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEnG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;;AAExG;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,yCAA+E;IACrI;;;;;;;;;;;;;;;;;;OAkBG;gBACS,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,2BAA2B,EAAE,mBAAmB;IAM3K;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,oBAAoB;IAgC5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAInM;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,2BAA2B,EAAE,iBAAiB,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;CAKxL"}
@@ -1,116 +0,0 @@
1
- import { mapIterable } from "@aidc-toolkit/utility";
2
- import { Mixin } from "ts-mixer";
3
- import { AbstractNumericIdentifierCreator } from "./numeric-identifier-creator.js";
4
- import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
5
- /**
6
- * Serializable numeric identifier creator.
7
- */
8
- export class SerializableNumericIdentifierCreator extends Mixin(SerializableNumericIdentifierValidator, 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 serialComponentLength
23
- * Serial component length.
24
- *
25
- * @param serialComponentCharacterSet
26
- * Serial component character set.
27
- */
28
- constructor(prefixProvider, identifierType, length, serialComponentLength, serialComponentCharacterSet) {
29
- super(identifierType, length, serialComponentLength, serialComponentCharacterSet);
30
- this.init(prefixProvider, prefixProvider.gs1CompanyPrefix);
31
- }
32
- /**
33
- * Concatenate a validated base identifier with serial component(s).
34
- *
35
- * @template TTransformerInput
36
- * Transformer input type.
37
- *
38
- * @param baseIdentifier
39
- * Base identifier.
40
- *
41
- * @param serialComponentOrComponents
42
- * Serial component(s).
43
- *
44
- * @returns
45
- * Serialized identifier(s).
46
- */
47
- concatenateValidated(baseIdentifier, serialComponentOrComponents) {
48
- // TODO Refactor type when https://github.com/microsoft/TypeScript/pull/56941 released.
49
- let result;
50
- const serialComponentCreator = this.serialComponentCreator;
51
- const serialComponentValidation = this.serialComponentValidation;
52
- /**
53
- * Validate a serial component and concatenate it to the base identifier.
54
- *
55
- * @param serialComponent
56
- * Serial component.
57
- *
58
- * @returns
59
- * Serialized identifier.
60
- */
61
- function validateAndConcatenate(serialComponent) {
62
- serialComponentCreator.validate(serialComponent, serialComponentValidation);
63
- return baseIdentifier + serialComponent;
64
- }
65
- if (typeof serialComponentOrComponents !== "object") {
66
- result = validateAndConcatenate(serialComponentOrComponents);
67
- }
68
- else {
69
- result = mapIterable(serialComponentOrComponents, validateAndConcatenate);
70
- }
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type determination is handled above.
72
- return result;
73
- }
74
- /**
75
- * Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
76
- * The value is converted to a reference of the appropriate length using a numeric creator.
77
- *
78
- * @template TTransformerInput
79
- * Transformer input type.
80
- *
81
- * @param value
82
- * Numeric value of the reference.
83
- *
84
- * @param serialComponentOrComponents
85
- * Serial component(s).
86
- *
87
- * @param sparse
88
- * If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.
89
- *
90
- * @returns
91
- * Serialized identifiers.
92
- */
93
- createSerialized(value, serialComponentOrComponents, sparse) {
94
- return this.concatenateValidated(this.create(value, sparse), serialComponentOrComponents);
95
- }
96
- /**
97
- * Concatenate a base identifier with serial component(s).
98
- *
99
- * @template TTransformerInput
100
- * Transformer input type.
101
- *
102
- * @param baseIdentifier
103
- * Base identifier.
104
- *
105
- * @param serialComponentOrComponents
106
- * Serial component(s).
107
- *
108
- * @returns
109
- * Serialized identifier(s).
110
- */
111
- concatenate(baseIdentifier, serialComponentOrComponents) {
112
- this.validate(baseIdentifier);
113
- return this.concatenateValidated(baseIdentifier, serialComponentOrComponents);
114
- }
115
- }
116
- //# sourceMappingURL=serializable-numeric-identifier-creator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiD,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,oCAAqC,SAAQ,KAAK,CAAC,sCAAsC,EAAE,gCAAgC,CAAC;IACrI;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,cAA8B,EAAE,cAA8B,EAAE,MAAc,EAAE,qBAA6B,EAAE,2BAAgD;QACvK,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,2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c-toolkit/utility";
2
- import { type IdentifierType, IdentifierTypes } from "./identifier-type.js";
3
- import { type ContentCharacterSet, type IdentifierValidation } from "./identifier-validator.js";
4
- import { type NonGTINNumericIdentifierType, NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
5
- /**
6
- * Serializable numeric identifier type.
7
- */
8
- export type SerializableNumericIdentifierType = Exclude<NonGTINNumericIdentifierType, typeof IdentifierTypes.GLN | typeof IdentifierTypes.SSCC | typeof IdentifierTypes.GSRN | typeof IdentifierTypes.GSIN>;
9
- /**
10
- * Serializable numeric identifier validator. Validates both serialized and non-serialized forms of
11
- * numeric identifiers that support serialization.
12
- */
13
- export declare class SerializableNumericIdentifierValidator extends NonGTINNumericIdentifierValidator {
14
- /**
15
- * Serial component length.
16
- */
17
- private readonly _serialComponentLength;
18
- /**
19
- * Serial component character set.
20
- */
21
- private readonly _serialComponentCharacterSet;
22
- /**
23
- * Serial component validation parameters.
24
- */
25
- private readonly _serialComponentValidation;
26
- /**
27
- * Serial component creator.
28
- */
29
- private readonly _serialComponentCreator;
30
- /**
31
- * Constructor.
32
- *
33
- * @param identifierType
34
- * Identifier type.
35
- *
36
- * @param length
37
- * Length.
38
- *
39
- * @param serialComponentLength
40
- * Serial component length.
41
- *
42
- * @param serialComponentCharacterSet
43
- * Serial component character set.
44
- */
45
- constructor(identifierType: IdentifierType, length: number, serialComponentLength: number, serialComponentCharacterSet: ContentCharacterSet);
46
- /**
47
- * Get the serial component length.
48
- */
49
- get serialComponentLength(): number;
50
- /**
51
- * Get the serial component character set.
52
- */
53
- get serialComponentCharacterSet(): ContentCharacterSet;
54
- /**
55
- * Get the serial component validation parameters.
56
- */
57
- protected get serialComponentValidation(): CharacterSetValidation;
58
- /**
59
- * Get the serial component creator.
60
- */
61
- get serialComponentCreator(): CharacterSetCreator;
62
- /**
63
- * @inheritDoc
64
- */
65
- validate(identifier: string, validation?: IdentifierValidation): void;
66
- }
67
- /**
68
- * GRAI validator.
69
- */
70
- export declare const GRAI_VALIDATOR: SerializableNumericIdentifierValidator;
71
- /**
72
- * GDTI validator.
73
- */
74
- export declare const GDTI_VALIDATOR: SerializableNumericIdentifierValidator;
75
- /**
76
- * GCN validator.
77
- */
78
- export declare const GCN_VALIDATOR: SerializableNumericIdentifierValidator;
79
- //# sourceMappingURL=serializable-numeric-identifier-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializable-numeric-identifier-validator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,mBAAmB,EAAwB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtH,OAAO,EACH,KAAK,4BAA4B,EACjC,iCAAiC,EACpC,MAAM,4CAA4C,CAAC;AAGpD;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC,4BAA4B,EAAE,OAAO,eAAe,CAAC,GAAG,GAAG,OAAO,eAAe,CAAC,IAAI,GAAG,OAAO,eAAe,CAAC,IAAI,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAE5M;;;GAGG;AACH,qBAAa,sCAAuC,SAAQ,iCAAiC;IACzF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAS;IAEhD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAsB;IAEnE;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAyB;IAEpE;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAsB;IAE9D;;;;;;;;;;;;;;OAcG;gBACS,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,2BAA2B,EAAE,mBAAmB;IAe3I;;OAEG;IACH,IAAI,qBAAqB,IAAI,MAAM,CAElC;IAED;;OAEG;IACH,IAAI,2BAA2B,IAAI,mBAAmB,CAErD;IAED;;OAEG;IACH,SAAS,KAAK,yBAAyB,IAAI,sBAAsB,CAEhE;IAED;;OAEG;IACH,IAAI,sBAAsB,IAAI,mBAAmB,CAEhD;IAED;;OAEG;IACM,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI;CAOjF;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,wCAAsG,CAAC;AAElI;;GAEG;AACH,eAAO,MAAM,cAAc,wCAAsG,CAAC;AAElI;;GAEG;AACH,eAAO,MAAM,aAAa,wCAAwG,CAAC"}
@@ -1,99 +0,0 @@
1
- import { IdentifierTypes } from "./identifier-type.js";
2
- import { ContentCharacterSets } from "./identifier-validator.js";
3
- import { i18nextGS1 } from "./locale/i18n.js";
4
- import { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
5
- import { LeaderTypes } from "./numeric-identifier-validator.js";
6
- /**
7
- * Serializable numeric identifier validator. Validates both serialized and non-serialized forms of
8
- * numeric identifiers that support serialization.
9
- */
10
- export class SerializableNumericIdentifierValidator extends NonGTINNumericIdentifierValidator {
11
- /**
12
- * Serial component length.
13
- */
14
- _serialComponentLength;
15
- /**
16
- * Serial component character set.
17
- */
18
- _serialComponentCharacterSet;
19
- /**
20
- * Serial component validation parameters.
21
- */
22
- _serialComponentValidation;
23
- /**
24
- * Serial component creator.
25
- */
26
- _serialComponentCreator;
27
- /**
28
- * Constructor.
29
- *
30
- * @param identifierType
31
- * Identifier type.
32
- *
33
- * @param length
34
- * Length.
35
- *
36
- * @param serialComponentLength
37
- * Serial component length.
38
- *
39
- * @param serialComponentCharacterSet
40
- * Serial component character set.
41
- */
42
- constructor(identifierType, length, serialComponentLength, serialComponentCharacterSet) {
43
- super(identifierType, length, LeaderTypes.None);
44
- this._serialComponentLength = serialComponentLength;
45
- this._serialComponentCharacterSet = serialComponentCharacterSet;
46
- this._serialComponentValidation = {
47
- minimumLength: 1,
48
- maximumLength: serialComponentLength,
49
- component: () => i18nextGS1.t("Identifier.serialComponent")
50
- };
51
- this._serialComponentCreator = SerializableNumericIdentifierValidator.creatorFor(serialComponentCharacterSet);
52
- }
53
- /**
54
- * Get the serial component length.
55
- */
56
- get serialComponentLength() {
57
- return this._serialComponentLength;
58
- }
59
- /**
60
- * Get the serial component character set.
61
- */
62
- get serialComponentCharacterSet() {
63
- return this._serialComponentCharacterSet;
64
- }
65
- /**
66
- * Get the serial component validation parameters.
67
- */
68
- get serialComponentValidation() {
69
- return this._serialComponentValidation;
70
- }
71
- /**
72
- * Get the serial component creator.
73
- */
74
- get serialComponentCreator() {
75
- return this._serialComponentCreator;
76
- }
77
- /**
78
- * @inheritDoc
79
- */
80
- validate(identifier, validation) {
81
- super.validate(identifier.substring(0, this.length), validation);
82
- if (identifier.length > this.length) {
83
- this.serialComponentCreator.validate(identifier.substring(this.length), this._serialComponentValidation);
84
- }
85
- }
86
- }
87
- /**
88
- * GRAI validator.
89
- */
90
- export const GRAI_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GRAI, 13, 16, ContentCharacterSets.AI82);
91
- /**
92
- * GDTI validator.
93
- */
94
- export const GDTI_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GDTI, 13, 17, ContentCharacterSets.AI82);
95
- /**
96
- * GCN validator.
97
- */
98
- export const GCN_VALIDATOR = new SerializableNumericIdentifierValidator(IdentifierTypes.GCN, 13, 12, ContentCharacterSets.Numeric);
99
- //# sourceMappingURL=serializable-numeric-identifier-validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serializable-numeric-identifier-validator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E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