@aidc-toolkit/gs1 1.0.27-beta → 1.0.31-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 +6 -40
- package/dist/abstract-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-identifier-creator.js +3 -9
- package/dist/abstract-identifier-creator.js.map +1 -1
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts +7 -13
- package/dist/abstract-non-gtin-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-non-gtin-numeric-identifier-creator.js +8 -11
- package/dist/abstract-non-gtin-numeric-identifier-creator.js.map +1 -1
- package/dist/abstract-numeric-identifier-creator.d.ts +7 -16
- package/dist/abstract-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/abstract-numeric-identifier-creator.js +3 -9
- package/dist/abstract-numeric-identifier-creator.js.map +1 -1
- package/dist/gtin-creator.d.ts +2 -2
- package/dist/gtin-creator.d.ts.map +1 -1
- package/dist/gtin-creator.js +1 -1
- package/dist/gtin-creator.js.map +1 -1
- package/dist/identifier-creators.d.ts +32 -4
- package/dist/identifier-creators.d.ts.map +1 -1
- package/dist/identifier-creators.js +18 -0
- package/dist/identifier-creators.js.map +1 -1
- package/dist/identifier-validators.d.ts +28 -3
- package/dist/identifier-validators.d.ts.map +1 -1
- package/dist/identifier-validators.js +15 -1
- package/dist/identifier-validators.js.map +1 -1
- package/dist/non-numeric-identifier-creator.d.ts +1 -1
- package/dist/non-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-numeric-identifier-creator.js.map +1 -1
- package/dist/non-serializable-numeric-identifier-creator.d.ts +1 -1
- package/dist/non-serializable-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/non-serializable-numeric-identifier-creator.js.map +1 -1
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts +5 -0
- package/dist/non-serializable-numeric-identifier-descriptor.d.ts.map +1 -1
- package/dist/prefix-manager.d.ts +19 -4
- package/dist/prefix-manager.d.ts.map +1 -1
- package/dist/prefix-manager.js +27 -69
- package/dist/prefix-manager.js.map +1 -1
- package/dist/serializable-numeric-identifier-creator.d.ts +1 -1
- package/dist/serializable-numeric-identifier-creator.d.ts.map +1 -1
- package/dist/serializable-numeric-identifier-creator.js.map +1 -1
- package/package.json +4 -4
- package/src/abstract-identifier-creator.ts +18 -70
- package/src/abstract-non-gtin-numeric-identifier-creator.ts +22 -27
- package/src/abstract-numeric-identifier-creator.ts +21 -38
- package/src/gtin-creator.ts +2 -4
- package/src/identifier-creators.ts +54 -4
- package/src/identifier-validators.ts +50 -3
- package/src/non-numeric-identifier-creator.ts +1 -3
- package/src/non-serializable-numeric-identifier-creator.ts +1 -2
- package/src/non-serializable-numeric-identifier-descriptor.ts +5 -0
- package/src/prefix-manager.ts +37 -76
- package/src/serializable-numeric-identifier-creator.ts +1 -2
- package/test/mixin.test.ts +35 -0
- package/test/non-numeric-identifier-validator.ts +2 -2
- package/test/serializable-numeric-identifier-validator.ts +2 -2
- package/test/utility.ts +6 -6
- package/tsconfig.json +1 -0
|
@@ -2,7 +2,7 @@ import { type CharacterSetValidation, type TransformerInput, type TransformerOut
|
|
|
2
2
|
import type { NonNumericIdentifierType } from "./non-numeric-identifier-type.js";
|
|
3
3
|
import { type NonNumericIdentifierValidation, NonNumericIdentifierValidator } from "./non-numeric-identifier-validator.js";
|
|
4
4
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
5
|
-
declare const NonNumericIdentifierCreator_base: import("./abstract-identifier-creator.js").IdentifierCreatorConstructor<
|
|
5
|
+
declare const NonNumericIdentifierCreator_base: import("./abstract-identifier-creator.js").IdentifierCreatorConstructor<NonNumericIdentifierType, NonNumericIdentifierValidation, NonNumericIdentifierValidator>;
|
|
6
6
|
/**
|
|
7
7
|
* Non-numeric identifier creator.
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACH,KAAK,8BAA8B,EACnC,6BAA6B,EAChC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;;AAE3D;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,
|
|
1
|
+
{"version":3,"file":"non-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EACH,KAAK,8BAA8B,EACnC,6BAA6B,EAChC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;;AAE3D;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,gCAGjB;;IAM5B;;;;;;;;OAQG;gBACS,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,wBAAwB;IAWpF;;OAEG;IACH,SAAS,KAAK,mBAAmB,IAAI,sBAAsB,CAE1D;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,iBAAiB,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,qBAAqB,EAAE,iBAAiB,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,CAAC;CAmCrJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-numeric-identifier-creator.ts"],"names":[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AG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC;SACxD,CAAC;IACN,CAAC;IAED;;OAEG;IACH,IAAc,mBAAmB;QAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAqD,qBAAwC;QAC/F,uFAAuF;QACvF,IAAI,MAAiC,CAAC;QAEtC,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC/C,MAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,0BAA0B,GAAG,IAAI,CAAC,0BAA0B,CAAC;QAEnE;;;;;;;;WAQG;QACH,SAAS,iBAAiB,CAAC,SAAiB;YACxC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;YAE1D,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;YAE7C,OAAO,0BAA0B,CAAC,CAAC,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACtH,CAAC;QAED,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACJ,MAAM,GAAG,WAAW,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;QACnE,CAAC;QAED,+GAA+G;QAC/G,OAAO,MAAsD,CAAC;IAClE,CAAC;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NonSerializableNumericIdentifierType } from "./non-serializable-numeric-identifier-type.js";
|
|
2
2
|
import { NonSerializableNumericIdentifierValidator } from "./non-serializable-numeric-identifier-validator.js";
|
|
3
|
-
declare const NonSerializableNumericIdentifierCreator_base: abstract new (prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType:
|
|
3
|
+
declare const NonSerializableNumericIdentifierCreator_base: abstract new (...args: [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GLN"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "SSCC"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GSRN"] | [prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType: "GSIN"]) => NonSerializableNumericIdentifierValidator & import("./non-gtin-numeric-identifier-creator.js").NonGTINNumericIdentifierCreator<NonSerializableNumericIdentifierType>;
|
|
4
4
|
/**
|
|
5
5
|
* Non-serializable numeric identifier creator.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAC1G,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;;AAE/G;;GAEG;AACH,qBAAa,uCAAwC,SAAQ,
|
|
1
|
+
{"version":3,"file":"non-serializable-numeric-identifier-creator.d.ts","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AAC1G,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;;AAE/G;;GAEG;AACH,qBAAa,uCAAwC,SAAQ,4CAEjB;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEjH,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAE/G;;GAEG;AACH,MAAM,OAAO,uCAAwC,SAAQ,4CAA4C,
|
|
1
|
+
{"version":3,"file":"non-serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEjH,OAAO,EAAE,yCAAyC,EAAE,MAAM,oDAAoD,CAAC;AAE/G;;GAEG;AACH,MAAM,OAAO,uCAAwC,SAAQ,4CAA4C,CAEvG,yCAAyC,CAAC;CAC3C"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { LeaderTypes } from "./leader-type.js";
|
|
1
2
|
import type { NonGTINNumericIdentifierDescriptor } from "./non-gtin-numeric-identifier-descriptor.js";
|
|
2
3
|
/**
|
|
3
4
|
* Non-serializable numeric identifier descriptor.
|
|
4
5
|
*/
|
|
5
6
|
export interface NonSerializableNumericIdentifierDescriptor extends NonGTINNumericIdentifierDescriptor {
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
readonly leaderType: typeof LeaderTypes.None | typeof LeaderTypes.ExtensionDigit;
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=non-serializable-numeric-identifier-descriptor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-serializable-numeric-identifier-descriptor.d.ts","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,0CAA2C,SAAQ,kCAAkC;
|
|
1
|
+
{"version":3,"file":"non-serializable-numeric-identifier-descriptor.d.ts","sourceRoot":"","sources":["../src/non-serializable-numeric-identifier-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,0CAA2C,SAAQ,kCAAkC;IAClG;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,WAAW,CAAC,IAAI,GAAG,OAAO,WAAW,CAAC,cAAc,CAAC;CACpF"}
|
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
|
*
|
|
@@ -84,6 +86,19 @@ export declare class PrefixManager implements PrefixProvider {
|
|
|
84
86
|
* Prefix manager with normalized prefix type and prefix.
|
|
85
87
|
*/
|
|
86
88
|
static get(prefixType: PrefixType, prefix: string): PrefixManager;
|
|
89
|
+
/**
|
|
90
|
+
* Get an identifier creator.
|
|
91
|
+
*
|
|
92
|
+
* @template TIdentifierType
|
|
93
|
+
* Identifier type type.
|
|
94
|
+
*
|
|
95
|
+
* @param identifierType
|
|
96
|
+
* Identifier type for which to retrieve or construct identifier creator.
|
|
97
|
+
*
|
|
98
|
+
* @returns
|
|
99
|
+
* Identifier creator.
|
|
100
|
+
*/
|
|
101
|
+
getIdentifierCreator<TIdentifierType extends IdentifierType>(identifierType: TIdentifierType): IdentifierCreatorsRecord[TIdentifierType];
|
|
87
102
|
/**
|
|
88
103
|
* Get GTIN creator.
|
|
89
104
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-manager.d.ts","sourceRoot":"","sources":["../src/prefix-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"prefix-manager.d.ts","sourceRoot":"","sources":["../src/prefix-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,EAEH,KAAK,wBAAwB,EAGhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAE5E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,kDAAkD,CAAC;AAEhH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,aAAc,YAAW,cAAc;;IA6DhD;;;;;;;;OAQG;gBACS,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;IAelD;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;OAEG;IACH,IAAI,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAeD;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACH,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAUrC;IAED;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAIxB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa;IAcjE;;;;;;;;;;;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,14 +1,10 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { GTINCreator } from "./gtin-creator.js";
|
|
3
2
|
import { GTIN_BASE_TYPES } from "./gtin-length.js";
|
|
4
|
-
import { isNumericIdentifierCreator } from "./identifier-creators.js";
|
|
3
|
+
import { IdentifierCreatorConstructors, isNumericIdentifierCreator } from "./identifier-creators.js";
|
|
5
4
|
import { IdentifierTypes } from "./identifier-type.js";
|
|
6
5
|
import { i18nextGS1 } from "./locale/i18n.js";
|
|
7
|
-
import { NonNumericIdentifierCreator } from "./non-numeric-identifier-creator.js";
|
|
8
|
-
import { NonSerializableNumericIdentifierCreator } from "./non-serializable-numeric-identifier-creator.js";
|
|
9
6
|
import { PrefixTypes } from "./prefix-type.js";
|
|
10
7
|
import { PrefixValidator } from "./prefix-validator.js";
|
|
11
|
-
import { SerializableNumericIdentifierCreator } from "./serializable-numeric-identifier-creator.js";
|
|
12
8
|
/**
|
|
13
9
|
* Prefix manager. This is the core class for identifier creation.
|
|
14
10
|
*
|
|
@@ -197,142 +193,104 @@ export class PrefixManager {
|
|
|
197
193
|
* @template TIdentifierType
|
|
198
194
|
* Identifier type type.
|
|
199
195
|
*
|
|
200
|
-
* @template TConstructorArgument
|
|
201
|
-
* Second constructor argument type.
|
|
202
|
-
*
|
|
203
196
|
* @param identifierType
|
|
204
|
-
* Identifier type
|
|
205
|
-
*
|
|
206
|
-
* @param constructorArgument
|
|
207
|
-
* Second constructor argument passed to constructor callback alongside this.
|
|
208
|
-
*
|
|
209
|
-
* @param ConstructorCallback
|
|
210
|
-
* Constructor callback.
|
|
197
|
+
* Identifier type for which to retrieve or construct identifier creator.
|
|
211
198
|
*
|
|
212
199
|
* @returns
|
|
213
200
|
* Identifier creator.
|
|
214
201
|
*/
|
|
215
|
-
|
|
202
|
+
getIdentifierCreator(identifierType) {
|
|
216
203
|
let creator = this.#identifierCreators[identifierType];
|
|
217
204
|
if (creator === undefined) {
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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]);
|
|
208
|
+
}
|
|
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);
|
|
222
217
|
}
|
|
223
|
-
creator = new ConstructorCallback(this, constructorArgument);
|
|
224
218
|
this.#setCreatorTweak(creator);
|
|
225
219
|
this.#identifierCreators[identifierType] = creator;
|
|
226
220
|
}
|
|
227
221
|
return creator;
|
|
228
222
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Get non-GTIN numeric identifier creator.
|
|
231
|
-
*
|
|
232
|
-
* @param identifierType
|
|
233
|
-
* Identifier type used to construct identifier creator.
|
|
234
|
-
*
|
|
235
|
-
* @returns
|
|
236
|
-
* Identifier creator.
|
|
237
|
-
*/
|
|
238
|
-
#getNonGTINNumericIdentifierCreator(identifierType) {
|
|
239
|
-
return this.#getIdentifierCreator(identifierType, identifierType, NonSerializableNumericIdentifierCreator);
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Get serialized numeric identifier creator.
|
|
243
|
-
*
|
|
244
|
-
* @param identifierType
|
|
245
|
-
* Identifier type used to construct identifier creator.
|
|
246
|
-
*
|
|
247
|
-
* @returns
|
|
248
|
-
* Identifier creator.
|
|
249
|
-
*/
|
|
250
|
-
#getSerializableNumericIdentifierCreator(identifierType) {
|
|
251
|
-
return this.#getIdentifierCreator(identifierType, identifierType, SerializableNumericIdentifierCreator);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Get non-numeric identifier creator.
|
|
255
|
-
*
|
|
256
|
-
* @param identifierType
|
|
257
|
-
* Identifier type used to construct identifier creator.
|
|
258
|
-
*
|
|
259
|
-
* @returns
|
|
260
|
-
* Identifier creator.
|
|
261
|
-
*/
|
|
262
|
-
#getNonNumericIdentifierCreator(identifierType) {
|
|
263
|
-
return this.#getIdentifierCreator(identifierType, identifierType, NonNumericIdentifierCreator);
|
|
264
|
-
}
|
|
265
223
|
/**
|
|
266
224
|
* Get GTIN creator.
|
|
267
225
|
*/
|
|
268
226
|
get gtinCreator() {
|
|
269
|
-
return this
|
|
227
|
+
return this.getIdentifierCreator(IdentifierTypes.GTIN);
|
|
270
228
|
}
|
|
271
229
|
/**
|
|
272
230
|
* Get GLN creator.
|
|
273
231
|
*/
|
|
274
232
|
get glnCreator() {
|
|
275
|
-
return this
|
|
233
|
+
return this.getIdentifierCreator(IdentifierTypes.GLN);
|
|
276
234
|
}
|
|
277
235
|
/**
|
|
278
236
|
* Get SSCC creator.
|
|
279
237
|
*/
|
|
280
238
|
get ssccCreator() {
|
|
281
|
-
return this
|
|
239
|
+
return this.getIdentifierCreator(IdentifierTypes.SSCC);
|
|
282
240
|
}
|
|
283
241
|
/**
|
|
284
242
|
* Get GRAI creator.
|
|
285
243
|
*/
|
|
286
244
|
get graiCreator() {
|
|
287
|
-
return this
|
|
245
|
+
return this.getIdentifierCreator(IdentifierTypes.GRAI);
|
|
288
246
|
}
|
|
289
247
|
/**
|
|
290
248
|
* Get GIAI creator.
|
|
291
249
|
*/
|
|
292
250
|
get giaiCreator() {
|
|
293
|
-
return this
|
|
251
|
+
return this.getIdentifierCreator(IdentifierTypes.GIAI);
|
|
294
252
|
}
|
|
295
253
|
/**
|
|
296
254
|
* Get GSRN creator.
|
|
297
255
|
*/
|
|
298
256
|
get gsrnCreator() {
|
|
299
|
-
return this
|
|
257
|
+
return this.getIdentifierCreator(IdentifierTypes.GSRN);
|
|
300
258
|
}
|
|
301
259
|
/**
|
|
302
260
|
* Get GDTI creator.
|
|
303
261
|
*/
|
|
304
262
|
get gdtiCreator() {
|
|
305
|
-
return this
|
|
263
|
+
return this.getIdentifierCreator(IdentifierTypes.GDTI);
|
|
306
264
|
}
|
|
307
265
|
/**
|
|
308
266
|
* Get GINC creator.
|
|
309
267
|
*/
|
|
310
268
|
get gincCreator() {
|
|
311
|
-
return this
|
|
269
|
+
return this.getIdentifierCreator(IdentifierTypes.GINC);
|
|
312
270
|
}
|
|
313
271
|
/**
|
|
314
272
|
* Get GSIN creator.
|
|
315
273
|
*/
|
|
316
274
|
get gsinCreator() {
|
|
317
|
-
return this
|
|
275
|
+
return this.getIdentifierCreator(IdentifierTypes.GSIN);
|
|
318
276
|
}
|
|
319
277
|
/**
|
|
320
278
|
* Get GCN creator.
|
|
321
279
|
*/
|
|
322
280
|
get gcnCreator() {
|
|
323
|
-
return this
|
|
281
|
+
return this.getIdentifierCreator(IdentifierTypes.GCN);
|
|
324
282
|
}
|
|
325
283
|
/**
|
|
326
284
|
* Get CPID creator.
|
|
327
285
|
*/
|
|
328
286
|
get cpidCreator() {
|
|
329
|
-
return this
|
|
287
|
+
return this.getIdentifierCreator(IdentifierTypes.CPID);
|
|
330
288
|
}
|
|
331
289
|
/**
|
|
332
290
|
* Get GMN creator.
|
|
333
291
|
*/
|
|
334
292
|
get gmnCreator() {
|
|
335
|
-
return this
|
|
293
|
+
return this.getIdentifierCreator(IdentifierTypes.GMN);
|
|
336
294
|
}
|
|
337
295
|
}
|
|
338
296
|
_a = PrefixManager;
|
|
@@ -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;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I,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,7 +1,7 @@
|
|
|
1
1
|
import { type TransformerInput, type TransformerOutput } from "@aidc-toolkit/utility";
|
|
2
2
|
import type { SerializableNumericIdentifierType } from "./serializable-numeric-identifier-type.js";
|
|
3
3
|
import { SerializableNumericIdentifierValidator } from "./serializable-numeric-identifier-validator.js";
|
|
4
|
-
declare const SerializableNumericIdentifierCreator_base: abstract new (prefixProvider: import("./prefix-provider.js").PrefixProvider, identifierType:
|
|
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>;
|
|
5
5
|
/**
|
|
6
6
|
* Serializable numeric identifier creator.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAkE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEjH,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,oCAAqC,SAAQ,4CAA4C,
|
|
1
|
+
{"version":3,"file":"serializable-numeric-identifier-creator.js","sourceRoot":"","sources":["../src/serializable-numeric-identifier-creator.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAkE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAC;AAEjH,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAExG;;GAEG;AACH,MAAM,OAAO,oCAAqC,SAAQ,4CAA4C,CAEpG,sCAAsC,CAAC;IACrC;;;;;;;;;;;;;;OAcG;IACH,qBAAqB,CAAqD,cAAsB,EAAE,2BAA8C;QAC5I,uFAAuF;QACvF,IAAI,MAAiC,CAAC;QAEtC,MAAM,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAC3D,MAAM,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAAC;QAEjE;;;;;;;;WAQG;QACH,SAAS,sBAAsB,CAAC,eAAuB;YACnD,sBAAsB,CAAC,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC;YAE5E,OAAO,cAAc,GAAG,eAAe,CAAC;QAC5C,CAAC;QAED,IAAI,OAAO,2BAA2B,KAAK,QAAQ,EAAE,CAAC;YAClD,MAAM,GAAG,sBAAsB,CAAC,2BAA2B,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,MAAM,GAAG,WAAW,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC;QAC9E,CAAC;QAED,+GAA+G;QAC/G,OAAO,MAAsD,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CAAqD,KAAa,EAAE,2BAA8C,EAAE,MAAgB;QAChJ,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAqD,cAAsB,EAAE,2BAA8C;QAClI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,cAAc,EAAE,2BAA2B,CAAC,CAAC;IACnF,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/gs1",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31-beta",
|
|
4
4
|
"description": "GS1 AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aidc-toolkit/dev": "1.0.
|
|
30
|
+
"@aidc-toolkit/dev": "1.0.31-beta",
|
|
31
31
|
"vitest": "^4.0.15"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aidc-toolkit/core": "1.0.
|
|
35
|
-
"@aidc-toolkit/utility": "1.0.
|
|
34
|
+
"@aidc-toolkit/core": "1.0.31-beta",
|
|
35
|
+
"@aidc-toolkit/utility": "1.0.31-beta"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1,54 +1,13 @@
|
|
|
1
|
+
import type { AbstractConstructor } from "@aidc-toolkit/core";
|
|
1
2
|
import type { IdentifierCreator } from "./identifier-creator.js";
|
|
2
3
|
import type { IdentifierType } from "./identifier-type.js";
|
|
3
4
|
import type { IdentifierValidation, IdentifierValidator } from "./identifier-validator.js";
|
|
4
|
-
import type { IdentifierTypeValidator } from "./identifier-validators.js";
|
|
5
|
+
import type { IdentifierTypeValidator, IdentifierValidatorConstructorsEntry } from "./identifier-validators.js";
|
|
5
6
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
* Identifier extension constructor type.
|
|
9
|
-
*
|
|
10
|
-
* @template TConstructorArguments
|
|
11
|
-
* Constructor arguments types.
|
|
12
|
-
*
|
|
13
|
-
* @template TConstructorInstance
|
|
14
|
-
* Constructor instance type.
|
|
15
|
-
*/
|
|
16
|
-
export type IdentifierExtensionConstructor<
|
|
17
|
-
TConstructorArguments extends unknown[],
|
|
18
|
-
TConstructorInstance
|
|
19
|
-
> = abstract new (...args: TConstructorArguments) => TConstructorInstance;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Identifier validator constructor type.
|
|
23
|
-
*
|
|
24
|
-
* @template TConstructorArguments
|
|
25
|
-
* Constructor arguments types.
|
|
26
|
-
*
|
|
27
|
-
* @template TIdentifierType
|
|
28
|
-
* Identifier type type.
|
|
29
|
-
*
|
|
30
|
-
* @template TIdentifierValidation
|
|
31
|
-
* Identifier validation type.
|
|
32
|
-
*
|
|
33
|
-
* @template TIdentifierValidator
|
|
34
|
-
* Identifier validator type.
|
|
35
|
-
*/
|
|
36
|
-
export type IdentifierValidatorConstructor<
|
|
37
|
-
TConstructorArguments extends unknown[],
|
|
38
|
-
TIdentifierType extends IdentifierType,
|
|
39
|
-
TIdentifierValidation extends IdentifierValidation,
|
|
40
|
-
TIdentifierValidator extends IdentifierValidator<TIdentifierType, TIdentifierValidation> = IdentifierTypeValidator<TIdentifierType>
|
|
41
|
-
> = IdentifierExtensionConstructor<
|
|
42
|
-
TConstructorArguments,
|
|
43
|
-
TIdentifierValidator
|
|
44
|
-
>;
|
|
45
|
-
|
|
46
8
|
/**
|
|
47
9
|
* Identifier creator constructor type, which delegates to an identifier validator constructor.
|
|
48
10
|
*
|
|
49
|
-
* @template TConstructorArguments
|
|
50
|
-
* Constructor arguments types.
|
|
51
|
-
*
|
|
52
11
|
* @template TIdentifierType
|
|
53
12
|
* Identifier type type.
|
|
54
13
|
*
|
|
@@ -59,47 +18,36 @@ export type IdentifierValidatorConstructor<
|
|
|
59
18
|
* Identifier validator type.
|
|
60
19
|
*/
|
|
61
20
|
export type IdentifierCreatorConstructor<
|
|
62
|
-
TConstructorArguments extends unknown[],
|
|
63
21
|
TIdentifierType extends IdentifierType,
|
|
64
22
|
TIdentifierValidation extends IdentifierValidation,
|
|
65
23
|
TIdentifierValidator extends IdentifierValidator<TIdentifierType, TIdentifierValidation>
|
|
66
|
-
> =
|
|
67
|
-
[prefixProvider: PrefixProvider, prefix: string, checkAllowance: number, ...args:
|
|
24
|
+
> = AbstractConstructor<
|
|
25
|
+
[prefixProvider: PrefixProvider, prefix: string, checkAllowance: number, ...args: ConstructorParameters<IdentifierValidatorConstructorsEntry<TIdentifierType>>],
|
|
68
26
|
TIdentifierValidator & IdentifierCreator<TIdentifierType, TIdentifierValidation>
|
|
69
27
|
>;
|
|
70
28
|
|
|
71
29
|
/**
|
|
72
30
|
* Mixin implementation of {@linkcode IdentifierCreator} with an appropriate identifier validator base.
|
|
73
31
|
*
|
|
74
|
-
* @template TConstructorArguments
|
|
75
|
-
* Constructor arguments types.
|
|
76
|
-
*
|
|
77
32
|
* @template TIdentifierType
|
|
78
33
|
* Identifier type type.
|
|
79
34
|
*
|
|
80
35
|
* @template TIdentifierValidation
|
|
81
36
|
* Identifier validation type.
|
|
82
37
|
*
|
|
83
|
-
* @
|
|
84
|
-
* Identifier validator constructor type.
|
|
85
|
-
*
|
|
86
|
-
* @param IdentifierValidatorBase
|
|
38
|
+
* @param IdentifierValidatorConstructor
|
|
87
39
|
* Identifier validator base.
|
|
88
40
|
*
|
|
89
41
|
* @returns
|
|
90
42
|
* Identifier creator class.
|
|
91
43
|
*/
|
|
92
44
|
export function MixinAbstractIdentifierCreator<
|
|
93
|
-
TConstructorArguments extends unknown[],
|
|
94
45
|
TIdentifierType extends IdentifierType,
|
|
95
|
-
TIdentifierValidation extends IdentifierValidation
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
>(IdentifierValidatorBase: TIdentifierValidatorConstructor): IdentifierCreatorConstructor<
|
|
102
|
-
TConstructorArguments,
|
|
46
|
+
TIdentifierValidation extends IdentifierValidation
|
|
47
|
+
>(IdentifierValidatorConstructor: AbstractConstructor<
|
|
48
|
+
ConstructorParameters<IdentifierValidatorConstructorsEntry<TIdentifierType>>,
|
|
49
|
+
IdentifierTypeValidator<TIdentifierType>
|
|
50
|
+
>): IdentifierCreatorConstructor<
|
|
103
51
|
TIdentifierType,
|
|
104
52
|
TIdentifierValidation,
|
|
105
53
|
IdentifierTypeValidator<TIdentifierType>
|
|
@@ -108,12 +56,12 @@ export function MixinAbstractIdentifierCreator<
|
|
|
108
56
|
* Abstract numeric identifier creator. Implements common functionality for a numeric identifier creator, mixed in
|
|
109
57
|
* with a matching numeric identifier validator.
|
|
110
58
|
*/
|
|
111
|
-
abstract class AbstractIdentifierCreator extends (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
59
|
+
abstract class AbstractIdentifierCreator extends (
|
|
60
|
+
IdentifierValidatorConstructor as AbstractConstructor<
|
|
61
|
+
ConstructorParameters<IdentifierValidatorConstructorsEntry<TIdentifierType>>,
|
|
62
|
+
IdentifierValidator<TIdentifierType>
|
|
63
|
+
>
|
|
64
|
+
) implements IdentifierCreator<TIdentifierType, TIdentifierValidation> {
|
|
117
65
|
/**
|
|
118
66
|
* Prefix provider.
|
|
119
67
|
*/
|
|
@@ -139,7 +87,7 @@ export function MixinAbstractIdentifierCreator<
|
|
|
139
87
|
* @param args
|
|
140
88
|
* Originating constructor arguments.
|
|
141
89
|
*/
|
|
142
|
-
constructor(prefixProvider: PrefixProvider, prefix: string, checkAllowance: number, ...args:
|
|
90
|
+
constructor(prefixProvider: PrefixProvider, prefix: string, checkAllowance: number, ...args: ConstructorParameters<IdentifierValidatorConstructorsEntry<TIdentifierType>>) {
|
|
143
91
|
super(...args);
|
|
144
92
|
|
|
145
93
|
this.#prefixProvider = prefixProvider;
|
|
@@ -171,7 +119,7 @@ export function MixinAbstractIdentifierCreator<
|
|
|
171
119
|
}
|
|
172
120
|
|
|
173
121
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Base class was upcast to type with statically known members for mixin, downcast result.
|
|
174
|
-
return AbstractIdentifierCreator as
|
|
122
|
+
return AbstractIdentifierCreator as AbstractConstructor<
|
|
175
123
|
ConstructorParameters<typeof AbstractIdentifierCreator>,
|
|
176
124
|
IdentifierTypeValidator<TIdentifierType> & AbstractIdentifierCreator
|
|
177
125
|
>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractConstructor } from "@aidc-toolkit/core";
|
|
2
2
|
import {
|
|
3
3
|
MixinAbstractNumericIdentifierCreator,
|
|
4
4
|
type NumericIdentifierCreatorConstructor
|
|
5
5
|
} from "./abstract-numeric-identifier-creator.js";
|
|
6
|
-
import type { IdentifierTypeValidator } from "./identifier-validators.js";
|
|
6
|
+
import type { IdentifierTypeValidator, IdentifierValidatorConstructorsEntry } from "./identifier-validators.js";
|
|
7
7
|
import type { NonGTINNumericIdentifierCreator } from "./non-gtin-numeric-identifier-creator.js";
|
|
8
8
|
import type { NonGTINNumericIdentifierType } from "./non-gtin-numeric-identifier-type.js";
|
|
9
9
|
import type { NonGTINNumericIdentifierValidator } from "./non-gtin-numeric-identifier-validator.js";
|
|
10
|
-
import type { NumericIdentifierValidation } from "./numeric-identifier-validator.js";
|
|
11
10
|
import type { PrefixProvider } from "./prefix-provider.js";
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -23,8 +22,8 @@ import type { PrefixProvider } from "./prefix-provider.js";
|
|
|
23
22
|
type NonGTINNumericIdentifierCreatorConstructor<
|
|
24
23
|
TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType,
|
|
25
24
|
TNonGTINNumericIdentifierValidator extends NonGTINNumericIdentifierValidator<TNonGTINNumericIdentifierType>
|
|
26
|
-
> =
|
|
27
|
-
[prefixProvider: PrefixProvider,
|
|
25
|
+
> = AbstractConstructor<
|
|
26
|
+
[prefixProvider: PrefixProvider, ...args: ConstructorParameters<IdentifierValidatorConstructorsEntry<TNonGTINNumericIdentifierType>>],
|
|
28
27
|
TNonGTINNumericIdentifierValidator & NonGTINNumericIdentifierCreator<TNonGTINNumericIdentifierType>
|
|
29
28
|
>;
|
|
30
29
|
|
|
@@ -35,23 +34,18 @@ type NonGTINNumericIdentifierCreatorConstructor<
|
|
|
35
34
|
* @template TNonGTINNumericIdentifierType
|
|
36
35
|
* Non-GTIN numeric identifier type type.
|
|
37
36
|
*
|
|
38
|
-
* @
|
|
39
|
-
* Non-GTIN numeric identifier validator constructor
|
|
40
|
-
*
|
|
41
|
-
* @param NonGTINNumericIdentifierValidatorBase
|
|
42
|
-
* Non-GTIN numeric identifier validator base.
|
|
37
|
+
* @param NonGTINNumericIdentifierValidatorConstructor
|
|
38
|
+
* Non-GTIN numeric identifier validator constructor.
|
|
43
39
|
*
|
|
44
40
|
* @returns
|
|
45
41
|
* Non-GTIN numeric identifier creator class.
|
|
46
42
|
*/
|
|
47
43
|
export function MixinAbstractNonGTINNumericIdentifierCreator<
|
|
48
|
-
TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>
|
|
54
|
-
>(NonGTINNumericIdentifierValidatorBase: TNonGTINNumericIdentifierValidatorConstructor): NonGTINNumericIdentifierCreatorConstructor<
|
|
44
|
+
TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType
|
|
45
|
+
>(NonGTINNumericIdentifierValidatorConstructor: AbstractConstructor<
|
|
46
|
+
ConstructorParameters<IdentifierValidatorConstructorsEntry<TNonGTINNumericIdentifierType>>,
|
|
47
|
+
IdentifierTypeValidator<TNonGTINNumericIdentifierType>
|
|
48
|
+
>): NonGTINNumericIdentifierCreatorConstructor<
|
|
55
49
|
TNonGTINNumericIdentifierType,
|
|
56
50
|
IdentifierTypeValidator<TNonGTINNumericIdentifierType>
|
|
57
51
|
> {
|
|
@@ -59,27 +53,28 @@ export function MixinAbstractNonGTINNumericIdentifierCreator<
|
|
|
59
53
|
* Abstract non-GTIN numeric identifier creator. Implements common functionality for a non-GTIN numeric identifier
|
|
60
54
|
* creator, mixed in with a matching non-GTIN numeric identifier validator.
|
|
61
55
|
*/
|
|
62
|
-
abstract class AbstractNonGTINNumericIdentifierCreator extends (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
abstract class AbstractNonGTINNumericIdentifierCreator extends (
|
|
57
|
+
MixinAbstractNumericIdentifierCreator(NonGTINNumericIdentifierValidatorConstructor) as NumericIdentifierCreatorConstructor<
|
|
58
|
+
TNonGTINNumericIdentifierType,
|
|
59
|
+
NonGTINNumericIdentifierValidator<TNonGTINNumericIdentifierType>
|
|
60
|
+
>
|
|
61
|
+
) implements NonGTINNumericIdentifierCreator<TNonGTINNumericIdentifierType> {
|
|
67
62
|
/**
|
|
68
63
|
* Constructor.
|
|
69
64
|
*
|
|
70
65
|
* @param prefixProvider
|
|
71
66
|
* Prefix provider.
|
|
72
67
|
*
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
68
|
+
* @param args
|
|
69
|
+
* Originating constructor arguments.
|
|
75
70
|
*/
|
|
76
|
-
constructor(prefixProvider: PrefixProvider,
|
|
77
|
-
super(prefixProvider, prefixProvider.gs1CompanyPrefix,
|
|
71
|
+
constructor(prefixProvider: PrefixProvider, ...args: ConstructorParameters<IdentifierValidatorConstructorsEntry<TNonGTINNumericIdentifierType>>) {
|
|
72
|
+
super(prefixProvider, prefixProvider.gs1CompanyPrefix, ...args);
|
|
78
73
|
}
|
|
79
74
|
}
|
|
80
75
|
|
|
81
76
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Base class was upcast to type with statically known members for mixin, downcast result.
|
|
82
|
-
return AbstractNonGTINNumericIdentifierCreator as
|
|
77
|
+
return AbstractNonGTINNumericIdentifierCreator as AbstractConstructor<
|
|
83
78
|
ConstructorParameters<typeof AbstractNonGTINNumericIdentifierCreator>,
|
|
84
79
|
IdentifierTypeValidator<TNonGTINNumericIdentifierType> & AbstractNonGTINNumericIdentifierCreator
|
|
85
80
|
>;
|