Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bentley/bentleyjs-core

Package Overview
Dependencies
Maintainers
4
Versions
524
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bentley/bentleyjs-core - npm Package Compare versions

Comparing version 2.5.5 to 2.6.0

15

CHANGELOG.json

@@ -5,2 +5,17 @@ {

{
"version": "2.6.0",
"tag": "@bentley/bentleyjs-core_v2.6.0",
"date": "Thu, 17 Sep 2020 13:16:12 GMT",
"comments": {
"none": [
{
"comment": "Add Id64 functions for working with compact representations of Id64Sets and ordering Id64Strings based on 64-bit numerical value."
},
{
"comment": "Moved ESLint configuration to a plugin"
}
]
}
},
{
"version": "2.5.5",

@@ -7,0 +22,0 @@ "tag": "@bentley/bentleyjs-core_v2.5.5",

10

CHANGELOG.md
# Change Log - @bentley/bentleyjs-core
This log was last generated on Wed, 02 Sep 2020 17:42:23 GMT and should not be manually modified.
This log was last generated on Thu, 17 Sep 2020 13:16:12 GMT and should not be manually modified.
## 2.6.0
Thu, 17 Sep 2020 13:16:12 GMT
### Updates
- Add Id64 functions for working with compact representations of Id64Sets and ordering Id64Strings based on 64-bit numerical value.
- Moved ESLint configuration to a plugin
## 2.5.5

@@ -6,0 +14,0 @@ Wed, 02 Sep 2020 17:42:23 GMT

2

lib/Assert.js

@@ -22,5 +22,5 @@ "use strict";

if (!condition)
throw new Error("Assert: " + ((msg !== undefined) ? msg : "Programmer Error"));
throw new Error(`Assert: ${(msg !== null && msg !== void 0 ? msg : "Programmer Error")}`);
}
exports.assert = assert;
//# sourceMappingURL=Assert.js.map

@@ -701,3 +701,3 @@ "use strict";

default:
return "Error (" + this.errorNumber + ")";
return `Error (${this.errorNumber})`;
}

@@ -704,0 +704,0 @@ }

/**
* Set to true if the process is running in Electron
* Set to true if the process is running in Electron renderer process
* @internal

@@ -7,7 +7,6 @@ */

/**
* Utility to wrap import of the electron module
* @note The value is set to undefined if not running in Electron.
* Set to true if the process is running in Electron main process
* @internal
*/
export declare const electronRenderer: any;
export declare const isElectronMain: boolean;
//# sourceMappingURL=ElectronUtils.d.ts.map

