@aidc-toolkit/app-extension 1.0.24-beta → 1.0.25-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidc-toolkit/app-extension",
3
- "version": "1.0.24-beta",
3
+ "version": "1.0.25-beta",
4
4
  "description": "Application extension framework for AIDC Toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,13 +22,13 @@
22
22
  "build:doc": "npm run build:dev"
23
23
  },
24
24
  "devDependencies": {
25
- "@aidc-toolkit/dev": "beta",
25
+ "@aidc-toolkit/dev": "1.0.25-beta",
26
26
  "@types/node": "^24.10.1"
27
27
  },
28
28
  "dependencies": {
29
- "@aidc-toolkit/core": "beta",
30
- "@aidc-toolkit/gs1": "beta",
31
- "@aidc-toolkit/utility": "beta",
32
- "i18next": "^25.7.0"
29
+ "@aidc-toolkit/core": "1.0.25-beta",
30
+ "@aidc-toolkit/gs1": "1.0.25-beta",
31
+ "@aidc-toolkit/utility": "1.0.25-beta",
32
+ "i18next": "^25.7.1"
33
33
  }
34
34
  }
package/src/descriptor.ts CHANGED
@@ -38,10 +38,15 @@ export const Types = {
38
38
  Any: 3
39
39
  } as const;
40
40
 
41
+ /**
42
+ * Type key.
43
+ */
44
+ export type TypeKey = keyof typeof Types;
45
+
41
46
  /**
42
47
  * Type.
43
48
  */
44
- export type Type = typeof Types[keyof typeof Types];
49
+ export type Type = typeof Types[TypeKey];
45
50
 
