@aidc-toolkit/core 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.
- package/dist/app-data-storage.d.ts +118 -0
- package/dist/app-data-storage.d.ts.map +1 -0
- package/dist/app-data-storage.js +117 -0
- package/dist/app-data-storage.js.map +1 -0
- package/dist/app-data.d.ts +26 -0
- package/dist/app-data.d.ts.map +1 -0
- package/dist/app-data.js +79 -0
- package/dist/app-data.js.map +1 -0
- package/dist/browser-app-data-storage.d.ts +26 -0
- package/dist/browser-app-data-storage.d.ts.map +1 -0
- package/dist/browser-app-data-storage.js +34 -0
- package/dist/browser-app-data-storage.js.map +1 -0
- package/dist/cache.d.ts +58 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +12 -0
- package/dist/cache.js.map +1 -0
- package/dist/file-app-data-storage.d.ts +27 -0
- package/dist/file-app-data-storage.d.ts.map +1 -0
- package/dist/file-app-data-storage.js +52 -0
- package/dist/file-app-data-storage.js.map +1 -0
- package/dist/http-fetch.d.ts +45 -0
- package/dist/http-fetch.d.ts.map +1 -0
- package/dist/http-fetch.js +26 -0
- package/dist/http-fetch.js.map +1 -0
- package/dist/hyperlink.d.ts +18 -0
- package/dist/hyperlink.d.ts.map +1 -0
- package/dist/hyperlink.js +2 -0
- package/dist/hyperlink.js.map +1 -0
- package/dist/index.d.ts +30 -821
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -0
- package/dist/local-app-data-storage.d.ts +8 -0
- package/dist/local-app-data-storage.d.ts.map +1 -0
- package/dist/local-app-data-storage.js +11 -0
- package/dist/local-app-data-storage.js.map +1 -0
- package/dist/locale/en/locale-resources.d.ts +10 -0
- package/dist/locale/en/locale-resources.d.ts.map +1 -0
- package/dist/locale/en/locale-resources.js +9 -0
- package/dist/locale/en/locale-resources.js.map +1 -0
- package/dist/locale/fr/locale-resources.d.ts +10 -0
- package/dist/locale/fr/locale-resources.d.ts.map +1 -0
- package/dist/locale/fr/locale-resources.js +9 -0
- package/dist/locale/fr/locale-resources.js.map +1 -0
- package/dist/locale/i18n.d.ts +95 -0
- package/dist/locale/i18n.d.ts.map +1 -0
- package/dist/locale/i18n.js +168 -0
- package/dist/locale/i18n.js.map +1 -0
- package/dist/logger.d.ts +136 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +256 -0
- package/dist/logger.js.map +1 -0
- package/dist/parse-version.d.ts +36 -0
- package/dist/parse-version.d.ts.map +1 -0
- package/dist/parse-version.js +23 -0
- package/dist/parse-version.js.map +1 -0
- package/dist/remote-app-data-storage.d.ts +23 -0
- package/dist/remote-app-data-storage.d.ts.map +1 -0
- package/dist/remote-app-data-storage.js +42 -0
- package/dist/remote-app-data-storage.js.map +1 -0
- package/dist/type-helper.d.ts +115 -0
- package/dist/type-helper.d.ts.map +1 -0
- package/dist/type-helper.js +163 -0
- package/dist/type-helper.js.map +1 -0
- package/dist/type.d.ts +111 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/website-url.d.ts +29 -0
- package/dist/website-url.d.ts.map +1 -0
- package/dist/website-url.js +60 -0
- package/dist/website-url.js.map +1 -0
- package/package.json +2 -2
- package/src/locale/i18n.ts +12 -6
- package/src/version.ts +1 -1
- package/tsconfig-src.tsbuildinfo +1 -1
- package/dist/browser-app-data-storage-G62WSQ5Z.js +0 -1
- package/dist/chunk-FIUBVWNN.js +0 -1
- package/dist/file-app-data-storage-M6RA7QOG.js +0 -1
- package/dist/index.cjs +0 -18
- package/dist/index.d.cts +0 -821
package/dist/index.d.ts
CHANGED
|
@@ -1,821 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Arbitrary abstract constructor. Abstract version of {@linkcode Constructor}.
|
|
33
|
-
*
|
|
34
|
-
* @template TConstructorParameters
|
|
35
|
-
* Constructor parameters types.
|
|
36
|
-
*
|
|
37
|
-
* @template TConstructorInstance
|
|
38
|
-
* Constructor instance type.
|
|
39
|
-
*/
|
|
40
|
-
type AbstractConstructor<TConstructorParameters extends unknown[], TConstructorInstance> = abstract new (...args: TConstructorParameters) => TConstructorInstance;
|
|
41
|
-
/**
|
|
42
|
-
* Typed constructor, applicable to any constructor.
|
|
43
|
-
*
|
|
44
|
-
* @template TConstructor
|
|
45
|
-
* Constructor type.
|
|
46
|
-
*/
|
|
47
|
-
type TypedConstructor<TConstructor extends abstract new (...args: ConstructorParameters<TConstructor>) => InstanceType<TConstructor>> = Constructor<ConstructorParameters<TConstructor>, InstanceType<TConstructor>>;
|
|
48
|
-
/**
|
|
49
|
-
* Typed abstract constructor, applicable to any constructor.
|
|
50
|
-
*
|
|
51
|
-
* @template TConstructor
|
|
52
|
-
* Constructor type.
|
|
53
|
-
*/
|
|
54
|
-
type TypedAbstractConstructor<TConstructor extends abstract new (...args: ConstructorParameters<TConstructor>) => InstanceType<TConstructor>> = AbstractConstructor<ConstructorParameters<TConstructor>, InstanceType<TConstructor>>;
|
|
55
|
-
/**
|
|
56
|
-
* Promisable type. Extends a type by allowing a {@linkcode Promise} of the same type. Typically used in abstract method
|
|
57
|
-
* declarations where the implementing class may or may not implement the method as asynchronous.
|
|
58
|
-
*/
|
|
59
|
-
type Promisable<T> = T | Promise<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Determine the fundamental promised type. This is stricter than `Awaited<Type>` in that it requires a {@linkcode
|
|
62
|
-
* Promise}.
|
|
63
|
-
*
|
|
64
|
-
* @template T
|
|
65
|
-
* Promised type.
|
|
66
|
-
*/
|
|
67
|
-
type PromisedType<T> = [T] extends [PromiseLike<infer TPromised>] ? TPromised : never;
|
|
68
|
-
/**
|
|
69
|
-
* Typed asynchronous function, applicable to any function that returns a {@linkcode Promise}.
|
|
70
|
-
*
|
|
71
|
-
* @template TFunction
|
|
72
|
-
* Function type.
|
|
73
|
-
*/
|
|
74
|
-
type TypedAsyncFunction<TMethod extends (...args: Parameters<TMethod>) => PromiseLike<PromisedType<ReturnType<TMethod>>>> = (...args: Parameters<TMethod>) => Promise<PromisedType<ReturnType<TMethod>>>;
|
|
75
|
-
/**
|
|
76
|
-
* Nullishable type. Extends a type by allowing `null` and `undefined`.
|
|
77
|
-
*
|
|
78
|
-
* @template T
|
|
79
|
-
* Type.
|
|
80
|
-
*/
|
|
81
|
-
type Nullishable<T> = T | null | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* Non-nullishable type. If T is an object type, it is spread and attributes within it are made non-nullishable.
|
|
84
|
-
* Equivalent to a deep `Required<T>` for an object and `NonNullable<T>` for any other type.
|
|
85
|
-
*
|
|
86
|
-
* @template T
|
|
87
|
-
* Type.
|
|
88
|
-
*/
|
|
89
|
-
type NonNullishable<T> = T extends object ? {
|
|
90
|
-
[P in keyof T]-?: NonNullishable<T[P]>;
|
|
91
|
-
} : NonNullable<T>;
|
|
92
|
-
/**
|
|
93
|
-
* Make some keys within a type optional.
|
|
94
|
-
*
|
|
95
|
-
* @template T
|
|
96
|
-
* Object type.
|
|
97
|
-
*
|
|
98
|
-
* @template K
|
|
99
|
-
* Object key type.
|
|
100
|
-
*/
|
|
101
|
-
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
102
|
-
/**
|
|
103
|
-
* Type to restrict property keys to those that are strings and that support a specified type.
|
|
104
|
-
*
|
|
105
|
-
* @template T
|
|
106
|
-
* Object type.
|
|
107
|
-
*
|
|
108
|
-
* @template P
|
|
109
|
-
* Object property type.
|
|
110
|
-
*/
|
|
111
|
-
type PropertyKeys<T, P> = {
|
|
112
|
-
[K in keyof T]: K extends string ? T[K] extends P ? K : never : never;
|
|
113
|
-
}[keyof T];
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Create an object with omitted entries.
|
|
117
|
-
*
|
|
118
|
-
* @template T
|
|
119
|
-
* Object type.
|
|
120
|
-
*
|
|
121
|
-
* @template K
|
|
122
|
-
* Object key type.
|
|
123
|
-
*
|
|
124
|
-
* @param o
|
|
125
|
-
* Object.
|
|
126
|
-
*
|
|
127
|
-
* @param keys
|
|
128
|
-
* Keys to omit.
|
|
129
|
-
*
|
|
130
|
-
* @returns
|
|
131
|
-
* Edited object.
|
|
132
|
-
*/
|
|
133
|
-
declare function omit<T extends object, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K>;
|
|
134
|
-
/**
|
|
135
|
-
* Create an object with picked entries.
|
|
136
|
-
*
|
|
137
|
-
* @template T
|
|
138
|
-
* Object type.
|
|
139
|
-
*
|
|
140
|
-
* @template K
|
|
141
|
-
* Object key type.
|
|
142
|
-
*
|
|
143
|
-
* @param o
|
|
144
|
-
* Object.
|
|
145
|
-
*
|
|
146
|
-
* @param keys
|
|
147
|
-
* Keys to pick.
|
|
148
|
-
*
|
|
149
|
-
* @returns
|
|
150
|
-
* Edited object.
|
|
151
|
-
*/
|
|
152
|
-
declare function pick<T extends object, K extends keyof T>(o: T, ...keys: K[]): Pick<T, K>;
|
|
153
|
-
/**
|
|
154
|
-
* Create an object from a wide object without entries matching those from a narrow object.
|
|
155
|
-
*
|
|
156
|
-
* @template TWide
|
|
157
|
-
* Wide object type.
|
|
158
|
-
*
|
|
159
|
-
* @template TNarrow
|
|
160
|
-
* Narrow object type.
|
|
161
|
-
*
|
|
162
|
-
* @template K
|
|
163
|
-
* Narrow object key type, subset of wide object key type.
|
|
164
|
-
*
|
|
165
|
-
* @param wide
|
|
166
|
-
* Wide object.
|
|
167
|
-
*
|
|
168
|
-
* @param narrow
|
|
169
|
-
* Narrow object.
|
|
170
|
-
*
|
|
171
|
-
* @returns
|
|
172
|
-
* Edited object.
|
|
173
|
-
*/
|
|
174
|
-
declare function exclude<TWide extends TNarrow, TNarrow extends object, K extends keyof TNarrow>(wide: TWide, narrow: TNarrow): Omit<TWide, K>;
|
|
175
|
-
/**
|
|
176
|
-
* Create an object from a wide object with entries matching those from a narrow object.
|
|
177
|
-
*
|
|
178
|
-
* @template TWide
|
|
179
|
-
* Wide object type.
|
|
180
|
-
*
|
|
181
|
-
* @template TNarrow
|
|
182
|
-
* Narrow object type.
|
|
183
|
-
*
|
|
184
|
-
* @template K
|
|
185
|
-
* Narrow object key type, subset of wide object key type.
|
|
186
|
-
*
|
|
187
|
-
* @param wide
|
|
188
|
-
* Wide object.
|
|
189
|
-
*
|
|
190
|
-
* @param narrow
|
|
191
|
-
* Narrow object.
|
|
192
|
-
*
|
|
193
|
-
* @returns
|
|
194
|
-
* Edited object.
|
|
195
|
-
*/
|
|
196
|
-
declare function include<TWide extends TNarrow, TNarrow extends object, K extends keyof TNarrow>(wide: TWide, narrow: TNarrow): Pick<TWide, K>;
|
|
197
|
-
/**
|
|
198
|
-
* Cast a property as a more narrow type.
|
|
199
|
-
*
|
|
200
|
-
* @template T
|
|
201
|
-
* Object type.
|
|
202
|
-
*
|
|
203
|
-
* @template K
|
|
204
|
-
* Object key type.
|
|
205
|
-
*
|
|
206
|
-
* @template TAsType
|
|
207
|
-
* Desired type.
|
|
208
|
-
*
|
|
209
|
-
* @param o
|
|
210
|
-
* Object.
|
|
211
|
-
*
|
|
212
|
-
* @param key
|
|
213
|
-
* Key of property to cast.
|
|
214
|
-
*
|
|
215
|
-
* @returns
|
|
216
|
-
* Single-key object with property cast as desired type.
|
|
217
|
-
*/
|
|
218
|
-
declare function propertyAs<T extends object, K extends keyof T, TAsType extends T[K]>(o: T, key: K): Readonly<Omit<T, K> extends T ? Partial<Record<K, TAsType>> : Record<K, TAsType>>;
|
|
219
|
-
/**
|
|
220
|
-
* Determine if argument is nullish. Application extension may pass `null` or `undefined` to missing parameters.
|
|
221
|
-
*
|
|
222
|
-
* @param argument
|
|
223
|
-
* Argument.
|
|
224
|
-
*
|
|
225
|
-
* @returns
|
|
226
|
-
* True if argument is undefined or null.
|
|
227
|
-
*/
|
|
228
|
-
declare function isNullish(argument: unknown): argument is null | undefined;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Log levels.
|
|
232
|
-
*/
|
|
233
|
-
declare const LogLevels: {
|
|
234
|
-
readonly Silly: 0;
|
|
235
|
-
readonly Trace: 1;
|
|
236
|
-
readonly Debug: 2;
|
|
237
|
-
readonly Info: 3;
|
|
238
|
-
readonly Warn: 4;
|
|
239
|
-
readonly Error: 5;
|
|
240
|
-
readonly Fatal: 6;
|
|
241
|
-
};
|
|
242
|
-
/**
|
|
243
|
-
* Log level key.
|
|
244
|
-
*/
|
|
245
|
-
type LogLevelKey = keyof typeof LogLevels;
|
|
246
|
-
/**
|
|
247
|
-
* Log level.
|
|
248
|
-
*/
|
|
249
|
-
type LogLevel = typeof LogLevels[LogLevelKey];
|
|
250
|
-
/**
|
|
251
|
-
* Get the log level enumeration value corresponding to a string or number.
|
|
252
|
-
*
|
|
253
|
-
* @param untypedLogLevel
|
|
254
|
-
* Untyped log level.
|
|
255
|
-
*
|
|
256
|
-
* @returns
|
|
257
|
-
* Typed log level or default `LogLevels.Info` if untyped log level not provided..
|
|
258
|
-
*/
|
|
259
|
-
declare function logLevelOf(untypedLogLevel?: string | number): LogLevel;
|
|
260
|
-
/**
|
|
261
|
-
* Get a logger with an optional log level. The underlying implementation is
|
|
262
|
-
* [`tslog`](https://tslog.js.org/).
|
|
263
|
-
*
|
|
264
|
-
* @param logLevel
|
|
265
|
-
* Log level as enumeration value or string. Mapped to `minLevel` and sets `hideLogPositionForProduction` to true in
|
|
266
|
-
* settings if at {@linkcode LogLevels.Info} or higher. Default is {@linkcode LogLevels.Info}.
|
|
267
|
-
*
|
|
268
|
-
* @param settings
|
|
269
|
-
* Detailed settings. See [`tslog`](https://tslog.js.org/#/?id=settings) documentation for details. The `minLevel` is
|
|
270
|
-
* ignored in favour of `logLevel` but `hideLogPositionForProduction` will override the default logic.
|
|
271
|
-
*
|
|
272
|
-
* @param logObj
|
|
273
|
-
* Default log object. See [`tslog`](https://tslog.js.org/#/?id=defining-and-accessing-logobj) documentation for
|
|
274
|
-
* details.
|
|
275
|
-
*
|
|
276
|
-
* @returns
|
|
277
|
-
* Logger.
|
|
278
|
-
*
|
|
279
|
-
* @template T
|
|
280
|
-
* Log object type.
|
|
281
|
-
*/
|
|
282
|
-
declare function getLogger<T extends object = object>(logLevel?: string | number, settings?: ISettingsParam<T>, logObj?: T): Logger<T>;
|
|
283
|
-
/**
|
|
284
|
-
* Get a loggable representation of a value. Values are returned unmodified, except as follows:
|
|
285
|
-
*
|
|
286
|
-
* - Big integers are converted to whole numbers where possible, otherwise as their decimal string representations.
|
|
287
|
-
* - Arrays are limited to a maximum of ten elements. Any array longer than ten elements is replaced with the first four
|
|
288
|
-
* elements, a string of three dots, and the last four elements. This may still create large results for
|
|
289
|
-
* multidimensional arrays.
|
|
290
|
-
* - Errors are converted to objects with `name`, `message`, and `stack` properties.
|
|
291
|
-
* - Symbols are converted to their string representations.
|
|
292
|
-
* - Functions are converted to strings of the form `Function(name)`.
|
|
293
|
-
*
|
|
294
|
-
* @param value
|
|
295
|
-
* Value.
|
|
296
|
-
*
|
|
297
|
-
* @returns
|
|
298
|
-
* Loggable value.
|
|
299
|
-
*/
|
|
300
|
-
declare function loggableValue(value: unknown): unknown;
|
|
301
|
-
/**
|
|
302
|
-
* Logger transport that stores messages in memory.
|
|
303
|
-
*/
|
|
304
|
-
declare class MemoryTransport<T extends object> {
|
|
305
|
-
#private;
|
|
306
|
-
/**
|
|
307
|
-
* Constructor.
|
|
308
|
-
*
|
|
309
|
-
* @param logger
|
|
310
|
-
* Logger.
|
|
311
|
-
*
|
|
312
|
-
* @param maximumLength
|
|
313
|
-
* Maximum length of messages array.
|
|
314
|
-
*
|
|
315
|
-
* @param truncateLength
|
|
316
|
-
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
317
|
-
* is 80% of `maximumLength`.
|
|
318
|
-
*/
|
|
319
|
-
constructor(logger: Logger<T>, maximumLength: number, truncateLength?: number);
|
|
320
|
-
/**
|
|
321
|
-
* Get the messages.
|
|
322
|
-
*/
|
|
323
|
-
get messages(): string[];
|
|
324
|
-
/**
|
|
325
|
-
* Get the maximum length of messages array.
|
|
326
|
-
*/
|
|
327
|
-
get maximumLength(): number;
|
|
328
|
-
/**
|
|
329
|
-
* Get the length to which messages array is truncated when maximum is reached.
|
|
330
|
-
*/
|
|
331
|
-
get truncateLength(): number;
|
|
332
|
-
/**
|
|
333
|
-
* Add a notification callback. If one already exists under the current name, do nothing.
|
|
334
|
-
*
|
|
335
|
-
* @param name
|
|
336
|
-
* Callback name.
|
|
337
|
-
*
|
|
338
|
-
* @param notificationCallback
|
|
339
|
-
* Callback.
|
|
340
|
-
*
|
|
341
|
-
* @returns
|
|
342
|
-
* True if successfully added.
|
|
343
|
-
*/
|
|
344
|
-
addNotificationCallback(name: string, notificationCallback: (message: string | undefined, messages: readonly string[]) => void): boolean;
|
|
345
|
-
/**
|
|
346
|
-
* Remove a notification callback.
|
|
347
|
-
*
|
|
348
|
-
* @param name
|
|
349
|
-
* Callback name.
|
|
350
|
-
*/
|
|
351
|
-
removeNotificationCallback(name: string): void;
|
|
352
|
-
/**
|
|
353
|
-
* Resize the messages array.
|
|
354
|
-
*
|
|
355
|
-
* @param maximumLength
|
|
356
|
-
* Maximum length of messages array.
|
|
357
|
-
*
|
|
358
|
-
* @param truncateLength
|
|
359
|
-
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
360
|
-
* is 80% of `maximumLength`.
|
|
361
|
-
*/
|
|
362
|
-
resize(maximumLength: number, truncateLength?: number): void;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Parsed version.
|
|
367
|
-
*/
|
|
368
|
-
interface ParsedVersion {
|
|
369
|
-
/**
|
|
370
|
-
* Major version.
|
|
371
|
-
*/
|
|
372
|
-
readonly majorVersion: number;
|
|
373
|
-
/**
|
|
374
|
-
* Minor version.
|
|
375
|
-
*/
|
|
376
|
-
readonly minorVersion: number;
|
|
377
|
-
/**
|
|
378
|
-
* Patch version.
|
|
379
|
-
*/
|
|
380
|
-
readonly patchVersion: number;
|
|
381
|
-
/**
|
|
382
|
-
* Pre-release identifier.
|
|
383
|
-
*/
|
|
384
|
-
readonly preReleaseIdentifier: string | undefined;
|
|
385
|
-
/**
|
|
386
|
-
* Date/time included with pre-release identifier.
|
|
387
|
-
*/
|
|
388
|
-
readonly dateTime: string | undefined;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Parse version.
|
|
392
|
-
*
|
|
393
|
-
* @param version
|
|
394
|
-
* Version, typically from package.json.
|
|
395
|
-
*
|
|
396
|
-
* @returns
|
|
397
|
-
* Parsed version.
|
|
398
|
-
*/
|
|
399
|
-
declare function parseVersion(version: string): ParsedVersion;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Alpha URL. Reads from local application storage, path "config", key "resources.local", if present, otherwise defaults
|
|
403
|
-
* to Vite development server URL.
|
|
404
|
-
*/
|
|
405
|
-
declare const ALPHA_URL: Promise<string>;
|
|
406
|
-
/**
|
|
407
|
-
* AIDC Toolkit website base URL.
|
|
408
|
-
*/
|
|
409
|
-
declare const WEBSITE_BASE_URL = "https://aidc-toolkit.com";
|
|
410
|
-
/**
|
|
411
|
-
* Determine the website URL based on the package version.
|
|
412
|
-
*
|
|
413
|
-
* @param version
|
|
414
|
-
* Package version.
|
|
415
|
-
*
|
|
416
|
-
* @param includeVersionInProduction
|
|
417
|
-
* If true, the version is included in the URL in production.
|
|
418
|
-
*
|
|
419
|
-
* @param alphaURL
|
|
420
|
-
* URL if pre-release identifier is "alpha".
|
|
421
|
-
*
|
|
422
|
-
* @param nonAlphaRelativeURL
|
|
423
|
-
* Non-alpha URL, relative to website base URL plus pre-release identifier (optional) and version.
|
|
424
|
-
*
|
|
425
|
-
* @returns
|
|
426
|
-
* Fully-formed website URL based on the package version.
|
|
427
|
-
*/
|
|
428
|
-
declare function websiteURL(version: string, includeVersionInProduction: boolean, alphaURL: string, nonAlphaRelativeURL?: string): string;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Application data.
|
|
432
|
-
*/
|
|
433
|
-
type AppData = string | number | boolean | object;
|
|
434
|
-
/**
|
|
435
|
-
* Decode application data from an encoded string.
|
|
436
|
-
*
|
|
437
|
-
* @param stringData
|
|
438
|
-
* String data.
|
|
439
|
-
*
|
|
440
|
-
* @returns
|
|
441
|
-
* Decoded application data.
|
|
442
|
-
*/
|
|
443
|
-
declare function decodeAppData(stringData: string): AppData | undefined;
|
|
444
|
-
/**
|
|
445
|
-
* Encode application data as a string for storage. Encoded string is in JSON format with date/time and binary data
|
|
446
|
-
* converted to identifiable strings for decoding.
|
|
447
|
-
*
|
|
448
|
-
* @param appData
|
|
449
|
-
* Application data.
|
|
450
|
-
*
|
|
451
|
-
* @returns
|
|
452
|
-
* Encoded application data.
|
|
453
|
-
*/
|
|
454
|
-
declare function encodeAppData(appData: AppData): string;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Generic read-only application data storage.
|
|
458
|
-
*/
|
|
459
|
-
declare abstract class ReadOnlyAppDataStorage<SupportsBinary extends boolean> {
|
|
460
|
-
#private;
|
|
461
|
-
/**
|
|
462
|
-
* Extension to identify binary data.
|
|
463
|
-
*/
|
|
464
|
-
protected static readonly BINARY_EXTENSION = ".bin";
|
|
465
|
-
/**
|
|
466
|
-
* Extension to identify JSON data.
|
|
467
|
-
*/
|
|
468
|
-
protected static readonly JSON_EXTENSION = ".json";
|
|
469
|
-
/**
|
|
470
|
-
* Constructor.
|
|
471
|
-
*
|
|
472
|
-
* @param supportsBinary
|
|
473
|
-
* True if binary data is supported.
|
|
474
|
-
*
|
|
475
|
-
* @param path
|
|
476
|
-
* Storage path prepended to each key along with '/' if defined, empty string if not.
|
|
477
|
-
*/
|
|
478
|
-
protected constructor(supportsBinary: SupportsBinary, path?: string);
|
|
479
|
-
/**
|
|
480
|
-
* Determine if binary data is supported.
|
|
481
|
-
*/
|
|
482
|
-
get supportsBinary(): SupportsBinary;
|
|
483
|
-
/**
|
|
484
|
-
* Get the storage path, prepended to each key.
|
|
485
|
-
*/
|
|
486
|
-
get path(): string;
|
|
487
|
-
/**
|
|
488
|
-
* Build the full storage key.
|
|
489
|
-
*
|
|
490
|
-
* @param pathKey
|
|
491
|
-
* Key relative to path.
|
|
492
|
-
*
|
|
493
|
-
* @param isBinary
|
|
494
|
-
* True if key is to binary data, false or undefined if to string data. Ignored if binary data is not supported.
|
|
495
|
-
*
|
|
496
|
-
* @returns
|
|
497
|
-
* Full storage key.
|
|
498
|
-
*/
|
|
499
|
-
protected fullKey(pathKey: string, isBinary: boolean): string;
|
|
500
|
-
/**
|
|
501
|
-
* Read a string or binary data from persistent storage.
|
|
502
|
-
*
|
|
503
|
-
* @param key
|
|
504
|
-
* Storage key (file path in Node.js, key in localStorage).
|
|
505
|
-
*
|
|
506
|
-
* @param asBinary
|
|
507
|
-
* True if binary data is requested, false or undefined if string data is requested. Ignored if binary data is not
|
|
508
|
-
* supported.
|
|
509
|
-
*
|
|
510
|
-
* @returns
|
|
511
|
-
* String or binary data or undefined if not found.
|
|
512
|
-
*/
|
|
513
|
-
protected abstract doRead(key: string, asBinary: boolean | undefined): Promisable<(SupportsBinary extends true ? string | Uint8Array : string) | undefined>;
|
|
514
|
-
/**
|
|
515
|
-
* Read application data from storage.
|
|
516
|
-
*
|
|
517
|
-
* @param pathKey
|
|
518
|
-
* Key relative to path.
|
|
519
|
-
*
|
|
520
|
-
* @param asBinary
|
|
521
|
-
* True if binary data is requested, false or undefined if string data is requested. Ignored if binary data is not
|
|
522
|
-
* supported.
|
|
523
|
-
*
|
|
524
|
-
* @returns
|
|
525
|
-
* Application data or undefined if not found.
|
|
526
|
-
*/
|
|
527
|
-
read(pathKey: string, asBinary?: boolean): Promise<AppData | undefined>;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Generic read/write application data storage.
|
|
531
|
-
*/
|
|
532
|
-
declare abstract class AppDataStorage<SupportsBinary extends boolean> extends ReadOnlyAppDataStorage<SupportsBinary> {
|
|
533
|
-
/**
|
|
534
|
-
* Write a string or binary data in persistent storage.
|
|
535
|
-
*
|
|
536
|
-
* @param key
|
|
537
|
-
* Storage key (file path in Node.js, key in localStorage).
|
|
538
|
-
*
|
|
539
|
-
* @param data
|
|
540
|
-
* String or binary data.
|
|
541
|
-
*/
|
|
542
|
-
protected abstract doWrite(key: string, data: SupportsBinary extends true ? string | Uint8Array : string): Promisable<void>;
|
|
543
|
-
/**
|
|
544
|
-
* Write application data to storage.
|
|
545
|
-
*
|
|
546
|
-
* @param pathKey
|
|
547
|
-
* Key relative to path.
|
|
548
|
-
*
|
|
549
|
-
* @param appData
|
|
550
|
-
* Application data to write.
|
|
551
|
-
*/
|
|
552
|
-
write(pathKey: string, appData: AppData): Promise<void>;
|
|
553
|
-
/**
|
|
554
|
-
* Delete from persistent storage.
|
|
555
|
-
*
|
|
556
|
-
* @param key
|
|
557
|
-
* Storage key (file path in Node.js, key in localStorage).
|
|
558
|
-
*/
|
|
559
|
-
protected abstract doDelete(key: string): Promisable<void>;
|
|
560
|
-
/**
|
|
561
|
-
* Delete application data from persistent storage.
|
|
562
|
-
*
|
|
563
|
-
* @param pathKey
|
|
564
|
-
* Key relative to path.
|
|
565
|
-
*
|
|
566
|
-
* @param asBinary
|
|
567
|
-
* True if key is to binary data, false or undefined if to string data. Ignored if binary data is not supported.
|
|
568
|
-
*/
|
|
569
|
-
delete(pathKey: string, asBinary?: boolean): Promise<void>;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Local application data storage class for the current environment. This is a variable representing a `Promise` as the
|
|
574
|
-
* implementing class is loaded dynamically to prevent the inclusion of unnecessary node dependencies in a browser
|
|
575
|
-
* environment.
|
|
576
|
-
*/
|
|
577
|
-
declare const LocalAppDataStorage: Promise<new (path?: string) => AppDataStorage<boolean>>;
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* HTTP status code for OK.
|
|
581
|
-
*/
|
|
582
|
-
declare const HTTP_OK = 200;
|
|
583
|
-
/**
|
|
584
|
-
* HTTP status code for not found.
|
|
585
|
-
*/
|
|
586
|
-
declare const HTTP_NOT_FOUND = 404;
|
|
587
|
-
/**
|
|
588
|
-
* Generic HTTP response.
|
|
589
|
-
*/
|
|
590
|
-
interface HTTPResponse {
|
|
591
|
-
/**
|
|
592
|
-
* True if OK.
|
|
593
|
-
*/
|
|
594
|
-
readonly ok: boolean;
|
|
595
|
-
/**
|
|
596
|
-
* HTTP status code.
|
|
597
|
-
*/
|
|
598
|
-
readonly status: number;
|
|
599
|
-
/**
|
|
600
|
-
* Body as array buffer.
|
|
601
|
-
*/
|
|
602
|
-
readonly arrayBuffer: () => Promisable<ArrayBuffer>;
|
|
603
|
-
/**
|
|
604
|
-
* Body as text.
|
|
605
|
-
*/
|
|
606
|
-
readonly text: () => Promisable<string>;
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* HTTP fetch function.
|
|
610
|
-
*/
|
|
611
|
-
type HTTPFetch = (url: string) => Promisable<HTTPResponse>;
|
|
612
|
-
/**
|
|
613
|
-
* Default HTTP fetch function using global `fetch` function.
|
|
614
|
-
*
|
|
615
|
-
* @param url
|
|
616
|
-
* URL.
|
|
617
|
-
*
|
|
618
|
-
* @returns
|
|
619
|
-
* HTTP response.
|
|
620
|
-
*/
|
|
621
|
-
declare function defaultHTTPFetch(url: string): Promise<HTTPResponse>;
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Remote application data storage using HTTP.
|
|
625
|
-
*/
|
|
626
|
-
declare class RemoteAppDataStorage extends ReadOnlyAppDataStorage<true> {
|
|
627
|
-
#private;
|
|
628
|
-
/**
|
|
629
|
-
* Constructor.
|
|
630
|
-
*
|
|
631
|
-
* @param baseURL
|
|
632
|
-
* Base URL. The URL must not end with a slash.
|
|
633
|
-
*
|
|
634
|
-
* @param httpFetch
|
|
635
|
-
* HTTP fetch function.
|
|
636
|
-
*/
|
|
637
|
-
constructor(baseURL: string, httpFetch?: HTTPFetch);
|
|
638
|
-
/**
|
|
639
|
-
* @inheritDoc
|
|
640
|
-
*/
|
|
641
|
-
protected doRead(key: string, asBinary: boolean | undefined): Promise<string | Uint8Array | undefined>;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Generic cache. Typically used to manage a local copy of remote data that is not refreshed regularly.
|
|
646
|
-
*
|
|
647
|
-
* @template TCache
|
|
648
|
-
* Type of cached data.
|
|
649
|
-
*
|
|
650
|
-
* @template TSource
|
|
651
|
-
* Type of source data. The type may be different from the cached data type if a transformation is required.
|
|
652
|
-
*/
|
|
653
|
-
declare abstract class Cache<TCache, TSource = TCache> {
|
|
654
|
-
/**
|
|
655
|
-
* Get the date/time at or after which the source should be checked for updates. If the value is undefined, this is
|
|
656
|
-
* the first usage.
|
|
657
|
-
*/
|
|
658
|
-
abstract get nextCheckDateTime(): Promisable<Date | undefined>;
|
|
659
|
-
/**
|
|
660
|
-
* Get the date/time at which the cache was last updated. This may more accurately reflect the date/time at which
|
|
661
|
-
* the last source retrieved was updated. If the value is undefined, there is no data in the cache.
|
|
662
|
-
*/
|
|
663
|
-
abstract get cacheDateTime(): Promisable<Date | undefined>;
|
|
664
|
-
/**
|
|
665
|
-
* Get the cache data. This should only ever be called if the cache date/time is defined.
|
|
666
|
-
*/
|
|
667
|
-
abstract get cacheData(): Promisable<TCache>;
|
|
668
|
-
/**
|
|
669
|
-
* Get the date/time at which the source was last updated. This should not be called unless the next check date/time
|
|
670
|
-
* has passed, as it may trigger an expensive remote retrieval.
|
|
671
|
-
*/
|
|
672
|
-
abstract get sourceDateTime(): Promisable<Date>;
|
|
673
|
-
/**
|
|
674
|
-
* Get the source data. This should not be called unless the next check date/time has passed, as it may trigger an
|
|
675
|
-
* expensive remote retrieval.
|
|
676
|
-
*/
|
|
677
|
-
abstract get sourceData(): Promisable<TSource>;
|
|
678
|
-
/**
|
|
679
|
-
* Update the cache with only the next check date/time. The cache date/time and cache data must not be modified.
|
|
680
|
-
* This is typically called when the cache is up to date with the source or source retrieval has failed.
|
|
681
|
-
*
|
|
682
|
-
* @param nextCheckDateTime
|
|
683
|
-
* Next check date/time.
|
|
684
|
-
*/
|
|
685
|
-
abstract update(nextCheckDateTime: Date): Promisable<void>;
|
|
686
|
-
/**
|
|
687
|
-
* Update all cache parameters. This is typically called when the cache is updated from the source.
|
|
688
|
-
*
|
|
689
|
-
* @param nextCheckDateTime
|
|
690
|
-
* Next check date/time.
|
|
691
|
-
*
|
|
692
|
-
* @param cacheDateTime
|
|
693
|
-
* Cache date/time.
|
|
694
|
-
*
|
|
695
|
-
* @param cacheData
|
|
696
|
-
* Cache data.
|
|
697
|
-
*/
|
|
698
|
-
abstract update(nextCheckDateTime: Date, cacheDateTime: Date, cacheData: TCache): Promisable<void>;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* Hyperlink.
|
|
703
|
-
*/
|
|
704
|
-
interface Hyperlink {
|
|
705
|
-
/**
|
|
706
|
-
* Reference, relative or absolute depending on the application.
|
|
707
|
-
*/
|
|
708
|
-
readonly reference: string;
|
|
709
|
-
/**
|
|
710
|
-
* Human-readable text.
|
|
711
|
-
*/
|
|
712
|
-
readonly text?: string | undefined;
|
|
713
|
-
/**
|
|
714
|
-
* Additional details.
|
|
715
|
-
*/
|
|
716
|
-
readonly details?: string | undefined;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
declare const _default: {
|
|
720
|
-
Logger: {
|
|
721
|
-
unknownLogLevel: string;
|
|
722
|
-
};
|
|
723
|
-
RemoteAppDataStorage: {
|
|
724
|
-
httpError: string;
|
|
725
|
-
};
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Locale strings type for generic manipulation.
|
|
730
|
-
*/
|
|
731
|
-
interface LocaleResources {
|
|
732
|
-
[key: string]: LocaleResources | string | undefined;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Internationalization language detectors.
|
|
736
|
-
*/
|
|
737
|
-
declare const I18nLanguageDetectors: {
|
|
738
|
-
/**
|
|
739
|
-
* Command-line interface (e.g., unit tests).
|
|
740
|
-
*/
|
|
741
|
-
readonly CLI: LanguageDetectorModule;
|
|
742
|
-
/**
|
|
743
|
-
* Web browser.
|
|
744
|
-
*/
|
|
745
|
-
readonly Browser: Newable<LanguageDetectorModule>;
|
|
746
|
-
};
|
|
747
|
-
/**
|
|
748
|
-
* Internationalization language detector.
|
|
749
|
-
*/
|
|
750
|
-
type I18nLanguageDetector = LanguageDetectorModule | Newable<LanguageDetectorModule> | NewableModule<LanguageDetectorModule>;
|
|
751
|
-
/**
|
|
752
|
-
* Determine if a key exists.
|
|
753
|
-
*
|
|
754
|
-
* @param i18next
|
|
755
|
-
* Internationalization object.
|
|
756
|
-
*
|
|
757
|
-
* @param key
|
|
758
|
-
* Key to check.
|
|
759
|
-
*
|
|
760
|
-
* @param options
|
|
761
|
-
* Options.
|
|
762
|
-
*
|
|
763
|
-
* @returns
|
|
764
|
-
* True if key exists in the specified namespace with the given options.
|
|
765
|
-
*/
|
|
766
|
-
declare function isI18nParseKey<TNamespace extends Namespace = DefaultNamespace, TNamespaceOptions extends TOptions = TNamespace extends DefaultNamespace ? {
|
|
767
|
-
ns?: DefaultNamespace;
|
|
768
|
-
} : {
|
|
769
|
-
ns: TNamespace;
|
|
770
|
-
}>(i18next: i18n, key: string, options?: TNamespaceOptions): key is ParseKeys<TNamespace, TNamespaceOptions>;
|
|
771
|
-
declare const coreNS = "aidct_core";
|
|
772
|
-
/**
|
|
773
|
-
* Locale resources type is extracted from the English locale resources object.
|
|
774
|
-
*/
|
|
775
|
-
type CoreLocaleResources = typeof _default;
|
|
776
|
-
/**
|
|
777
|
-
* Core resource bundle.
|
|
778
|
-
*/
|
|
779
|
-
declare const coreResourceBundle: Resource;
|
|
780
|
-
declare const i18nextCore: i18n;
|
|
781
|
-
/**
|
|
782
|
-
* Initialize internationalization.
|
|
783
|
-
*
|
|
784
|
-
* @param i18next
|
|
785
|
-
* Internationalization object. As multiple objects exist, this parameter represents the one for the module for which
|
|
786
|
-
* internationalization is being initialized.
|
|
787
|
-
*
|
|
788
|
-
* @param languageDetector
|
|
789
|
-
* Language detector.
|
|
790
|
-
*
|
|
791
|
-
* @param debug
|
|
792
|
-
* Debug setting.
|
|
793
|
-
*
|
|
794
|
-
* @param defaultNS
|
|
795
|
-
* Default namespace.
|
|
796
|
-
*
|
|
797
|
-
* @param defaultResourceBundle
|
|
798
|
-
* Default resource bundle.
|
|
799
|
-
*
|
|
800
|
-
* @param i18nDependencyInits
|
|
801
|
-
* Dependency internationalization initialization functions.
|
|
802
|
-
*
|
|
803
|
-
* @returns
|
|
804
|
-
* Default resource bundle.
|
|
805
|
-
*/
|
|
806
|
-
declare function i18nInit(i18next: i18n, languageDetector: I18nLanguageDetector, debug: boolean, defaultNS: string, defaultResourceBundle: Resource, ...i18nDependencyInits: Array<(languageDetector: I18nLanguageDetector, debug: boolean) => Promise<Resource>>): Promise<Resource>;
|
|
807
|
-
/**
|
|
808
|
-
* Initialize internationalization.
|
|
809
|
-
*
|
|
810
|
-
* @param languageDetector
|
|
811
|
-
* Language detector.
|
|
812
|
-
*
|
|
813
|
-
* @param debug
|
|
814
|
-
* Debug setting.
|
|
815
|
-
*
|
|
816
|
-
* @returns
|
|
817
|
-
* Core resource bundle.
|
|
818
|
-
*/
|
|
819
|
-
declare function i18nCoreInit(languageDetector: I18nLanguageDetector, debug?: boolean): Promise<Resource>;
|
|
820
|
-
|
|
821
|
-
export { ALPHA_URL, type AbstractConstructor, type AppData, AppDataStorage, Cache, type Constructor, type CoreLocaleResources, type HTTPFetch, type HTTPResponse, HTTP_NOT_FOUND, HTTP_OK, type Hyperlink, type I18nLanguageDetector, I18nLanguageDetectors, LocalAppDataStorage, type LocaleResources, type LogLevel, type LogLevelKey, LogLevels, MemoryTransport, type NonNullishable, type Nullishable, type Optional, type ParsedVersion, type Promisable, type PromisedType, type PropertyKeys, ReadOnlyAppDataStorage, RemoteAppDataStorage, type TypedAbstractConstructor, type TypedAsyncFunction, type TypedConstructor, type TypedFunction, type TypedSyncFunction, WEBSITE_BASE_URL, coreNS, coreResourceBundle, decodeAppData, defaultHTTPFetch, encodeAppData, exclude, getLogger, i18nCoreInit, i18nInit, i18nextCore, include, isI18nParseKey, isNullish, logLevelOf, loggableValue, omit, parseVersion, pick, propertyAs, websiteURL };
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright © 2024-2026 Dolphin Data Development Ltd. and AIDC Toolkit
|
|
3
|
+
* contributors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export type * from "./type.js";
|
|
18
|
+
export * from "./type-helper.js";
|
|
19
|
+
export * from "./logger.js";
|
|
20
|
+
export * from "./parse-version.js";
|
|
21
|
+
export * from "./website-url.js";
|
|
22
|
+
export * from "./app-data.js";
|
|
23
|
+
export * from "./app-data-storage.js";
|
|
24
|
+
export * from "./local-app-data-storage.js";
|
|
25
|
+
export * from "./http-fetch.js";
|
|
26
|
+
export * from "./remote-app-data-storage.js";
|
|
27
|
+
export * from "./cache.js";
|
|
28
|
+
export type * from "./hyperlink.js";
|
|
29
|
+
export * from "./locale/i18n.js";
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|