@@ -7,26 +7,12 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
function isElectronRendererFn() {
return (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer");
}
/**
* Set to true if the process is running in Electron
* Set to true if the process is running in Electron renderer process
* @internal
*/
exports.isElectronRenderer = isElectronRendererFn();
function electronRendererFn() {
if (exports.isElectronRenderer) {
// Wrapping this require in a try/catch signals to webpack that this is only an optional dependency
try {
return require("electron"); // eslint-disable-line @typescript-eslint/no-var-requires
}
catch (error) { }
}
return undefined;
}
exports.isElectronRenderer = typeof navigator === "object" && navigator.userAgent.toLowerCase().indexOf("electron") >= 0;
/**
* Utility to wrap import of the electron module
* @note The value is set to undefined if not running in Electron.
* Set to true if the process is running in Electron main process
* @internal
*/
exports.electronRenderer = electronRendererFn();
exports.isElectronMain = typeof process === "object" && process.versions.hasOwnProperty("electron");
//# sourceMappingURL=ElectronUtils.js.map

@@ -17,2 +17,10 @@ /** @packageDocumentation

export declare type Id64Set = Set<Id64String>;
/** A compact string representation of an [[Id64Set]]. Such a representation is useful when serializing potentially very large
* sets of Ids.
* @see [[Id64.compressSet]] and [[Id64.compressArray]] to produce a compact string from a collection of Ids.
* @see [[Id64.decompressSet]] and [[Id64.decompressArray]] to produce a collection of Ids from a compact string.
* @see [[Id64.decompressIds]] to iterate the Ids represented by a compact string.
* @beta
*/
export declare type CompressedId64Set = string;
/** An array of [[Id64String]]s.

@@ -83,4 +91,8 @@ * @public

}
/** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers. */
function getUint32Pair(id: Id64String): Uint32Pair;
/** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.
* @param id The well-formed string representation of a 64-bit Id.
* @param out Used as the return value if supplied; otherwise a new object is returned.
* @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.
*/
function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair;
/** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */

@@ -227,2 +239,66 @@ function getLowerUint32(id: Id64String): number;

}
/** An ordered comparison of [[Id64String]]s suitable for use with sorting routines like `Array.sort` and sorted containers
* like [[SortedArray]] and [[Dictionary]]. The comparison compares the 64-bit numerical values of the two Ids, returning a negative number if lhs < rhs,
* a positive number if lhs > rhs, or zero if lhs == rhs.
* The default string comparison is fine (and more efficient) when numerical ordering is not required; use this instead if you want e.g., "0x100" to be greater than "0xf".
* @see [[Id64.sortArray]] for a convenient way to sort an array of Id64Strings.
* @beta
*/
function compare(lhs: Id64String, rhs: Id64String): number;
/** Sort an array of [[Id64String]]s **in-place** in ascending order by their 64-bit numerical values.
* @see [[Id64.compare]] for the comparison routine used.
* @returns the input array.
* @note This function returns its input for consistency with Javascript's `Array.sort` method. It **does not** create a **new** array.
* @beta
*/
function sortArray(ids: Id64Array): Id64Array;
/** Given a set of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
* @note Invalid Ids are ignored.
* @see [[Id64.compressArray]] to perform the same operation on an [[Id64Array]].
* @see [[Id64.decompressSet]] to perform the inverse operation.
* @beta
*/
function compressSet(ids: Id64Set): CompressedId64Set;
/** Give a **numerically-ordered** array of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
* Duplicate Ids are included only once in the string representation.
* @throws Error if two consecutive Ids `x` and `y` exist such that the numerical value of `x` is greater than that of `y` - i.e., the array is not properly sorted.
* @note The array must be sorted according to the 64-bit numerical value of each Id.
* @note Invalid Ids are ignored.
* @see [[Id64.decompressArray]] to perform the inverse operation.
* @see [[Id64.sortArray]] to ensure the Ids are properly sorted.
* @beta
*/
function compressArray(ids: Id64Array): CompressedId64Set;
/** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Set]].
* @param compressedIds The compact string representation.
* @param out If supplied, the Ids will be inserted into this set rather than allocating and returning a new set.
* @returns The set containing the decompressed Ids.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @see [[Id64.compressSet]] to perform the inverse operation.
* @see [[Id64.decompressArray]] to decompress as an [[Id64Array]] instead.
* @beta
*/
function decompressSet(compressedIds: CompressedId64Set, out?: Id64Set): Id64Set;
/** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Array].
* @param compressedIds The compact string representation.
* @param out If supplied, the Ids will be appended to this array rather than allocating and returning a new array.
* @returns The array containing the decompressed Ids.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @note The Ids are decompressed and appended to the array in ascending order based on their 64-bit numerical values.
* @see [[Id64.compressArray]] to perform the inverse operation.
* @see [[Id64.decompressSet]] to decompress as an [[Id64Set]] instead.
* @beta
*/
function decompressArray(compressedIds: CompressedId64Set, out?: Id64Array): Id64Array;
/** Decompress the compact string representation of an [[Id64Set]].
* @param ids The compact string representation.
* @param func A function to be invoked with each decompressed Id in sequence, returning `true` to continue iterating the Ids or `false` to abort.
* @returns true if all Ids were processed - i.e., `func` did not abort by returning `false`.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @note The Ids are emitted in ascending order based on their 64-bit numerical values.
* @see [[Id64.decompressSet]] or [[Id64.decompressArray]] to produce an [[Id64Set]] or [[Id64Array]].
* @see [[Id64.compressSet]] or [[Id64.compressArray]] to produce the compact string representation.
* @beta
*/
function decompressIds(ids: CompressedId64Set, func: (id: Id64String) => boolean): boolean;
}

