@aidc-toolkit/app-extension 1.0.32-beta → 1.0.34-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +1 -5
  2. package/dist/app-extension.d.ts +194 -0
  3. package/dist/app-extension.d.ts.map +1 -0
  4. package/dist/app-extension.js +133 -0
  5. package/dist/app-extension.js.map +1 -0
  6. package/dist/app-helper-proxy.d.ts +61 -0
  7. package/dist/app-helper-proxy.d.ts.map +1 -0
  8. package/dist/app-helper-proxy.js +332 -0
  9. package/dist/app-helper-proxy.js.map +1 -0
  10. package/dist/descriptor.d.ts +193 -0
  11. package/dist/descriptor.d.ts.map +1 -0
  12. package/dist/descriptor.js +44 -0
  13. package/dist/descriptor.js.map +1 -0
  14. package/dist/generator/generator.d.ts +114 -0
  15. package/dist/generator/generator.d.ts.map +1 -0
  16. package/dist/generator/generator.js +160 -0
  17. package/dist/generator/generator.js.map +1 -0
  18. package/dist/generator/index.d.ts +2 -0
  19. package/dist/generator/index.d.ts.map +1 -0
  20. package/dist/generator/index.js +2 -0
  21. package/dist/generator/index.js.map +1 -0
  22. package/dist/generator/locale-resources-generator.d.ts +2 -0
  23. package/dist/generator/locale-resources-generator.d.ts.map +1 -0
  24. package/dist/generator/locale-resources-generator.js +311 -0
  25. package/dist/generator/locale-resources-generator.js.map +1 -0
  26. package/dist/gs1/character-set-proxy.d.ts +13 -0
  27. package/dist/gs1/character-set-proxy.d.ts.map +1 -0
  28. package/dist/gs1/character-set-proxy.js +126 -0
  29. package/dist/gs1/character-set-proxy.js.map +1 -0
  30. package/dist/gs1/check-proxy.d.ts +11 -0
  31. package/dist/gs1/check-proxy.d.ts.map +1 -0
  32. package/dist/gs1/check-proxy.js +163 -0
  33. package/dist/gs1/check-proxy.js.map +1 -0
  34. package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
  35. package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
  36. package/dist/gs1/gtin-creator-proxy.js +85 -0
  37. package/dist/gs1/gtin-creator-proxy.js.map +1 -0
  38. package/dist/gs1/gtin-descriptor.d.ts +3 -0
  39. package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
  40. package/dist/gs1/gtin-descriptor.js +8 -0
  41. package/dist/gs1/gtin-descriptor.js.map +1 -0
  42. package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
  43. package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
  44. package/dist/gs1/gtin-validator-proxy.js +256 -0
  45. package/dist/gs1/gtin-validator-proxy.js.map +1 -0
  46. package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
  47. package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
  48. package/dist/gs1/identifier-creator-proxy.js +302 -0
  49. package/dist/gs1/identifier-creator-proxy.js.map +1 -0
  50. package/dist/gs1/identifier-descriptor.d.ts +4 -0
  51. package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
  52. package/dist/gs1/identifier-descriptor.js +14 -0
  53. package/dist/gs1/identifier-descriptor.js.map +1 -0
  54. package/dist/gs1/identifier-type.d.ts +22 -0
  55. package/dist/gs1/identifier-type.d.ts.map +1 -0
  56. package/dist/gs1/identifier-type.js +34 -0
  57. package/dist/gs1/identifier-type.js.map +1 -0
  58. package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
  59. package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
  60. package/dist/gs1/identifier-validator-proxy.js +212 -0
  61. package/dist/gs1/identifier-validator-proxy.js.map +1 -0
  62. package/dist/gs1/index.d.ts +10 -0
  63. package/dist/gs1/index.d.ts.map +1 -0
  64. package/dist/gs1/index.js +10 -0
  65. package/dist/gs1/index.js.map +1 -0
  66. package/dist/gs1/non-gtin-creator-proxy.d.ts +38 -0
  67. package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
  68. package/dist/gs1/non-gtin-creator-proxy.js +301 -0
  69. package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
  70. package/dist/gs1/non-gtin-validator-proxy.d.ts +37 -0
  71. package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
  72. package/dist/gs1/non-gtin-validator-proxy.js +302 -0
  73. package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
  74. package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
  75. package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
  76. package/dist/gs1/prefix-definition-descriptor.js +16 -0
  77. package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
  78. package/dist/gs1/prefix-manager-proxy.d.ts +14 -0
  79. package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
  80. package/dist/gs1/prefix-manager-proxy.js +213 -0
  81. package/dist/gs1/prefix-manager-proxy.js.map +1 -0
  82. package/dist/gs1/service-proxy.d.ts +7 -0
  83. package/dist/gs1/service-proxy.d.ts.map +1 -0
  84. package/dist/gs1/service-proxy.js +105 -0
  85. package/dist/gs1/service-proxy.js.map +1 -0
  86. package/dist/gs1/variable-measure-proxy.d.ts +7 -0
  87. package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
  88. package/dist/gs1/variable-measure-proxy.js +114 -0
  89. package/dist/gs1/variable-measure-proxy.js.map +1 -0
  90. package/dist/index.d.ts +28 -1866
  91. package/dist/index.d.ts.map +1 -0
  92. package/dist/index.js +10 -6508
  93. package/dist/index.js.map +1 -1
  94. package/dist/lib-proxy.d.ts +135 -0
  95. package/dist/lib-proxy.d.ts.map +1 -0
  96. package/dist/lib-proxy.js +276 -0
  97. package/dist/lib-proxy.js.map +1 -0
  98. package/dist/locale/en/locale-resources.d.ts +752 -0
  99. package/dist/locale/en/locale-resources.d.ts.map +1 -0
  100. package/dist/locale/en/locale-resources.js +751 -0
  101. package/dist/locale/en/locale-resources.js.map +1 -0
  102. package/dist/locale/fr/locale-resources.d.ts +752 -0
  103. package/dist/locale/fr/locale-resources.d.ts.map +1 -0
  104. package/dist/locale/fr/locale-resources.js +751 -0
  105. package/dist/locale/fr/locale-resources.js.map +1 -0
  106. package/dist/locale/i18n.d.ts +27 -0
  107. package/dist/locale/i18n.d.ts.map +1 -0
  108. package/dist/locale/i18n.js +36 -0
  109. package/dist/locale/i18n.js.map +1 -0
  110. package/dist/proxy.d.ts +136 -0
  111. package/dist/proxy.d.ts.map +1 -0
  112. package/dist/proxy.js +319 -0
  113. package/dist/proxy.js.map +1 -0
  114. package/dist/streaming.d.ts +10 -0
  115. package/dist/streaming.d.ts.map +1 -0
  116. package/dist/streaming.js +2 -0
  117. package/dist/streaming.js.map +1 -0
  118. package/dist/type.d.ts +91 -0
  119. package/dist/type.d.ts.map +1 -0
  120. package/dist/type.js +2 -0
  121. package/dist/type.js.map +1 -0
  122. package/dist/utility/character-set-descriptor.d.ts +6 -0
  123. package/dist/utility/character-set-descriptor.d.ts.map +1 -0
  124. package/dist/utility/character-set-descriptor.js +28 -0
  125. package/dist/utility/character-set-descriptor.js.map +1 -0
  126. package/dist/utility/character-set-proxy.d.ts +31 -0
  127. package/dist/utility/character-set-proxy.d.ts.map +1 -0
  128. package/dist/utility/character-set-proxy.js +278 -0
  129. package/dist/utility/character-set-proxy.js.map +1 -0
  130. package/dist/utility/index.d.ts +4 -0
  131. package/dist/utility/index.d.ts.map +1 -0
  132. package/dist/utility/index.js +4 -0
  133. package/dist/utility/index.js.map +1 -0
  134. package/dist/utility/reg-exp-proxy.d.ts +8 -0
  135. package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
  136. package/dist/utility/reg-exp-proxy.js +103 -0
  137. package/dist/utility/reg-exp-proxy.js.map +1 -0
  138. package/dist/utility/string-descriptor.d.ts +4 -0
  139. package/dist/utility/string-descriptor.d.ts.map +1 -0
  140. package/dist/utility/string-descriptor.js +12 -0
  141. package/dist/utility/string-descriptor.js.map +1 -0
  142. package/dist/utility/string-proxy.d.ts +7 -0
  143. package/dist/utility/string-proxy.d.ts.map +1 -0
  144. package/dist/utility/string-proxy.js +63 -0
  145. package/dist/utility/string-proxy.js.map +1 -0
  146. package/dist/utility/transformer-descriptor.d.ts +6 -0
  147. package/dist/utility/transformer-descriptor.d.ts.map +1 -0
  148. package/dist/utility/transformer-descriptor.js +24 -0
  149. package/dist/utility/transformer-descriptor.js.map +1 -0
  150. package/dist/utility/transformer-proxy.d.ts +9 -0
  151. package/dist/utility/transformer-proxy.d.ts.map +1 -0
  152. package/dist/utility/transformer-proxy.js +111 -0
  153. package/dist/utility/transformer-proxy.js.map +1 -0
  154. package/package.json +13 -12
  155. package/src/app-extension.ts +26 -47
  156. package/src/{app-utility-proxy.ts → app-helper-proxy.ts} +21 -19
  157. package/src/descriptor.ts +43 -2
  158. package/src/generator/generator.ts +122 -95
  159. package/src/generator/locale-resources-generator.ts +26 -14
  160. package/src/gs1/check-proxy.ts +12 -11
  161. package/src/gs1/gtin-creator-proxy.ts +2 -3
  162. package/src/gs1/gtin-descriptor.ts +2 -2
  163. package/src/gs1/gtin-validator-proxy.ts +12 -14
  164. package/src/gs1/identifier-creator-proxy.ts +19 -21
  165. package/src/gs1/identifier-descriptor.ts +3 -3
  166. package/src/gs1/identifier-validator-proxy.ts +15 -16
  167. package/src/gs1/non-gtin-creator-proxy.ts +0 -11
  168. package/src/gs1/non-gtin-validator-proxy.ts +0 -11
  169. package/src/gs1/prefix-definition-descriptor.ts +2 -2
  170. package/src/gs1/prefix-manager-proxy.ts +80 -120
  171. package/src/gs1/service-proxy.ts +6 -5
  172. package/src/gs1/variable-measure-proxy.ts +9 -8
  173. package/src/index.ts +3 -3
  174. package/src/locale/en/locale-resources.ts +28 -15
  175. package/src/locale/fr/locale-resources.ts +28 -15
  176. package/src/locale/i18n.ts +10 -9
  177. package/src/locale/i18next.d.ts +2 -0
  178. package/src/proxy.ts +64 -40
  179. package/src/utility/character-set-descriptor.ts +2 -2
  180. package/src/utility/character-set-proxy.ts +7 -7
  181. package/src/utility/reg-exp-proxy.ts +5 -5
  182. package/src/utility/string-descriptor.ts +2 -2
  183. package/src/utility/string-proxy.ts +4 -0
  184. package/src/utility/transformer-descriptor.ts +5 -5
  185. package/src/utility/transformer-proxy.ts +6 -5
  186. package/tsconfig-src.json +7 -1
  187. package/tsconfig-src.tsbuildinfo +1 -0
  188. package/dist/index.cjs +0 -6544
  189. package/dist/index.cjs.map +0 -1
  190. package/dist/index.d.cts +0 -1866
  191. package/src/app-data.ts +0 -94
