@aidc-toolkit/app-extension 1.0.46 → 1.0.47-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-extension.d.ts +198 -0
- package/dist/app-extension.d.ts.map +1 -0
- package/dist/app-extension.js +133 -0
- package/dist/app-extension.js.map +1 -0
- package/dist/app-helper-proxy.d.ts +61 -0
- package/dist/app-helper-proxy.d.ts.map +1 -0
- package/dist/app-helper-proxy.js +333 -0
- package/dist/app-helper-proxy.js.map +1 -0
- package/dist/{descriptor-FJHoLlYK.d.cts → descriptor.d.ts} +13 -13
- package/dist/descriptor.d.ts.map +1 -0
- package/dist/descriptor.js +44 -0
- package/dist/descriptor.js.map +1 -0
- package/dist/generator/{index.d.cts → generator.d.ts} +7 -9
- package/dist/generator/generator.d.ts.map +1 -0
- package/dist/generator/generator.js +190 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/index.d.ts +17 -125
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +2 -1
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/locale-resources-generator.d.ts +2 -0
- package/dist/generator/locale-resources-generator.d.ts.map +1 -0
- package/dist/generator/locale-resources-generator.js +312 -0
- package/dist/generator/locale-resources-generator.js.map +1 -0
- package/dist/gs1/character-set-proxy.d.ts +13 -0
- package/dist/gs1/character-set-proxy.d.ts.map +1 -0
- package/dist/gs1/character-set-proxy.js +126 -0
- package/dist/gs1/character-set-proxy.js.map +1 -0
- package/dist/gs1/check-proxy.d.ts +11 -0
- package/dist/gs1/check-proxy.d.ts.map +1 -0
- package/dist/gs1/check-proxy.js +163 -0
- package/dist/gs1/check-proxy.js.map +1 -0
- package/dist/gs1/gcp-length-proxy.d.ts +11 -0
- package/dist/gs1/gcp-length-proxy.d.ts.map +1 -0
- package/dist/gs1/gcp-length-proxy.js +190 -0
- package/dist/gs1/gcp-length-proxy.js.map +1 -0
- package/dist/gs1/gtin-creator-proxy.d.ts +10 -0
- package/dist/gs1/gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-creator-proxy.js +85 -0
- package/dist/gs1/gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/gtin-descriptor.d.ts +3 -0
- package/dist/gs1/gtin-descriptor.d.ts.map +1 -0
- package/dist/gs1/gtin-descriptor.js +8 -0
- package/dist/gs1/gtin-descriptor.js.map +1 -0
- package/dist/gs1/gtin-validator-proxy.d.ts +26 -0
- package/dist/gs1/gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/gtin-validator-proxy.js +256 -0
- package/dist/gs1/gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/identifier-creator-proxy.d.ts +30 -0
- package/dist/gs1/identifier-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-creator-proxy.js +318 -0
- package/dist/gs1/identifier-creator-proxy.js.map +1 -0
- package/dist/gs1/identifier-descriptor.d.ts +4 -0
- package/dist/gs1/identifier-descriptor.d.ts.map +1 -0
- package/dist/gs1/identifier-descriptor.js +14 -0
- package/dist/gs1/identifier-descriptor.js.map +1 -0
- package/dist/gs1/identifier-type.d.ts +22 -0
- package/dist/gs1/identifier-type.d.ts.map +1 -0
- package/dist/gs1/identifier-type.js +34 -0
- package/dist/gs1/identifier-type.js.map +1 -0
- package/dist/gs1/identifier-validator-proxy.d.ts +29 -0
- package/dist/gs1/identifier-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/identifier-validator-proxy.js +212 -0
- package/dist/gs1/identifier-validator-proxy.js.map +1 -0
- package/dist/gs1/index.d.ts +11 -0
- package/dist/gs1/index.d.ts.map +1 -0
- package/dist/gs1/index.js +11 -0
- package/dist/gs1/index.js.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts +38 -0
- package/dist/gs1/non-gtin-creator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-creator-proxy.js +301 -0
- package/dist/gs1/non-gtin-creator-proxy.js.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts +37 -0
- package/dist/gs1/non-gtin-validator-proxy.d.ts.map +1 -0
- package/dist/gs1/non-gtin-validator-proxy.js +302 -0
- package/dist/gs1/non-gtin-validator-proxy.js.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts +4 -0
- package/dist/gs1/prefix-definition-descriptor.d.ts.map +1 -0
- package/dist/gs1/prefix-definition-descriptor.js +16 -0
- package/dist/gs1/prefix-definition-descriptor.js.map +1 -0
- package/dist/gs1/prefix-manager-proxy.d.ts +8 -0
- package/dist/gs1/prefix-manager-proxy.d.ts.map +1 -0
- package/dist/gs1/prefix-manager-proxy.js +94 -0
- package/dist/gs1/prefix-manager-proxy.js.map +1 -0
- package/dist/gs1/variable-measure-proxy.d.ts +7 -0
- package/dist/gs1/variable-measure-proxy.d.ts.map +1 -0
- package/dist/gs1/variable-measure-proxy.js +114 -0
- package/dist/gs1/variable-measure-proxy.js.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts +7 -0
- package/dist/gs1/verified-by-gs1-proxy.d.ts.map +1 -0
- package/dist/gs1/verified-by-gs1-proxy.js +106 -0
- package/dist/gs1/verified-by-gs1-proxy.js.map +1 -0
- package/dist/index.d.ts +25 -1557
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -0
- package/dist/lib-proxy.d.ts +135 -0
- package/dist/lib-proxy.d.ts.map +1 -0
- package/dist/lib-proxy.js +276 -0
- package/dist/lib-proxy.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +752 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +751 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +752 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +751 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +27 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +36 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/proxy.d.ts +136 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +295 -0
- package/dist/proxy.js.map +1 -0
- package/dist/streaming.d.ts +10 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +2 -0
- package/dist/streaming.js.map +1 -0
- package/dist/type.d.ts +91 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/utility/character-set-descriptor.d.ts +6 -0
- package/dist/utility/character-set-descriptor.d.ts.map +1 -0
- package/dist/utility/character-set-descriptor.js +28 -0
- package/dist/utility/character-set-descriptor.js.map +1 -0
- package/dist/utility/character-set-proxy.d.ts +31 -0
- package/dist/utility/character-set-proxy.d.ts.map +1 -0
- package/dist/utility/character-set-proxy.js +278 -0
- package/dist/utility/character-set-proxy.js.map +1 -0
- package/dist/utility/index.d.ts +4 -0
- package/dist/utility/index.d.ts.map +1 -0
- package/dist/utility/index.js +4 -0
- package/dist/utility/index.js.map +1 -0
- package/dist/utility/reg-exp-proxy.d.ts +8 -0
- package/dist/utility/reg-exp-proxy.d.ts.map +1 -0
- package/dist/utility/reg-exp-proxy.js +103 -0
- package/dist/utility/reg-exp-proxy.js.map +1 -0
- package/dist/utility/string-descriptor.d.ts +4 -0
- package/dist/utility/string-descriptor.d.ts.map +1 -0
- package/dist/utility/string-descriptor.js +12 -0
- package/dist/utility/string-descriptor.js.map +1 -0
- package/dist/utility/string-proxy.d.ts +7 -0
- package/dist/utility/string-proxy.d.ts.map +1 -0
- package/dist/utility/string-proxy.js +63 -0
- package/dist/utility/string-proxy.js.map +1 -0
- package/dist/utility/transformer-descriptor.d.ts +6 -0
- package/dist/utility/transformer-descriptor.d.ts.map +1 -0
- package/dist/utility/transformer-descriptor.js +24 -0
- package/dist/utility/transformer-descriptor.js.map +1 -0
- package/dist/utility/transformer-proxy.d.ts +9 -0
- package/dist/utility/transformer-proxy.d.ts.map +1 -0
- package/dist/utility/transformer-proxy.js +111 -0
- package/dist/utility/transformer-proxy.js.map +1 -0
- package/package.json +6 -5
- package/src/app-extension.ts +6 -0
- package/src/gs1/gcp-length-proxy.ts +1 -1
- package/src/gs1/identifier-creator-proxy.ts +21 -2
- package/src/index.ts +0 -1
- package/tsconfig-src.tsbuildinfo +1 -1
- package/tsup.config.ts +1 -1
- package/dist/chunk-FAD3UX6B.js +0 -1
- package/dist/descriptor-FJHoLlYK.d.ts +0 -197
- package/dist/generator/index.cjs +0 -17
- package/dist/index.cjs +0 -17
- package/dist/index.d.cts +0 -1557
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { type AppDataStorage, type HTTPFetch, 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
|
+
* Get HTTP fetch function.
|
|
150
|
+
*/
|
|
151
|
+
abstract get httpFetch(): HTTPFetch;
|
|
152
|
+
/**
|
|
153
|
+
* Validate a sequence count against the maximum supported by application.
|
|
154
|
+
*
|
|
155
|
+
* @param sequenceCount
|
|
156
|
+
* Sequence count.
|
|
157
|
+
*/
|
|
158
|
+
validateSequenceCount(sequenceCount: number): void;
|
|
159
|
+
/**
|
|
160
|
+
* Map big integer to another type if necessary.
|
|
161
|
+
*
|
|
162
|
+
* @param value
|
|
163
|
+
* Big integer value to map.
|
|
164
|
+
*
|
|
165
|
+
* @returns
|
|
166
|
+
* Mapped big integer value.
|
|
167
|
+
*/
|
|
168
|
+
abstract mapBigInt(value: bigint): SingletonResult<TBigInt, ThrowError, TError>;
|
|
169
|
+
/**
|
|
170
|
+
* Map hyperlink results to a form suitable for the application.
|
|
171
|
+
*
|
|
172
|
+
* @param invocationContext
|
|
173
|
+
* Invocation context.
|
|
174
|
+
*
|
|
175
|
+
* @param matrixHyperlinkResults
|
|
176
|
+
* Matrix of hyperlink results from function call.
|
|
177
|
+
*
|
|
178
|
+
* @returns
|
|
179
|
+
* Matrix of results in a form suitable for the application.
|
|
180
|
+
*/
|
|
181
|
+
abstract mapHyperlinkResults(invocationContext: TInvocationContext, matrixHyperlinkResults: MatrixResult<Hyperlink, ThrowError, TError>): Promisable<MatrixResult<unknown, ThrowError, TError>>;
|
|
182
|
+
/**
|
|
183
|
+
* Map a range error (thrown by the library) to an application-specific error. If errors are reported through the
|
|
184
|
+
* throw/catch mechanism, the implementation may return the range error unmodified if that is supported.
|
|
185
|
+
*
|
|
186
|
+
* @param rangeError
|
|
187
|
+
*/
|
|
188
|
+
abstract mapRangeError(rangeError: RangeError): TError;
|
|
189
|
+
/**
|
|
190
|
+
* Handle an error with a message; called when an exception occurs outside the control of the AIDC Toolkit library.
|
|
191
|
+
* Implementation must not return, most likely by throwing the message wrapped in an error type.
|
|
192
|
+
*
|
|
193
|
+
* @param message
|
|
194
|
+
* Message to include in the error.
|
|
195
|
+
*/
|
|
196
|
+
abstract handleError(message: string): never;
|
|
197
|
+
}
|
|
198
|
+
//# 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;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,QAA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CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC;IAE/D;;OAEG;IACH,QAAQ,KAAK,sBAAsB,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/D;;OAEG;IACH,QAAQ,KAAK,oBAAoB,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAE7D;;OAEG;IACH,QAAQ,KAAK,SAAS,IAAI,SAAS,CAAC;IAEpC;;;;;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,EAGT,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"}
|