@@ -229,0 +305,0 @@ /**

@@ -10,2 +10,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Assert_1 = require("./Assert");
function toHex(str) {

@@ -132,7 +133,7 @@ const v = parseInt(str, 16);

const lowStr = localId.toString(16);
return "0x" + ((briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr)));
return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;
}
Id64.fromLocalAndBriefcaseIds = fromLocalAndBriefcaseIds;
// Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.
const _scratchCharCodes = [
const scratchCharCodes = [
0x30,

@@ -189,3 +190,3 @@ 0x78,

// Need to omit or preserve leading zeroes...
const buffer = _scratchCharCodes;
const buffer = scratchCharCodes;
let index = 2;

@@ -208,3 +209,3 @@ for (let i = 7; i >= 0; i--) {

buffer.length = index;
return String.fromCharCode(..._scratchCharCodes);
return String.fromCharCode(...scratchCharCodes);
}

@@ -220,8 +221,13 @@ Id64.fromUint32Pair = fromUint32Pair;

Id64.isValidUint32Pair = isValidUint32Pair;
/** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers. */
function getUint32Pair(id) {
return {
lower: getLowerUint32(id),
upper: getUpperUint32(id),
};
/** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.
* @param id The well-formed string representation of a 64-bit Id.
* @param out Used as the return value if supplied; otherwise a new object is returned.
* @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.
*/
function getUint32Pair(id, out) {
if (!out)
out = { lower: 0, upper: 0 };
out.lower = getLowerUint32(id);
out.upper = getUpperUint32(id);
return out;
}

@@ -536,2 +542,305 @@ Id64.getUint32Pair = getUint32Pair;

Id64.Uint32Map = Uint32Map;
/** This exists strictly for the purposes of compressed sets of 64-bit Ids, to avoid the overhead of BigInt for handling 64-bit integers. */
class Uint64 {
constructor(lower = 0, upper = 0) {
this.lower = lower;
this.upper = upper;
this.assertConstraints();
}
static assertUint32(num) {
Assert_1.assert(num >= 0);
Assert_1.assert(num < Uint64._base);
Assert_1.assert(Math.floor(num) === num);
}
assertConstraints() {
Uint64.assertUint32(this.lower);
Uint64.assertUint32(this.upper);
}
compare(rhs) {
const diff = this.upper - rhs.upper;
return 0 === diff ? this.lower - rhs.lower : diff;
}
equals(rhs) { return 0 === this.compare(rhs); }
isLessThan(rhs) { return this.compare(rhs) < 0; }
isGreaterThan(rhs) { return this.compare(rhs) > 0; }
get isZero() { return 0 === this.lower && 0 === this.upper; }
setFromDifference(lhs, rhs) {
Assert_1.assert(!rhs.isGreaterThan(lhs));
this.lower = lhs.lower - rhs.lower;
this.upper = lhs.upper - rhs.upper;
if (this.lower < 0) {
this.lower += Uint64._base;
this.upper -= 1;
}
}
add(rhs) {
let lower = rhs.lower;
let upper = rhs.upper;
if (lower >= Uint64._base) {
lower -= Uint64._base;
upper += 1;
}
this.lower += lower;
this.upper += upper;
this.assertConstraints();
}
setFromId(id) {
getUint32Pair(id, this);
}
copyFrom(other) {
this.lower = other.lower;
this.upper = other.upper;
}
toString() {
if (0 === this.upper)
return this.lower.toString(16).toUpperCase();
const upper = this.upper.toString(16);
const lower = this.lower.toString(16).padStart(8, "0");
Assert_1.assert(lower.length === 8);
return `${upper}${lower}`.toUpperCase();
}
toId64String() {
return Id64.fromUint32Pair(this.lower, this.upper);
}
}
Uint64._base = 0x100000000;
/** An ordered comparison of [[Id64String]]s suitable for use with sorting routines like `Array.sort` and sorted containers
* like [[SortedArray]] and [[Dictionary]]. The comparison compares the 64-bit numerical values of the two Ids, returning a negative number if lhs < rhs,
* a positive number if lhs > rhs, or zero if lhs == rhs.
* The default string comparison is fine (and more efficient) when numerical ordering is not required; use this instead if you want e.g., "0x100" to be greater than "0xf".
* @see [[Id64.sortArray]] for a convenient way to sort an array of Id64Strings.
* @beta
*/
function compare(lhs, rhs) {
if (lhs.length !== rhs.length)
return lhs.length < rhs.length ? -1 : 1;
// This is faster than localeCompare(). Unclear why there is no string.compare() - would be generally useful in
// array sort functions...
if (lhs !== rhs)
return lhs < rhs ? -1 : 1;
return 0;
}
Id64.compare = compare;
/** Sort an array of [[Id64String]]s **in-place** in ascending order by their 64-bit numerical values.
* @see [[Id64.compare]] for the comparison routine used.
* @returns the input array.
* @note This function returns its input for consistency with Javascript's `Array.sort` method. It **does not** create a **new** array.
* @beta
*/
function sortArray(ids) {
ids.sort((x, y) => Id64.compare(x, y));
return ids;
}
Id64.sortArray = sortArray;
function compactRange(increment, length) {
Assert_1.assert(length > 0);
const inc = `+${increment.toString()}`;
if (length <= 1)
return inc;
const len = length.toString(16).toUpperCase();
return `${inc}*${len}`;
}
/** Given a set of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
* @note Invalid Ids are ignored.
* @see [[Id64.compressArray]] to perform the same operation on an [[Id64Array]].
* @see [[Id64.decompressSet]] to perform the inverse operation.
* @beta
*/
function compressSet(ids) {
const arr = Array.from(ids);
sortArray(arr);
return compressArray(arr);
}
Id64.compressSet = compressSet;
/** Give a **numerically-ordered** array of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
* Duplicate Ids are included only once in the string representation.
* @throws Error if two consecutive Ids `x` and `y` exist such that the numerical value of `x` is greater than that of `y` - i.e., the array is not properly sorted.
* @note The array must be sorted according to the 64-bit numerical value of each Id.
* @note Invalid Ids are ignored.
* @see [[Id64.decompressArray]] to perform the inverse operation.
* @see [[Id64.sortArray]] to ensure the Ids are properly sorted.
* @beta
*/
function compressArray(ids) {
let str = "";
const prevId = new Uint64();
const rangeIncrement = new Uint64();
let rangeLen = 0;
const curId = new Uint64();
const curIncrement = new Uint64();
for (const id of ids) {
if (!Id64.isValidId64(id))
continue; // ignore garbage and invalid Ids ("0")
curId.setFromId(id);
curIncrement.setFromDifference(curId, prevId);
const cmp = prevId.compare(curId);
if (0 === cmp)
continue; // ignore duplicates
else if (cmp > 0)
throw new Error("Id64.compressArray requires a sorted array as input");
prevId.copyFrom(curId);
if (0 === rangeLen) {
rangeIncrement.copyFrom(curIncrement);
rangeLen = 1;
}
else if (curIncrement.equals(rangeIncrement)) {
++rangeLen;
}
else {
str += compactRange(rangeIncrement, rangeLen);
rangeIncrement.copyFrom(curIncrement);
rangeLen = 1;
}
}
if (0 < rangeLen)
str += compactRange(rangeIncrement, rangeLen);
return str;
}
Id64.compressArray = compressArray;
/** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Set]].
* @param compressedIds The compact string representation.
* @param out If supplied, the Ids will be inserted into this set rather than allocating and returning a new set.
* @returns The set containing the decompressed Ids.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @see [[Id64.compressSet]] to perform the inverse operation.
* @see [[Id64.decompressArray]] to decompress as an [[Id64Array]] instead.
* @beta
*/
function decompressSet(compressedIds, out) {
const set = (out !== null && out !== void 0 ? out : new Set());
decompressIds(compressedIds, (x) => { set.add(x); return true; });
return set;
}
Id64.decompressSet = decompressSet;
/** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Array].
* @param compressedIds The compact string representation.
* @param out If supplied, the Ids will be appended to this array rather than allocating and returning a new array.
* @returns The array containing the decompressed Ids.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @note The Ids are decompressed and appended to the array in ascending order based on their 64-bit numerical values.
* @see [[Id64.compressArray]] to perform the inverse operation.
* @see [[Id64.decompressSet]] to decompress as an [[Id64Set]] instead.
* @beta
*/
function decompressArray(compressedIds, out) {
const arr = (out !== null && out !== void 0 ? out : []);
decompressIds(compressedIds, (x) => { arr.push(x); return true; });
return arr;
}
Id64.decompressArray = decompressArray;
function isHexDigit(ch) {
// ascii values...
const zero = 48;
const nine = 57;
const a = 65;
const f = 70;
return (ch >= zero && ch <= nine) || (ch >= a && ch <= f);
}
/** An object is useful for holding onto the state and temp objects, rather than writing awkward individual functions
* that must accept and return multiple values.
*/
class Decompressor {
constructor(_str, _func) {
this._str = _str;
this._func = _func;
this._curIndex = 1; // Skip the leading "+".
this._curId = new Uint64();
}
static decompress(str, func) {
const decompressor = new Decompressor(str, func);
return decompressor.decompress();
}
parseUint32() {
let value = 0;
let nChars = 0;
while (this._curIndex < this._str.length && nChars < 8) {
++nChars;
const ch = this._str.charCodeAt(this._curIndex);
if (!isHexDigit(ch))
break; // not a hex digit in [0..9] or [A..F]
value <<= 4;
value |= (ch >= 65 ? ch - 65 + 10 : ch - 48); // ch - 'A' + 10 or ch - '0'
value = value >>> 0; // restore unsignedness because silly javascript.
++this._curIndex;
}
return value;
}
parseUint64(uint64) {
let lower = 0;
let upper = 0;
// Read up to the first 8 digits.
const startIndex = this._curIndex;
const first = this.parseUint32();
const nFirstDigits = this._curIndex - startIndex;
Assert_1.assert(nFirstDigits <= 8);
if (8 === nFirstDigits && this._curIndex + 1 < this._str.length && isHexDigit(this._str.charCodeAt(this._curIndex + 1))) {
// We've got up to 8 more digits remaining
const secondIndex = this._curIndex;
const second = this.parseUint32();
// Transfer excess digits from upper to lower.
const nSecondDigits = this._curIndex - secondIndex;
Assert_1.assert(nSecondDigits > 0 && nSecondDigits <= 8);
const nDigitsToTransfer = 8 - nSecondDigits;
upper = first >>> (4 * nDigitsToTransfer);
const transfer = first - ((upper << (4 * nDigitsToTransfer)) >>> 0);
lower = (second | ((transfer << (4 * nSecondDigits)) >>> 0)) >>> 0;
}
else {
lower = first;
}
uint64.lower = lower;
uint64.upper = upper;
}
emit(increment, multiplier) {
for (let i = 0; i < multiplier; i++) {
this._curId.add(increment);
if (!this._func(this._curId.toId64String()))
return false;
}
return true;
}
decompress() {
const increment = new Uint64();
if (0 === this._str.length || "+" !== this._str[0])
throw new Error("Invalid CompressedId64Set");
while (this._curIndex < this._str.length) {
let multiplier = 1;
this.parseUint64(increment);
if (increment.isZero)
throw new Error("Invalid CompressedId64Set");
if (this._curIndex < this._str.length) {
switch (this._str[this._curIndex++]) {
case "*":
multiplier = this.parseUint32();
if (0 === multiplier)
throw new Error("Invalid CompressedId64Set");
if (this._curIndex !== this._str.length && this._str[this._curIndex++] !== "+")
return true;
break;
case "+":
break;
default:
throw new Error("Invalid CompressedId64Set");
}
}
if (!this.emit(increment, multiplier))
return false;
}
return true;
}
}
/** Decompress the compact string representation of an [[Id64Set]].
* @param ids The compact string representation.
* @param func A function to be invoked with each decompressed Id in sequence, returning `true` to continue iterating the Ids or `false` to abort.
* @returns true if all Ids were processed - i.e., `func` did not abort by returning `false`.
* @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
* @note The Ids are emitted in ascending order based on their 64-bit numerical values.
* @see [[Id64.decompressSet]] or [[Id64.decompressArray]] to produce an [[Id64Set]] or [[Id64Array]].
* @see [[Id64.compressSet]] or [[Id64.compressArray]] to produce the compact string representation.
* @beta
*/
function decompressIds(ids, func) {
return Decompressor.decompress(ids, func);
}
Id64.decompressIds = decompressIds;
})(Id64 = exports.Id64 || (exports.Id64 = {}));

