@aidc-toolkit/app-extension 1.0.49 → 1.0.50-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 (210) hide show
  1. package/dist/app-extension-options.d.ts +52 -0
  2. package/dist/app-extension-options.d.ts.map +1 -0
  3. package/dist/app-extension-options.js +2 -0
  4. package/dist/app-extension-options.js.map +1 -0
  5. package/dist/app-extension.d.ts +194 -0
  6. package/dist/app-extension.d.ts.map +1 -0
  7. package/dist/app-extension.js +141 -0
  8. package/dist/app-extension.js.map +1 -0
  9. package/dist/app-helper-proxy.d.ts +57 -0
  10. package/dist/app-helper-proxy.d.ts.map +1 -0
  11. package/dist/app-helper-proxy.js +369 -0
  12. package/dist/app-helper-proxy.js.map +1 -0
  13. package/dist/{descriptor-D6tZH-vc.d.cts → descriptor.d.ts} +13 -13
  14. package/dist/descriptor.d.ts.map +1 -0
  15. package/dist/descriptor.js +44 -0
  16. package/dist/descriptor.js.map +1 -0
  17. package/dist/generator/functions-generator.d.ts +103 -0
  18. package/dist/generator/functions-generator.d.ts.map +1 -0
  19. package/dist/generator/functions-generator.js +179 -0
  20. package/dist/generator/functions-generator.js.map +1 -0
  21. package/dist/generator/generator.d.ts +121 -0
  22. package/dist/generator/generator.d.ts.map +1 -0
  23. package/dist/generator/generator.js +186 -0
  24. package/dist/generator/generator.js.map +1 -0
  25. package/dist/generator/index.d.ts +18 -239
  26. package/dist/generator/index.d.ts.map +1 -0
  27. package/dist/generator/index.js +3 -1
  28. package/dist/generator/index.js.map +1 -0
  29. package/dist/generator/locale-resources-generator.d.ts +2 -0
  30. package/dist/generator/locale-resources-generator.d.ts.map +1 -0
  31. package/dist/generator/locale-resources-generator.js +333 -0
  32. package/dist/generator/locale-resources-generator.js.map +1 -0
  33. package/dist/gs1/character-set-proxy.d.ts +12 -0
  34. package/dist/gs1/character-set-proxy.d.ts.map +1 -0
  35. package/dist/gs1/character-set-proxy.js +126 -0
  36. package/dist/gs1/character-set-proxy.js.map +1 -0
  37. package/dist/gs1/check-proxy.d.ts +11 -0
  38. package/dist/gs1/check-proxy.d.ts.map +1 -0
  39. package/dist/gs1/check-proxy.js +163 -0
  40. package/dist/gs1/check-proxy.js.map +1 -0
  41. package/dist/gs1/gcp-length-proxy.d.ts +11 -0
  42. package/dist/gs1/gcp-length-proxy.d.ts.map +1 -0
  43. package/dist/gs1/gcp-length-proxy.js +187 -0
  44. package/dist/gs1/gcp-length-proxy.js.map +1 -0
  45. package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
  46. package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
  47. package/dist/gs1/gtin-creator-proxy.js +85 -0
  48. package/dist/gs1/gtin-creator-proxy.js.map +1 -0
  49. package/dist/gs1/gtin-descriptor.d.ts +3 -0
  50. package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
  51. package/dist/gs1/gtin-descriptor.js +8 -0
  52. package/dist/gs1/gtin-descriptor.js.map +1 -0
  53. package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
  54. package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
  55. package/dist/gs1/gtin-validator-proxy.js +256 -0
  56. package/dist/gs1/gtin-validator-proxy.js.map +1 -0
  57. package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
  58. package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
  59. package/dist/gs1/identifier-creator-proxy.js +318 -0
  60. package/dist/gs1/identifier-creator-proxy.js.map +1 -0
  61. package/dist/gs1/identifier-descriptor.d.ts +4 -0
  62. package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
  63. package/dist/gs1/identifier-descriptor.js +14 -0
  64. package/dist/gs1/identifier-descriptor.js.map +1 -0
  65. package/dist/gs1/identifier-type.d.ts +22 -0
  66. package/dist/gs1/identifier-type.d.ts.map +1 -0
  67. package/dist/gs1/identifier-type.js +34 -0
  68. package/dist/gs1/identifier-type.js.map +1 -0
  69. package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
  70. package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
  71. package/dist/gs1/identifier-validator-proxy.js +212 -0
  72. package/dist/gs1/identifier-validator-proxy.js.map +1 -0
  73. package/dist/gs1/index.d.ts +11 -185
  74. package/dist/gs1/index.d.ts.map +1 -0
  75. package/dist/gs1/index.js +11 -1
  76. package/dist/gs1/index.js.map +1 -0
  77. package/dist/gs1/non-gtin-creator-proxy.d.ts +37 -0
  78. package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
  79. package/dist/gs1/non-gtin-creator-proxy.js +301 -0
  80. package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
  81. package/dist/gs1/non-gtin-validator-proxy.d.ts +36 -0
  82. package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
  83. package/dist/gs1/non-gtin-validator-proxy.js +302 -0
  84. package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
  85. package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
  86. package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
  87. package/dist/gs1/prefix-definition-descriptor.js +16 -0
  88. package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
  89. package/dist/gs1/prefix-manager-proxy.d.ts +8 -0
  90. package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
  91. package/dist/gs1/prefix-manager-proxy.js +94 -0
  92. package/dist/gs1/prefix-manager-proxy.js.map +1 -0
  93. package/dist/gs1/variable-measure-proxy.d.ts +7 -0
  94. package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
  95. package/dist/gs1/variable-measure-proxy.js +114 -0
  96. package/dist/gs1/variable-measure-proxy.js.map +1 -0
  97. package/dist/gs1/verified-by-gs1-proxy.d.ts +7 -0
  98. package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -0
  99. package/dist/gs1/verified-by-gs1-proxy.js +100 -0
  100. package/dist/gs1/verified-by-gs1-proxy.js.map +1 -0
  101. package/dist/index.d.ts +22 -862
  102. package/dist/index.d.ts.map +1 -0
  103. package/dist/index.js +7 -1
  104. package/dist/index.js.map +1 -0
  105. package/dist/lib-proxy.d.ts +121 -0
  106. package/dist/lib-proxy.d.ts.map +1 -0
  107. package/dist/lib-proxy.js +259 -0
  108. package/dist/lib-proxy.js.map +1 -0
  109. package/dist/{index.d.cts → locale/en/locale-resources.d.ts} +2 -113
  110. package/dist/locale/en/locale-resources.d.ts.map +1 -0
  111. package/dist/locale/en/locale-resources.js +754 -0
  112. package/dist/locale/en/locale-resources.js.map +1 -0
  113. package/dist/locale/fr/locale-resources.d.ts +755 -0
  114. package/dist/locale/fr/locale-resources.d.ts.map +1 -0
  115. package/dist/locale/fr/locale-resources.js +754 -0
  116. package/dist/locale/fr/locale-resources.js.map +1 -0
  117. package/dist/locale/i18n.d.ts +27 -0
  118. package/dist/locale/i18n.d.ts.map +1 -0
  119. package/dist/locale/i18n.js +36 -0
  120. package/dist/locale/i18n.js.map +1 -0
  121. package/dist/proxy.d.ts +135 -0
  122. package/dist/proxy.d.ts.map +1 -0
  123. package/dist/proxy.js +291 -0
  124. package/dist/proxy.js.map +1 -0
  125. package/dist/streaming.d.ts +10 -0
  126. package/dist/streaming.d.ts.map +1 -0
  127. package/dist/streaming.js +2 -0
  128. package/dist/streaming.js.map +1 -0
  129. package/dist/type.d.ts +72 -0
  130. package/dist/type.d.ts.map +1 -0
  131. package/dist/type.js +2 -0
  132. package/dist/type.js.map +1 -0
  133. package/dist/utility/character-set-descriptor.d.ts +6 -0
  134. package/dist/utility/character-set-descriptor.d.ts.map +1 -0
  135. package/dist/utility/character-set-descriptor.js +28 -0
  136. package/dist/utility/character-set-descriptor.js.map +1 -0
  137. package/dist/utility/character-set-proxy.d.ts +32 -0
  138. package/dist/utility/character-set-proxy.d.ts.map +1 -0
  139. package/dist/utility/character-set-proxy.js +278 -0
  140. package/dist/utility/character-set-proxy.js.map +1 -0
  141. package/dist/utility/index.d.ts +4 -0
  142. package/dist/utility/index.d.ts.map +1 -0
  143. package/dist/utility/index.js +4 -0
  144. package/dist/utility/index.js.map +1 -0
  145. package/dist/utility/reg-exp-proxy.d.ts +8 -0
  146. package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
  147. package/dist/utility/reg-exp-proxy.js +103 -0
  148. package/dist/utility/reg-exp-proxy.js.map +1 -0
  149. package/dist/utility/string-descriptor.d.ts +4 -0
  150. package/dist/utility/string-descriptor.d.ts.map +1 -0
  151. package/dist/utility/string-descriptor.js +12 -0
  152. package/dist/utility/string-descriptor.js.map +1 -0
  153. package/dist/utility/string-proxy.d.ts +7 -0
  154. package/dist/utility/string-proxy.d.ts.map +1 -0
  155. package/dist/utility/string-proxy.js +63 -0
  156. package/dist/utility/string-proxy.js.map +1 -0
  157. package/dist/utility/transformer-descriptor.d.ts +6 -0
  158. package/dist/utility/transformer-descriptor.d.ts.map +1 -0
  159. package/dist/utility/transformer-descriptor.js +24 -0
  160. package/dist/utility/transformer-descriptor.js.map +1 -0
  161. package/dist/utility/transformer-proxy.d.ts +10 -0
  162. package/dist/utility/transformer-proxy.d.ts.map +1 -0
  163. package/dist/utility/transformer-proxy.js +111 -0
  164. package/dist/utility/transformer-proxy.js.map +1 -0
  165. package/dist/version.d.ts +5 -0
  166. package/dist/version.d.ts.map +1 -0
  167. package/dist/version.js +5 -0
  168. package/dist/version.js.map +1 -0
  169. package/package.json +5 -5
  170. package/src/app-extension-options.ts +61 -0
  171. package/src/app-extension.ts +22 -32
  172. package/src/app-helper-proxy.ts +21 -33
  173. package/src/generator/functions-generator.ts +14 -45
  174. package/src/generator/generator.ts +28 -18
  175. package/src/generator/locale-resources-generator.ts +79 -52
  176. package/src/gs1/character-set-proxy.ts +6 -7
  177. package/src/gs1/check-proxy.ts +8 -8
  178. package/src/gs1/gcp-length-proxy.ts +8 -8
  179. package/src/gs1/gtin-creator-proxy.ts +4 -4
  180. package/src/gs1/gtin-validator-proxy.ts +12 -12
  181. package/src/gs1/identifier-creator-proxy.ts +14 -14
  182. package/src/gs1/identifier-validator-proxy.ts +10 -10
  183. package/src/gs1/non-gtin-creator-proxy.ts +22 -23
  184. package/src/gs1/non-gtin-validator-proxy.ts +22 -23
  185. package/src/gs1/prefix-manager-proxy.ts +2 -2
  186. package/src/gs1/variable-measure-proxy.ts +4 -4
  187. package/src/gs1/verified-by-gs1-proxy.ts +5 -11
  188. package/src/index.ts +1 -0
  189. package/src/lib-proxy.ts +27 -43
  190. package/src/locale/en/locale-resources.ts +1 -1
  191. package/src/proxy.ts +12 -15
  192. package/src/streaming.ts +3 -3
  193. package/src/type.ts +3 -22
  194. package/src/utility/character-set-proxy.ts +17 -16
  195. package/src/utility/reg-exp-proxy.ts +2 -2
  196. package/src/utility/string-proxy.ts +2 -2
  197. package/src/utility/transformer-proxy.ts +6 -5
  198. package/src/version.ts +1 -1
  199. package/tsconfig-src.tsbuildinfo +1 -1
  200. package/dist/character-set-proxy-BOW94WCe.d.cts +0 -473
  201. package/dist/character-set-proxy-BOW94WCe.d.ts +0 -473
  202. package/dist/chunk-22IRLVWO.js +0 -1
  203. package/dist/chunk-MR63TJ3B.js +0 -1
  204. package/dist/chunk-TWX7TPRC.js +0 -1
  205. package/dist/descriptor-D6tZH-vc.d.ts +0 -185
  206. package/dist/generator/index.cjs +0 -17
  207. package/dist/generator/index.d.cts +0 -240
  208. package/dist/gs1/index.cjs +0 -1
  209. package/dist/gs1/index.d.cts +0 -185
  210. package/dist/index.cjs +0 -17
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Application extension options. Never instantiated; used only as extension point for custom application extension
3
+ * options to define types.
4
+ */
5
+ export interface AppExtensionOptions {
6
+ /**
7
+ * If true, errors are reported through the throw/catch mechanism.
8
+ */
9
+ ThrowError: boolean;
10
+ /**
11
+ * Application error.
12
+ */
13
+ ApplicationError: object;
14
+ /**
15
+ * Invocation context.
16
+ */
17
+ InvocationContext: unknown;
18
+ /**
19
+ * Streaming context.
20
+ */
21
+ StreamingContext: unknown;
22
+ /**
23
+ * Big integer representation.
24
+ */
25
+ BigInteger: number | bigint;
26
+ }
27
+ /**
28
+ * Custom application extension options.
29
+ */
30
+ export interface CustomAppExtensionOptions extends AppExtensionOptions {
31
+ }
32
+ /**
33
+ * If true, errors are reported through the throw/catch mechanism.
34
+ */
35
+ export type ThrowError = CustomAppExtensionOptions["ThrowError"];
36
+ /**
37
+ * Application error type.
38
+ */
39
+ export type ApplicationError = CustomAppExtensionOptions["ApplicationError"];
40
+ /**
41
+ * Invocation context type.
42
+ */
43
+ export type InvocationContext = CustomAppExtensionOptions["InvocationContext"];
44
+ /**
45
+ * Streaming context type.
46
+ */
47
+ export type StreamingContext = CustomAppExtensionOptions["StreamingContext"];
48
+ /**
49
+ * Big integer representation type.
50
+ */
51
+ export type BigInteger = CustomAppExtensionOptions["BigInteger"];
52
+ //# sourceMappingURL=app-extension-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension-options.d.ts","sourceRoot":"","sources":["../src/app-extension-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;CACrE;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,kBAAkB,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,mBAAmB,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,kBAAkB,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app-extension-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension-options.js","sourceRoot":"","sources":["../src/app-extension-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,194 @@
1
+ import { type AppDataStorage, type HTTPFetch, type Hyperlink, MemoryTransport, type Promisable } from "@aidc-toolkit/core";
2
+ import type { Logger } from "tslog";
3
+ import type { ApplicationError, BigInteger, InvocationContext, StreamingContext, ThrowError } from "./app-extension-options.js";
4
+ import type { LibProxy } from "./lib-proxy.js";
5
+ import type { StreamingCancelledCallback, StreamingConsumerCallback } from "./streaming.js";
6
+ import type { MatrixResult, SheetAddress, SheetRange, SingletonResult } from "./type.js";
7
+ /**
8
+ * Application extension.
9
+ */
10
+ export declare abstract class AppExtension {
11
+ #private;
12
+ /**
13
+ * Application name.
14
+ */
15
+ static readonly APPLICATION_NAME = "AIDCToolkit";
16
+ /**
17
+ * Version property name.
18
+ */
19
+ static readonly VERSION_NAME: string;
20
+ /**
21
+ * Constructor.
22
+ *
23
+ * @param version
24
+ * Application version.
25
+ *
26
+ * @param maximumSequenceCount
27
+ * Maximum sequence count supported by application.
28
+ *
29
+ * @param throwError
30
+ * If true, errors are reported through the throw/catch mechanism.
31
+ */
32
+ protected constructor(version: string, maximumSequenceCount: number, throwError: ThrowError);
33
+ /**
34
+ * Initialize the application extension.
35
+ */
36
+ initialize(): Promise<void>;
37
+ /**
38
+ * Get the version.
39
+ *
40
+ * @returns
41
+ * Version.
42
+ */
43
+ get version(): string;
44
+ /**
45
+ * Determine if errors are reported through the throw/catch mechanism.
46
+ */
47
+ get throwError(): ThrowError;
48
+ /**
49
+ * Get the logger.
50
+ */
51
+ get logger(): Logger<object>;
52
+ /**
53
+ * Get the logger memory transport.
54
+ */
55
+ get memoryTransport(): MemoryTransport<object>;
56
+ /**
57
+ * Get the maximum width supported by the application.
58
+ */
59
+ abstract get maximumWidth(): number;
60
+ /**
61
+ * Get the maximum height supported by the application.
62
+ */
63
+ abstract get maximumHeight(): number;
64
+ /**
65
+ * Get a proxy instance. The use of a weak map ensures that proxies are loaded only as needed and may be garbage
66
+ * collected if required.
67
+ *
68
+ * @param ProxyConstructor
69
+ * Proxy constructor.
70
+ *
71
+ * @returns
72
+ * Proxy instance.
73
+ */
74
+ getProxy<T extends LibProxy>(ProxyConstructor: new (appExtension: AppExtension) => T): T;
75
+ /**
76
+ * Get the sheet address from an invocation context.
77
+ *
78
+ * @param invocationContext
79
+ * Invocation context.
80
+ *
81
+ * @returns
82
+ * Sheet address.
83
+ */
84
+ abstract getSheetAddress(invocationContext: InvocationContext): Promisable<SheetAddress>;
85
+ /**
86
+ * Get a parameter range from an invocation context.
87
+ *
88
+ * @param invocationContext
89
+ * Invocation context.
90
+ *
91
+ * @param parameterNumber
92
+ * Parameter number.
93
+ *
94
+ * @returns
95
+ * Sheet range or null if parameter is not a range.
96
+ */
97
+ abstract getParameterSheetRange(invocationContext: InvocationContext, parameterNumber: number): Promisable<SheetRange | null>;
98
+ /**
99
+ * Install a streaming function.
100
+ *
101
+ * @param streamingContext
102
+ * Streaming context.
103
+ *
104
+ * @param streamingCancelledCallback
105
+ * Streaming cancelled callback, called when streaming is cancelled.
106
+ *
107
+ * @returns
108
+ * Streaming consumer callback, called when stream contents updated.
109
+ */
110
+ abstract installStreaming<TResult>(streamingContext: StreamingContext, streamingCancelledCallback: StreamingCancelledCallback): StreamingConsumerCallback<TResult>;
111
+ /**
112
+ * Get a property stored within the active document.
113
+ *
114
+ * @param name
115
+ * Property name.
116
+ *
117
+ * @returns
118
+ * Property value or undefined if no value is stored under the given name.
119
+ */
120
+ abstract getDocumentProperty(name: string): Promisable<string | undefined>;
121
+ /**
122
+ * Set a property to be stored within the active document.
123
+ *
124
+ * @param name
125
+ * Property name.
126
+ *
127
+ * @param value
128
+ * Property value.
129
+ */
130
+ abstract setDocumentProperty(name: string, value: string): Promisable<void>;
131
+ /**
132
+ * Delete a property from the active document.
133
+ *
134
+ * @param name
135
+ * Property name.
136
+ */
137
+ abstract deleteDocumentProperty(name: string): Promisable<void>;
138
+ /**
139
+ * Get application data storage for the current document.
140
+ */
141
+ abstract get documentAppDataStorage(): AppDataStorage<boolean>;
142
+ /**
143
+ * Get application data storage shared across multiple documents.
144
+ */
145
+ abstract get sharedAppDataStorage(): AppDataStorage<boolean>;
146
+ /**
147
+ * Get HTTP fetch function.
148
+ */
149
+ abstract get httpFetch(): HTTPFetch;
150
+ /**
151
+ * Validate a sequence count against the maximum supported by application.
152
+ *
153
+ * @param sequenceCount
154
+ * Sequence count.
155
+ */
156
+ validateSequenceCount(sequenceCount: number): void;
157
+ /**
158
+ * Map a big integer to its representation type.
159
+ *
160
+ * @param value
161
+ * Big integer value to map.
162
+ *
163
+ * @returns
164
+ * Mapped big integer value.
165
+ */
166
+ abstract mapBigInt(value: bigint): SingletonResult<BigInteger>;
167
+ /**
168
+ * Map hyperlink results to a form suitable for the application.
169
+ *
170
+ * @param matrixHyperlinkResults
171
+ * Matrix of hyperlink results from function call.
172
+ *
173
+ * @returns
174
+ * Matrix of results in a form suitable for the application.
175
+ */
176
+ abstract mapHyperlinkResults(matrixHyperlinkResults: MatrixResult<Hyperlink>): Promisable<MatrixResult<unknown>>;
177
+ /**
178
+ * Map a range error (thrown by the library) to an application-specific error. If errors are reported through the
179
+ * throw/catch mechanism, the implementation may return the range error unmodified if that is supported.
180
+ *
181
+ * @param rangeError
182
+ * Range error.
183
+ */
184
+ abstract mapRangeError(rangeError: RangeError): ApplicationError;
185
+ /**
186
+ * Handle an error with a message; called when an exception occurs outside the control of the AIDC Toolkit library.
187
+ * Implementation must not return, most likely by throwing the message wrapped in an error type.
188
+ *
189
+ * @param message
190
+ * Message to include in the error.
191
+ */
192
+ abstract handleError(message: string): never;
193
+ }
194
+ //# sourceMappingURL=app-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension.d.ts","sourceRoot":"","sources":["../src/app-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,SAAS,EAEd,eAAe,EACf,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EACR,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEzF;;GAEG;AACH,8BAAsB,YAAY;;IAC9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,iBAAiB;IAEjD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,SAA8C;IA0C1E;;;;;;;;;;;OAWG;IACH,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAe3F;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjC;;;;;OAKG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAE3B;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,CAAC,CAE7C;IAED;;OAEG;IACH,QAAQ,KAAK,YAAY,IAAI,MAAM,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ACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC;IAE9D;;;;;;;;OAQG;IACH,QAAQ,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAEhH;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,gBAAgB;IAEhE;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;CAC/C"}
@@ -0,0 +1,141 @@
1
+ import { getLogger, LogLevels, MemoryTransport } from "@aidc-toolkit/core";
2
+ import { i18nextAppExtension } from "./locale/i18n.js";
3
+ /**
4
+ * Application extension.
5
+ */
6
+ export class AppExtension {
7
+ /**
8
+ * Application name.
9
+ */
10
+ static APPLICATION_NAME = "AIDCToolkit";
11
+ /**
12
+ * Version property name.
13
+ */
14
+ static VERSION_NAME = `${AppExtension.APPLICATION_NAME}.version`;
15
+ /**
16
+ * Maximum logger messages length.
17
+ */
18
+ static #MAXIMUM_LOGGER_MESSAGES_LENGTH = 120;
19
+ /**
20
+ * Truncate logger messages length.
21
+ */
22
+ static #TRUNCATE_LOGGER_MESSAGES_LENGTH = 100;
23
+ /**
24
+ * Application version.
25
+ */
26
+ #version;
27
+ /**
28
+ * Maximum sequence count supported by application.
29
+ */
30
+ #maximumSequenceCount;
31
+ /**
32
+ * If true, errors are reported through the throw/catch mechanism.
33
+ */
34
+ #throwError;
35
+ /**
36
+ * Logger.
37
+ */
38
+ #logger;
39
+ /**
40
+ * Logger memory transport.
41
+ */
42
+ #memoryTransport;
43
+ /**
44
+ * Proxies map for lazy loading and memory management.
45
+ */
46
+ #proxiesMap = new WeakMap();
47
+ /**
48
+ * Constructor.
49
+ *
50
+ * @param version
51
+ * Application version.
52
+ *
53
+ * @param maximumSequenceCount
54
+ * Maximum sequence count supported by application.
55
+ *
56
+ * @param throwError
57
+ * If true, errors are reported through the throw/catch mechanism.
58
+ */
59
+ constructor(version, maximumSequenceCount, throwError) {
60
+ this.#version = version;
61
+ this.#maximumSequenceCount = maximumSequenceCount;
62
+ this.#throwError = throwError;
63
+ // Running in production if version doesn't include a pre-release identifier.
64
+ const isProduction = !version.includes("-");
65
+ this.#logger = getLogger(isProduction ? LogLevels.Info : LogLevels.Debug, {
66
+ type: isProduction ? "hidden" : "pretty"
67
+ });
68
+ this.#memoryTransport = new MemoryTransport(this.#logger, AppExtension.#MAXIMUM_LOGGER_MESSAGES_LENGTH, AppExtension.#TRUNCATE_LOGGER_MESSAGES_LENGTH);
69
+ }
70
+ /**
71
+ * Initialize the application extension.
72
+ */
73
+ async initialize() {
74
+ const fileVersion = await this.getDocumentProperty(AppExtension.VERSION_NAME);
75
+ if (fileVersion !== this.#version) {
76
+ await this.setDocumentProperty(AppExtension.VERSION_NAME, this.#version);
77
+ }
78
+ }
79
+ /**
80
+ * Get the version.
81
+ *
82
+ * @returns
83
+ * Version.
84
+ */
85
+ get version() {
86
+ return this.#version;
87
+ }
88
+ /**
89
+ * Determine if errors are reported through the throw/catch mechanism.
90
+ */
91
+ get throwError() {
92
+ return this.#throwError;
93
+ }
94
+ /**
95
+ * Get the logger.
96
+ */
97
+ get logger() {
98
+ return this.#logger;
99
+ }
100
+ /**
101
+ * Get the logger memory transport.
102
+ */
103
+ get memoryTransport() {
104
+ return this.#memoryTransport;
105
+ }
106
+ /**
107
+ * Get a proxy instance. The use of a weak map ensures that proxies are loaded only as needed and may be garbage
108
+ * collected if required.
109
+ *
110
+ * @param ProxyConstructor
111
+ * Proxy constructor.
112
+ *
113
+ * @returns
114
+ * Proxy instance.
115
+ */
116
+ getProxy(ProxyConstructor) {
117
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Type is managed in this method.
118
+ let proxy = this.#proxiesMap.get(ProxyConstructor);
119
+ if (proxy === undefined) {
120
+ proxy = new ProxyConstructor(this);
121
+ this.#proxiesMap.set(ProxyConstructor, proxy);
122
+ }
123
+ return proxy;
124
+ }
125
+ /**
126
+ * Validate a sequence count against the maximum supported by application.
127
+ *
128
+ * @param sequenceCount
129
+ * Sequence count.
130
+ */
131
+ validateSequenceCount(sequenceCount) {
132
+ const absoluteSequenceCount = Math.abs(sequenceCount);
133
+ if (absoluteSequenceCount > this.#maximumSequenceCount) {
134
+ throw new RangeError(i18nextAppExtension.t("AppExtension.sequenceCountMustBeLessThanOrEqualTo", {
135
+ sequenceCount: absoluteSequenceCount,
136
+ maximumSequenceCount: this.#maximumSequenceCount
137
+ }));
138
+ }
139
+ }
140
+ }
141
+ //# sourceMappingURL=app-extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-extension.js","sourceRoot":"","sources":["../src/app-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,SAAS,EAGT,SAAS,EACT,eAAe,EAElB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;GAEG;AACH,MAAM,OAAgB,YAAY;IAC9B;;OAEG;IACH,MAAM,CAAU,gBAAgB,GAAG,aAAa,CAAC;IAEjD;;OAEG;IACH,MAAM,CAAU,YAAY,GAAG,GAAG,YAAY,CAAC,gBAAgB,UAAU,CAAC;IAE1E;;OAEG;IACH,MAAM,CAAU,+BAA+B,GAAG,GAAG,CAAC;IAEtD;;OAEG;IACH,MAAM,CAAU,gCAAgC,GAAG,GAAG,CAAC;IAEvD;;OAEG;IACM,QAAQ,CAAS;IAE1B;;OAEG;IACM,qBAAqB,CAAS;IAEvC;;OAEG;IACM,WAAW,CAAa;IAEjC;;OAEG;IACM,OAAO,CAAiB;IAEjC;;OAEG;IACM,gBAAgB,CAA0B;IAEnD;;OAEG;IACM,WAAW,GAAG,IAAI,OAAO,EAAoB,CAAC;IAEvD;;;;;;;;;;;OAWG;IACH,YAAsB,OAAe,EAAE,oBAA4B,EAAE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QAAQ,CAAqB,gBAAuD;QAChF,0GAA0G;QAC1G,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAkB,CAAC;QAEpE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAEnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAsFD;;;;;OAKG;IACH,qBAAqB,CAAC,aAAqB;QACvC,MAAM,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAEtD,IAAI,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;YACrD,MAAM,IAAI,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC,mDAAmD,EAAE;gBAC5F,aAAa,EAAE,qBAAqB;gBACpC,oBAAoB,EAAE,IAAI,CAAC,qBAAqB;aACnD,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { type Nullishable } from "@aidc-toolkit/core";
2
+ import type { InvocationContext, StreamingContext } from "./app-extension-options.js";
3
+ import { LibProxy } from "./lib-proxy.js";
4
+ import type { Matrix, MatrixResult } from "./type.js";
5
+ /**
6
+ * Application helper.
7
+ */
8
+ export declare class AppHelperProxy extends LibProxy {
9
+ #private;
10
+ /**
11
+ * Get the version.
12
+ *
13
+ * @returns
14
+ * Version.
15
+ */
16
+ version(): string;
17
+ /**
18
+ * Spill a one-dimensional matrix to fit a rectangle within a given maximum height and width.
19
+ *
20
+ * @param arrayValues
21
+ * Matrix values. Matrix is length 1 or contains arrays of length 1 with the values.
22
+ *
23
+ * @param maximumHeight
24
+ * Maximum height.
25
+ *
26
+ * @param maximumWidth
27
+ * Maximum width.
28
+ *
29
+ * @param invocationContext
30
+ * Invocation context.
31
+ *
32
+ * @returns
33
+ * Matrix spilled within maximum height and maximum width.
34
+ */
35
+ spill(arrayValues: Matrix<unknown>, maximumHeight: Nullishable<number>, maximumWidth: Nullishable<number>, invocationContext: Nullishable<InvocationContext>): Promise<MatrixResult<unknown>>;
36
+ /**
37
+ * Get the logger messages. This is a snapshot, with the option to change the log level for the next call.
38
+ *
39
+ * @param logLevelString
40
+ * Log level as string.
41
+ *
42
+ * @returns
43
+ * Logger messages.
44
+ */
45
+ loggerMessages(logLevelString: Nullishable<string>): MatrixResult<string>;
46
+ /**
47
+ * Get the logger messages as a stream.
48
+ *
49
+ * @param logLevelString
50
+ * Log level as string.
51
+ *
52
+ * @param streamingContext
53
+ * Streaming context.
54
+ */
55
+ loggerStream(logLevelString: Nullishable<string>, streamingContext: Nullishable<StreamingContext>): void;
56
+ }
57
+ //# sourceMappingURL=app-helper-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-helper-proxy.d.ts","sourceRoot":"","sources":["../src/app-helper-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6D,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAkDtD;;GAEG;AACH,qBAGa,cAAe,SAAQ,QAAQ;;IAGxC;;;;;OAKG;IAMH,OAAO,IAAI,MAAM;IA6CjB;;;;;;;;;;;;;;;;;OAiBG;IAQG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,WAAW,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IA4GnM;;;;;;;;OAQG;IAOH,cAAc,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC;IAqBzE;;;;;;;;OAQG;IAQH,YAAY,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI;CA8C3G"}