@itwin/core-bentley 5.2.0-dev.3 → 5.2.0-dev.31

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 CHANGED
@@ -1,6 +1,55 @@
1
1
  # Change Log - @itwin/core-bentley
2
2
 
3
- This log was last generated on Wed, 06 Aug 2025 15:37:23 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 17 Sep 2025 17:22:50 GMT and should not be manually modified.
4
+
5
+ ## 5.1.8
6
+ Wed, 17 Sep 2025 17:17:16 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 5.1.7
11
+ Tue, 09 Sep 2025 19:28:04 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 5.1.6
16
+ Mon, 08 Sep 2025 13:53:47 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 5.1.5
21
+ Thu, 04 Sep 2025 13:51:08 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 5.1.4
26
+ Fri, 22 Aug 2025 14:22:33 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 5.1.3
31
+ Wed, 20 Aug 2025 13:57:10 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 5.1.2
36
+ Thu, 14 Aug 2025 19:38:08 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 5.1.1
41
+ Fri, 08 Aug 2025 18:06:10 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 5.1.0
46
+ Fri, 08 Aug 2025 12:51:53 GMT
47
+
48
+ ### Updates
49
+
50
+ - Add TypeScript utility types `DeepReadonlyObject` and `DeepRequiredObject`.
51
+ - Add compareArrays for ordered comparison of arrays.
52
+ - Updated deprecation comments to new template
4
53
 
5
54
  ## 5.0.5
