@aidc-toolkit/app-extension 1.0.23-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/dist/index.cjs +3457 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1769 -0
- package/dist/index.d.ts +1769 -26
- package/dist/index.js +3409 -9
- package/dist/index.js.map +1 -1
- package/package.json +10 -13
- package/src/app-extension.ts +3 -10
- package/src/app-utility-proxy.ts +5 -4
- package/src/descriptor.ts +18 -9
- package/src/generator/descriptor.ts +1 -1
- package/src/generator/generator.ts +4 -4
- package/src/generator/index.ts +2 -2
- package/src/generator/locale-resources-generator.ts +14 -10
- package/src/gs1/character-set-proxy.ts +18 -8
- package/src/gs1/check-proxy.ts +3 -3
- package/src/gs1/identifier-proxy.ts +71 -66
- package/src/gs1/index.ts +3 -3
- package/src/index.ts +9 -9
- package/src/lib-proxy.ts +3 -3
- package/src/locale/en/locale-resources.ts +9 -0
- package/src/locale/fr/locale-resources.ts +9 -0
- package/src/locale/i18n.ts +3 -5
- package/src/locale/i18next.d.ts +1 -1
- package/{dist/types.d.ts → src/type.ts} +11 -39
- package/src/utility/character-set-descriptor.ts +1 -1
- package/src/utility/character-set-proxy.ts +29 -17
- package/src/utility/index.ts +3 -3
- package/src/utility/reg-exp-proxy.ts +5 -4
- package/src/utility/string-descriptor.ts +1 -1
- package/src/utility/string-proxy.ts +2 -2
- package/src/utility/transformer-descriptor.ts +1 -1
- package/src/utility/transformer-proxy.ts +5 -4
- package/tsup.config.ts +3 -0
- package/dist/app-extension.d.ts +0 -169
- package/dist/app-extension.d.ts.map +0 -1
- package/dist/app-extension.js +0 -148
- package/dist/app-extension.js.map +0 -1
- package/dist/app-utility-proxy.d.ts +0 -66
- package/dist/app-utility-proxy.d.ts.map +0 -1
- package/dist/app-utility-proxy.js +0 -233
- package/dist/app-utility-proxy.js.map +0 -1
- package/dist/descriptor.d.ts +0 -172
- package/dist/descriptor.d.ts.map +0 -1
- package/dist/descriptor.js +0 -174
- package/dist/descriptor.js.map +0 -1
- package/dist/generator/descriptor.d.ts +0 -107
- package/dist/generator/descriptor.d.ts.map +0 -1
- package/dist/generator/descriptor.js +0 -2
- package/dist/generator/descriptor.js.map +0 -1
- package/dist/generator/generator.d.ts +0 -120
- package/dist/generator/generator.d.ts.map +0 -1
- package/dist/generator/generator.js +0 -213
- package/dist/generator/generator.js.map +0 -1
- package/dist/generator/index.d.ts +0 -3
- package/dist/generator/index.d.ts.map +0 -1
- package/dist/generator/index.js +0 -2
- package/dist/generator/index.js.map +0 -1
- package/dist/gs1/character-set-proxy.d.ts +0 -10
- package/dist/gs1/character-set-proxy.d.ts.map +0 -1
- package/dist/gs1/character-set-proxy.js +0 -47
- package/dist/gs1/character-set-proxy.js.map +0 -1
- package/dist/gs1/check-proxy.d.ts +0 -11
- package/dist/gs1/check-proxy.d.ts.map +0 -1
- package/dist/gs1/check-proxy.js +0 -120
- package/dist/gs1/check-proxy.js.map +0 -1
- package/dist/gs1/identifier-proxy.d.ts +0 -136
- package/dist/gs1/identifier-proxy.d.ts.map +0 -1
- package/dist/gs1/identifier-proxy.js +0 -782
- package/dist/gs1/identifier-proxy.js.map +0 -1
- package/dist/gs1/index.d.ts +0 -4
- package/dist/gs1/index.d.ts.map +0 -1
- package/dist/gs1/index.js +0 -4
- package/dist/gs1/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib-proxy.d.ts +0 -135
- package/dist/lib-proxy.d.ts.map +0 -1
- package/dist/lib-proxy.js +0 -235
- package/dist/lib-proxy.js.map +0 -1
- package/dist/locale/en/locale-resources.d.ts +0 -617
- package/dist/locale/en/locale-resources.d.ts.map +0 -1
- package/dist/locale/en/locale-resources.js +0 -616
- package/dist/locale/en/locale-resources.js.map +0 -1
- package/dist/locale/fr/locale-resources.d.ts +0 -617
- package/dist/locale/fr/locale-resources.d.ts.map +0 -1
- package/dist/locale/fr/locale-resources.js +0 -616
- package/dist/locale/fr/locale-resources.js.map +0 -1
- package/dist/locale/i18n.d.ts +0 -27
- package/dist/locale/i18n.d.ts.map +0 -1
- package/dist/locale/i18n.js +0 -39
- package/dist/locale/i18n.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -13
- package/dist/types.js.map +0 -1
- package/dist/utility/character-set-descriptor.d.ts +0 -6
- package/dist/utility/character-set-descriptor.d.ts.map +0 -1
- package/dist/utility/character-set-descriptor.js +0 -28
- package/dist/utility/character-set-descriptor.js.map +0 -1
- package/dist/utility/character-set-proxy.d.ts +0 -26
- package/dist/utility/character-set-proxy.d.ts.map +0 -1
- package/dist/utility/character-set-proxy.js +0 -167
- package/dist/utility/character-set-proxy.js.map +0 -1
- package/dist/utility/index.d.ts +0 -4
- package/dist/utility/index.d.ts.map +0 -1
- package/dist/utility/index.js +0 -4
- package/dist/utility/index.js.map +0 -1
- package/dist/utility/reg-exp-proxy.d.ts +0 -7
- package/dist/utility/reg-exp-proxy.d.ts.map +0 -1
- package/dist/utility/reg-exp-proxy.js +0 -61
- package/dist/utility/reg-exp-proxy.js.map +0 -1
- package/dist/utility/string-descriptor.d.ts +0 -4
- package/dist/utility/string-descriptor.d.ts.map +0 -1
- package/dist/utility/string-descriptor.js +0 -12
- package/dist/utility/string-descriptor.js.map +0 -1
- package/dist/utility/string-proxy.d.ts +0 -8
- package/dist/utility/string-proxy.d.ts.map +0 -1
- package/dist/utility/string-proxy.js +0 -12
- package/dist/utility/string-proxy.js.map +0 -1
- package/dist/utility/transformer-descriptor.d.ts +0 -6
- package/dist/utility/transformer-descriptor.d.ts.map +0 -1
- package/dist/utility/transformer-descriptor.js +0 -24
- package/dist/utility/transformer-descriptor.js.map +0 -1
- package/dist/utility/transformer-proxy.d.ts +0 -8
- package/dist/utility/transformer-proxy.d.ts.map +0 -1
- package/dist/utility/transformer-proxy.js +0 -74
- package/dist/utility/transformer-proxy.js.map +0 -1
- package/src/generator/logger.ts +0 -45
- package/src/types.ts +0 -144
package/src/index.ts
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export * from "./locale/i18n
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./app-extension
|
|
20
|
-
export * from "./lib-proxy
|
|
21
|
-
export * from "./descriptor
|
|
22
|
-
export * from "./app-utility-proxy
|
|
23
|
-
export * from "./utility/index
|
|
24
|
-
export * as GS1 from "./gs1/index
|
|
25
|
-
export * from "./generator/index
|
|
17
|
+
export * from "./locale/i18n";
|
|
18
|
+
export type * from "./type";
|
|
19
|
+
export * from "./app-extension";
|
|
20
|
+
export * from "./lib-proxy";
|
|
21
|
+
export * from "./descriptor";
|
|
22
|
+
export * from "./app-utility-proxy";
|
|
23
|
+
export * from "./utility/index";
|
|
24
|
+
export * as GS1 from "./gs1/index";
|
|
25
|
+
export * from "./generator/index";
|
package/src/lib-proxy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mapIterable } from "@aidc-toolkit/utility";
|
|
2
|
-
import type { AppExtension } from "./app-extension
|
|
3
|
-
import { i18nextAppExtension } from "./locale/i18n
|
|
4
|
-
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "./
|
|
2
|
+
import type { AppExtension } from "./app-extension";
|
|
3
|
+
import { i18nextAppExtension } from "./locale/i18n";
|
|
4
|
+
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "./type";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Library proxy.
|
|
@@ -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/locale/i18n.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i18nCoreInit, type I18nEnvironment } from "@aidc-toolkit/core";
|
|
2
2
|
import { gs1Resources, i18nGS1Init } from "@aidc-toolkit/gs1";
|
|
3
3
|
import { i18nUtilityInit, utilityResources } from "@aidc-toolkit/utility";
|
|
4
4
|
import i18next, { type i18n, type Resource } from "i18next";
|
|
5
|
-
import enLocaleResources from "./en/locale-resources
|
|
6
|
-
import frLocaleResources from "./fr/locale-resources
|
|
5
|
+
import enLocaleResources from "./en/locale-resources";
|
|
6
|
+
import frLocaleResources from "./fr/locale-resources";
|
|
7
7
|
|
|
8
8
|
export const appExtensionNS = "aidct_app_extension";
|
|
9
9
|
|
|
@@ -12,8 +12,6 @@ export const appExtensionNS = "aidct_app_extension";
|
|
|
12
12
|
*/
|
|
13
13
|
export type AppExtensionLocaleResources = typeof enLocaleResources;
|
|
14
14
|
|
|
15
|
-
i18nAssertValidResources(enLocaleResources, "fr", frLocaleResources);
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* App extension resources.
|
|
19
17
|
*/
|
package/src/locale/i18next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GS1LocaleResources } from "@aidc-toolkit/gs1";
|
|
2
2
|
import type { UtilityLocaleResources } from "@aidc-toolkit/utility";
|
|
3
|
-
import type { AppExtensionLocaleResources } from "./i18n
|
|
3
|
+
import type { AppExtensionLocaleResources } from "./i18n";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Internationalization module.
|
|
@@ -1,11 +1,12 @@
|
|
|
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 {@
|
|
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.
|
|
7
7
|
*/
|
|
8
8
|
export type ErrorExtends<ThrowError extends boolean> = ThrowError extends true ? Error : object;
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* Sheet.
|
|
11
12
|
*/
|
|
@@ -15,6 +16,7 @@ export interface Sheet {
|
|
|
15
16
|
*/
|
|
16
17
|
readonly name: string;
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Single cell address.
|
|
20
22
|
*/
|
|
@@ -23,16 +25,19 @@ export interface Address {
|
|
|
23
25
|
* Zero-indexed row.
|
|
24
26
|
*/
|
|
25
27
|
readonly rowIndex: number;
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* Zero-indexed column.
|
|
28
31
|
*/
|
|
29
32
|
readonly columnIndex: number;
|
|
30
33
|
}
|
|
34
|
+
|
|
31
35
|
/**
|
|
32
36
|
* Sheet address.
|
|
33
37
|
*/
|
|
34
38
|
export interface SheetAddress extends Sheet, Address {
|
|
35
39
|
}
|
|
40
|
+
|
|
36
41
|
/**
|
|
37
42
|
* Range of cells.
|
|
38
43
|
*/
|
|
@@ -41,16 +46,19 @@ export interface Range {
|
|
|
41
46
|
* Start address, inclusive.
|
|
42
47
|
*/
|
|
43
48
|
readonly startAddress: Address;
|
|
49
|
+
|
|
44
50
|
/**
|
|
45
51
|
* End address, exclusive.
|
|
46
52
|
*/
|
|
47
53
|
readonly endAddress: Address;
|
|
48
54
|
}
|
|
55
|
+
|
|
49
56
|
/**
|
|
50
57
|
* Sheet range.
|
|
51
58
|
*/
|
|
52
59
|
export interface SheetRange extends Sheet, Range {
|
|
53
60
|
}
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
* Matrix type; shorthand for defining a two-dimensional matrix (array of array) of a type.
|
|
56
64
|
*
|
|
@@ -58,6 +66,7 @@ export interface SheetRange extends Sheet, Range {
|
|
|
58
66
|
* Type.
|
|
59
67
|
*/
|
|
60
68
|
export type Matrix<T> = T[][];
|
|
69
|
+
|
|
61
70
|
/**
|
|
62
71
|
* Function result, possibly including an error result. If the application framework reports errors through the return
|
|
63
72
|
* value, the result is the union of the result type and the error type; otherwise, it's just the result type.
|
|
@@ -72,6 +81,7 @@ export type Matrix<T> = T[][];
|
|
|
72
81
|
* Error type.
|
|
73
82
|
*/
|
|
74
83
|
export type ResultError<TResult, ThrowError extends boolean, TError extends ErrorExtends<ThrowError>> = ThrowError extends false ? TResult | TError : TResult;
|
|
84
|
+
|
|
75
85
|
/**
|
|
76
86
|
* Function result as matrix, possibly including an error result in each element. If the application framework reports
|
|
77
87
|
* errors through the return value, the individual element result is the union of the result type and the error type;
|
|
@@ -87,41 +97,3 @@ export type ResultError<TResult, ThrowError extends boolean, TError extends Erro
|
|
|
87
97
|
* Error type.
|
|
88
98
|
*/
|
|
89
99
|
export type MatrixResultError<TResult, ThrowError extends boolean, TError extends ErrorExtends<ThrowError>> = Matrix<ResultError<TResult, ThrowError, TError>>;
|
|
90
|
-
/**
|
|
91
|
-
* Typed function, applicable to any function, stricter than {@link Function}.
|
|
92
|
-
*/
|
|
93
|
-
export type TypedFunction<TMethod extends (...args: Parameters<TMethod>) => ReturnType<TMethod>> = (...args: Parameters<TMethod>) => ReturnType<TMethod>;
|
|
94
|
-
/**
|
|
95
|
-
* Typed synchronous function, applicable to any function that doesn't return a Promise.
|
|
96
|
-
*/
|
|
97
|
-
export type TypedSyncFunction<TMethod extends TypedFunction<TMethod>> = [ReturnType<TMethod>] extends [PromiseLike<unknown>] ? never : TypedFunction<TMethod>;
|
|
98
|
-
/**
|
|
99
|
-
* Determine the fundamental promised type. This is stricter than `Awaited\<Type\>` in that it requires a Promise.
|
|
100
|
-
*/
|
|
101
|
-
type PromisedType<T> = [T] extends [PromiseLike<infer TPromised>] ? TPromised : never;
|
|
102
|
-
/**
|
|
103
|
-
* Typed asynchronous function, applicable to any function that returns a Promise.
|
|
104
|
-
*/
|
|
105
|
-
export type TypedAsyncFunction<TMethod extends (...args: Parameters<TMethod>) => PromiseLike<PromisedType<ReturnType<TMethod>>>> = (...args: Parameters<TMethod>) => Promise<PromisedType<ReturnType<TMethod>>>;
|
|
106
|
-
/**
|
|
107
|
-
* Nullishable type. Application extension may pass `null` or `undefined` to missing parameters.
|
|
108
|
-
*/
|
|
109
|
-
export type Nullishable<T> = T | null | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Non-nullishable type. If T is an object type, it is spread and attributes within it are made non-nullishable.
|
|
112
|
-
*/
|
|
113
|
-
export type NonNullishable<T> = T extends object ? {
|
|
114
|
-
[P in keyof T]-?: NonNullishable<T[P]>;
|
|
115
|
-
} : NonNullable<T>;
|
|
116
|
-
/**
|
|
117
|
-
* Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.
|
|
118
|
-
*
|
|
119
|
-
* @param argument
|
|
120
|
-
* Argument.
|
|
121
|
-
*
|
|
122
|
-
* @returns
|
|
123
|
-
* True if argument is undefined or null.
|
|
124
|
-
*/
|
|
125
|
-
export declare function isNullish<T>(argument: T | null | undefined): argument is null | undefined;
|
|
126
|
-
export {};
|
|
127
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import type { Nullishable } from "@aidc-toolkit/core";
|
|
1
2
|
import {
|
|
2
3
|
ALPHABETIC_CREATOR,
|
|
3
4
|
ALPHANUMERIC_CREATOR,
|
|
4
5
|
type CharacterSetCreator,
|
|
5
6
|
type CharacterSetValidation,
|
|
7
|
+
type CharacterSetValidator,
|
|
6
8
|
type Exclusion,
|
|
7
9
|
HEXADECIMAL_CREATOR,
|
|
8
10
|
NUMERIC_CREATOR,
|
|
9
11
|
Sequence
|
|
10
12
|
} from "@aidc-toolkit/utility";
|
|
11
|
-
import type { AppExtension } from "../app-extension
|
|
13
|
+
import type { AppExtension } from "../app-extension";
|
|
12
14
|
import {
|
|
13
15
|
expandParameterDescriptor,
|
|
14
16
|
type ParameterDescriptor,
|
|
@@ -16,22 +18,22 @@ import {
|
|
|
16
18
|
ProxyMethod,
|
|
17
19
|
ProxyParameter,
|
|
18
20
|
Types
|
|
19
|
-
} from "../descriptor
|
|
20
|
-
import { LibProxy } from "../lib-proxy
|
|
21
|
-
import type { ErrorExtends, Matrix, MatrixResultError,
|
|
21
|
+
} from "../descriptor";
|
|
22
|
+
import { LibProxy } from "../lib-proxy";
|
|
23
|
+
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "../type";
|
|
22
24
|
import {
|
|
23
25
|
exclusionAnyParameterDescriptor,
|
|
24
26
|
exclusionFirstZeroParameterDescriptor,
|
|
25
27
|
exclusionNoneParameterDescriptor
|
|
26
|
-
} from "./character-set-descriptor
|
|
27
|
-
import { sParameterDescriptor, validateSParameterDescriptor } from "./string-descriptor
|
|
28
|
-
import { StringProxy } from "./string-proxy
|
|
28
|
+
} from "./character-set-descriptor";
|
|
29
|
+
import { sParameterDescriptor, validateSParameterDescriptor } from "./string-descriptor";
|
|
30
|
+
import { StringProxy } from "./string-proxy";
|
|
29
31
|
import {
|
|
30
32
|
countParameterDescriptor,
|
|
31
33
|
startValueParameterDescriptor,
|
|
32
34
|
tweakParameterDescriptor,
|
|
33
35
|
valueParameterDescriptor
|
|
34
|
-
} from "./transformer-descriptor
|
|
36
|
+
} from "./transformer-descriptor";
|
|
35
37
|
|
|
36
38
|
const lengthParameterDescriptor: ParameterDescriptor = {
|
|
37
39
|
name: "length",
|
|
@@ -45,13 +47,13 @@ const valueForSParameterDescriptor: ParameterDescriptor = {
|
|
|
45
47
|
name: "valueForS"
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
export abstract class
|
|
49
|
-
private readonly
|
|
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;
|
|
50
52
|
|
|
51
|
-
protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>,
|
|
53
|
+
protected constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>, characterSetValidator: CharacterSetValidator) {
|
|
52
54
|
super(appExtension);
|
|
53
55
|
|
|
54
|
-
this.
|
|
56
|
+
this._characterSetValidator = characterSetValidator;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
@ProxyMethod({
|
|
@@ -62,7 +64,7 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
|
|
|
62
64
|
@ProxyParameter(validateSParameterDescriptor) matrixSs: Matrix<string>,
|
|
63
65
|
@ProxyParameter(exclusionNoneParameterDescriptor) exclusion: Nullishable<Exclusion>
|
|
64
66
|
): MatrixResultError<string, ThrowError, TError> {
|
|
65
|
-
return this.validateString(this.
|
|
67
|
+
return this.validateString(this._characterSetValidator, matrixSs, {
|
|
66
68
|
exclusion: exclusion ?? undefined
|
|
67
69
|
} satisfies CharacterSetValidation);
|
|
68
70
|
}
|
|
@@ -77,6 +79,16 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
|
|
|
77
79
|
): MatrixResultError<boolean, ThrowError, TError> {
|
|
78
80
|
return this.isValidString(this.validate(matrixSs, exclusion));
|
|
79
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
|
+
}
|
|
80
92
|
|
|
81
93
|
@ProxyMethod({
|
|
82
94
|
type: Types.String,
|
|
@@ -139,7 +151,7 @@ export abstract class CharacterSetProxy<ThrowError extends boolean, TError exten
|
|
|
139
151
|
}
|
|
140
152
|
]
|
|
141
153
|
})
|
|
142
|
-
export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends
|
|
154
|
+
export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
143
155
|
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
144
156
|
super(appExtension, NUMERIC_CREATOR);
|
|
145
157
|
}
|
|
@@ -154,7 +166,7 @@ export class NumericProxy<ThrowError extends boolean, TError extends ErrorExtend
|
|
|
154
166
|
}
|
|
155
167
|
]
|
|
156
168
|
})
|
|
157
|
-
export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends
|
|
169
|
+
export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
158
170
|
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
159
171
|
super(appExtension, HEXADECIMAL_CREATOR);
|
|
160
172
|
}
|
|
@@ -163,7 +175,7 @@ export class HexadecimalProxy<ThrowError extends boolean, TError extends ErrorEx
|
|
|
163
175
|
@ProxyClass({
|
|
164
176
|
methodInfix: "Alphabetic"
|
|
165
177
|
})
|
|
166
|
-
export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends
|
|
178
|
+
export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
167
179
|
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
168
180
|
super(appExtension, ALPHABETIC_CREATOR);
|
|
169
181
|
}
|
|
@@ -178,7 +190,7 @@ export class AlphabeticProxy<ThrowError extends boolean, TError extends ErrorExt
|
|
|
178
190
|
}
|
|
179
191
|
]
|
|
180
192
|
})
|
|
181
|
-
export class AlphanumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends
|
|
193
|
+
export class AlphanumericProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
182
194
|
constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TBigInt>) {
|
|
183
195
|
super(appExtension, ALPHANUMERIC_CREATOR);
|
|
184
196
|
}
|
package/src/utility/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./transformer-proxy
|
|
2
|
-
export * from "./reg-exp-proxy
|
|
3
|
-
export * from "./character-set-proxy
|
|
1
|
+
export * from "./transformer-proxy";
|
|
2
|
+
export * from "./reg-exp-proxy";
|
|
3
|
+
export * from "./character-set-proxy";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { Nullishable } from "@aidc-toolkit/core";
|
|
1
2
|
import { RegExpValidator } from "@aidc-toolkit/utility";
|
|
2
|
-
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor
|
|
3
|
-
import type { ErrorExtends, Matrix, MatrixResultError
|
|
4
|
-
import { validateSParameterDescriptor } from "./string-descriptor
|
|
5
|
-
import { StringProxy } from "./string-proxy
|
|
3
|
+
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor";
|
|
4
|
+
import type { ErrorExtends, Matrix, MatrixResultError } from "../type";
|
|
5
|
+
import { validateSParameterDescriptor } from "./string-descriptor";
|
|
6
|
+
import { StringProxy } from "./string-proxy";
|
|
6
7
|
|
|
7
8
|
const regExpParameterDescriptor: ParameterDescriptor = {
|
|
8
9
|
name: "regExp",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StringValidation, StringValidator } from "@aidc-toolkit/utility";
|
|
2
|
-
import { LibProxy } from "../lib-proxy
|
|
3
|
-
import type { ErrorExtends, Matrix, MatrixResultError } from "../
|
|
2
|
+
import { LibProxy } from "../lib-proxy";
|
|
3
|
+
import type { ErrorExtends, Matrix, MatrixResultError } from "../type";
|
|
4
4
|
|
|
5
5
|
export abstract class StringProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TBigInt> {
|
|
6
6
|
protected validateString<TStringValidation extends StringValidation>(validator: StringValidator<TStringValidation>, matrixSs: Matrix<string>, validation?: TStringValidation): Matrix<string> {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { Nullishable } from "@aidc-toolkit/core";
|
|
1
2
|
import { mapIterable, Sequence, Transformer } from "@aidc-toolkit/utility";
|
|
2
|
-
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor
|
|
3
|
-
import { LibProxy } from "../lib-proxy
|
|
4
|
-
import type { ErrorExtends, Matrix, MatrixResultError,
|
|
3
|
+
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor";
|
|
4
|
+
import { LibProxy } from "../lib-proxy";
|
|
5
|
+
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "../type";
|
|
5
6
|
import {
|
|
6
7
|
countParameterDescriptor,
|
|
7
8
|
startValueParameterDescriptor,
|
|
8
9
|
tweakParameterDescriptor,
|
|
9
10
|
valueParameterDescriptor
|
|
10
|
-
} from "./transformer-descriptor
|
|
11
|
+
} from "./transformer-descriptor";
|
|
11
12
|
|
|
12
13
|
const domainParameterDescriptor: ParameterDescriptor = {
|
|
13
14
|
name: "domain",
|
package/tsup.config.ts
ADDED
package/dist/app-extension.d.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import type { ErrorExtends, ResultError, SheetAddress, SheetRange, TypedAsyncFunction, TypedFunction, TypedSyncFunction } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Application extension.
|
|
4
|
-
*
|
|
5
|
-
* @template TBigInt
|
|
6
|
-
* Type to which big integer is mapped.
|
|
7
|
-
*
|
|
8
|
-
* @template ThrowError
|
|
9
|
-
* If true, errors are reported through the throw/catch mechanism.
|
|
10
|
-
*
|
|
11
|
-
* @template TError
|
|
12
|
-
* Error type.
|
|
13
|
-
*/
|
|
14
|
-
export declare abstract class AppExtension<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TBigInt> {
|
|
15
|
-
/**
|
|
16
|
-
* Application version.
|
|
17
|
-
*/
|
|
18
|
-
private readonly _version;
|
|
19
|
-
/**
|
|
20
|
-
* Maximum sequence count supported by application.
|
|
21
|
-
*/
|
|
22
|
-
private readonly _maximumSequenceCount;
|
|
23
|
-
/**
|
|
24
|
-
* If true, errors are reported through the throw/catch mechanism.
|
|
25
|
-
*/
|
|
26
|
-
private readonly _throwError;
|
|
27
|
-
/**
|
|
28
|
-
* Maximum width supported by application.
|
|
29
|
-
*/
|
|
30
|
-
private _maximumWidth?;
|
|
31
|
-
/**
|
|
32
|
-
* Maximum height supported by application.
|
|
33
|
-
*/
|
|
34
|
-
private _maximumHeight?;
|
|
35
|
-
/**
|
|
36
|
-
* Constructor.
|
|
37
|
-
*
|
|
38
|
-
* @param version
|
|
39
|
-
* Application version.
|
|
40
|
-
*
|
|
41
|
-
* @param maximumSequenceCount
|
|
42
|
-
* Maximum sequence count supported by application.
|
|
43
|
-
*
|
|
44
|
-
* @param throwError
|
|
45
|
-
* If true, errors are reported through the throw/catch mechanism.
|
|
46
|
-
*/
|
|
47
|
-
protected constructor(version: string, maximumSequenceCount: number, throwError: ThrowError);
|
|
48
|
-
/**
|
|
49
|
-
* Get the version.
|
|
50
|
-
*
|
|
51
|
-
* @returns
|
|
52
|
-
* Version.
|
|
53
|
-
*/
|
|
54
|
-
get version(): string;
|
|
55
|
-
/**
|
|
56
|
-
* Determine if errors are reported through the throw/catch mechanism.
|
|
57
|
-
*/
|
|
58
|
-
get throwError(): ThrowError;
|
|
59
|
-
/**
|
|
60
|
-
* Get the maximum width supported by the application.
|
|
61
|
-
*
|
|
62
|
-
* @returns
|
|
63
|
-
* Maximum width supported by the application.
|
|
64
|
-
*/
|
|
65
|
-
maximumWidth(): Promise<number>;
|
|
66
|
-
/**
|
|
67
|
-
* Get the maximum width supported by the application.
|
|
68
|
-
*
|
|
69
|
-
* @returns
|
|
70
|
-
* Maximum width supported by the application.
|
|
71
|
-
*/
|
|
72
|
-
protected abstract getMaximumWidth(): Promise<number>;
|
|
73
|
-
/**
|
|
74
|
-
* Get the maximum height supported by the application.
|
|
75
|
-
*
|
|
76
|
-
* @returns
|
|
77
|
-
* Maximum height supported by the application.
|
|
78
|
-
*/
|
|
79
|
-
maximumHeight(): Promise<number>;
|
|
80
|
-
/**
|
|
81
|
-
* Get the maximum height supported by the application.
|
|
82
|
-
*
|
|
83
|
-
* @returns
|
|
84
|
-
* Maximum height supported by the application.
|
|
85
|
-
*/
|
|
86
|
-
protected abstract getMaximumHeight(): Promise<number>;
|
|
87
|
-
/**
|
|
88
|
-
* Get the sheet address from an invocation context.
|
|
89
|
-
*
|
|
90
|
-
* @param invocationContext
|
|
91
|
-
* Invocation context.
|
|
92
|
-
*
|
|
93
|
-
* @returns
|
|
94
|
-
* Sheet address.
|
|
95
|
-
*/
|
|
96
|
-
abstract getSheetAddress(invocationContext: TInvocationContext): Promise<SheetAddress>;
|
|
97
|
-
/**
|
|
98
|
-
* Get a parameter range from an invocation context.
|
|
99
|
-
*
|
|
100
|
-
* @param invocationContext
|
|
101
|
-
* Invocation context.
|
|
102
|
-
*
|
|
103
|
-
* @param parameterNumber
|
|
104
|
-
* Parameter number.
|
|
105
|
-
*
|
|
106
|
-
* @returns
|
|
107
|
-
* Sheet range or null if parameter is not a range.
|
|
108
|
-
*/
|
|
109
|
-
abstract getParameterSheetRange(invocationContext: TInvocationContext, parameterNumber: number): Promise<SheetRange | null>;
|
|
110
|
-
/**
|
|
111
|
-
* Validate a sequence count against the maximum supported by application.
|
|
112
|
-
*
|
|
113
|
-
* @param sequenceCount
|
|
114
|
-
* Sequence count.
|
|
115
|
-
*/
|
|
116
|
-
validateSequenceCount(sequenceCount: number): void;
|
|
117
|
-
/**
|
|
118
|
-
* Map big integer to another type if necessary.
|
|
119
|
-
*
|
|
120
|
-
* @param value
|
|
121
|
-
* Big integer value to map.
|
|
122
|
-
*
|
|
123
|
-
* @returns
|
|
124
|
-
* Mapped big integer value.
|
|
125
|
-
*/
|
|
126
|
-
abstract mapBigInt(value: bigint): ResultError<TBigInt, ThrowError, TError>;
|
|
127
|
-
/**
|
|
128
|
-
* Map a range error (thrown by the library) to an application-specific error. If errors are reported through the
|
|
129
|
-
* throw/catch mechanism, the implementation may return the range error unmodified if that is supported.
|
|
130
|
-
*
|
|
131
|
-
* @param rangeError
|
|
132
|
-
*/
|
|
133
|
-
abstract mapRangeError(rangeError: RangeError): TError;
|
|
134
|
-
/**
|
|
135
|
-
* Handle an error with a message; called when an exception occurs outside the control of the AIDC Toolkit library.
|
|
136
|
-
* Implementation must not return, most likely by throwing the message wrapped in an error type.
|
|
137
|
-
*
|
|
138
|
-
* @param message
|
|
139
|
-
* Message to include in the error.
|
|
140
|
-
*/
|
|
141
|
-
abstract handleError(message: string): never;
|
|
142
|
-
/**
|
|
143
|
-
* Bind a synchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
144
|
-
*
|
|
145
|
-
* @param thisArg
|
|
146
|
-
* The value to be passed as the `this` parameter to the method.
|
|
147
|
-
*
|
|
148
|
-
* @param method
|
|
149
|
-
* Method to call.
|
|
150
|
-
*
|
|
151
|
-
* @returns
|
|
152
|
-
* Function wrapped around the method.
|
|
153
|
-
*/
|
|
154
|
-
bindSync<TMethod extends TypedSyncFunction<TMethod>>(thisArg: ThisParameterType<TMethod>, method: TMethod): TypedFunction<TMethod>;
|
|
155
|
-
/**
|
|
156
|
-
* Bind an asynchronous method and wrap it in a try/catch for comprehensive error handling.
|
|
157
|
-
*
|
|
158
|
-
* @param thisArg
|
|
159
|
-
* The value to be passed as the `this` parameter to the method.
|
|
160
|
-
*
|
|
161
|
-
* @param method
|
|
162
|
-
* Method to call.
|
|
163
|
-
*
|
|
164
|
-
* @returns
|
|
165
|
-
* Function wrapped around the method.
|
|
166
|
-
*/
|
|
167
|
-
bindAsync<TMethod extends TypedAsyncFunction<TMethod>>(thisArg: ThisParameterType<TMethod>, method: TMethod): TypedAsyncFunction<TMethod>;
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=app-extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-extension.d.ts","sourceRoot":"","sources":["../src/app-extension.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACpB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,8BAAsB,YAAY,CAAC,UAAU,SAAS,OAAO,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,OAAO;IAC/H;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAE/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;OAEG;IACH,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC;;;;;;;;;;;OAWG;IACH,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAM3F;;;;;OAKG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAMrC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAErD;;;;;OAKG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAMtC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAEtD;;;;;;;;OAQG;IACH,QAAQ,CAAC,eAAe,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAEtF;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAE3H;;;;;OAKG;IACH,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAWlD;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC;IAE3E;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;IAEtD;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAE5C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;IAelI;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,OAAO,SAAS,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC;CAU5I"}
|