@aidc-toolkit/app-extension 1.0.49-beta → 1.0.49

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 (178) hide show
  1. package/dist/character-set-proxy-BOW94WCe.d.cts +473 -0
  2. package/dist/character-set-proxy-BOW94WCe.d.ts +473 -0
  3. package/dist/chunk-22IRLVWO.js +1 -0
  4. package/dist/chunk-MR63TJ3B.js +1 -0
  5. package/dist/chunk-TWX7TPRC.js +1 -0
  6. package/dist/{descriptor.d.ts → descriptor-D6tZH-vc.d.cts} +13 -13
  7. package/dist/descriptor-D6tZH-vc.d.ts +185 -0
  8. package/dist/generator/index.cjs +17 -0
  9. package/dist/generator/index.d.cts +240 -0
  10. package/dist/generator/index.d.ts +239 -18
  11. package/dist/generator/index.js +1 -3
  12. package/dist/gs1/index.cjs +1 -0
  13. package/dist/gs1/index.d.cts +185 -0
  14. package/dist/gs1/index.d.ts +185 -11
  15. package/dist/gs1/index.js +1 -11
  16. package/dist/index.cjs +17 -0
  17. package/dist/{locale/en/locale-resources.d.ts → index.d.cts} +113 -2
  18. package/dist/index.d.ts +862 -21
  19. package/dist/index.js +1 -7
  20. package/package.json +5 -5
  21. package/src/version.ts +1 -1
  22. package/tsconfig-src.tsbuildinfo +1 -1
  23. package/dist/app-extension.d.ts +0 -210
  24. package/dist/app-extension.d.ts.map +0 -1
  25. package/dist/app-extension.js +0 -156
  26. package/dist/app-extension.js.map +0 -1
  27. package/dist/app-helper-proxy.d.ts +0 -71
  28. package/dist/app-helper-proxy.d.ts.map +0 -1
  29. package/dist/app-helper-proxy.js +0 -368
  30. package/dist/app-helper-proxy.js.map +0 -1
  31. package/dist/descriptor.d.ts.map +0 -1
  32. package/dist/descriptor.js +0 -44
  33. package/dist/descriptor.js.map +0 -1
  34. package/dist/generator/functions-generator.d.ts +0 -119
  35. package/dist/generator/functions-generator.d.ts.map +0 -1
  36. package/dist/generator/functions-generator.js +0 -206
  37. package/dist/generator/functions-generator.js.map +0 -1
  38. package/dist/generator/generator.d.ts +0 -121
  39. package/dist/generator/generator.d.ts.map +0 -1
  40. package/dist/generator/generator.js +0 -183
  41. package/dist/generator/generator.js.map +0 -1
  42. package/dist/generator/index.d.ts.map +0 -1
  43. package/dist/generator/index.js.map +0 -1
  44. package/dist/generator/locale-resources-generator.d.ts +0 -2
  45. package/dist/generator/locale-resources-generator.d.ts.map +0 -1
  46. package/dist/generator/locale-resources-generator.js +0 -313
  47. package/dist/generator/locale-resources-generator.js.map +0 -1
  48. package/dist/gs1/character-set-proxy.d.ts +0 -13
  49. package/dist/gs1/character-set-proxy.d.ts.map +0 -1
  50. package/dist/gs1/character-set-proxy.js +0 -126
  51. package/dist/gs1/character-set-proxy.js.map +0 -1
  52. package/dist/gs1/check-proxy.d.ts +0 -11
  53. package/dist/gs1/check-proxy.d.ts.map +0 -1
  54. package/dist/gs1/check-proxy.js +0 -163
  55. package/dist/gs1/check-proxy.js.map +0 -1
  56. package/dist/gs1/gcp-length-proxy.d.ts +0 -11
  57. package/dist/gs1/gcp-length-proxy.d.ts.map +0 -1
  58. package/dist/gs1/gcp-length-proxy.js +0 -187
  59. package/dist/gs1/gcp-length-proxy.js.map +0 -1
  60. package/dist/gs1/gtin-creator-proxy.d.ts +0 -10
  61. package/dist/gs1/gtin-creator-proxy.d.ts.map +0 -1
  62. package/dist/gs1/gtin-creator-proxy.js +0 -85
  63. package/dist/gs1/gtin-creator-proxy.js.map +0 -1
  64. package/dist/gs1/gtin-descriptor.d.ts +0 -3
  65. package/dist/gs1/gtin-descriptor.d.ts.map +0 -1
  66. package/dist/gs1/gtin-descriptor.js +0 -8
  67. package/dist/gs1/gtin-descriptor.js.map +0 -1
  68. package/dist/gs1/gtin-validator-proxy.d.ts +0 -26
  69. package/dist/gs1/gtin-validator-proxy.d.ts.map +0 -1
  70. package/dist/gs1/gtin-validator-proxy.js +0 -256
  71. package/dist/gs1/gtin-validator-proxy.js.map +0 -1
  72. package/dist/gs1/identifier-creator-proxy.d.ts +0 -30
  73. package/dist/gs1/identifier-creator-proxy.d.ts.map +0 -1
  74. package/dist/gs1/identifier-creator-proxy.js +0 -318
  75. package/dist/gs1/identifier-creator-proxy.js.map +0 -1
  76. package/dist/gs1/identifier-descriptor.d.ts +0 -4
  77. package/dist/gs1/identifier-descriptor.d.ts.map +0 -1
  78. package/dist/gs1/identifier-descriptor.js +0 -14
  79. package/dist/gs1/identifier-descriptor.js.map +0 -1
  80. package/dist/gs1/identifier-type.d.ts +0 -22
  81. package/dist/gs1/identifier-type.d.ts.map +0 -1
  82. package/dist/gs1/identifier-type.js +0 -34
  83. package/dist/gs1/identifier-type.js.map +0 -1
  84. package/dist/gs1/identifier-validator-proxy.d.ts +0 -29
  85. package/dist/gs1/identifier-validator-proxy.d.ts.map +0 -1
  86. package/dist/gs1/identifier-validator-proxy.js +0 -212
  87. package/dist/gs1/identifier-validator-proxy.js.map +0 -1
  88. package/dist/gs1/index.d.ts.map +0 -1
  89. package/dist/gs1/index.js.map +0 -1
  90. package/dist/gs1/non-gtin-creator-proxy.d.ts +0 -38
  91. package/dist/gs1/non-gtin-creator-proxy.d.ts.map +0 -1
  92. package/dist/gs1/non-gtin-creator-proxy.js +0 -301
  93. package/dist/gs1/non-gtin-creator-proxy.js.map +0 -1
  94. package/dist/gs1/non-gtin-validator-proxy.d.ts +0 -37
  95. package/dist/gs1/non-gtin-validator-proxy.d.ts.map +0 -1
  96. package/dist/gs1/non-gtin-validator-proxy.js +0 -302
  97. package/dist/gs1/non-gtin-validator-proxy.js.map +0 -1
  98. package/dist/gs1/prefix-definition-descriptor.d.ts +0 -4
  99. package/dist/gs1/prefix-definition-descriptor.d.ts.map +0 -1
  100. package/dist/gs1/prefix-definition-descriptor.js +0 -16
  101. package/dist/gs1/prefix-definition-descriptor.js.map +0 -1
  102. package/dist/gs1/prefix-manager-proxy.d.ts +0 -8
  103. package/dist/gs1/prefix-manager-proxy.d.ts.map +0 -1
  104. package/dist/gs1/prefix-manager-proxy.js +0 -94
  105. package/dist/gs1/prefix-manager-proxy.js.map +0 -1
  106. package/dist/gs1/variable-measure-proxy.d.ts +0 -7
  107. package/dist/gs1/variable-measure-proxy.d.ts.map +0 -1
  108. package/dist/gs1/variable-measure-proxy.js +0 -114
  109. package/dist/gs1/variable-measure-proxy.js.map +0 -1
  110. package/dist/gs1/verified-by-gs1-proxy.d.ts +0 -7
  111. package/dist/gs1/verified-by-gs1-proxy.d.ts.map +0 -1
  112. package/dist/gs1/verified-by-gs1-proxy.js +0 -106
  113. package/dist/gs1/verified-by-gs1-proxy.js.map +0 -1
  114. package/dist/index.d.ts.map +0 -1
  115. package/dist/index.js.map +0 -1
  116. package/dist/lib-proxy.d.ts +0 -135
  117. package/dist/lib-proxy.d.ts.map +0 -1
  118. package/dist/lib-proxy.js +0 -276
  119. package/dist/lib-proxy.js.map +0 -1
  120. package/dist/locale/en/locale-resources.d.ts.map +0 -1
  121. package/dist/locale/en/locale-resources.js +0 -754
  122. package/dist/locale/en/locale-resources.js.map +0 -1
  123. package/dist/locale/fr/locale-resources.d.ts +0 -755
  124. package/dist/locale/fr/locale-resources.d.ts.map +0 -1
  125. package/dist/locale/fr/locale-resources.js +0 -754
  126. package/dist/locale/fr/locale-resources.js.map +0 -1
  127. package/dist/locale/i18n.d.ts +0 -27
  128. package/dist/locale/i18n.d.ts.map +0 -1
  129. package/dist/locale/i18n.js +0 -36
  130. package/dist/locale/i18n.js.map +0 -1
  131. package/dist/proxy.d.ts +0 -136
  132. package/dist/proxy.d.ts.map +0 -1
  133. package/dist/proxy.js +0 -291
  134. package/dist/proxy.js.map +0 -1
  135. package/dist/streaming.d.ts +0 -10
  136. package/dist/streaming.d.ts.map +0 -1
  137. package/dist/streaming.js +0 -2
  138. package/dist/streaming.js.map +0 -1
  139. package/dist/type.d.ts +0 -91
  140. package/dist/type.d.ts.map +0 -1
  141. package/dist/type.js +0 -2
  142. package/dist/type.js.map +0 -1
  143. package/dist/utility/character-set-descriptor.d.ts +0 -6
  144. package/dist/utility/character-set-descriptor.d.ts.map +0 -1
  145. package/dist/utility/character-set-descriptor.js +0 -28
  146. package/dist/utility/character-set-descriptor.js.map +0 -1
  147. package/dist/utility/character-set-proxy.d.ts +0 -31
  148. package/dist/utility/character-set-proxy.d.ts.map +0 -1
  149. package/dist/utility/character-set-proxy.js +0 -278
  150. package/dist/utility/character-set-proxy.js.map +0 -1
  151. package/dist/utility/index.d.ts +0 -4
  152. package/dist/utility/index.d.ts.map +0 -1
  153. package/dist/utility/index.js +0 -4
  154. package/dist/utility/index.js.map +0 -1
  155. package/dist/utility/reg-exp-proxy.d.ts +0 -8
  156. package/dist/utility/reg-exp-proxy.d.ts.map +0 -1
  157. package/dist/utility/reg-exp-proxy.js +0 -103
  158. package/dist/utility/reg-exp-proxy.js.map +0 -1
  159. package/dist/utility/string-descriptor.d.ts +0 -4
  160. package/dist/utility/string-descriptor.d.ts.map +0 -1
  161. package/dist/utility/string-descriptor.js +0 -12
  162. package/dist/utility/string-descriptor.js.map +0 -1
  163. package/dist/utility/string-proxy.d.ts +0 -7
  164. package/dist/utility/string-proxy.d.ts.map +0 -1
  165. package/dist/utility/string-proxy.js +0 -63
  166. package/dist/utility/string-proxy.js.map +0 -1
  167. package/dist/utility/transformer-descriptor.d.ts +0 -6
  168. package/dist/utility/transformer-descriptor.d.ts.map +0 -1
  169. package/dist/utility/transformer-descriptor.js +0 -24
  170. package/dist/utility/transformer-descriptor.js.map +0 -1
  171. package/dist/utility/transformer-proxy.d.ts +0 -9
  172. package/dist/utility/transformer-proxy.d.ts.map +0 -1
  173. package/dist/utility/transformer-proxy.js +0 -111
  174. package/dist/utility/transformer-proxy.js.map +0 -1
  175. package/dist/version.d.ts +0 -5
  176. package/dist/version.d.ts.map +0 -1
  177. package/dist/version.js +0 -5
  178. package/dist/version.js.map +0 -1
