@aidc-toolkit/app-extension 0.9.19-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/LICENSE +174 -0
- package/README.md +17 -0
- package/app-extension.iml +9 -0
- package/dist/app-extension.d.ts +169 -0
- package/dist/app-extension.d.ts.map +1 -0
- package/dist/app-extension.js +148 -0
- package/dist/app-extension.js.map +1 -0
- package/dist/app-utility-proxy.d.ts +66 -0
- package/dist/app-utility-proxy.d.ts.map +1 -0
- package/dist/app-utility-proxy.js +233 -0
- package/dist/app-utility-proxy.js.map +1 -0
- package/dist/descriptor.d.ts +168 -0
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +175 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/gs1/character-set-proxy.d.ts +10 -0
- package/dist/gs1/character-set-proxy.d.ts.map +1 -0
- package/dist/gs1/character-set-proxy.js +47 -0
- package/dist/gs1/character-set-proxy.js.map +1 -0
- package/dist/gs1/check-proxy.d.ts +11 -0
- package/dist/gs1/check-proxy.d.ts.map +1 -0
- package/dist/gs1/check-proxy.js +120 -0
- package/dist/gs1/check-proxy.js.map +1 -0
- package/dist/gs1/idkey-proxy.d.ts +135 -0
- package/dist/gs1/idkey-proxy.d.ts.map +1 -0
- package/dist/gs1/idkey-proxy.js +779 -0
- package/dist/gs1/idkey-proxy.js.map +1 -0
- package/dist/gs1/index.d.ts +4 -0
- package/dist/gs1/index.d.ts.map +1 -0
- package/dist/gs1/index.js +4 -0
- package/dist/gs1/index.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/lib-proxy.d.ts +135 -0
- package/dist/lib-proxy.d.ts.map +1 -0
- package/dist/lib-proxy.js +235 -0
- package/dist/lib-proxy.js.map +1 -0
- package/dist/locale/en/locale-strings.d.ts +616 -0
- package/dist/locale/en/locale-strings.d.ts.map +1 -0
- package/dist/locale/en/locale-strings.js +616 -0
- package/dist/locale/en/locale-strings.js.map +1 -0
- package/dist/locale/fr/locale-strings.d.ts +616 -0
- package/dist/locale/fr/locale-strings.d.ts.map +1 -0
- package/dist/locale/fr/locale-strings.js +616 -0
- package/dist/locale/fr/locale-strings.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +39 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/types.d.ts +127 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/utility/character-set-descriptor.d.ts +6 -0
- package/dist/utility/character-set-descriptor.d.ts.map +1 -0
- package/dist/utility/character-set-descriptor.js +28 -0
- package/dist/utility/character-set-descriptor.js.map +1 -0
- package/dist/utility/character-set-proxy.d.ts +26 -0
- package/dist/utility/character-set-proxy.d.ts.map +1 -0
- package/dist/utility/character-set-proxy.js +167 -0
- package/dist/utility/character-set-proxy.js.map +1 -0
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.d.ts.map +1 -0
- package/dist/utility/index.js +4 -0
- package/dist/utility/index.js.map +1 -0
- package/dist/utility/reg-exp-proxy.d.ts +7 -0
- package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
- package/dist/utility/reg-exp-proxy.js +61 -0
- package/dist/utility/reg-exp-proxy.js.map +1 -0
- package/dist/utility/string-descriptor.d.ts +4 -0
- package/dist/utility/string-descriptor.d.ts.map +1 -0
- package/dist/utility/string-descriptor.js +12 -0
- package/dist/utility/string-descriptor.js.map +1 -0
- package/dist/utility/string-proxy.d.ts +8 -0
- package/dist/utility/string-proxy.d.ts.map +1 -0
- package/dist/utility/string-proxy.js +12 -0
- package/dist/utility/string-proxy.js.map +1 -0
- package/dist/utility/transformer-descriptor.d.ts +6 -0
- package/dist/utility/transformer-descriptor.d.ts.map +1 -0
- package/dist/utility/transformer-descriptor.js +24 -0
- package/dist/utility/transformer-descriptor.js.map +1 -0
- package/dist/utility/transformer-proxy.d.ts +8 -0
- package/dist/utility/transformer-proxy.d.ts.map +1 -0
- package/dist/utility/transformer-proxy.js +74 -0
- package/dist/utility/transformer-proxy.js.map +1 -0
- package/eslint.config.ts +21 -0
- package/package.json +37 -0
- package/src/app-extension.ts +244 -0
- package/src/app-utility-proxy.ts +266 -0
- package/src/descriptor.ts +314 -0
- package/src/gs1/character-set-proxy.ts +41 -0
- package/src/gs1/check-proxy.ts +122 -0
- package/src/gs1/idkey-proxy.ts +815 -0
- package/src/gs1/index.ts +3 -0
- package/src/index.ts +24 -0
- package/src/lib-proxy.ts +256 -0
- package/src/locale/en/locale-strings.ts +615 -0
- package/src/locale/fr/locale-strings.ts +615 -0
- package/src/locale/i18n.ts +48 -0
- package/src/locale/i18next.d.ts +20 -0
- package/src/types.ts +144 -0
- package/src/utility/character-set-descriptor.ts +32 -0
- package/src/utility/character-set-proxy.ts +185 -0
- package/src/utility/index.ts +3 -0
- package/src/utility/reg-exp-proxy.ts +51 -0
- package/src/utility/string-descriptor.ts +13 -0
- package/src/utility/string-proxy.ts +15 -0
- package/src/utility/transformer-descriptor.ts +27 -0
- package/src/utility/transformer-proxy.ts +72 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CPID_VALIDATOR,
|
|
3
|
+
GCN_VALIDATOR,
|
|
4
|
+
GDTI_VALIDATOR,
|
|
5
|
+
GIAI_VALIDATOR,
|
|
6
|
+
GINC_VALIDATOR,
|
|
7
|
+
GLN_VALIDATOR,
|
|
8
|
+
GMN_VALIDATOR,
|
|
9
|
+
GRAI_VALIDATOR,
|
|
10
|
+
GSIN_VALIDATOR,
|
|
11
|
+
GSRN_VALIDATOR,
|
|
12
|
+
GTIN12_VALIDATOR,
|
|
13
|
+
GTIN13_VALIDATOR,
|
|
14
|
+
GTIN8_VALIDATOR,
|
|
15
|
+
GTINCreator,
|
|
16
|
+
type GTINLevel,
|
|
17
|
+
GTINValidator,
|
|
18
|
+
type IdentificationKeyCreator,
|
|
19
|
+
type IdentificationKeyValidation,
|
|
20
|
+
type IdentificationKeyValidator,
|
|
21
|
+
type NonGTINNumericIdentificationKeyCreator,
|
|
22
|
+
type NonGTINNumericIdentificationKeyValidator,
|
|
23
|
+
type NonNumericIdentificationKeyCreator,
|
|
24
|
+
type NonNumericIdentificationKeyValidation,
|
|
25
|
+
type NonNumericIdentificationKeyValidator,
|
|
26
|
+
type NumericIdentificationKeyCreator,
|
|
27
|
+
type NumericIdentificationKeyValidator,
|
|
28
|
+
PrefixManager,
|
|
29
|
+
PrefixType,
|
|
30
|
+
type SerializableNumericIdentificationKeyCreator,
|
|
31
|
+
type SerializableNumericIdentificationKeyValidator,
|
|
32
|
+
SSCC_VALIDATOR
|
|
33
|
+
} from "@aidc-toolkit/gs1";
|
|
34
|
+
import { Sequence } from "@aidc-toolkit/utility";
|
|
35
|
+
import type { AppExtension } from "../app-extension.js";
|
|
36
|
+
import {
|
|
37
|
+
expandParameterDescriptor,
|
|
38
|
+
type ParameterDescriptor,
|
|
39
|
+
ProxyClass,
|
|
40
|
+
ProxyMethod,
|
|
41
|
+
ProxyParameter,
|
|
42
|
+
Type
|
|
43
|
+
} from "../descriptor.js";
|
|
44
|
+
import { LibProxy } from "../lib-proxy.js";
|
|
45
|
+
import { i18nextAppExtension } from "../locale/i18n.js";
|
|
46
|
+
import { type ErrorExtends, isNullish, type Matrix, type MatrixResultError, type Nullishable } from "../types.js";
|
|
47
|
+
import { exclusionAllNumericParameterDescriptor } from "../utility/character-set-descriptor.js";
|
|
48
|
+
import { StringProxy } from "../utility/string-proxy.js";
|
|
49
|
+
import {
|
|
50
|
+
countParameterDescriptor,
|
|
51
|
+
startValueParameterDescriptor,
|
|
52
|
+
valueParameterDescriptor
|
|
53
|
+
} from "../utility/transformer-descriptor.js";
|
|
54
|
+
|
|
55
|
+
const identificationKeyParameterDescriptor: ParameterDescriptor = {
|
|
56
|
+
name: "identificationKey",
|
|
57
|
+
type: Type.String,
|
|
58
|
+
isMatrix: true,
|
|
59
|
+
isRequired: true
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const validateIdentificationKeyParameterDescriptor: ParameterDescriptor = {
|
|
63
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
64
|
+
sortOrder: 0,
|
|
65
|
+
name: "validateIdentificationKey"
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
abstract class IdentificationKeyValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentificationKeyValidation extends IdentificationKeyValidation, TIdentificationKeyValidator extends IdentificationKeyValidator<TIdentificationKeyValidation>> extends StringProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
69
|
+
private readonly _validator: TIdentificationKeyValidator;
|
|
70
|
+
|
|
71
|
+
protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, validator: TIdentificationKeyValidator) {
|
|
72
|
+
super(appExtension);
|
|
73
|
+
|
|
74
|
+
this._validator = validator;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected get validator(): TIdentificationKeyValidator {
|
|
78
|
+
return this._validator;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
abstract class NumericIdentificationKeyValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentificationKeyValidator extends NumericIdentificationKeyValidator> extends IdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, IdentificationKeyValidation, TNumericIdentificationKeyValidator> {
|
|
83
|
+
@ProxyMethod({
|
|
84
|
+
type: Type.String,
|
|
85
|
+
isMatrix: true
|
|
86
|
+
})
|
|
87
|
+
validate(
|
|
88
|
+
@ProxyParameter(validateIdentificationKeyParameterDescriptor) matrixIdentificationKeys: Matrix<string>
|
|
89
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
90
|
+
return this.validateString(this.validator, matrixIdentificationKeys);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
abstract class GTINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, GTINValidator> {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
abstract class NonGTINNumericIdentificationKeyValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentificationKeyValidator extends NonGTINNumericIdentificationKeyValidator> extends NumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentificationKeyValidator> {
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
abstract class SerializableNumericIdentificationKeyValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentificationKeyValidator> {
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
abstract class NonNumericIdentificationKeyValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentificationKeyValidation, NonNumericIdentificationKeyValidator> {
|
|
104
|
+
@ProxyMethod({
|
|
105
|
+
type: Type.String,
|
|
106
|
+
isMatrix: true
|
|
107
|
+
})
|
|
108
|
+
validate(
|
|
109
|
+
@ProxyParameter(validateIdentificationKeyParameterDescriptor) matrixIdentificationKeys: Matrix<string>,
|
|
110
|
+
@ProxyParameter(exclusionAllNumericParameterDescriptor) exclusion: Nullishable<NonNumericIdentificationKeyValidation["exclusion"]>
|
|
111
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
112
|
+
return this.validateString(this.validator, matrixIdentificationKeys, {
|
|
113
|
+
exclusion: exclusion ?? undefined
|
|
114
|
+
} satisfies NonNumericIdentificationKeyValidation);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@ProxyClass({
|
|
119
|
+
namespace: "GS1",
|
|
120
|
+
methodInfix: "GTIN13"
|
|
121
|
+
})
|
|
122
|
+
export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
123
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
124
|
+
super(appExtension, GTIN13_VALIDATOR);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@ProxyClass({
|
|
129
|
+
namespace: "GS1",
|
|
130
|
+
methodInfix: "GTIN12"
|
|
131
|
+
})
|
|
132
|
+
export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
133
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
134
|
+
super(appExtension, GTIN12_VALIDATOR);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@ProxyClass({
|
|
139
|
+
namespace: "GS1",
|
|
140
|
+
methodInfix: "GTIN8"
|
|
141
|
+
})
|
|
142
|
+
export class GTIN8ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
143
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
144
|
+
super(appExtension, GTIN8_VALIDATOR);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const zeroSuppressibleGTIN12ParameterDescriptor: ParameterDescriptor = {
|
|
149
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
150
|
+
name: "zeroSuppressibleGTIN12"
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const zeroSuppressedGTIN12ParameterDescriptor: ParameterDescriptor = {
|
|
154
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
155
|
+
name: "zeroSuppressedGTIN12"
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const indicatorDigitParameterDescriptor: ParameterDescriptor = {
|
|
159
|
+
name: "indicatorDigit",
|
|
160
|
+
type: Type.String,
|
|
161
|
+
isMatrix: false,
|
|
162
|
+
isRequired: true
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const convertGTINParameterDescriptor: ParameterDescriptor = {
|
|
166
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
167
|
+
name: "convertGTIN"
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const normalizeGTINParameterDescriptor: ParameterDescriptor = {
|
|
171
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
172
|
+
name: "normalizeGTIN"
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const validateGTINParameterDescriptor: ParameterDescriptor = {
|
|
176
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
177
|
+
name: "validateGTIN"
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const gtinLevelParameterDescriptor: ParameterDescriptor = {
|
|
181
|
+
name: "gtinLevel",
|
|
182
|
+
type: Type.Number,
|
|
183
|
+
isMatrix: false,
|
|
184
|
+
isRequired: false
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const validateGTIN14ParameterDescriptor: ParameterDescriptor = {
|
|
188
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
189
|
+
name: "validateGTIN14"
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const rcnFormatParameterDescriptor: ParameterDescriptor = {
|
|
193
|
+
name: "rcnFormat",
|
|
194
|
+
type: Type.String,
|
|
195
|
+
isMatrix: false,
|
|
196
|
+
isRequired: true
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const rcnParameterDescriptor: ParameterDescriptor = {
|
|
200
|
+
name: "rcn",
|
|
201
|
+
type: Type.String,
|
|
202
|
+
isMatrix: true,
|
|
203
|
+
isRequired: true
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const rcnItemReferenceParameterDescriptor: ParameterDescriptor = {
|
|
207
|
+
name: "rcnItemReference",
|
|
208
|
+
type: Type.Number,
|
|
209
|
+
isMatrix: false,
|
|
210
|
+
isRequired: true
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const rcnPriceOrWeightParameterDescriptor: ParameterDescriptor = {
|
|
214
|
+
name: "rcnPriceOrWeight",
|
|
215
|
+
type: Type.Number,
|
|
216
|
+
isMatrix: true,
|
|
217
|
+
isRequired: true
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
@ProxyClass({
|
|
221
|
+
namespace: "GS1"
|
|
222
|
+
})
|
|
223
|
+
export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
224
|
+
@ProxyMethod({
|
|
225
|
+
type: Type.String,
|
|
226
|
+
isMatrix: true
|
|
227
|
+
})
|
|
228
|
+
zeroSuppressGTIN12(
|
|
229
|
+
@ProxyParameter(zeroSuppressibleGTIN12ParameterDescriptor) matrixGTIN12s: Matrix<string>
|
|
230
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
231
|
+
return this.mapMatrix(matrixGTIN12s, gtin12 => GTINValidator.zeroSuppress(gtin12));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@ProxyMethod({
|
|
235
|
+
type: Type.String,
|
|
236
|
+
isMatrix: true
|
|
237
|
+
})
|
|
238
|
+
zeroExpandGTIN12(
|
|
239
|
+
@ProxyParameter(zeroSuppressedGTIN12ParameterDescriptor) matrixZeroSuppressedGTIN12s: Matrix<string>
|
|
240
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
241
|
+
return this.mapMatrix(matrixZeroSuppressedGTIN12s, zeroSuppressedGTIN12 => GTINValidator.zeroExpand(zeroSuppressedGTIN12));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@ProxyMethod({
|
|
245
|
+
type: Type.String,
|
|
246
|
+
isMatrix: true
|
|
247
|
+
})
|
|
248
|
+
convertToGTIN14(
|
|
249
|
+
@ProxyParameter(indicatorDigitParameterDescriptor) indicatorDigit: string,
|
|
250
|
+
@ProxyParameter(convertGTINParameterDescriptor) matrixGTINs: Matrix<string>
|
|
251
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
252
|
+
return this.mapMatrix(matrixGTINs, gtin => GTINValidator.convertToGTIN14(indicatorDigit, gtin));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@ProxyMethod({
|
|
256
|
+
type: Type.String,
|
|
257
|
+
isMatrix: true
|
|
258
|
+
})
|
|
259
|
+
normalizeGTIN(
|
|
260
|
+
@ProxyParameter(normalizeGTINParameterDescriptor) matrixGTINs: Matrix<string>
|
|
261
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
262
|
+
return this.mapMatrix(matrixGTINs, gtin => GTINValidator.normalize(gtin));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@ProxyMethod({
|
|
266
|
+
type: Type.String,
|
|
267
|
+
isMatrix: true
|
|
268
|
+
})
|
|
269
|
+
validateGTIN(
|
|
270
|
+
@ProxyParameter(validateGTINParameterDescriptor) matrixGTINs: Matrix<string>,
|
|
271
|
+
@ProxyParameter(gtinLevelParameterDescriptor) gtinLevel: Nullishable<GTINLevel>
|
|
272
|
+
): Matrix<string> {
|
|
273
|
+
const gtinLevelOrUndefined = gtinLevel ?? undefined;
|
|
274
|
+
|
|
275
|
+
return LibProxy.mapMatrixRangeError(matrixGTINs, (gtin) => {
|
|
276
|
+
GTINValidator.validateAny(gtin, gtinLevelOrUndefined);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@ProxyMethod({
|
|
281
|
+
type: Type.String,
|
|
282
|
+
isMatrix: true
|
|
283
|
+
})
|
|
284
|
+
validateGTIN14(
|
|
285
|
+
@ProxyParameter(validateGTIN14ParameterDescriptor) matrixGTIN14s: Matrix<string>
|
|
286
|
+
): Matrix<string> {
|
|
287
|
+
return LibProxy.mapMatrixRangeError(matrixGTIN14s, (gtin14) => {
|
|
288
|
+
GTINValidator.validateGTIN14(gtin14);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@ProxyMethod({
|
|
293
|
+
type: Type.Number,
|
|
294
|
+
isMatrix: true
|
|
295
|
+
})
|
|
296
|
+
parseVariableMeasureRCN(
|
|
297
|
+
@ProxyParameter(rcnFormatParameterDescriptor) format: string,
|
|
298
|
+
@ProxyParameter(rcnParameterDescriptor) matrixRCNs: Matrix<string>
|
|
299
|
+
): MatrixResultError<number, ThrowError, TError> {
|
|
300
|
+
return this.mapArray(matrixRCNs, (rcn) => {
|
|
301
|
+
const rcnReference = GTINValidator.parseVariableMeasureRCN(format, rcn);
|
|
302
|
+
|
|
303
|
+
return [rcnReference.itemReference, rcnReference.priceOrWeight];
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@ProxyClass({
|
|
309
|
+
namespace: "GS1",
|
|
310
|
+
methodInfix: "GLN"
|
|
311
|
+
})
|
|
312
|
+
export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyValidator> {
|
|
313
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
314
|
+
super(appExtension, GLN_VALIDATOR);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@ProxyClass({
|
|
319
|
+
namespace: "GS1",
|
|
320
|
+
methodInfix: "SSCC"
|
|
321
|
+
})
|
|
322
|
+
export class SSCCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyValidator> {
|
|
323
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
324
|
+
super(appExtension, SSCC_VALIDATOR);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@ProxyClass({
|
|
329
|
+
namespace: "GS1",
|
|
330
|
+
methodInfix: "GRAI"
|
|
331
|
+
})
|
|
332
|
+
export class GRAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
333
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
334
|
+
super(appExtension, GRAI_VALIDATOR);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
@ProxyClass({
|
|
339
|
+
namespace: "GS1",
|
|
340
|
+
methodInfix: "GIAI"
|
|
341
|
+
})
|
|
342
|
+
export class GIAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
343
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
344
|
+
super(appExtension, GIAI_VALIDATOR);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@ProxyClass({
|
|
349
|
+
namespace: "GS1",
|
|
350
|
+
methodInfix: "GSRN"
|
|
351
|
+
})
|
|
352
|
+
export class GSRNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyValidator> {
|
|
353
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
354
|
+
super(appExtension, GSRN_VALIDATOR);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@ProxyClass({
|
|
359
|
+
namespace: "GS1",
|
|
360
|
+
methodInfix: "GDTI"
|
|
361
|
+
})
|
|
362
|
+
export class GDTIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
363
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
364
|
+
super(appExtension, GDTI_VALIDATOR);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@ProxyClass({
|
|
369
|
+
namespace: "GS1",
|
|
370
|
+
methodInfix: "GINC"
|
|
371
|
+
})
|
|
372
|
+
export class GINCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
373
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
374
|
+
super(appExtension, GINC_VALIDATOR);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
@ProxyClass({
|
|
379
|
+
namespace: "GS1",
|
|
380
|
+
methodInfix: "GSIN"
|
|
381
|
+
})
|
|
382
|
+
export class GSINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyValidator> {
|
|
383
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
384
|
+
super(appExtension, GSIN_VALIDATOR);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@ProxyClass({
|
|
389
|
+
namespace: "GS1",
|
|
390
|
+
methodInfix: "GCN"
|
|
391
|
+
})
|
|
392
|
+
export class GCNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
393
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
394
|
+
super(appExtension, GCN_VALIDATOR);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@ProxyClass({
|
|
399
|
+
namespace: "GS1",
|
|
400
|
+
methodInfix: "CPID"
|
|
401
|
+
})
|
|
402
|
+
export class CPIDValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
403
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
404
|
+
super(appExtension, CPID_VALIDATOR);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
@ProxyClass({
|
|
409
|
+
namespace: "GS1",
|
|
410
|
+
methodInfix: "GMN"
|
|
411
|
+
})
|
|
412
|
+
export class GMNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
413
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
414
|
+
super(appExtension, GMN_VALIDATOR);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const prefixParameterDescriptor: ParameterDescriptor = {
|
|
419
|
+
name: "prefix",
|
|
420
|
+
type: Type.String,
|
|
421
|
+
isMatrix: false,
|
|
422
|
+
isRequired: true
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
const prefixTypeParameterDescriptor: ParameterDescriptor = {
|
|
426
|
+
name: "prefixType",
|
|
427
|
+
type: Type.Number,
|
|
428
|
+
isMatrix: false,
|
|
429
|
+
isRequired: false
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
const tweakFactorParameterDescriptor: ParameterDescriptor = {
|
|
433
|
+
name: "tweakFactor",
|
|
434
|
+
type: Type.Number,
|
|
435
|
+
isMatrix: false,
|
|
436
|
+
isRequired: false
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
const prefixDefinitionParameterDescriptor: ParameterDescriptor = {
|
|
440
|
+
name: "prefixDefinition",
|
|
441
|
+
type: Type.Any,
|
|
442
|
+
isMatrix: true,
|
|
443
|
+
isRequired: true
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const prefixDefinitionGS1UPCParameterDescriptor: ParameterDescriptor = {
|
|
447
|
+
extendsDescriptor: prefixDefinitionParameterDescriptor,
|
|
448
|
+
name: "prefixDefinitionGS1UPC"
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const prefixDefinitionAnyParameterDescriptor: ParameterDescriptor = {
|
|
452
|
+
extendsDescriptor: prefixDefinitionParameterDescriptor,
|
|
453
|
+
name: "prefixDefinitionAny"
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
@ProxyClass({
|
|
457
|
+
namespace: "GS1"
|
|
458
|
+
})
|
|
459
|
+
export class PrefixManagerProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
460
|
+
@ProxyMethod({
|
|
461
|
+
type: Type.Any,
|
|
462
|
+
isMatrix: true
|
|
463
|
+
})
|
|
464
|
+
definePrefix(
|
|
465
|
+
@ProxyParameter(prefixParameterDescriptor) prefix: string,
|
|
466
|
+
@ProxyParameter(prefixTypeParameterDescriptor) prefixType: Nullishable<PrefixType>,
|
|
467
|
+
@ProxyParameter(tweakFactorParameterDescriptor) tweakFactor: Nullishable<number>
|
|
468
|
+
): Matrix<unknown> {
|
|
469
|
+
// Parameters will be validated by IdentificationKeyCreatorProxy.getCreator().
|
|
470
|
+
return [[prefix, prefixType, tweakFactor]];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
abstract class IdentificationKeyCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentificationKeyCreator extends IdentificationKeyCreator> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
475
|
+
private readonly _getCreator: (prefixManager: PrefixManager) => TIdentificationKeyCreator;
|
|
476
|
+
|
|
477
|
+
protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, getCreator: (prefixManager: PrefixManager) => TIdentificationKeyCreator) {
|
|
478
|
+
super(appExtension);
|
|
479
|
+
|
|
480
|
+
this._getCreator = getCreator;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
protected getCreator(prefixDefinition: Matrix<unknown>): TIdentificationKeyCreator {
|
|
484
|
+
const reducedPrefixDefinition = prefixDefinition.length === 1 ?
|
|
485
|
+
// Prefix definition is horizontal.
|
|
486
|
+
prefixDefinition[0] :
|
|
487
|
+
// Prefix definition is vertical.
|
|
488
|
+
prefixDefinition.map((prefixDefinitionRow) => {
|
|
489
|
+
if (prefixDefinitionRow.length !== 1) {
|
|
490
|
+
throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixDefinitionMustBeOneDimensional"));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return prefixDefinitionRow[0];
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
if (reducedPrefixDefinition.length > 3) {
|
|
497
|
+
throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixDefinitionMustHaveMaximumThreeElements"));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const prefix = reducedPrefixDefinition[0];
|
|
501
|
+
|
|
502
|
+
if (typeof prefix !== "string") {
|
|
503
|
+
throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixMustBeString"));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const prefixType = reducedPrefixDefinition[1] ?? PrefixType.GS1CompanyPrefix;
|
|
507
|
+
|
|
508
|
+
if (typeof prefixType !== "number") {
|
|
509
|
+
throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.prefixTypeMustBeNumber"));
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const prefixManager = PrefixManager.get(prefixType, prefix);
|
|
513
|
+
|
|
514
|
+
const tweakFactor = reducedPrefixDefinition[2];
|
|
515
|
+
|
|
516
|
+
if (!isNullish(tweakFactor)) {
|
|
517
|
+
if (typeof tweakFactor !== "number") {
|
|
518
|
+
throw new RangeError(i18nextAppExtension.t("IdentificationKeyCreatorProxy.tweakFactorMustBeNumber"));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
prefixManager.tweakFactor = tweakFactor;
|
|
522
|
+
} else {
|
|
523
|
+
prefixManager.resetTweakFactor();
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
return this._getCreator(prefixManager);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const sparseParameterDescriptor: ParameterDescriptor = {
|
|
531
|
+
name: "sparse",
|
|
532
|
+
type: Type.Boolean,
|
|
533
|
+
isMatrix: false,
|
|
534
|
+
isRequired: false
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
abstract class NumericIdentificationKeyCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentificationKeyCreator extends NumericIdentificationKeyCreator> extends IdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNumericIdentificationKeyCreator> {
|
|
538
|
+
@ProxyMethod({
|
|
539
|
+
type: Type.String,
|
|
540
|
+
isMatrix: true
|
|
541
|
+
})
|
|
542
|
+
create(
|
|
543
|
+
@ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor) prefixDefinition: Matrix<unknown>,
|
|
544
|
+
@ProxyParameter(valueParameterDescriptor) matrixValues: Matrix<number | bigint>,
|
|
545
|
+
@ProxyParameter(sparseParameterDescriptor) sparse: Nullishable<boolean>
|
|
546
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
547
|
+
const creator = this.getCreator(prefixDefinition);
|
|
548
|
+
|
|
549
|
+
const sparseOrUndefined = sparse ?? undefined;
|
|
550
|
+
|
|
551
|
+
return this.mapMatrix(matrixValues, value => creator.create(value, sparseOrUndefined));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
@ProxyMethod({
|
|
555
|
+
infixBefore: "Sequence",
|
|
556
|
+
type: Type.String,
|
|
557
|
+
isMatrix: true
|
|
558
|
+
})
|
|
559
|
+
createSequence(
|
|
560
|
+
@ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor) prefixDefinition: Matrix<unknown>,
|
|
561
|
+
@ProxyParameter(startValueParameterDescriptor) startValue: number,
|
|
562
|
+
@ProxyParameter(countParameterDescriptor) count: number,
|
|
563
|
+
@ProxyParameter(sparseParameterDescriptor) sparse: Nullishable<boolean>
|
|
564
|
+
): Matrix<string> {
|
|
565
|
+
this.appExtension.validateSequenceCount(count);
|
|
566
|
+
|
|
567
|
+
return LibProxy.matrixResult(this.getCreator(prefixDefinition).create(new Sequence(startValue, count), sparse ?? undefined));
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
@ProxyMethod({
|
|
571
|
+
type: Type.String,
|
|
572
|
+
isMatrix: true
|
|
573
|
+
})
|
|
574
|
+
createAll(
|
|
575
|
+
@ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor) prefixDefinition: Matrix<unknown>
|
|
576
|
+
): Matrix<string> {
|
|
577
|
+
const creator = this.getCreator(prefixDefinition);
|
|
578
|
+
|
|
579
|
+
this.appExtension.validateSequenceCount(creator.capacity);
|
|
580
|
+
|
|
581
|
+
return LibProxy.matrixResult(creator.createAll());
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
abstract class NonGTINNumericIdentificationKeyCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentificationKeyCreator extends NonGTINNumericIdentificationKeyCreator> extends NumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentificationKeyCreator> {
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const singleValueParameterDescriptor: ParameterDescriptor = {
|
|
589
|
+
extendsDescriptor: valueParameterDescriptor,
|
|
590
|
+
isMatrix: false
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
const baseIdentificationKeyParameterDescriptor: ParameterDescriptor = {
|
|
594
|
+
extendsDescriptor: identificationKeyParameterDescriptor,
|
|
595
|
+
name: "baseIdentificationKey",
|
|
596
|
+
isMatrix: false
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
const serialComponentParameterDescriptor: ParameterDescriptor = {
|
|
600
|
+
name: "serialComponent",
|
|
601
|
+
type: Type.String,
|
|
602
|
+
isMatrix: true,
|
|
603
|
+
isRequired: true
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
abstract class SerializableNumericIdentificationKeyCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentificationKeyCreator> {
|
|
607
|
+
@ProxyMethod({
|
|
608
|
+
type: Type.String,
|
|
609
|
+
isMatrix: true
|
|
610
|
+
})
|
|
611
|
+
createSerialized(
|
|
612
|
+
@ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor) prefixDefinition: Matrix<unknown>,
|
|
613
|
+
@ProxyParameter(singleValueParameterDescriptor) value: number,
|
|
614
|
+
@ProxyParameter(serialComponentParameterDescriptor) matrixSerialComponents: Matrix<string>,
|
|
615
|
+
@ProxyParameter(sparseParameterDescriptor) sparse: Nullishable<boolean>
|
|
616
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
617
|
+
const creator = this.getCreator(prefixDefinition);
|
|
618
|
+
|
|
619
|
+
const sparseOrUndefined = sparse ?? undefined;
|
|
620
|
+
|
|
621
|
+
return this.mapMatrix(matrixSerialComponents, serialComponent => creator.createSerialized(value, serialComponent, sparseOrUndefined));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
@ProxyMethod({
|
|
625
|
+
type: Type.String,
|
|
626
|
+
isMatrix: true
|
|
627
|
+
})
|
|
628
|
+
concatenate(
|
|
629
|
+
@ProxyParameter(baseIdentificationKeyParameterDescriptor) baseIdentificationKey: string,
|
|
630
|
+
@ProxyParameter(serialComponentParameterDescriptor) matrixSerialComponents: Matrix<string>
|
|
631
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
632
|
+
const creator = this.getCreator([[baseIdentificationKey.substring(0, !baseIdentificationKey.startsWith("0") ? PrefixManager.GS1_COMPANY_PREFIX_MINIMUM_LENGTH : PrefixManager.UPC_COMPANY_PREFIX_MINIMUM_LENGTH + 1), PrefixType.GS1CompanyPrefix]]);
|
|
633
|
+
|
|
634
|
+
return this.mapMatrix(matrixSerialComponents, serialComponent => creator.concatenate(baseIdentificationKey, serialComponent));
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
const referenceParameterDescriptor: ParameterDescriptor = {
|
|
639
|
+
name: "reference",
|
|
640
|
+
type: Type.String,
|
|
641
|
+
isMatrix: true,
|
|
642
|
+
isRequired: true
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
abstract class NonNumericIdentificationKeyCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentificationKeyCreator> {
|
|
646
|
+
@ProxyMethod({
|
|
647
|
+
type: Type.String,
|
|
648
|
+
isMatrix: true
|
|
649
|
+
})
|
|
650
|
+
create(
|
|
651
|
+
@ProxyParameter(prefixDefinitionGS1UPCParameterDescriptor) prefixDefinition: Matrix<unknown>,
|
|
652
|
+
@ProxyParameter(referenceParameterDescriptor) matrixReferences: Matrix<string>
|
|
653
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
654
|
+
const creator = this.getCreator(prefixDefinition);
|
|
655
|
+
|
|
656
|
+
return this.mapMatrix(matrixReferences, reference => creator.create(reference));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
@ProxyClass({
|
|
661
|
+
namespace: "GS1",
|
|
662
|
+
methodInfix: "GTIN",
|
|
663
|
+
replaceParameterDescriptors: [
|
|
664
|
+
{
|
|
665
|
+
name: expandParameterDescriptor(prefixDefinitionGS1UPCParameterDescriptor).name,
|
|
666
|
+
replacement: prefixDefinitionAnyParameterDescriptor
|
|
667
|
+
}
|
|
668
|
+
]
|
|
669
|
+
})
|
|
670
|
+
export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, GTINCreator> {
|
|
671
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
672
|
+
super(appExtension, prefixManager => prefixManager.gtinCreator);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
@ProxyMethod({
|
|
676
|
+
type: Type.String,
|
|
677
|
+
isMatrix: true,
|
|
678
|
+
ignoreInfix: true
|
|
679
|
+
})
|
|
680
|
+
createGTIN14(
|
|
681
|
+
@ProxyParameter(indicatorDigitParameterDescriptor) indicatorDigit: string,
|
|
682
|
+
@ProxyParameter(prefixDefinitionAnyParameterDescriptor) prefixDefinition: Matrix<unknown>,
|
|
683
|
+
@ProxyParameter(valueParameterDescriptor) matrixValues: Matrix<number | bigint>,
|
|
684
|
+
@ProxyParameter(sparseParameterDescriptor) sparse: Nullishable<boolean>
|
|
685
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
686
|
+
const creator = this.getCreator(prefixDefinition);
|
|
687
|
+
|
|
688
|
+
const sparseOrUndefined = sparse ?? undefined;
|
|
689
|
+
|
|
690
|
+
return this.mapMatrix(matrixValues, value => creator.createGTIN14(indicatorDigit, value, sparseOrUndefined));
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
@ProxyMethod({
|
|
694
|
+
type: Type.String,
|
|
695
|
+
isMatrix: true,
|
|
696
|
+
ignoreInfix: true
|
|
697
|
+
})
|
|
698
|
+
createVariableMeasureRCN(
|
|
699
|
+
@ProxyParameter(rcnFormatParameterDescriptor) format: string,
|
|
700
|
+
@ProxyParameter(rcnItemReferenceParameterDescriptor) itemReference: number,
|
|
701
|
+
@ProxyParameter(rcnPriceOrWeightParameterDescriptor) matrixPricesOrWeights: Matrix<number>
|
|
702
|
+
): MatrixResultError<string, ThrowError, TError> {
|
|
703
|
+
return this.mapMatrix(matrixPricesOrWeights, priceOrWeight => GTINCreator.createVariableMeasureRCN(format, itemReference, priceOrWeight));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
@ProxyClass({
|
|
708
|
+
namespace: "GS1",
|
|
709
|
+
methodInfix: "GLN"
|
|
710
|
+
})
|
|
711
|
+
export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyCreator> {
|
|
712
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
713
|
+
super(appExtension, prefixManager => prefixManager.glnCreator);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
@ProxyClass({
|
|
718
|
+
namespace: "GS1",
|
|
719
|
+
methodInfix: "SSCC"
|
|
720
|
+
})
|
|
721
|
+
export class SSCCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyCreator> {
|
|
722
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
723
|
+
super(appExtension, prefixManager => prefixManager.ssccCreator);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
@ProxyClass({
|
|
728
|
+
namespace: "GS1",
|
|
729
|
+
methodInfix: "GRAI"
|
|
730
|
+
})
|
|
731
|
+
export class GRAICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
732
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
733
|
+
super(appExtension, prefixManager => prefixManager.graiCreator);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
@ProxyClass({
|
|
738
|
+
namespace: "GS1",
|
|
739
|
+
methodInfix: "GIAI"
|
|
740
|
+
})
|
|
741
|
+
export class GIAICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
742
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
743
|
+
super(appExtension, prefixManager => prefixManager.giaiCreator);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
@ProxyClass({
|
|
748
|
+
namespace: "GS1",
|
|
749
|
+
methodInfix: "GSRN"
|
|
750
|
+
})
|
|
751
|
+
export class GSRNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyCreator> {
|
|
752
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
753
|
+
super(appExtension, prefixManager => prefixManager.gsrnCreator);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
@ProxyClass({
|
|
758
|
+
namespace: "GS1",
|
|
759
|
+
methodInfix: "GDTI"
|
|
760
|
+
})
|
|
761
|
+
export class GDTICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
762
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
763
|
+
super(appExtension, prefixManager => prefixManager.gdtiCreator);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
@ProxyClass({
|
|
768
|
+
namespace: "GS1",
|
|
769
|
+
methodInfix: "GINC"
|
|
770
|
+
})
|
|
771
|
+
export class GINCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
772
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
773
|
+
super(appExtension, prefixManager => prefixManager.gincCreator);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
@ProxyClass({
|
|
778
|
+
namespace: "GS1",
|
|
779
|
+
methodInfix: "GSIN"
|
|
780
|
+
})
|
|
781
|
+
export class GSINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentificationKeyCreator> {
|
|
782
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
783
|
+
super(appExtension, prefixManager => prefixManager.gsinCreator);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
@ProxyClass({
|
|
788
|
+
namespace: "GS1",
|
|
789
|
+
methodInfix: "GCN"
|
|
790
|
+
})
|
|
791
|
+
export class GCNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
792
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
793
|
+
super(appExtension, prefixManager => prefixManager.gcnCreator);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
@ProxyClass({
|
|
798
|
+
namespace: "GS1",
|
|
799
|
+
methodInfix: "CPID"
|
|
800
|
+
})
|
|
801
|
+
export class CPIDCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
802
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
803
|
+
super(appExtension, prefixManager => prefixManager.cpidCreator);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
@ProxyClass({
|
|
808
|
+
namespace: "GS1",
|
|
809
|
+
methodInfix: "GMN"
|
|
810
|
+
})
|
|
811
|
+
export class GMNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentificationKeyCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
812
|
+
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
813
|
+
super(appExtension, prefixManager => prefixManager.gmnCreator);
|
|
814
|
+
}
|
|
815
|
+
}
|