@itwin/core-bentley 5.0.0-dev.8 → 5.0.0-dev.82
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 +46 -1
- package/lib/cjs/BeEvent.js +3 -7
- package/lib/cjs/BeEvent.js.map +1 -1
- package/lib/cjs/BentleyError.d.ts +3 -0
- package/lib/cjs/BentleyError.d.ts.map +1 -1
- package/lib/cjs/BentleyError.js +6 -1
- package/lib/cjs/BentleyError.js.map +1 -1
- package/lib/cjs/ByteStream.d.ts +3 -22
- package/lib/cjs/ByteStream.d.ts.map +1 -1
- package/lib/cjs/ByteStream.js +7 -21
- package/lib/cjs/ByteStream.js.map +1 -1
- package/lib/cjs/Compare.d.ts +15 -0
- package/lib/cjs/Compare.d.ts.map +1 -1
- package/lib/cjs/Compare.js +48 -0
- package/lib/cjs/Compare.js.map +1 -1
- package/lib/cjs/CompressedId64Set.js +6 -3
- package/lib/cjs/CompressedId64Set.js.map +1 -1
- package/lib/cjs/Dictionary.js +8 -3
- package/lib/cjs/Dictionary.js.map +1 -1
- package/lib/cjs/Disposable.d.ts +18 -0
- package/lib/cjs/Disposable.d.ts.map +1 -1
- package/lib/cjs/Disposable.js +25 -25
- package/lib/cjs/Disposable.js.map +1 -1
- package/lib/cjs/Id.d.ts +0 -4
- package/lib/cjs/Id.d.ts.map +1 -1
- package/lib/cjs/Id.js +9 -11
- package/lib/cjs/Id.js.map +1 -1
- package/lib/cjs/IndexMap.js +6 -1
- package/lib/cjs/IndexMap.js.map +1 -1
- package/lib/cjs/LRUMap.js +16 -0
- package/lib/cjs/LRUMap.js.map +1 -1
- package/lib/cjs/Logger.d.ts +24 -2
- package/lib/cjs/Logger.d.ts.map +1 -1
- package/lib/cjs/Logger.js +26 -7
- package/lib/cjs/Logger.js.map +1 -1
- package/lib/cjs/ObservableSet.js +6 -6
- package/lib/cjs/ObservableSet.js.map +1 -1
- package/lib/cjs/OneAtATimeAction.js +9 -0
- package/lib/cjs/OneAtATimeAction.js.map +1 -1
- package/lib/cjs/OrderedSet.js +1 -0
- package/lib/cjs/OrderedSet.js.map +1 -1
- package/lib/cjs/PriorityQueue.js +3 -1
- package/lib/cjs/PriorityQueue.js.map +1 -1
- package/lib/cjs/SortedArray.js +4 -1
- package/lib/cjs/SortedArray.js.map +1 -1
- package/lib/cjs/StatusCategory.js +42 -105
- package/lib/cjs/StatusCategory.js.map +1 -1
- package/lib/cjs/Time.js +5 -0
- package/lib/cjs/Time.js.map +1 -1
- package/lib/cjs/Tracing.js +2 -0
- package/lib/cjs/Tracing.js.map +1 -1
- package/lib/cjs/TupleKeyedMap.js +2 -2
- package/lib/cjs/TupleKeyedMap.js.map +1 -1
- package/lib/cjs/TypedArrayBuilder.js +8 -0
- package/lib/cjs/TypedArrayBuilder.js.map +1 -1
- package/lib/cjs/UnexpectedErrors.js +10 -12
- package/lib/cjs/UnexpectedErrors.js.map +1 -1
- package/lib/cjs/YieldManager.js +3 -1
- package/lib/cjs/YieldManager.js.map +1 -1
- package/lib/cjs/internal/cross-package.d.ts +0 -1
- package/lib/cjs/internal/cross-package.d.ts.map +1 -1
- package/lib/cjs/internal/cross-package.js +1 -3
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/esm/BeEvent.js +3 -7
- package/lib/esm/BeEvent.js.map +1 -1
- package/lib/esm/BentleyError.d.ts +3 -0
- package/lib/esm/BentleyError.d.ts.map +1 -1
- package/lib/esm/BentleyError.js +6 -1
- package/lib/esm/BentleyError.js.map +1 -1
- package/lib/esm/ByteStream.d.ts +3 -22
- package/lib/esm/ByteStream.d.ts.map +1 -1
- package/lib/esm/ByteStream.js +7 -21
- package/lib/esm/ByteStream.js.map +1 -1
- package/lib/esm/Compare.d.ts +15 -0
- package/lib/esm/Compare.d.ts.map +1 -1
- package/lib/esm/Compare.js +46 -0
- package/lib/esm/Compare.js.map +1 -1
- package/lib/esm/CompressedId64Set.js +6 -3
- package/lib/esm/CompressedId64Set.js.map +1 -1
- package/lib/esm/Dictionary.js +8 -3
- package/lib/esm/Dictionary.js.map +1 -1
- package/lib/esm/Disposable.d.ts +18 -0
- package/lib/esm/Disposable.d.ts.map +1 -1
- package/lib/esm/Disposable.js +24 -25
- package/lib/esm/Disposable.js.map +1 -1
- package/lib/esm/Id.d.ts +0 -4
- package/lib/esm/Id.d.ts.map +1 -1
- package/lib/esm/Id.js +9 -11
- package/lib/esm/Id.js.map +1 -1
- package/lib/esm/IndexMap.js +6 -1
- package/lib/esm/IndexMap.js.map +1 -1
- package/lib/esm/LRUMap.js +16 -0
- package/lib/esm/LRUMap.js.map +1 -1
- package/lib/esm/Logger.d.ts +24 -2
- package/lib/esm/Logger.d.ts.map +1 -1
- package/lib/esm/Logger.js +26 -7
- package/lib/esm/Logger.js.map +1 -1
- package/lib/esm/ObservableSet.js +6 -6
- package/lib/esm/ObservableSet.js.map +1 -1
- package/lib/esm/OneAtATimeAction.js +9 -0
- package/lib/esm/OneAtATimeAction.js.map +1 -1
- package/lib/esm/OrderedSet.js +1 -0
- package/lib/esm/OrderedSet.js.map +1 -1
- package/lib/esm/PriorityQueue.js +3 -1
- package/lib/esm/PriorityQueue.js.map +1 -1
- package/lib/esm/SortedArray.js +4 -1
- package/lib/esm/SortedArray.js.map +1 -1
- package/lib/esm/StatusCategory.js +42 -105
- package/lib/esm/StatusCategory.js.map +1 -1
- package/lib/esm/Time.js +5 -0
- package/lib/esm/Time.js.map +1 -1
- package/lib/esm/Tracing.js +2 -0
- package/lib/esm/Tracing.js.map +1 -1
- package/lib/esm/TupleKeyedMap.js +2 -2
- package/lib/esm/TupleKeyedMap.js.map +1 -1
- package/lib/esm/TypedArrayBuilder.js +8 -0
- package/lib/esm/TypedArrayBuilder.js.map +1 -1
- package/lib/esm/UnexpectedErrors.js +10 -12
- package/lib/esm/UnexpectedErrors.js.map +1 -1
- package/lib/esm/YieldManager.js +3 -1
- package/lib/esm/YieldManager.js.map +1 -1
- package/lib/esm/internal/cross-package.d.ts +0 -1
- package/lib/esm/internal/cross-package.d.ts.map +1 -1
- package/lib/esm/internal/cross-package.js +0 -1
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/package.json +8 -8
- package/lib/cjs/internal/staticLoggerMetadata.d.ts +0 -11
- package/lib/cjs/internal/staticLoggerMetadata.d.ts.map +0 -1
- package/lib/cjs/internal/staticLoggerMetadata.js +0 -17
- package/lib/cjs/internal/staticLoggerMetadata.js.map +0 -1
- package/lib/esm/internal/staticLoggerMetadata.d.ts +0 -11
- package/lib/esm/internal/staticLoggerMetadata.d.ts.map +0 -1
- package/lib/esm/internal/staticLoggerMetadata.js +0 -14
- package/lib/esm/internal/staticLoggerMetadata.js.map +0 -1
|
@@ -21,6 +21,14 @@ import { assert } from "./Assert";
|
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
23
|
export class TypedArrayBuilder {
|
|
24
|
+
/** The constructor for the specific type of array being populated. */
|
|
25
|
+
_constructor;
|
|
26
|
+
/** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
|
|
27
|
+
_data;
|
|
28
|
+
/** The number of elements added to the array so far. */
|
|
29
|
+
_length;
|
|
30
|
+
/** Multiplier applied to required capacity by [[ensureCapacity]]. */
|
|
31
|
+
growthFactor;
|
|
24
32
|
/** Constructs a new builder from the specified options, with a [[length]] of zero. */
|
|
25
33
|
constructor(constructor, options) {
|
|
26
34
|
this._constructor = constructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IAU5B,sFAAsF;IACtF,YAAsB,WAA2B,EAAE,OAAkC;QACnF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,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BAAkB,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,kBAAkB,IAAI,eAAe;YACvC,OAAO;QAET,IAAI,CAAC,YAAY,GAAG,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACnH,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,sCAAsC;IACtB,IAAI,CAAC,KAAa;QAChC,IAAI,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,wCAAwC;IACxB,MAAM,CAAC,MAAiB;QACtC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,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 { Constructor } from \"./UtilityTypes\";\nimport { assert } from \"./Assert\";\n\n/** Options used to construct a [[TypedArrayBuilder]].\n * @public\n */\nexport interface TypedArrayBuilderOptions {\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\n * Default: 1.5\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\n */\n growthFactor?: number;\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\n * initial capacity to avoid reallocations when populating the array.\n * Default: 0.\n * Minimum: 0.\n */\n initialCapacity?: number;\n}\n\n/** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.\n * @see [[UintArrayBuilder]] to construct such an array.\n * @public\n */\nexport type UintArray = Uint8Array | Uint16Array | Uint32Array;\n\n/** Incrementally builds a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of unsigned 8-, 16-, or 32-bit integers.\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\n *\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\n *\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\n * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.\n * @public\n */\nexport class TypedArrayBuilder<T extends UintArray> {\n /** The constructor for the specific type of array being populated. */\n protected _constructor: Constructor<T>;\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\n protected _data: T;\n /** The number of elements added to the array so far. */\n protected _length: number;\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\n public readonly growthFactor: number;\n\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\n this._constructor = constructor;\n this._data = new constructor(options?.initialCapacity ?? 0);\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\n this._length = 0;\n }\n\n /** The number of elements currently in the array. */\n public get length(): number {\n return this._length;\n }\n\n /** The number of elements that can fit into the memory currently allocated for the array. */\n public get capacity(): number {\n return this._data.length;\n }\n\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\n * returns the element at the specified index, with negative integers counting back from the end of the array.\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\n */\n public at(index: number): number {\n if (index < 0)\n index = this.length - index;\n\n const value = this._data[index];\n assert(value !== undefined, \"index out of bounds\");\n return value;\n }\n\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\n *\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\n */\n public ensureCapacity(newCapacity: number): number {\n if (this.capacity >= newCapacity)\n return this.capacity;\n\n assert(this.growthFactor >= 1.0);\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\n const prevData = this._data;\n this._data = new this._constructor(newCapacity);\n this._data.set(prevData, 0);\n\n assert(this.capacity === newCapacity);\n return this.capacity;\n }\n\n /** Append the specified value, resizing if necessary. */\n public push(value: number): void {\n this.ensureCapacity(this.length + 1);\n this._data[this.length] = value;\n ++this._length;\n }\n\n /** Append an array of values, resizing (at most once) if necessary. */\n public append(values: T): void {\n const newLength = this.length + values.length;\n this.ensureCapacity(newLength);\n this._data.set(values, this.length);\n this._length = newLength;\n }\n\n /** Obtain the finished array.\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\n * returned array's length will be equal to [[length]].\n */\n public toTypedArray(includeUnusedCapacity = false): T {\n if (includeUnusedCapacity)\n return this._data;\n\n const subarray = this._data.subarray(0, this.length);\n assert(subarray instanceof this._constructor);\n assert(subarray.buffer === this._data.buffer);\n return subarray;\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * @public\n */\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint8Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\n * @public\n */\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint16Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\n * @public\n */\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint32Array, options);\n }\n\n /** Obtain a view of the finished array as an array of bytes. */\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\n if (includeUnusedCapacity)\n return new Uint8Array(this._data.buffer);\n\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\n }\n}\n\n/** Options used to construct a [[UintArrayBuilder]].\n * @public\n */\nexport interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {\n /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than\n * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.\n * Default: `Uint8Array`.\n */\n initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;\n}\n\n/** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum\n * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.\n *\n * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].\n * As values are added to the array, if the bytes per element supported by the underlying array is too small to hold one of the new values, the array is\n * reallocated to a type large enough to hold all of the new values. For example, the following produces a `Uint8Array` because all values are less than 256:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 2, 254, 255]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint8Array);\n * ```\n *\n * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 255, 257, 65535]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint16Array);\n * ```\n *\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.\n * @public\n */\nexport class UintArrayBuilder extends TypedArrayBuilder<UintArray> {\n public constructor(options?: UintArrayBuilderOptions) {\n super(options?.initialType ?? Uint8Array, options);\n }\n\n /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.\n * This may change as larger values are added to the array.\n */\n public get bytesPerElement(): number {\n return this._data.BYTES_PER_ELEMENT;\n }\n\n /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.\n * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.\n * This method is invoked by [[push]] and [[append]].\n */\n protected ensureBytesPerElement(newValues: Iterable<number>): void {\n const curBytesPerElem = this.bytesPerElement;\n assert(curBytesPerElem === 1 || curBytesPerElem === 2 || curBytesPerElem === 4);\n if (curBytesPerElem >= 4)\n return;\n\n let neededBytesPerElem = curBytesPerElem;\n for (const value of newValues) {\n if (value > 0xffff) {\n neededBytesPerElem = 4;\n break;\n } else if (value > 0xff) {\n neededBytesPerElem = 2;\n }\n }\n\n if (neededBytesPerElem <= curBytesPerElem)\n return;\n\n this._constructor = neededBytesPerElem === 1 ? Uint8Array : (neededBytesPerElem === 2 ? Uint16Array : Uint32Array);\n this._data = new this._constructor(this._data);\n }\n\n /** See [[TypedArrayBuilder.push]]. */\n public override push(value: number): void {\n this.ensureBytesPerElement([value]);\n super.push(value);\n }\n\n /** See [[TypedArrayBuilder.append]]. */\n public override append(values: UintArray): void {\n this.ensureBytesPerElement(values);\n super.append(values);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IAC5B,sEAAsE;IAC5D,YAAY,CAAiB;IACvC,8FAA8F;IACpF,KAAK,CAAI;IACnB,wDAAwD;IAC9C,OAAO,CAAS;IAC1B,qEAAqE;IACrD,YAAY,CAAS;IAErC,sFAAsF;IACtF,YAAsB,WAA2B,EAAE,OAAkC;QACnF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,IAAI,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,qDAAqD;IACrD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,6FAA6F;IAC7F,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,EAAE,CAAC,KA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CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,wCAAwC;IACxB,MAAM,CAAC,MAAiB;QACtC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,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 { Constructor } from \"./UtilityTypes\";\nimport { assert } from \"./Assert\";\n\n/** Options used to construct a [[TypedArrayBuilder]].\n * @public\n */\nexport interface TypedArrayBuilderOptions {\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\n * Default: 1.5\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\n */\n growthFactor?: number;\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\n * initial capacity to avoid reallocations when populating the array.\n * Default: 0.\n * Minimum: 0.\n */\n initialCapacity?: number;\n}\n\n/** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.\n * @see [[UintArrayBuilder]] to construct such an array.\n * @public\n */\nexport type UintArray = Uint8Array | Uint16Array | Uint32Array;\n\n/** Incrementally builds a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of unsigned 8-, 16-, or 32-bit integers.\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\n *\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\n *\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\n * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.\n * @public\n */\nexport class TypedArrayBuilder<T extends UintArray> {\n /** The constructor for the specific type of array being populated. */\n protected _constructor: Constructor<T>;\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\n protected _data: T;\n /** The number of elements added to the array so far. */\n protected _length: number;\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\n public readonly growthFactor: number;\n\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\n this._constructor = constructor;\n this._data = new constructor(options?.initialCapacity ?? 0);\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\n this._length = 0;\n }\n\n /** The number of elements currently in the array. */\n public get length(): number {\n return this._length;\n }\n\n /** The number of elements that can fit into the memory currently allocated for the array. */\n public get capacity(): number {\n return this._data.length;\n }\n\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\n * returns the element at the specified index, with negative integers counting back from the end of the array.\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\n */\n public at(index: number): number {\n if (index < 0)\n index = this.length - index;\n\n const value = this._data[index];\n assert(value !== undefined, \"index out of bounds\");\n return value;\n }\n\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\n *\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\n */\n public ensureCapacity(newCapacity: number): number {\n if (this.capacity >= newCapacity)\n return this.capacity;\n\n assert(this.growthFactor >= 1.0);\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\n const prevData = this._data;\n this._data = new this._constructor(newCapacity);\n this._data.set(prevData, 0);\n\n assert(this.capacity === newCapacity);\n return this.capacity;\n }\n\n /** Append the specified value, resizing if necessary. */\n public push(value: number): void {\n this.ensureCapacity(this.length + 1);\n this._data[this.length] = value;\n ++this._length;\n }\n\n /** Append an array of values, resizing (at most once) if necessary. */\n public append(values: T): void {\n const newLength = this.length + values.length;\n this.ensureCapacity(newLength);\n this._data.set(values, this.length);\n this._length = newLength;\n }\n\n /** Obtain the finished array.\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\n * returned array's length will be equal to [[length]].\n */\n public toTypedArray(includeUnusedCapacity = false): T {\n if (includeUnusedCapacity)\n return this._data;\n\n const subarray = this._data.subarray(0, this.length);\n assert(subarray instanceof this._constructor);\n assert(subarray.buffer === this._data.buffer);\n return subarray;\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * @public\n */\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint8Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\n * @public\n */\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint16Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\n * @public\n */\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint32Array, options);\n }\n\n /** Obtain a view of the finished array as an array of bytes. */\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\n if (includeUnusedCapacity)\n return new Uint8Array(this._data.buffer);\n\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\n }\n}\n\n/** Options used to construct a [[UintArrayBuilder]].\n * @public\n */\nexport interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {\n /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than\n * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.\n * Default: `Uint8Array`.\n */\n initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;\n}\n\n/** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum\n * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.\n *\n * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].\n * As values are added to the array, if the bytes per element supported by the underlying array is too small to hold one of the new values, the array is\n * reallocated to a type large enough to hold all of the new values. For example, the following produces a `Uint8Array` because all values are less than 256:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 2, 254, 255]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint8Array);\n * ```\n *\n * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 255, 257, 65535]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint16Array);\n * ```\n *\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.\n * @public\n */\nexport class UintArrayBuilder extends TypedArrayBuilder<UintArray> {\n public constructor(options?: UintArrayBuilderOptions) {\n super(options?.initialType ?? Uint8Array, options);\n }\n\n /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.\n * This may change as larger values are added to the array.\n */\n public get bytesPerElement(): number {\n return this._data.BYTES_PER_ELEMENT;\n }\n\n /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.\n * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.\n * This method is invoked by [[push]] and [[append]].\n */\n protected ensureBytesPerElement(newValues: Iterable<number>): void {\n const curBytesPerElem = this.bytesPerElement;\n assert(curBytesPerElem === 1 || curBytesPerElem === 2 || curBytesPerElem === 4);\n if (curBytesPerElem >= 4)\n return;\n\n let neededBytesPerElem = curBytesPerElem;\n for (const value of newValues) {\n if (value > 0xffff) {\n neededBytesPerElem = 4;\n break;\n } else if (value > 0xff) {\n neededBytesPerElem = 2;\n }\n }\n\n if (neededBytesPerElem <= curBytesPerElem)\n return;\n\n this._constructor = neededBytesPerElem === 1 ? Uint8Array : (neededBytesPerElem === 2 ? Uint16Array : Uint32Array);\n this._data = new this._constructor(this._data);\n }\n\n /** See [[TypedArrayBuilder.push]]. */\n public override push(value: number): void {\n this.ensureBytesPerElement([value]);\n super.push(value);\n }\n\n /** See [[TypedArrayBuilder.append]]. */\n public override append(values: UintArray): void {\n this.ensureBytesPerElement(values);\n super.append(values);\n }\n}\n"]}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Errors
|
|
7
7
|
*/
|
|
8
|
-
var _a;
|
|
9
8
|
import { Logger } from "./Logger";
|
|
10
9
|
/**
|
|
11
10
|
* Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for
|
|
@@ -15,6 +14,16 @@ import { Logger } from "./Logger";
|
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
export class UnexpectedErrors {
|
|
17
|
+
/** handler for re-throwing exceptions directly */
|
|
18
|
+
static reThrowImmediate = (e) => { throw e; };
|
|
19
|
+
/** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
|
|
20
|
+
static reThrowDeferred = (e) => setTimeout(() => { throw e; }, 0);
|
|
21
|
+
/** handler for logging exception to console */
|
|
22
|
+
static consoleLog = (e) => console.error(e); // eslint-disable-line no-console
|
|
23
|
+
/** handler for logging exception with [[Logger]] */
|
|
24
|
+
static errorLog = (e) => Logger.logException("unhandled", e);
|
|
25
|
+
static _telemetry = [];
|
|
26
|
+
static _handler = this.errorLog; // default to error logging
|
|
18
27
|
constructor() { } // this is a singleton
|
|
19
28
|
/** Add a "telemetry tracker" for unexpected errors. Useful for tracking/reporting errors without changing handler.
|
|
20
29
|
* @returns a method to remove the tracker
|
|
@@ -51,15 +60,4 @@ export class UnexpectedErrors {
|
|
|
51
60
|
return oldHandler;
|
|
52
61
|
}
|
|
53
62
|
}
|
|
54
|
-
_a = UnexpectedErrors;
|
|
55
|
-
/** handler for re-throwing exceptions directly */
|
|
56
|
-
UnexpectedErrors.reThrowImmediate = (e) => { throw e; };
|
|
57
|
-
/** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
|
|
58
|
-
UnexpectedErrors.reThrowDeferred = (e) => setTimeout(() => { throw e; }, 0);
|
|
59
|
-
/** handler for logging exception to console */
|
|
60
|
-
UnexpectedErrors.consoleLog = (e) => console.error(e); // eslint-disable-line no-console
|
|
61
|
-
/** handler for logging exception with [[Logger]] */
|
|
62
|
-
UnexpectedErrors.errorLog = (e) => Logger.logException("unhandled", e);
|
|
63
|
-
UnexpectedErrors._telemetry = [];
|
|
64
|
-
UnexpectedErrors._handler = _a.errorLog; // default to error logging
|
|
65
63
|
//# sourceMappingURL=UnexpectedErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG
|
|
1
|
+
{"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOlC;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC3B,kDAAkD;IAC3C,MAAM,CAAU,gBAAgB,GAAG,CAAC,CAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,kHAAkH;IAC3G,MAAM,CAAU,eAAe,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvF,+CAA+C;IACxC,MAAM,CAAU,UAAU,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,iCAAiC;IACnG,oDAAoD;IAC7C,MAAM,CAAU,QAAQ,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE1E,MAAM,CAAC,UAAU,GAAwB,EAAE,CAAC;IAC5C,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,2BAA2B;IACpE,gBAAwB,CAAC,CAAC,sBAAsB;IAEhD;;OAEG;IACI,MAAM,CAAC,YAAY,CAAC,OAA0B;QACnD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,KAAU,EAAE,eAAe,GAAG,IAAI;QACrD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACpC,IAAI,CAAC;oBACH,SAAS,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC;gBAAC,MAAM,CAAC;oBACP,wCAAwC;gBAC1C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,OAA0B;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,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/** @packageDocumentation\n * @module Errors\n */\n\nimport { Logger } from \"./Logger\";\n\n/** A function to be notified when an unexpected error happens\n * @public\n */\nexport type OnUnexpectedError = (error: any) => void;\n\n/**\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\n * @public\n */\nexport class UnexpectedErrors {\n /** handler for re-throwing exceptions directly */\n public static readonly reThrowImmediate = (e: any) => { throw e; };\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\n /** handler for logging exception to console */\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\n /** handler for logging exception with [[Logger]] */\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\n\n private static _telemetry: OnUnexpectedError[] = [];\n private static _handler = this.errorLog; // default to error logging\n private constructor() { } // this is a singleton\n\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\n * @returns a method to remove the tracker\n */\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\n this._telemetry.push(tracker);\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\n }\n\n /** call this method when an unexpected error happens so the global handler can process it.\n * @param error the unexpected error\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\n */\n public static handle(error: any, notifyTelemetry = true): void {\n this._handler(error);\n if (notifyTelemetry) {\n this._telemetry.forEach((telemetry) => {\n try {\n telemetry(error);\n } catch {\n // ignore errors from telemetry trackers\n }\n });\n }\n }\n\n /** establish a new global *unexpected error* handler.\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\n * The default is [[errorLog]].\n * @returns the previous handler. Useful to temporarily change the handler.\n */\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\n const oldHandler = this._handler;\n this._handler = handler;\n return oldHandler;\n }\n}\n"]}
|
package/lib/esm/YieldManager.js
CHANGED
|
@@ -17,11 +17,13 @@ const defaultYieldManagerOptions = {
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export class YieldManager {
|
|
20
|
+
/** Options controlling the yield behavior. */
|
|
21
|
+
options;
|
|
22
|
+
_counter = 0;
|
|
20
23
|
/** Constructor.
|
|
21
24
|
* @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
|
|
22
25
|
*/
|
|
23
26
|
constructor(options = {}) {
|
|
24
|
-
this._counter = 0;
|
|
25
27
|
this.options = { ...defaultYieldManagerOptions, ...options };
|
|
26
28
|
}
|
|
27
29
|
/** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IACvB,8CAA8C;IAC9B,OAAO,CAA0C;IACzD,QAAQ,GAAG,CAAC,CAAC;IAErB;;OAEG;IACH,YAAmB,UAA+B,EAAE;QAClD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAED,oIAAoI;IAC7H,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,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 Utils\n */\n\n/** Options supplied to a [[YieldManager]].\n * @public\n */\nexport interface YieldManagerOptions {\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\n * Default: 1000.\n */\n iterationsBeforeYield?: number;\n}\n\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\n iterationsBeforeYield: 1000,\n};\n\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\n * It maintains a count of the number of iterations that have occurred since the last yield.\n * The constructor specifies how many iterations of the loop are permitted before yielding.\n * The loop should `await` [[allowYield]] on each iteration.\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\n * @public\n */\nexport class YieldManager {\n /** Options controlling the yield behavior. */\n public readonly options: Readonly<Required<YieldManagerOptions>>;\n private _counter = 0;\n\n /** Constructor.\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\n */\n public constructor(options: YieldManagerOptions = {}) {\n this.options = { ...defaultYieldManagerOptions, ...options };\n }\n\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\n public async allowYield() {\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\n if (this._counter === 0) {\n await this.actualYield();\n }\n }\n\n private async actualYield() {\n await new Promise((r) => setTimeout(r, 0));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-package.d.ts","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cross-package.d.ts","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
export { staticLoggerMetadata } from "./staticLoggerMetadata";
|
|
6
5
|
export { RepositoryStatus } from "./RepositoryStatus";
|
|
7
6
|
export { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from "./BeSQLiteInternal";
|
|
8
7
|
//# sourceMappingURL=cross-package.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,oBAAoB,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\nexport { RepositoryStatus } from \"./RepositoryStatus\";\nexport { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from \"./BeSQLiteInternal\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-bentley",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.82",
|
|
4
4
|
"description": "Bentley JavaScript core components",
|
|
5
5
|
"main": "lib/cjs/core-bentley.js",
|
|
6
6
|
"module": "lib/esm/core-bentley.js",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
26
26
|
"@opentelemetry/api": "1.0.4",
|
|
27
|
-
"@types/node": "~20.
|
|
28
|
-
"@vitest/coverage-v8": "^
|
|
27
|
+
"@types/node": "~20.17.0",
|
|
28
|
+
"@vitest/coverage-v8": "^3.0.6",
|
|
29
29
|
"eslint": "^9.13.0",
|
|
30
|
-
"rimraf": "^
|
|
30
|
+
"rimraf": "^6.0.1",
|
|
31
31
|
"typescript": "~5.6.2",
|
|
32
|
-
"vitest": "^
|
|
33
|
-
"@itwin/build-tools": "5.0.0-dev.
|
|
32
|
+
"vitest": "^3.0.6",
|
|
33
|
+
"@itwin/build-tools": "5.0.0-dev.82"
|
|
34
34
|
},
|
|
35
35
|
"nyc": {
|
|
36
36
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "npm run -s build:cjs && npm run -s build:esm",
|
|
40
40
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
41
|
-
"build:esm": "tsc 1>&2 --module
|
|
42
|
-
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
41
|
+
"build:esm": "tsc 1>&2 --module ES2022 --outDir lib/esm",
|
|
42
|
+
"clean": "rimraf -g lib .rush/temp/package-deps*.json",
|
|
43
43
|
"extract-api": "betools extract-api --entry=core-bentley",
|
|
44
44
|
"test": "vitest --run",
|
|
45
45
|
"docs": "betools docs --json=../../generated-docs/core/core-bentley/file.json --tsIndexFile=core-bentley.ts --onlyJson",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Logging
|
|
3
|
-
*/
|
|
4
|
-
import { LoggingMetaData } from "../BentleyError";
|
|
5
|
-
/** All static metadata is combined with per-call metadata and stringified in every log message.
|
|
6
|
-
* Static metadata can either be an object or a function that returns an object.
|
|
7
|
-
* Use a key to identify entries in the map so the can be removed individually.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare const staticLoggerMetadata: Map<string, LoggingMetaData>;
|
|
11
|
-
//# sourceMappingURL=staticLoggerMetadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticLoggerMetadata.d.ts","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,8BAAqC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Logging
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.staticLoggerMetadata = void 0;
|
|
11
|
-
/** All static metadata is combined with per-call metadata and stringified in every log message.
|
|
12
|
-
* Static metadata can either be an object or a function that returns an object.
|
|
13
|
-
* Use a key to identify entries in the map so the can be removed individually.
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
exports.staticLoggerMetadata = new Map();
|
|
17
|
-
//# sourceMappingURL=staticLoggerMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticLoggerMetadata.js","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,IAAI,GAAG,EAA2B,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/** @packageDocumentation\n * @module Logging\n */\n\nimport { LoggingMetaData } from \"../BentleyError\";\n\n/** All static metadata is combined with per-call metadata and stringified in every log message.\n * Static metadata can either be an object or a function that returns an object.\n * Use a key to identify entries in the map so the can be removed individually.\n * @internal\n */\nexport const staticLoggerMetadata = new Map<string, LoggingMetaData>();\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Logging
|
|
3
|
-
*/
|
|
4
|
-
import { LoggingMetaData } from "../BentleyError";
|
|
5
|
-
/** All static metadata is combined with per-call metadata and stringified in every log message.
|
|
6
|
-
* Static metadata can either be an object or a function that returns an object.
|
|
7
|
-
* Use a key to identify entries in the map so the can be removed individually.
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare const staticLoggerMetadata: Map<string, LoggingMetaData>;
|
|
11
|
-
//# sourceMappingURL=staticLoggerMetadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticLoggerMetadata.d.ts","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,8BAAqC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
/** @packageDocumentation
|
|
6
|
-
* @module Logging
|
|
7
|
-
*/
|
|
8
|
-
/** All static metadata is combined with per-call metadata and stringified in every log message.
|
|
9
|
-
* Static metadata can either be an object or a function that returns an object.
|
|
10
|
-
* Use a key to identify entries in the map so the can be removed individually.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export const staticLoggerMetadata = new Map();
|
|
14
|
-
//# sourceMappingURL=staticLoggerMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticLoggerMetadata.js","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAA2B,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/** @packageDocumentation\n * @module Logging\n */\n\nimport { LoggingMetaData } from \"../BentleyError\";\n\n/** All static metadata is combined with per-call metadata and stringified in every log message.\n * Static metadata can either be an object or a function that returns an object.\n * Use a key to identify entries in the map so the can be removed individually.\n * @internal\n */\nexport const staticLoggerMetadata = new Map<string, LoggingMetaData>();\n"]}
|