@aidc-toolkit/app-extension 1.0.45 → 1.0.46-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/app-extension.d.ts +194 -0
  2. package/dist/app-extension.d.ts.map +1 -0
  3. package/dist/app-extension.js +133 -0
  4. package/dist/app-extension.js.map +1 -0
  5. package/dist/app-helper-proxy.d.ts +61 -0
  6. package/dist/app-helper-proxy.d.ts.map +1 -0
  7. package/dist/app-helper-proxy.js +333 -0
  8. package/dist/app-helper-proxy.js.map +1 -0
  9. package/dist/descriptor.d.ts +197 -0
  10. package/dist/descriptor.d.ts.map +1 -0
  11. package/dist/descriptor.js +44 -0
  12. package/dist/descriptor.js.map +1 -0
  13. package/dist/generator/generator.d.ts +124 -0
  14. package/dist/generator/generator.d.ts.map +1 -0
  15. package/dist/generator/generator.js +190 -0
  16. package/dist/generator/generator.js.map +1 -0
  17. package/dist/generator/index.d.ts +18 -0
  18. package/dist/generator/index.d.ts.map +1 -0
  19. package/dist/generator/index.js +18 -0
  20. package/dist/generator/index.js.map +1 -0
  21. package/dist/generator/locale-resources-generator.d.ts +2 -0
  22. package/dist/generator/locale-resources-generator.d.ts.map +1 -0
  23. package/dist/generator/locale-resources-generator.js +312 -0
  24. package/dist/generator/locale-resources-generator.js.map +1 -0
  25. package/dist/gs1/character-set-proxy.d.ts +13 -0
  26. package/dist/gs1/character-set-proxy.d.ts.map +1 -0
  27. package/dist/gs1/character-set-proxy.js +126 -0
  28. package/dist/gs1/character-set-proxy.js.map +1 -0
  29. package/dist/gs1/check-proxy.d.ts +11 -0
  30. package/dist/gs1/check-proxy.d.ts.map +1 -0
  31. package/dist/gs1/check-proxy.js +163 -0
  32. package/dist/gs1/check-proxy.js.map +1 -0
  33. package/dist/gs1/gcp-length-proxy.d.ts +11 -0
  34. package/dist/gs1/gcp-length-proxy.d.ts.map +1 -0
  35. package/dist/gs1/gcp-length-proxy.js +190 -0
  36. package/dist/gs1/gcp-length-proxy.js.map +1 -0
  37. package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
  38. package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
  39. package/dist/gs1/gtin-creator-proxy.js +85 -0
  40. package/dist/gs1/gtin-creator-proxy.js.map +1 -0
  41. package/dist/gs1/gtin-descriptor.d.ts +3 -0
  42. package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
  43. package/dist/gs1/gtin-descriptor.js +8 -0
  44. package/dist/gs1/gtin-descriptor.js.map +1 -0
  45. package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
  46. package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
  47. package/dist/gs1/gtin-validator-proxy.js +256 -0
  48. package/dist/gs1/gtin-validator-proxy.js.map +1 -0
  49. package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
  50. package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
  51. package/dist/gs1/identifier-creator-proxy.js +302 -0
  52. package/dist/gs1/identifier-creator-proxy.js.map +1 -0
  53. package/dist/gs1/identifier-descriptor.d.ts +4 -0
  54. package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
  55. package/dist/gs1/identifier-descriptor.js +14 -0
  56. package/dist/gs1/identifier-descriptor.js.map +1 -0
  57. package/dist/gs1/identifier-type.d.ts +22 -0
  58. package/dist/gs1/identifier-type.d.ts.map +1 -0
  59. package/dist/gs1/identifier-type.js +34 -0
  60. package/dist/gs1/identifier-type.js.map +1 -0
  61. package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
  62. package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
  63. package/dist/gs1/identifier-validator-proxy.js +212 -0
  64. package/dist/gs1/identifier-validator-proxy.js.map +1 -0
  65. package/dist/gs1/index.d.ts +11 -0
  66. package/dist/gs1/index.d.ts.map +1 -0
  67. package/dist/gs1/index.js +11 -0
  68. package/dist/gs1/index.js.map +1 -0
  69. package/dist/gs1/non-gtin-creator-proxy.d.ts +38 -0
  70. package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
  71. package/dist/gs1/non-gtin-creator-proxy.js +301 -0
  72. package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
  73. package/dist/gs1/non-gtin-validator-proxy.d.ts +37 -0
  74. package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
  75. package/dist/gs1/non-gtin-validator-proxy.js +302 -0
  76. package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
  77. package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
  78. package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
  79. package/dist/gs1/prefix-definition-descriptor.js +16 -0
  80. package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
  81. package/dist/gs1/prefix-manager-proxy.d.ts +8 -0
  82. package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
  83. package/dist/gs1/prefix-manager-proxy.js +94 -0
  84. package/dist/gs1/prefix-manager-proxy.js.map +1 -0
  85. package/dist/gs1/variable-measure-proxy.d.ts +7 -0
  86. package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
  87. package/dist/gs1/variable-measure-proxy.js +114 -0
  88. package/dist/gs1/variable-measure-proxy.js.map +1 -0
  89. package/dist/gs1/verified-by-gs1-proxy.d.ts +7 -0
  90. package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -0
  91. package/dist/gs1/verified-by-gs1-proxy.js +106 -0
  92. package/dist/gs1/verified-by-gs1-proxy.js.map +1 -0
  93. package/dist/index.d.ts +26 -1752
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +8 -1
  96. package/dist/index.js.map +1 -0
  97. package/dist/lib-proxy.d.ts +135 -0
  98. package/dist/lib-proxy.d.ts.map +1 -0
  99. package/dist/lib-proxy.js +276 -0
  100. package/dist/lib-proxy.js.map +1 -0
  101. package/dist/locale/en/locale-resources.d.ts +752 -0
  102. package/dist/locale/en/locale-resources.d.ts.map +1 -0
  103. package/dist/locale/en/locale-resources.js +751 -0
  104. package/dist/locale/en/locale-resources.js.map +1 -0
  105. package/dist/locale/fr/locale-resources.d.ts +752 -0
  106. package/dist/locale/fr/locale-resources.d.ts.map +1 -0
  107. package/dist/locale/fr/locale-resources.js +751 -0
  108. package/dist/locale/fr/locale-resources.js.map +1 -0
  109. package/dist/locale/i18n.d.ts +27 -0
  110. package/dist/locale/i18n.d.ts.map +1 -0
  111. package/dist/locale/i18n.js +36 -0
  112. package/dist/locale/i18n.js.map +1 -0
  113. package/dist/proxy.d.ts +136 -0
  114. package/dist/proxy.d.ts.map +1 -0
  115. package/dist/proxy.js +295 -0
  116. package/dist/proxy.js.map +1 -0
  117. package/dist/streaming.d.ts +10 -0
  118. package/dist/streaming.d.ts.map +1 -0
  119. package/dist/streaming.js +2 -0
  120. package/dist/streaming.js.map +1 -0
  121. package/dist/type.d.ts +91 -0
  122. package/dist/type.d.ts.map +1 -0
  123. package/dist/type.js +2 -0
  124. package/dist/type.js.map +1 -0
  125. package/dist/utility/character-set-descriptor.d.ts +6 -0
  126. package/dist/utility/character-set-descriptor.d.ts.map +1 -0
  127. package/dist/utility/character-set-descriptor.js +28 -0
  128. package/dist/utility/character-set-descriptor.js.map +1 -0
  129. package/dist/utility/character-set-proxy.d.ts +31 -0
  130. package/dist/utility/character-set-proxy.d.ts.map +1 -0
  131. package/dist/utility/character-set-proxy.js +278 -0
  132. package/dist/utility/character-set-proxy.js.map +1 -0
  133. package/dist/utility/index.d.ts +4 -0
  134. package/dist/utility/index.d.ts.map +1 -0
  135. package/dist/utility/index.js +4 -0
  136. package/dist/utility/index.js.map +1 -0
  137. package/dist/utility/reg-exp-proxy.d.ts +8 -0
  138. package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
  139. package/dist/utility/reg-exp-proxy.js +103 -0
  140. package/dist/utility/reg-exp-proxy.js.map +1 -0
  141. package/dist/utility/string-descriptor.d.ts +4 -0
  142. package/dist/utility/string-descriptor.d.ts.map +1 -0
  143. package/dist/utility/string-descriptor.js +12 -0
  144. package/dist/utility/string-descriptor.js.map +1 -0
  145. package/dist/utility/string-proxy.d.ts +7 -0
  146. package/dist/utility/string-proxy.d.ts.map +1 -0
  147. package/dist/utility/string-proxy.js +63 -0
  148. package/dist/utility/string-proxy.js.map +1 -0
  149. package/dist/utility/transformer-descriptor.d.ts +6 -0
  150. package/dist/utility/transformer-descriptor.d.ts.map +1 -0
  151. package/dist/utility/transformer-descriptor.js +24 -0
  152. package/dist/utility/transformer-descriptor.js.map +1 -0
  153. package/dist/utility/transformer-proxy.d.ts +9 -0
  154. package/dist/utility/transformer-proxy.d.ts.map +1 -0
  155. package/dist/utility/transformer-proxy.js +111 -0
  156. package/dist/utility/transformer-proxy.js.map +1 -0
  157. package/package.json +1 -1
  158. package/tsconfig-src.tsbuildinfo +1 -1
  159. package/tsup.config.ts +4 -1
  160. package/dist/index.cjs +0 -17
  161. package/dist/index.d.cts +0 -1752