46
51
  /**
47
52
  * Type descriptor.
@@ -1,12 +1,12 @@
1
- import { AI39_CREATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
1
+ import { AI39_CREATOR, AI64_VALIDATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
2
2
  import type { AppExtension } from "../app-extension";
3
3
  import { expandParameterDescriptor, ProxyClass } from "../descriptor";
4
4
  import type { ErrorExtends } from "../type";
5
+ import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility";
5
6
  import {
6
7
  exclusionAllNumericParameterDescriptor,
7
8
  exclusionNoneParameterDescriptor
8
9
  } from "../utility/character-set-descriptor";
9
- import { CharacterSetProxy } from "../utility";
10
10
 
11
11
  @ProxyClass({
12
12
  namespace: "GS1",
@@ -18,7 +18,7 @@ import { CharacterSetProxy } from "../utility";
18
18
  }
19
19
  ]
20
20
  })
21
- export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
21
+ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
22
22
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
23
23
  super(appExtension, AI82_CREATOR);
24
24
  }
@@ -34,8 +34,18 @@ export class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<T
34
34
  }
35
35
  ]
36
36
  })
37
- export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
37
+ export class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
38
38
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
39
39
  super(appExtension, AI39_CREATOR);
40
40
  }
41
41
  }
42
+
43
+ @ProxyClass({
44
+ namespace: "GS1",
45
+ methodInfix: "AI64"
46
+ })
47
+ export class AI64Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
48
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
49
+ super(appExtension, AI64_VALIDATOR);
50
+ }
51
+ }
@@ -1,38 +1,35 @@
1
1
  import { isNullish, type Nullishable } from "@aidc-toolkit/core";
2
2
  import {
3
- CPID_VALIDATOR,
4
- GCN_VALIDATOR,
5
- GDTI_VALIDATOR,
6
- GIAI_VALIDATOR,
7
- GINC_VALIDATOR,
8
- GLN_VALIDATOR,
9
- GMN_VALIDATOR,
10
- GRAI_VALIDATOR,
11
- GSIN_VALIDATOR,
12
- GSRN_VALIDATOR,
13
- GTIN12_VALIDATOR,
14
- GTIN13_VALIDATOR,
15
- GTIN8_VALIDATOR,
16
3
  GTINCreator,
4
+ type GTINDescriptor,
17
5
  type GTINLevel,
6
+ GTINTypes,
18
7
  GTINValidator,
19
8
  type IdentifierCreator,
9
+ type IdentifierDescriptor,
10
+ type IdentifierType,
11
+ type IdentifierTypes,
12
+ type IdentifierTypeValidator,
20
13
  type IdentifierValidation,
21
- type IdentifierValidator,
14
+ IdentifierValidators,
22
15
  type NonGTINNumericIdentifierCreator,
23
- type NonGTINNumericIdentifierValidator,
16
+ type NonGTINNumericIdentifierDescriptor,
17
+ type NonGTINNumericIdentifierType,
24
18
  type NonNumericIdentifierCreator,
19
+ type NonNumericIdentifierDescriptor,
20
+ type NonNumericIdentifierType,
25
21
  type NonNumericIdentifierValidation,
26
- type NonNumericIdentifierValidator,
27
22
  type NumericIdentifierCreator,
28
- type NumericIdentifierValidator,
23
+ type NumericIdentifierDescriptor,
24
+ type NumericIdentifierType,
25
+ type NumericIdentifierValidation,
29
26
  PrefixManager,
30
27
  type PrefixType,
31
28
  PrefixTypes,
32
29
  PrefixValidator,
33
30
  type SerializableNumericIdentifierCreator,
34
- type SerializableNumericIdentifierValidator,
35
- SSCC_VALIDATOR
31
+ type SerializableNumericIdentifierDescriptor,
32
+ type SerializableNumericIdentifierType
36
33
  } from "@aidc-toolkit/gs1";
37
34
  import { Sequence } from "@aidc-toolkit/utility";
38
35
  import type { AppExtension } from "../app-extension";
@@ -68,21 +65,21 @@ const validateIdentifierParameterDescriptor: ParameterDescriptor = {
68
65
  name: "validateIdentifier"
69
66
  };
70
67
 
71
- abstract class IdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentifierValidation extends IdentifierValidation, TIdentifierValidator extends IdentifierValidator<TIdentifierValidation>> extends StringProxy<ThrowError, TError, TInvocationContext, TBigInt> {
72
- private readonly _validator: TIdentifierValidator;
68
+ abstract class IdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentifierType extends IdentifierType> extends StringProxy<ThrowError, TError, TInvocationContext, TBigInt> {
69
+ private readonly _validator: IdentifierTypeValidator<TIdentifierType>;
73
70
 
74
- protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, validator: TIdentifierValidator) {
71
+ protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, validator: IdentifierTypeValidator<TIdentifierType>) {
75
72
  super(appExtension);
76
73
 
77
74
  this._validator = validator;
78
75
  }
79
76
 
80
- protected get validator(): TIdentifierValidator {
77
+ protected get validator(): IdentifierTypeValidator<TIdentifierType> {
81
78
  return this._validator;
82
79
  }
83
80
  }
84
81
 
85
- abstract class NumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentifierValidator extends NumericIdentifierValidator> extends IdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, IdentifierValidation, TNumericIdentifierValidator> {
82
+ abstract class NumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentifierType extends NumericIdentifierType> extends IdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNumericIdentifierType> {
86
83
  @ProxyMethod({
87
84
  type: Types.String,
88
85
  isMatrix: true
@@ -94,16 +91,16 @@ abstract class NumericIdentifierValidatorProxy<ThrowError extends boolean, TErro
94
91
  }
95
92
  }
96
93
 
97
- abstract class GTINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, GTINValidator> {
94
+ abstract class GTINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, typeof IdentifierTypes.GTIN> {
98
95
  }
99
96
 
100
- abstract class NonGTINNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentifierValidator extends NonGTINNumericIdentifierValidator> extends NumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentifierValidator> {
97
+ abstract class NonGTINNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType = NonGTINNumericIdentifierType> extends NumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentifierType> {
101
98
  }
102
99
 
103
- abstract class SerializableNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentifierValidator> {
100
+ abstract class SerializableNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentifierType> {
104
101
  }
105
102
 
106
- abstract class NonNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentifierValidation, NonNumericIdentifierValidator> {
103
+ abstract class NonNumericIdentifierValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentifierType> {
107
104
  @ProxyMethod({
108
105
  type: Types.String,
109
106
  isMatrix: true
@@ -124,7 +121,7 @@ abstract class NonNumericIdentifierValidatorProxy<ThrowError extends boolean, TE
124
121
  })
125
122
  export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
126
123
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
127
- super(appExtension, GTIN13_VALIDATOR);
124
+ super(appExtension, IdentifierValidators.GTIN[GTINTypes.GTIN13]);
128
125
  }
129
126
  }
130
127
 
@@ -134,7 +131,7 @@ export class GTIN13ValidatorProxy<ThrowError extends boolean, TError extends Err
134
131
  })
135
132
  export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
136
133
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
137
- super(appExtension, GTIN12_VALIDATOR);
134
+ super(appExtension, IdentifierValidators.GTIN[GTINTypes.GTIN12]);
138
135
  }
139
136
  }
140
137
 
@@ -144,7 +141,7 @@ export class GTIN12ValidatorProxy<ThrowError extends boolean, TError extends Err
144
141
  })
145
142
  export class GTIN8ValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends GTINValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
146
143
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
147
- super(appExtension, GTIN8_VALIDATOR);
144
+ super(appExtension, IdentifierValidators.GTIN[GTINTypes.GTIN8]);
148
145
  }
149
146
  }
150
147
 
@@ -312,9 +309,9 @@ export class GTINValidatorStaticProxy<ThrowError extends boolean, TError extends
312
309
  namespace: "GS1",
313
310
  methodInfix: "GLN"
314
311
  })
315
- export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierValidator> {
312
+ export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
316
313
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
317
- super(appExtension, GLN_VALIDATOR);
314
+ super(appExtension, IdentifierValidators.GLN);
318
315
  }
319
316
  }
320
317
 
@@ -322,9 +319,9 @@ export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorE
322
319
  namespace: "GS1",
323
320
  methodInfix: "SSCC"
324
321
  })
325
- export class SSCCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierValidator> {
322
+ export class SSCCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
326
323
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
327
- super(appExtension, SSCC_VALIDATOR);
324
+ super(appExtension, IdentifierValidators.SSCC);
328
325
  }
329
326
  }
330
327
 
@@ -334,7 +331,7 @@ export class SSCCValidatorProxy<ThrowError extends boolean, TError extends Error
334
331
  })
335
332
  export class GRAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
336
333
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
337
- super(appExtension, GRAI_VALIDATOR);
334
+ super(appExtension, IdentifierValidators.GRAI);
338
335
  }
339
336
  }
340
337
 
@@ -344,7 +341,7 @@ export class GRAIValidatorProxy<ThrowError extends boolean, TError extends Error
344
341
  })
345
342
  export class GIAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
346
343
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
347
- super(appExtension, GIAI_VALIDATOR);
344
+ super(appExtension, IdentifierValidators.GIAI);
348
345
  }
349
346
  }
350
347
 
@@ -352,9 +349,9 @@ export class GIAIValidatorProxy<ThrowError extends boolean, TError extends Error
352
349
  namespace: "GS1",
353
350
  methodInfix: "GSRN"
354
351
  })
355
- export class GSRNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierValidator> {
352
+ export class GSRNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
356
353
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
357
- super(appExtension, GSRN_VALIDATOR);
354
+ super(appExtension, IdentifierValidators.GSRN);
358
355
  }
359
356
  }
360
357
 
@@ -364,7 +361,7 @@ export class GSRNValidatorProxy<ThrowError extends boolean, TError extends Error
364
361
  })
365
362
  export class GDTIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
366
363
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
367
- super(appExtension, GDTI_VALIDATOR);
364
+ super(appExtension, IdentifierValidators.GDTI);
368
365
  }
369
366
  }
370
367
 
@@ -374,7 +371,7 @@ export class GDTIValidatorProxy<ThrowError extends boolean, TError extends Error
374
371
  })
375
372
  export class GINCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
376
373
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
377
- super(appExtension, GINC_VALIDATOR);
374
+ super(appExtension, IdentifierValidators.GINC);
378
375
  }
379
376
  }
380
377
 
@@ -382,9 +379,9 @@ export class GINCValidatorProxy<ThrowError extends boolean, TError extends Error
382
379
  namespace: "GS1",
383
380
  methodInfix: "GSIN"
384
381
  })
385
- export class GSINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierValidator> {
382
+ export class GSINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
386
383
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
387
- super(appExtension, GSIN_VALIDATOR);
384
+ super(appExtension, IdentifierValidators.GSIN);
388
385
  }
389
386
  }
390
387
 
@@ -394,7 +391,7 @@ export class GSINValidatorProxy<ThrowError extends boolean, TError extends Error
394
391
  })
395
392
  export class GCNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
396
393
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
397
- super(appExtension, GCN_VALIDATOR);
394
+ super(appExtension, IdentifierValidators.GCN);
398
395
  }
399
396
  }
400
397
 
@@ -404,7 +401,7 @@ export class GCNValidatorProxy<ThrowError extends boolean, TError extends ErrorE
404
401
  })
405
402
  export class CPIDValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
406
403
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
407
- super(appExtension, CPID_VALIDATOR);
404
+ super(appExtension, IdentifierValidators.CPID);
408
405
  }
409
406
  }
410
407
 
@@ -414,7 +411,7 @@ export class CPIDValidatorProxy<ThrowError extends boolean, TError extends Error
414
411
  })
415
412
  export class GMNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
416
413
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
417
- super(appExtension, GMN_VALIDATOR);
414
+ super(appExtension, IdentifierValidators.GMN);
418
415
  }
419
416
  }
420
417
 
@@ -474,8 +471,8 @@ export class PrefixManagerProxy<ThrowError extends boolean, TError extends Error
474
471
  }
475
472
  }
476
473
 
477
- abstract class IdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentifierCreator extends IdentifierCreator> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
478
- private static readonly PREFIX_TYPES: PrefixType[] = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
474
+ abstract class IdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TIdentifierDescriptor extends IdentifierDescriptor, TIdentifierValidation extends IdentifierValidation, TIdentifierCreator extends IdentifierCreator<TIdentifierDescriptor, TIdentifierValidation>> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
475
+ private static readonly PREFIX_TYPES: Array<PrefixType | undefined> = [PrefixTypes.GS1CompanyPrefix, PrefixTypes.UPCCompanyPrefix, PrefixTypes.GS18Prefix];
479
476
 
480
477
  private readonly _getCreator: (prefixManager: PrefixManager) => TIdentifierCreator;
481
478
 
@@ -515,7 +512,14 @@ abstract class IdentifierCreatorProxy<ThrowError extends boolean, TError extends
515
512
  }));
516
513
  }
517
514
 
518
- const prefixManager = PrefixManager.get(IdentifierCreatorProxy.PREFIX_TYPES[prefixTypeIndex], prefix);
515
+ const prefixType = IdentifierCreatorProxy.PREFIX_TYPES[prefixTypeIndex];
516
+
517
+ // Undefined is included in type in case of invalid input.
518
+ if (prefixType === undefined) {
519
+ throw new RangeError(i18nextAppExtension.t("IdentifierCreatorProxy.invalidPrefixType"));
520
+ }
521
+
522
+ const prefixManager = PrefixManager.get(prefixType, prefix);
519
523
 
520
524
  const tweakFactor = reducedPrefixDefinition[2];
521
525
 
@@ -540,7 +544,7 @@ const sparseParameterDescriptor: ParameterDescriptor = {
540
544
  isRequired: false
541
545
  };
542
546
 
543
- abstract class NumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentifierCreator extends NumericIdentifierCreator> extends IdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNumericIdentifierCreator> {
547
+ abstract class NumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNumericIdentifierDescriptor extends NumericIdentifierDescriptor, TNumericIdentifierCreator extends NumericIdentifierCreator<TNumericIdentifierDescriptor>> extends IdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNumericIdentifierDescriptor, NumericIdentifierValidation, TNumericIdentifierCreator> {
544
548
  @ProxyMethod({
545
549
  type: Types.String,
546
550
  isMatrix: true
@@ -588,7 +592,7 @@ abstract class NumericIdentifierCreatorProxy<ThrowError extends boolean, TError
588
592
  }
589
593
  }
590
594
 
591
- abstract class NonGTINNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentifierCreator extends NonGTINNumericIdentifierCreator> extends NumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentifierCreator> {
595
+ abstract class NonGTINNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt, TNonGTINNumericIdentifierDescriptor extends NonGTINNumericIdentifierDescriptor, TNonGTINNumericIdentifierCreator extends NonGTINNumericIdentifierCreator> extends NumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, TNonGTINNumericIdentifierDescriptor, TNonGTINNumericIdentifierCreator> {
592
596
  }
593
597
 
594
598
  const singleValueParameterDescriptor: ParameterDescriptor = {
@@ -609,7 +613,7 @@ const serialComponentParameterDescriptor: ParameterDescriptor = {
609
613
  isRequired: true
610
614
  };
611
615
 
612
- abstract class SerializableNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentifierCreator> {
616
+ abstract class SerializableNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, SerializableNumericIdentifierDescriptor, SerializableNumericIdentifierCreator> {
613
617
  @ProxyMethod({
614
618
  type: Types.String,
615
619
  isMatrix: true
@@ -648,7 +652,7 @@ const referenceParameterDescriptor: ParameterDescriptor = {
648
652
  isRequired: true
649
653
  };
650
654
 
651
- abstract class NonNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentifierCreator> {
655
+ abstract class NonNumericIdentifierCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends IdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonNumericIdentifierDescriptor, NonNumericIdentifierValidation, NonNumericIdentifierCreator> {
652
656
  @ProxyMethod({
653
657
  type: Types.String,
654
658
  isMatrix: true
@@ -673,7 +677,7 @@ abstract class NonNumericIdentifierCreatorProxy<ThrowError extends boolean, TErr
673
677
  }
674
678
  ]
675
679
  })
676
- export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, GTINCreator> {
680
+ export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, GTINDescriptor, GTINCreator> {
677
681
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
678
682
  super(appExtension, prefixManager => prefixManager.gtinCreator);
679
683
  }
@@ -714,7 +718,7 @@ export class GTINCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
714
718
  namespace: "GS1",
715
719
  methodInfix: "GLN"
716
720
  })
717
- export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierCreator> {
721
+ export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierDescriptor, NonGTINNumericIdentifierCreator> {
718
722
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
719
723
  super(appExtension, prefixManager => prefixManager.glnCreator);
720
724
  }
@@ -724,7 +728,7 @@ export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExt
724
728
  namespace: "GS1",
725
729
  methodInfix: "SSCC"
726
730
  })
727
- export class SSCCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierCreator> {
731
+ export class SSCCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierDescriptor, NonGTINNumericIdentifierCreator> {
728
732
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
729
733
  super(appExtension, prefixManager => prefixManager.ssccCreator);
730
734
  }
@@ -754,7 +758,7 @@ export class GIAICreatorProxy<ThrowError extends boolean, TError extends ErrorEx
754
758
  namespace: "GS1",
755
759
  methodInfix: "GSRN"
756
760
  })
757
- export class GSRNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierCreator> {
761
+ export class GSRNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierDescriptor, NonGTINNumericIdentifierCreator> {
758
762
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
759
763
  super(appExtension, prefixManager => prefixManager.gsrnCreator);
760
764
  }
@@ -784,7 +788,7 @@ export class GINCCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
784
788
  namespace: "GS1",
785
789
  methodInfix: "GSIN"
786
790
  })
787
- export class GSINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierCreator> {
791
+ export class GSINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonGTINNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonGTINNumericIdentifierDescriptor, NonGTINNumericIdentifierCreator> {
788
792
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
789
793
  super(appExtension, prefixManager => prefixManager.gsinCreator);
790
794
  }
@@ -12,6 +12,7 @@ export default {
12
12
  prefixDefinitionMustHaveMaximumThreeElements: "Prefix definition must have a maximum of 3 elements",
13
13
  prefixMustBeString: "Prefix must be a string",
14
14
  prefixTypeMustBeNumber: "Prefix type must be a number in the range of 0 to {{maximumPrefixType, number}}",
15
+ invalidPrefixType: "Invalid prefix type",
15
16
  tweakFactorMustBeNumber: "Tweak factor must be a number"
16
17
  },
17
18
  Parameters: {
@@ -354,6 +355,14 @@ export default {
354
355
  name: "valueForAI39",
355
356
  description: "Get the value for a GS1 AI 39 encodable character set string."
356
357
  },
358
+ validateAI64: {
359
+ name: "validateAI64",
360
+ description: "Validate a GS1 AI 64 encodable character set string."
361
+ },
362
+ isValidAI64: {
363
+ name: "isValidAI64",
364
+ description: "Determine if a string is GS1 AI 64 encodable character set."
365
+ },
357
366
  checkDigit: {
358
367
  name: "checkDigit",
359
368
  description: "Calculate the check digit for a numeric string."
@@ -12,6 +12,7 @@ export default {
12
12
  prefixDefinitionMustHaveMaximumThreeElements: "La définition du préfixe doit comporter un maximum de 3 éléments",
13
13
  prefixMustBeString: "Le préfixe doit être une chaîne",
14
14
  prefixTypeMustBeNumber: "Le type de préfixe doit être un nombre compris entre 0 et {{maximumPrefixType, number}}",
15
+ invalidPrefixType: "Type de préfixe invalide",
15
16
  tweakFactorMustBeNumber: "Le facteur de réglage doit être un nombre"
16
17
  },
17
18
  Parameters: {
@@ -354,6 +355,14 @@ export default {
354
355
  name: "valeurDeAI39",
355
356
  description: "Obtenez la valeur d'une chaîne de caractères GS1 AI 39."
356
357
  },
358
+ validateAI64: {
359
+ name: "validerAI64",
360
+ description: "Valider une chaîne de caractères GS1 AI 64."
361
+ },
362
+ isValidAI64: {
363
+ name: "estValideAI64",
364
+ description: "Déterminer si une chaîne est un jeu de caractères GS1 AI 64."
365
+ },
357
366
  checkDigit: {
358
367
  name: "chiffreDeControle",
359
368
  description: "Calculer le chiffre de contrôle pour une chaîne numérique."
package/src/type.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Type that error type is expected to extend. If the application framework reports errors through the throw/catch
3
- * mechanism, the error type is expected to extend {@link Error}. Otherwise, it may extend any object type.
3
+ * mechanism, the error type is expected to extend {@linkcode Error}. Otherwise, it may extend any object type.
4
4
  *
5
5
  * @template ThrowError
6
6
  * If true, errors are reported through the throw/catch mechanism.
@@ -4,6 +4,7 @@ import {
4
4
  ALPHANUMERIC_CREATOR,
5
5
  type CharacterSetCreator,
6
6
  type CharacterSetValidation,
7
+ type CharacterSetValidator,
7
8
  type Exclusion,
8
9
  HEXADECIMAL_CREATOR,
9
10
  NUMERIC_CREATOR,
@@ -46,13 +47,13 @@ const valueForSParameterDescriptor: ParameterDescriptor = {
46
47
  name: "valueForS"
47
48
  };
48
49
 
49
- export abstract class CharacterSetProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends StringProxy<ThrowError, TError, TInvocationContext, TBigInt> {
50
- private readonly _characterSetCreator: CharacterSetCreator;
50
+ export abstract class CharacterSetValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends StringProxy<ThrowError, TError, TInvocationContext, TBigInt> {
51
+ private readonly _characterSetValidator: CharacterSetValidator;
51
52
 
52
- protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, characterSetCreator: CharacterSetCreator) {
53
+ protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, characterSetValidator: CharacterSetValidator) {
53
54
  super(appExtension);
54
55
 
55
- this._characterSetCreator = characterSetCreator;
56
+ this._characterSetValidator = characterSetValidator;
56
57
  }
57
58
 
58
59
  @ProxyMethod({
@@ -63,7 +64,7 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
63
64
  @ProxyParameter(validateSParameterDescriptor) matrixSs: Matrix<string>,
64
65
  @ProxyParameter(exclusionNoneParameterDescriptor) exclusion: Nullishable<Exclusion>
65
66
  ): MatrixResultError<string, ThrowError, TError> {
66
- return this.validateString(this._characterSetCreator, matrixSs, {
67
+ return this.validateString(this._characterSetValidator, matrixSs, {
67
68
  exclusion: exclusion ?? undefined
68
69
  } satisfies CharacterSetValidation);
69
70
  }
@@ -78,6 +79,16 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
78
79
  ): MatrixResultError<boolean, ThrowError, TError> {
79
80
  return this.isValidString(this.validate(matrixSs, exclusion));
80
81
  }
82
+ }
83
+
84
+ export abstract class CharacterSetCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
85
+ private readonly _characterSetCreator: CharacterSetCreator;
86
+
87
+ protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, characterSetCreator: CharacterSetCreator) {
88
+ super(appExtension, characterSetCreator);
89
+
90
+ this._characterSetCreator = characterSetCreator;
91
+ }
81
92
 
82
93
  @ProxyMethod({
83
94
  type: Types.String,
@@ -140,7 +151,7 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
140
151
  }
141
152
  ]
142
153
  })
143
- export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
154
+ export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
144
155
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
145
156
  super(appExtension, NUMERIC_CREATOR);
146
157
  }
@@ -155,7 +166,7 @@ export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtend
155
166
  }
156
167
  ]
157
168
  })
158
- export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
169
+ export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
159
170
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
160
171
  super(appExtension, HEXADECIMAL_CREATOR);
161
172
  }
@@ -164,7 +175,7 @@ export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorEx
164
175
  @ProxyClass({
165
176
  methodInfix: "Alphabetic"
166
177
  })
167
- export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
178
+ export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
168
179
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
169
180
  super(appExtension, ALPHABETIC_CREATOR);
170
181
  }
@@ -179,7 +190,7 @@ export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExt
179
190
  }
180
191
  ]
181
192
  })
182
- export class AlphanumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetProxy<ThrowError, TError, TInvocationContext, TBigInt> {
193
+ export class AlphanumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
183
194
  constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
184
195
  super(appExtension, ALPHANUMERIC_CREATOR);
185
196
  }