@aidc-toolkit/core 1.0.31-beta → 1.0.33-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/README.md +98 -87
- 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 +26 -0
- package/dist/file-app-data-storage.d.ts.map +1 -0
- package/dist/file-app-data-storage.js +40 -0
- package/dist/file-app-data-storage.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 +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- 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 +33 -6
- package/dist/locale/i18n.d.ts.map +1 -1
- package/dist/locale/i18n.js +76 -31
- package/dist/locale/i18n.js.map +1 -1
- package/dist/logger.d.ts +108 -4
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +227 -12
- package/dist/logger.js.map +1 -1
- package/dist/remote-app-data-storage.d.ts +18 -0
- package/dist/remote-app-data-storage.d.ts.map +1 -0
- package/dist/remote-app-data-storage.js +37 -0
- package/dist/remote-app-data-storage.js.map +1 -0
- package/dist/type-helper.js.map +1 -1
- package/dist/type.d.ts +5 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +10 -8
- package/src/app-data-storage.ts +166 -0
- package/src/app-data.ts +94 -0
- package/src/browser-app-data-storage.ts +37 -0
- package/src/cache.ts +64 -0
- package/src/file-app-data-storage.ts +49 -0
- package/src/hyperlink.ts +19 -0
- package/src/index.ts +10 -0
- package/src/local-app-data-storage.ts +12 -0
- package/src/locale/en/locale-resources.ts +8 -0
- package/src/locale/fr/locale-resources.ts +8 -0
- package/src/locale/i18n.ts +102 -36
- package/src/locale/i18next.d.ts +16 -0
- package/src/logger.ts +250 -13
- package/src/remote-app-data-storage.ts +38 -0
- package/src/type-helper.ts +2 -2
- package/src/type.ts +6 -0
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from "tslog";
|
|
1
|
+
import { type ISettingsParam, Logger } from "tslog";
|
|
2
2
|
/**
|
|
3
3
|
* Log levels.
|
|
4
4
|
*/
|
|
@@ -20,13 +20,117 @@ export type LogLevelKey = keyof typeof LogLevels;
|
|
|
20
20
|
*/
|
|
21
21
|
export type LogLevel = typeof LogLevels[LogLevelKey];
|
|
22
22
|
/**
|
|
23
|
-
* Get
|
|
23
|
+
* Get the log level enumeration value corresponding to a string or number.
|
|
24
|
+
*
|
|
25
|
+
* @param untypedLogLevel
|
|
26
|
+
* Untyped log level.
|
|
27
|
+
*
|
|
28
|
+
* @returns
|
|
29
|
+
* Typed log level or default `LogLevels.Info` if untyped log level not provided..
|
|
30
|
+
*/
|
|
31
|
+
export declare function logLevelOf(untypedLogLevel?: string | number): LogLevel;
|
|
32
|
+
/**
|
|
33
|
+
* Get a logger with an optional log level. The underlying implementation is
|
|
34
|
+
* [`tslog`](https://tslog.js.org/).
|
|
24
35
|
*
|
|
25
36
|
* @param logLevel
|
|
26
|
-
* Log level as enumeration value or string.
|
|
37
|
+
* Log level as enumeration value or string. Mapped to `minLevel` and sets `hideLogPositionForProduction` to true in
|
|
38
|
+
* settings if at {@linkcode LogLevels.Info} or higher. Default is {@linkcode LogLevels.Info}.
|
|
39
|
+
*
|
|
40
|
+
* @param settings
|
|
41
|
+
* Detailed settings. See [`tslog`](https://tslog.js.org/#/?id=settings) documentation for details. The `minLevel` is
|
|
42
|
+
* ignored in favour of `logLevel` but `hideLogPositionForProduction` will override the default logic.
|
|
43
|
+
*
|
|
44
|
+
* @param logObj
|
|
45
|
+
* Default log object. See [`tslog`](https://tslog.js.org/#/?id=defining-and-accessing-logobj) documentation for
|
|
46
|
+
* details.
|
|
27
47
|
*
|
|
28
48
|
* @returns
|
|
29
49
|
* Logger.
|
|
50
|
+
*
|
|
51
|
+
* @template T
|
|
52
|
+
* Log object type.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getLogger<T extends object = object>(logLevel?: string | number, settings?: ISettingsParam<T>, logObj?: T): Logger<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Get a loggable representation of a value. Values are returned unmodified, except as follows:
|
|
57
|
+
*
|
|
58
|
+
* - Big integers are converted to whole numbers where possible, otherwise as their decimal string representations.
|
|
59
|
+
* - Arrays are limited to a maximum of ten elements. Any array longer than ten elements is replaced with the first four
|
|
60
|
+
* elements, a string of three dots, and the last four elements. This may still create large results for
|
|
61
|
+
* multidimensional arrays.
|
|
62
|
+
* - Errors are converted to objects with `name`, `message`, and `stack` properties.
|
|
63
|
+
* - Symbols are converted to their string representations.
|
|
64
|
+
* - Functions are converted to strings of the form `Function(name)`.
|
|
65
|
+
*
|
|
66
|
+
* @param value
|
|
67
|
+
* Value.
|
|
68
|
+
*
|
|
69
|
+
* @returns
|
|
70
|
+
* Loggable value.
|
|
71
|
+
*/
|
|
72
|
+
export declare function loggableValue(value: unknown): unknown;
|
|
73
|
+
/**
|
|
74
|
+
* Logger transport that stores messages in memory.
|
|
30
75
|
*/
|
|
31
|
-
export declare
|
|
76
|
+
export declare class MemoryTransport<T extends object> {
|
|
77
|
+
#private;
|
|
78
|
+
/**
|
|
79
|
+
* Constructor.
|
|
80
|
+
*
|
|
81
|
+
* @param logger
|
|
82
|
+
* Logger.
|
|
83
|
+
*
|
|
84
|
+
* @param maximumLength
|
|
85
|
+
* Maximum length of messages array.
|
|
86
|
+
*
|
|
87
|
+
* @param truncateLength
|
|
88
|
+
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
89
|
+
* is 80% of `maximumLength`.
|
|
90
|
+
*/
|
|
91
|
+
constructor(logger: Logger<T>, maximumLength: number, truncateLength?: number);
|
|
92
|
+
/**
|
|
93
|
+
* Get the messages.
|
|
94
|
+
*/
|
|
95
|
+
get messages(): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Get the maximum length of messages array.
|
|
98
|
+
*/
|
|
99
|
+
get maximumLength(): number;
|
|
100
|
+
/**
|
|
101
|
+
* Get the length to which messages array is truncated when maximum is reached.
|
|
102
|
+
*/
|
|
103
|
+
get truncateLength(): number;
|
|
104
|
+
/**
|
|
105
|
+
* Add a notification callback. If one already exists under the current name, do nothing.
|
|
106
|
+
*
|
|
107
|
+
* @param name
|
|
108
|
+
* Callback name.
|
|
109
|
+
*
|
|
110
|
+
* @param notificationCallback
|
|
111
|
+
* Callback.
|
|
112
|
+
*
|
|
113
|
+
* @returns
|
|
114
|
+
* True if successfully added.
|
|
115
|
+
*/
|
|
116
|
+
addNotificationCallback(name: string, notificationCallback: (message: string | undefined, messages: readonly string[]) => void): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Remove a notification callback.
|
|
119
|
+
*
|
|
120
|
+
* @param name
|
|
121
|
+
* Callback name.
|
|
122
|
+
*/
|
|
123
|
+
removeNotificationCallback(name: string): void;
|
|
124
|
+
/**
|
|
125
|
+
* Resize the messages array.
|
|
126
|
+
*
|
|
127
|
+
* @param maximumLength
|
|
128
|
+
* Maximum length of messages array.
|
|
129
|
+
*
|
|
130
|
+
* @param truncateLength
|
|
131
|
+
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
132
|
+
* is 80% of `maximumLength`.
|
|
133
|
+
*/
|
|
134
|
+
resize(maximumLength: number, truncateLength?: number): void;
|
|
135
|
+
}
|
|
32
136
|
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGpD;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CA2BtE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAUpI;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA4CrD;AAED;;GAEG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,MAAM;;IAqBzC;;;;;;;;;;;;OAYG;gBACS,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAoB7E;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,EAAE,CAEvB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;;;;;;;;;OAWG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO;IAaxI;;;;;OAKG;IACH,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9C;;;;;;;;;OASG;IACH,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;CAI/D"}
|
package/dist/logger.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Logger } from "tslog";
|
|
2
|
+
import { i18nextCore } from "./locale/i18n.js";
|
|
2
3
|
/**
|
|
3
4
|
* Log levels.
|
|
4
5
|
*/
|
|
@@ -12,30 +13,244 @@ export const LogLevels = {
|
|
|
12
13
|
Fatal: 6
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
|
-
* Get
|
|
16
|
+
* Get the log level enumeration value corresponding to a string or number.
|
|
16
17
|
*
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
18
|
+
* @param untypedLogLevel
|
|
19
|
+
* Untyped log level.
|
|
19
20
|
*
|
|
20
21
|
* @returns
|
|
21
|
-
*
|
|
22
|
+
* Typed log level or default `LogLevels.Info` if untyped log level not provided..
|
|
22
23
|
*/
|
|
23
|
-
export function
|
|
24
|
-
let
|
|
25
|
-
if (typeof
|
|
26
|
-
if (
|
|
24
|
+
export function logLevelOf(untypedLogLevel) {
|
|
25
|
+
let typedLogLevel;
|
|
26
|
+
if (typeof untypedLogLevel === "string") {
|
|
27
|
+
if (untypedLogLevel in LogLevels) {
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- String exists as a key.
|
|
28
|
-
|
|
29
|
+
typedLogLevel = LogLevels[untypedLogLevel];
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
|
-
throw new
|
|
32
|
+
throw new RangeError(i18nextCore.t("Logger.unknownLogLevel", {
|
|
33
|
+
logLevel: untypedLogLevel
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else if (untypedLogLevel !== undefined) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Assume that valid log level has been provided.
|
|
39
|
+
if (Object.values(LogLevels).includes(untypedLogLevel)) {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Valid log level has been provided.
|
|
41
|
+
typedLogLevel = untypedLogLevel;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw new RangeError(i18nextCore.t("Logger.unknownLogLevel", {
|
|
45
|
+
logLevel: untypedLogLevel
|
|
46
|
+
}));
|
|
32
47
|
}
|
|
33
48
|
}
|
|
34
49
|
else {
|
|
35
|
-
|
|
50
|
+
typedLogLevel = LogLevels.Info;
|
|
36
51
|
}
|
|
52
|
+
return typedLogLevel;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get a logger with an optional log level. The underlying implementation is
|
|
56
|
+
* [`tslog`](https://tslog.js.org/).
|
|
57
|
+
*
|
|
58
|
+
* @param logLevel
|
|
59
|
+
* Log level as enumeration value or string. Mapped to `minLevel` and sets `hideLogPositionForProduction` to true in
|
|
60
|
+
* settings if at {@linkcode LogLevels.Info} or higher. Default is {@linkcode LogLevels.Info}.
|
|
61
|
+
*
|
|
62
|
+
* @param settings
|
|
63
|
+
* Detailed settings. See [`tslog`](https://tslog.js.org/#/?id=settings) documentation for details. The `minLevel` is
|
|
64
|
+
* ignored in favour of `logLevel` but `hideLogPositionForProduction` will override the default logic.
|
|
65
|
+
*
|
|
66
|
+
* @param logObj
|
|
67
|
+
* Default log object. See [`tslog`](https://tslog.js.org/#/?id=defining-and-accessing-logobj) documentation for
|
|
68
|
+
* details.
|
|
69
|
+
*
|
|
70
|
+
* @returns
|
|
71
|
+
* Logger.
|
|
72
|
+
*
|
|
73
|
+
* @template T
|
|
74
|
+
* Log object type.
|
|
75
|
+
*/
|
|
76
|
+
export function getLogger(logLevel, settings, logObj) {
|
|
77
|
+
const minLevel = logLevelOf(logLevel);
|
|
37
78
|
return new Logger({
|
|
79
|
+
// Hiding log position for production can be overridden in settings parameter.
|
|
80
|
+
hideLogPositionForProduction: minLevel >= LogLevels.Info,
|
|
81
|
+
...settings ?? {},
|
|
82
|
+
// Minimum log level overrides settings parameter.
|
|
38
83
|
minLevel
|
|
39
|
-
});
|
|
84
|
+
}, logObj);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get a loggable representation of a value. Values are returned unmodified, except as follows:
|
|
88
|
+
*
|
|
89
|
+
* - Big integers are converted to whole numbers where possible, otherwise as their decimal string representations.
|
|
90
|
+
* - Arrays are limited to a maximum of ten elements. Any array longer than ten elements is replaced with the first four
|
|
91
|
+
* elements, a string of three dots, and the last four elements. This may still create large results for
|
|
92
|
+
* multidimensional arrays.
|
|
93
|
+
* - Errors are converted to objects with `name`, `message`, and `stack` properties.
|
|
94
|
+
* - Symbols are converted to their string representations.
|
|
95
|
+
* - Functions are converted to strings of the form `Function(name)`.
|
|
96
|
+
*
|
|
97
|
+
* @param value
|
|
98
|
+
* Value.
|
|
99
|
+
*
|
|
100
|
+
* @returns
|
|
101
|
+
* Loggable value.
|
|
102
|
+
*/
|
|
103
|
+
export function loggableValue(value) {
|
|
104
|
+
let replacementValue;
|
|
105
|
+
switch (typeof value) {
|
|
106
|
+
case "string":
|
|
107
|
+
case "number":
|
|
108
|
+
case "boolean":
|
|
109
|
+
case "undefined":
|
|
110
|
+
replacementValue = value;
|
|
111
|
+
break;
|
|
112
|
+
case "bigint":
|
|
113
|
+
// Big integers not supported in JSON.
|
|
114
|
+
replacementValue = value >= Number.MIN_SAFE_INTEGER && value <= Number.MAX_SAFE_INTEGER ? Number(value) : value.toString(10);
|
|
115
|
+
break;
|
|
116
|
+
case "object":
|
|
117
|
+
if (value === null) {
|
|
118
|
+
replacementValue = value;
|
|
119
|
+
}
|
|
120
|
+
else if (Array.isArray(value)) {
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- Slicing array is necessary to keep log size down.
|
|
122
|
+
replacementValue = (value.length <= 10 ? value : [...value.slice(0, 4), "...", ...value.slice(-4)]).map(entry => loggableValue(entry));
|
|
123
|
+
}
|
|
124
|
+
else if (value instanceof Error) {
|
|
125
|
+
replacementValue = loggableValue({
|
|
126
|
+
name: value.name,
|
|
127
|
+
message: value.message,
|
|
128
|
+
stack: value.stack?.split("\n")
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Apply recursively to all properties of the object.
|
|
133
|
+
replacementValue = Object.fromEntries(Object.entries(value).map(([k, v]) => [k, loggableValue(v)]));
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "symbol":
|
|
137
|
+
replacementValue = value.toString();
|
|
138
|
+
break;
|
|
139
|
+
case "function":
|
|
140
|
+
replacementValue = `Function(${value.name})`;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
return replacementValue;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Logger transport that stores messages in memory.
|
|
147
|
+
*/
|
|
148
|
+
export class MemoryTransport {
|
|
149
|
+
/**
|
|
150
|
+
* Notification callbacks map.
|
|
151
|
+
*/
|
|
152
|
+
#notificationCallbacksMap = new Map();
|
|
153
|
+
/**
|
|
154
|
+
* Messages.
|
|
155
|
+
*/
|
|
156
|
+
#messages = [];
|
|
157
|
+
/**
|
|
158
|
+
* Maximum length of messages array.
|
|
159
|
+
*/
|
|
160
|
+
#maximumLength = 0;
|
|
161
|
+
/**
|
|
162
|
+
* Length to which messages array is truncated when maximum is reached.
|
|
163
|
+
*/
|
|
164
|
+
#truncateLength = 0;
|
|
165
|
+
/**
|
|
166
|
+
* Constructor.
|
|
167
|
+
*
|
|
168
|
+
* @param logger
|
|
169
|
+
* Logger.
|
|
170
|
+
*
|
|
171
|
+
* @param maximumLength
|
|
172
|
+
* Maximum length of messages array.
|
|
173
|
+
*
|
|
174
|
+
* @param truncateLength
|
|
175
|
+
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
176
|
+
* is 80% of `maximumLength`.
|
|
177
|
+
*/
|
|
178
|
+
constructor(logger, maximumLength, truncateLength) {
|
|
179
|
+
this.resize(maximumLength, truncateLength);
|
|
180
|
+
logger.attachTransport((logObject) => {
|
|
181
|
+
// Truncate logger messages if necessary.
|
|
182
|
+
if (this.#messages.length >= this.#maximumLength) {
|
|
183
|
+
this.#messages.splice(0, this.#maximumLength - this.#truncateLength);
|
|
184
|
+
}
|
|
185
|
+
const message = JSON.stringify(logObject);
|
|
186
|
+
this.#messages.push(message);
|
|
187
|
+
// Notify all registered callbacks.
|
|
188
|
+
for (const notificationCallback of this.#notificationCallbacksMap.values()) {
|
|
189
|
+
notificationCallback(message, this.#messages);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get the messages.
|
|
195
|
+
*/
|
|
196
|
+
get messages() {
|
|
197
|
+
return this.#messages;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get the maximum length of messages array.
|
|
201
|
+
*/
|
|
202
|
+
get maximumLength() {
|
|
203
|
+
return this.#maximumLength;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get the length to which messages array is truncated when maximum is reached.
|
|
207
|
+
*/
|
|
208
|
+
get truncateLength() {
|
|
209
|
+
return this.#truncateLength;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Add a notification callback. If one already exists under the current name, do nothing.
|
|
213
|
+
*
|
|
214
|
+
* @param name
|
|
215
|
+
* Callback name.
|
|
216
|
+
*
|
|
217
|
+
* @param notificationCallback
|
|
218
|
+
* Callback.
|
|
219
|
+
*
|
|
220
|
+
* @returns
|
|
221
|
+
* True if successfully added.
|
|
222
|
+
*/
|
|
223
|
+
addNotificationCallback(name, notificationCallback) {
|
|
224
|
+
const added = !this.#notificationCallbacksMap.has(name);
|
|
225
|
+
if (added) {
|
|
226
|
+
this.#notificationCallbacksMap.set(name, notificationCallback);
|
|
227
|
+
// Notify with existing messages.
|
|
228
|
+
notificationCallback(undefined, this.#messages);
|
|
229
|
+
}
|
|
230
|
+
return added;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Remove a notification callback.
|
|
234
|
+
*
|
|
235
|
+
* @param name
|
|
236
|
+
* Callback name.
|
|
237
|
+
*/
|
|
238
|
+
removeNotificationCallback(name) {
|
|
239
|
+
this.#notificationCallbacksMap.delete(name);
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Resize the messages array.
|
|
243
|
+
*
|
|
244
|
+
* @param maximumLength
|
|
245
|
+
* Maximum length of messages array.
|
|
246
|
+
*
|
|
247
|
+
* @param truncateLength
|
|
248
|
+
* Length to which messages array is truncated when maximum is reached. Default is 50% of `maximumLength`, maximum
|
|
249
|
+
* is 80% of `maximumLength`.
|
|
250
|
+
*/
|
|
251
|
+
resize(maximumLength, truncateLength) {
|
|
252
|
+
this.#maximumLength = maximumLength;
|
|
253
|
+
this.#truncateLength = truncateLength !== undefined ? Math.min(truncateLength, Math.floor(maximumLength * 0.8)) : Math.floor(maximumLength / 2);
|
|
254
|
+
}
|
|
40
255
|
}
|
|
41
256
|
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,MAAM,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;CACF,CAAC;AAYX;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,eAAiC;IACxD,IAAI,aAAuB,CAAC;IAE5B,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;QACtC,IAAI,eAAe,IAAI,SAAS,EAAE,CAAC;YAC/B,kGAAkG;YAClG,aAAa,GAAG,SAAS,CAAC,eAA8B,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,wBAAwB,EAAE;gBACzD,QAAQ,EAAE,eAAe;aAC5B,CAAC,CAAC,CAAC;QACR,CAAC;IACL,CAAC;SAAM,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACvC,yHAAyH;QACzH,IAAI,MAAM,CAAC,MAAM,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G;IACH,uBAAuB,CAAC,IAAY,EAAE,oBAAwF;QAC1H,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAExD,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;YAE/D,iCAAiC;YACjC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,0BAA0B,CAAC,IAAY;QACnC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,aAAqB,EAAE,cAAuB;QACjD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;IACpJ,CAAC;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReadOnlyAppDataStorage } from "./app-data-storage.js";
|
|
2
|
+
/**
|
|
3
|
+
* Remote application data storage using HTTP. The `store()` and `delete()` methods are not supported.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RemoteAppDataStorage extends ReadOnlyAppDataStorage<true> {
|
|
6
|
+
/**
|
|
7
|
+
* Constructor.
|
|
8
|
+
*
|
|
9
|
+
* @param baseURL
|
|
10
|
+
* Base URL. The URL must not end with a slash.
|
|
11
|
+
*/
|
|
12
|
+
constructor(baseURL: string);
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
protected doRead(key: string, asBinary: boolean | undefined): Promise<string | Uint8Array | undefined>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=remote-app-data-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-app-data-storage.d.ts","sourceRoot":"","sources":["../src/remote-app-data-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,sBAAsB,CAAC,IAAI,CAAC;IAClE;;;;;OAKG;gBACS,OAAO,EAAE,MAAM;IAI3B;;OAEG;cACsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;CAiBxH"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReadOnlyAppDataStorage } from "./app-data-storage.js";
|
|
2
|
+
import { i18nextCore } from "./locale/i18n.js";
|
|
3
|
+
/**
|
|
4
|
+
* Remote application data storage using HTTP. The `store()` and `delete()` methods are not supported.
|
|
5
|
+
*/
|
|
6
|
+
export class RemoteAppDataStorage extends ReadOnlyAppDataStorage {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor.
|
|
9
|
+
*
|
|
10
|
+
* @param baseURL
|
|
11
|
+
* Base URL. The URL must not end with a slash.
|
|
12
|
+
*/
|
|
13
|
+
constructor(baseURL) {
|
|
14
|
+
super(true, baseURL);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
async doRead(key, asBinary) {
|
|
20
|
+
return fetch(key).then(async (response) => {
|
|
21
|
+
let result;
|
|
22
|
+
if (response.ok) {
|
|
23
|
+
result = asBinary === true ? new Uint8Array(await response.arrayBuffer()) : await response.text();
|
|
24
|
+
}
|
|
25
|
+
else if (response.status === 404) {
|
|
26
|
+
result = undefined;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new RangeError(i18nextCore.t("RemoteAppDataStorage.httpError", {
|
|
30
|
+
status: response.status
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=remote-app-data-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-app-data-storage.js","sourceRoot":"","sources":["../src/remote-app-data-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,sBAA4B;IAClE;;;;;OAKG;IACH,YAAY,OAAe;QACvB,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACgB,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,QAA6B;QACtE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACtC,IAAI,MAAuC,CAAC;YAE5C,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACd,MAAM,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACtG,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACjC,MAAM,GAAG,SAAS,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,gCAAgC,EAAE;oBACjE,MAAM,EAAE,QAAQ,CAAC,MAAM;iBAC1B,CAAC,CAAC,CAAC;YACR,CAAC;YAED,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/type-helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-helper.js","sourceRoot":"","sources":["../src/type-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,UAAU,CAAgE,QAAkB,EAAE,CAAI,EAAE,GAAG,IAAS;IACrH,yGAAyG;IACzG,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAQ,CAAC,KAAK,QAAQ,CAAC,CAAkD,CAAC;AAC1J,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,IAAI,CAAsC,CAAI,EAAE,GAAG,IAAS;IACxE,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,IAAI,CAAsC,CAAI,EAAE,GAAG,IAAS;IACxE,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,OAAO,CAAyE,IAAW,EAAE,MAAe;IACxH,0FAA0F;IAC1F,OAAO,IAAI,CAAC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"type-helper.js","sourceRoot":"","sources":["../src/type-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,UAAU,CAAgE,QAAkB,EAAE,CAAI,EAAE,GAAG,IAAS;IACrH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;AACtD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,QAAiB;IACvC,OAAO,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,CAAC;AACvD,CAAC"}
|
package/dist/type.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ export type TypedConstructor<TConstructor extends abstract new (...args: Constru
|
|
|
49
49
|
* Constructor type.
|
|
50
50
|
*/
|
|
51
51
|
export type TypedAbstractConstructor<TConstructor extends abstract new (...args: ConstructorParameters<TConstructor>) => InstanceType<TConstructor>> = AbstractConstructor<ConstructorParameters<TConstructor>, InstanceType<TConstructor>>;
|
|
52
|
+
/**
|
|
53
|
+
* Promisable type. Extends a type by allowing a {@linkcode Promise} of the same type. Typically used in abstract method
|
|
54
|
+
* declarations where the implementing class may or may not implement the method as asynchronous.
|
|
55
|
+
*/
|
|
56
|
+
export type Promisable<T> = T | Promise<T>;
|
|
52
57
|
/**
|
|
53
58
|
* Determine the fundamental promised type. This is stricter than `Awaited<Type>` in that it requires a {@linkcode
|
|
54
59
|
* Promise}.
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC,SAAS,CAAC,CAAC;AAEnK;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;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CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhN;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG;KAC9C,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE9E;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK;CACxE,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidc-toolkit/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33-beta",
|
|
4
4
|
"description": "Core functionality for AIDC Toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"homepage": "https://aidc-toolkit.com
|
|
7
|
+
"homepage": "https://aidc-toolkit.com",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/aidc-toolkit/core.git"
|
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"lint": "eslint",
|
|
23
|
-
"tsc
|
|
24
|
-
"build:
|
|
25
|
-
"build:
|
|
26
|
-
"build:
|
|
23
|
+
"tsc-src": "tsc --project tsconfig-src.json",
|
|
24
|
+
"build:alpha": "rimraf dist && npm run tsc-src -- --declarationMap --sourceMap",
|
|
25
|
+
"build:beta": "npm run build:alpha",
|
|
26
|
+
"build:prod": "npm run tsc-src -- --noEmit && tsup",
|
|
27
|
+
"build:doc": "npm run build:alpha"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@aidc-toolkit/dev": "1.0.
|
|
30
|
+
"@aidc-toolkit/dev": "1.0.33-beta"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
+
"base64-js": "^1.5.1",
|
|
34
|
+
"i18next": "^25.7.4",
|
|
33
35
|
"i18next-browser-languagedetector": "^8.2.0",
|
|
34
36
|
"i18next-cli-language-detector": "^1.1.8",
|
|
35
37
|
"tslog": "^4.10.2"
|