@@ -599,3 +908,3 @@ /**

if (noDashPattern.test(noDashValue)) {
return noDashValue.replace(noDashPattern, (_match, p1, p2, p3, p4, p5) => p1 + "-" + p2 + "-" + p3 + "-" + p4 + "-" + p5);
return noDashValue.replace(noDashPattern, (_match, p1, p2, p3, p4, p5) => `${p1}-${p2}-${p3}-${p4}-${p5}`);
}

@@ -602,0 +911,0 @@ // Return unmodified string - (note: it is *not* a valid Guid)

@@ -72,3 +72,3 @@ "use strict";

/* eslint-disable no-console */
Logger.initialize((category, message, getMetaData) => console.log("Error |" + category + "| " + message + Logger.formatMetaData(getMetaData)), (category, message, getMetaData) => console.log("Warning |" + category + "| " + message + Logger.formatMetaData(getMetaData)), (category, message, getMetaData) => console.log("Info |" + category + "| " + message + Logger.formatMetaData(getMetaData)), (category, message, getMetaData) => console.log("Trace |" + category + "| " + message + Logger.formatMetaData(getMetaData)));
Logger.initialize((category, message, getMetaData) => console.log(`Error |${category}| ${message}${Logger.formatMetaData(getMetaData)}`), (category, message, getMetaData) => console.log(`Warning |${category}| ${message}${Logger.formatMetaData(getMetaData)}`), (category, message, getMetaData) => console.log(`Info |${category}| ${message}${Logger.formatMetaData(getMetaData)}`), (category, message, getMetaData) => console.log(`Trace |${category}| ${message}${Logger.formatMetaData(getMetaData)}`));
/* eslint-enable no-console */

