@aidc-toolkit/app-extension 1.0.49-beta → 1.0.50-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-extension-options.d.ts +52 -0
- package/dist/app-extension-options.d.ts.map +1 -0
- package/dist/app-extension-options.js +2 -0
- package/dist/app-extension-options.js.map +1 -0
- package/dist/app-extension.d.ts +15 -31
- package/dist/app-extension.d.ts.map +1 -1
- package/dist/app-extension.js +0 -15
- package/dist/app-extension.js.map +1 -1
- package/dist/app-helper-proxy.d.ts +9 -23
- package/dist/app-helper-proxy.d.ts.map +1 -1
- package/dist/app-helper-proxy.js +27 -26
- package/dist/app-helper-proxy.js.map +1 -1
- package/dist/generator/functions-generator.d.ts +1 -17
- package/dist/generator/functions-generator.d.ts.map +1 -1
- package/dist/generator/functions-generator.js +13 -40
- package/dist/generator/functions-generator.js.map +1 -1
- package/dist/generator/generator.d.ts.map +1 -1
- package/dist/generator/generator.js +17 -14
- package/dist/generator/generator.js.map +1 -1
- package/dist/generator/locale-resources-generator.js +64 -44
- package/dist/generator/locale-resources-generator.js.map +1 -1
- package/dist/gs1/character-set-proxy.d.ts +6 -7
- package/dist/gs1/character-set-proxy.d.ts.map +1 -1
- package/dist/gs1/character-set-proxy.js.map +1 -1
- package/dist/gs1/check-proxy.d.ts +8 -8
- package/dist/gs1/check-proxy.d.ts.map +1 -1
- package/dist/gs1/check-proxy.js.map +1 -1
- package/dist/gs1/gcp-length-proxy.d.ts +6 -6
- package/dist/gs1/gcp-length-proxy.d.ts.map +1 -1
- package/dist/gs1/gcp-length-proxy.js.map +1 -1
- package/dist/gs1/gtin-creator-proxy.d.ts +4 -4
- package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -1
- package/dist/gs1/gtin-creator-proxy.js.map +1 -1
- package/dist/gs1/gtin-validator-proxy.d.ts +12 -12
- package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -1
- package/dist/gs1/gtin-validator-proxy.js.map +1 -1
- package/dist/gs1/identifier-creator-proxy.d.ts +14 -14
- package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -1
- package/dist/gs1/identifier-creator-proxy.js.map +1 -1
- package/dist/gs1/identifier-validator-proxy.d.ts +10 -10
- package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -1
- package/dist/gs1/identifier-validator-proxy.js.map +1 -1
- package/dist/gs1/non-gtin-creator-proxy.d.ts +22 -23
- package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -1
- package/dist/gs1/non-gtin-creator-proxy.js.map +1 -1
- package/dist/gs1/non-gtin-validator-proxy.d.ts +22 -23
- package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -1
- package/dist/gs1/non-gtin-validator-proxy.js.map +1 -1
- package/dist/gs1/prefix-manager-proxy.d.ts +2 -2
- package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -1
- package/dist/gs1/prefix-manager-proxy.js.map +1 -1
- package/dist/gs1/variable-measure-proxy.d.ts +4 -4
- package/dist/gs1/variable-measure-proxy.d.ts.map +1 -1
- package/dist/gs1/variable-measure-proxy.js.map +1 -1
- package/dist/gs1/verified-by-gs1-proxy.d.ts +4 -4
- package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -1
- package/dist/gs1/verified-by-gs1-proxy.js +2 -8
- package/dist/gs1/verified-by-gs1-proxy.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib-proxy.d.ts +12 -26
- package/dist/lib-proxy.d.ts.map +1 -1
- package/dist/lib-proxy.js +1 -18
- package/dist/lib-proxy.js.map +1 -1
- package/dist/locale/en/locale-resources.js +1 -1
- package/dist/locale/en/locale-resources.js.map +1 -1
- package/dist/proxy.d.ts +3 -4
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js.map +1 -1
- package/dist/streaming.d.ts +2 -2
- package/dist/streaming.d.ts.map +1 -1
- package/dist/type.d.ts +3 -22
- package/dist/type.d.ts.map +1 -1
- package/dist/utility/character-set-proxy.d.ts +17 -16
- package/dist/utility/character-set-proxy.d.ts.map +1 -1
- package/dist/utility/character-set-proxy.js.map +1 -1
- package/dist/utility/reg-exp-proxy.d.ts +2 -2
- package/dist/utility/reg-exp-proxy.d.ts.map +1 -1
- package/dist/utility/reg-exp-proxy.js.map +1 -1
- package/dist/utility/string-proxy.d.ts +2 -2
- package/dist/utility/string-proxy.d.ts.map +1 -1
- package/dist/utility/string-proxy.js.map +1 -1
- package/dist/utility/transformer-proxy.d.ts +6 -5
- package/dist/utility/transformer-proxy.d.ts.map +1 -1
- package/dist/utility/transformer-proxy.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/src/app-extension-options.ts +61 -0
- package/src/app-extension.ts +22 -32
- package/src/app-helper-proxy.ts +21 -33
- package/src/generator/functions-generator.ts +14 -45
- package/src/generator/generator.ts +28 -18
- package/src/generator/locale-resources-generator.ts +79 -52
- package/src/gs1/character-set-proxy.ts +6 -7
- package/src/gs1/check-proxy.ts +8 -8
- package/src/gs1/gcp-length-proxy.ts +8 -8
- package/src/gs1/gtin-creator-proxy.ts +4 -4
- package/src/gs1/gtin-validator-proxy.ts +12 -12
- package/src/gs1/identifier-creator-proxy.ts +14 -14
- package/src/gs1/identifier-validator-proxy.ts +10 -10
- package/src/gs1/non-gtin-creator-proxy.ts +22 -23
- package/src/gs1/non-gtin-validator-proxy.ts +22 -23
- package/src/gs1/prefix-manager-proxy.ts +2 -2
- package/src/gs1/variable-measure-proxy.ts +4 -4
- package/src/gs1/verified-by-gs1-proxy.ts +5 -11
- package/src/index.ts +1 -0
- package/src/lib-proxy.ts +27 -43
- package/src/locale/en/locale-resources.ts +1 -1
- package/src/proxy.ts +12 -15
- package/src/streaming.ts +3 -3
- package/src/type.ts +3 -22
- package/src/utility/character-set-proxy.ts +17 -16
- package/src/utility/reg-exp-proxy.ts +2 -2
- package/src/utility/string-proxy.ts +2 -2
- package/src/utility/transformer-proxy.ts +6 -5
- package/src/version.ts +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
import type { AppExtension } from "../app-extension.js";
|
|
14
14
|
import { type ExtendsParameterDescriptor, Multiplicities, Types } from "../descriptor.js";
|
|
15
15
|
import { proxy } from "../proxy.js";
|
|
16
|
-
import type {
|
|
16
|
+
import type { Matrix, MatrixResult } from "../type.js";
|
|
17
17
|
import { exclusionAllNumericParameterDescriptor } from "../utility/character-set-descriptor.js";
|
|
18
18
|
import { StringProxy } from "../utility/string-proxy.js";
|
|
19
19
|
import { identifierParameterDescriptor } from "./identifier-descriptor.js";
|
|
@@ -35,10 +35,10 @@ const splitIdentifierParameterDescriptor: ExtendsParameterDescriptor = {
|
|
|
35
35
|
namespace: "GS1",
|
|
36
36
|
category: "identifierValidation"
|
|
37
37
|
})
|
|
38
|
-
abstract class IdentifierValidatorProxy<
|
|
38
|
+
abstract class IdentifierValidatorProxy<TIdentifierType extends IdentifierType> extends StringProxy {
|
|
39
39
|
readonly #validator: IdentifierTypeValidator<TIdentifierType>;
|
|
40
40
|
|
|
41
|
-
constructor(appExtension: AppExtension
|
|
41
|
+
constructor(appExtension: AppExtension, validator: IdentifierTypeValidator<TIdentifierType>) {
|
|
42
42
|
super(appExtension);
|
|
43
43
|
|
|
44
44
|
this.#validator = validator;
|
|
@@ -50,7 +50,7 @@ abstract class IdentifierValidatorProxy<ThrowError extends boolean, TError exten
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@proxy.describeClass(true)
|
|
53
|
-
abstract class NumericIdentifierValidatorProxy<
|
|
53
|
+
abstract class NumericIdentifierValidatorProxy<TNumericIdentifierType extends NumericIdentifierType> extends IdentifierValidatorProxy<TNumericIdentifierType> {
|
|
54
54
|
@proxy.describeMethod({
|
|
55
55
|
type: Types.String,
|
|
56
56
|
multiplicity: Multiplicities.Matrix,
|
|
@@ -70,23 +70,23 @@ abstract class NumericIdentifierValidatorProxy<ThrowError extends boolean, TErro
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export abstract class GTINValidatorProxy
|
|
73
|
+
export abstract class GTINValidatorProxy extends NumericIdentifierValidatorProxy<GTINType> {
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
abstract class NonGTINNumericIdentifierValidatorProxy<
|
|
76
|
+
abstract class NonGTINNumericIdentifierValidatorProxy<TNonGTINNumericIdentifierType extends NonGTINNumericIdentifierType = NonGTINNumericIdentifierType> extends NumericIdentifierValidatorProxy<TNonGTINNumericIdentifierType> {
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export abstract class NonSerializableNumericIdentifierValidatorProxy
|
|
79
|
+
export abstract class NonSerializableNumericIdentifierValidatorProxy extends NonGTINNumericIdentifierValidatorProxy<NonSerializableNumericIdentifierType> {
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
@proxy.describeClass(true)
|
|
83
|
-
export abstract class SerializableNumericIdentifierValidatorProxy
|
|
83
|
+
export abstract class SerializableNumericIdentifierValidatorProxy extends NonGTINNumericIdentifierValidatorProxy<SerializableNumericIdentifierType> {
|
|
84
84
|
@proxy.describeMethod({
|
|
85
85
|
type: Types.String,
|
|
86
86
|
multiplicity: Multiplicities.Matrix,
|
|
87
87
|
parameterDescriptors: [splitIdentifierParameterDescriptor]
|
|
88
88
|
})
|
|
89
|
-
split(matrixIdentifiers: Matrix<string>): MatrixResult<string
|
|
89
|
+
split(matrixIdentifiers: Matrix<string>): MatrixResult<string> {
|
|
90
90
|
return this.arrayResult(matrixIdentifiers, (identifier) => {
|
|
91
91
|
const serializableNumericIdentifierSplit = this.validator.split(identifier);
|
|
92
92
|
|
|
@@ -96,7 +96,7 @@ export abstract class SerializableNumericIdentifierValidatorProxy<ThrowError ext
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
@proxy.describeClass(true)
|
|
99
|
-
export abstract class NonNumericIdentifierValidatorProxy
|
|
99
|
+
export abstract class NonNumericIdentifierValidatorProxy extends IdentifierValidatorProxy<NonNumericIdentifierType> {
|
|
100
100
|
@proxy.describeMethod({
|
|
101
101
|
type: Types.String,
|
|
102
102
|
multiplicity: Multiplicities.Matrix,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { NonGTINNumericIdentifierCreator, NonSerializableNumericIdentifierType } from "@aidc-toolkit/gs1";
|
|
2
2
|
import type { AppExtension } from "../app-extension.js";
|
|
3
3
|
import { proxy } from "../proxy.js";
|
|
4
|
-
import type { ErrorExtends } from "../type.js";
|
|
5
4
|
import {
|
|
6
5
|
NonNumericIdentifierCreatorProxy,
|
|
7
6
|
NonSerializableNumericIdentifierCreatorProxy,
|
|
@@ -11,8 +10,8 @@ import {
|
|
|
11
10
|
@proxy.describeClass(false, {
|
|
12
11
|
methodInfix: "GLN"
|
|
13
12
|
})
|
|
14
|
-
export class GLNCreatorProxy
|
|
15
|
-
constructor(appExtension: AppExtension
|
|
13
|
+
export class GLNCreatorProxy extends NonSerializableNumericIdentifierCreatorProxy<NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
|
|
14
|
+
constructor(appExtension: AppExtension) {
|
|
16
15
|
super(appExtension, prefixManager => prefixManager.glnCreator);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -20,8 +19,8 @@ export class GLNCreatorProxy<ThrowError extends boolean, TError extends ErrorExt
|
|
|
20
19
|
@proxy.describeClass(false, {
|
|
21
20
|
methodInfix: "SSCC"
|
|
22
21
|
})
|
|
23
|
-
export class SSCCCreatorProxy
|
|
24
|
-
constructor(appExtension: AppExtension
|
|
22
|
+
export class SSCCCreatorProxy extends NonSerializableNumericIdentifierCreatorProxy<NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
|
|
23
|
+
constructor(appExtension: AppExtension) {
|
|
25
24
|
super(appExtension, prefixManager => prefixManager.ssccCreator);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -29,8 +28,8 @@ export class SSCCCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
29
28
|
@proxy.describeClass(false, {
|
|
30
29
|
methodInfix: "GRAI"
|
|
31
30
|
})
|
|
32
|
-
export class GRAICreatorProxy
|
|
33
|
-
constructor(appExtension: AppExtension
|
|
31
|
+
export class GRAICreatorProxy extends SerializableNumericIdentifierCreatorProxy {
|
|
32
|
+
constructor(appExtension: AppExtension) {
|
|
34
33
|
super(appExtension, prefixManager => prefixManager.graiCreator);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -38,8 +37,8 @@ export class GRAICreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
38
37
|
@proxy.describeClass(false, {
|
|
39
38
|
methodInfix: "GIAI"
|
|
40
39
|
})
|
|
41
|
-
export class GIAICreatorProxy
|
|
42
|
-
constructor(appExtension: AppExtension
|
|
40
|
+
export class GIAICreatorProxy extends NonNumericIdentifierCreatorProxy {
|
|
41
|
+
constructor(appExtension: AppExtension) {
|
|
43
42
|
super(appExtension, prefixManager => prefixManager.giaiCreator);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -47,8 +46,8 @@ export class GIAICreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
47
46
|
@proxy.describeClass(false, {
|
|
48
47
|
methodInfix: "GSRN"
|
|
49
48
|
})
|
|
50
|
-
export class GSRNCreatorProxy
|
|
51
|
-
constructor(appExtension: AppExtension
|
|
49
|
+
export class GSRNCreatorProxy extends NonSerializableNumericIdentifierCreatorProxy<NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
|
|
50
|
+
constructor(appExtension: AppExtension) {
|
|
52
51
|
super(appExtension, prefixManager => prefixManager.gsrnCreator);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -56,8 +55,8 @@ export class GSRNCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
56
55
|
@proxy.describeClass(false, {
|
|
57
56
|
methodInfix: "GDTI"
|
|
58
57
|
})
|
|
59
|
-
export class GDTICreatorProxy
|
|
60
|
-
constructor(appExtension: AppExtension
|
|
58
|
+
export class GDTICreatorProxy extends SerializableNumericIdentifierCreatorProxy {
|
|
59
|
+
constructor(appExtension: AppExtension) {
|
|
61
60
|
super(appExtension, prefixManager => prefixManager.gdtiCreator);
|
|
62
61
|
}
|
|
63
62
|
}
|
|
@@ -65,8 +64,8 @@ export class GDTICreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
65
64
|
@proxy.describeClass(false, {
|
|
66
65
|
methodInfix: "GINC"
|
|
67
66
|
})
|
|
68
|
-
export class GINCCreatorProxy
|
|
69
|
-
constructor(appExtension: AppExtension
|
|
67
|
+
export class GINCCreatorProxy extends NonNumericIdentifierCreatorProxy {
|
|
68
|
+
constructor(appExtension: AppExtension) {
|
|
70
69
|
super(appExtension, prefixManager => prefixManager.gincCreator);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
@@ -74,8 +73,8 @@ export class GINCCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
74
73
|
@proxy.describeClass(false, {
|
|
75
74
|
methodInfix: "GSIN"
|
|
76
75
|
})
|
|
77
|
-
export class GSINCreatorProxy
|
|
78
|
-
constructor(appExtension: AppExtension
|
|
76
|
+
export class GSINCreatorProxy extends NonSerializableNumericIdentifierCreatorProxy<NonSerializableNumericIdentifierType, NonGTINNumericIdentifierCreator> {
|
|
77
|
+
constructor(appExtension: AppExtension) {
|
|
79
78
|
super(appExtension, prefixManager => prefixManager.gsinCreator);
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -83,8 +82,8 @@ export class GSINCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
83
82
|
@proxy.describeClass(false, {
|
|
84
83
|
methodInfix: "GCN"
|
|
85
84
|
})
|
|
86
|
-
export class GCNCreatorProxy
|
|
87
|
-
constructor(appExtension: AppExtension
|
|
85
|
+
export class GCNCreatorProxy extends SerializableNumericIdentifierCreatorProxy {
|
|
86
|
+
constructor(appExtension: AppExtension) {
|
|
88
87
|
super(appExtension, prefixManager => prefixManager.gcnCreator);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -92,8 +91,8 @@ export class GCNCreatorProxy<ThrowError extends boolean, TError extends ErrorExt
|
|
|
92
91
|
@proxy.describeClass(false, {
|
|
93
92
|
methodInfix: "CPID"
|
|
94
93
|
})
|
|
95
|
-
export class CPIDCreatorProxy
|
|
96
|
-
constructor(appExtension: AppExtension
|
|
94
|
+
export class CPIDCreatorProxy extends NonNumericIdentifierCreatorProxy {
|
|
95
|
+
constructor(appExtension: AppExtension) {
|
|
97
96
|
super(appExtension, prefixManager => prefixManager.cpidCreator);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -101,8 +100,8 @@ export class CPIDCreatorProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
101
100
|
@proxy.describeClass(false, {
|
|
102
101
|
methodInfix: "GMN"
|
|
103
102
|
})
|
|
104
|
-
export class GMNCreatorProxy
|
|
105
|
-
constructor(appExtension: AppExtension
|
|
103
|
+
export class GMNCreatorProxy extends NonNumericIdentifierCreatorProxy {
|
|
104
|
+
constructor(appExtension: AppExtension) {
|
|
106
105
|
super(appExtension, prefixManager => prefixManager.gmnCreator);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IdentifierValidators } from "@aidc-toolkit/gs1";
|
|
2
2
|
import type { AppExtension } from "../app-extension.js";
|
|
3
3
|
import { proxy } from "../proxy.js";
|
|
4
|
-
import type { ErrorExtends } from "../type.js";
|
|
5
4
|
import {
|
|
6
5
|
NonNumericIdentifierValidatorProxy,
|
|
7
6
|
NonSerializableNumericIdentifierValidatorProxy,
|
|
@@ -11,8 +10,8 @@ import {
|
|
|
11
10
|
@proxy.describeClass(false, {
|
|
12
11
|
methodInfix: "GLN"
|
|
13
12
|
})
|
|
14
|
-
export class GLNValidatorProxy
|
|
15
|
-
constructor(appExtension: AppExtension
|
|
13
|
+
export class GLNValidatorProxy extends NonSerializableNumericIdentifierValidatorProxy {
|
|
14
|
+
constructor(appExtension: AppExtension) {
|
|
16
15
|
super(appExtension, IdentifierValidators.GLN);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -20,8 +19,8 @@ export class GLNValidatorProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
20
19
|
@proxy.describeClass(false, {
|
|
21
20
|
methodInfix: "SSCC"
|
|
22
21
|
})
|
|
23
|
-
export class SSCCValidatorProxy
|
|
24
|
-
constructor(appExtension: AppExtension
|
|
22
|
+
export class SSCCValidatorProxy extends NonSerializableNumericIdentifierValidatorProxy {
|
|
23
|
+
constructor(appExtension: AppExtension) {
|
|
25
24
|
super(appExtension, IdentifierValidators.SSCC);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -29,8 +28,8 @@ export class SSCCValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
29
28
|
@proxy.describeClass(false, {
|
|
30
29
|
methodInfix: "GRAI"
|
|
31
30
|
})
|
|
32
|
-
export class GRAIValidatorProxy
|
|
33
|
-
constructor(appExtension: AppExtension
|
|
31
|
+
export class GRAIValidatorProxy extends SerializableNumericIdentifierValidatorProxy {
|
|
32
|
+
constructor(appExtension: AppExtension) {
|
|
34
33
|
super(appExtension, IdentifierValidators.GRAI);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -38,8 +37,8 @@ export class GRAIValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
38
37
|
@proxy.describeClass(false, {
|
|
39
38
|
methodInfix: "GIAI"
|
|
40
39
|
})
|
|
41
|
-
export class GIAIValidatorProxy
|
|
42
|
-
constructor(appExtension: AppExtension
|
|
40
|
+
export class GIAIValidatorProxy extends NonNumericIdentifierValidatorProxy {
|
|
41
|
+
constructor(appExtension: AppExtension) {
|
|
43
42
|
super(appExtension, IdentifierValidators.GIAI);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
@@ -47,8 +46,8 @@ export class GIAIValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
47
46
|
@proxy.describeClass(false, {
|
|
48
47
|
methodInfix: "GSRN"
|
|
49
48
|
})
|
|
50
|
-
export class GSRNValidatorProxy
|
|
51
|
-
constructor(appExtension: AppExtension
|
|
49
|
+
export class GSRNValidatorProxy extends NonSerializableNumericIdentifierValidatorProxy {
|
|
50
|
+
constructor(appExtension: AppExtension) {
|
|
52
51
|
super(appExtension, IdentifierValidators.GSRN);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -56,8 +55,8 @@ export class GSRNValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
56
55
|
@proxy.describeClass(false, {
|
|
57
56
|
methodInfix: "GDTI"
|
|
58
57
|
})
|
|
59
|
-
export class GDTIValidatorProxy
|
|
60
|
-
constructor(appExtension: AppExtension
|
|
58
|
+
export class GDTIValidatorProxy extends SerializableNumericIdentifierValidatorProxy {
|
|
59
|
+
constructor(appExtension: AppExtension) {
|
|
61
60
|
super(appExtension, IdentifierValidators.GDTI);
|
|
62
61
|
}
|
|
63
62
|
}
|
|
@@ -65,8 +64,8 @@ export class GDTIValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
65
64
|
@proxy.describeClass(false, {
|
|
66
65
|
methodInfix: "GINC"
|
|
67
66
|
})
|
|
68
|
-
export class GINCValidatorProxy
|
|
69
|
-
constructor(appExtension: AppExtension
|
|
67
|
+
export class GINCValidatorProxy extends NonNumericIdentifierValidatorProxy {
|
|
68
|
+
constructor(appExtension: AppExtension) {
|
|
70
69
|
super(appExtension, IdentifierValidators.GINC);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
@@ -74,8 +73,8 @@ export class GINCValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
74
73
|
@proxy.describeClass(false, {
|
|
75
74
|
methodInfix: "GSIN"
|
|
76
75
|
})
|
|
77
|
-
export class GSINValidatorProxy
|
|
78
|
-
constructor(appExtension: AppExtension
|
|
76
|
+
export class GSINValidatorProxy extends NonSerializableNumericIdentifierValidatorProxy {
|
|
77
|
+
constructor(appExtension: AppExtension) {
|
|
79
78
|
super(appExtension, IdentifierValidators.GSIN);
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -83,8 +82,8 @@ export class GSINValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
83
82
|
@proxy.describeClass(false, {
|
|
84
83
|
methodInfix: "GCN"
|
|
85
84
|
})
|
|
86
|
-
export class GCNValidatorProxy
|
|
87
|
-
constructor(appExtension: AppExtension
|
|
85
|
+
export class GCNValidatorProxy extends SerializableNumericIdentifierValidatorProxy {
|
|
86
|
+
constructor(appExtension: AppExtension) {
|
|
88
87
|
super(appExtension, IdentifierValidators.GCN);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
@@ -92,8 +91,8 @@ export class GCNValidatorProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
92
91
|
@proxy.describeClass(false, {
|
|
93
92
|
methodInfix: "CPID"
|
|
94
93
|
})
|
|
95
|
-
export class CPIDValidatorProxy
|
|
96
|
-
constructor(appExtension: AppExtension
|
|
94
|
+
export class CPIDValidatorProxy extends NonNumericIdentifierValidatorProxy {
|
|
95
|
+
constructor(appExtension: AppExtension) {
|
|
97
96
|
super(appExtension, IdentifierValidators.CPID);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -101,8 +100,8 @@ export class CPIDValidatorProxy<ThrowError extends boolean, TError extends Error
|
|
|
101
100
|
@proxy.describeClass(false, {
|
|
102
101
|
methodInfix: "GMN"
|
|
103
102
|
})
|
|
104
|
-
export class GMNValidatorProxy
|
|
105
|
-
constructor(appExtension: AppExtension
|
|
103
|
+
export class GMNValidatorProxy extends NonNumericIdentifierValidatorProxy {
|
|
104
|
+
constructor(appExtension: AppExtension) {
|
|
106
105
|
super(appExtension, IdentifierValidators.GMN);
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -3,7 +3,7 @@ import type { PrefixType } from "@aidc-toolkit/gs1";
|
|
|
3
3
|
import { Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
|
|
4
4
|
import { LibProxy } from "../lib-proxy.js";
|
|
5
5
|
import { proxy } from "../proxy.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Matrix } from "../type.js";
|
|
7
7
|
|
|
8
8
|
const prefixParameterDescriptor: ParameterDescriptor = {
|
|
9
9
|
name: "prefix",
|
|
@@ -30,7 +30,7 @@ const tweakFactorParameterDescriptor: ParameterDescriptor = {
|
|
|
30
30
|
namespace: "GS1",
|
|
31
31
|
category: "prefix"
|
|
32
32
|
})
|
|
33
|
-
export class PrefixManagerProxy
|
|
33
|
+
export class PrefixManagerProxy extends LibProxy {
|
|
34
34
|
@proxy.describeMethod({
|
|
35
35
|
type: Types.Any,
|
|
36
36
|
multiplicity: Multiplicities.SingletonArray,
|
|
@@ -2,7 +2,7 @@ import { VariableMeasure } from "@aidc-toolkit/gs1";
|
|
|
2
2
|
import { Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
|
|
3
3
|
import { LibProxy } from "../lib-proxy.js";
|
|
4
4
|
import { proxy } from "../proxy.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { Matrix, MatrixResult } from "../type.js";
|
|
6
6
|
|
|
7
7
|
const rcnFormatParameterDescriptor: ParameterDescriptor = {
|
|
8
8
|
name: "rcnFormat",
|
|
@@ -36,13 +36,13 @@ const rcnPriceOrWeightParameterDescriptor: ParameterDescriptor = {
|
|
|
36
36
|
namespace: "GS1",
|
|
37
37
|
category: "variableMeasure"
|
|
38
38
|
})
|
|
39
|
-
export class VariableMeasureProxy
|
|
39
|
+
export class VariableMeasureProxy extends LibProxy {
|
|
40
40
|
@proxy.describeMethod({
|
|
41
41
|
type: Types.Number,
|
|
42
42
|
multiplicity: Multiplicities.Matrix,
|
|
43
43
|
parameterDescriptors: [rcnFormatParameterDescriptor, rcnParameterDescriptor]
|
|
44
44
|
})
|
|
45
|
-
parseVariableMeasureRCN(format: string, matrixRCNs: Matrix<string>): MatrixResult<number
|
|
45
|
+
parseVariableMeasureRCN(format: string, matrixRCNs: Matrix<string>): MatrixResult<number> {
|
|
46
46
|
return this.arrayResult(matrixRCNs, (rcn) => {
|
|
47
47
|
const rcnReference = VariableMeasure.parseRCN(format, rcn);
|
|
48
48
|
|
|
@@ -56,7 +56,7 @@ export class VariableMeasureProxy<ThrowError extends boolean, TError extends Err
|
|
|
56
56
|
ignoreInfix: true,
|
|
57
57
|
parameterDescriptors: [rcnFormatParameterDescriptor, rcnItemReferenceParameterDescriptor, rcnPriceOrWeightParameterDescriptor]
|
|
58
58
|
})
|
|
59
|
-
createVariableMeasureRCN(format: string, itemReference: number, matrixPricesOrWeights: Matrix<number>): MatrixResult<string
|
|
59
|
+
createVariableMeasureRCN(format: string, itemReference: number, matrixPricesOrWeights: Matrix<number>): MatrixResult<string> {
|
|
60
60
|
return this.matrixResult(matrixPricesOrWeights, priceOrWeight => VariableMeasure.createRCN(format, itemReference, priceOrWeight));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Nullishable } from "@aidc-toolkit/core";
|
|
2
2
|
import { verifiedByGS1 } from "@aidc-toolkit/gs1";
|
|
3
3
|
import { type ExtendsParameterDescriptor, Multiplicities, type ParameterDescriptor, Types } from "../descriptor.js";
|
|
4
4
|
import { LibProxy } from "../lib-proxy.js";
|
|
5
5
|
import { proxy } from "../proxy.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Matrix, MatrixResult } from "../type.js";
|
|
7
7
|
import { identifierParameterDescriptor, identifierTypeParameterDescriptor } from "./identifier-descriptor.js";
|
|
8
8
|
import { validateIdentifierType } from "./identifier-type.js";
|
|
9
9
|
|
|
@@ -30,12 +30,11 @@ const hyperlinkDetailsParameterDescriptor: ParameterDescriptor = {
|
|
|
30
30
|
namespace: "GS1",
|
|
31
31
|
category: "service"
|
|
32
32
|
})
|
|
33
|
-
export class VerifiedByGS1Proxy
|
|
33
|
+
export class VerifiedByGS1Proxy extends LibProxy {
|
|
34
34
|
@proxy.describeMethod({
|
|
35
35
|
type: Types.Any,
|
|
36
36
|
multiplicity: Multiplicities.Matrix,
|
|
37
37
|
isAsync: true,
|
|
38
|
-
requiresContext: true,
|
|
39
38
|
parameterDescriptors: [
|
|
40
39
|
identifierTypeParameterDescriptor,
|
|
41
40
|
hyperlinkIdentifierParameterDescriptor,
|
|
@@ -43,13 +42,8 @@ export class VerifiedByGS1Proxy<ThrowError extends boolean, TError extends Error
|
|
|
43
42
|
hyperlinkDetailsParameterDescriptor
|
|
44
43
|
]
|
|
45
44
|
})
|
|
46
|
-
async verifiedByGS1(identifierType: string, matrixIdentifiers: Matrix<string>, text: Nullishable<string>, details: Nullishable<string
|
|
47
|
-
|
|
48
|
-
// Application error; no localization necessary.
|
|
49
|
-
throw new Error("Invocation context not provided by application");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return this.appExtension.mapHyperlinkResults(invocationContext, this.setUpMatrixResult(() =>
|
|
45
|
+
async verifiedByGS1(identifierType: string, matrixIdentifiers: Matrix<string>, text: Nullishable<string>, details: Nullishable<string>): Promise<MatrixResult<unknown>> {
|
|
46
|
+
return this.appExtension.mapHyperlinkResults(this.setUpMatrixResult(() =>
|
|
53
47
|
validateIdentifierType(identifierType),
|
|
54
48
|
matrixIdentifiers, (validatedIdentifierType, identifier) =>
|
|
55
49
|
verifiedByGS1(validatedIdentifierType, identifier, text ?? undefined, details ?? undefined)
|
package/src/index.ts
CHANGED
package/src/lib-proxy.ts
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
import { mapIterable } from "@aidc-toolkit/utility";
|
|
2
|
+
import type { BigInteger } from "./app-extension-options.js";
|
|
2
3
|
import type { AppExtension } from "./app-extension.js";
|
|
3
4
|
import { i18nextAppExtension } from "./locale/i18n.js";
|
|
4
|
-
import type {
|
|
5
|
+
import type { Matrix, MatrixResult, SingletonResult } from "./type.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Library proxy.
|
|
8
|
-
*
|
|
9
|
-
* @template ThrowError
|
|
10
|
-
* If true, errors are reported through the throw/catch mechanism.
|
|
11
|
-
*
|
|
12
|
-
* @template TError
|
|
13
|
-
* Error type.
|
|
14
|
-
*
|
|
15
|
-
* @template TInvocationContext
|
|
16
|
-
* Application-specific invocation context type.
|
|
17
|
-
*
|
|
18
|
-
* @template TStreamingInvocationContext
|
|
19
|
-
* Application-specific streaming invocation context type.
|
|
20
|
-
*
|
|
21
|
-
* @template TBigInt
|
|
22
|
-
* Type to which big integer is mapped.
|
|
23
9
|
*/
|
|
24
|
-
export abstract class LibProxy
|
|
10
|
+
export abstract class LibProxy {
|
|
25
11
|
/**
|
|
26
12
|
* Application extension.
|
|
27
13
|
*/
|
|
28
|
-
readonly #appExtension: AppExtension
|
|
14
|
+
readonly #appExtension: AppExtension;
|
|
29
15
|
|
|
30
16
|
/**
|
|
31
17
|
* Constructor.
|
|
@@ -33,14 +19,14 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
33
19
|
* @param appExtension
|
|
34
20
|
* Application extension.
|
|
35
21
|
*/
|
|
36
|
-
constructor(appExtension: AppExtension
|
|
22
|
+
constructor(appExtension: AppExtension) {
|
|
37
23
|
this.#appExtension = appExtension;
|
|
38
24
|
}
|
|
39
25
|
|
|
40
26
|
/**
|
|
41
27
|
* Get the application extension.
|
|
42
28
|
*/
|
|
43
|
-
get appExtension(): AppExtension
|
|
29
|
+
get appExtension(): AppExtension {
|
|
44
30
|
return this.#appExtension;
|
|
45
31
|
}
|
|
46
32
|
|
|
@@ -53,7 +39,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
53
39
|
* @returns
|
|
54
40
|
* Mapped big integer value.
|
|
55
41
|
*/
|
|
56
|
-
mapBigInt(value: bigint): SingletonResult<
|
|
42
|
+
mapBigInt(value: bigint): SingletonResult<BigInteger> {
|
|
57
43
|
return this.#appExtension.mapBigInt(value);
|
|
58
44
|
}
|
|
59
45
|
|
|
@@ -67,19 +53,18 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
67
53
|
* @returns
|
|
68
54
|
* Error if errors are not thrown.
|
|
69
55
|
*/
|
|
70
|
-
#handleError<TResult>(e: unknown): SingletonResult<TResult
|
|
71
|
-
let result
|
|
56
|
+
#handleError<TResult>(e: unknown): SingletonResult<TResult> {
|
|
57
|
+
let result;
|
|
72
58
|
|
|
73
59
|
if (e instanceof RangeError) {
|
|
74
60
|
const error = this.#appExtension.mapRangeError(e);
|
|
75
61
|
|
|
76
62
|
if (this.#appExtension.throwError) {
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
78
|
-
throw error
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error -- Type is determined by application.
|
|
64
|
+
throw error;
|
|
79
65
|
}
|
|
80
66
|
|
|
81
|
-
|
|
82
|
-
result = error as SingletonResult<TResult, ThrowError, TError>;
|
|
67
|
+
result = error as SingletonResult<TResult>;
|
|
83
68
|
} else {
|
|
84
69
|
// Unknown error; pass on to application extension.
|
|
85
70
|
result = this.appExtension.handleError(e instanceof Error ? e.message : String(e));
|
|
@@ -97,13 +82,13 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
97
82
|
* @returns
|
|
98
83
|
* Callback return or error if errors are not thrown.
|
|
99
84
|
*/
|
|
100
|
-
singletonResult<TResult>(callback: () => SingletonResult<TResult
|
|
101
|
-
let result
|
|
85
|
+
singletonResult<TResult>(callback: () => SingletonResult<TResult>): SingletonResult<TResult> {
|
|
86
|
+
let result;
|
|
102
87
|
|
|
103
88
|
try {
|
|
104
89
|
result = callback();
|
|
105
90
|
} catch (e: unknown) {
|
|
106
|
-
result = this.#handleError(e);
|
|
91
|
+
result = this.#handleError<TResult>(e);
|
|
107
92
|
}
|
|
108
93
|
|
|
109
94
|
return result;
|
|
@@ -121,7 +106,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
121
106
|
* @returns
|
|
122
107
|
* Matrix of callback results and errors if errors are not thrown.
|
|
123
108
|
*/
|
|
124
|
-
protected matrixResult<TValue, TResult>(matrixValues: Matrix<TValue>, valueCallback: (value: TValue) => SingletonResult<TResult
|
|
109
|
+
protected matrixResult<TValue, TResult>(matrixValues: Matrix<TValue>, valueCallback: (value: TValue) => SingletonResult<TResult>): MatrixResult<TResult> {
|
|
125
110
|
return matrixValues.map(rowValues => rowValues.map(value => this.singletonResult(() => valueCallback(value))));
|
|
126
111
|
}
|
|
127
112
|
|
|
@@ -135,7 +120,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
135
120
|
* @returns
|
|
136
121
|
* Matrix of boolean values, true if corresponding string is empty.
|
|
137
122
|
*/
|
|
138
|
-
protected isValidString(matrixValidateResults: MatrixResult<string
|
|
123
|
+
protected isValidString(matrixValidateResults: MatrixResult<string>): Matrix<boolean> {
|
|
139
124
|
return matrixValidateResults.map(rowValues => rowValues.map(value => (validateResult => validateResult === "")(value)));
|
|
140
125
|
}
|
|
141
126
|
|
|
@@ -154,8 +139,8 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
154
139
|
* @returns
|
|
155
140
|
* Matrix of callback results and errors if errors are not thrown.
|
|
156
141
|
*/
|
|
157
|
-
protected setUpMatrixResult<TSetup, TValue, TResult>(setUpCallback: () => TSetup, matrixValues: Matrix<TValue>, valueCallback: (setup: TSetup, value: TValue) => SingletonResult<TResult
|
|
158
|
-
let result: MatrixResult<TResult
|
|
142
|
+
protected setUpMatrixResult<TSetup, TValue, TResult>(setUpCallback: () => TSetup, matrixValues: Matrix<TValue>, valueCallback: (setup: TSetup, value: TValue) => SingletonResult<TResult>): MatrixResult<TResult> {
|
|
143
|
+
let result: MatrixResult<TResult>;
|
|
159
144
|
|
|
160
145
|
try {
|
|
161
146
|
result = matrixValues.map(rowValues => rowValues.map(value => this.singletonResult(() => valueCallback(setUpCallback(), value))));
|
|
@@ -178,11 +163,10 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
178
163
|
* @returns
|
|
179
164
|
* Callback result or error as array if errors are not thrown.
|
|
180
165
|
*/
|
|
181
|
-
#arrayCallback<TValue, TResult>(value: TValue, callback: (value: TValue) => Array<SingletonResult<TResult
|
|
166
|
+
#arrayCallback<TValue, TResult>(value: TValue, callback: (value: TValue) => Array<SingletonResult<TResult>>): Array<SingletonResult<TResult>> {
|
|
182
167
|
const result = this.singletonResult(() => callback(value));
|
|
183
168
|
|
|
184
|
-
|
|
185
|
-
return result instanceof Array ? result : [result as SingletonResult<TResult, ThrowError, TError>];
|
|
169
|
+
return result instanceof Array ? result : [result];
|
|
186
170
|
}
|
|
187
171
|
|
|
188
172
|
/**
|
|
@@ -197,8 +181,8 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
197
181
|
* @returns
|
|
198
182
|
* Matrix of callback results and errors if errors are not thrown.
|
|
199
183
|
*/
|
|
200
|
-
protected arrayResult<TValue, TResult>(matrixValues: Matrix<TValue>, callback: (value: TValue) => Array<SingletonResult<TResult
|
|
201
|
-
let result: MatrixResult<TResult
|
|
184
|
+
protected arrayResult<TValue, TResult>(matrixValues: Matrix<TValue>, callback: (value: TValue) => Array<SingletonResult<TResult>>): MatrixResult<TResult> {
|
|
185
|
+
let result: MatrixResult<TResult>;
|
|
202
186
|
|
|
203
187
|
if (matrixValues.length === 0) {
|
|
204
188
|
// Special case; unlikely to occur.
|
|
@@ -221,7 +205,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
221
205
|
});
|
|
222
206
|
} else {
|
|
223
207
|
result = matrixValues.map((rowValue) => {
|
|
224
|
-
let arrayResult: Array<SingletonResult<TResult
|
|
208
|
+
let arrayResult: Array<SingletonResult<TResult>>;
|
|
225
209
|
|
|
226
210
|
if (rowValue.length === 0) {
|
|
227
211
|
// Special case; unlikely to occur.
|
|
@@ -254,7 +238,7 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
254
238
|
*/
|
|
255
239
|
protected matrixErrorResult<TValue>(matrixValues: Matrix<TValue>, callback: (value: TValue) => void): Matrix<string> {
|
|
256
240
|
return matrixValues.map(rowValues => rowValues.map((value) => {
|
|
257
|
-
let result
|
|
241
|
+
let result;
|
|
258
242
|
|
|
259
243
|
try {
|
|
260
244
|
callback(value);
|
|
@@ -287,8 +271,8 @@ export abstract class LibProxy<ThrowError extends boolean, TError extends ErrorE
|
|
|
287
271
|
* @returns
|
|
288
272
|
* Matrix of callback results.
|
|
289
273
|
*/
|
|
290
|
-
protected iterableResult<TResult>(iterableCallback: () => Iterable<SingletonResult<TResult
|
|
291
|
-
let result: MatrixResult<TResult
|
|
274
|
+
protected iterableResult<TResult>(iterableCallback: () => Iterable<SingletonResult<TResult>>): MatrixResult<TResult> {
|
|
275
|
+
let result: MatrixResult<TResult>;
|
|
292
276
|
|
|
293
277
|
try {
|
|
294
278
|
result = Array.from(mapIterable(iterableCallback(), result => [result]));
|
|
@@ -200,7 +200,7 @@ export default {
|
|
|
200
200
|
},
|
|
201
201
|
sparse: {
|
|
202
202
|
name: "sparse",
|
|
203
|
-
description: "If true, value is mapped to a sparse sequence resistant to discovery.
|
|
203
|
+
description: "If true, value is mapped to a sparse sequence resistant to discovery."
|
|
204
204
|
},
|
|
205
205
|
serialComponent: {
|
|
206
206
|
name: "serialComponent",
|