@aidc-toolkit/app-extension 1.0.45 → 1.0.46-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.d.ts +194 -0
- package/dist/app-extension.d.ts.map +1 -0
- package/dist/app-extension.js +133 -0
- package/dist/app-extension.js.map +1 -0
- package/dist/app-helper-proxy.d.ts +61 -0
- package/dist/app-helper-proxy.d.ts.map +1 -0
- package/dist/app-helper-proxy.js +333 -0
- package/dist/app-helper-proxy.js.map +1 -0
- package/dist/descriptor.d.ts +197 -0
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +44 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/generator/generator.d.ts +124 -0
- package/dist/generator/generator.d.ts.map +1 -0
- package/dist/generator/generator.js +190 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/index.d.ts +18 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +18 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/locale-resources-generator.d.ts +2 -0
- package/dist/generator/locale-resources-generator.d.ts.map +1 -0
- package/dist/generator/locale-resources-generator.js +312 -0
- package/dist/generator/locale-resources-generator.js.map +1 -0
- package/dist/gs1/character-set-proxy.d.ts +13 -0
- package/dist/gs1/character-set-proxy.d.ts.map +1 -0
- package/dist/gs1/character-set-proxy.js +126 -0
- package/dist/gs1/character-set-proxy.js.map +1 -0
- package/dist/gs1/check-proxy.d.ts +11 -0
- package/dist/gs1/check-proxy.d.ts.map +1 -0
- package/dist/gs1/check-proxy.js +163 -0
- package/dist/gs1/check-proxy.js.map +1 -0
- package/dist/gs1/gcp-length-proxy.d.ts +11 -0
- package/dist/gs1/gcp-length-proxy.d.ts.map +1 -0
- package/dist/gs1/gcp-length-proxy.js +190 -0
- package/dist/gs1/gcp-length-proxy.js.map +1 -0
- package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
- package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-creator-proxy.js +85 -0
- package/dist/gs1/gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/gtin-descriptor.d.ts +3 -0
- package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
- package/dist/gs1/gtin-descriptor.js +8 -0
- package/dist/gs1/gtin-descriptor.js.map +1 -0
- package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
- package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-validator-proxy.js +256 -0
- package/dist/gs1/gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
- package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-creator-proxy.js +302 -0
- package/dist/gs1/identifier-creator-proxy.js.map +1 -0
- package/dist/gs1/identifier-descriptor.d.ts +4 -0
- package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
- package/dist/gs1/identifier-descriptor.js +14 -0
- package/dist/gs1/identifier-descriptor.js.map +1 -0
- package/dist/gs1/identifier-type.d.ts +22 -0
- package/dist/gs1/identifier-type.d.ts.map +1 -0
- package/dist/gs1/identifier-type.js +34 -0
- package/dist/gs1/identifier-type.js.map +1 -0
- package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
- package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-validator-proxy.js +212 -0
- package/dist/gs1/identifier-validator-proxy.js.map +1 -0
- package/dist/gs1/index.d.ts +11 -0
- package/dist/gs1/index.d.ts.map +1 -0
- package/dist/gs1/index.js +11 -0
- package/dist/gs1/index.js.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts +38 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.js +301 -0
- package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts +37 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.js +302 -0
- package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.js +16 -0
- package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
- package/dist/gs1/prefix-manager-proxy.d.ts +8 -0
- package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
- package/dist/gs1/prefix-manager-proxy.js +94 -0
- package/dist/gs1/prefix-manager-proxy.js.map +1 -0
- package/dist/gs1/variable-measure-proxy.d.ts +7 -0
- package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
- package/dist/gs1/variable-measure-proxy.js +114 -0
- package/dist/gs1/variable-measure-proxy.js.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts +7 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.js +106 -0
- package/dist/gs1/verified-by-gs1-proxy.js.map +1 -0
- package/dist/index.d.ts +26 -1752
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -0
- package/dist/lib-proxy.d.ts +135 -0
- package/dist/lib-proxy.d.ts.map +1 -0
- package/dist/lib-proxy.js +276 -0
- package/dist/lib-proxy.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +752 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +751 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +752 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +751 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +36 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/proxy.d.ts +136 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +295 -0
- package/dist/proxy.js.map +1 -0
- package/dist/streaming.d.ts +10 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +2 -0
- package/dist/streaming.js.map +1 -0
- package/dist/type.d.ts +91 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/utility/character-set-descriptor.d.ts +6 -0
- package/dist/utility/character-set-descriptor.d.ts.map +1 -0
- package/dist/utility/character-set-descriptor.js +28 -0
- package/dist/utility/character-set-descriptor.js.map +1 -0
- package/dist/utility/character-set-proxy.d.ts +31 -0
- package/dist/utility/character-set-proxy.d.ts.map +1 -0
- package/dist/utility/character-set-proxy.js +278 -0
- package/dist/utility/character-set-proxy.js.map +1 -0
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.d.ts.map +1 -0
- package/dist/utility/index.js +4 -0
- package/dist/utility/index.js.map +1 -0
- package/dist/utility/reg-exp-proxy.d.ts +8 -0
- package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
- package/dist/utility/reg-exp-proxy.js +103 -0
- package/dist/utility/reg-exp-proxy.js.map +1 -0
- package/dist/utility/string-descriptor.d.ts +4 -0
- package/dist/utility/string-descriptor.d.ts.map +1 -0
- package/dist/utility/string-descriptor.js +12 -0
- package/dist/utility/string-descriptor.js.map +1 -0
- package/dist/utility/string-proxy.d.ts +7 -0
- package/dist/utility/string-proxy.d.ts.map +1 -0
- package/dist/utility/string-proxy.js +63 -0
- package/dist/utility/string-proxy.js.map +1 -0
- package/dist/utility/transformer-descriptor.d.ts +6 -0
- package/dist/utility/transformer-descriptor.d.ts.map +1 -0
- package/dist/utility/transformer-descriptor.js +24 -0
- package/dist/utility/transformer-descriptor.js.map +1 -0
- package/dist/utility/transformer-proxy.d.ts +9 -0
- package/dist/utility/transformer-proxy.d.ts.map +1 -0
- package/dist/utility/transformer-proxy.js +111 -0
- package/dist/utility/transformer-proxy.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
- package/tsup.config.ts +4 -1
- package/dist/index.cjs +0 -17
- package/dist/index.d.cts +0 -1752
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type Promisable } from "@aidc-toolkit/core";
|
|
2
|
+
import type { Logger } from "tslog";
|
|
3
|
+
import type { ClassDescriptor, MethodDescriptor } from "../descriptor.js";
|
|
4
|
+
/**
|
|
5
|
+
* Localization.
|
|
6
|
+
*/
|
|
7
|
+
export interface Localization {
|
|
8
|
+
/**
|
|
9
|
+
* Name.
|
|
10
|
+
*/
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Description.
|
|
14
|
+
*/
|
|
15
|
+
readonly description: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Function localization.
|
|
19
|
+
*/
|
|
20
|
+
export interface FunctionLocalization extends Localization {
|
|
21
|
+
/**
|
|
22
|
+
* Namespace function name.
|
|
23
|
+
*/
|
|
24
|
+
readonly namespaceFunctionName: string;
|
|
25
|
+
/**
|
|
26
|
+
* Documentation URL.
|
|
27
|
+
*/
|
|
28
|
+
readonly documentationURL: string;
|
|
29
|
+
/**
|
|
30
|
+
* Parameters map.
|
|
31
|
+
*/
|
|
32
|
+
readonly parametersMap: ReadonlyMap<string, Localization>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Abstract generator.
|
|
36
|
+
*/
|
|
37
|
+
export declare abstract class Generator {
|
|
38
|
+
#private;
|
|
39
|
+
/**
|
|
40
|
+
* Constructor.
|
|
41
|
+
*
|
|
42
|
+
* @param version
|
|
43
|
+
* Package version.
|
|
44
|
+
*
|
|
45
|
+
* @param includeLocalizations
|
|
46
|
+
* Include localizations if true.
|
|
47
|
+
*/
|
|
48
|
+
constructor(version: string, includeLocalizations?: boolean);
|
|
49
|
+
/**
|
|
50
|
+
* Get the logger.
|
|
51
|
+
*/
|
|
52
|
+
get logger(): Logger<object>;
|
|
53
|
+
/**
|
|
54
|
+
* Get the package version.
|
|
55
|
+
*/
|
|
56
|
+
get version(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Get the locales.
|
|
59
|
+
*/
|
|
60
|
+
protected get locales(): readonly string[];
|
|
61
|
+
/**
|
|
62
|
+
* Get the default locale.
|
|
63
|
+
*/
|
|
64
|
+
protected get defaultLocale(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Initialize the generation of the output.
|
|
67
|
+
*/
|
|
68
|
+
protected abstract initialize(): Promisable<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Create a namespace.
|
|
71
|
+
*
|
|
72
|
+
* @param namespace
|
|
73
|
+
* Namespace.
|
|
74
|
+
*/
|
|
75
|
+
protected abstract createNamespace(namespace: string | undefined): void;
|
|
76
|
+
/**
|
|
77
|
+
* Create a category.
|
|
78
|
+
*
|
|
79
|
+
* @param namespace
|
|
80
|
+
* Namespace.
|
|
81
|
+
*
|
|
82
|
+
* @param category
|
|
83
|
+
* Category.
|
|
84
|
+
*
|
|
85
|
+
* @param categoryLocalizationsMap
|
|
86
|
+
* Category localizations map.
|
|
87
|
+
*/
|
|
88
|
+
protected abstract createCategory(namespace: string | undefined, category: string, categoryLocalizationsMap: ReadonlyMap<string, string>): void;
|
|
89
|
+
/**
|
|
90
|
+
* Create a proxy object for a class.
|
|
91
|
+
*
|
|
92
|
+
* @param objectName
|
|
93
|
+
* Object name, derived from namespace and class name.
|
|
94
|
+
*
|
|
95
|
+
* @param classDescriptor
|
|
96
|
+
* Class descriptor.
|
|
97
|
+
*/
|
|
98
|
+
protected abstract createProxyObject(objectName: string, classDescriptor: ClassDescriptor): void;
|
|
99
|
+
/**
|
|
100
|
+
* Create a proxy function for a class and method.
|
|
101
|
+
*
|
|
102
|
+
* @param classDescriptor
|
|
103
|
+
* Class descriptor.
|
|
104
|
+
*
|
|
105
|
+
* @param methodDescriptor
|
|
106
|
+
* Method descriptor.
|
|
107
|
+
*
|
|
108
|
+
* @param functionLocalizationsMap
|
|
109
|
+
* Function localizations map.
|
|
110
|
+
*/
|
|
111
|
+
protected abstract createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor, functionLocalizationsMap: ReadonlyMap<string, FunctionLocalization>): void;
|
|
112
|
+
/**
|
|
113
|
+
* Finalize the generation of the output.
|
|
114
|
+
*
|
|
115
|
+
* @param success
|
|
116
|
+
* True if successful.
|
|
117
|
+
*/
|
|
118
|
+
protected abstract finalize(success: boolean): Promisable<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Generate by processing individual imports.
|
|
121
|
+
*/
|
|
122
|
+
generate(): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAEzG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAiB1E;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACtD;;OAEG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC7D;AAED;;GAEG;AACH,8BA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I18nEnvironments, websiteURL } from "@aidc-toolkit/core";
|
|
2
|
+
import { AppHelperProxy } from "../app-helper-proxy.js";
|
|
3
|
+
import * as GS1 from "../gs1/index.js";
|
|
4
|
+
import { appExtensionResourceBundle, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
|
|
5
|
+
import { proxy } from "../proxy.js";
|
|
6
|
+
import * as Utility from "../utility/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Dummy method to force proxies to register their decorators.
|
|
9
|
+
*
|
|
10
|
+
* @param _proxies
|
|
11
|
+
* Proxies.
|
|
12
|
+
*/
|
|
13
|
+
function registerProxies(..._proxies) {
|
|
14
|
+
}
|
|
15
|
+
registerProxies(AppHelperProxy, Utility, GS1);
|
|
16
|
+
/**
|
|
17
|
+
* Abstract generator.
|
|
18
|
+
*/
|
|
19
|
+
export class Generator {
|
|
20
|
+
/**
|
|
21
|
+
* Documentation path, optionally preceded by locale.
|
|
22
|
+
*/
|
|
23
|
+
static #DOCUMENTATION_PATH = "app-extension/";
|
|
24
|
+
/**
|
|
25
|
+
* Logger.
|
|
26
|
+
*/
|
|
27
|
+
#logger = getLogger();
|
|
28
|
+
/**
|
|
29
|
+
* Package version.
|
|
30
|
+
*/
|
|
31
|
+
#version;
|
|
32
|
+
/**
|
|
33
|
+
* Locales.
|
|
34
|
+
*/
|
|
35
|
+
#locales;
|
|
36
|
+
/**
|
|
37
|
+
* Default locale.
|
|
38
|
+
*/
|
|
39
|
+
#defaultLocale;
|
|
40
|
+
/**
|
|
41
|
+
* Constructor.
|
|
42
|
+
*
|
|
43
|
+
* @param version
|
|
44
|
+
* Package version.
|
|
45
|
+
*
|
|
46
|
+
* @param includeLocalizations
|
|
47
|
+
* Include localizations if true.
|
|
48
|
+
*/
|
|
49
|
+
constructor(version, includeLocalizations = true) {
|
|
50
|
+
this.#version = version;
|
|
51
|
+
this.#locales = includeLocalizations ? Object.keys(appExtensionResourceBundle) : [];
|
|
52
|
+
this.#defaultLocale = this.#locales[0] ?? "";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the logger.
|
|
56
|
+
*/
|
|
57
|
+
get logger() {
|
|
58
|
+
return this.#logger;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the package version.
|
|
62
|
+
*/
|
|
63
|
+
get version() {
|
|
64
|
+
return this.#version;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the locales.
|
|
68
|
+
*/
|
|
69
|
+
get locales() {
|
|
70
|
+
return this.#locales;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the default locale.
|
|
74
|
+
*/
|
|
75
|
+
get defaultLocale() {
|
|
76
|
+
return this.#defaultLocale;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generate a localization.
|
|
80
|
+
*
|
|
81
|
+
* @template TLocalization
|
|
82
|
+
* Localization type.
|
|
83
|
+
*
|
|
84
|
+
* @param locale
|
|
85
|
+
* Locale.
|
|
86
|
+
*
|
|
87
|
+
* @param key
|
|
88
|
+
* Key.
|
|
89
|
+
*
|
|
90
|
+
* @param localizationCallback
|
|
91
|
+
* Callback to finalize localization.
|
|
92
|
+
*
|
|
93
|
+
* @returns
|
|
94
|
+
* Localization.
|
|
95
|
+
*/
|
|
96
|
+
static #generateLocalization(locale, key, localizationCallback) {
|
|
97
|
+
const lngReturnObjectsOption = {
|
|
98
|
+
lng: locale,
|
|
99
|
+
returnObjects: true
|
|
100
|
+
};
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists and return type is Localization.
|
|
102
|
+
return localizationCallback(locale, i18nextAppExtension.t(key, lngReturnObjectsOption));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Generate by processing individual imports.
|
|
106
|
+
*/
|
|
107
|
+
async generate() {
|
|
108
|
+
let success = false;
|
|
109
|
+
await i18nAppExtensionInit(I18nEnvironments.CLI);
|
|
110
|
+
const documentationBaseURL = websiteURL(this.version, true, await ALPHA_URL);
|
|
111
|
+
await this.initialize();
|
|
112
|
+
const namespaceHierarchy = new Map();
|
|
113
|
+
// Organize class descriptors by namespace and category.
|
|
114
|
+
for (const classDescriptor of proxy.classDescriptors) {
|
|
115
|
+
const namespace = classDescriptor.namespace;
|
|
116
|
+
const category = classDescriptor.category;
|
|
117
|
+
let categoryHierarchy = namespaceHierarchy.get(namespace);
|
|
118
|
+
if (categoryHierarchy === undefined) {
|
|
119
|
+
categoryHierarchy = new Map();
|
|
120
|
+
namespaceHierarchy.set(namespace, categoryHierarchy);
|
|
121
|
+
}
|
|
122
|
+
let classDescriptors = categoryHierarchy.get(category);
|
|
123
|
+
if (classDescriptors === undefined) {
|
|
124
|
+
classDescriptors = [];
|
|
125
|
+
categoryHierarchy.set(category, classDescriptors);
|
|
126
|
+
}
|
|
127
|
+
classDescriptors.push(classDescriptor);
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
for (const [namespace, categoryHierarchy] of namespaceHierarchy) {
|
|
131
|
+
const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
|
|
132
|
+
const namespacePath = namespace === undefined ? "" : `${namespace}/`;
|
|
133
|
+
this.createNamespace(namespace);
|
|
134
|
+
for (const [category, classDescriptors] of categoryHierarchy) {
|
|
135
|
+
const namespaceCategory = `${namespacePrefix}${category}`;
|
|
136
|
+
const categoriesKey = `Categories.${category}`;
|
|
137
|
+
const namespaceCategoriesKey = `Categories.${namespaceCategory}`;
|
|
138
|
+
const categoryLocalizationsMap = new Map(this.locales.map((locale) => {
|
|
139
|
+
const lngOption = {
|
|
140
|
+
lng: locale
|
|
141
|
+
};
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
|
|
143
|
+
return [locale, i18nextAppExtension.t((i18nextAppExtension.exists(namespaceCategoriesKey, lngOption) ? namespaceCategoriesKey : categoriesKey), lngOption)];
|
|
144
|
+
}));
|
|
145
|
+
this.createCategory(namespace, category, categoryLocalizationsMap);
|
|
146
|
+
const namespaceClassNamesSet = new Set();
|
|
147
|
+
for (const classDescriptor of classDescriptors) {
|
|
148
|
+
const namespaceClassName = classDescriptor.namespaceClassName;
|
|
149
|
+
if (namespaceClassNamesSet.has(namespaceClassName)) {
|
|
150
|
+
throw new Error(`Duplicate class ${namespaceClassName}`);
|
|
151
|
+
}
|
|
152
|
+
namespaceClassNamesSet.add(namespaceClassName);
|
|
153
|
+
// First capture group is:
|
|
154
|
+
// - one or more uppercase letters followed by zero or more numbers; or
|
|
155
|
+
// - single uppercase letter followed by zero or more characters except uppercase letters or period.
|
|
156
|
+
//
|
|
157
|
+
// Second capture group is:
|
|
158
|
+
// - single uppercase letter followed by zero or more characters except period; or
|
|
159
|
+
// - zero characters (empty string).
|
|
160
|
+
//
|
|
161
|
+
// Third capture group, separated by optional period, is:
|
|
162
|
+
// - single uppercase letter followed by zero or more characters (remainder of string); or
|
|
163
|
+
// - zero characters (empty string).
|
|
164
|
+
const objectNameGroups = /^(?<namespaceFirstWord>[A-Z]+[0-9]*|[A-Z][^A-Z.]*)(?<namespaceRemaining>[A-Z][^.]*|)\.?(?<className>[A-Z].*|)$/u.exec(namespaceClassName)?.groups;
|
|
165
|
+
if (objectNameGroups === undefined) {
|
|
166
|
+
throw new Error(`${namespaceClassName} is not a valid namespace-qualified class name`);
|
|
167
|
+
}
|
|
168
|
+
this.createProxyObject(`${objectNameGroups["namespaceFirstWord"].toLowerCase()}${objectNameGroups["namespaceRemaining"]}${objectNameGroups["className"]}`, classDescriptor);
|
|
169
|
+
for (const methodDescriptor of classDescriptor.methodDescriptors) {
|
|
170
|
+
const functionLocalizationsMap = new Map(this.locales.map(locale => [locale, Generator.#generateLocalization(locale, `Functions.${methodDescriptor.namespaceFunctionName}`, (locale, localization) => ({
|
|
171
|
+
...localization,
|
|
172
|
+
namespaceFunctionName: `${namespacePrefix}${localization.name}`,
|
|
173
|
+
documentationURL: `${documentationBaseURL}/${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
|
|
174
|
+
parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
|
|
175
|
+
// eslint-disable-next-line max-nested-callbacks -- Callback is empty.
|
|
176
|
+
[parameterDescriptor.name, Generator.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]))
|
|
177
|
+
}))]));
|
|
178
|
+
this.createProxyFunction(classDescriptor, methodDescriptor, functionLocalizationsMap);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
success = true;
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
await this.finalize(success);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAmB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAE/C;;;;;GAKG;AACH,SAAS,eAAe,CAAC,GAAG,QAAmB;AAC/C,CAAC;AAED,eAAe,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;AAqC9C;;GAEG;AACH,MAAM,OAAgB,SAAS;IAC3B;;OAEG;IACH,MAAM,CAAU,mBAAmB,GAAG,gBAAgB,CAAC;IAEvD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AC,IAAI,EAAE,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,cAAc,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CACzJ,CAAC;iCACL,CAAC,CAAC,CAAC,CACP,CAAC,CAAC;4BAEH,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;wBAC1F,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;YAED,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;gBAAS,CAAC;YACP,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
3
|
+
* contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./generator.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
3
|
+
* contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./generator.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-resources-generator.d.ts","sourceRoot":"","sources":["../../src/generator/locale-resources-generator.ts"],"names":[],"mappings":""}
|