@aidc-toolkit/app-extension 1.0.24-beta → 1.0.26-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 +109 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -37
- package/dist/index.d.ts +59 -37
- package/dist/index.js +111 -65
- package/dist/index.js.map +1 -1
- package/package.json +14 -9
- package/src/app-extension.ts +2 -2
- package/src/app-utility-proxy.ts +4 -4
- package/src/descriptor.ts +9 -4
- package/src/generator/descriptor.ts +1 -1
- package/src/generator/generator.ts +24 -6
- package/src/generator/index.ts +2 -2
- package/src/generator/locale-resources-generator.ts +9 -9
- package/src/gs1/character-set-proxy.ts +18 -8
- package/src/gs1/check-proxy.ts +3 -3
- package/src/gs1/identifier-proxy.ts +70 -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 -3
- package/src/locale/i18next.d.ts +1 -1
- package/src/type.ts +1 -1
- package/src/utility/character-set-descriptor.ts +1 -1
- package/src/utility/character-set-proxy.ts +28 -17
- package/src/utility/index.ts +3 -3
- package/src/utility/reg-exp-proxy.ts +4 -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 +4 -4
- package/tsconfig-config.json +4 -0
- package/tsconfig-src.json +11 -0
- package/tsconfig.json +9 -4
- package/tsup.config.ts +3 -2
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/app-extension",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26-beta",
|
|
4
4
|
"description": "Application extension framework for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"homepage": "https://aidc-toolkit.com/",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/aidc-toolkit/app-extension.git"
|
|
11
|
+
},
|
|
9
12
|
"bugs": {
|
|
10
13
|
"url": "https://github.com/aidc-toolkit/app-extension/issues"
|
|
11
14
|
},
|
|
@@ -16,19 +19,21 @@
|
|
|
16
19
|
"url": "https://www.linkedin.com/in/kdean"
|
|
17
20
|
},
|
|
18
21
|
"scripts": {
|
|
22
|
+
"locale-resources-generator": "tsx src/generator/locale-resources-generator.ts",
|
|
19
23
|
"lint": "eslint",
|
|
24
|
+
"tsc:core": "tsc --project tsconfig-src.json",
|
|
25
|
+
"build:devx": "rimraf dist && npm run tsc:core -- --declarationMap --sourceMap",
|
|
20
26
|
"build:dev": "tsup --define.mode=dev",
|
|
21
|
-
"build:release": "tsup",
|
|
27
|
+
"build:release": "npm run tsc:core -- --noEmit && tsup",
|
|
22
28
|
"build:doc": "npm run build:dev"
|
|
23
29
|
},
|
|
24
30
|
"devDependencies": {
|
|
25
|
-
"@aidc-toolkit/dev": "beta"
|
|
26
|
-
"@types/node": "^24.10.1"
|
|
31
|
+
"@aidc-toolkit/dev": "1.0.26-beta"
|
|
27
32
|
},
|
|
28
33
|
"dependencies": {
|
|
29
|
-
"@aidc-toolkit/core": "beta",
|
|
30
|
-
"@aidc-toolkit/gs1": "beta",
|
|
31
|
-
"@aidc-toolkit/utility": "beta",
|
|
32
|
-
"i18next": "^25.7.
|
|
34
|
+
"@aidc-toolkit/core": "1.0.26-beta",
|
|
35
|
+
"@aidc-toolkit/gs1": "1.0.26-beta",
|
|
36
|
+
"@aidc-toolkit/utility": "1.0.26-beta",
|
|
37
|
+
"i18next": "^25.7.1"
|
|
33
38
|
}
|
|
34
39
|
}
|
package/src/app-extension.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TypedAsyncFunction, TypedFunction, TypedSyncFunction } from "@aidc-toolkit/core";
|
|
2
|
-
import { i18nextAppExtension } from "./locale/i18n";
|
|
3
|
-
import type { ErrorExtends, ResultError, SheetAddress, SheetRange } from "./type";
|
|
2
|
+
import { i18nextAppExtension } from "./locale/i18n.js";
|
|
3
|
+
import type { ErrorExtends, ResultError, SheetAddress, SheetRange } from "./type.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Application extension.
|
package/src/app-utility-proxy.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isNullish, type NonNullishable, type Nullishable } from "@aidc-toolkit/core";
|
|
2
|
-
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "./descriptor";
|
|
3
|
-
import { LibProxy } from "./lib-proxy";
|
|
4
|
-
import { i18nextAppExtension } from "./locale/i18n";
|
|
5
|
-
import type { ErrorExtends, Matrix } from "./type";
|
|
2
|
+
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "./descriptor.js";
|
|
3
|
+
import { LibProxy } from "./lib-proxy.js";
|
|
4
|
+
import { i18nextAppExtension } from "./locale/i18n.js";
|
|
5
|
+
import type { ErrorExtends, Matrix } from "./type.js";
|
|
6
6
|
|
|
7
7
|
const spillMatrix: ParameterDescriptor = {
|
|
8
8
|
name: "spillMatrix",
|
package/src/descriptor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TypedFunction } from "@aidc-toolkit/core";
|
|
2
|
-
import type { AppExtension } from "./app-extension";
|
|
3
|
-
import { LibProxy } from "./lib-proxy";
|
|
4
|
-
import type { ErrorExtends } from "./type";
|
|
2
|
+
import type { AppExtension } from "./app-extension.js";
|
|
3
|
+
import { LibProxy } from "./lib-proxy.js";
|
|
4
|
+
import type { ErrorExtends } from "./type.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Core descriptor.
|
|
@@ -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[
|
|
49
|
+
export type Type = typeof Types[TypeKey];
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* Type descriptor.
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { I18nEnvironments } from "@aidc-toolkit/core";
|
|
2
2
|
import type { ParseKeys } from "i18next";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { AppUtilityProxy } from "../app-utility-proxy.js";
|
|
4
|
+
import { expandParameterDescriptor, getClassDescriptorsMap } from "../descriptor.js";
|
|
5
|
+
import * as GS1 from "../gs1/index.js";
|
|
6
|
+
import { appExtensionResources, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
|
|
7
|
+
import * as Utility from "../utility/index.js";
|
|
5
8
|
import type {
|
|
6
9
|
FunctionLocalization,
|
|
7
10
|
Localization,
|
|
8
11
|
ParameterLocalization,
|
|
9
12
|
ProxyFunctionDescriptor,
|
|
10
13
|
ProxyObjectDescriptor
|
|
11
|
-
} from "./descriptor";
|
|
14
|
+
} from "./descriptor.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Dummy method to force proxies to register their decorators.
|
|
18
|
+
*
|
|
19
|
+
* @param _proxies
|
|
20
|
+
* Proxies.
|
|
21
|
+
*/
|
|
22
|
+
function registerProxies(..._proxies: unknown[]): void {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
registerProxies(AppUtilityProxy, Utility, GS1);
|
|
12
26
|
|
|
13
27
|
/**
|
|
14
28
|
* Abstract generator.
|
|
@@ -89,7 +103,7 @@ export abstract class Generator {
|
|
|
89
103
|
const functionLocalization = this._functionLocalizationsMapsMap.get(namespaceFunctionName)?.get(locale);
|
|
90
104
|
|
|
91
105
|
if (functionLocalization === undefined) {
|
|
92
|
-
throw new Error(
|
|
106
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} not found`);
|
|
93
107
|
}
|
|
94
108
|
|
|
95
109
|
return functionLocalization;
|
|
@@ -114,7 +128,7 @@ export abstract class Generator {
|
|
|
114
128
|
const parameterLocalization = this._parameterLocalizationsMapsMap.get(`${namespaceFunctionName}.${parameterName}`)?.get(locale);
|
|
115
129
|
|
|
116
130
|
if (parameterLocalization === undefined) {
|
|
117
|
-
throw new Error(
|
|
131
|
+
throw new Error(`${locale} localization for function ${namespaceFunctionName} parameter ${parameterName} not found`);
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
return parameterLocalization;
|
|
@@ -184,6 +198,10 @@ export abstract class Generator {
|
|
|
184
198
|
|
|
185
199
|
await i18nAppExtensionInit(I18nEnvironments.CLI);
|
|
186
200
|
|
|
201
|
+
// const LocaleResourcesSource = path.resolve(LocaleResourcesGenerator.IMPORT_PATH, entry.name, "locale-resources.ts");
|
|
202
|
+
//
|
|
203
|
+
// await import(LocaleResourcesSource).then((module) => {
|
|
204
|
+
|
|
187
205
|
this.initialize();
|
|
188
206
|
|
|
189
207
|
try {
|
|
@@ -237,7 +255,7 @@ export abstract class Generator {
|
|
|
237
255
|
const insertIndex = methodName.indexOf(infixBefore);
|
|
238
256
|
|
|
239
257
|
if (insertIndex === -1) {
|
|
240
|
-
throw new Error(`Cannot find "${infixBefore}" in method
|
|
258
|
+
throw new Error(`Cannot find "${infixBefore}" in method ${methodName}`);
|
|
241
259
|
}
|
|
242
260
|
|
|
243
261
|
// Other classes in the hierarchy and infix is in the middle of the string.
|
package/src/generator/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type * from "./descriptor";
|
|
2
|
-
export * from "./generator";
|
|
1
|
+
export type * from "./descriptor.js";
|
|
2
|
+
export * from "./generator.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getLogger, type LocaleResources } from "@aidc-toolkit/core";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { expandParameterDescriptor, type ParameterDescriptor } from "../descriptor";
|
|
5
|
-
import type { ProxyFunctionDescriptor } from "./descriptor";
|
|
6
|
-
import { Generator } from "./generator";
|
|
4
|
+
import { expandParameterDescriptor, type ParameterDescriptor } from "../descriptor.js";
|
|
5
|
+
import type { ProxyFunctionDescriptor } from "./descriptor.js";
|
|
6
|
+
import { Generator } from "./generator.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Parameters sequencer entry.
|
|
@@ -37,7 +37,7 @@ interface LocaleResourcesModule {
|
|
|
37
37
|
/**
|
|
38
38
|
* Locale resources.
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
default: LocaleResources;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -188,7 +188,7 @@ class LocaleResourcesGenerator extends Generator {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
if (functionName in functionsLocaleResources) {
|
|
191
|
-
throw new Error(`Duplicate function
|
|
191
|
+
throw new Error(`Duplicate function ${functionName}`);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// Add function.
|
|
@@ -346,13 +346,13 @@ class LocaleResourcesGenerator extends Generator {
|
|
|
346
346
|
await Promise.all(fs.readdirSync(LocaleResourcesGenerator.IMPORT_PATH, {
|
|
347
347
|
withFileTypes: true
|
|
348
348
|
}).filter(entry => entry.isDirectory()).map(async (entry) => {
|
|
349
|
-
const
|
|
349
|
+
const localeResourcesSource = path.resolve(LocaleResourcesGenerator.IMPORT_PATH, entry.name, "locale-resources.ts");
|
|
350
350
|
|
|
351
|
-
await import(
|
|
351
|
+
await import(localeResourcesSource).then((module) => {
|
|
352
352
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Module format is known.
|
|
353
|
-
const
|
|
353
|
+
const localeResources = this.merge(entry.name === "en", "", this._LocaleResources, (module as LocaleResourcesModule).default, !entry.name.includes("-"));
|
|
354
354
|
|
|
355
|
-
fs.writeFileSync(
|
|
355
|
+
fs.writeFileSync(localeResourcesSource, `${LocaleResourcesGenerator.buildOutput("export default", localeResources, 0)};\n`);
|
|
356
356
|
});
|
|
357
357
|
}));
|
|
358
358
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AI39_CREATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
|
|
2
|
-
import type { AppExtension } from "../app-extension";
|
|
3
|
-
import { expandParameterDescriptor, ProxyClass } from "../descriptor";
|
|
4
|
-
import type { ErrorExtends } from "../type";
|
|
1
|
+
import { AI39_CREATOR, AI64_VALIDATOR, AI82_CREATOR } from "@aidc-toolkit/gs1";
|
|
2
|
+
import type { AppExtension } from "../app-extension.js";
|
|
3
|
+
import { expandParameterDescriptor, ProxyClass } from "../descriptor.js";
|
|
4
|
+
import type { ErrorExtends } from "../type.js";
|
|
5
|
+
import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility/index.js";
|
|
5
6
|
import {
|
|
6
7
|
exclusionAllNumericParameterDescriptor,
|
|
7
8
|
exclusionNoneParameterDescriptor
|
|
8
|
-
} from "../utility/character-set-descriptor";
|
|
9
|
-
import { CharacterSetProxy } from "../utility";
|
|
9
|
+
} from "../utility/character-set-descriptor.js";
|
|
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
|
|
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
|
|
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
|
+
}
|
package/src/gs1/check-proxy.ts
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
isValidPriceOrWeightCheckDigit,
|
|
7
7
|
priceOrWeightCheckDigit
|
|
8
8
|
} from "@aidc-toolkit/gs1";
|
|
9
|
-
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor";
|
|
10
|
-
import { LibProxy } from "../lib-proxy";
|
|
11
|
-
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "../type";
|
|
9
|
+
import { type ParameterDescriptor, ProxyClass, ProxyMethod, ProxyParameter, Types } from "../descriptor.js";
|
|
10
|
+
import { LibProxy } from "../lib-proxy.js";
|
|
11
|
+
import type { ErrorExtends, Matrix, MatrixResultError, ResultError } from "../type.js";
|
|
12
12
|
|
|
13
13
|
const checkSParameterDescriptor: ParameterDescriptor = {
|
|
14
14
|
name: "checkS",
|