@aidc-toolkit/app-extension 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.
Files changed (38) hide show
  1. package/dist/index.cjs +1115 -876
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +79 -241
  4. package/dist/index.d.ts +79 -241
  5. package/dist/index.js +1113 -869
  6. package/dist/index.js.map +1 -1
  7. package/package.json +5 -5
  8. package/src/app-extension.ts +5 -5
  9. package/src/app-utility-proxy.ts +18 -24
  10. package/src/descriptor.ts +29 -259
  11. package/src/generator/generator.ts +89 -131
  12. package/src/generator/index.ts +0 -1
  13. package/src/generator/locale-resources-generator.ts +39 -14
  14. package/src/gs1/character-set-proxy.ts +5 -5
  15. package/src/gs1/check-proxy.ts +35 -42
  16. package/src/gs1/gtin-creator-proxy.ts +58 -0
  17. package/src/gs1/gtin-descriptor.ts +29 -0
  18. package/src/gs1/gtin-validator-proxy.ts +161 -0
  19. package/src/gs1/identifier-creator-proxy.ts +227 -0
  20. package/src/gs1/identifier-validator-proxy.ts +87 -0
  21. package/src/gs1/index.ts +5 -1
  22. package/src/gs1/non-gtin-creator-proxy.ts +119 -0
  23. package/src/gs1/non-gtin-validator-proxy.ts +119 -0
  24. package/src/gs1/prefix-definition-descriptor.ts +18 -0
  25. package/src/gs1/prefix-manager-proxy.ts +42 -0
  26. package/src/index.ts +1 -0
  27. package/src/lib-proxy.ts +1 -1
  28. package/src/proxy.ts +526 -0
  29. package/src/utility/character-set-descriptor.ts +5 -5
  30. package/src/utility/character-set-proxy.ts +31 -47
  31. package/src/utility/reg-exp-proxy.ts +11 -15
  32. package/src/utility/string-descriptor.ts +2 -2
  33. package/src/utility/transformer-descriptor.ts +3 -3
  34. package/src/utility/transformer-proxy.ts +16 -26
  35. package/tsconfig-src.json +1 -4
  36. package/tsconfig.json +1 -0
  37. package/src/generator/descriptor.ts +0 -125
  38. package/src/gs1/identifier-proxy.ts +0 -826