@@ -0,0 +1,194 @@
1
+ import { type AppDataStorage, type Hyperlink, MemoryTransport, type Promisable } from "@aidc-toolkit/core";
2
+ import type { Logger } from "tslog";
3
+ import type { StreamingCancelledCallback, StreamingConsumerCallback } from "./streaming.js";
4
+ import type { ErrorExtends, MatrixResult, SheetAddress, SheetRange, SingletonResult } from "./type.js";
5
+ /**
6
+ * Application extension.
7
+ *
8
+ * @template ThrowError
9
+ * If true, errors are reported through the throw/catch mechanism.
10
+ *
11
+ * @template TError
12
+ * Error type.
13
+ *
14
+ * @template TInvocationContext
15
+ * Application-specific invocation context type.
16
+ *
17
+ * @template TStreamingInvocationContext
18
+ * Application-specific streaming invocation context type.
19
+ *
20
+ * @template TBigInt
21
+ * Type to which big integer is mapped.
22
+ */
23
+ export declare abstract class AppExtension<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> {
24
+ #private;
25
+ /**
26
+ * Application name.
27
+ */
28
+ static readonly APPLICATION_NAME = "AIDCToolkit";
29
+ /**
30
+ * Version property name.
31
+ */
32
+ static readonly VERSION_NAME: string;
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @param version
37
+ * Application version.
38
+ *
39
+ * @param maximumSequenceCount
40
+ * Maximum sequence count supported by application.
41
+ *
42
+ * @param throwError
43
+ * If true, errors are reported through the throw/catch mechanism.
44
+ */
45
+ protected constructor(version: string, maximumSequenceCount: number, throwError: ThrowError);
46
+ /**
47
+ * Initialize the application extension.
48
+ */
49
+ initialize(): Promise<void>;
50
+ /**
51
+ * Get the version.
52
+ *
53
+ * @returns
54
+ * Version.
55
+ */
56
+ get version(): string;
57
+ /**
58
+ * Determine if errors are reported through the throw/catch mechanism.
59
+ */
60
+ get throwError(): ThrowError;
61
+ /**
62
+ * Get the logger.
63
+ */
64
+ get logger(): Logger<object>;
65
+ /**
66
+ * Get the logger memory transport.
67
+ */
68
+ get memoryTransport(): MemoryTransport<object>;
69
+ /**
70
+ * Get the maximum width supported by the application.
71
+ */
72
+ abstract get maximumWidth(): number;
73
+ /**
74
+ * Get the maximum height supported by the application.
75
+ */
76
+ abstract get maximumHeight(): number;
77
+ /**
78
+ * Get the sheet address from an invocation context.
79
+ *
80
+ * @param invocationContext
81
+ * Invocation context.
82
+ *
83
+ * @returns
84
+ * Sheet address.
85
+ */
86
+ abstract getSheetAddress(invocationContext: TInvocationContext): Promisable<SheetAddress>;
87
+ /**
88
+ * Get a parameter range from an invocation context.
89
+ *
90
+ * @param invocationContext
91
+ * Invocation context.
92
+ *
93
+ * @param parameterNumber
94
+ * Parameter number.
95
+ *
96
+ * @returns
97
+ * Sheet range or null if parameter is not a range.
98
+ */
99
+ abstract getParameterSheetRange(invocationContext: TInvocationContext, parameterNumber: number): Promisable<SheetRange | null>;
100
+ /**
101
+ * Set up streaming for a streaming function.
102
+ *
103
+ * @param streamingInvocationContext
104
+ * Streaming invocation context.
105
+ *
106
+ * @param streamingCancelledCallback
107
+ * Streaming cancelled callback, called when streaming is cancelled.
108
+ *
109
+ * @returns
110
+ * Streaming consumer callback, called when stream contents updated.
111
+ */
112
+ abstract setUpStreaming<TResult>(streamingInvocationContext: TStreamingInvocationContext, streamingCancelledCallback: StreamingCancelledCallback): StreamingConsumerCallback<TResult, ThrowError, TError>;
113
+ /**
114
+ * Get a property stored within the active document.
115
+ *
116
+ * @param name
117
+ * Property name.
118
+ *
119
+ * @returns
120
+ * Property value or undefined if no value is stored under the given name.
121
+ */
122
+ abstract getDocumentProperty(name: string): Promisable<string | undefined>;
123
+ /**
124
+ * Set a property to be stored within the active document.
125
+ *
126
+ * @param name
127
+ * Property name.
128
+ *
129
+ * @param value
130
+ * Property value.
131
+ */
132
+ abstract setDocumentProperty(name: string, value: string): Promisable<void>;
133
+ /**
134
+ * Delete a property from the active document.
135
+ *
136
+ * @param name
137
+ * Property name.
138
+ */
139
+ abstract deleteDocumentProperty(name: string): Promisable<void>;
140
+ /**
141
+ * Get application data storage for the current document.
142
+ */
143
+ abstract get documentAppDataStorage(): AppDataStorage<boolean>;
144
+ /**
145
+ * Get application data storage shared across multiple documents.
146
+ */
147
+ abstract get sharedAppDataStorage(): AppDataStorage<boolean>;
148
+ /**
149
+ * Validate a sequence count against the maximum supported by application.
150
+ *
151
+ * @param sequenceCount
152
+ * Sequence count.
153
+ */
154
+ validateSequenceCount(sequenceCount: number): void;
155
+ /**
156
+ * Map big integer to another type if necessary.
157
+ *
158
+ * @param value
159
+ * Big integer value to map.
160
+ *
161
+ * @returns
162
+ * Mapped big integer value.
163
+ */
164
+ abstract mapBigInt(value: bigint): SingletonResult<TBigInt, ThrowError, TError>;
165
+ /**
166
+ * Map hyperlink results to a form suitable for the application.
167
+ *
168
+ * @param invocationContext
169
+ * Invocation context.
170
+ *
171
+ * @param matrixHyperlinkResults
172
+ * Matrix of hyperlink results from function call.
173
+ *
174
+ * @returns
175
+ * Matrix of results in a form suitable for the application.
176
+ */
177
+ abstract mapHyperlinkResults(invocationContext: TInvocationContext, matrixHyperlinkResults: MatrixResult<Hyperlink, ThrowError, TError>): Promisable<MatrixResult<unknown, ThrowError, TError>>;
178
+ /**
179
+ * Map a range error (thrown by the library) to an application-specific error. If errors are reported through the
180
+ * throw/catch mechanism, the implementation may return the range error unmodified if that is supported.
181
+ *
182
+ * @param rangeError
183
+ */
184
+ abstract mapRangeError(rangeError: RangeError): TError;
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,EAEd,eAAe,EACf,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEvG;;;;;;;;;;;;;;;;;GAiBG;AACH,8BAAsB,YAAY,CAAC,UAAU,SAAS,OAAO,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,OAAO;;IAC5J;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,iBAAiB;IAEjD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,SAA8C;IAqC1E;;;;;;;;;;;OAWG;IACH,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU;IAe3F;;OAEG;IACG,UAAU,IAAI,OAAO,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KAAK,oBAAoB,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAE7D;;;;;OAKG;IACH,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAWlD;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC;IAE/E;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAE/L;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;IAEtD;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;CAC/C"}
@@ -0,0 +1,133 @@
1
+ import { getLogger, LogLevels, MemoryTransport } from "@aidc-toolkit/core";
2
+ import { i18nextAppExtension } from "./locale/i18n.js";
3
+ /**
4
+ * Application extension.
5
+ *
6
+ * @template ThrowError
7
+ * If true, errors are reported through the throw/catch mechanism.
8
+ *
9
+ * @template TError
10
+ * Error type.
11
+ *
12
+ * @template TInvocationContext
13
+ * Application-specific invocation context type.
14
+ *
15
+ * @template TStreamingInvocationContext
16
+ * Application-specific streaming invocation context type.
17
+ *
18
+ * @template TBigInt
19
+ * Type to which big integer is mapped.
20
+ */
21
+ export class AppExtension {
22
+ /**
23
+ * Application name.
24
+ */
25
+ static APPLICATION_NAME = "AIDCToolkit";
26
+ /**
27
+ * Version property name.
28
+ */
29
+ static VERSION_NAME = `${AppExtension.APPLICATION_NAME}.version`;
30
+ /**
31
+ * Maximum logger messages length.
32
+ */
33
+ static #MAXIMUM_LOGGER_MESSAGES_LENGTH = 120;
34
+ /**
35
+ * Truncate logger messages length.
36
+ */
37
+ static #TRUNCATE_LOGGER_MESSAGES_LENGTH = 100;
38
+ /**
39
+ * Application version.
40
+ */
41
+ #version;
42
+ /**
43
+ * Maximum sequence count supported by application.
44
+ */
45
+ #maximumSequenceCount;
46
+ /**
47
+ * If true, errors are reported through the throw/catch mechanism.
48
+ */
49
+ #throwError;
50
+ /**
51
+ * Logger.
52
+ */
53
+ #logger;
54
+ /**
55
+ * Logger memory transport.
56
+ */
57
+ #memoryTransport;
58
+ /**
59
+ * Constructor.
60
+ *
61
+ * @param version
62
+ * Application version.
63
+ *
64
+ * @param maximumSequenceCount
65
+ * Maximum sequence count supported by application.
66
+ *
67
+ * @param throwError
68
+ * If true, errors are reported through the throw/catch mechanism.
69
+ */
70
+ constructor(version, maximumSequenceCount, throwError) {
71
+ this.#version = version;
72
+ this.#maximumSequenceCount = maximumSequenceCount;
73
+ this.#throwError = throwError;
74
+ // Running in production if version doesn't include a pre-release identifier.
75
+ const isProduction = !version.includes("-");
76
+ this.#logger = getLogger(isProduction ? LogLevels.Info : LogLevels.Debug, {
77
+ type: isProduction ? "hidden" : "pretty"
78
+ });
79
+ this.#memoryTransport = new MemoryTransport(this.#logger, AppExtension.#MAXIMUM_LOGGER_MESSAGES_LENGTH, AppExtension.#TRUNCATE_LOGGER_MESSAGES_LENGTH);
80
+ }
81
+ /**
82
+ * Initialize the application extension.
83
+ */
84
+ async initialize() {
85
+ const fileVersion = await this.getDocumentProperty(AppExtension.VERSION_NAME);
86
+ if (fileVersion !== this.#version) {
87
+ await this.setDocumentProperty(AppExtension.VERSION_NAME, this.#version);
88
+ }
89
+ }
90
+ /**
91
+ * Get the version.
92
+ *
93
+ * @returns
94
+ * Version.
95
+ */
96
+ get version() {
97
+ return this.#version;
98
+ }
99
+ /**
100
+ * Determine if errors are reported through the throw/catch mechanism.
101
+ */
102
+ get throwError() {
103
+ return this.#throwError;
104
+ }
105
+ /**
106
+ * Get the logger.
107
+ */
108
+ get logger() {
109
+ return this.#logger;
110
+ }
111
+ /**
112
+ * Get the logger memory transport.
113
+ */
114
+ get memoryTransport() {
115
+ return this.#memoryTransport;
116
+ }
117
+ /**
118
+ * Validate a sequence count against the maximum supported by application.
119
+ *
120
+ * @param sequenceCount
121
+ * Sequence count.
122
+ */
123
+ validateSequenceCount(sequenceCount) {
124
+ const absoluteSequenceCount = Math.abs(sequenceCount);
125
+ if (absoluteSequenceCount > this.#maximumSequenceCount) {
126
+ throw new RangeError(i18nextAppExtension.t("AppExtension.sequenceCountMustBeLessThanOrEqualTo", {
127
+ sequenceCount: absoluteSequenceCount,
128
+ maximumSequenceCount: this.#maximumSequenceCount
129
+ }));
130
+ }
131
+ }
132
+ }
133
+ //# 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,EAET,SAAS,EACT,eAAe,EAElB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;;;;;;;;;;;;;;;;GAiBG;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;;;;;;;;;;;OAWG;IACH,YAAsB,OAAe,EAAE,oBAA4B,EAAE,UAAsB;QACvF,IA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B;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,61 @@
1
+ import { type Nullishable } from "@aidc-toolkit/core";
2
+ import { LibProxy } from "./lib-proxy.js";
3
+ import type { ErrorExtends, Matrix, MatrixResult } from "./type.js";
4
+ /**
5
+ * Application utilities.
6
+ *
7
+ * @template ThrowError
8
+ * If true, errors are reported through the throw/catch mechanism.
9
+ *
10
+ * @template TError
11
+ * Error type.
12
+ *
13
+ * @template TInvocationContext
14
+ * Application-specific invocation context type.
15
+ *
16
+ * @template TStreamingInvocationContext
17
+ * Application-specific streaming invocation context type.
18
+ *
19
+ * @template TBigInt
20
+ * Type to which big integer is mapped.
21
+ */
22
+ export declare class AppHelperProxy<ThrowError extends boolean, TError extends ErrorExtends<ThrowError>, TInvocationContext, TStreamingInvocationContext, TBigInt> extends LibProxy<ThrowError, TError, TInvocationContext, TStreamingInvocationContext, TBigInt> {
23
+ #private;
24
+ /**
25
+ * Get the version.
26
+ *
27
+ * @returns
28
+ * Version.
29
+ */
30
+ version(): string;
31
+ /**
32
+ * Spill a one-dimensional matrix to fit a rectangle within a given maximum height and width.
33
+ *
34
+ * @param arrayValues
35
+ * Matrix values. Matrix is length 1 or contains arrays of length 1 with the values.
36
+ *
37
+ * @param maximumHeight
38
+ * Maximum height.
39
+ *
40
+ * @param maximumWidth
41
+ * Maximum width.
42
+ *
43
+ * @param invocationContext
44
+ * Invocation context.
45
+ *
46
+ * @returns
47
+ * Matrix spilled within maximum height and maximum width.
48
+ */
49
+ spill(arrayValues: Matrix<unknown>, maximumHeight: Nullishable<number>, maximumWidth: Nullishable<number>, invocationContext: Nullishable<TInvocationContext>): Promise<MatrixResult<unknown, ThrowError, TError>>;
50
+ /**
51
+ * Get the logger messages as a stream.
52
+ *
53
+ * @param logLevelString
54
+ * Log level as string.
55
+ *
56
+ * @param streamingInvocationContext
57
+ * Streaming invocation context.
58
+ */
59
+ loggerMessages(logLevelString: Nullishable<string>, streamingInvocationContext: Nullishable<TStreamingInvocationContext>): void;
60
+ }
61
+ //# 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;AAEjH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA2CpE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAGa,cAAc,CAAC,UAAU,SAAS,OAAO,EAAE,MAAM,SAAS,YAAY,CAAC,UAAU,CAAC,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,OAAO,CAAE,SAAQ,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,OAAO,CAAC;;IACrP;;;;;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,kBAAkB,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IA4GxN;;;;;;;;OAQG;IAaH,cAAc,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,0BAA0B,EAAE,WAAW,CAAC,2BAA2B,CAAC,GAAG,IAAI;CA8ClI"}