6
55
  Wed, 06 Aug 2025 15:34:15 GMT
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Expects that a value is defined (not undefined).
3
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
4
+ * handle undefined values instead of throwing an error.
5
+ * @param value The value to check.
6
+ * @param message Optional error message to be used in thrown Error.
7
+ * @returns The original value if it is defined.
8
+ * @throws Error if the value is undefined.
9
+ * @internal
10
+ */
11
+ export declare function expectDefined<T>(value: T | undefined, message?: string): T;
12
+ /**
13
+ * Expects that a value is not null.
14
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
15
+ * handle null values instead of throwing an error.
16
+ * @param value The value to check.
17
+ * @param message Optional error message to be used in thrown Error.
18
+ * @returns The original value if it is not null.
19
+ * @throws Error if the value is null.
20
+ * @internal
21
+ */
22
+ export declare function expectNotNull<T>(value: T | null, message?: string): T;
23
+ //# sourceMappingURL=Expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expect.d.ts","sourceRoot":"","sources":["../../src/Expect.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAK1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAKrE"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.expectDefined = expectDefined;
8
+ exports.expectNotNull = expectNotNull;
9
+ /**
10
+ * Expects that a value is defined (not undefined).
11
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
12
+ * handle undefined values instead of throwing an error.
13
+ * @param value The value to check.
14
+ * @param message Optional error message to be used in thrown Error.
15
+ * @returns The original value if it is defined.
16
+ * @throws Error if the value is undefined.
17
+ * @internal
18
+ */
19
+ function expectDefined(value, message) {
20
+ if (value === undefined) {
21
+ throw new Error(message ?? "Expected value to be defined, but it was undefined.");
22
+ }
23
+ return value;
24
+ }
25
+ /**
26
+ * Expects that a value is not null.
27
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
28
+ * handle null values instead of throwing an error.
29
+ * @param value The value to check.
30
+ * @param message Optional error message to be used in thrown Error.
31
+ * @returns The original value if it is not null.
32
+ * @throws Error if the value is null.
33
+ * @internal
34
+ */
35
+ function expectNotNull(value, message) {
36
+ if (value === null) {
37
+ throw new Error(message ?? "Expected value to be not null, but it was null.");
38
+ }
39
+ return value;
40
+ }
41
+ //# sourceMappingURL=Expect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expect.js","sourceRoot":"","sources":["../../src/Expect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AAY/F,sCAKC;AAYD,sCAKC;AAhCD;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAI,KAAoB,EAAE,OAAgB;IACrE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,qDAAqD,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAI,KAAe,EAAE,OAAgB;IAChE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,iDAAiD,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/**\n * Expects that a value is defined (not undefined).\n * @note Almost always, places that use this function should in the future be cleaned up to properly\n * handle undefined values instead of throwing an error.\n * @param value The value to check.\n * @param message Optional error message to be used in thrown Error.\n * @returns The original value if it is defined.\n * @throws Error if the value is undefined.\n * @internal\n */\nexport function expectDefined<T>(value: T | undefined, message?: string): T {\n if (value === undefined) {\n throw new Error(message ?? \"Expected value to be defined, but it was undefined.\");\n }\n return value;\n}\n\n/**\n * Expects that a value is not null.\n * @note Almost always, places that use this function should in the future be cleaned up to properly\n * handle null values instead of throwing an error.\n * @param value The value to check.\n * @param message Optional error message to be used in thrown Error.\n * @returns The original value if it is not null.\n * @throws Error if the value is null.\n * @internal\n */\nexport function expectNotNull<T>(value: T | null, message?: string): T {\n if (value === null) {\n throw new Error(message ?? \"Expected value to be not null, but it was null.\");\n }\n return value;\n}\n"]}
package/lib/cjs/LRUMap.js CHANGED
@@ -311,7 +311,7 @@ class LRUCache {
311
311
  let s = "";
312
312
  let entry = this.oldest;
313
313
  while (entry) {
314
- s += `${String(entry.key)}:${entry.value}`;
314
+ s += `${String(entry.key)}:${String(entry.value)}`;
315
315
  entry = entry.newer;
316
316
  if (entry) {
317
317
  s += " < ";
@@ -1 +1 @@
1
- {"version":3,"file":"LRUMap.js","sourceRoot":"","sources":["../../src/LRUMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,6CAA0C;AAE1C;;;;GAIG;AAEH;;GAEG;AACH,MAAa,KAAK;IAGG;IAAe;IAF3B,KAAK,CAAe;IACpB,KAAK,CAAe;IAC3B,YAAmB,GAAM,EAAS,KAAQ;QAAvB,QAAG,GAAH,GAAG,CAAG;QAAS,UAAK,GAAL,KAAK,CAAG;IAAI,CAAC;CAChD;AAJD,sBAIC;AAED,MAAM,aAAa;IACT,MAAM,CAA0B;IACxC,YAAY,WAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;IACM,IAAI;QACT,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,CAAC,GAAG;YACN,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAA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;YACb,CAAC;QACH,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AA3PD,4BA2PC;AAED;;GAEG;AACH,MAAa,MAAa,SAAQ,QAAc;IAC9C;;OAEG;IACH,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC1C,CAAC;CACF;AAPD,wBAOC;AAED;;GAEG;AACH,MAAa,aAAoB,SAAQ,QAAc;IACrD;;;;OAIG;IACH,YAAY,KAAa,EAAE,WAAiC;QAC1D,KAAK,CAAC,KAAK,EAAE,IAAI,uBAAU,CAAiB,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF;AATD,sCASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { OrderedComparator } from \"./Compare\";\nimport { Dictionary } from \"./Dictionary\";\n\n/**\n * Derived from:\n * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson <http://hunch.se/>\n * See README.md at https://github.com/rsms/js-lru for details.\n */\n\n/** An entry holds the key and value, and pointers to any older and newer entries.\n * @public\n */\nexport class Entry<K, V> {\n public newer?: Entry<K, V>;\n public older?: Entry<K, V>;\n constructor(public key: K, public value: V) { }\n}\n\nclass EntryIterator<K, V> implements Iterator<[K, V] | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n const val: [K, V] = [ent.key, ent.value];\n return { done: false, value: val };\n }\n}\n\nclass KeyIterator<K, V> implements Iterator<K | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.key };\n }\n}\n\nclass ValueIterator<K, V> implements Iterator<V | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.value };\n }\n}\n\n/** The interface that must be satisfied by the underlying container type used by a LRUCache.\n * Compatible with a [[Dictionary]] or a standard Map.\n * @public\n */\nexport interface EntryContainer<K, V> {\n readonly size: number;\n clear(): void;\n get(key: K): Entry<K, V> | undefined;\n set(key: K, value: Entry<K, V>): void;\n has(key: K): boolean;\n delete(key: K): void;\n}\n\n/**\n * A mapping of a key/value pairs, where the size of the cache can be limited.\n *\n * When entries are inserted, if the cache is \"full\", the\n * least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list.\n *\n * Illustration of the design:\n *\n * ```\n *\n * entry entry entry entry\n * ______ ______ ______ ______\n * | head |.newer => | |.newer => | |.newer => | tail |\n * | A | | B | | C | | D |\n * |______| <= older.|______| <= older.|______| <= older.|______|\n *\n * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n * ```\n * @public\n */\nexport class LRUCache<K, V> {\n private _container: EntryContainer<K, V>;\n\n /** Current number of items */\n public size: number;\n\n /** Maximum number of items this cache can hold */\n public limit: number;\n\n /** Least recently-used entry. Invalidated when cache is modified. */\n public oldest?: Entry<K, V>;\n\n /** Most recently-used entry. Invalidated when cache is modified. */\n public newest?: Entry<K, V>;\n\n /**\n * Construct a new LRUCache to hold up to `limit` entries.\n */\n public constructor(limit: number, container: EntryContainer<K, V>) {\n this.size = 0;\n this.limit = limit;\n this.oldest = this.newest = undefined;\n this._container = container;\n }\n\n private markEntryAsUsed(entry: Entry<K, V>) {\n if (entry === this.newest)\n return; // Already the most recently used entry, so no need to update the list\n\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C <D> E\n if (entry.newer) {\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.newest; // D. --> E\n if (this.newest) {\n this.newest.newer = entry; // E. <-- D\n }\n this.newest = entry;\n }\n\n /** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */\n public assign(entries: Iterable<[K, V]>): void {\n let entry;\n let limit = this.limit || Number.MAX_VALUE;\n this._container.clear();\n const it = entries[Symbol.iterator]();\n for (let itv = it.next(); !itv.done; itv = it.next()) {\n const e = new Entry(itv.value[0], itv.value[1]);\n this._container.set(e.key, e);\n if (!entry) {\n this.oldest = e;\n } else {\n entry.newer = e;\n e.older = entry;\n }\n entry = e;\n if (limit-- === 0) {\n throw new Error(\"overflow\");\n }\n }\n this.newest = entry;\n this.size = this._container.size;\n }\n\n /** Get and register recent use of <key>.\n * Returns the value associated with <key> or undefined if not in cache.\n */\n public get(key: K): V | undefined {\n // First, find our cache entry\n const entry = this._container.get(key);\n if (!entry)\n return; // Not cached. Sorry.\n // As <key> was found in the cache, register it as being requested recently\n this.markEntryAsUsed(entry);\n return entry.value;\n }\n\n /** Put <value> into the cache associated with <key>. Replaces any existing entry with the same key.\n * @returns `this`.\n */\n public set(key: K, value: V): LRUCache<K, V> {\n let entry = this._container.get(key);\n if (entry) {\n // update existing\n entry.value = value;\n this.markEntryAsUsed(entry);\n return this;\n }\n\n // new entry\n this._container.set(key, (entry = new Entry(key, value)));\n\n if (this.newest) {\n // link previous tail to the new tail (entry)\n this.newest.newer = entry;\n entry.older = this.newest;\n } else {\n // we're first in\n this.oldest = entry;\n }\n\n // add new entry to the end of the linked list -- it is now the freshest entry.\n this.newest = entry;\n ++this.size;\n if (this.size > this.limit) {\n // we hit the limit -- remove the head\n this.shift();\n }\n return this;\n }\n\n /** Purge the least recently used (oldest) entry from the cache.\n * @returns The removed entry or undefined if the cache was empty.\n */\n public shift(): [K, V] | undefined {\n const entry = this.oldest;\n if (entry) {\n if (entry.newer) {\n // advance the list\n this.oldest = entry.newer;\n this.oldest.older = undefined;\n } else {\n // the cache is exhausted\n this.oldest = undefined;\n this.newest = undefined;\n }\n // Remove last strong reference to <entry> and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n this._container.delete(entry.key);\n --this.size;\n return [entry.key, entry.value];\n }\n return undefined;\n }\n\n /** Access value for `key` without registering recent use. Useful if you do not\n * want to change the state of the cache, but only \"peek\" at it.\n * @returns The value associated with `key` if found, or undefined if not found.\n */\n public find(key: K): V | undefined {\n const e = this._container.get(key);\n return e ? e.value : undefined;\n }\n\n /** Check if there's a value for key in the cache without registering recent use. */\n public has(key: K): boolean {\n return this._container.has(key);\n }\n\n /** Remove entry `key` from cache and return its value.\n * @returns The removed value, or undefined if not found.\n */\n public delete(key: K): V | undefined {\n const entry = this._container.get(key);\n if (!entry)\n return;\n\n this._container.delete(entry.key);\n if (entry.newer && entry.older) {\n // re-link the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.oldest = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.newest = entry.older;\n } else { // if(entry.older === undefined && entry.newer === undefined) {\n this.oldest = this.newest = undefined;\n }\n\n this.size--;\n return entry.value;\n }\n\n /** Removes all entries */\n public clear(): void {\n // Note: clearing links should be safe, as we don't expose live links to user\n this.oldest = this.newest = undefined;\n this.size = 0;\n this._container.clear();\n }\n\n /** Returns an iterator over all keys, starting with the oldest. */\n public keys(): Iterator<K | undefined> | undefined {\n return this.oldest ? new KeyIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all values, starting with the oldest. */\n public values(): Iterator<V | undefined> | undefined {\n return this.oldest ? new ValueIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all entries, starting with the oldest. */\n public entries(): Iterator<[K, V] | undefined> | undefined {\n return this.oldest ? new EntryIterator(this.oldest) : undefined;\n }\n\n /** Call `fun` for each entry, starting with the oldest entry. */\n public forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void {\n if (typeof thisObj !== \"object\") {\n thisObj = this; // eslint-disable-line @typescript-eslint/no-this-alias\n }\n let entry = this.oldest;\n while (entry) {\n fun.call(thisObj, entry.value, entry.key, this);\n entry = entry.newer;\n }\n }\n\n /** Returns a JSON (array) representation */\n public toJSON(): Array<{ key: K, value: V }> {\n const s = new Array(this.size);\n let i = 0;\n let entry = this.oldest;\n while (entry) {\n s[i++] = { key: entry.key, value: entry.value };\n entry = entry.newer;\n }\n return s;\n }\n\n /** Returns a String representation */\n public toString(): string {\n let s = \"\";\n let entry = this.oldest;\n while (entry) {\n s += `${String(entry.key)}:${entry.value}`;\n entry = entry.newer;\n if (entry) {\n s += \" < \";\n }\n }\n return s;\n }\n}\n\n/** A [[LRUCache]] using a standard Map as its internal storage.\n * @public\n */\nexport class LRUMap<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUMap to hold up to `limit` entries.\n */\n constructor(limit: number) {\n super(limit, new Map<K, Entry<K, V>>());\n }\n}\n\n/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic.\n * @public\n */\nexport class LRUDictionary<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUDictionary to hold up to `limit` entries.\n * @param limit The maximum number of entries permitted in the dictionary.\n * @param compareKeys The function used to compare keys within the dictionary.\n */\n constructor(limit: number, compareKeys: OrderedComparator<K>) {\n super(limit, new Dictionary<K, Entry<K, V>>(compareKeys));\n }\n}\n"]}
1
+ {"version":3,"file":"LRUMap.js","sourceRoot":"","sources":["../../src/LRUMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,6CAA0C;AAE1C;;;;GAIG;AAEH;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AAE,KAAK,CAAC,KAAK,EAAE,CAAC;YAChD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACtB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,sCAAsC;IAC/B,QAAQ;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,OAAO,KAAK,EAAE,CAAC;YACb,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACpB,IAAI,KAAK,EAAE,CAAC;gBACV,CAAC,IAAI,KAAK,CAAC;YACb,CAAC;QACH,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AA3PD,4BA2PC;AAED;;GAEG;AACH,MAAa,MAAa,SAAQ,QAAc;IAC9C;;OAEG;IACH,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC1C,CAAC;CACF;AAPD,wBAOC;AAED;;GAEG;AACH,MAAa,aAAoB,SAAQ,QAAc;IACrD;;;;OAIG;IACH,YAAY,KAAa,EAAE,WAAiC;QAC1D,KAAK,CAAC,KAAK,EAAE,IAAI,uBAAU,CAAiB,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF;AATD,sCASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { OrderedComparator } from \"./Compare\";\nimport { Dictionary } from \"./Dictionary\";\n\n/**\n * Derived from:\n * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson <http://hunch.se/>\n * See README.md at https://github.com/rsms/js-lru for details.\n */\n\n/** An entry holds the key and value, and pointers to any older and newer entries.\n * @public\n */\nexport class Entry<K, V> {\n public newer?: Entry<K, V>;\n public older?: Entry<K, V>;\n constructor(public key: K, public value: V) { }\n}\n\nclass EntryIterator<K, V> implements Iterator<[K, V] | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n const val: [K, V] = [ent.key, ent.value];\n return { done: false, value: val };\n }\n}\n\nclass KeyIterator<K, V> implements Iterator<K | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.key };\n }\n}\n\nclass ValueIterator<K, V> implements Iterator<V | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.value };\n }\n}\n\n/** The interface that must be satisfied by the underlying container type used by a LRUCache.\n * Compatible with a [[Dictionary]] or a standard Map.\n * @public\n */\nexport interface EntryContainer<K, V> {\n readonly size: number;\n clear(): void;\n get(key: K): Entry<K, V> | undefined;\n set(key: K, value: Entry<K, V>): void;\n has(key: K): boolean;\n delete(key: K): void;\n}\n\n/**\n * A mapping of a key/value pairs, where the size of the cache can be limited.\n *\n * When entries are inserted, if the cache is \"full\", the\n * least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list.\n *\n * Illustration of the design:\n *\n * ```\n *\n * entry entry entry entry\n * ______ ______ ______ ______\n * | head |.newer => | |.newer => | |.newer => | tail |\n * | A | | B | | C | | D |\n * |______| <= older.|______| <= older.|______| <= older.|______|\n *\n * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n * ```\n * @public\n */\nexport class LRUCache<K, V> {\n private _container: EntryContainer<K, V>;\n\n /** Current number of items */\n public size: number;\n\n /** Maximum number of items this cache can hold */\n public limit: number;\n\n /** Least recently-used entry. Invalidated when cache is modified. */\n public oldest?: Entry<K, V>;\n\n /** Most recently-used entry. Invalidated when cache is modified. */\n public newest?: Entry<K, V>;\n\n /**\n * Construct a new LRUCache to hold up to `limit` entries.\n */\n public constructor(limit: number, container: EntryContainer<K, V>) {\n this.size = 0;\n this.limit = limit;\n this.oldest = this.newest = undefined;\n this._container = container;\n }\n\n private markEntryAsUsed(entry: Entry<K, V>) {\n if (entry === this.newest)\n return; // Already the most recently used entry, so no need to update the list\n\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C <D> E\n if (entry.newer) {\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.newest; // D. --> E\n if (this.newest) {\n this.newest.newer = entry; // E. <-- D\n }\n this.newest = entry;\n }\n\n /** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */\n public assign(entries: Iterable<[K, V]>): void {\n let entry;\n let limit = this.limit || Number.MAX_VALUE;\n this._container.clear();\n const it = entries[Symbol.iterator]();\n for (let itv = it.next(); !itv.done; itv = it.next()) {\n const e = new Entry(itv.value[0], itv.value[1]);\n this._container.set(e.key, e);\n if (!entry) {\n this.oldest = e;\n } else {\n entry.newer = e;\n e.older = entry;\n }\n entry = e;\n if (limit-- === 0) {\n throw new Error(\"overflow\");\n }\n }\n this.newest = entry;\n this.size = this._container.size;\n }\n\n /** Get and register recent use of <key>.\n * Returns the value associated with <key> or undefined if not in cache.\n */\n public get(key: K): V | undefined {\n // First, find our cache entry\n const entry = this._container.get(key);\n if (!entry)\n return; // Not cached. Sorry.\n // As <key> was found in the cache, register it as being requested recently\n this.markEntryAsUsed(entry);\n return entry.value;\n }\n\n /** Put <value> into the cache associated with <key>. Replaces any existing entry with the same key.\n * @returns `this`.\n */\n public set(key: K, value: V): LRUCache<K, V> {\n let entry = this._container.get(key);\n if (entry) {\n // update existing\n entry.value = value;\n this.markEntryAsUsed(entry);\n return this;\n }\n\n // new entry\n this._container.set(key, (entry = new Entry(key, value)));\n\n if (this.newest) {\n // link previous tail to the new tail (entry)\n this.newest.newer = entry;\n entry.older = this.newest;\n } else {\n // we're first in\n this.oldest = entry;\n }\n\n // add new entry to the end of the linked list -- it is now the freshest entry.\n this.newest = entry;\n ++this.size;\n if (this.size > this.limit) {\n // we hit the limit -- remove the head\n this.shift();\n }\n return this;\n }\n\n /** Purge the least recently used (oldest) entry from the cache.\n * @returns The removed entry or undefined if the cache was empty.\n */\n public shift(): [K, V] | undefined {\n const entry = this.oldest;\n if (entry) {\n if (entry.newer) {\n // advance the list\n this.oldest = entry.newer;\n this.oldest.older = undefined;\n } else {\n // the cache is exhausted\n this.oldest = undefined;\n this.newest = undefined;\n }\n // Remove last strong reference to <entry> and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n this._container.delete(entry.key);\n --this.size;\n return [entry.key, entry.value];\n }\n return undefined;\n }\n\n /** Access value for `key` without registering recent use. Useful if you do not\n * want to change the state of the cache, but only \"peek\" at it.\n * @returns The value associated with `key` if found, or undefined if not found.\n */\n public find(key: K): V | undefined {\n const e = this._container.get(key);\n return e ? e.value : undefined;\n }\n\n /** Check if there's a value for key in the cache without registering recent use. */\n public has(key: K): boolean {\n return this._container.has(key);\n }\n\n /** Remove entry `key` from cache and return its value.\n * @returns The removed value, or undefined if not found.\n */\n public delete(key: K): V | undefined {\n const entry = this._container.get(key);\n if (!entry)\n return;\n\n this._container.delete(entry.key);\n if (entry.newer && entry.older) {\n // re-link the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.oldest = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.newest = entry.older;\n } else { // if(entry.older === undefined && entry.newer === undefined) {\n this.oldest = this.newest = undefined;\n }\n\n this.size--;\n return entry.value;\n }\n\n /** Removes all entries */\n public clear(): void {\n // Note: clearing links should be safe, as we don't expose live links to user\n this.oldest = this.newest = undefined;\n this.size = 0;\n this._container.clear();\n }\n\n /** Returns an iterator over all keys, starting with the oldest. */\n public keys(): Iterator<K | undefined> | undefined {\n return this.oldest ? new KeyIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all values, starting with the oldest. */\n public values(): Iterator<V | undefined> | undefined {\n return this.oldest ? new ValueIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all entries, starting with the oldest. */\n public entries(): Iterator<[K, V] | undefined> | undefined {\n return this.oldest ? new EntryIterator(this.oldest) : undefined;\n }\n\n /** Call `fun` for each entry, starting with the oldest entry. */\n public forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void {\n if (typeof thisObj !== \"object\") {\n thisObj = this; // eslint-disable-line @typescript-eslint/no-this-alias\n }\n let entry = this.oldest;\n while (entry) {\n fun.call(thisObj, entry.value, entry.key, this);\n entry = entry.newer;\n }\n }\n\n /** Returns a JSON (array) representation */\n public toJSON(): Array<{ key: K, value: V }> {\n const s = new Array(this.size);\n let i = 0;\n let entry = this.oldest;\n while (entry) {\n s[i++] = { key: entry.key, value: entry.value };\n entry = entry.newer;\n }\n return s;\n }\n\n /** Returns a String representation */\n public toString(): string {\n let s = \"\";\n let entry = this.oldest;\n while (entry) {\n s += `${String(entry.key)}:${String(entry.value)}`;\n entry = entry.newer;\n if (entry) {\n s += \" < \";\n }\n }\n return s;\n }\n}\n\n/** A [[LRUCache]] using a standard Map as its internal storage.\n * @public\n */\nexport class LRUMap<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUMap to hold up to `limit` entries.\n */\n constructor(limit: number) {\n super(limit, new Map<K, Entry<K, V>>());\n }\n}\n\n/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic.\n * @public\n */\nexport class LRUDictionary<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUDictionary to hold up to `limit` entries.\n * @param limit The maximum number of entries permitted in the dictionary.\n * @param compareKeys The function used to compare keys within the dictionary.\n */\n constructor(limit: number, compareKeys: OrderedComparator<K>) {\n super(limit, new Dictionary<K, Entry<K, V>>(compareKeys));\n }\n}\n"]}
@@ -17,6 +17,8 @@ export declare class ProcessDetector {
17
17
  static get isElectronAppFrontend(): boolean;
18
18
  /** Is this process the backend of an Electron app? */
19
19
  static get isElectronAppBackend(): boolean;
20
+ /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */
21
+ static get isIEBrowser(): boolean;
20
22
  /** Is this process running in a browser on an iPad?
21
23
  * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
22
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessDetector.d.ts","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,WAAkB,gBAAgB,YAAiF;IAEnH;;MAEE;IACF,WAAkB,aAAa,YAA4E;IAE3G,uDAAuD;IACvD,WAAkB,qBAAqB,YAA0G;IAEjJ,sDAAsD;IACtD,WAAkB,oBAAoB,YAAyF;IAE/H;;OAEG;IACH,WAAkB,aAAa,YAE9B;IAED;;OAEG;IACH,WAAkB,eAAe,YAA2F;IAE5H;;MAEE;IACF,WAAkB,YAAY,YAAyD;IAEvF;;MAEE;IACF,WAAkB,gBAAgB,YAAmF;IAErH;;MAEE;IACF,WAAkB,eAAe,YAAyD;IAE1F,oGAAoG;IACpG,WAAkB,UAAU,YAE3B;IAED;;;OAGG;IACH,WAAkB,mBAAmB,YAAiE;IAEtG,iEAAiE;IACjE,WAAkB,gBAAgB,YAA2F;IAE7H,qEAAqE;IACrE,WAAkB,oBAAoB,YAA+F;IAErI,gEAAgE;IAChE,WAAkB,eAAe,YAAwE;IAEzG,oEAAoE;IACpE,WAAkB,mBAAmB,YAA4E;IAEjH,6CAA6C;IAC7C,WAAkB,kBAAkB,YAA+D;IAEnG,yEAAyE;IACzE,WAAkB,mBAAmB,YAAqE;CAC3G"}
1
+ {"version":3,"file":"ProcessDetector.d.ts","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,WAAkB,gBAAgB,YAAiF;IAEnH;;MAEE;IACF,WAAkB,aAAa,YAA4E;IAE3G,uDAAuD;IACvD,WAAkB,qBAAqB,YAA0G;IAEjJ,sDAAsD;IACtD,WAAkB,oBAAoB,YAAyF;IAE/H,qFAAqF;IACrF,WAAkB,WAAW,YAA+E;IAE5G;;OAEG;IACH,WAAkB,aAAa,YAE9B;IAED;;OAEG;IACH,WAAkB,eAAe,YAA2F;IAE5H;;MAEE;IACF,WAAkB,YAAY,YAAyD;IAEvF;;MAEE;IACF,WAAkB,gBAAgB,YAAmF;IAErH;;MAEE;IACF,WAAkB,eAAe,YAAyD;IAE1F,oGAAoG;IACpG,WAAkB,UAAU,YAE3B;IAED;;;OAGG;IACH,WAAkB,mBAAmB,YAAiE;IAEtG,iEAAiE;IACjE,WAAkB,gBAAgB,YAA2F;IAE7H,qEAAqE;IACrE,WAAkB,oBAAoB,YAA+F;IAErI,gEAAgE;IAChE,WAAkB,eAAe,YAAwE;IAEzG,oEAAoE;IACpE,WAAkB,mBAAmB,YAA4E;IAEjH,6CAA6C;IAC7C,WAAkB,kBAAkB,YAA+D;IAEnG,yEAAyE;IACzE,WAAkB,mBAAmB,YAAqE;CAC3G"}
@@ -24,6 +24,8 @@ class ProcessDetector {
24
24
  static get isElectronAppFrontend() { return typeof navigator === "object" && navigator.userAgent.toLowerCase().indexOf("electron") >= 0; }
25
25
  /** Is this process the backend of an Electron app? */
26
26
  static get isElectronAppBackend() { return typeof process === "object" && process.versions.hasOwnProperty("electron"); }
27
+ /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */
28
+ static get isIEBrowser() { return !!document.documentMode || !!window.StyleMedia; }
27
29
  /** Is this process running in a browser on an iPad?
28
30
  * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
29
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,MAAa,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,sDAAsD;IAC/C,MAAM,KAAK,oBAAoB,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/H;;OAEG;IACI,MAAM,KAAK,aAAa;QAC7B,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,Q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AAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,qEAAqE;IAC9D,MAAM,KAAK,oBAAoB,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAErI,gEAAgE;IACzD,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,KAAK,CAAC,CAAC,CAAC;IAEzG,oEAAoE;IAC7D,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,SAAS,CAAC,CAAC,CAAC;IAEjH,6CAA6C;IACtC,MAAM,KAAK,kBAAkB,KAAK,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEnG,yEAAyE;IAClE,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC3G;AAzED,0CAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ProcessDetector\n */\n\n/** Functions to determine the type of JavaScript process currently executing.\n * @public\n */\nexport class ProcessDetector {\n\n /** Is this a browser process?\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\n */\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\n\n /** Is this a Node process?\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\n */\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\n\n /** Is this process the frontend of an Electron app? */\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\n\n /** Is this process the backend of an Electron app? */\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\n\n /** Is this process running in a browser on an iPad?\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPadBrowser() {\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */\n }\n\n /** Is this process running in a browser on an iPhone?\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\n\n /** Is this process running in a browser on an iOS device?\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\n\n /** Is this process running in a browser on an Android device?\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\n */\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\n\n /** Is this process running in a browser on a mobile device?\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\n */\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\n\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\n public static get isChromium() {\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\n }\n\n /** Is this process the frontend of an iTwin mobile application?\n * @note this indicates that this is a browser process started by an iTwin mobile application.\n * It will return `false` when running user-launched web browsers on a mobile device.\n */\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\n\n /** Is this process the frontend of an iOS mobile application? */\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\n\n /** Is this process the frontend of an Android mobile application? */\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\n\n /** Is this process the backend of an iOS mobile application? */\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\n\n /** Is this process the backend of an Android mobile application? */\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\n\n /** Is this process a mobile app backend? */\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\n\n /** Is this process the frontend of a native (Electron or Mobile) app? */\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\n}\n"]}
1
+ {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,MAAa,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,s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bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ProcessDetector\n */\n\n/** Functions to determine the type of JavaScript process currently executing.\n * @public\n */\nexport class ProcessDetector {\n\n /** Is this a browser process?\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\n */\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\n\n /** Is this a Node process?\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\n */\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\n\n /** Is this process the frontend of an Electron app? */\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\n\n /** Is this process the backend of an Electron app? */\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\n\n /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */\n public static get isIEBrowser() { return !!(document as any).documentMode || !!(window as any).StyleMedia; }\n\n /** Is this process running in a browser on an iPad?\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPadBrowser() {\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */\n }\n\n /** Is this process running in a browser on an iPhone?\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\n\n /** Is this process running in a browser on an iOS device?\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\n\n /** Is this process running in a browser on an Android device?\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\n */\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\n\n /** Is this process running in a browser on a mobile device?\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\n */\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\n\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\n public static get isChromium() {\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\n }\n\n /** Is this process the frontend of an iTwin mobile application?\n * @note this indicates that this is a browser process started by an iTwin mobile application.\n * It will return `false` when running user-launched web browsers on a mobile device.\n */\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\n\n /** Is this process the frontend of an iOS mobile application? */\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\n\n /** Is this process the frontend of an Android mobile application? */\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\n\n /** Is this process the backend of an iOS mobile application? */\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\n\n /** Is this process the backend of an Android mobile application? */\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\n\n /** Is this process a mobile app backend? */\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\n\n /** Is this process the frontend of a native (Electron or Mobile) app? */\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\n}\n"]}
@@ -11,6 +11,7 @@ export * from "./Compare";
11
11
  export * from "./CompressedId64Set";
12
12
  export * from "./Dictionary";
13
13
  export * from "./Disposable";
14
+ export * from "./Expect";
14
15
  export * from "./Id";
15
16
  export * from "./IndexMap";
16
17
  export * from "./JsonSchema";
@@ -1 +1 @@
1
- {"version":3,"file":"core-bentley.d.ts","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,0BAA0B,CAAC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
1
+ {"version":3,"file":"core-bentley.d.ts","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,0BAA0B,CAAC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
@@ -31,6 +31,7 @@ __exportStar(require("./Compare"), exports);
31
31
  __exportStar(require("./CompressedId64Set"), exports);
32
32
  __exportStar(require("./Dictionary"), exports);
33
33
  __exportStar(require("./Disposable"), exports);
34
+ __exportStar(require("./Expect"), exports);
34
35
  __exportStar(require("./Id"), exports);
35
36
  __exportStar(require("./IndexMap"), exports);
36
37
  __exportStar(require("./JsonSchema"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"core-bentley.js","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,iDAA+B;AAC/B,0DAAwC;AACxC,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,sDAAoC;AACpC,+CAA6B;AAC7B,+CAA6B;AAC7B,uCAAqB;AACrB,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAC9B,gDAA8B;AAC9B,yCAAuB;AACvB,4CAA0B;AAC1B,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC;AACnC,iDAA+B;AAC/B,iDAA+B;AAE/B,oFAAoF;AACpF,2DAAyC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./AccessToken\";\nexport * from \"./Assert\";\nexport * from \"./BeEvent\";\nexport * from \"./BentleyError\";\nexport * from \"./BentleyLoggerCategory\";\nexport * from \"./StatusCategory\";\nexport * from \"./BeSQLite\";\nexport * from \"./ByteStream\";\nexport * from \"./ClassUtils\";\nexport * from \"./Compare\";\nexport * from \"./CompressedId64Set\";\nexport * from \"./Dictionary\";\nexport * from \"./Disposable\";\nexport * from \"./Id\";\nexport * from \"./IndexMap\";\nexport * from \"./JsonSchema\";\nexport * from \"./JsonUtils\";\nexport * from \"./Logger\";\nexport * from \"./LRUMap\";\nexport * from \"./ObservableSet\";\nexport * from \"./OneAtATimeAction\";\nexport * from \"./OrderedId64Iterable\";\nexport * from \"./OrderedSet\";\nexport * from \"./partitionArray\";\nexport * from \"./PriorityQueue\";\nexport * from \"./ProcessDetector\";\nexport * from \"./SortedArray\";\nexport * from \"./StringUtils\";\nexport * from \"./Time\";\nexport * from \"./Tracing\";\nexport * from \"./TupleKeyedMap\";\nexport * from \"./TypedArrayBuilder\";\nexport * from \"./UnexpectedErrors\";\nexport * from \"./UtilityTypes\";\nexport * from \"./YieldManager\";\n\n// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-bentley package contains classes to solve problems that are common for both client and server use cases.\n */\n/**\n * @docs-group-description BeSQLite\n * Classes for working with SQLite databases. SQLite underlies IModelDb and ECDb - see [Executing ECSQL]($docs/learning/ECSQL.md)\n */\n/**\n * @docs-group-description Errors\n * Classes for working with errors.\n */\n/**\n * @docs-group-description Events\n * Classes for raising and handling events.\n */\n/**\n * @docs-group-description Ids\n * Classes for working with unique identifiers.\n */\n/**\n * @docs-group-description Logging\n * Classes for configuring and logging diagnostic messages - see [Learning about Logging]($docs/learning/common/Logging.md)\n */\n/**\n * @docs-group-description Collections\n * Specialized, customizable collection classes like priority queues.\n */\n/**\n * @docs-group-description Json\n * utilities for dealing with Json strings and files.\n */\n/**\n * @docs-group-description Utils\n * Miscellaneous utility classes.\n */\n/**\n * @docs-group-description ProcessDetector\n * Functions for determining the type of the current JavaScript process.\n */\n"]}
1
+ {"version":3,"file":"core-bentley.js","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,iDAA+B;AAC/B,0DAAwC;AACxC,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,sDAAoC;AACpC,+CAA6B;AAC7B,+CAA6B;AAC7B,2CAAyB;AACzB,uCAAqB;AACrB,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAC9B,gDAA8B;AAC9B,yCAAuB;AACvB,4CAA0B;AAC1B,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC;AACnC,iDAA+B;AAC/B,iDAA+B;AAE/B,oFAAoF;AACpF,2DAAyC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./AccessToken\";\nexport * from \"./Assert\";\nexport * from \"./BeEvent\";\nexport * from \"./BentleyError\";\nexport * from \"./BentleyLoggerCategory\";\nexport * from \"./StatusCategory\";\nexport * from \"./BeSQLite\";\nexport * from \"./ByteStream\";\nexport * from \"./ClassUtils\";\nexport * from \"./Compare\";\nexport * from \"./CompressedId64Set\";\nexport * from \"./Dictionary\";\nexport * from \"./Disposable\";\nexport * from \"./Expect\";\nexport * from \"./Id\";\nexport * from \"./IndexMap\";\nexport * from \"./JsonSchema\";\nexport * from \"./JsonUtils\";\nexport * from \"./Logger\";\nexport * from \"./LRUMap\";\nexport * from \"./ObservableSet\";\nexport * from \"./OneAtATimeAction\";\nexport * from \"./OrderedId64Iterable\";\nexport * from \"./OrderedSet\";\nexport * from \"./partitionArray\";\nexport * from \"./PriorityQueue\";\nexport * from \"./ProcessDetector\";\nexport * from \"./SortedArray\";\nexport * from \"./StringUtils\";\nexport * from \"./Time\";\nexport * from \"./Tracing\";\nexport * from \"./TupleKeyedMap\";\nexport * from \"./TypedArrayBuilder\";\nexport * from \"./UnexpectedErrors\";\nexport * from \"./UtilityTypes\";\nexport * from \"./YieldManager\";\n\n// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-bentley package contains classes to solve problems that are common for both client and server use cases.\n */\n/**\n * @docs-group-description BeSQLite\n * Classes for working with SQLite databases. SQLite underlies IModelDb and ECDb - see [Executing ECSQL]($docs/learning/ECSQL.md)\n */\n/**\n * @docs-group-description Errors\n * Classes for working with errors.\n */\n/**\n * @docs-group-description Events\n * Classes for raising and handling events.\n */\n/**\n * @docs-group-description Ids\n * Classes for working with unique identifiers.\n */\n/**\n * @docs-group-description Logging\n * Classes for configuring and logging diagnostic messages - see [Learning about Logging]($docs/learning/common/Logging.md)\n */\n/**\n * @docs-group-description Collections\n * Specialized, customizable collection classes like priority queues.\n */\n/**\n * @docs-group-description Json\n * utilities for dealing with Json strings and files.\n */\n/**\n * @docs-group-description Utils\n * Miscellaneous utility classes.\n */\n/**\n * @docs-group-description ProcessDetector\n * Functions for determining the type of the current JavaScript process.\n */\n"]}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Expects that a value is defined (not undefined).
3
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
4
+ * handle undefined values instead of throwing an error.
5
+ * @param value The value to check.
6
+ * @param message Optional error message to be used in thrown Error.
7
+ * @returns The original value if it is defined.
8
+ * @throws Error if the value is undefined.
9
+ * @internal
10
+ */
11
+ export declare function expectDefined<T>(value: T | undefined, message?: string): T;
12
+ /**
13
+ * Expects that a value is not null.
14
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
15
+ * handle null values instead of throwing an error.
16
+ * @param value The value to check.
17
+ * @param message Optional error message to be used in thrown Error.
18
+ * @returns The original value if it is not null.
19
+ * @throws Error if the value is null.
20
+ * @internal
21
+ */
22
+ export declare function expectNotNull<T>(value: T | null, message?: string): T;
23
+ //# sourceMappingURL=Expect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expect.d.ts","sourceRoot":"","sources":["../../src/Expect.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAK1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAKrE"}
@@ -0,0 +1,37 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /**
6
+ * Expects that a value is defined (not undefined).
7
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
8
+ * handle undefined values instead of throwing an error.
9
+ * @param value The value to check.
10
+ * @param message Optional error message to be used in thrown Error.
11
+ * @returns The original value if it is defined.
12
+ * @throws Error if the value is undefined.
13
+ * @internal
14
+ */
15
+ export function expectDefined(value, message) {
16
+ if (value === undefined) {
17
+ throw new Error(message ?? "Expected value to be defined, but it was undefined.");
18
+ }
19
+ return value;
20
+ }
21
+ /**
22
+ * Expects that a value is not null.
23
+ * @note Almost always, places that use this function should in the future be cleaned up to properly
24
+ * handle null values instead of throwing an error.
25
+ * @param value The value to check.
26
+ * @param message Optional error message to be used in thrown Error.
27
+ * @returns The original value if it is not null.
28
+ * @throws Error if the value is null.
29
+ * @internal
30
+ */
31
+ export function expectNotNull(value, message) {
32
+ if (value === null) {
33
+ throw new Error(message ?? "Expected value to be not null, but it was null.");
34
+ }
35
+ return value;
36
+ }
37
+ //# sourceMappingURL=Expect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Expect.js","sourceRoot":"","sources":["../../src/Expect.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAI,KAAoB,EAAE,OAAgB;IACrE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,qDAAqD,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAI,KAAe,EAAE,OAAgB;IAChE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,iDAAiD,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/**\n * Expects that a value is defined (not undefined).\n * @note Almost always, places that use this function should in the future be cleaned up to properly\n * handle undefined values instead of throwing an error.\n * @param value The value to check.\n * @param message Optional error message to be used in thrown Error.\n * @returns The original value if it is defined.\n * @throws Error if the value is undefined.\n * @internal\n */\nexport function expectDefined<T>(value: T | undefined, message?: string): T {\n if (value === undefined) {\n throw new Error(message ?? \"Expected value to be defined, but it was undefined.\");\n }\n return value;\n}\n\n/**\n * Expects that a value is not null.\n * @note Almost always, places that use this function should in the future be cleaned up to properly\n * handle null values instead of throwing an error.\n * @param value The value to check.\n * @param message Optional error message to be used in thrown Error.\n * @returns The original value if it is not null.\n * @throws Error if the value is null.\n * @internal\n */\nexport function expectNotNull<T>(value: T | null, message?: string): T {\n if (value === null) {\n throw new Error(message ?? \"Expected value to be not null, but it was null.\");\n }\n return value;\n}\n"]}
package/lib/esm/LRUMap.js CHANGED
@@ -307,7 +307,7 @@ export class LRUCache {
307
307
  let s = "";
308
308
  let entry = this.oldest;
309
309
  while (entry) {
310
- s += `${String(entry.key)}:${entry.value}`;
310
+ s += `${String(entry.key)}:${String(entry.value)}`;
311
311
  entry = entry.newer;
312
312
  if (entry) {
313
313
  s += " < ";
@@ -1 +1 @@
1
- {"version":3,"file":"LRUMap.js","sourceRoot":"","sources":["../../src/LRUMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AAEH;;GAEG;AACH,MAAM,OAAO,KAAK;IAGG;IAAe;IAF3B,KAAK,CAAe;IACpB,KAAK,CAAe;IAC3B,YAAmB,GAAM,EAAS,KAAQ;QAAvB,QAAG,GAAH,GAAG,CAAG;QAAS,UAAK,GAAL,KAAK,CAAG;IAAI,CAAC;CAChD;AAED,MAAM,aAAa;IACT,MAAM,CAA0B;IACxC,YAAY,WAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;IACM,IAAI;QACT,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,CAAC,GAAG;YACN,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC;QACxB,MAAM,GAAG,GAAW,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACz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;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAoB,SAAQ,QAAc;IACrD;;;;OAIG;IACH,YAAY,KAAa,EAAE,WAAiC;QAC1D,KAAK,CAAC,KAAK,EAAE,IAAI,UAAU,CAAiB,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { OrderedComparator } from \"./Compare\";\nimport { Dictionary } from \"./Dictionary\";\n\n/**\n * Derived from:\n * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson <http://hunch.se/>\n * See README.md at https://github.com/rsms/js-lru for details.\n */\n\n/** An entry holds the key and value, and pointers to any older and newer entries.\n * @public\n */\nexport class Entry<K, V> {\n public newer?: Entry<K, V>;\n public older?: Entry<K, V>;\n constructor(public key: K, public value: V) { }\n}\n\nclass EntryIterator<K, V> implements Iterator<[K, V] | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n const val: [K, V] = [ent.key, ent.value];\n return { done: false, value: val };\n }\n}\n\nclass KeyIterator<K, V> implements Iterator<K | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.key };\n }\n}\n\nclass ValueIterator<K, V> implements Iterator<V | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.value };\n }\n}\n\n/** The interface that must be satisfied by the underlying container type used by a LRUCache.\n * Compatible with a [[Dictionary]] or a standard Map.\n * @public\n */\nexport interface EntryContainer<K, V> {\n readonly size: number;\n clear(): void;\n get(key: K): Entry<K, V> | undefined;\n set(key: K, value: Entry<K, V>): void;\n has(key: K): boolean;\n delete(key: K): void;\n}\n\n/**\n * A mapping of a key/value pairs, where the size of the cache can be limited.\n *\n * When entries are inserted, if the cache is \"full\", the\n * least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list.\n *\n * Illustration of the design:\n *\n * ```\n *\n * entry entry entry entry\n * ______ ______ ______ ______\n * | head |.newer => | |.newer => | |.newer => | tail |\n * | A | | B | | C | | D |\n * |______| <= older.|______| <= older.|______| <= older.|______|\n *\n * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n * ```\n * @public\n */\nexport class LRUCache<K, V> {\n private _container: EntryContainer<K, V>;\n\n /** Current number of items */\n public size: number;\n\n /** Maximum number of items this cache can hold */\n public limit: number;\n\n /** Least recently-used entry. Invalidated when cache is modified. */\n public oldest?: Entry<K, V>;\n\n /** Most recently-used entry. Invalidated when cache is modified. */\n public newest?: Entry<K, V>;\n\n /**\n * Construct a new LRUCache to hold up to `limit` entries.\n */\n public constructor(limit: number, container: EntryContainer<K, V>) {\n this.size = 0;\n this.limit = limit;\n this.oldest = this.newest = undefined;\n this._container = container;\n }\n\n private markEntryAsUsed(entry: Entry<K, V>) {\n if (entry === this.newest)\n return; // Already the most recently used entry, so no need to update the list\n\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C <D> E\n if (entry.newer) {\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.newest; // D. --> E\n if (this.newest) {\n this.newest.newer = entry; // E. <-- D\n }\n this.newest = entry;\n }\n\n /** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */\n public assign(entries: Iterable<[K, V]>): void {\n let entry;\n let limit = this.limit || Number.MAX_VALUE;\n this._container.clear();\n const it = entries[Symbol.iterator]();\n for (let itv = it.next(); !itv.done; itv = it.next()) {\n const e = new Entry(itv.value[0], itv.value[1]);\n this._container.set(e.key, e);\n if (!entry) {\n this.oldest = e;\n } else {\n entry.newer = e;\n e.older = entry;\n }\n entry = e;\n if (limit-- === 0) {\n throw new Error(\"overflow\");\n }\n }\n this.newest = entry;\n this.size = this._container.size;\n }\n\n /** Get and register recent use of <key>.\n * Returns the value associated with <key> or undefined if not in cache.\n */\n public get(key: K): V | undefined {\n // First, find our cache entry\n const entry = this._container.get(key);\n if (!entry)\n return; // Not cached. Sorry.\n // As <key> was found in the cache, register it as being requested recently\n this.markEntryAsUsed(entry);\n return entry.value;\n }\n\n /** Put <value> into the cache associated with <key>. Replaces any existing entry with the same key.\n * @returns `this`.\n */\n public set(key: K, value: V): LRUCache<K, V> {\n let entry = this._container.get(key);\n if (entry) {\n // update existing\n entry.value = value;\n this.markEntryAsUsed(entry);\n return this;\n }\n\n // new entry\n this._container.set(key, (entry = new Entry(key, value)));\n\n if (this.newest) {\n // link previous tail to the new tail (entry)\n this.newest.newer = entry;\n entry.older = this.newest;\n } else {\n // we're first in\n this.oldest = entry;\n }\n\n // add new entry to the end of the linked list -- it is now the freshest entry.\n this.newest = entry;\n ++this.size;\n if (this.size > this.limit) {\n // we hit the limit -- remove the head\n this.shift();\n }\n return this;\n }\n\n /** Purge the least recently used (oldest) entry from the cache.\n * @returns The removed entry or undefined if the cache was empty.\n */\n public shift(): [K, V] | undefined {\n const entry = this.oldest;\n if (entry) {\n if (entry.newer) {\n // advance the list\n this.oldest = entry.newer;\n this.oldest.older = undefined;\n } else {\n // the cache is exhausted\n this.oldest = undefined;\n this.newest = undefined;\n }\n // Remove last strong reference to <entry> and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n this._container.delete(entry.key);\n --this.size;\n return [entry.key, entry.value];\n }\n return undefined;\n }\n\n /** Access value for `key` without registering recent use. Useful if you do not\n * want to change the state of the cache, but only \"peek\" at it.\n * @returns The value associated with `key` if found, or undefined if not found.\n */\n public find(key: K): V | undefined {\n const e = this._container.get(key);\n return e ? e.value : undefined;\n }\n\n /** Check if there's a value for key in the cache without registering recent use. */\n public has(key: K): boolean {\n return this._container.has(key);\n }\n\n /** Remove entry `key` from cache and return its value.\n * @returns The removed value, or undefined if not found.\n */\n public delete(key: K): V | undefined {\n const entry = this._container.get(key);\n if (!entry)\n return;\n\n this._container.delete(entry.key);\n if (entry.newer && entry.older) {\n // re-link the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.oldest = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.newest = entry.older;\n } else { // if(entry.older === undefined && entry.newer === undefined) {\n this.oldest = this.newest = undefined;\n }\n\n this.size--;\n return entry.value;\n }\n\n /** Removes all entries */\n public clear(): void {\n // Note: clearing links should be safe, as we don't expose live links to user\n this.oldest = this.newest = undefined;\n this.size = 0;\n this._container.clear();\n }\n\n /** Returns an iterator over all keys, starting with the oldest. */\n public keys(): Iterator<K | undefined> | undefined {\n return this.oldest ? new KeyIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all values, starting with the oldest. */\n public values(): Iterator<V | undefined> | undefined {\n return this.oldest ? new ValueIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all entries, starting with the oldest. */\n public entries(): Iterator<[K, V] | undefined> | undefined {\n return this.oldest ? new EntryIterator(this.oldest) : undefined;\n }\n\n /** Call `fun` for each entry, starting with the oldest entry. */\n public forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void {\n if (typeof thisObj !== \"object\") {\n thisObj = this; // eslint-disable-line @typescript-eslint/no-this-alias\n }\n let entry = this.oldest;\n while (entry) {\n fun.call(thisObj, entry.value, entry.key, this);\n entry = entry.newer;\n }\n }\n\n /** Returns a JSON (array) representation */\n public toJSON(): Array<{ key: K, value: V }> {\n const s = new Array(this.size);\n let i = 0;\n let entry = this.oldest;\n while (entry) {\n s[i++] = { key: entry.key, value: entry.value };\n entry = entry.newer;\n }\n return s;\n }\n\n /** Returns a String representation */\n public toString(): string {\n let s = \"\";\n let entry = this.oldest;\n while (entry) {\n s += `${String(entry.key)}:${entry.value}`;\n entry = entry.newer;\n if (entry) {\n s += \" < \";\n }\n }\n return s;\n }\n}\n\n/** A [[LRUCache]] using a standard Map as its internal storage.\n * @public\n */\nexport class LRUMap<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUMap to hold up to `limit` entries.\n */\n constructor(limit: number) {\n super(limit, new Map<K, Entry<K, V>>());\n }\n}\n\n/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic.\n * @public\n */\nexport class LRUDictionary<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUDictionary to hold up to `limit` entries.\n * @param limit The maximum number of entries permitted in the dictionary.\n * @param compareKeys The function used to compare keys within the dictionary.\n */\n constructor(limit: number, compareKeys: OrderedComparator<K>) {\n super(limit, new Dictionary<K, Entry<K, V>>(compareKeys));\n }\n}\n"]}
1
+ {"version":3,"file":"LRUMap.js","sourceRoot":"","sources":["../../src/LRUMap.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;GAIG;AAEH;;GAEG;AACH,MAAM,OAAO,KAAK;IAGG;IAAe;IAF3B,KAAK,CAAe;IACpB,KAAK,CAAe;IAC3B,YAAmB,GAAM,EAAS,KAAQ;QAAvB,QAAG,GAAH,GAAG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C/B,QAAQ;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,OAAO,KAAK,EAAE,CAAC;YACb,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YACpB,IAAI,KAAK,EAAE,CAAC;gBACV,CAAC,IAAI,KAAK,CAAC;YACb,CAAC;QACH,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,MAAa,SAAQ,QAAc;IAC9C;;OAEG;IACH,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,EAAkB,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAoB,SAAQ,QAAc;IACrD;;;;OAIG;IACH,YAAY,KAAa,EAAE,WAAiC;QAC1D,KAAK,CAAC,KAAK,EAAE,IAAI,UAAU,CAAiB,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { OrderedComparator } from \"./Compare\";\nimport { Dictionary } from \"./Dictionary\";\n\n/**\n * Derived from:\n * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson <http://hunch.se/>\n * See README.md at https://github.com/rsms/js-lru for details.\n */\n\n/** An entry holds the key and value, and pointers to any older and newer entries.\n * @public\n */\nexport class Entry<K, V> {\n public newer?: Entry<K, V>;\n public older?: Entry<K, V>;\n constructor(public key: K, public value: V) { }\n}\n\nclass EntryIterator<K, V> implements Iterator<[K, V] | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n const val: [K, V] = [ent.key, ent.value];\n return { done: false, value: val };\n }\n}\n\nclass KeyIterator<K, V> implements Iterator<K | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.key };\n }\n}\n\nclass ValueIterator<K, V> implements Iterator<V | undefined> {\n private _entry: Entry<K, V> | undefined;\n constructor(oldestEntry: Entry<K, V>) {\n this._entry = oldestEntry;\n }\n public next() {\n const ent = this._entry;\n if (!ent)\n return { done: true, value: undefined };\n this._entry = ent.newer;\n return { done: false, value: ent.value };\n }\n}\n\n/** The interface that must be satisfied by the underlying container type used by a LRUCache.\n * Compatible with a [[Dictionary]] or a standard Map.\n * @public\n */\nexport interface EntryContainer<K, V> {\n readonly size: number;\n clear(): void;\n get(key: K): Entry<K, V> | undefined;\n set(key: K, value: Entry<K, V>): void;\n has(key: K): boolean;\n delete(key: K): void;\n}\n\n/**\n * A mapping of a key/value pairs, where the size of the cache can be limited.\n *\n * When entries are inserted, if the cache is \"full\", the\n * least-recently-used (LRU) value is dropped. When entries are retrieved, they are moved to the front of the LRU list.\n *\n * Illustration of the design:\n *\n * ```\n *\n * entry entry entry entry\n * ______ ______ ______ ______\n * | head |.newer => | |.newer => | |.newer => | tail |\n * | A | | B | | C | | D |\n * |______| <= older.|______| <= older.|______| <= older.|______|\n *\n * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n * ```\n * @public\n */\nexport class LRUCache<K, V> {\n private _container: EntryContainer<K, V>;\n\n /** Current number of items */\n public size: number;\n\n /** Maximum number of items this cache can hold */\n public limit: number;\n\n /** Least recently-used entry. Invalidated when cache is modified. */\n public oldest?: Entry<K, V>;\n\n /** Most recently-used entry. Invalidated when cache is modified. */\n public newest?: Entry<K, V>;\n\n /**\n * Construct a new LRUCache to hold up to `limit` entries.\n */\n public constructor(limit: number, container: EntryContainer<K, V>) {\n this.size = 0;\n this.limit = limit;\n this.oldest = this.newest = undefined;\n this._container = container;\n }\n\n private markEntryAsUsed(entry: Entry<K, V>) {\n if (entry === this.newest)\n return; // Already the most recently used entry, so no need to update the list\n\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C <D> E\n if (entry.newer) {\n if (entry === this.oldest) {\n this.oldest = entry.newer;\n }\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older) {\n entry.older.newer = entry.newer; // C. --> E\n }\n entry.newer = undefined; // D --x\n entry.older = this.newest; // D. --> E\n if (this.newest) {\n this.newest.newer = entry; // E. <-- D\n }\n this.newest = entry;\n }\n\n /** Replace all values in this cache with key-value pairs (2-element Arrays) from provided iterable. */\n public assign(entries: Iterable<[K, V]>): void {\n let entry;\n let limit = this.limit || Number.MAX_VALUE;\n this._container.clear();\n const it = entries[Symbol.iterator]();\n for (let itv = it.next(); !itv.done; itv = it.next()) {\n const e = new Entry(itv.value[0], itv.value[1]);\n this._container.set(e.key, e);\n if (!entry) {\n this.oldest = e;\n } else {\n entry.newer = e;\n e.older = entry;\n }\n entry = e;\n if (limit-- === 0) {\n throw new Error(\"overflow\");\n }\n }\n this.newest = entry;\n this.size = this._container.size;\n }\n\n /** Get and register recent use of <key>.\n * Returns the value associated with <key> or undefined if not in cache.\n */\n public get(key: K): V | undefined {\n // First, find our cache entry\n const entry = this._container.get(key);\n if (!entry)\n return; // Not cached. Sorry.\n // As <key> was found in the cache, register it as being requested recently\n this.markEntryAsUsed(entry);\n return entry.value;\n }\n\n /** Put <value> into the cache associated with <key>. Replaces any existing entry with the same key.\n * @returns `this`.\n */\n public set(key: K, value: V): LRUCache<K, V> {\n let entry = this._container.get(key);\n if (entry) {\n // update existing\n entry.value = value;\n this.markEntryAsUsed(entry);\n return this;\n }\n\n // new entry\n this._container.set(key, (entry = new Entry(key, value)));\n\n if (this.newest) {\n // link previous tail to the new tail (entry)\n this.newest.newer = entry;\n entry.older = this.newest;\n } else {\n // we're first in\n this.oldest = entry;\n }\n\n // add new entry to the end of the linked list -- it is now the freshest entry.\n this.newest = entry;\n ++this.size;\n if (this.size > this.limit) {\n // we hit the limit -- remove the head\n this.shift();\n }\n return this;\n }\n\n /** Purge the least recently used (oldest) entry from the cache.\n * @returns The removed entry or undefined if the cache was empty.\n */\n public shift(): [K, V] | undefined {\n const entry = this.oldest;\n if (entry) {\n if (entry.newer) {\n // advance the list\n this.oldest = entry.newer;\n this.oldest.older = undefined;\n } else {\n // the cache is exhausted\n this.oldest = undefined;\n this.newest = undefined;\n }\n // Remove last strong reference to <entry> and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n this._container.delete(entry.key);\n --this.size;\n return [entry.key, entry.value];\n }\n return undefined;\n }\n\n /** Access value for `key` without registering recent use. Useful if you do not\n * want to change the state of the cache, but only \"peek\" at it.\n * @returns The value associated with `key` if found, or undefined if not found.\n */\n public find(key: K): V | undefined {\n const e = this._container.get(key);\n return e ? e.value : undefined;\n }\n\n /** Check if there's a value for key in the cache without registering recent use. */\n public has(key: K): boolean {\n return this._container.has(key);\n }\n\n /** Remove entry `key` from cache and return its value.\n * @returns The removed value, or undefined if not found.\n */\n public delete(key: K): V | undefined {\n const entry = this._container.get(key);\n if (!entry)\n return;\n\n this._container.delete(entry.key);\n if (entry.newer && entry.older) {\n // re-link the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.oldest = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.newest = entry.older;\n } else { // if(entry.older === undefined && entry.newer === undefined) {\n this.oldest = this.newest = undefined;\n }\n\n this.size--;\n return entry.value;\n }\n\n /** Removes all entries */\n public clear(): void {\n // Note: clearing links should be safe, as we don't expose live links to user\n this.oldest = this.newest = undefined;\n this.size = 0;\n this._container.clear();\n }\n\n /** Returns an iterator over all keys, starting with the oldest. */\n public keys(): Iterator<K | undefined> | undefined {\n return this.oldest ? new KeyIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all values, starting with the oldest. */\n public values(): Iterator<V | undefined> | undefined {\n return this.oldest ? new ValueIterator(this.oldest) : undefined;\n }\n\n /** Returns an iterator over all entries, starting with the oldest. */\n public entries(): Iterator<[K, V] | undefined> | undefined {\n return this.oldest ? new EntryIterator(this.oldest) : undefined;\n }\n\n /** Call `fun` for each entry, starting with the oldest entry. */\n public forEach(fun: (value: V, key: K, m: LRUCache<K, V>) => void, thisObj?: any): void {\n if (typeof thisObj !== \"object\") {\n thisObj = this; // eslint-disable-line @typescript-eslint/no-this-alias\n }\n let entry = this.oldest;\n while (entry) {\n fun.call(thisObj, entry.value, entry.key, this);\n entry = entry.newer;\n }\n }\n\n /** Returns a JSON (array) representation */\n public toJSON(): Array<{ key: K, value: V }> {\n const s = new Array(this.size);\n let i = 0;\n let entry = this.oldest;\n while (entry) {\n s[i++] = { key: entry.key, value: entry.value };\n entry = entry.newer;\n }\n return s;\n }\n\n /** Returns a String representation */\n public toString(): string {\n let s = \"\";\n let entry = this.oldest;\n while (entry) {\n s += `${String(entry.key)}:${String(entry.value)}`;\n entry = entry.newer;\n if (entry) {\n s += \" < \";\n }\n }\n return s;\n }\n}\n\n/** A [[LRUCache]] using a standard Map as its internal storage.\n * @public\n */\nexport class LRUMap<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUMap to hold up to `limit` entries.\n */\n constructor(limit: number) {\n super(limit, new Map<K, Entry<K, V>>());\n }\n}\n\n/** A [[LRUCache]] using a [[Dictionary]] as its internal storage, permitting custom key comparison logic.\n * @public\n */\nexport class LRUDictionary<K, V> extends LRUCache<K, V> {\n /**\n * Construct a new LRUDictionary to hold up to `limit` entries.\n * @param limit The maximum number of entries permitted in the dictionary.\n * @param compareKeys The function used to compare keys within the dictionary.\n */\n constructor(limit: number, compareKeys: OrderedComparator<K>) {\n super(limit, new Dictionary<K, Entry<K, V>>(compareKeys));\n }\n}\n"]}
@@ -17,6 +17,8 @@ export declare class ProcessDetector {
17
17
  static get isElectronAppFrontend(): boolean;
18
18
  /** Is this process the backend of an Electron app? */
19
19
  static get isElectronAppBackend(): boolean;
20
+ /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */
21
+ static get isIEBrowser(): boolean;
20
22
  /** Is this process running in a browser on an iPad?
21
23
  * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
22
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessDetector.d.ts","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,WAAkB,gBAAgB,YAAiF;IAEnH;;MAEE;IACF,WAAkB,aAAa,YAA4E;IAE3G,uDAAuD;IACvD,WAAkB,qBAAqB,YAA0G;IAEjJ,sDAAsD;IACtD,WAAkB,oBAAoB,YAAyF;IAE/H;;OAEG;IACH,WAAkB,aAAa,YAE9B;IAED;;OAEG;IACH,WAAkB,eAAe,YAA2F;IAE5H;;MAEE;IACF,WAAkB,YAAY,YAAyD;IAEvF;;MAEE;IACF,WAAkB,gBAAgB,YAAmF;IAErH;;MAEE;IACF,WAAkB,eAAe,YAAyD;IAE1F,oGAAoG;IACpG,WAAkB,UAAU,YAE3B;IAED;;;OAGG;IACH,WAAkB,mBAAmB,YAAiE;IAEtG,iEAAiE;IACjE,WAAkB,gBAAgB,YAA2F;IAE7H,qEAAqE;IACrE,WAAkB,oBAAoB,YAA+F;IAErI,gEAAgE;IAChE,WAAkB,eAAe,YAAwE;IAEzG,oEAAoE;IACpE,WAAkB,mBAAmB,YAA4E;IAEjH,6CAA6C;IAC7C,WAAkB,kBAAkB,YAA+D;IAEnG,yEAAyE;IACzE,WAAkB,mBAAmB,YAAqE;CAC3G"}
1
+ {"version":3,"file":"ProcessDetector.d.ts","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,qBAAa,eAAe;IAE1B;;OAEG;IACH,WAAkB,gBAAgB,YAAiF;IAEnH;;MAEE;IACF,WAAkB,aAAa,YAA4E;IAE3G,uDAAuD;IACvD,WAAkB,qBAAqB,YAA0G;IAEjJ,sDAAsD;IACtD,WAAkB,oBAAoB,YAAyF;IAE/H,qFAAqF;IACrF,WAAkB,WAAW,YAA+E;IAE5G;;OAEG;IACH,WAAkB,aAAa,YAE9B;IAED;;OAEG;IACH,WAAkB,eAAe,YAA2F;IAE5H;;MAEE;IACF,WAAkB,YAAY,YAAyD;IAEvF;;MAEE;IACF,WAAkB,gBAAgB,YAAmF;IAErH;;MAEE;IACF,WAAkB,eAAe,YAAyD;IAE1F,oGAAoG;IACpG,WAAkB,UAAU,YAE3B;IAED;;;OAGG;IACH,WAAkB,mBAAmB,YAAiE;IAEtG,iEAAiE;IACjE,WAAkB,gBAAgB,YAA2F;IAE7H,qEAAqE;IACrE,WAAkB,oBAAoB,YAA+F;IAErI,gEAAgE;IAChE,WAAkB,eAAe,YAAwE;IAEzG,oEAAoE;IACpE,WAAkB,mBAAmB,YAA4E;IAEjH,6CAA6C;IAC7C,WAAkB,kBAAkB,YAA+D;IAEnG,yEAAyE;IACzE,WAAkB,mBAAmB,YAAqE;CAC3G"}
@@ -21,6 +21,8 @@ export class ProcessDetector {
21
21
  static get isElectronAppFrontend() { return typeof navigator === "object" && navigator.userAgent.toLowerCase().indexOf("electron") >= 0; }
22
22
  /** Is this process the backend of an Electron app? */
23
23
  static get isElectronAppBackend() { return typeof process === "object" && process.versions.hasOwnProperty("electron"); }
24
+ /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */
25
+ static get isIEBrowser() { return !!document.documentMode || !!window.StyleMedia; }
24
26
  /** Is this process running in a browser on an iPad?
25
27
  * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
26
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,OAAO,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,sDAAsD;IAC/C,MAAM,KAAK,oBAAoB,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/H;;OAEG;IACI,MAAM,KAAK,aAAa;QAC7B,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,0DAA0D;IAClP,CAAC;IAED;;OAEG;IACI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AI,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAErI,gEAAgE;IACzD,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,KAAK,CAAC,CAAC,CAAC;IAEzG,oEAAoE;IAC7D,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,SAAS,CAAC,CAAC,CAAC;IAEjH,6CAA6C;IACtC,MAAM,KAAK,kBAAkB,KAAK,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEnG,yEAAyE;IAClE,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC3G","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ProcessDetector\n */\n\n/** Functions to determine the type of JavaScript process currently executing.\n * @public\n */\nexport class ProcessDetector {\n\n /** Is this a browser process?\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\n */\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\n\n /** Is this a Node process?\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\n */\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\n\n /** Is this process the frontend of an Electron app? */\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\n\n /** Is this process the backend of an Electron app? */\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\n\n /** Is this process running in a browser on an iPad?\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPadBrowser() {\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */\n }\n\n /** Is this process running in a browser on an iPhone?\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\n\n /** Is this process running in a browser on an iOS device?\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\n\n /** Is this process running in a browser on an Android device?\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\n */\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\n\n /** Is this process running in a browser on a mobile device?\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\n */\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\n\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\n public static get isChromium() {\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\n }\n\n /** Is this process the frontend of an iTwin mobile application?\n * @note this indicates that this is a browser process started by an iTwin mobile application.\n * It will return `false` when running user-launched web browsers on a mobile device.\n */\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\n\n /** Is this process the frontend of an iOS mobile application? */\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\n\n /** Is this process the frontend of an Android mobile application? */\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\n\n /** Is this process the backend of an iOS mobile application? */\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\n\n /** Is this process the backend of an Android mobile application? */\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\n\n /** Is this process a mobile app backend? */\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\n\n /** Is this process the frontend of a native (Electron or Mobile) app? */\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\n}\n"]}
1
+ {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,OAAO,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,sDAAsD;IAC/C,MAAM,KAAK,oBAAoB,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/H,qFAAqF;IAC9E,MAAM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qBAAqB,CAAC;IACvK,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEtG,iEAAiE;IAC1D,MAAM,KAAK,gBAAgB,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,qEAAqE;IAC9D,MAAM,KAAK,oBAAoB,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAErI,gEAAgE;IACzD,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,KAAK,CAAC,CAAC,CAAC;IAEzG,oEAAoE;IAC7D,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,SAAS,CAAC,CAAC,CAAC;IAEjH,6CAA6C;IACtC,MAAM,KAAK,kBAAkB,KAAK,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEnG,yEAAyE;IAClE,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC3G","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ProcessDetector\n */\n\n/** Functions to determine the type of JavaScript process currently executing.\n * @public\n */\nexport class ProcessDetector {\n\n /** Is this a browser process?\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\n */\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\n\n /** Is this a Node process?\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\n */\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\n\n /** Is this process the frontend of an Electron app? */\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\n\n /** Is this process the backend of an Electron app? */\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\n\n /** Is this process running in an Internet Explorer or old Microsoft Edge browser? */\n public static get isIEBrowser() { return !!(document as any).documentMode || !!(window as any).StyleMedia; }\n\n /** Is this process running in a browser on an iPad?\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPadBrowser() {\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */\n }\n\n /** Is this process running in a browser on an iPhone?\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\n\n /** Is this process running in a browser on an iOS device?\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\n */\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\n\n /** Is this process running in a browser on an Android device?\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\n */\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\n\n /** Is this process running in a browser on a mobile device?\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\n */\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\n\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\n public static get isChromium() {\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\n }\n\n /** Is this process the frontend of an iTwin mobile application?\n * @note this indicates that this is a browser process started by an iTwin mobile application.\n * It will return `false` when running user-launched web browsers on a mobile device.\n */\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\n\n /** Is this process the frontend of an iOS mobile application? */\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\n\n /** Is this process the frontend of an Android mobile application? */\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\n\n /** Is this process the backend of an iOS mobile application? */\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\n\n /** Is this process the backend of an Android mobile application? */\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\n\n /** Is this process a mobile app backend? */\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\n\n /** Is this process the frontend of a native (Electron or Mobile) app? */\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\n}\n"]}
@@ -11,6 +11,7 @@ export * from "./Compare";
11
11
  export * from "./CompressedId64Set";
12
12
  export * from "./Dictionary";
13
13
  export * from "./Disposable";
14
+ export * from "./Expect";
14
15
  export * from "./Id";
15
16
  export * from "./IndexMap";
16
17
  export * from "./JsonSchema";
@@ -1 +1 @@
1
- {"version":3,"file":"core-bentley.d.ts","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"m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BAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,0BAA0B,CAAC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
@@ -15,6 +15,7 @@ export * from "./Compare";
15
15
  export * from "./CompressedId64Set";
16
16
  export * from "./Dictionary";
17
17
  export * from "./Disposable";
18
+ export * from "./Expect";
18
19
  export * from "./Id";
19
20
  export * from "./IndexMap";
20
21
  export * from "./JsonSchema";
@@ -1 +1 @@
1
- {"version":3,"file":"core-bentley.js","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,oFAAoF;AACpF,cAAc,0BAA0B,CAAC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./AccessToken\";\nexport * from \"./Assert\";\nexport * from \"./BeEvent\";\nexport * from \"./BentleyError\";\nexport * from \"./BentleyLoggerCategory\";\nexport * from \"./StatusCategory\";\nexport * from \"./BeSQLite\";\nexport * from \"./ByteStream\";\nexport * from \"./ClassUtils\";\nexport * from \"./Compare\";\nexport * from \"./CompressedId64Set\";\nexport * from \"./Dictionary\";\nexport * from \"./Disposable\";\nexport * from \"./Id\";\nexport * from \"./IndexMap\";\nexport * from \"./JsonSchema\";\nexport * from \"./JsonUtils\";\nexport * from \"./Logger\";\nexport * from \"./LRUMap\";\nexport * from \"./ObservableSet\";\nexport * from \"./OneAtATimeAction\";\nexport * from \"./OrderedId64Iterable\";\nexport * from \"./OrderedSet\";\nexport * from \"./partitionArray\";\nexport * from \"./PriorityQueue\";\nexport * from \"./ProcessDetector\";\nexport * from \"./SortedArray\";\nexport * from \"./StringUtils\";\nexport * from \"./Time\";\nexport * from \"./Tracing\";\nexport * from \"./TupleKeyedMap\";\nexport * from \"./TypedArrayBuilder\";\nexport * from \"./UnexpectedErrors\";\nexport * from \"./UtilityTypes\";\nexport * from \"./YieldManager\";\n\n// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-bentley package contains classes to solve problems that are common for both client and server use cases.\n */\n/**\n * @docs-group-description BeSQLite\n * Classes for working with SQLite databases. SQLite underlies IModelDb and ECDb - see [Executing ECSQL]($docs/learning/ECSQL.md)\n */\n/**\n * @docs-group-description Errors\n * Classes for working with errors.\n */\n/**\n * @docs-group-description Events\n * Classes for raising and handling events.\n */\n/**\n * @docs-group-description Ids\n * Classes for working with unique identifiers.\n */\n/**\n * @docs-group-description Logging\n * Classes for configuring and logging diagnostic messages - see [Learning about Logging]($docs/learning/common/Logging.md)\n */\n/**\n * @docs-group-description Collections\n * Specialized, customizable collection classes like priority queues.\n */\n/**\n * @docs-group-description Json\n * utilities for dealing with Json strings and files.\n */\n/**\n * @docs-group-description Utils\n * Miscellaneous utility classes.\n */\n/**\n * @docs-group-description ProcessDetector\n * Functions for determining the type of the current JavaScript process.\n */\n"]}
1
+ {"version":3,"file":"core-bentley.js","sourceRoot":"","sources":["../../src/core-bentley.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAE/B,oFAAoF;AACpF,cAAc,0BAA0B,CAAC;AAEzC;;GAEG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nexport * from \"./AccessToken\";\nexport * from \"./Assert\";\nexport * from \"./BeEvent\";\nexport * from \"./BentleyError\";\nexport * from \"./BentleyLoggerCategory\";\nexport * from \"./StatusCategory\";\nexport * from \"./BeSQLite\";\nexport * from \"./ByteStream\";\nexport * from \"./ClassUtils\";\nexport * from \"./Compare\";\nexport * from \"./CompressedId64Set\";\nexport * from \"./Dictionary\";\nexport * from \"./Disposable\";\nexport * from \"./Expect\";\nexport * from \"./Id\";\nexport * from \"./IndexMap\";\nexport * from \"./JsonSchema\";\nexport * from \"./JsonUtils\";\nexport * from \"./Logger\";\nexport * from \"./LRUMap\";\nexport * from \"./ObservableSet\";\nexport * from \"./OneAtATimeAction\";\nexport * from \"./OrderedId64Iterable\";\nexport * from \"./OrderedSet\";\nexport * from \"./partitionArray\";\nexport * from \"./PriorityQueue\";\nexport * from \"./ProcessDetector\";\nexport * from \"./SortedArray\";\nexport * from \"./StringUtils\";\nexport * from \"./Time\";\nexport * from \"./Tracing\";\nexport * from \"./TupleKeyedMap\";\nexport * from \"./TypedArrayBuilder\";\nexport * from \"./UnexpectedErrors\";\nexport * from \"./UtilityTypes\";\nexport * from \"./YieldManager\";\n\n// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.\nexport * from \"./internal/cross-package\";\n\n/** @docs-package-description\n * The core-bentley package contains classes to solve problems that are common for both client and server use cases.\n */\n/**\n * @docs-group-description BeSQLite\n * Classes for working with SQLite databases. SQLite underlies IModelDb and ECDb - see [Executing ECSQL]($docs/learning/ECSQL.md)\n */\n/**\n * @docs-group-description Errors\n * Classes for working with errors.\n */\n/**\n * @docs-group-description Events\n * Classes for raising and handling events.\n */\n/**\n * @docs-group-description Ids\n * Classes for working with unique identifiers.\n */\n/**\n * @docs-group-description Logging\n * Classes for configuring and logging diagnostic messages - see [Learning about Logging]($docs/learning/common/Logging.md)\n */\n/**\n * @docs-group-description Collections\n * Specialized, customizable collection classes like priority queues.\n */\n/**\n * @docs-group-description Json\n * utilities for dealing with Json strings and files.\n */\n/**\n * @docs-group-description Utils\n * Miscellaneous utility classes.\n */\n/**\n * @docs-group-description ProcessDetector\n * Functions for determining the type of the current JavaScript process.\n */\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-bentley",
3
- "version": "5.2.0-dev.3",
3
+ "version": "5.2.0-dev.31",
4
4
  "description": "Bentley JavaScript core components",
5
5
  "main": "lib/cjs/core-bentley.js",
6
6
  "module": "lib/esm/core-bentley.js",
@@ -30,7 +30,7 @@
30
30
  "rimraf": "^6.0.1",
31
31
  "typescript": "~5.6.2",
32
32
  "vitest": "^3.0.6",
33
- "@itwin/build-tools": "5.2.0-dev.3"
33
+ "@itwin/build-tools": "5.2.0-dev.31"
34
34
  },
35
35
  "nyc": {
36
36
  "extends": "./node_modules/@itwin/build-tools/.nycrc"