@@ -0,0 +1,119 @@
1
+ import type { NonGTINNumericIdentifierCreator, NonSerializableNumericIdentifierType } from "@aidc-toolkit/gs1";
2
+ import type { AppExtension } from "../app-extension.js";
3
+ import { proxy } from "../proxy.js";
4
+ import type { ErrorExtends } from "../type.js";
5
+ import {
6
+ NonNumericIdentifierCreatorProxy,
7
+ NonSerializableNumericIdentifierCreatorProxy,
8
+ SerializableNumericIdentifierCreatorProxy
9
+ } from "./identifier-creator-proxy.js";
10
+
11
+ @proxy.describeClass(false, {
12
+ namespace: "GS1",
13
+ methodInfix: "GLN"
14
+ })
15
+ export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
16
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
17
+ super(appExtension, prefixManager => prefixManager.glnCreator);
18
+ }
19
+ }
20
+
21
+ @proxy.describeClass(false, {
22
+ namespace: "GS1",
23
+ methodInfix: "SSCC"
24
+ })
25
+ export class SSCCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
26
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
27
+ super(appExtension, prefixManager => prefixManager.ssccCreator);
28
+ }
29
+ }
30
+
31
+ @proxy.describeClass(false, {
32
+ namespace: "GS1",
33
+ methodInfix: "GRAI"
34
+ })
35
+ export class GRAICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
36
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
37
+ super(appExtension, prefixManager => prefixManager.graiCreator);
38
+ }
39
+ }
40
+
41
+ @proxy.describeClass(false, {
42
+ namespace: "GS1",
43
+ methodInfix: "GIAI"
44
+ })
45
+ export class GIAICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
46
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
47
+ super(appExtension, prefixManager => prefixManager.giaiCreator);
48
+ }
49
+ }
50
+
51
+ @proxy.describeClass(false, {
52
+ namespace: "GS1",
53
+ methodInfix: "GSRN"
54
+ })
55
+ export class GSRNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
56
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
57
+ super(appExtension, prefixManager => prefixManager.gsrnCreator);
58
+ }
59
+ }
60
+
61
+ @proxy.describeClass(false, {
62
+ namespace: "GS1",
63
+ methodInfix: "GDTI"
64
+ })
65
+ export class GDTICreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
66
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
67
+ super(appExtension, prefixManager => prefixManager.gdtiCreator);
68
+ }
69
+ }
70
+
71
+ @proxy.describeClass(false, {
72
+ namespace: "GS1",
73
+ methodInfix: "GINC"
74
+ })
75
+ export class GINCCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
76
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
77
+ super(appExtension, prefixManager => prefixManager.gincCreator);
78
+ }
79
+ }
80
+
81
+ @proxy.describeClass(false, {
82
+ namespace: "GS1",
83
+ methodInfix: "GSIN"
84
+ })
85
+ export class GSINCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt, NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
86
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
87
+ super(appExtension, prefixManager => prefixManager.gsinCreator);
88
+ }
89
+ }
90
+
91
+ @proxy.describeClass(false, {
92
+ namespace: "GS1",
93
+ methodInfix: "GCN"
94
+ })
95
+ export class GCNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
96
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
97
+ super(appExtension, prefixManager => prefixManager.gcnCreator);
98
+ }
99
+ }
100
+
101
+ @proxy.describeClass(false, {
102
+ namespace: "GS1",
103
+ methodInfix: "CPID"
104
+ })
105
+ export class CPIDCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
106
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
107
+ super(appExtension, prefixManager => prefixManager.cpidCreator);
108
+ }
109
+ }
110
+
111
+ @proxy.describeClass(false, {
112
+ namespace: "GS1",
113
+ methodInfix: "GMN"
114
+ })
115
+ export class GMNCreatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
116
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
117
+ super(appExtension, prefixManager => prefixManager.gmnCreator);
118
+ }
119
+ }
@@ -0,0 +1,119 @@
1
+ import { IdentifierValidators } from "@aidc-toolkit/gs1";
2
+ import type { AppExtension } from "../app-extension.js";
3
+ import { proxy } from "../proxy.js";
4
+ import type { ErrorExtends } from "../type.js";
5
+ import {
6
+ NonNumericIdentifierValidatorProxy,
7
+ NonSerializableNumericIdentifierValidatorProxy,
8
+ SerializableNumericIdentifierValidatorProxy
9
+ } from "./identifier-validator-proxy.js";
10
+
11
+ @proxy.describeClass(false, {
12
+ namespace: "GS1",
13
+ methodInfix: "GLN"
14
+ })
15
+ export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
16
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
17
+ super(appExtension, IdentifierValidators.GLN);
18
+ }
19
+ }
20
+
21
+ @proxy.describeClass(false, {
22
+ namespace: "GS1",
23
+ methodInfix: "SSCC"
24
+ })
25
+ export class SSCCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
26
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
27
+ super(appExtension, IdentifierValidators.SSCC);
28
+ }
29
+ }
30
+
31
+ @proxy.describeClass(false, {
32
+ namespace: "GS1",
33
+ methodInfix: "GRAI"
34
+ })
35
+ export class GRAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
36
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
37
+ super(appExtension, IdentifierValidators.GRAI);
38
+ }
39
+ }
40
+
41
+ @proxy.describeClass(false, {
42
+ namespace: "GS1",
43
+ methodInfix: "GIAI"
44
+ })
45
+ export class GIAIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
46
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
47
+ super(appExtension, IdentifierValidators.GIAI);
48
+ }
49
+ }
50
+
51
+ @proxy.describeClass(false, {
52
+ namespace: "GS1",
53
+ methodInfix: "GSRN"
54
+ })
55
+ export class GSRNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
56
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
57
+ super(appExtension, IdentifierValidators.GSRN);
58
+ }
59
+ }
60
+
61
+ @proxy.describeClass(false, {
62
+ namespace: "GS1",
63
+ methodInfix: "GDTI"
64
+ })
65
+ export class GDTIValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
66
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
67
+ super(appExtension, IdentifierValidators.GDTI);
68
+ }
69
+ }
70
+
71
+ @proxy.describeClass(false, {
72
+ namespace: "GS1",
73
+ methodInfix: "GINC"
74
+ })
75
+ export class GINCValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
76
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
77
+ super(appExtension, IdentifierValidators.GINC);
78
+ }
79
+ }
80
+
81
+ @proxy.describeClass(false, {
82
+ namespace: "GS1",
83
+ methodInfix: "GSIN"
84
+ })
85
+ export class GSINValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonSerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
86
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
87
+ super(appExtension, IdentifierValidators.GSIN);
88
+ }
89
+ }
90
+
91
+ @proxy.describeClass(false, {
92
+ namespace: "GS1",
93
+ methodInfix: "GCN"
94
+ })
95
+ export class GCNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends SerializableNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
96
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
97
+ super(appExtension, IdentifierValidators.GCN);
98
+ }
99
+ }
100
+
101
+ @proxy.describeClass(false, {
102
+ namespace: "GS1",
103
+ methodInfix: "CPID"
104
+ })
105
+ export class CPIDValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
106
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
107
+ super(appExtension, IdentifierValidators.CPID);
108
+ }
109
+ }
110
+
111
+ @proxy.describeClass(false, {
112
+ namespace: "GS1",
113
+ methodInfix: "GMN"
114
+ })
115
+ export class GMNValidatorProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends NonNumericIdentifierValidatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
116
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
117
+ super(appExtension, IdentifierValidators.GMN);
118
+ }
119
+ }
@@ -0,0 +1,18 @@
1
+ import { type ExtendsParameterDescriptor, type ParameterDescriptor, Types } from "../descriptor.js";
2
+
3
+ const prefixDefinitionParameterDescriptor: ParameterDescriptor = {
4
+ name: "prefixDefinition",
5
+ type: Types.Any,
6
+ isMatrix: true,
7
+ isRequired: true
8
+ };
9
+
10
+ export const prefixDefinitionGS1UPCParameterDescriptor: ExtendsParameterDescriptor = {
11
+ extendsDescriptor: prefixDefinitionParameterDescriptor,
12
+ name: "prefixDefinitionGS1UPC"
13
+ };
14
+
15
+ export const prefixDefinitionAnyParameterDescriptor: ExtendsParameterDescriptor = {
16
+ extendsDescriptor: prefixDefinitionParameterDescriptor,
17
+ name: "prefixDefinitionAny"
18
+ };
@@ -0,0 +1,42 @@
1
+ import type { Nullishable } from "@aidc-toolkit/core";
2
+ import type { PrefixType } from "@aidc-toolkit/gs1";
3
+ import { type ParameterDescriptor, Types } from "../descriptor.js";
4
+ import { LibProxy } from "../lib-proxy.js";
5
+ import { proxy } from "../proxy.js";
6
+ import type { ErrorExtends, Matrix } from "../type.js";
7
+
8
+ const prefixParameterDescriptor: ParameterDescriptor = {
9
+ name: "prefix",
10
+ type: Types.String,
11
+ isMatrix: false,
12
+ isRequired: true
13
+ };
14
+
15
+ const prefixTypeParameterDescriptor: ParameterDescriptor = {
16
+ name: "prefixType",
17
+ type: Types.Number,
18
+ isMatrix: false,
19
+ isRequired: false
20
+ };
21
+
22
+ const tweakFactorParameterDescriptor: ParameterDescriptor = {
23
+ name: "tweakFactor",
24
+ type: Types.Number,
25
+ isMatrix: false,
26
+ isRequired: false
27
+ };
28
+
29
+ @proxy.describeClass(false, {
30
+ namespace: "GS1"
31
+ })
32
+ export class PrefixManagerProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
33
+ @proxy.describeMethod({
34
+ type: Types.Any,
35
+ isMatrix: true,
36
+ parameterDescriptors: [prefixParameterDescriptor, prefixTypeParameterDescriptor, tweakFactorParameterDescriptor]
37
+ })
38
+ definePrefix(prefix: string, prefixType: Nullishable<PrefixType>, tweakFactor: Nullishable<number>): Matrix<unknown> {
39
+ // Parameters will be validated by IdentifierCreatorProxy.getCreator().
40
+ return [[prefix, prefixType, tweakFactor]];
41
+ }
42
+ }
package/src/index.ts CHANGED
@@ -23,3 +23,4 @@ export * from "./app-utility-proxy.js";
23
23
  export * from "./utility/index.js";
24
24
  export * as GS1 from "./gs1/index.js";
25
25
  export * from "./generator/index.js";
26
+ export { expandParameterDescriptor } from "./proxy.js";
package/src/lib-proxy.ts CHANGED
@@ -37,7 +37,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
37
37
  /**
38
38
  * Get the application extension.
39
39
  */
40
- protected get appExtension(): AppExtension<ThrowError, TError, TInvocationContext, TBigInt> {
40
+ get appExtension(): AppExtension<ThrowError, TError, TInvocationContext, TBigInt> {
41
41
  return this.#appExtension;
42
42
  }
43
43