@aidc-toolkit/gs1 1.0.26-beta → 1.0.28-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 +32 -66
- package/dist/abstract-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-identifier-creator.js +62 -45
- package/dist/abstract-identifier-creator.js.map +1 -1
- 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 +28 -86
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-numeric-identifier-creator.js +138 -121
- package/dist/abstract-numeric-identifier-creator.js.map +1 -1
- 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/gtin-creator.d.ts +8 -13
- package/dist/gtin-creator.d.ts.map +1 -1
- package/dist/gtin-creator.js +12 -15
- package/dist/gtin-creator.js.map +1 -1
- package/dist/gtin-descriptor.d.ts +8 -3
- package/dist/gtin-descriptor.d.ts.map +1 -1
- 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 +15 -28
- package/dist/gtin-type.d.ts.map +1 -1
- package/dist/gtin-type.js +4 -28
- package/dist/gtin-type.js.map +1 -1
- package/dist/gtin-validator.d.ts +9 -23
- package/dist/gtin-validator.d.ts.map +1 -1
- package/dist/gtin-validator.js +32 -39
- package/dist/gtin-validator.js.map +1 -1
- package/dist/identifier-creator.d.ts +4 -4
- package/dist/identifier-creator.d.ts.map +1 -1
- package/dist/{creators.d.ts → identifier-creators.d.ts} +47 -10
- 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/{descriptors.d.ts → identifier-descriptors.d.ts} +20 -10
- package/dist/identifier-descriptors.d.ts.map +1 -0
- package/dist/{descriptors.js → identifier-descriptors.js} +27 -31
- 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-validator.d.ts +44 -9
- package/dist/identifier-validator.d.ts.map +1 -1
- package/dist/identifier-validator.js +109 -1
- package/dist/identifier-validator.js.map +1 -1
- package/dist/{validators.d.ts → identifier-validators.d.ts} +47 -12
- package/dist/identifier-validators.d.ts.map +1 -0
- package/dist/{validators.js → identifier-validators.js} +40 -13
- package/dist/identifier-validators.js.map +1 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- 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/non-gtin-numeric-identifier-creator.d.ts +7 -19
- package/dist/non-gtin-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-creator.js +1 -22
- package/dist/non-gtin-numeric-identifier-creator.js.map +1 -1
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts +1 -1
- package/dist/non-gtin-numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-type.d.ts +22 -3
- package/dist/non-gtin-numeric-identifier-type.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-type.js +7 -1
- package/dist/non-gtin-numeric-identifier-type.js.map +1 -1
- package/dist/non-gtin-numeric-identifier-validator.d.ts +5 -10
- package/dist/non-gtin-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/non-gtin-numeric-identifier-validator.js +5 -12
- package/dist/non-gtin-numeric-identifier-validator.js.map +1 -1
- package/dist/non-numeric-identifier-creator.d.ts +4 -9
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-creator.js +8 -10
- package/dist/non-numeric-identifier-creator.js.map +1 -1
- package/dist/non-numeric-identifier-type.d.ts +22 -3
- package/dist/non-numeric-identifier-type.d.ts.map +1 -1
- package/dist/non-numeric-identifier-type.js +7 -1
- package/dist/non-numeric-identifier-type.js.map +1 -1
- package/dist/non-numeric-identifier-validator.d.ts +3 -11
- package/dist/non-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-validator.js +8 -8
- package/dist/non-numeric-identifier-validator.js.map +1 -1
- 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 +6 -6
- package/dist/numeric-identifier-creator.d.ts.map +1 -1
- package/dist/numeric-identifier-descriptor.d.ts +2 -1
- package/dist/numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/numeric-identifier-type.d.ts +19 -24
- package/dist/numeric-identifier-type.d.ts.map +1 -1
- package/dist/numeric-identifier-type.js +4 -15
- package/dist/numeric-identifier-type.js.map +1 -1
- package/dist/numeric-identifier-validator.d.ts +20 -6
- package/dist/numeric-identifier-validator.d.ts.map +1 -1
- package/dist/numeric-identifier-validator.js +60 -1
- package/dist/numeric-identifier-validator.js.map +1 -1
- package/dist/prefix-manager.d.ts +13 -94
- package/dist/prefix-manager.d.ts.map +1 -1
- package/dist/prefix-manager.js +65 -102
- package/dist/prefix-manager.js.map +1 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +3 -31
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-creator.js +7 -21
- package/dist/serializable-numeric-identifier-creator.js.map +1 -1
- package/dist/serializable-numeric-identifier-descriptor.d.ts +1 -1
- package/dist/serializable-numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-type.d.ts +22 -2
- package/dist/serializable-numeric-identifier-type.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-type.js +7 -1
- package/dist/serializable-numeric-identifier-type.js.map +1 -1
- package/dist/serializable-numeric-identifier-validator.d.ts +3 -18
- package/dist/serializable-numeric-identifier-validator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-validator.js +17 -16
- package/dist/serializable-numeric-identifier-validator.js.map +1 -1
- package/package.json +4 -5
- package/src/abstract-identifier-creator.ts +104 -75
- package/src/abstract-non-gtin-numeric-identifier-creator.ts +81 -0
- package/src/abstract-numeric-identifier-creator.ts +185 -133
- package/src/content-character-set-creators.ts +9 -0
- package/src/gtin-creator.ts +15 -16
- package/src/gtin-descriptor.ts +9 -3
- package/src/gtin-length.ts +61 -0
- package/src/gtin-type.ts +6 -37
- package/src/gtin-validator.ts +34 -41
- package/src/identifier-creator.ts +4 -4
- package/src/identifier-creators.ts +177 -0
- package/src/{descriptors.ts → identifier-descriptors.ts} +56 -54
- package/src/identifier-extension.ts +155 -0
- package/src/identifier-validator.ts +93 -10
- package/src/{validators.ts → identifier-validators.ts} +98 -36
- package/src/index.ts +15 -9
- package/src/leader-type.ts +29 -0
- package/src/non-gtin-numeric-identifier-creator.ts +7 -22
- package/src/non-gtin-numeric-identifier-descriptor.ts +1 -1
- package/src/non-gtin-numeric-identifier-type.ts +14 -3
- package/src/non-gtin-numeric-identifier-validator.ts +5 -13
- package/src/non-numeric-identifier-creator.ts +15 -12
- package/src/non-numeric-identifier-type.ts +14 -3
- package/src/non-numeric-identifier-validator.ts +8 -9
- package/src/non-serializable-numeric-identifier-creator.ts +11 -0
- package/src/non-serializable-numeric-identifier-descriptor.ts +12 -0
- package/src/non-serializable-numeric-identifier-type.ts +22 -0
- package/src/non-serializable-numeric-identifier-validator.ts +19 -0
- package/src/numeric-identifier-creator.ts +7 -6
- package/src/numeric-identifier-descriptor.ts +2 -1
- package/src/numeric-identifier-type.ts +17 -35
- package/src/numeric-identifier-validator.ts +61 -6
- package/src/prefix-manager.ts +76 -112
- package/src/serializable-numeric-identifier-creator.ts +10 -25
- package/src/serializable-numeric-identifier-descriptor.ts +1 -1
- package/src/serializable-numeric-identifier-type.ts +14 -5
- package/src/serializable-numeric-identifier-validator.ts +17 -16
- package/test/gtin-creator.ts +9 -2
- package/test/gtin-validator.test.ts +8 -10
- package/test/identifier-creator.ts +7 -7
- package/test/mixin.test.ts +35 -0
- package/test/non-gtin-numeric-identifier-validator.ts +7 -2
- package/test/non-numeric-identifier-validator.ts +2 -2
- package/test/non-serializable-numeric-identifier-creator.ts +64 -0
- package/test/non-serializable-numeric-identifier-validator.ts +6 -0
- package/test/numeric-identifier-creator.ts +7 -2
- package/test/serializable-numeric-identifier-validator.ts +2 -2
- package/test/utility.ts +6 -6
- package/test/validator.test.ts +11 -10
- package/test/variable-measure-rcn.test.ts +23 -23
- package/dist/abstract-identifier-validator.d.ts +0 -95
- package/dist/abstract-identifier-validator.d.ts.map +0 -1
- package/dist/abstract-identifier-validator.js +0 -123
- package/dist/abstract-identifier-validator.js.map +0 -1
- package/dist/abstract-numeric-identifier-validator.d.ts +0 -35
- package/dist/abstract-numeric-identifier-validator.d.ts.map +0 -1
- package/dist/abstract-numeric-identifier-validator.js +0 -61
- package/dist/abstract-numeric-identifier-validator.js.map +0 -1
- package/dist/creators.d.ts.map +0 -1
- package/dist/creators.js +0 -62
- package/dist/creators.js.map +0 -1
- package/dist/descriptors.d.ts.map +0 -1
- package/dist/descriptors.js.map +0 -1
- package/dist/validators.d.ts.map +0 -1
- package/dist/validators.js.map +0 -1
- package/src/abstract-identifier-validator.ts +0 -140
- package/src/abstract-numeric-identifier-validator.ts +0 -69
- package/src/creators.ts +0 -113
package/dist/prefix-manager.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { GTINCreator } from "./gtin-creator.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { GTINCreator } from "./gtin-creator.js";
|
|
2
|
+
import { type IdentifierCreatorsRecord } from "./identifier-creators.js";
|
|
3
|
+
import { type IdentifierType } from "./identifier-type.js";
|
|
4
|
+
import type { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator.js";
|
|
5
|
+
import type { NonSerializableNumericIdentifierCreator } from "./non-serializable-numeric-identifier-creator.js";
|
|
4
6
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
5
7
|
import { type PrefixType } from "./prefix-type.js";
|
|
6
|
-
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
8
|
+
import type { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
7
9
|
/**
|
|
8
10
|
* Prefix manager. This is the core class for identifier creation.
|
|
9
11
|
*
|
|
@@ -25,47 +27,7 @@ import { SerializableNumericIdentifierCreator } from "./serializable-numeric-ide
|
|
|
25
27
|
* should be taken to restore it when resuming the application. A tweak factor of 0 creates a straight sequence.
|
|
26
28
|
*/
|
|
27
29
|
export declare class PrefixManager implements PrefixProvider {
|
|
28
|
-
|
|
29
|
-
* Cached prefix managers, keyed by GS1 Company Prefix.
|
|
30
|
-
*/
|
|
31
|
-
private static readonly PREFIX_MANAGERS_MAP;
|
|
32
|
-
/**
|
|
33
|
-
* Creator tweak factors. Different numeric identifier types have different tweak factors so that sparse creation
|
|
34
|
-
* generates different sequences for each.
|
|
35
|
-
*/
|
|
36
|
-
private static readonly CREATOR_TWEAK_FACTORS;
|
|
37
|
-
/**
|
|
38
|
-
* Normalized prefix type.
|
|
39
|
-
*/
|
|
40
|
-
private readonly _prefixType;
|
|
41
|
-
/**
|
|
42
|
-
* Normalized prefix.
|
|
43
|
-
*/
|
|
44
|
-
private readonly _prefix;
|
|
45
|
-
/**
|
|
46
|
-
* Prefix as GS1 Company Prefix.
|
|
47
|
-
*/
|
|
48
|
-
private readonly _gs1CompanyPrefix;
|
|
49
|
-
/**
|
|
50
|
-
* U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix}.
|
|
51
|
-
*/
|
|
52
|
-
private readonly _upcCompanyPrefix;
|
|
53
|
-
/**
|
|
54
|
-
* GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix}.
|
|
55
|
-
*/
|
|
56
|
-
private readonly _gs18Prefix;
|
|
57
|
-
/**
|
|
58
|
-
* Default tweak factor.
|
|
59
|
-
*/
|
|
60
|
-
private readonly _defaultTweakFactor;
|
|
61
|
-
/**
|
|
62
|
-
* Tweak factor.
|
|
63
|
-
*/
|
|
64
|
-
private _tweakFactor;
|
|
65
|
-
/**
|
|
66
|
-
* Cached identifier creators.
|
|
67
|
-
*/
|
|
68
|
-
private readonly _identifierCreators;
|
|
30
|
+
#private;
|
|
69
31
|
/**
|
|
70
32
|
* Constructor.
|
|
71
33
|
*
|
|
@@ -96,13 +58,6 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
96
58
|
* Get the GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix} or undefined if not.
|
|
97
59
|
*/
|
|
98
60
|
get gs18Prefix(): string | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* Set the tweak for an identifier creator if it's a numeric identifier creator.
|
|
101
|
-
*
|
|
102
|
-
* @param identifierCreator
|
|
103
|
-
* Identifier creator.
|
|
104
|
-
*/
|
|
105
|
-
private setCreatorTweak;
|
|
106
61
|
/**
|
|
107
62
|
* Get the tweak factor.
|
|
108
63
|
*/
|
|
@@ -138,48 +93,12 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
138
93
|
* Identifier type type.
|
|
139
94
|
*
|
|
140
95
|
* @param identifierType
|
|
141
|
-
* Identifier type
|
|
142
|
-
*
|
|
143
|
-
* @param constructorParameter
|
|
144
|
-
* Second constructor parameter passed to constructor callback alongside this.
|
|
145
|
-
*
|
|
146
|
-
* @param ConstructorCallback
|
|
147
|
-
* Constructor callback.
|
|
148
|
-
*
|
|
149
|
-
* @returns
|
|
150
|
-
* Identifier creator.
|
|
151
|
-
*/
|
|
152
|
-
private getIdentifierCreator;
|
|
153
|
-
/**
|
|
154
|
-
* Get non-GTIN numeric identifier creator.
|
|
155
|
-
*
|
|
156
|
-
* @param identifierType
|
|
157
|
-
* Identifier type used to construct identifier creator.
|
|
158
|
-
*
|
|
159
|
-
* @returns
|
|
160
|
-
* Identifier creator.
|
|
161
|
-
*/
|
|
162
|
-
private getNonGTINNumericIdentifierCreator;
|
|
163
|
-
/**
|
|
164
|
-
* Get serialized numeric identifier creator.
|
|
165
|
-
*
|
|
166
|
-
* @param identifierType
|
|
167
|
-
* Identifier type used to construct identifier creator.
|
|
168
|
-
*
|
|
169
|
-
* @returns
|
|
170
|
-
* Identifier creator.
|
|
171
|
-
*/
|
|
172
|
-
private getSerializableNumericIdentifierCreator;
|
|
173
|
-
/**
|
|
174
|
-
* Get non-numeric identifier creator.
|
|
175
|
-
*
|
|
176
|
-
* @param identifierType
|
|
177
|
-
* Identifier type used to construct identifier creator.
|
|
96
|
+
* Identifier type for which to retrieve or construct identifier creator.
|
|
178
97
|
*
|
|
179
98
|
* @returns
|
|
180
99
|
* Identifier creator.
|
|
181
100
|
*/
|
|
182
|
-
|
|
101
|
+
getIdentifierCreator<TIdentifierType extends IdentifierType>(identifierType: TIdentifierType): IdentifierCreatorsRecord[TIdentifierType];
|
|
183
102
|
/**
|
|
184
103
|
* Get GTIN creator.
|
|
185
104
|
*/
|
|
@@ -187,11 +106,11 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
187
106
|
/**
|
|
188
107
|
* Get GLN creator.
|
|
189
108
|
*/
|
|
190
|
-
get glnCreator():
|
|
109
|
+
get glnCreator(): NonSerializableNumericIdentifierCreator;
|
|
191
110
|
/**
|
|
192
111
|
* Get SSCC creator.
|
|
193
112
|
*/
|
|
194
|
-
get ssccCreator():
|
|
113
|
+
get ssccCreator(): NonSerializableNumericIdentifierCreator;
|
|
195
114
|
/**
|
|
196
115
|
* Get GRAI creator.
|
|
197
116
|
*/
|
|
@@ -203,7 +122,7 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
203
122
|
/**
|
|
204
123
|
* Get GSRN creator.
|
|
205
124
|
*/
|
|
206
|
-
get gsrnCreator():
|
|
125
|
+
get gsrnCreator(): NonSerializableNumericIdentifierCreator;
|
|
207
126
|
/**
|
|
208
127
|
* Get GDTI creator.
|
|
209
128
|
*/
|
|
@@ -215,7 +134,7 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
215
134
|
/**
|
|
216
135
|
* Get GSIN creator.
|
|
217
136
|
*/
|
|
218
|
-
get gsinCreator():
|
|
137
|
+
get gsinCreator(): NonSerializableNumericIdentifierCreator;
|
|
219
138
|
/**
|
|
220
139
|
* Get GCN creator.
|
|
221
140
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-manager.d.ts","sourceRoot":"","sources":["../src/prefix-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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;;;;;OAWG;IACH,oBAAoB,CAAC,eAAe,SAAS,cAAc,EAAE,cAAc,EAAE,eAAe,GAAG,wBAAwB,CAAC,eAAe,CAAC;IA0BxI;;OAEG;IACH,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,uCAAuC,CAExD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,uCAAuC,CAEzD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,oCAAoC,CAEtD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,2BAA2B,CAE7C;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,uCAAuC,CAEzD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,oCAAoC,CAEtD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,2BAA2B,CAE7C;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,uCAAuC,CAEzD;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,oCAAoC,CAErD;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,2BAA2B,CAE7C;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,2BAA2B,CAE5C;CACJ"}
|
package/dist/prefix-manager.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
var _a;
|
|
2
|
+
import { GTIN_BASE_TYPES } from "./gtin-length.js";
|
|
3
|
+
import { IdentifierCreatorConstructors, isNumericIdentifierCreator } from "./identifier-creators.js";
|
|
4
4
|
import { IdentifierTypes } from "./identifier-type.js";
|
|
5
5
|
import { i18nextGS1 } from "./locale/i18n.js";
|
|
6
|
-
import { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator.js";
|
|
7
|
-
import { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator.js";
|
|
8
6
|
import { PrefixTypes } from "./prefix-type.js";
|
|
9
7
|
import { PrefixValidator } from "./prefix-validator.js";
|
|
10
|
-
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
11
8
|
/**
|
|
12
9
|
* Prefix manager. This is the core class for identifier creation.
|
|
13
10
|
*
|
|
@@ -32,12 +29,12 @@ export class PrefixManager {
|
|
|
32
29
|
/**
|
|
33
30
|
* Cached prefix managers, keyed by GS1 Company Prefix.
|
|
34
31
|
*/
|
|
35
|
-
static PREFIX_MANAGERS_MAP = new Map();
|
|
32
|
+
static #PREFIX_MANAGERS_MAP = new Map();
|
|
36
33
|
/**
|
|
37
34
|
* Creator tweak factors. Different numeric identifier types have different tweak factors so that sparse creation
|
|
38
35
|
* generates different sequences for each.
|
|
39
36
|
*/
|
|
40
|
-
static CREATOR_TWEAK_FACTORS = {
|
|
37
|
+
static #CREATOR_TWEAK_FACTORS = {
|
|
41
38
|
GTIN: 1987n,
|
|
42
39
|
GLN: 4241n,
|
|
43
40
|
SSCC: 8087n,
|
|
@@ -50,35 +47,35 @@ export class PrefixManager {
|
|
|
50
47
|
/**
|
|
51
48
|
* Normalized prefix type.
|
|
52
49
|
*/
|
|
53
|
-
|
|
50
|
+
#prefixType;
|
|
54
51
|
/**
|
|
55
52
|
* Normalized prefix.
|
|
56
53
|
*/
|
|
57
|
-
|
|
54
|
+
#prefix;
|
|
58
55
|
/**
|
|
59
56
|
* Prefix as GS1 Company Prefix.
|
|
60
57
|
*/
|
|
61
|
-
|
|
58
|
+
#gs1CompanyPrefix;
|
|
62
59
|
/**
|
|
63
60
|
* U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix}.
|
|
64
61
|
*/
|
|
65
|
-
|
|
62
|
+
#upcCompanyPrefix;
|
|
66
63
|
/**
|
|
67
64
|
* GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix}.
|
|
68
65
|
*/
|
|
69
|
-
|
|
66
|
+
#gs18Prefix;
|
|
70
67
|
/**
|
|
71
68
|
* Default tweak factor.
|
|
72
69
|
*/
|
|
73
|
-
|
|
70
|
+
#defaultTweakFactor;
|
|
74
71
|
/**
|
|
75
72
|
* Tweak factor.
|
|
76
73
|
*/
|
|
77
|
-
|
|
74
|
+
#tweakFactor = 0n;
|
|
78
75
|
/**
|
|
79
76
|
* Cached identifier creators.
|
|
80
77
|
*/
|
|
81
|
-
|
|
78
|
+
#identifierCreators = {};
|
|
82
79
|
/**
|
|
83
80
|
* Constructor.
|
|
84
81
|
*
|
|
@@ -90,44 +87,44 @@ export class PrefixManager {
|
|
|
90
87
|
*/
|
|
91
88
|
constructor(prefixType, prefix) {
|
|
92
89
|
const normalizedPrefixProvider = PrefixValidator.normalize(prefixType, prefix);
|
|
93
|
-
this
|
|
94
|
-
this
|
|
95
|
-
this
|
|
96
|
-
this
|
|
97
|
-
this
|
|
90
|
+
this.#prefixType = normalizedPrefixProvider.prefixType;
|
|
91
|
+
this.#prefix = normalizedPrefixProvider.prefix;
|
|
92
|
+
this.#gs1CompanyPrefix = normalizedPrefixProvider.gs1CompanyPrefix;
|
|
93
|
+
this.#upcCompanyPrefix = normalizedPrefixProvider.upcCompanyPrefix;
|
|
94
|
+
this.#gs18Prefix = normalizedPrefixProvider.gs18Prefix;
|
|
98
95
|
// Default tweak factor is the numeric value of the GS1 Company Prefix preceded by '1'.
|
|
99
|
-
this
|
|
96
|
+
this.#defaultTweakFactor = BigInt(`1${this.gs1CompanyPrefix}`);
|
|
100
97
|
this.resetTweakFactor();
|
|
101
98
|
}
|
|
102
99
|
/**
|
|
103
100
|
* Get the prefix type.
|
|
104
101
|
*/
|
|
105
102
|
get prefixType() {
|
|
106
|
-
return this
|
|
103
|
+
return this.#prefixType;
|
|
107
104
|
}
|
|
108
105
|
/**
|
|
109
106
|
* Get the prefix.
|
|
110
107
|
*/
|
|
111
108
|
get prefix() {
|
|
112
|
-
return this
|
|
109
|
+
return this.#prefix;
|
|
113
110
|
}
|
|
114
111
|
/**
|
|
115
112
|
* Get the GS1 Company Prefix.
|
|
116
113
|
*/
|
|
117
114
|
get gs1CompanyPrefix() {
|
|
118
|
-
return this
|
|
115
|
+
return this.#gs1CompanyPrefix;
|
|
119
116
|
}
|
|
120
117
|
/**
|
|
121
118
|
* Get the U.P.C. Company Prefix if prefix type is {@linkcode PrefixTypes.UPCCompanyPrefix} or undefined if not.
|
|
122
119
|
*/
|
|
123
120
|
get upcCompanyPrefix() {
|
|
124
|
-
return this
|
|
121
|
+
return this.#upcCompanyPrefix;
|
|
125
122
|
}
|
|
126
123
|
/**
|
|
127
124
|
* Get the GS1-8 Prefix if prefix type is {@linkcode PrefixTypes.GS18Prefix} or undefined if not.
|
|
128
125
|
*/
|
|
129
126
|
get gs18Prefix() {
|
|
130
|
-
return this
|
|
127
|
+
return this.#gs18Prefix;
|
|
131
128
|
}
|
|
132
129
|
/**
|
|
133
130
|
* Set the tweak for an identifier creator if it's a numeric identifier creator.
|
|
@@ -135,17 +132,17 @@ export class PrefixManager {
|
|
|
135
132
|
* @param identifierCreator
|
|
136
133
|
* Identifier creator.
|
|
137
134
|
*/
|
|
138
|
-
setCreatorTweak(identifierCreator) {
|
|
135
|
+
#setCreatorTweak(identifierCreator) {
|
|
139
136
|
if (isNumericIdentifierCreator(identifierCreator)) {
|
|
140
137
|
// eslint-disable-next-line no-param-reassign -- Method purpose is to set the tweak.
|
|
141
|
-
identifierCreator.tweak = this.tweakFactor *
|
|
138
|
+
identifierCreator.tweak = this.tweakFactor * _a.#CREATOR_TWEAK_FACTORS[identifierCreator.identifierType];
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
/**
|
|
145
142
|
* Get the tweak factor.
|
|
146
143
|
*/
|
|
147
144
|
get tweakFactor() {
|
|
148
|
-
return this
|
|
145
|
+
return this.#tweakFactor;
|
|
149
146
|
}
|
|
150
147
|
/**
|
|
151
148
|
* Set the tweak factor.
|
|
@@ -155,10 +152,10 @@ export class PrefixManager {
|
|
|
155
152
|
*/
|
|
156
153
|
set tweakFactor(value) {
|
|
157
154
|
const tweakFactor = BigInt(value);
|
|
158
|
-
if (this
|
|
159
|
-
this
|
|
160
|
-
for (const creator of Object.values(this
|
|
161
|
-
this
|
|
155
|
+
if (this.#tweakFactor !== tweakFactor) {
|
|
156
|
+
this.#tweakFactor = tweakFactor;
|
|
157
|
+
for (const creator of Object.values(this.#identifierCreators)) {
|
|
158
|
+
this.#setCreatorTweak(creator);
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
161
|
}
|
|
@@ -166,7 +163,7 @@ export class PrefixManager {
|
|
|
166
163
|
* Reset the tweak factor to its default (numeric value of the GS1 Company Prefix preceded by '1').
|
|
167
164
|
*/
|
|
168
165
|
resetTweakFactor() {
|
|
169
|
-
this.tweakFactor = this
|
|
166
|
+
this.tweakFactor = this.#defaultTweakFactor;
|
|
170
167
|
}
|
|
171
168
|
/**
|
|
172
169
|
* Get a prefix manager.
|
|
@@ -183,10 +180,10 @@ export class PrefixManager {
|
|
|
183
180
|
static get(prefixType, prefix) {
|
|
184
181
|
// Normalization will occur in constructor as well, but it's necessary here for the map.
|
|
185
182
|
const normalizedPrefixProvider = PrefixValidator.normalize(prefixType, prefix);
|
|
186
|
-
let prefixManager =
|
|
183
|
+
let prefixManager = _a.#PREFIX_MANAGERS_MAP.get(normalizedPrefixProvider.gs1CompanyPrefix);
|
|
187
184
|
if (prefixManager === undefined) {
|
|
188
|
-
prefixManager = new
|
|
189
|
-
|
|
185
|
+
prefixManager = new _a(normalizedPrefixProvider.prefixType, normalizedPrefixProvider.prefix);
|
|
186
|
+
_a.#PREFIX_MANAGERS_MAP.set(normalizedPrefixProvider.gs1CompanyPrefix, prefixManager);
|
|
190
187
|
}
|
|
191
188
|
return prefixManager;
|
|
192
189
|
}
|
|
@@ -197,138 +194,104 @@ export class PrefixManager {
|
|
|
197
194
|
* Identifier type type.
|
|
198
195
|
*
|
|
199
196
|
* @param identifierType
|
|
200
|
-
* Identifier type
|
|
201
|
-
*
|
|
202
|
-
* @param constructorParameter
|
|
203
|
-
* Second constructor parameter passed to constructor callback alongside this.
|
|
204
|
-
*
|
|
205
|
-
* @param ConstructorCallback
|
|
206
|
-
* Constructor callback.
|
|
197
|
+
* Identifier type for which to retrieve or construct identifier creator.
|
|
207
198
|
*
|
|
208
199
|
* @returns
|
|
209
200
|
* Identifier creator.
|
|
210
201
|
*/
|
|
211
|
-
getIdentifierCreator(identifierType
|
|
212
|
-
let creator = this
|
|
202
|
+
getIdentifierCreator(identifierType) {
|
|
203
|
+
let creator = this.#identifierCreators[identifierType];
|
|
213
204
|
if (creator === undefined) {
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}));
|
|
205
|
+
if (identifierType === IdentifierTypes.GTIN) {
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Types are known to match.
|
|
207
|
+
creator = new IdentifierCreatorConstructors.GTIN(this, GTIN_BASE_TYPES[this.prefixType]);
|
|
218
208
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
209
|
+
else {
|
|
210
|
+
if (this.prefixType === PrefixTypes.GS18Prefix) {
|
|
211
|
+
throw new RangeError(i18nextGS1.t("Prefix.identifierTypeNotSupportedByGS18Prefix", {
|
|
212
|
+
identifierType
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Types are known to match.
|
|
216
|
+
creator = new IdentifierCreatorConstructors[identifierType](this, identifierType);
|
|
217
|
+
}
|
|
218
|
+
this.#setCreatorTweak(creator);
|
|
219
|
+
this.#identifierCreators[identifierType] = creator;
|
|
222
220
|
}
|
|
223
221
|
return creator;
|
|
224
222
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Get non-GTIN numeric identifier creator.
|
|
227
|
-
*
|
|
228
|
-
* @param identifierType
|
|
229
|
-
* Identifier type used to construct identifier creator.
|
|
230
|
-
*
|
|
231
|
-
* @returns
|
|
232
|
-
* Identifier creator.
|
|
233
|
-
*/
|
|
234
|
-
getNonGTINNumericIdentifierCreator(identifierType) {
|
|
235
|
-
return this.getIdentifierCreator(identifierType, identifierType, NonGTINNumericIdentifierCreator);
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Get serialized numeric identifier creator.
|
|
239
|
-
*
|
|
240
|
-
* @param identifierType
|
|
241
|
-
* Identifier type used to construct identifier creator.
|
|
242
|
-
*
|
|
243
|
-
* @returns
|
|
244
|
-
* Identifier creator.
|
|
245
|
-
*/
|
|
246
|
-
getSerializableNumericIdentifierCreator(identifierType) {
|
|
247
|
-
return this.getIdentifierCreator(identifierType, identifierType, SerializableNumericIdentifierCreator);
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Get non-numeric identifier creator.
|
|
251
|
-
*
|
|
252
|
-
* @param identifierType
|
|
253
|
-
* Identifier type used to construct identifier creator.
|
|
254
|
-
*
|
|
255
|
-
* @returns
|
|
256
|
-
* Identifier creator.
|
|
257
|
-
*/
|
|
258
|
-
getNonNumericIdentifierCreator(identifierType) {
|
|
259
|
-
return this.getIdentifierCreator(identifierType, identifierType, NonNumericIdentifierCreator);
|
|
260
|
-
}
|
|
261
223
|
/**
|
|
262
224
|
* Get GTIN creator.
|
|
263
225
|
*/
|
|
264
226
|
get gtinCreator() {
|
|
265
|
-
return this.getIdentifierCreator(IdentifierTypes.GTIN
|
|
227
|
+
return this.getIdentifierCreator(IdentifierTypes.GTIN);
|
|
266
228
|
}
|
|
267
229
|
/**
|
|
268
230
|
* Get GLN creator.
|
|
269
231
|
*/
|
|
270
232
|
get glnCreator() {
|
|
271
|
-
return this.
|
|
233
|
+
return this.getIdentifierCreator(IdentifierTypes.GLN);
|
|
272
234
|
}
|
|
273
235
|
/**
|
|
274
236
|
* Get SSCC creator.
|
|
275
237
|
*/
|
|
276
238
|
get ssccCreator() {
|
|
277
|
-
return this.
|
|
239
|
+
return this.getIdentifierCreator(IdentifierTypes.SSCC);
|
|
278
240
|
}
|
|
279
241
|
/**
|
|
280
242
|
* Get GRAI creator.
|
|
281
243
|
*/
|
|
282
244
|
get graiCreator() {
|
|
283
|
-
return this.
|
|
245
|
+
return this.getIdentifierCreator(IdentifierTypes.GRAI);
|
|
284
246
|
}
|
|
285
247
|
/**
|
|
286
248
|
* Get GIAI creator.
|
|
287
249
|
*/
|
|
288
250
|
get giaiCreator() {
|
|
289
|
-
return this.
|
|
251
|
+
return this.getIdentifierCreator(IdentifierTypes.GIAI);
|
|
290
252
|
}
|
|
291
253
|
/**
|
|
292
254
|
* Get GSRN creator.
|
|
293
255
|
*/
|
|
294
256
|
get gsrnCreator() {
|
|
295
|
-
return this.
|
|
257
|
+
return this.getIdentifierCreator(IdentifierTypes.GSRN);
|
|
296
258
|
}
|
|
297
259
|
/**
|
|
298
260
|
* Get GDTI creator.
|
|
299
261
|
*/
|
|
300
262
|
get gdtiCreator() {
|
|
301
|
-
return this.
|
|
263
|
+
return this.getIdentifierCreator(IdentifierTypes.GDTI);
|
|
302
264
|
}
|
|
303
265
|
/**
|
|
304
266
|
* Get GINC creator.
|
|
305
267
|
*/
|
|
306
268
|
get gincCreator() {
|
|
307
|
-
return this.
|
|
269
|
+
return this.getIdentifierCreator(IdentifierTypes.GINC);
|
|
308
270
|
}
|
|
309
271
|
/**
|
|
310
272
|
* Get GSIN creator.
|
|
311
273
|
*/
|
|
312
274
|
get gsinCreator() {
|
|
313
|
-
return this.
|
|
275
|
+
return this.getIdentifierCreator(IdentifierTypes.GSIN);
|
|
314
276
|
}
|
|
315
277
|
/**
|
|
316
278
|
* Get GCN creator.
|
|
317
279
|
*/
|
|
318
280
|
get gcnCreator() {
|
|
319
|
-
return this.
|
|
281
|
+
return this.getIdentifierCreator(IdentifierTypes.GCN);
|
|
320
282
|
}
|
|
321
283
|
/**
|
|
322
284
|
* Get CPID creator.
|
|
323
285
|
*/
|
|
324
286
|
get cpidCreator() {
|
|
325
|
-
return this.
|
|
287
|
+
return this.getIdentifierCreator(IdentifierTypes.CPID);
|
|
326
288
|
}
|
|
327
289
|
/**
|
|
328
290
|
* Get GMN creator.
|
|
329
291
|
*/
|
|
330
292
|
get gmnCreator() {
|
|
331
|
-
return this.
|
|
293
|
+
return this.getIdentifierCreator(IdentifierTypes.GMN);
|
|
332
294
|
}
|
|
333
295
|
}
|
|
296
|
+
_a = PrefixManager;
|
|
334
297
|
//# sourceMappingURL=prefix-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-manager.js","sourceRoot":"","sources":["../src/prefix-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefix-manager.js","sourceRoot":"","sources":["../src/prefix-manager.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EACH,6BAA6B,EAE7B,0BAA0B,EAE7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAuB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,aAAa;IACtB;;OAEG;IACH,MAAM,CAAU,oBAAoB,GAAG,IAAI,GAAG,EAAyB,CAAC;IAExE;;;OAGG;IACH,MAAM,CAAU,sBAAsB,GAAoD;QACtF,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,KAAK;KACb,CAAC;IAEF;;OAEG;IACM,WAAW,CAAa;IAEjC;;OAEG;IACM,OAAO,CAAS;IAEzB;;OAEG;IACM,iBAAiB,CAAS;IAEnC;;OAEG;IACM,iBAAiB,CAAqB;IAE/C;;OAEG;IACM,WAAW,CAAqB;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AAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC"}
|
|
@@ -1,43 +1,15 @@
|
|
|
1
1
|
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
|
-
import { AbstractNumericIdentifierCreator } from "./abstract-numeric-identifier-creator.js";
|
|
3
|
-
import type { PrefixProvider } from "./prefix-provider.js";
|
|
4
2
|
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
5
3
|
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
6
|
-
declare const SerializableNumericIdentifierCreator_base: import("
|
|
4
|
+
declare const SerializableNumericIdentifierCreator_base: abstract new (...args: [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GRAI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GDTI"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GCN"]) => SerializableNumericIdentifierValidator & import("./non-gtin-numeric-identifier-creator.js").NonGTINNumericIdentifierCreator<SerializableNumericIdentifierType>;
|
|
7
5
|
/**
|
|
8
6
|
* Serializable numeric identifier creator.
|
|
9
7
|
*/
|
|
10
8
|
export declare class SerializableNumericIdentifierCreator extends SerializableNumericIdentifierCreator_base {
|
|
11
|
-
|
|
12
|
-
* Constructor. Typically called internally by a prefix manager but may be called by other code with another prefix
|
|
13
|
-
* provider type.
|
|
14
|
-
*
|
|
15
|
-
* @param prefixProvider
|
|
16
|
-
* Prefix provider.
|
|
17
|
-
*
|
|
18
|
-
* @param identifierType
|
|
19
|
-
* Identifier type.
|
|
20
|
-
*/
|
|
21
|
-
constructor(prefixProvider: PrefixProvider, identifierType: SerializableNumericIdentifierType);
|
|
22
|
-
/**
|
|
23
|
-
* Concatenate a validated base identifier with serial component(s).
|
|
24
|
-
*
|
|
25
|
-
* @template TTransformerInput
|
|
26
|
-
* Transformer input type.
|
|
27
|
-
*
|
|
28
|
-
* @param baseIdentifier
|
|
29
|
-
* Base identifier.
|
|
30
|
-
*
|
|
31
|
-
* @param serialComponentOrComponents
|
|
32
|
-
* Serial component(s).
|
|
33
|
-
*
|
|
34
|
-
* @returns
|
|
35
|
-
* Serialized identifier(s).
|
|
36
|
-
*/
|
|
37
|
-
private concatenateValidated;
|
|
9
|
+
#private;
|
|
38
10
|
/**
|
|
39
11
|
* Create serialized identifier(s) with a reference based on a numeric value concatenated with serial component(s).
|
|
40
|
-
* The value is converted to a reference of the appropriate length using
|
|
12
|
+
* The value is converted to a reference of the appropriate length using {@linkcode NUMERIC_CREATOR}.
|
|
41
13
|
*
|
|
42
14
|
* @template TTransformerInput
|
|
43
15
|
* Transformer input type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,EAAgC,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEpH,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;;AAExG;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,yCAEjB;;IAgDrC;;;;;;;;;;;;;;;;;;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"}
|