@@ -1,119 +0,0 @@
1
- import { type ClassDescriptor, type MethodDescriptor, type ParameterDescriptor } from "../descriptor.js";
2
- import { type FunctionLocalization, Generator, type Localization } from "./generator.js";
3
- /**
4
- * Class type alias.
5
- */
6
- export interface ClassTypeAlias {
7
- /**
8
- * Name.
9
- */
10
- readonly name: string;
11
- /**
12
- * Getter function.
13
- */
14
- readonly getter: string;
15
- /**
16
- * Declaration associating name with implementation type and creating getter function.
17
- */
18
- readonly declaration: string[];
19
- }
20
- /**
21
- * Function implementation.
22
- */
23
- export interface FunctionImplementation {
24
- /**
25
- * Function name.
26
- */
27
- readonly functionName: string;
28
- /**
29
- * Parameter localizations with JavaScript type and parameter descriptor.
30
- */
31
- readonly parameterLocalizations: ReadonlyArray<Localization & {
32
- /**
33
- * JavaScript type.
34
- */
35
- javaScriptType: string;
36
- /**
37
- * Parameter descriptor.
38
- */
39
- parameterDescriptor?: ParameterDescriptor;
40
- }>;
41
- /**
42
- * Declaration.
43
- */
44
- readonly declaration: string[];
45
- }
46
- /**
47
- * Generator with helpers for writing TypeScript functions file.
48
- */
49
- export declare abstract class FunctionsGenerator extends Generator {
50
- #private;
51
- protected static readonly BASE_IMPORTS: string[];
52
- /**
53
- * Constructor.
54
- *
55
- * @param version
56
- * Package version.
57
- *
58
- * @param inline
59
- * If true, functions are declared inline rather than using `function`.
60
- *
61
- * @param throwError
62
- * If true, errors are reported through the throw/catch mechanism.
63
- *
64
- * @param errorTypeName
65
- * Error type name.
66
- *
67
- * @param supportsContext
68
- * If true, application extension supports context.
69
- *
70
- * Big integer type name.
71
- * @param invocationContextTypeName
72
- * Invocation context type name.
73
- *
74
- * @param streamingInvocationContextTypeName
75
- * Streaming invocation context type name.
76
- *
77
- * @param bigIntTypeName
78
- * Big integer type name.
79
- */
80
- constructor(version: string, inline: boolean, throwError: boolean, errorTypeName: string, supportsContext: boolean, invocationContextTypeName: string, streamingInvocationContextTypeName: string, bigIntTypeName: string);
81
- /**
82
- * Get the class type alias.
83
- */
84
- get classTypeAlias(): ClassTypeAlias;
85
- /**
86
- * Get the import statement for a namespace.
87
- *
88
- * @param namespace
89
- * Namespace.
90
- *
91
- * @returns
92
- * Import statement.
93
- */
94
- protected getNamespaceImport(namespace: string): string;
95
- /**
96
- * @inheritDoc
97
- */
98
- protected createClassProxy(classDescriptor: ClassDescriptor): void;
99
- /**
100
- * Get a function implementation.
101
- *
102
- * @param methodDescriptor
103
- * Method descriptor.
104
- *
105
- * @param functionNamePrefix
106
- * Function name prefix.
107
- *
108
- * @param functionLocalization
109
- * Function localization. May be undefined for hidden functions, in which case generated
110
- *
111
- * @param parameterCallback
112
- * Callback to modify parameter in implementation function call.
113
- *
114
- * @returns
115
- * Function implementation.
116
- */
117
- protected getFunctionImplementation(methodDescriptor: MethodDescriptor, functionNamePrefix: string, functionLocalization: FunctionLocalization | undefined, parameterCallback?: (name: string, parameterDescriptor: ParameterDescriptor) => string): FunctionImplementation;
118
- }
119
- //# sourceMappingURL=functions-generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions-generator.d.ts","sourceRoot":"","sources":["../../src/generator/functions-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAG3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,oBAAoB,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,aAAa,CAAC,YAAY,GAAG;QAC1D;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC;QAEvB;;WAEG;QACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;KAC7C,CAAC,CAAC;IAEH;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,8BAAsB,kBAAmB,SAAQ,SAAS;;IAWtD,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,WAGpC;IAgCF;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;gBACS,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,kCAAkC,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAYzN;;OAEG;IACH,IAAI,cAAc,IAAI,cAAc,CAEnC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIvD;;OAEG;cACgB,gBAAgB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IA6B3E;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,yBAAyB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,EAAE,oBAAoB,EAAE,oBAAoB,GAAG,SAAS,EAAE,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,KAAK,MAAM,GAAG,sBAAsB;CAyE9Q"}
@@ -1,206 +0,0 @@
1
- import { Types } from "../descriptor.js";
2
- import { Generator } from "./generator.js";
3
- /**
4
- * Generator with helpers for writing TypeScript functions file.
5
- */
6
- export class FunctionsGenerator extends Generator {
7
- /**
8
- * Mapping of descriptor types to JavaScript types.
9
- */
10
- static #DESCRIPTOR_TYPE_STRINGS = {
11
- [Types.String]: "string",
12
- [Types.Number]: "number",
13
- [Types.Boolean]: "boolean",
14
- [Types.Any]: "any"
15
- };
16
- static BASE_IMPORTS = [
17
- "import * as AppExtension from \"@aidc-toolkit/app-extension\";",
18
- "import { appExtension } from \"./app-extension.js\";"
19
- ];
20
- /**
21
- * If true, functions are declared inline rather than using `function`.
22
- */
23
- #inline;
24
- /**
25
- * If true, application extension supports context.
26
- */
27
- #supportsContext;
28
- /**
29
- * Invocation context type name.
30
- */
31
- #invocationContextTypeName;
32
- /**
33
- * Streaming invocation context type name.
34
- */
35
- #streamingInvocationContextTypeName;
36
- /**
37
- * Template declaration for type alias.
38
- */
39
- #templateDeclaration;
40
- /**
41
- * Current class type alias.
42
- */
43
- #classTypeAlias;
44
- /**
45
- * Constructor.
46
- *
47
- * @param version
48
- * Package version.
49
- *
50
- * @param inline
51
- * If true, functions are declared inline rather than using `function`.
52
- *
53
- * @param throwError
54
- * If true, errors are reported through the throw/catch mechanism.
55
- *
56
- * @param errorTypeName
57
- * Error type name.
58
- *
59
- * @param supportsContext
60
- * If true, application extension supports context.
61
- *
62
- * Big integer type name.
63
- * @param invocationContextTypeName
64
- * Invocation context type name.
65
- *
66
- * @param streamingInvocationContextTypeName
67
- * Streaming invocation context type name.
68
- *
69
- * @param bigIntTypeName
70
- * Big integer type name.
71
- */
72
- constructor(version, inline, throwError, errorTypeName, supportsContext, invocationContextTypeName, streamingInvocationContextTypeName, bigIntTypeName) {
73
- super(version, true);
74
- this.#inline = inline;
75
- this.#supportsContext = supportsContext;
76
- this.#invocationContextTypeName = invocationContextTypeName;
77
- this.#streamingInvocationContextTypeName = streamingInvocationContextTypeName;
78
- this.#templateDeclaration = `<${throwError}, ${errorTypeName}, ${invocationContextTypeName}, ${streamingInvocationContextTypeName}, ${bigIntTypeName}>`;
79
- }
80
- /**
81
- * Get the class type alias.
82
- */
83
- get classTypeAlias() {
84
- return this.#classTypeAlias;
85
- }
86
- /**
87
- * Get the import statement for a namespace.
88
- *
89
- * @param namespace
90
- * Namespace.
91
- *
92
- * @returns
93
- * Import statement.
94
- */
95
- getNamespaceImport(namespace) {
96
- return `import * as AppExtension${namespace} from "@aidc-toolkit/app-extension/${namespace.toLowerCase()}";`;
97
- }
98
- /**
99
- * @inheritDoc
100
- */
101
- createClassProxy(classDescriptor) {
102
- const classDescriptorNamespace = classDescriptor.namespace ?? "";
103
- const name = `${classDescriptorNamespace}${classDescriptor.name}`;
104
- const getter = `get${name}()`;
105
- const implementation = `AppExtension${classDescriptorNamespace}.${classDescriptor.name}${this.#templateDeclaration}`;
106
- this.#classTypeAlias = {
107
- name,
108
- getter,
109
- declaration: [
110
- "",
111
- "/**",
112
- " * Class type alias name.",
113
- " */",
114
- `type ${name} = ${implementation};`,
115
- "",
116
- "/**",
117
- " * Getter function to get an instance of the class.",
118
- " *",
119
- " * @returns",
120
- " * Class instance.",
121
- " */",
122
- `function ${getter}: ${name} {`,
123
- ` return appExtension.getProxy(${implementation});`,
124
- "}"
125
- ]
126
- };
127
- }
128
- /**
129
- * Get a function implementation.
130
- *
131
- * @param methodDescriptor
132
- * Method descriptor.
133
- *
134
- * @param functionNamePrefix
135
- * Function name prefix.
136
- *
137
- * @param functionLocalization
138
- * Function localization. May be undefined for hidden functions, in which case generated
139
- *
140
- * @param parameterCallback
141
- * Callback to modify parameter in implementation function call.
142
- *
143
- * @returns
144
- * Function implementation.
145
- */
146
- getFunctionImplementation(methodDescriptor, functionNamePrefix, functionLocalization, parameterCallback) {
147
- const methodType = `${this.classTypeAlias.name}["${methodDescriptor.name}"]`;
148
- const parameterDescriptors = methodDescriptor.parameterDescriptors;
149
- const parameterLocalizations = parameterDescriptors.map((parameterDescriptor) => {
150
- const parameterLocalization = functionLocalization?.parametersMap.get(parameterDescriptor.name) ?? {
151
- name: parameterDescriptor.name,
152
- description: "*** NO LOCALIZATION ***"
153
- };
154
- return {
155
- ...parameterLocalization,
156
- javaScriptType: FunctionsGenerator.#DESCRIPTOR_TYPE_STRINGS[parameterDescriptor.type],
157
- parameterDescriptor
158
- };
159
- });
160
- const dummyParameters = [];
161
- if (this.#supportsContext) {
162
- if (methodDescriptor.requiresContext === true) {
163
- parameterLocalizations.push({
164
- name: "invocationContext",
165
- description: "Invocation context.",
166
- javaScriptType: this.#invocationContextTypeName
167
- });
168
- }
169
- if (methodDescriptor.isStream === true) {
170
- parameterLocalizations.push({
171
- name: "streamingInvocationContext",
172
- description: "Streaming invocation context.",
173
- javaScriptType: this.#streamingInvocationContextTypeName
174
- });
175
- }
176
- }
177
- else {
178
- if (methodDescriptor.requiresContext === true) {
179
- // Invocation context type name represents a literal dummy value.
180
- dummyParameters.push(this.#invocationContextTypeName);
181
- }
182
- if (methodDescriptor.isStream === true) {
183
- // Streaming invocation context type name represents a literal dummy value.
184
- dummyParameters.push(this.#streamingInvocationContextTypeName);
185
- }
186
- }
187
- const asyncQualifier = methodDescriptor.isAsync === true ? "async " : "";
188
- const functionName = functionNamePrefix === "" ?
189
- functionLocalization?.name ?? methodDescriptor.name :
190
- `${functionNamePrefix}${functionLocalization?.titleCaseName ?? methodDescriptor.name.replace(/^[a-z]/u, c => c.toUpperCase())}`;
191
- return {
192
- functionName,
193
- parameterLocalizations,
194
- declaration: [
195
- `${!this.#inline ?
196
- `export ${asyncQualifier}function ${functionName}` :
197
- asyncQualifier}(${parameterLocalizations.map((parameterLocalization, index) => `${parameterLocalization.name}: Parameters<${methodType}>[${index}]`).join(", ")}): ReturnType<${methodType}> ${!this.#inline ? "{" : "=>"}`,
198
- ` ${!this.#inline ? "return " : ""}${(this.classTypeAlias.getter)}.${methodDescriptor.name}(${[...parameterLocalizations.map(parameterLocalization => parameterCallback === undefined || parameterLocalization.parameterDescriptor === undefined ?
199
- parameterLocalization.name :
200
- parameterCallback(parameterLocalization.name, parameterLocalization.parameterDescriptor)), ...dummyParameters].join(", ")})${(!this.#inline ? ";" : "")}`,
201
- ...!this.#inline ? ["}"] : []
202
- ]
203
- };
204
- }
205
- }
206
- //# sourceMappingURL=functions-generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions-generator.js","sourceRoot":"","sources":["../../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Ae,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBACjE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;aAChC;SACJ,CAAC;IACN,CAAC"}
@@ -1,121 +0,0 @@
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
- * Name in title case.
23
- */
24
- readonly titleCaseName: 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 for a class.
91
- *
92
- * @param classDescriptor
93
- * Class descriptor.
94
- */
95
- protected abstract createClassProxy(classDescriptor: ClassDescriptor): void;
96
- /**
97
- * Create a proxy for a method.
98
- *
99
- * @param classDescriptor
100
- * Class descriptor.
101
- *
102
- * @param methodDescriptor
103
- * Method descriptor.
104
- *
105
- * @param functionLocalizationsMap
106
- * Function localizations map.
107
- */
108
- protected abstract createMethodProxy(classDescriptor: ClassDescriptor, methodDescriptor: MethodDescriptor, functionLocalizationsMap: ReadonlyMap<string, FunctionLocalization>): void;
109
- /**
110
- * Finalize the generation of the output.
111
- *
112
- * @param success
113
- * True if successful.
114
- */
115
- protected abstract finalize(success: boolean): Promisable<void>;
116
- /**
117
- * Generate by processing individual imports.
118
- */
119
- generate(): Promise<void>;
120
- }
121
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,UAAU,EAAc,MAAM,oBAAoB,CAAC;AAE9G,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,aAAa,EAAE,MAAM,CAAC;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AAC,IAAI,CAAC;IAqC/D;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAkGlC"}
@@ -1,183 +0,0 @@
1
- import { ALPHA_URL, getLogger, I18nLanguageDetectors, 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 -- Assume localized key exists.
102
- const parseKey = key;
103
- if (!i18nextAppExtension.exists(parseKey, lngReturnObjectsOption)) {
104
- throw new Error(`Missing localization for ${key} in ${locale}`);
105
- }
106
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists and return type is Localization & Partial<TLocalization>.
107
- return localizationCallback(locale, i18nextAppExtension.t(key, lngReturnObjectsOption));
108
- }
109
- /**
110
- * Generate by processing individual imports.
111
- */
112
- async generate() {
113
- let success = false;
114
- await i18nAppExtensionInit(I18nLanguageDetectors.CLI);
115
- const documentationBaseURL = websiteURL(this.version, true, await ALPHA_URL);
116
- await this.initialize();
117
- const namespaceHierarchy = new Map();
118
- // Organize class descriptors by namespace and category.
119
- for (const classDescriptor of proxy.classDescriptors) {
120
- const namespace = classDescriptor.namespace;
121
- const category = classDescriptor.category;
122
- let categoryHierarchy = namespaceHierarchy.get(namespace);
123
- if (categoryHierarchy === undefined) {
124
- categoryHierarchy = new Map();
125
- namespaceHierarchy.set(namespace, categoryHierarchy);
126
- }
127
- let classDescriptors = categoryHierarchy.get(category);
128
- if (classDescriptors === undefined) {
129
- classDescriptors = [];
130
- categoryHierarchy.set(category, classDescriptors);
131
- }
132
- classDescriptors.push(classDescriptor);
133
- }
134
- try {
135
- for (const [namespace, categoryHierarchy] of namespaceHierarchy) {
136
- const namespacePrefix = namespace === undefined ? "" : `${namespace}.`;
137
- const namespacePath = namespace === undefined ? "" : `${namespace}/`;
138
- this.createNamespace(namespace);
139
- for (const [category, classDescriptors] of categoryHierarchy) {
140
- const namespaceCategory = `${namespacePrefix}${category}`;
141
- const categoriesKey = `Categories.${category}`;
142
- const namespaceCategoriesKey = `Categories.${namespaceCategory}`;
143
- const categoryLocalizationsMap = new Map(this.locales.map((locale) => {
144
- const lngOption = {
145
- lng: locale
146
- };
147
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Localized key exists.
148
- return [locale, i18nextAppExtension.t((i18nextAppExtension.exists(namespaceCategoriesKey, lngOption) ? namespaceCategoriesKey : categoriesKey), lngOption)];
149
- }));
150
- this.createCategory(namespace, category, categoryLocalizationsMap);
151
- const namespaceClassNamesSet = new Set();
152
- for (const classDescriptor of classDescriptors) {
153
- const namespaceClassName = `${namespacePrefix}${classDescriptor.name}`;
154
- if (namespaceClassNamesSet.has(namespaceClassName)) {
155
- throw new Error(`Duplicate class ${namespaceClassName}`);
156
- }
157
- namespaceClassNamesSet.add(namespaceClassName);
158
- this.createClassProxy(classDescriptor);
159
- for (const methodDescriptor of classDescriptor.methodDescriptors) {
160
- const functionLocalizationsMap = new Map(methodDescriptor.isHidden !== true ?
161
- this.locales.map(locale => [locale, Generator.#generateLocalization(locale, `Functions.${namespacePrefix}${methodDescriptor.functionName}`, (locale, localization) => ({
162
- ...localization,
163
- titleCaseName: localization.titleCaseName ?? localization.name.replace(/^[a-z]/u, c => c.toUpperCase()),
164
- documentationURL: `${documentationBaseURL}/${locale === this.defaultLocale ? "" : `${locale}/`}${Generator.#DOCUMENTATION_PATH}${namespacePath}${localization.name}.html`,
165
- parametersMap: new Map(methodDescriptor.parameterDescriptors.map(parameterDescriptor =>
166
- // eslint-disable-next-line max-nested-callbacks -- Callback is empty.
167
- [parameterDescriptor.name, Generator.#generateLocalization(locale, `Parameters.${parameterDescriptor.name}`, (_locale, localization) => localization)]))
168
- }))]) :
169
- // Hidden methods are not localized.
170
- []);
171
- this.createMethodProxy(classDescriptor, methodDescriptor, functionLocalizationsMap);
172
- }
173
- }
174
- }
175
- }
176
- success = true;
177
- }
178
- finally {
179
- await this.finalize(success);
180
- }
181
- }
182
- }
183
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,qBAAqB,EAAmB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAG9G,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;;OAEG;IACM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE/B;;OAEG;IACM,QAAQ,CAAS;IAE1B;;OAEG;IACM,QAAQ,CAAoB;IAErC;;OAEG;IACM,cAAc,CAAS;IAEhC;;;;;;;;OAQG;IACH,YAAY,OAAe,EAAE,oBAAoB,GAAG,IAAI;QACpD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,CAAC,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,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AC/B,cAAc,0BAA0B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=locale-resources-generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale-resources-generator.d.ts","sourceRoot":"","sources":["../../src/generator/locale-resources-generator.ts"],"names":[],"mappings":""}