@itwin/core-i18n 5.7.0-dev.9 → 5.7.1
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/CHANGELOG.md +21 -1
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js +214 -152
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js.map +1 -1
- package/lib/cjs/test/webpack/bundled-tests.js +83 -21
- package/lib/cjs/test/webpack/bundled-tests.js.map +1 -1
- package/lib/cjs/test/webpack/vendors-common_temp_node_modules_pnpm_cross-fetch_4_0_0_node_modules_cross-fetch_dist_browser-24291b.bundled-tests.instrumented.js.map +1 -1
- package/lib/cjs/test/webpack/vendors-common_temp_node_modules_pnpm_cross-fetch_4_0_0_node_modules_cross-fetch_dist_browser-24291b.bundled-tests.js.map +1 -1
- package/package.json +6 -6
|
@@ -18874,30 +18874,58 @@ class Logger {
|
|
|
18874
18874
|
const minLevel = Logger.getLevel(category);
|
|
18875
18875
|
return (minLevel !== undefined) && (level >= minLevel);
|
|
18876
18876
|
}
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18877
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
18878
|
+
static logError(category, messageOrError, metaData) {
|
|
18879
|
+
if (Logger._logError && Logger.isEnabled(category, LogLevel.Error)) {
|
|
18880
|
+
if (typeof messageOrError === "string") {
|
|
18881
|
+
Logger._logError(category, messageOrError, metaData);
|
|
18882
|
+
}
|
|
18883
|
+
else if (_BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.isError(messageOrError)) {
|
|
18884
|
+
// For backwards compatibility, log BentleyError old way
|
|
18885
|
+
Logger._logError(category, Logger.getExceptionMessage(messageOrError), () => ({ ..._BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getErrorMetadata(messageOrError), exceptionType: messageOrError?.constructor?.name ?? "<Unknown>", ..._BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getMetaData(metaData) }));
|
|
18886
|
+
}
|
|
18887
|
+
else {
|
|
18888
|
+
// Else, return a copy of the error, with non-enumerable members `message` and `stack` removed, as "metadata" for log.
|
|
18889
|
+
Logger._logError(category, Logger.getExceptionMessage(messageOrError), Logger.getExceptionMetaData(messageOrError, metaData));
|
|
18890
|
+
}
|
|
18891
|
+
}
|
|
18885
18892
|
}
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18893
|
+
/**
|
|
18894
|
+
* Get a sting message for a given error.
|
|
18895
|
+
* For legacy [[BentleyError]] exceptions, this will include the error message and, optionally, the call stack.
|
|
18896
|
+
* For other exceptions, this will include the stringified version of the error.
|
|
18897
|
+
* @param error The error to get the message for
|
|
18898
|
+
* @returns A string message for the error
|
|
18899
|
+
*/
|
|
18900
|
+
static getExceptionMessage(error) {
|
|
18901
|
+
if (error === undefined) {
|
|
18902
|
+
return "Error: error is undefined.";
|
|
18903
|
+
}
|
|
18904
|
+
if (error === null) {
|
|
18905
|
+
return "Error: error is null.";
|
|
18889
18906
|
}
|
|
18890
|
-
|
|
18891
|
-
|
|
18907
|
+
const stack = Logger.logExceptionCallstacks ? `\n${_BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getErrorStack(error)}` : "";
|
|
18908
|
+
return _BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getErrorMessage(error) + stack;
|
|
18909
|
+
}
|
|
18910
|
+
/**
|
|
18911
|
+
* Merged passed metaData with error properties into one LoggingMetaData, with the passed metaData taking precedence in case of conflict.
|
|
18912
|
+
* @param error The error to be logged as metadata
|
|
18913
|
+
* @param metaData Optional metadata to be merged with the error
|
|
18914
|
+
* @returns A function returning the merged metadata
|
|
18915
|
+
*/
|
|
18916
|
+
static getExceptionMetaData(error, metaData) {
|
|
18917
|
+
const exceptionType = error?.constructor?.name ?? "<Unknown>";
|
|
18918
|
+
if (metaData === undefined) {
|
|
18919
|
+
return () => ({ exceptionType, ...error });
|
|
18892
18920
|
}
|
|
18893
|
-
|
|
18894
|
-
return _BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getErrorMessage(err) + stack;
|
|
18921
|
+
return () => ({ exceptionType, ...error, ..._BentleyError__WEBPACK_IMPORTED_MODULE_1__.BentleyError.getMetaData(metaData) });
|
|
18895
18922
|
}
|
|
18896
18923
|
/** Log the specified exception.
|
|
18897
18924
|
* For legacy [[BentleyError]] exceptions, the special "exceptionType" property will be added as metadata. Otherwise, all enumerable members of the exception are logged as metadata.
|
|
18898
18925
|
* @param category The category of the message.
|
|
18899
18926
|
* @param err The exception object.
|
|
18900
18927
|
* @param log The logger output function to use - defaults to Logger.logError
|
|
18928
|
+
* @deprecated in 5.6 - will not be removed until after 2027-03-03. Use logError(category, error, metaData) instead, which will log exceptions in the same way but is more flexible and easier to use.
|
|
18901
18929
|
*/
|
|
18902
18930
|
static logException(category, err, log = (_category, message, metaData) => Logger.logError(_category, message, metaData)) {
|
|
18903
18931
|
log(category, Logger.getExceptionMessage(err), () => {
|
|
@@ -19013,6 +19041,10 @@ class ObservableSet extends Set {
|
|
|
19013
19041
|
onDeleted = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
19014
19042
|
/** Emitted after this set's contents are cleared. */
|
|
19015
19043
|
onCleared = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
19044
|
+
/** Emitted after multiple items are added to this set via [[addAll]]. */
|
|
19045
|
+
onBatchAdded = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
19046
|
+
/** Emitted after multiple items are deleted from this set via [[deleteAll]]. */
|
|
19047
|
+
onBatchDeleted = new _BeEvent__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
19016
19048
|
/** Construct a new ObservableSet.
|
|
19017
19049
|
* @param elements Optional elements with which to populate the new set.
|
|
19018
19050
|
*/
|
|
@@ -19045,6 +19077,32 @@ class ObservableSet extends Set {
|
|
|
19045
19077
|
this.onCleared.raiseEvent();
|
|
19046
19078
|
}
|
|
19047
19079
|
}
|
|
19080
|
+
/** Add multiple items to the set, raising [[onBatchAdded]] only once after all items are added.
|
|
19081
|
+
* This is more efficient than calling [[add]] in a loop when listeners need not be notified of each individual addition.
|
|
19082
|
+
* @param items The items to add.
|
|
19083
|
+
* @returns The number of items that were actually added (i.e., were not already present).
|
|
19084
|
+
*/
|
|
19085
|
+
addAll(items) {
|
|
19086
|
+
const prevSize = this.size;
|
|
19087
|
+
for (const item of items)
|
|
19088
|
+
super.add(item);
|
|
19089
|
+
if (this.size !== prevSize)
|
|
19090
|
+
this.onBatchAdded.raiseEvent();
|
|
19091
|
+
return this.size - prevSize;
|
|
19092
|
+
}
|
|
19093
|
+
/** Delete multiple items from the set, raising [[onBatchDeleted]] only once after all items are deleted.
|
|
19094
|
+
* This is more efficient than calling [[delete]] in a loop when listeners need not be notified of each individual deletion.
|
|
19095
|
+
* @param items The items to delete.
|
|
19096
|
+
* @returns The number of items that were actually deleted (i.e., were present in the set).
|
|
19097
|
+
*/
|
|
19098
|
+
deleteAll(items) {
|
|
19099
|
+
const prevSize = this.size;
|
|
19100
|
+
for (const item of items)
|
|
19101
|
+
super.delete(item);
|
|
19102
|
+
if (this.size !== prevSize)
|
|
19103
|
+
this.onBatchDeleted.raiseEvent();
|
|
19104
|
+
return prevSize - this.size;
|
|
19105
|
+
}
|
|
19048
19106
|
}
|
|
19049
19107
|
|
|
19050
19108
|
|
|
@@ -19153,11 +19211,15 @@ class OneAtATimeAction {
|
|
|
19153
19211
|
return await promise;
|
|
19154
19212
|
}
|
|
19155
19213
|
finally {
|
|
19156
|
-
//
|
|
19157
|
-
|
|
19158
|
-
this.
|
|
19159
|
-
|
|
19160
|
-
this._active.
|
|
19214
|
+
// A replaced pending request can be abandoned before it ever becomes active.
|
|
19215
|
+
// Only the currently active entry is allowed to promote/start the next pending request.
|
|
19216
|
+
if (this._active === entry) {
|
|
19217
|
+
// do all of this whether promise was fulfilled or rejected
|
|
19218
|
+
this._active = this._pending; // see if there's a pending request waiting
|
|
19219
|
+
this._pending = undefined; // clear pending
|
|
19220
|
+
if (this._active)
|
|
19221
|
+
this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
|
|
19222
|
+
}
|
|
19161
19223
|
}
|
|
19162
19224
|
}
|
|
19163
19225
|
}
|
|
@@ -21240,7 +21302,7 @@ class UnexpectedErrors {
|
|
|
21240
21302
|
/** handler for logging exception to console */
|
|
21241
21303
|
static consoleLog = (e) => console.error(e); // eslint-disable-line no-console
|
|
21242
21304
|
/** handler for logging exception with [[Logger]] */
|
|
21243
|
-
static errorLog = (e) => _Logger__WEBPACK_IMPORTED_MODULE_0__.Logger.
|
|
21305
|
+
static errorLog = (e) => _Logger__WEBPACK_IMPORTED_MODULE_0__.Logger.logError("unhandled", e);
|
|
21244
21306
|
static _telemetry = [];
|
|
21245
21307
|
static _handler = this.errorLog; // default to error logging
|
|
21246
21308
|
constructor() { } // this is a singleton
|