@@ -0,0 +1,114 @@
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 includeLocalizations
43
+ * Include localizations if true.
44
+ */
45
+ constructor(includeLocalizations?: boolean);
46
+ /**
47
+ * Get the logger.
48
+ */
49
+ get logger(): Logger<object>;
50
+ /**
51
+ * Get the locales.
52
+ */
53
+ protected get locales(): readonly string[];
54
+ /**
55
+ * Get the default locale.
56
+ */
57
+ protected get defaultLocale(): string;
58
+ /**
59
+ * Initialize the generation of the output.
60
+ */
61
+ protected abstract initialize(): void;
62
+ /**
63
+ * Create a namespace.
64
+ *
65
+ * @param namespace
66
+ * Namespace.
67
+ */
68
+ protected abstract createNamespace(namespace: string | undefined): void;
69
+ /**
70
+ * Create a category.
71
+ *
72
+ * @param namespace
73
+ * Namespace.
74
+ *
75
+ * @param category
76
+ * Category.
77
+ *
78
+ * @param categoryLocalizationsMap
79
+ * Category localizations map.
80
+ */
81
+ protected abstract createCategory(namespace: string | undefined, category: string, categoryLocalizationsMap: ReadonlyMap<string, string>): void;
82
+ /**
83
+ * Create a proxy object for a class.
84
+ *
85
+ * @param classDescriptor
86
+ * Class descriptor.
87
+ */
88
+ protected abstract createProxyObject(classDescriptor: ClassDescriptor): void;
89
+ /**
90
+ * Create a proxy function for a class and method.
91
+ *
92
+ * @param classDescriptor
93
+ * Class descriptor.
94
+ *
95
+ * @param methodDescriptor
96
+ * Method descriptor.
97
+ *
98
+ * @param functionLocalizationsMap
99
+ * Function localizations map.
100
+ */
101
+ protected abstract createProxyFunction(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor, functionLocalizationsMap: ReadonlyMap<string, FunctionLocalization>): void;
102
+ /**
103
+ * Finalize the generation of the output.
104
+ *
105
+ * @param success
106
+ * True if successful.
107
+ */
108
+ protected abstract finalize(success: boolean): Promisable<void>;
109
+ /**
110
+ * Generate by processing individual imports.
111
+ */
112
+ generate(): Promise<void>;
113
+ }
114
+ //# 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,EAAyC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGpC,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,CA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AAI,CAAC;CAkFlC"}
@@ -0,0 +1,160 @@
1
+ import { getLogger, I18nEnvironments, phaseURL } from "@aidc-toolkit/core";
2
+ import packageConfiguration from "../../package.json" with { type: "json" };
3
+ import { AppHelperProxy } from "../app-helper-proxy.js";
4
+ import * as GS1 from "../gs1/index.js";
5
+ import { appExtensionResourceBundle, i18nAppExtensionInit, i18nextAppExtension } from "../locale/i18n.js";
6
+ import { proxy } from "../proxy.js";
7
+ import * as Utility from "../utility/index.js";
8
+ /**
9
+ * Dummy method to force proxies to register their decorators.
10
+ *
11
+ * @param _proxies
12
+ * Proxies.
13
+ */
14
+ function registerProxies(..._proxies) {
15
+ }
16
+ registerProxies(AppHelperProxy, Utility, GS1);
17
+ /**
18
+ * Abstract generator.
19
+ */
20
+ export class Generator {
21
+ /**
22
+ * Documentation path, optionally preceded by locale.
23
+ */
24
+ static #DOCUMENTATION_PATH = "app-extension/";
25
+ /**
26
+ * Logger.
27
+ */
28
+ #logger = getLogger();
29
+ /**
30
+ * Base URL.
31
+ */
32
+ #baseURL;
33
+ /**
34
+ * Locales.
35
+ */
36
+ #locales;
37
+ /**
38
+ * Default locale.
39
+ */
40
+ #defaultLocale;
41
+ /**
42
+ * Constructor.
43
+ *
44
+ * @param includeLocalizations
45
+ * Include localizations if true.
46
+ */
47
+ constructor(includeLocalizations = true) {
48
+ this.#baseURL = phaseURL(packageConfiguration.version, "http://10.211.55.2:5173");
49
+ this.#locales = includeLocalizations ? Object.keys(appExtensionResourceBundle) : [];
50
+ this.#defaultLocale = this.#locales[0] ?? "";
51
+ }
52
+ /**
53
+ * Get the logger.
54
+ */
55
+ get logger() {
56
+ return this.#logger;
57
+ }
58
+ /**
59
+ * Get the locales.
60
+ */
61
+ get locales() {
62
+ return this.#locales;
63
+ }
64
+ /**
65
+ * Get the default locale.
66
+ */
67
+ get defaultLocale() {
68
+ return this.#defaultLocale;
69
+ }
70
+ /**
71
+ * Generate a localization.
72
+ *
73
+ * @template TLocalization
74
+ * Localization type.
75
+ *
76
+ * @param locale
77
+ * Locale.
78
+ *
79
+ * @param key
80
+ * Key.
81
+ *
82
+ * @param localizationCallback
83
+ * Callback to finalize localization.
84
+ *
85
+ * @returns
86
+ * Localization.
87
+ */
88
+ static #generateLocalization(locale, key, localizationCallback) {
89
+ const lngReturnObjectsOption = {
90
+ lng: locale,
91
+ returnObjects: true
92
+ };
93
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists and return type is Localization.
94
+ return localizationCallback(locale, i18nextAppExtension.t(key, lngReturnObjectsOption));
95
+ }
96
+ /**
97
+ * Generate by processing individual imports.
98
+ */
99
+ async generate() {
100
+ let success = false;
101
+ await i18nAppExtensionInit(I18nEnvironments.CLI);
102
+ this.initialize();
103
+ const namespaceHierarchy = new Map();
104
+ // Organize class descriptors by namespace and category.
105
+ for (const classDescriptor of proxy.classDescriptors) {
106
+ const namespace = classDescriptor.namespace;
107
+ const category = classDescriptor.category;
108
+ let categoryHierarchy = namespaceHierarchy.get(namespace);
109
+ if (categoryHierarchy === undefined) {
110
+ categoryHierarchy = new Map();
111
+ namespaceHierarchy.set(namespace, categoryHierarchy);
112
+ }
113
+ let classDescriptors = categoryHierarchy.get(category);
114
+ if (classDescriptors === undefined) {
115
+ classDescriptors = [];
116
+ categoryHierarchy.set(category, classDescriptors);
117
+ }
118
+ classDescriptors.push(classDescriptor);
119
+ }
120
+ try {
121
+ for (const [namespace, categoryHierarchy] of namespaceHierarchy) {
122
+ const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
123
+ const namespacePath = namespace === undefined ? "" : `${namespace}/`;
124
+ this.createNamespace(namespace);
125
+ for (const [category, classDescriptors] of categoryHierarchy) {
126
+ const namespaceCategory = `${namespacePrefix}${category}`;
127
+ const categoriesKey = `Categories.${category}`;
128
+ const namespaceCategoriesKey = `Categories.${namespaceCategory}`;
129
+ const categoryLocalizationsMap = new Map(this.locales.map((locale) => {
130
+ const lngOption = {
131
+ lng: locale
132
+ };
133
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
134
+ return [locale, i18nextAppExtension.t((i18nextAppExtension.exists(namespaceCategoriesKey, lngOption) ? namespaceCategoriesKey : categoriesKey), lngOption)];
135
+ }));
136
+ this.createCategory(namespace, category, categoryLocalizationsMap);
137
+ for (const classDescriptor of classDescriptors) {
138
+ this.createProxyObject(classDescriptor);
139
+ for (const methodDescriptor of classDescriptor.methodDescriptors) {
140
+ const functionLocalizationsMap = new Map(this.locales.map(locale => [locale, Generator.#generateLocalization(locale, `Functions.${methodDescriptor.namespaceFunctionName}`, (locale, localization) => ({
141
+ ...localization,
142
+ namespaceFunctionName: `${namespacePrefix}${localization.name}`,
143
+ documentationURL: `${this.#baseURL}/${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
144
+ parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
145
+ // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
146
+ [parameterDescriptor.name, Generator.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]))
147
+ }))]));
148
+ this.createProxyFunction(classDescriptor, methodDescriptor, functionLocalizationsMap);
149
+ }
150
+ }
151
+ }
152
+ }
153
+ success = true;
154
+ }
155
+ finally {
156
+ await this.finalize(success);
157
+ }
158
+ }
159
+ }
160
+ //# 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,gBAAgB,EAAE,QAAQ,EAAmB,MAAM,oBAAoB,CAAC;AAG5F,OAAO,oBAAoB,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AAC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{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./generator.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=locale-resources-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-resources-generator.d.ts","sourceRoot":"","sources":["../../src/generator/locale-resources-generator.ts"],"names":[],"mappings":""}
@@ -0,0 +1,311 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { Generator } from "./generator.js";
4
+ /**
5
+ * Locale resources generator.
6
+ */
7
+ class LocaleResourcesGenerator extends Generator {
8
+ /**
9
+ * Locale resources import path.
10
+ */
11
+ static #IMPORT_PATH = "../app-extension/src/locale";
12
+ /**
13
+ * Parameters sequencer.
14
+ */
15
+ #parametersSequencer = {};
16
+ /**
17
+ * Parameters locale resources.
18
+ */
19
+ #parametersLocaleResources = {};
20
+ /**
21
+ * Functions locale resources.
22
+ */
23
+ #functionsLocaleResources = {};
24
+ /**
25
+ * Locale resources.
26
+ */
27
+ #LocaleResources = {
28
+ Parameters: this.#parametersLocaleResources,
29
+ Functions: this.#functionsLocaleResources
30
+ };
31
+ /**
32
+ * Constructor.
33
+ */
34
+ constructor() {
35
+ super(false);
36
+ }
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ initialize() {
41
+ }
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ createNamespace() {
46
+ }
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ createCategory() {
51
+ }
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ createProxyObject() {
56
+ }
57
+ /**
58
+ * Save a parameter descriptor in the appropriate spot in the sequence.
59
+ *
60
+ * @param parameterDescriptor
61
+ * Parameter descriptor.
62
+ *
63
+ * @param isUsed
64
+ * True if parameter descriptor is actually used and not just a base.
65
+ *
66
+ * @returns
67
+ * Parameters sequencer entry.
68
+ */
69
+ #saveParameterSequence(parameterDescriptor, isUsed) {
70
+ let parametersSequencerEntry;
71
+ if (!("extendsDescriptor" in parameterDescriptor)) {
72
+ const parameterName = parameterDescriptor.name;
73
+ // Create entry if it doesn't exist, otherwise pick up where last call left off.
74
+ if (!(parameterName in this.#parametersSequencer)) {
75
+ parametersSequencerEntry = {
76
+ parametersSequencerOrNull: null,
77
+ parameterDescriptor,
78
+ parameterName,
79
+ baseParameterName: parameterName,
80
+ isUsed
81
+ };
82
+ this.#parametersSequencer[parameterName] = parametersSequencerEntry;
83
+ }
84
+ else {
85
+ parametersSequencerEntry = this.#parametersSequencer[parameterName];
86
+ }
87
+ }
88
+ else {
89
+ const baseParametersSequencerEntry = this.#saveParameterSequence(parameterDescriptor.extendsDescriptor, false);
90
+ let parameterName;
91
+ let baseParameterName;
92
+ if (parameterDescriptor.name !== undefined) {
93
+ parameterName = parameterDescriptor.name;
94
+ baseParameterName = baseParametersSequencerEntry.parameterName;
95
+ }
96
+ else {
97
+ parameterName = baseParametersSequencerEntry.parameterName;
98
+ baseParameterName = baseParametersSequencerEntry.baseParameterName;
99
+ }
100
+ if (parameterName !== baseParameterName) {
101
+ // Make sure that base parameters sequencer entry refers to a record type.
102
+ baseParametersSequencerEntry.parametersSequencerOrNull ??= {};
103
+ if (!(parameterName in baseParametersSequencerEntry.parametersSequencerOrNull)) {
104
+ parametersSequencerEntry = {
105
+ parametersSequencerOrNull: null,
106
+ parameterDescriptor,
107
+ parameterName,
108
+ baseParameterName,
109
+ isUsed
110
+ };
111
+ baseParametersSequencerEntry.parametersSequencerOrNull[parameterName] = parametersSequencerEntry;
112
+ }
113
+ else {
114
+ parametersSequencerEntry = baseParametersSequencerEntry.parametersSequencerOrNull[parameterName];
115
+ }
116
+ }
117
+ else {
118
+ // If name is the same, which means that parameter descriptor modified type information only.
119
+ parametersSequencerEntry = baseParametersSequencerEntry;
120
+ }
121
+ }
122
+ return parametersSequencerEntry;
123
+ }
124
+ /**
125
+ * @inheritDoc
126
+ */
127
+ createProxyFunction(classDescriptor, methodDescriptor) {
128
+ // Hidden functions aren't localized.
129
+ if (!(methodDescriptor.isHidden ?? false)) {
130
+ // Add any parameters that are not already known.
131
+ for (const parameterDescriptor of methodDescriptor.parameterDescriptors) {
132
+ this.#saveParameterSequence(parameterDescriptor, true);
133
+ }
134
+ let functionsLocaleResources = this.#functionsLocaleResources;
135
+ const namespace = classDescriptor.namespace;
136
+ if (namespace !== undefined) {
137
+ if (!(namespace in functionsLocaleResources)) {
138
+ const namespaceFunctionsLocaleResources = {};
139
+ // Add namespace and navigate to it.
140
+ functionsLocaleResources[namespace] = namespaceFunctionsLocaleResources;
141
+ functionsLocaleResources = namespaceFunctionsLocaleResources;
142
+ }
143
+ else {
144
+ // Navigate to namespace.
145
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Entry is never a string.
146
+ functionsLocaleResources = functionsLocaleResources[namespace];
147
+ }
148
+ }
149
+ const functionName = methodDescriptor.functionName;
150
+ if (functionName in functionsLocaleResources) {
151
+ throw new Error(`Duplicate function ${functionName}`);
152
+ }
153
+ // Add function.
154
+ functionsLocaleResources[functionName] = {
155
+ name: functionName,
156
+ description: "*** LOCALIZATION REQUIRED ***"
157
+ };
158
+ }
159
+ }
160
+ /**
161
+ * Merge source locale resources into existing destination locale resources.
162
+ *
163
+ * @param logChanges
164
+ * If true, changes are logged. Limits output when processing multiple sources.
165
+ *
166
+ * @param parentKey
167
+ * Parent key for logging purposes.
168
+ *
169
+ * @param sourceLocaleResources
170
+ * Source locale resources.
171
+ *
172
+ * @param destinationLocaleResources
173
+ * Destination locale resources.
174
+ *
175
+ * @param addMissing
176
+ * Add missing if true; applies to locale resources that are not regional.
177
+ *
178
+ * @returns
179
+ * Merged locale resources.
180
+ */
181
+ #merge(logChanges, parentKey, sourceLocaleResources, destinationLocaleResources, addMissing) {
182
+ // Some entries at the top are not part of the generator output.
183
+ const deleteMissing = parentKey.length !== 0;
184
+ const newDestinationLocaleResources = {};
185
+ // Copy over or delete any destination keys that are not in source.
186
+ for (const [key, destinationValue] of Object.entries(destinationLocaleResources)) {
187
+ if (!(key in sourceLocaleResources)) {
188
+ if (!deleteMissing) {
189
+ newDestinationLocaleResources[key] = destinationValue;
190
+ }
191
+ else if (logChanges) {
192
+ this.logger.info(`Deleting ${parentKey}${key}...`);
193
+ }
194
+ }
195
+ }
196
+ for (const [key, sourceValue] of Object.entries(sourceLocaleResources)) {
197
+ if (!(key in destinationLocaleResources)) {
198
+ if (addMissing) {
199
+ if (logChanges) {
200
+ this.logger.info(`Adding ${parentKey}${key}...`);
201
+ }
202
+ newDestinationLocaleResources[key] = sourceValue;
203
+ }
204
+ }
205
+ else {
206
+ const destinationValue = destinationLocaleResources[key];
207
+ if (typeof sourceValue === "object" && typeof destinationValue === "object") {
208
+ newDestinationLocaleResources[key] = this.#merge(logChanges, `${parentKey}${key}.`, sourceValue, destinationValue, addMissing);
209
+ }
210
+ else if (typeof sourceValue === "string" && typeof destinationValue === "string") {
211
+ newDestinationLocaleResources[key] = destinationValue;
212
+ }
213
+ else {
214
+ throw new Error(`Mismatched types at ${parentKey}${key}`);
215
+ }
216
+ }
217
+ }
218
+ return newDestinationLocaleResources;
219
+ }
220
+ /**
221
+ * Build parameters locale resources by going through parameters sequencer.
222
+ *
223
+ * @param parametersSequencer
224
+ * Parameters sequencer.
225
+ */
226
+ #buildParametersLocaleResources(parametersSequencer) {
227
+ const entries = Object.entries(parametersSequencer);
228
+ // Sort the entries as defined by the descriptors.
229
+ entries.sort((entry1, entry2) => {
230
+ let result;
231
+ const parameterDescriptor1 = entry1[1].parameterDescriptor;
232
+ const parameterDescriptor2 = entry2[1].parameterDescriptor;
233
+ if ("sortOrder" in parameterDescriptor1) {
234
+ if ("sortOrder" in parameterDescriptor2) {
235
+ result = parameterDescriptor1.sortOrder - parameterDescriptor2.sortOrder;
236
+ }
237
+ else {
238
+ // Parameter descriptors with undefined sort order to go the end.
239
+ result = -parameterDescriptor1.sortOrder;
240
+ }
241
+ }
242
+ else {
243
+ // eslint-disable-next-line no-lonely-if -- Matches structure in "then" clause.
244
+ if ("sortOrder" in parameterDescriptor2) {
245
+ // Parameter descriptors with undefined sort order to go the end.
246
+ result = parameterDescriptor2.sortOrder;
247
+ }
248
+ else {
249
+ result = 0;
250
+ }
251
+ }
252
+ return result;
253
+ });
254
+ for (const [parameterName, parametersSequencerEntry] of entries) {
255
+ if (parametersSequencerEntry.isUsed) {
256
+ this.#parametersLocaleResources[parameterName] = {
257
+ name: parameterName,
258
+ description: "*** LOCALIZATION REQUIRED ***"
259
+ };
260
+ }
261
+ if (parametersSequencerEntry.parametersSequencerOrNull !== null) {
262
+ this.#buildParametersLocaleResources(parametersSequencerEntry.parametersSequencerOrNull);
263
+ }
264
+ }
265
+ }
266
+ /**
267
+ * Build output to be written back to source file.
268
+ *
269
+ * @param prefix
270
+ * Line prefix.
271
+ *
272
+ * @param value
273
+ * Line value.
274
+ *
275
+ * @param indentLevel
276
+ * Indent level.
277
+ *
278
+ * @returns
279
+ * Output string.
280
+ */
281
+ static #buildOutput(prefix, value, indentLevel) {
282
+ return `${" ".repeat(indentLevel)}${prefix} ${typeof value === "object" ?
283
+ `{\n${Object.entries(value).map(entry => LocaleResourcesGenerator.#buildOutput(`${entry[0]}:`, entry[1], indentLevel + 1)).join(",\n")}\n${" ".repeat(indentLevel)}}` :
284
+ // JSON.stringify() will apply quotes as appropriate.
285
+ JSON.stringify(value)}`;
286
+ }
287
+ /**
288
+ * @inheritDoc
289
+ */
290
+ async finalize(success) {
291
+ if (success) {
292
+ this.#buildParametersLocaleResources(this.#parametersSequencer);
293
+ await Promise.all(fs.readdirSync(LocaleResourcesGenerator.#IMPORT_PATH, {
294
+ withFileTypes: true
295
+ }).filter(entry => entry.isDirectory()).map(async (entry) => {
296
+ const localeResourcesSource = path.resolve(LocaleResourcesGenerator.#IMPORT_PATH, entry.name, "locale-resources.ts");
297
+ return import(localeResourcesSource).then((module) => {
298
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Module format is known.
299
+ const localeResources = this.#merge(entry.name === "en", "", this.#LocaleResources, module.default, !entry.name.includes("-"));
300
+ fs.writeFileSync(localeResourcesSource, `${LocaleResourcesGenerator.#buildOutput("export default", localeResources, 0)};\n`);
301
+ });
302
+ }));
303
+ }
304
+ }
305
+ }
306
+ const generator = new LocaleResourcesGenerator();
307
+ generator.generate().catch((e) => {
308
+ generator.logger.error(e);
309
+ process.exit(1);
310
+ });
311
+ //# sourceMappingURL=locale-resources-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-resources-generator.js","sourceRoot":"","sources":["../../src/generator/locale-resources-generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAOlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+C3C;;GAEG;AACH,MAAM,wBAAyB,SAAQ,SAAS;IAC5C;;OAEG;IACH,MAAM,CAAU,YAAY,GAAG,6BAA6B,CAAC;IAE7D;;OAEG;IACM,oBAAoB,GAAwB,EAAE,CAAC;IAExD;;OAEG;IACM,0BAA0B,GAAoB,EAAE,CAAC;IAE1D;;OAEG;IACM,yBAAyB,GAAoB,EAAE,CAAC;IAEzD;;OAEG;IACM,gBAAgB,GAAoB;QACzC,UAAU,EAAE,IAAI,CAAC,0BAA0B;QAC3C,SAAS,EAAE,IAAI,CAAC,yBAAyB;KAC5C,CAAC;IAEF;;OAEG;IACH;QACI,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED;;OAEG;IACgB,UAAU;IAC7B,CAAC;IAED;;OAEG;IACgB,eAAe;IAClC,CAAC;IAED;;OAEG;I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AC,gBAAgB,EAAE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;gBACjI,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;;AAGL,MAAM,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;AAEjD,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;IACtC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { AppExtension } from "../app-extension.js";
2
+ import type { ErrorExtends } from "../type.js";
3
+ import { CharacterSetCreatorProxy, CharacterSetValidatorProxy } from "../utility/index.js";
4
+ export declare class AI82Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
5
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>);
6
+ }
7
+ export declare class AI39Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetCreatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
8
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>);
9
+ }
10
+ export declare class AI64Proxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends CharacterSetValidatorProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
11
+ constructor(appExtension: AppExtension<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt>);
12
+ }
13
+ //# sourceMappingURL=character-set-proxy.d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