@@ -137,5 +137,3 @@ }

static formatMetaData(getMetaData) {
if (!getMetaData)
return "";
return " " + JSON.stringify(Logger.makeMetaData(getMetaData));
return getMetaData ? ` ${JSON.stringify(Logger.makeMetaData(getMetaData))}` : "";
}

@@ -185,6 +183,6 @@ /** Set the least severe level at which messages should be displayed by default. Call setLevel to override this default setting for specific categories. */

if (!validProps.includes(prop))
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig - unrecognized property: " + prop);
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, `LoggerLevelsConfig - unrecognized property: ${prop}`);
if (prop === "defaultLevel") {
if (!Logger.isLogLevel(config.defaultLevel))
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.defaultLevel must be a LogLevel. Invalid value: " + JSON.stringify(config.defaultLevel));
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, `LoggerLevelsConfig.defaultLevel must be a LogLevel. Invalid value: ${JSON.stringify(config.defaultLevel)}`);
}

@@ -194,8 +192,8 @@ else if (prop === "categoryLevels") {

if (!Array.isArray(value))
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels must be an array. Invalid value: " + JSON.stringify(value));
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, `LoggerLevelsConfig.categoryLevels must be an array. Invalid value: ${JSON.stringify(value)}`);
for (const item of config[prop]) {
if (!item.hasOwnProperty("category") || !item.hasOwnProperty("logLevel"))
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels - each item must be a LoggerCategoryAndLevel {category: logLevel:}. Invalid value: " + JSON.stringify(item));
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, `LoggerLevelsConfig.categoryLevels - each item must be a LoggerCategoryAndLevel {category: logLevel:}. Invalid value: ${JSON.stringify(item)}`);
if (!Logger.isLogLevel(item.logLevel))
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, "LoggerLevelsConfig.categoryLevels - each item's logLevel property must be a LogLevel. Invalid value: " + JSON.stringify(item.logLevel));
throw new BentleyError_1.BentleyError(BentleyError_1.IModelStatus.BadArg, `LoggerLevelsConfig.categoryLevels - each item's logLevel property must be a LogLevel. Invalid value: ${JSON.stringify(item.logLevel)}`);
}

@@ -246,3 +244,3 @@ }

if (Logger.logExceptionCallstacks && err.stack)
msg += "\n" + err.stack;
msg += `\n${err.stack}`;
return msg;

@@ -249,0 +247,0 @@ }

@@ -297,3 +297,3 @@ "use strict";

while (entry) {
s += String(entry.key) + ":" + entry.value;
s += `${String(entry.key)}:${entry.value}`;
entry = entry.newer;

@@ -300,0 +300,0 @@ if (entry) {

{
"name": "@bentley/bentleyjs-core",
"version": "2.5.5",
"version": "2.6.0",
"description": "Bentley JavaScript core components",

@@ -33,3 +33,4 @@ "main": "lib/bentleyjs-core.js",

"devDependencies": {
"@bentley/build-tools": "2.5.5",
"@bentley/build-tools": "2.6.0",
"@bentley/eslint-plugin": "2.6.0",
"@types/chai": "^4.1.4",

@@ -52,4 +53,7 @@ "@types/chai-as-promised": "^7",

"eslintConfig": {
"extends": "./node_modules/@bentley/build-tools/.eslintrc.js"
"plugins": [
"@bentley"
],
"extends": "plugin:@bentley/imodeljs-recommended"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc