@itwin/core-bentley 5.1.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/AccessToken.js.map +1 -1
  3. package/lib/cjs/Assert.js.map +1 -1
  4. package/lib/cjs/BeEvent.js.map +1 -1
  5. package/lib/cjs/BeSQLite.js.map +1 -1
  6. package/lib/cjs/BentleyError.js.map +1 -1
  7. package/lib/cjs/BentleyLoggerCategory.js.map +1 -1
  8. package/lib/cjs/ByteStream.js.map +1 -1
  9. package/lib/cjs/ClassUtils.js.map +1 -1
  10. package/lib/cjs/Compare.js.map +1 -1
  11. package/lib/cjs/CompressedId64Set.js.map +1 -1
  12. package/lib/cjs/Dictionary.js.map +1 -1
  13. package/lib/cjs/Disposable.js.map +1 -1
  14. package/lib/cjs/Id.js.map +1 -1
  15. package/lib/cjs/IndexMap.js.map +1 -1
  16. package/lib/cjs/JsonSchema.js.map +1 -1
  17. package/lib/cjs/JsonUtils.js.map +1 -1
  18. package/lib/cjs/LRUMap.js.map +1 -1
  19. package/lib/cjs/Logger.js.map +1 -1
  20. package/lib/cjs/ObservableSet.js.map +1 -1
  21. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  22. package/lib/cjs/OrderedId64Iterable.js.map +1 -1
  23. package/lib/cjs/OrderedSet.js.map +1 -1
  24. package/lib/cjs/PriorityQueue.js.map +1 -1
  25. package/lib/cjs/ProcessDetector.js.map +1 -1
  26. package/lib/cjs/SortedArray.js.map +1 -1
  27. package/lib/cjs/StatusCategory.js.map +1 -1
  28. package/lib/cjs/StringUtils.js.map +1 -1
  29. package/lib/cjs/Time.js.map +1 -1
  30. package/lib/cjs/Tracing.js.map +1 -1
  31. package/lib/cjs/TupleKeyedMap.js.map +1 -1
  32. package/lib/cjs/TypedArrayBuilder.js.map +1 -1
  33. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  34. package/lib/cjs/UtilityTypes.js.map +1 -1
  35. package/lib/cjs/YieldManager.js.map +1 -1
  36. package/lib/cjs/core-bentley.js.map +1 -1
  37. package/lib/cjs/internal/BeSQLiteInternal.js.map +1 -1
  38. package/lib/cjs/internal/RepositoryStatus.js.map +1 -1
  39. package/lib/cjs/internal/cross-package.js.map +1 -1
  40. package/lib/cjs/partitionArray.js.map +1 -1
  41. package/lib/esm/AccessToken.js.map +1 -1
  42. package/lib/esm/Assert.js.map +1 -1
  43. package/lib/esm/BeEvent.js.map +1 -1
  44. package/lib/esm/BeSQLite.js.map +1 -1
  45. package/lib/esm/BentleyError.js.map +1 -1
  46. package/lib/esm/BentleyLoggerCategory.js.map +1 -1
  47. package/lib/esm/ByteStream.js.map +1 -1
  48. package/lib/esm/ClassUtils.js.map +1 -1
  49. package/lib/esm/Compare.js.map +1 -1
  50. package/lib/esm/CompressedId64Set.js.map +1 -1
  51. package/lib/esm/Dictionary.js.map +1 -1
  52. package/lib/esm/Disposable.js.map +1 -1
  53. package/lib/esm/Id.js.map +1 -1
  54. package/lib/esm/IndexMap.js.map +1 -1
  55. package/lib/esm/JsonSchema.js.map +1 -1
  56. package/lib/esm/JsonUtils.js.map +1 -1
  57. package/lib/esm/LRUMap.js.map +1 -1
  58. package/lib/esm/Logger.js.map +1 -1
  59. package/lib/esm/ObservableSet.js.map +1 -1
  60. package/lib/esm/OneAtATimeAction.js.map +1 -1
  61. package/lib/esm/OrderedId64Iterable.js.map +1 -1
  62. package/lib/esm/OrderedSet.js.map +1 -1
  63. package/lib/esm/PriorityQueue.js.map +1 -1
  64. package/lib/esm/ProcessDetector.js.map +1 -1
  65. package/lib/esm/SortedArray.js.map +1 -1
  66. package/lib/esm/StatusCategory.js.map +1 -1
  67. package/lib/esm/StringUtils.js.map +1 -1
  68. package/lib/esm/Time.js.map +1 -1
  69. package/lib/esm/Tracing.js.map +1 -1
  70. package/lib/esm/TupleKeyedMap.js.map +1 -1
  71. package/lib/esm/TypedArrayBuilder.js.map +1 -1
  72. package/lib/esm/UnexpectedErrors.js.map +1 -1
  73. package/lib/esm/UtilityTypes.js.map +1 -1
  74. package/lib/esm/YieldManager.js.map +1 -1
  75. package/lib/esm/core-bentley.js.map +1 -1
  76. package/lib/esm/internal/BeSQLiteInternal.js.map +1 -1
  77. package/lib/esm/internal/RepositoryStatus.js.map +1 -1
  78. package/lib/esm/internal/cross-package.js.map +1 -1
  79. package/lib/esm/partitionArray.js.map +1 -1
  80. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAa,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,KAAa;QACrB,IAAI,KAAK,GAAG,CAAC;YACX,KAAK,GAAG,I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AAC,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;AAlDD,4CAkDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { Constructor } from \"./UtilityTypes\";\r\nimport { assert } from \"./Assert\";\r\n\r\n/** Options used to construct a [[TypedArrayBuilder]].\r\n * @public\r\n */\r\nexport interface TypedArrayBuilderOptions {\r\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\r\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\r\n * Default: 1.5\r\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\r\n */\r\n growthFactor?: number;\r\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\r\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\r\n * initial capacity to avoid reallocations when populating the array.\r\n * Default: 0.\r\n * Minimum: 0.\r\n */\r\n initialCapacity?: number;\r\n}\r\n\r\n/** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.\r\n * @see [[UintArrayBuilder]] to construct such an array.\r\n * @public\r\n */\r\nexport type UintArray = Uint8Array | Uint16Array | Uint32Array;\r\n\r\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.\r\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\r\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\r\n *\r\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\r\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\r\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\r\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\r\n *\r\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\r\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\r\n * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.\r\n * @public\r\n */\r\nexport class TypedArrayBuilder<T extends UintArray> {\r\n /** The constructor for the specific type of array being populated. */\r\n protected _constructor: Constructor<T>;\r\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\r\n protected _data: T;\r\n /** The number of elements added to the array so far. */\r\n protected _length: number;\r\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\r\n public readonly growthFactor: number;\r\n\r\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\r\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\r\n this._constructor = constructor;\r\n this._data = new constructor(options?.initialCapacity ?? 0);\r\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\r\n this._length = 0;\r\n }\r\n\r\n /** The number of elements currently in the array. */\r\n public get length(): number {\r\n return this._length;\r\n }\r\n\r\n /** The number of elements that can fit into the memory currently allocated for the array. */\r\n public get capacity(): number {\r\n return this._data.length;\r\n }\r\n\r\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\r\n * returns the element at the specified index, with negative integers counting back from the end of the array.\r\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\r\n */\r\n public at(index: number): number {\r\n if (index < 0)\r\n index = this.length - index;\r\n\r\n const value = this._data[index];\r\n assert(value !== undefined, \"index out of bounds\");\r\n return value;\r\n }\r\n\r\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\r\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\r\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\r\n *\r\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\r\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\r\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\r\n */\r\n public ensureCapacity(newCapacity: number): number {\r\n if (this.capacity >= newCapacity)\r\n return this.capacity;\r\n\r\n assert(this.growthFactor >= 1.0);\r\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\r\n const prevData = this._data;\r\n this._data = new this._constructor(newCapacity);\r\n this._data.set(prevData, 0);\r\n\r\n assert(this.capacity === newCapacity);\r\n return this.capacity;\r\n }\r\n\r\n /** Append the specified value, resizing if necessary. */\r\n public push(value: number): void {\r\n this.ensureCapacity(this.length + 1);\r\n this._data[this.length] = value;\r\n ++this._length;\r\n }\r\n\r\n /** Append an array of values, resizing (at most once) if necessary. */\r\n public append(values: T): void {\r\n const newLength = this.length + values.length;\r\n this.ensureCapacity(newLength);\r\n this._data.set(values, this.length);\r\n this._length = newLength;\r\n }\r\n\r\n /** Obtain the finished array.\r\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\r\n * returned array's length will be equal to [[length]].\r\n */\r\n public toTypedArray(includeUnusedCapacity = false): T {\r\n if (includeUnusedCapacity)\r\n return this._data;\r\n\r\n const subarray = this._data.subarray(0, this.length);\r\n assert(subarray instanceof this._constructor);\r\n assert(subarray.buffer === this._data.buffer);\r\n return subarray;\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\r\n * @public\r\n */\r\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\r\n /** See [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint8Array, options);\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\r\n * @public\r\n */\r\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\r\n /** See [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint16Array, options);\r\n }\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\r\n * @public\r\n */\r\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\r\n /** See [[TypedArrayBuilder]] constructor. */\r\n public constructor(options?: TypedArrayBuilderOptions) {\r\n super(Uint32Array, options);\r\n }\r\n\r\n /** Obtain a view of the finished array as an array of bytes. */\r\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\r\n if (includeUnusedCapacity)\r\n return new Uint8Array(this._data.buffer);\r\n\r\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\r\n }\r\n}\r\n\r\n/** Options used to construct a [[UintArrayBuilder]].\r\n * @public\r\n */\r\nexport interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {\r\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\r\n * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.\r\n * Default: `Uint8Array`.\r\n */\r\n initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;\r\n}\r\n\r\n/** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum\r\n * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.\r\n *\r\n * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].\r\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\r\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:\r\n *\r\n * ```ts\r\n * const builder = new UintArrayBuilder();\r\n * builder.append([1, 2, 254, 255]);\r\n * const array = builder.toTypedArray();\r\n * assert(array instanceof Uint8Array);\r\n * ```\r\n *\r\n * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:\r\n *\r\n * ```ts\r\n * const builder = new UintArrayBuilder();\r\n * builder.append([1, 255, 257, 65535]);\r\n * const array = builder.toTypedArray();\r\n * assert(array instanceof Uint16Array);\r\n * ```\r\n *\r\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.\r\n * @public\r\n */\r\nexport class UintArrayBuilder extends TypedArrayBuilder<UintArray> {\r\n public constructor(options?: UintArrayBuilderOptions) {\r\n super(options?.initialType ?? Uint8Array, options);\r\n }\r\n\r\n /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.\r\n * This may change as larger values are added to the array.\r\n */\r\n public get bytesPerElement(): number {\r\n return this._data.BYTES_PER_ELEMENT;\r\n }\r\n\r\n /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.\r\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`.\r\n * This method is invoked by [[push]] and [[append]].\r\n */\r\n protected ensureBytesPerElement(newValues: Iterable<number>): void {\r\n const curBytesPerElem = this.bytesPerElement;\r\n assert(curBytesPerElem === 1 || curBytesPerElem === 2 || curBytesPerElem === 4);\r\n if (curBytesPerElem >= 4)\r\n return;\r\n\r\n let neededBytesPerElem = curBytesPerElem;\r\n for (const value of newValues) {\r\n if (value > 0xffff) {\r\n neededBytesPerElem = 4;\r\n break;\r\n } else if (value > 0xff) {\r\n neededBytesPerElem = 2;\r\n }\r\n }\r\n\r\n if (neededBytesPerElem <= curBytesPerElem)\r\n return;\r\n\r\n this._constructor = neededBytesPerElem === 1 ? Uint8Array : (neededBytesPerElem === 2 ? Uint16Array : Uint32Array);\r\n this._data = new this._constructor(this._data);\r\n }\r\n\r\n /** See [[TypedArrayBuilder.push]]. */\r\n public override push(value: number): void {\r\n this.ensureBytesPerElement([value]);\r\n super.push(value);\r\n }\r\n\r\n /** See [[TypedArrayBuilder.append]]. */\r\n public override append(values: UintArray): void {\r\n this.ensureBytesPerElement(values);\r\n super.append(values);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAa,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,qDAA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C,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;AAlDD,4CAkDC","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 +1 @@
1
- {"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qCAAkC;AAOlC;;;;;;GAMG;AACH,MAAa,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,eAAM,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;;AAhDH,4CAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Errors\r\n */\r\n\r\nimport { Logger } from \"./Logger\";\r\n\r\n/** A function to be notified when an unexpected error happens\r\n * @public\r\n */\r\nexport type OnUnexpectedError = (error: any) => void;\r\n\r\n/**\r\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\r\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\r\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\r\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\r\n * @public\r\n */\r\nexport class UnexpectedErrors {\r\n /** handler for re-throwing exceptions directly */\r\n public static readonly reThrowImmediate = (e: any) => { throw e; };\r\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\r\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\r\n /** handler for logging exception to console */\r\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\r\n /** handler for logging exception with [[Logger]] */\r\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\r\n\r\n private static _telemetry: OnUnexpectedError[] = [];\r\n private static _handler = this.errorLog; // default to error logging\r\n private constructor() { } // this is a singleton\r\n\r\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\r\n * @returns a method to remove the tracker\r\n */\r\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\r\n this._telemetry.push(tracker);\r\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\r\n }\r\n\r\n /** call this method when an unexpected error happens so the global handler can process it.\r\n * @param error the unexpected error\r\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\r\n */\r\n public static handle(error: any, notifyTelemetry = true): void {\r\n this._handler(error);\r\n if (notifyTelemetry) {\r\n this._telemetry.forEach((telemetry) => {\r\n try {\r\n telemetry(error);\r\n } catch {\r\n // ignore errors from telemetry trackers\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** establish a new global *unexpected error* handler.\r\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\r\n * The default is [[errorLog]].\r\n * @returns the previous handler. Useful to temporarily change the handler.\r\n */\r\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\r\n const oldHandler = this._handler;\r\n this._handler = handler;\r\n return oldHandler;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qCAAkC;AAOlC;;;;;;GAMG;AACH,MAAa,gBAAgB;IAC3B,kDAAkD;IAC3C,MAAM,CAAU,gBAAgB,GAAG,CAAC,CAAM,EAAE,EAAE,G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AC;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;;AAhDH,4CAiDC","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA+CH,oCAEC;AAMD,oCAEC;AAgFD,oBAKC;AAnGD;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAyED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAmD,CAAI,EAAE,IAAO;IAClF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/**\r\n * A type that recursively makes all properties of object `T` required, including all properties of nested objects.\r\n * @public\r\n */\r\nexport type DeepRequiredObject<T> = T extends object\r\n ? { [K in keyof T]-?: DeepRequiredObject<T[K]> }\r\n : T\r\n\r\n/**\r\n * A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.\r\n * @public\r\n */\r\nexport type DeepReadonlyObject<T> = T extends object\r\n ? { readonly [K in keyof T]: DeepReadonlyObject<T[K]> } :\r\n T\r\n\r\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\r\n * @public\r\n */\r\nexport type Mutable<T> = {\r\n -readonly [K in keyof T]: T[K];\r\n};\r\n\r\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\r\n * @public\r\n */\r\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\r\n\r\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\r\n * @public\r\n */\r\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\r\n\r\n/** Generically represents a class `T`, for use in type annotations.\r\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\r\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\r\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\r\n * @public\r\n */\r\nexport type Constructor<T> = new (...args: any[]) => T;\r\n\r\n/** Returns true if `obj` is an object of class `T`.\r\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\r\n * @public\r\n */\r\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\r\n return \"object\" === typeof obj && obj instanceof constructor;\r\n}\r\n\r\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\r\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\r\n * @public\r\n */\r\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\r\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\r\n}\r\n\r\n/** Extracts the names of all public properties of `T` that are not of type `function`.\r\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\r\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\r\n * so too does the type that TypeScript infers from that operator.\r\n * `get` syntax. For example:\r\n * ```ts\r\n * class Thing {\r\n * private _a = \"a\"; // a private variable\r\n * public b = \"b\"; // a public variable\r\n * public get c() { return \"c\"; } // a public property\r\n * public d() { return \"d\"; } // a public method\r\n * public e = () => \"e\"; // a public variable of type `function`\r\n * }\r\n *\r\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\r\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\r\n *\r\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\r\n * const thing1 = new Thing();\r\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\r\n * ```\r\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\r\n * @public\r\n */\r\nexport type NonFunctionPropertyNamesOf<T> = {\r\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K;\r\n}[keyof T];\r\n\r\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\r\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\r\n * @public\r\n */\r\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\r\n\r\n/** Any function returning a Promise.\r\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\r\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\r\n * @public\r\n */\r\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\r\n\r\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\r\n * @public\r\n */\r\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\r\n\r\n/** Extracts the names of all function properties of `T` that return a Promise.\r\n * @public\r\n */\r\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\r\n\r\n/** A type that is either `T` or `Promise<T>`.\r\n * @public\r\n */\r\nexport type MaybePromise<T> = T | Promise<T>;\r\n\r\n/** Extracts the type to which the Promise returned by an async function resolves.\r\n * @public\r\n */\r\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\r\n\r\n/** The members of `T` that are functions and no other properties\r\n * @public\r\n */\r\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never; };\r\n\r\n/** The members of `T` that are functions that do not return a Promise\r\n * @public\r\n */\r\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\r\n\r\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\r\n * Compatible with the typescript `Omit` mapped type:\r\n * ```js\r\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\r\n * ```\r\n * @public\r\n */\r\nexport function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\r\n const clone = { ...t };\r\n for (const key of keys)\r\n delete clone[key];\r\n return clone;\r\n}\r\n\r\n/** Defines a type wherein at least one of the properties of T is required to exist.\r\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\r\n * ```ts\r\n * interface Wallet {\r\n * cash?: number;\r\n * card?: CreditCard;\r\n * }\r\n *\r\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\r\n * ```\r\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\r\n * @public\r\n */\r\nexport type RequireAtLeastOne<T> = {\r\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\r\n}[keyof T];\r\n"]}
1
+ {"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA+CH,oCAEC;AAMD,oCAEC;AAgFD,oBAKC;AAnGD;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAyED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAmD,CAAI,EAAE,IAAO;IAClF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,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/** @packageDocumentation\n * @module Utils\n */\n\n/**\n * A type that recursively makes all properties of object `T` required, including all properties of nested objects.\n * @public\n */\nexport type DeepRequiredObject<T> = T extends object\n ? { [K in keyof T]-?: DeepRequiredObject<T[K]> }\n : T\n\n/**\n * A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.\n * @public\n */\nexport type DeepReadonlyObject<T> = T extends object\n ? { readonly [K in keyof T]: DeepReadonlyObject<T[K]> } :\n T\n\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\n * @public\n */\nexport type Mutable<T> = {\n -readonly [K in keyof T]: T[K];\n};\n\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\n * @public\n */\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\n * @public\n */\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\n\n/** Generically represents a class `T`, for use in type annotations.\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\n * @public\n */\nexport type Constructor<T> = new (...args: any[]) => T;\n\n/** Returns true if `obj` is an object of class `T`.\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\n * @public\n */\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\n return \"object\" === typeof obj && obj instanceof constructor;\n}\n\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\n * @public\n */\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\n}\n\n/** Extracts the names of all public properties of `T` that are not of type `function`.\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\n * so too does the type that TypeScript infers from that operator.\n * `get` syntax. For example:\n * ```ts\n * class Thing {\n * private _a = \"a\"; // a private variable\n * public b = \"b\"; // a public variable\n * public get c() { return \"c\"; } // a public property\n * public d() { return \"d\"; } // a public method\n * public e = () => \"e\"; // a public variable of type `function`\n * }\n *\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\n *\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\n * const thing1 = new Thing();\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\n * ```\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\n * @public\n */\nexport type NonFunctionPropertyNamesOf<T> = {\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K;\n}[keyof T];\n\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\n * @public\n */\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\n\n/** Any function returning a Promise.\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\n * @public\n */\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\n\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\n * @public\n */\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\n\n/** Extracts the names of all function properties of `T` that return a Promise.\n * @public\n */\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\n\n/** A type that is either `T` or `Promise<T>`.\n * @public\n */\nexport type MaybePromise<T> = T | Promise<T>;\n\n/** Extracts the type to which the Promise returned by an async function resolves.\n * @public\n */\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\n\n/** The members of `T` that are functions and no other properties\n * @public\n */\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never; };\n\n/** The members of `T` that are functions that do not return a Promise\n * @public\n */\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\n\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\n * Compatible with the typescript `Omit` mapped type:\n * ```js\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\n * ```\n * @public\n */\nexport function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\n const clone = { ...t };\n for (const key of keys)\n delete clone[key];\n return clone;\n}\n\n/** Defines a type wherein at least one of the properties of T is required to exist.\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\n * ```ts\n * interface Wallet {\n * cash?: number;\n * card?: CreditCard;\n * }\n *\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\n * ```\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\n * @public\n */\nexport type RequireAtLeastOne<T> = {\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\n}[keyof T];\n"]}
@@ -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,MAAa,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;AAvBD,oCAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Options supplied to a [[YieldManager]].\r\n * @public\r\n */\r\nexport interface YieldManagerOptions {\r\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\r\n * Default: 1000.\r\n */\r\n iterationsBeforeYield?: number;\r\n}\r\n\r\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\r\n iterationsBeforeYield: 1000,\r\n};\r\n\r\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\r\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\r\n * It maintains a count of the number of iterations that have occurred since the last yield.\r\n * The constructor specifies how many iterations of the loop are permitted before yielding.\r\n * The loop should `await` [[allowYield]] on each iteration.\r\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\r\n * @public\r\n */\r\nexport class YieldManager {\r\n /** Options controlling the yield behavior. */\r\n public readonly options: Readonly<Required<YieldManagerOptions>>;\r\n private _counter = 0;\r\n\r\n /** Constructor.\r\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\r\n */\r\n public constructor(options: YieldManagerOptions = {}) {\r\n this.options = { ...defaultYieldManagerOptions, ...options };\r\n }\r\n\r\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\r\n public async allowYield() {\r\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\r\n if (this._counter === 0) {\r\n await this.actualYield();\r\n }\r\n }\r\n\r\n private async actualYield() {\r\n await new Promise((r) => setTimeout(r, 0));\r\n }\r\n}\r\n"]}
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,MAAa,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;AAvBD,oCAuBC","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":"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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./AccessToken\";\r\nexport * from \"./Assert\";\r\nexport * from \"./BeEvent\";\r\nexport * from \"./BentleyError\";\r\nexport * from \"./BentleyLoggerCategory\";\r\nexport * from \"./StatusCategory\";\r\nexport * from \"./BeSQLite\";\r\nexport * from \"./ByteStream\";\r\nexport * from \"./ClassUtils\";\r\nexport * from \"./Compare\";\r\nexport * from \"./CompressedId64Set\";\r\nexport * from \"./Dictionary\";\r\nexport * from \"./Disposable\";\r\nexport * from \"./Id\";\r\nexport * from \"./IndexMap\";\r\nexport * from \"./JsonSchema\";\r\nexport * from \"./JsonUtils\";\r\nexport * from \"./Logger\";\r\nexport * from \"./LRUMap\";\r\nexport * from \"./ObservableSet\";\r\nexport * from \"./OneAtATimeAction\";\r\nexport * from \"./OrderedId64Iterable\";\r\nexport * from \"./OrderedSet\";\r\nexport * from \"./partitionArray\";\r\nexport * from \"./PriorityQueue\";\r\nexport * from \"./ProcessDetector\";\r\nexport * from \"./SortedArray\";\r\nexport * from \"./StringUtils\";\r\nexport * from \"./Time\";\r\nexport * from \"./Tracing\";\r\nexport * from \"./TupleKeyedMap\";\r\nexport * from \"./TypedArrayBuilder\";\r\nexport * from \"./UnexpectedErrors\";\r\nexport * from \"./UtilityTypes\";\r\nexport * from \"./YieldManager\";\r\n\r\n// Temporarily (until 5.0) export top-level internal APIs to avoid breaking callers.\r\nexport * from \"./internal/cross-package\";\r\n\r\n/** @docs-package-description\r\n * The core-bentley package contains classes to solve problems that are common for both client and server use cases.\r\n */\r\n/**\r\n * @docs-group-description BeSQLite\r\n * Classes for working with SQLite databases. SQLite underlies IModelDb and ECDb - see [Executing ECSQL]($docs/learning/ECSQL.md)\r\n */\r\n/**\r\n * @docs-group-description Errors\r\n * Classes for working with errors.\r\n */\r\n/**\r\n * @docs-group-description Events\r\n * Classes for raising and handling events.\r\n */\r\n/**\r\n * @docs-group-description Ids\r\n * Classes for working with unique identifiers.\r\n */\r\n/**\r\n * @docs-group-description Logging\r\n * Classes for configuring and logging diagnostic messages - see [Learning about Logging]($docs/learning/common/Logging.md)\r\n */\r\n/**\r\n * @docs-group-description Collections\r\n * Specialized, customizable collection classes like priority queues.\r\n */\r\n/**\r\n * @docs-group-description Json\r\n * utilities for dealing with Json strings and files.\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * Miscellaneous utility classes.\r\n */\r\n/**\r\n * @docs-group-description ProcessDetector\r\n * Functions for determining the type of the current JavaScript process.\r\n */\r\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,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 +1 @@
1
- {"version":3,"file":"BeSQLiteInternal.js","sourceRoot":"","sources":["../../../src/internal/BeSQLiteInternal.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gBAAgB;AAChB,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,+CAAO,CAAA;IACP,+CAAO,CAAA;AACT,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,gBAAgB;AAChB,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,yDAAc,CAAA;IACd,qDAAY,CAAA;IACZ,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,mDAAW,CAAA;AACb,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAED;;GAEG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,6DAAY,CAAA;IACZ,6DAAY,CAAA;IACZ,iEAAc,CAAA;IACd,iEAAc,CAAA;AAChB,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,gBAAgB;AAChB,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,2BAA2B;IAC3B,+DAAQ,CAAA;IACR,kDAAkD;IAClD,qEAAW,CAAA;IACX,4BAA4B;IAC5B,iEAAS,CAAA;AACX,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BeSQLite\r\n */\r\n\r\n/** @internal */\r\nexport enum DbChangeStage {\r\n Old = 0,\r\n New = 1\r\n}\r\n\r\n/** @internal */\r\nexport enum DbValueType {\r\n IntegerVal = 1,\r\n FloatVal = 2,\r\n TextVal = 3,\r\n BlobVal = 4,\r\n NullVal = 5\r\n}\r\n\r\n/** Cause of conflict when applying a changeset.\r\n * @internal\r\n */\r\nexport enum DbConflictCause {\r\n Data = 1,\r\n NotFound = 2,\r\n Conflict = 3,\r\n Constraint = 4,\r\n ForeignKey = 5,\r\n}\r\n\r\n/** @internal */\r\nexport enum DbConflictResolution {\r\n /** Skip incoming change */\r\n Skip = 0,\r\n /** Replace local row with incoming changed row */\r\n Replace = 1,\r\n /** Abort apply changeset */\r\n Abort = 2,\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"BeSQLiteInternal.js","sourceRoot":"","sources":["../../../src/internal/BeSQLiteInternal.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,gBAAgB;AAChB,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,+CAAO,CAAA;IACP,+CAAO,CAAA;AACT,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,gBAAgB;AAChB,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,yDAAc,CAAA;IACd,qDAAY,CAAA;IACZ,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,mDAAW,CAAA;AACb,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAED;;GAEG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,qDAAQ,CAAA;IACR,6DAAY,CAAA;IACZ,6DAAY,CAAA;IACZ,iEAAc,CAAA;IACd,iEAAc,CAAA;AAChB,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,gBAAgB;AAChB,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,2BAA2B;IAC3B,+DAAQ,CAAA;IACR,kDAAkD;IAClD,qEAAW,CAAA;IACX,4BAA4B;IAC5B,iEAAS,CAAA;AACX,CAAC,EAPW,oBAAoB,oCAApB,oBAAoB,QAO/B","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 BeSQLite\n */\n\n/** @internal */\nexport enum DbChangeStage {\n Old = 0,\n New = 1\n}\n\n/** @internal */\nexport enum DbValueType {\n IntegerVal = 1,\n FloatVal = 2,\n TextVal = 3,\n BlobVal = 4,\n NullVal = 5\n}\n\n/** Cause of conflict when applying a changeset.\n * @internal\n */\nexport enum DbConflictCause {\n Data = 1,\n NotFound = 2,\n Conflict = 3,\n Constraint = 4,\n ForeignKey = 5,\n}\n\n/** @internal */\nexport enum DbConflictResolution {\n /** Skip incoming change */\n Skip = 0,\n /** Replace local row with incoming changed row */\n Replace = 1,\n /** Abort apply changeset */\n Abort = 2,\n}\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"RepositoryStatus.js","sourceRoot":"","sources":["../../../src/internal/RepositoryStatus.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,gBAgCX;AAhCD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,yDAAyD;IACzD,qFAA2B,CAAA;IAC3B,6DAA6D;IAC7D,iFAAyB,CAAA;IACzB,mDAAmD;IACnD,qEAAmB,CAAA;IACnB,0CAA0C;IAC1C,iFAAyB,CAAA;IACzB,uEAAuE;IACvE,yFAA6B,CAAA;IAC7B,oFAAoF;IACpF,mEAAkB,CAAA;IAClB,kEAAkE;IAClE,6FAA+B,CAAA;IAC/B,uCAAuC;IACvC,+EAAwB,CAAA;IACxB,uHAAuH;IACvH,qFAA2B,CAAA;IAC3B,qEAAqE;IACrE,iFAAyB,CAAA;IACzB,gGAAgG;IAChG,iFAAyB,CAAA;IACzB,wEAAwE;IACxE,mEAAkB,CAAA;IAClB,oDAAoD;IACpD,yEAAqB,CAAA;IACrB,yDAAyD;IACzD,uFAA4B,CAAA;IAC5B,sGAAsG;IACtG,uGAAoC,CAAA;AACtC,CAAC,EAhCW,gBAAgB,gCAAhB,gBAAgB,QAgC3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Errors\r\n */\r\n\r\n/** Return codes for methods which perform repository management operations.\r\n * @internal\r\n */\r\nexport enum RepositoryStatus {\r\n Success = 0,\r\n /** The repository server did not respond to a request */\r\n ServerUnavailable = 0x15001,\r\n /** A requested lock was already held by another briefcase */\r\n LockAlreadyHeld = 0x15002,\r\n /** Failed to sync briefcase manager with server */\r\n SyncError = 0x15003,\r\n /** Response from server not understood */\r\n InvalidResponse = 0x15004,\r\n /** An operation requires local changes to be committed or abandoned */\r\n PendingTransactions = 0x15005,\r\n /** A lock cannot be relinquished because the associated object has been modified */\r\n LockUsed = 0x15006,\r\n /** An operation required creation of a ChangeSet, which failed */\r\n CannotCreateChangeSet = 0x15007,\r\n /** Request to server not understood */\r\n InvalidRequest = 0x15008,\r\n /** A change set committed to the server must be integrated into the briefcase before the operation can be completed */\r\n ChangeSetRequired = 0x15009,\r\n /** A requested DgnCode is reserved by another briefcase or in use */\r\n CodeUnavailable = 0x1500A,\r\n /** A DgnCode cannot be released because it has not been reserved by the requesting briefcase */\r\n CodeNotReserved = 0x1500B,\r\n /** A DgnCode cannot be relinquished because it has been used locally */\r\n CodeUsed = 0x1500C,\r\n /** A required lock is not held by this briefcase */\r\n LockNotHeld = 0x1500D,\r\n /** Repository is currently locked, no changes allowed */\r\n RepositoryIsLocked = 0x1500E,\r\n /** Channel write constraint violation, such as an attempt to write outside the designated channel. */\r\n ChannelConstraintViolation = 0x1500F,\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"RepositoryStatus.js","sourceRoot":"","sources":["../../../src/internal/RepositoryStatus.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,gBAgCX;AAhCD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,yDAAyD;IACzD,qFAA2B,CAAA;IAC3B,6DAA6D;IAC7D,iFAAyB,CAAA;IACzB,mDAAmD;IACnD,qEAAmB,CAAA;IACnB,0CAA0C;IAC1C,iFAAyB,CAAA;IACzB,uEAAuE;IACvE,yFAA6B,CAAA;IAC7B,oFAAoF;IACpF,mEAAkB,CAAA;IAClB,kEAAkE;IAClE,6FAA+B,CAAA;IAC/B,uCAAuC;IACvC,+EAAwB,CAAA;IACxB,uHAAuH;IACvH,qFAA2B,CAAA;IAC3B,qEAAqE;IACrE,iFAAyB,CAAA;IACzB,gGAAgG;IAChG,iFAAyB,CAAA;IACzB,wEAAwE;IACxE,mEAAkB,CAAA;IAClB,oDAAoD;IACpD,yEAAqB,CAAA;IACrB,yDAAyD;IACzD,uFAA4B,CAAA;IAC5B,sGAAsG;IACtG,uGAAoC,CAAA;AACtC,CAAC,EAhCW,gBAAgB,gCAAhB,gBAAgB,QAgC3B","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\n/** Return codes for methods which perform repository management operations.\n * @internal\n */\nexport enum RepositoryStatus {\n Success = 0,\n /** The repository server did not respond to a request */\n ServerUnavailable = 0x15001,\n /** A requested lock was already held by another briefcase */\n LockAlreadyHeld = 0x15002,\n /** Failed to sync briefcase manager with server */\n SyncError = 0x15003,\n /** Response from server not understood */\n InvalidResponse = 0x15004,\n /** An operation requires local changes to be committed or abandoned */\n PendingTransactions = 0x15005,\n /** A lock cannot be relinquished because the associated object has been modified */\n LockUsed = 0x15006,\n /** An operation required creation of a ChangeSet, which failed */\n CannotCreateChangeSet = 0x15007,\n /** Request to server not understood */\n InvalidRequest = 0x15008,\n /** A change set committed to the server must be integrated into the briefcase before the operation can be completed */\n ChangeSetRequired = 0x15009,\n /** A requested DgnCode is reserved by another briefcase or in use */\n CodeUnavailable = 0x1500A,\n /** A DgnCode cannot be released because it has not been reserved by the requesting briefcase */\n CodeNotReserved = 0x1500B,\n /** A DgnCode cannot be relinquished because it has been used locally */\n CodeUsed = 0x1500C,\n /** A required lock is not held by this briefcase */\n LockNotHeld = 0x1500D,\n /** Repository is currently locked, no changes allowed */\n RepositoryIsLocked = 0x1500E,\n /** Channel write constraint violation, such as an attempt to write outside the designated channel. */\n ChannelConstraintViolation = 0x1500F,\n}\n\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,uDAAuG;AAA9F,iHAAA,aAAa,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,+GAAA,WAAW,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nexport { RepositoryStatus } from \"./RepositoryStatus\";\r\nexport { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from \"./BeSQLiteInternal\";\r\n"]}
1
+ {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,uDAAuG;AAA9F,iHAAA,aAAa,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,+GAAA,WAAW,OAAA","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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"partitionArray.js","sourceRoot":"","sources":["../../src/partitionArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAmBH,wCAcC;AA/BD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAI,KAAU,EAAE,SAAkC;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,OAAO,KAAK,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,EAAE,KAAK,CAAC;QACV,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;YAClC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\n/** Partitions an array in-place according to some criterion, such that elements that fulfill the criterion are grouped in the lower\r\n * portion of the array, and those that fail to fulfill the criterion are grouped in the upper portion of the array.\r\n * @param array The array to be partitioned.\r\n * @param criterion A function invoked for each element of the array, returning whether the element fulfills the criterion.\r\n * @returns The index of the upper partition, i.e., of the first element that fails the criterion. If all elements fulfill the criterion, this is the length of the array.\r\n * @note The relative ordering of elements within each partition is unspecified.\r\n * Example:\r\n * ```ts\r\n * function isEven(n: number) { return 0 === n % 2; }\r\n * const list = [ 1, 2, 3, 4, 5 ];\r\n * const firstOddIndex = partitionArray(list, isEven); // firstOddIndex = 2\r\n * // 2 and 4 now appear before 1, 3, and 5 in the list; their ordering is otherwise unspecified.\r\n * for (let i = 0; i < list.length; i++)\r\n * assert(isEven(list[i]) === i < firstOddIndex);\r\n * ```\r\n * @public\r\n */\r\nexport function partitionArray<T>(array: T[], criterion: (element: T) => boolean): number {\r\n let index = 0;\r\n let partition = array.length;\r\n while (index < partition) {\r\n const elem = array[index];\r\n if (criterion(elem)) {\r\n ++index;\r\n } else {\r\n array[index] = array[--partition];\r\n array[partition] = elem;\r\n }\r\n }\r\n\r\n return partition;\r\n}\r\n"]}
1
+ {"version":3,"file":"partitionArray.js","sourceRoot":"","sources":["../../src/partitionArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAmBH,wCAcC;AA/BD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAI,KAAU,EAAE,SAAkC;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,OAAO,KAAK,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,EAAE,KAAK,CAAC;QACV,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;YAClC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,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 Collections\n */\n\n/** Partitions an array in-place according to some criterion, such that elements that fulfill the criterion are grouped in the lower\n * portion of the array, and those that fail to fulfill the criterion are grouped in the upper portion of the array.\n * @param array The array to be partitioned.\n * @param criterion A function invoked for each element of the array, returning whether the element fulfills the criterion.\n * @returns The index of the upper partition, i.e., of the first element that fails the criterion. If all elements fulfill the criterion, this is the length of the array.\n * @note The relative ordering of elements within each partition is unspecified.\n * Example:\n * ```ts\n * function isEven(n: number) { return 0 === n % 2; }\n * const list = [ 1, 2, 3, 4, 5 ];\n * const firstOddIndex = partitionArray(list, isEven); // firstOddIndex = 2\n * // 2 and 4 now appear before 1, 3, and 5 in the list; their ordering is otherwise unspecified.\n * for (let i = 0; i < list.length; i++)\n * assert(isEven(list[i]) === i < firstOddIndex);\n * ```\n * @public\n */\nexport function partitionArray<T>(array: T[], criterion: (element: T) => boolean): number {\n let index = 0;\n let partition = array.length;\n while (index < partition) {\n const elem = array[index];\n if (criterion(elem)) {\n ++index;\n } else {\n array[index] = array[--partition];\n array[partition] = elem;\n }\n }\n\n return partition;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AccessToken.js","sourceRoot":"","sources":["../../src/AccessToken.ts"],"names":[],"mappings":"AACA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["\r\n/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** A string representing a token used to access resources. An empty string represents an invalid/unavailable token.\r\n * @see [IModelHost.getAccessToken]($backend) and [IModelApp.getAccessToken]($frontend) to obtain an access token.\r\n * @see [IModelHostOptions.authorizationClient]($backend) and [IModelAppOptions.authorizationClient]($frontend) to configure how access tokens are obtained.\r\n * @note Access tokens expire periodically and are automatically refreshed when possible; therefore, tokens should always be requested via an [AuthorizationClient]($common), not cached for later reuse.\r\n * @public\r\n */\r\nexport type AccessToken = string;\r\n"]}
1
+ {"version":3,"file":"AccessToken.js","sourceRoot":"","sources":["../../src/AccessToken.ts"],"names":[],"mappings":"AACA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["\n/*---------------------------------------------------------------------------------------------\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/** A string representing a token used to access resources. An empty string represents an invalid/unavailable token.\n * @see [IModelHost.getAccessToken]($backend) and [IModelApp.getAccessToken]($frontend) to obtain an access token.\n * @see [IModelHostOptions.authorizationClient]($backend) and [IModelAppOptions.authorizationClient]($frontend) to configure how access tokens are obtained.\n * @note Access tokens expire periodically and are automatically refreshed when possible; therefore, tokens should always be requested via an [AuthorizationClient]($common), not cached for later reuse.\n * @public\n */\nexport type AccessToken = string;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Assert.js","sourceRoot":"","sources":["../../src/Assert.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CAAC,SAAoC,EAAE,OAAiC;IAC5F,IAAI,CAAC,iBAAiB;QACpB,OAAO;IAET,IAAI,SAAS,KAAK,OAAO,SAAS;QAChC,SAAS,GAAG,SAAS,EAAE,CAAC;IAE1B,IAAI,SAAS;QACX,OAAO;IAET,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAAC;IACxC,IAAI,QAAQ,KAAK,OAAO,OAAO;QAC7B,OAAO,GAAG,OAAO,EAAE,CAAC;IAEtB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nconst assertionsEnabled = process.env.NODE_ENV === \"development\";\r\n\r\n/** Asserts that a condition is `true` and - when enabled - throws an error if it is not.\r\n * Assertions are enabled only if the build configuration defines `process.env.NODE_ENV` as `development` at build time.\r\n *\r\n * Assertions exist solely to assist programmers during development, in the following ways:\r\n * 1 They allow the programmer to declare conditions that they believe cannot possibly occur. If such conditions occur, they indicate\r\n * a serious flaw in the programmer's logic.\r\n * 2 They allow the programmer to assure the TypeScript compiler of the truth of some condition that the compiler cannot itself infer.\r\n * 3 They allow the author of an API to indicate to consumers of the API a serious misuse that should be corrected during development.\r\n *\r\n * Assertions should **never** be used to test for conditions - however unlikely - that could be expected to occur at run-time,\r\n * such as failing to write to a file or load a resource over the network. If the condition asserted ever fails in a production environment,\r\n * the programmer has made a serious mistake.\r\n *\r\n * Note that even when assertions are disabled, calls to `assert` remain in the code and their arguments will be evaluated at run-time.\r\n * Therefore, if your condition or message requires computation, prefer to pass it as a function to prevent it from being evaluated when assertions are disabled.\r\n *\r\n * @param condition The condition that is asserted to be `true`. If the condition is more complex than a simple `boolean` variable, pass it as a function to prevent it from being evaluated when assertions are disabled.\r\n * @param message An optional description of the condition being asserted, to be included in the exception if `condition` is `false`. If the message must be computed, pass it as a function to prevent it from being evaluated when assertions are disabled. Defaults to \"Programmer Error\".\r\n * @throws Error containing the specified `message` if `condition` is `false`.\r\n * @public\r\n */\r\nexport function assert(condition: boolean | (() => boolean), message?: string | (() => string)): asserts condition {\r\n if (!assertionsEnabled)\r\n return;\r\n\r\n if (\"boolean\" !== typeof condition)\r\n condition = condition();\r\n\r\n if (condition)\r\n return;\r\n\r\n message = message ?? \"Programmer Error\";\r\n if (\"string\" !== typeof message)\r\n message = message();\r\n\r\n throw new Error(`Assert: ${message}`);\r\n}\r\n"]}
1
+ {"version":3,"file":"Assert.js","sourceRoot":"","sources":["../../src/Assert.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CAAC,SAAoC,EAAE,OAAiC;IAC5F,IAAI,CAAC,iBAAiB;QACpB,OAAO;IAET,IAAI,SAAS,KAAK,OAAO,SAAS;QAChC,SAAS,GAAG,SAAS,EAAE,CAAC;IAE1B,IAAI,SAAS;QACX,OAAO;IAET,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAAC;IACxC,IAAI,QAAQ,KAAK,OAAO,OAAO;QAC7B,OAAO,GAAG,OAAO,EAAE,CAAC;IAEtB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;AACxC,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 Utils\n */\n\nconst assertionsEnabled = process.env.NODE_ENV === \"development\";\n\n/** Asserts that a condition is `true` and - when enabled - throws an error if it is not.\n * Assertions are enabled only if the build configuration defines `process.env.NODE_ENV` as `development` at build time.\n *\n * Assertions exist solely to assist programmers during development, in the following ways:\n * 1 They allow the programmer to declare conditions that they believe cannot possibly occur. If such conditions occur, they indicate\n * a serious flaw in the programmer's logic.\n * 2 They allow the programmer to assure the TypeScript compiler of the truth of some condition that the compiler cannot itself infer.\n * 3 They allow the author of an API to indicate to consumers of the API a serious misuse that should be corrected during development.\n *\n * Assertions should **never** be used to test for conditions - however unlikely - that could be expected to occur at run-time,\n * such as failing to write to a file or load a resource over the network. If the condition asserted ever fails in a production environment,\n * the programmer has made a serious mistake.\n *\n * Note that even when assertions are disabled, calls to `assert` remain in the code and their arguments will be evaluated at run-time.\n * Therefore, if your condition or message requires computation, prefer to pass it as a function to prevent it from being evaluated when assertions are disabled.\n *\n * @param condition The condition that is asserted to be `true`. If the condition is more complex than a simple `boolean` variable, pass it as a function to prevent it from being evaluated when assertions are disabled.\n * @param message An optional description of the condition being asserted, to be included in the exception if `condition` is `false`. If the message must be computed, pass it as a function to prevent it from being evaluated when assertions are disabled. Defaults to \"Programmer Error\".\n * @throws Error containing the specified `message` if `condition` is `false`.\n * @public\n */\nexport function assert(condition: boolean | (() => boolean), message?: string | (() => string)): asserts condition {\n if (!assertionsEnabled)\n return;\n\n if (\"boolean\" !== typeof condition)\n condition = condition();\n\n if (condition)\n return;\n\n message = message ?? \"Programmer Error\";\n if (\"string\" !== typeof message)\n message = message();\n\n throw new Error(`Assert: ${message}`);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BeEvent.js","sourceRoot":"","sources":["../../src/BeEvent.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAatD;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IACV,UAAU,GAAmB,EAAE,CAAC;IAChC,iBAAiB,GAAY,KAAK,CAAC;I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,IAAI,GAAG,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBACrD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6CAA6C;IACtC,KAAK,KAAW,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,OAAO,SAAsB,SAAQ,OAAmC;IAC5E,wDAAwD;IACjD,IAAI,CAAC,IAAgB,IAAU,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACd,OAAO,GAA+C,EAAE,CAAC;IAEjE;;;OAGG;IACI,GAAG,CAAC,IAAY;QACrB,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QAEf,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Events\r\n */\r\n\r\nimport { UnexpectedErrors } from \"./UnexpectedErrors\";\r\n\r\n/** A function invoked when a BeEvent is raised.\r\n * @public\r\n */\r\nexport type Listener = (...arg: any[]) => void;\r\n\r\ninterface EventContext {\r\n listener: Listener | undefined;\r\n scope: any;\r\n once: boolean;\r\n}\r\n\r\n/**\r\n * Manages a set of *listeners* for a particular event and notifies them when the event is raised.\r\n * This class is usually instantiated inside of a container class and\r\n * exposed as a property for others to *subscribe* via [[BeEvent.addListener]].\r\n * @public\r\n */\r\nexport class BeEvent<T extends Listener> {\r\n private _listeners: EventContext[] = [];\r\n private _insideRaiseEvent: boolean = false;\r\n\r\n /** The number of listeners currently subscribed to the event. */\r\n public get numberOfListeners() { return this._listeners.length; }\r\n\r\n /**\r\n * Registers a Listener to be executed whenever this event is raised.\r\n * @param listener The function to be executed when the event is raised.\r\n * @param scope An optional object scope to serve as the 'this' pointer when listener is invoked.\r\n * @returns A function that will remove this event listener.\r\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\r\n */\r\n public addListener(listener: T, scope?: any): () => void {\r\n this._listeners.push({ listener, scope, once: false });\r\n return () => this.removeListener(listener, scope);\r\n }\r\n\r\n /**\r\n * Registers a callback function to be executed *only once* when the event is raised.\r\n * @param listener The function to be executed once when the event is raised.\r\n * @param scope An optional object scope to serve as the `this` pointer in which the listener function will execute.\r\n * @returns A function that will remove this event listener.\r\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\r\n */\r\n public addOnce(listener: T, scope?: any): () => void {\r\n this._listeners.push({ listener, scope, once: true });\r\n return () => this.removeListener(listener, scope);\r\n }\r\n\r\n /**\r\n * Un-register a previously registered listener.\r\n * @param listener The listener to be unregistered.\r\n * @param scope The scope that was originally passed to addListener.\r\n * @returns 'true' if the listener was removed; 'false' if the listener and scope are not registered with the event.\r\n * @see [[BeEvent.raiseEvent]], [[BeEvent.addListener]]\r\n */\r\n public removeListener(listener: T, scope?: any): boolean {\r\n const listeners = this._listeners;\r\n\r\n for (let i = 0; i < listeners.length; ++i) {\r\n const context = listeners[i];\r\n if (context.listener === listener && context.scope === scope) {\r\n if (this._insideRaiseEvent) {\r\n context.listener = undefined;\r\n } else {\r\n listeners.splice(i, 1);\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Raises the event by calling each registered listener with the supplied arguments.\r\n * @param args This method takes any number of parameters and passes them through to the listeners.\r\n * @see [[BeEvent.removeListener]], [[BeEvent.addListener]]\r\n */\r\n public raiseEvent(...args: Parameters<T>) {\r\n this._insideRaiseEvent = true;\r\n\r\n const listeners = this._listeners;\r\n const length = listeners.length;\r\n let dropped = false;\r\n\r\n for (let i = 0; i < length; ++i) {\r\n const context = listeners[i];\r\n if (!context.listener) {\r\n dropped = true;\r\n } else {\r\n try {\r\n context.listener.apply(context.scope, args);\r\n } catch (e) {\r\n UnexpectedErrors.handle(e);\r\n }\r\n if (context.once) {\r\n context.listener = undefined;\r\n dropped = true;\r\n }\r\n }\r\n }\r\n\r\n // if we had dropped listeners, remove them now\r\n if (dropped)\r\n this._listeners = this._listeners.filter((ctx) => ctx.listener !== undefined);\r\n\r\n this._insideRaiseEvent = false;\r\n }\r\n\r\n /** Determine whether this BeEvent has a specified listener registered.\r\n * @param listener The listener to check.\r\n * @param scope optional scope argument to match call to addListener\r\n */\r\n public has(listener: T, scope?: any): boolean {\r\n for (const ctx of this._listeners) {\r\n if (ctx.listener === listener && ctx.scope === scope) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /** Clear all Listeners from this BeEvent. */\r\n public clear(): void { this._listeners.length = 0; }\r\n}\r\n\r\n/** Specialization of BeEvent for events that take a single strongly typed argument, primarily used for UI events.\r\n * @public\r\n */\r\nexport class BeUiEvent<TEventArgs> extends BeEvent<(args: TEventArgs) => void> {\r\n /** Raises event with single strongly typed argument. */\r\n public emit(args: TEventArgs): void { this.raiseEvent(args); }\r\n}\r\n\r\n/**\r\n * A list of BeEvent objects, accessible by an event name.\r\n * This class may be used instead of explicitly declaring each BeEvent as a member of a containing class.\r\n * @public\r\n */\r\nexport class BeEventList<T extends Listener> {\r\n private _events: { [name: string]: BeEvent<T> | undefined } = {};\r\n\r\n /**\r\n * Gets the event associated with the specified name, creating the event if it does not already exist.\r\n * @param name The name of the event.\r\n */\r\n public get(name: string): BeEvent<T> {\r\n let event = this._events[name];\r\n if (event)\r\n return event;\r\n\r\n event = new BeEvent();\r\n this._events[name] = event;\r\n return event;\r\n }\r\n\r\n /**\r\n * Removes the event associated with a name.\r\n * @param name The name of the event.\r\n */\r\n public remove(name: string): void {\r\n this._events[name] = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Retrieves the type of the callback function for an event type like [[BeEvent]].\r\n * For example:\r\n * ```ts\r\n * const event = new BeEvent<(x: number, y: string) => void>();\r\n * const callback: ListenerType<typeof event> = (x, y) => {\r\n * console.log(`${x}, ${y}`);\r\n * };\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport type ListenerType<TEvent extends {\r\n addListener(listener: Listener): () => void;\r\n}> =\r\n TEvent extends {\r\n addListener(listener: infer TListener): () => void;\r\n } ? TListener : never;\r\n"]}
1
+ {"version":3,"file":"BeEvent.js","sourceRoot":"","sources":["../../src/BeEvent.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAatD;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IACV,UAAU,GAAmB,EAAE,CAAC;IAChC,iBAAiB,GAAY,KAAK,CAAC;IAE3C,iEAAiE;IACjE,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE;;;;;;OAMG;IACI,WAAW,CAAC,QAAW,EAAE,KAAW;QACzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,QAAW,EAAE,KAAW;QACrC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAA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G;IACI,GAAG,CAAC,IAAY;QACrB,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QAEf,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,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 Events\n */\n\nimport { UnexpectedErrors } from \"./UnexpectedErrors\";\n\n/** A function invoked when a BeEvent is raised.\n * @public\n */\nexport type Listener = (...arg: any[]) => void;\n\ninterface EventContext {\n listener: Listener | undefined;\n scope: any;\n once: boolean;\n}\n\n/**\n * Manages a set of *listeners* for a particular event and notifies them when the event is raised.\n * This class is usually instantiated inside of a container class and\n * exposed as a property for others to *subscribe* via [[BeEvent.addListener]].\n * @public\n */\nexport class BeEvent<T extends Listener> {\n private _listeners: EventContext[] = [];\n private _insideRaiseEvent: boolean = false;\n\n /** The number of listeners currently subscribed to the event. */\n public get numberOfListeners() { return this._listeners.length; }\n\n /**\n * Registers a Listener to be executed whenever this event is raised.\n * @param listener The function to be executed when the event is raised.\n * @param scope An optional object scope to serve as the 'this' pointer when listener is invoked.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addListener(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: false });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Registers a callback function to be executed *only once* when the event is raised.\n * @param listener The function to be executed once when the event is raised.\n * @param scope An optional object scope to serve as the `this` pointer in which the listener function will execute.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addOnce(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: true });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Un-register a previously registered listener.\n * @param listener The listener to be unregistered.\n * @param scope The scope that was originally passed to addListener.\n * @returns 'true' if the listener was removed; 'false' if the listener and scope are not registered with the event.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.addListener]]\n */\n public removeListener(listener: T, scope?: any): boolean {\n const listeners = this._listeners;\n\n for (let i = 0; i < listeners.length; ++i) {\n const context = listeners[i];\n if (context.listener === listener && context.scope === scope) {\n if (this._insideRaiseEvent) {\n context.listener = undefined;\n } else {\n listeners.splice(i, 1);\n }\n return true;\n }\n }\n return false;\n }\n\n /**\n * Raises the event by calling each registered listener with the supplied arguments.\n * @param args This method takes any number of parameters and passes them through to the listeners.\n * @see [[BeEvent.removeListener]], [[BeEvent.addListener]]\n */\n public raiseEvent(...args: Parameters<T>) {\n this._insideRaiseEvent = true;\n\n const listeners = this._listeners;\n const length = listeners.length;\n let dropped = false;\n\n for (let i = 0; i < length; ++i) {\n const context = listeners[i];\n if (!context.listener) {\n dropped = true;\n } else {\n try {\n context.listener.apply(context.scope, args);\n } catch (e) {\n UnexpectedErrors.handle(e);\n }\n if (context.once) {\n context.listener = undefined;\n dropped = true;\n }\n }\n }\n\n // if we had dropped listeners, remove them now\n if (dropped)\n this._listeners = this._listeners.filter((ctx) => ctx.listener !== undefined);\n\n this._insideRaiseEvent = false;\n }\n\n /** Determine whether this BeEvent has a specified listener registered.\n * @param listener The listener to check.\n * @param scope optional scope argument to match call to addListener\n */\n public has(listener: T, scope?: any): boolean {\n for (const ctx of this._listeners) {\n if (ctx.listener === listener && ctx.scope === scope) {\n return true;\n }\n }\n return false;\n }\n\n /** Clear all Listeners from this BeEvent. */\n public clear(): void { this._listeners.length = 0; }\n}\n\n/** Specialization of BeEvent for events that take a single strongly typed argument, primarily used for UI events.\n * @public\n */\nexport class BeUiEvent<TEventArgs> extends BeEvent<(args: TEventArgs) => void> {\n /** Raises event with single strongly typed argument. */\n public emit(args: TEventArgs): void { this.raiseEvent(args); }\n}\n\n/**\n * A list of BeEvent objects, accessible by an event name.\n * This class may be used instead of explicitly declaring each BeEvent as a member of a containing class.\n * @public\n */\nexport class BeEventList<T extends Listener> {\n private _events: { [name: string]: BeEvent<T> | undefined } = {};\n\n /**\n * Gets the event associated with the specified name, creating the event if it does not already exist.\n * @param name The name of the event.\n */\n public get(name: string): BeEvent<T> {\n let event = this._events[name];\n if (event)\n return event;\n\n event = new BeEvent();\n this._events[name] = event;\n return event;\n }\n\n /**\n * Removes the event associated with a name.\n * @param name The name of the event.\n */\n public remove(name: string): void {\n this._events[name] = undefined;\n }\n}\n\n/**\n * Retrieves the type of the callback function for an event type like [[BeEvent]].\n * For example:\n * ```ts\n * const event = new BeEvent<(x: number, y: string) => void>();\n * const callback: ListenerType<typeof event> = (x, y) => {\n * console.log(`${x}, ${y}`);\n * };\n * ```\n *\n * @public\n */\nexport type ListenerType<TEvent extends {\n addListener(listener: Listener): () => void;\n}> =\n TEvent extends {\n addListener(listener: infer TListener): () => void;\n } ? TListener : never;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BeSQLite.js","sourceRoot":"","sources":["../../src/BeSQLite.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+CAAqB,CAAA;IACrB,iDAAsB,CAAA;AACxB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,yBAAyB;IACzB,2CAAU,CAAA;IACV,8BAA8B;IAC9B,4CAAW,CAAA;IACX,oDAAoD;IACpD,4CAAW,CA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D,CAAA;IAC5D,+EAAqD,CAAA;IACrD,yFAA8D,CAAA;IAC9D,iFAA0D,CAAA;IAC1D,uFAA6D,CAAA;IAC7D,6EAAuD,CAAA;IACvD,uFAA6D,CAAA;IAC7D,uFAA6D,CAAA;IAC7D,uFAA6D,CAAA;IAC7D,iFAAuD,CAAA;IACvD,qFAAmE,CAAA;IACnE,+FAAwE,CAAA;IACxE,+FAAwE,CAAA;IACxE,4FAAsE,CAAA;IACtE,0FAAqE,CAAA;IACrE,gGAAwE,CAAA;IACxE,0FAAqE,CAAA;IACrE,wFAAoE,CAAA;IACpE,oFAAkE,CAAA;AACpE,CAAC,EAtJW,QAAQ,KAAR,QAAQ,QAsJnB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BeSQLite\r\n */\r\n\r\n/** Whether to open a database readonly or writeable.\r\n * @public\r\n */\r\nexport enum OpenMode {\r\n Readonly = 0x00000001,\r\n ReadWrite = 0x00000002,\r\n}\r\n\r\n/** Values, stored in changesets, that indicate what operation was performed on the database.\r\n * @public\r\n */\r\nexport enum DbOpcode {\r\n /** A row was deleted. */\r\n Delete = 9,\r\n /** A new row was inserted. */\r\n Insert = 18,\r\n /** Some columns of an existing row were updated. */\r\n Update = 23,\r\n}\r\n\r\n/** Values for return codes from BeSQLite functions. Consult SQLite documentation for further explanations.\r\n * @public\r\n */\r\n// Disabling for the rest of the file since eslint does not correctly parse the entire enum, only parts of it\r\nexport enum DbResult {\r\n /** Success */\r\n BE_SQLITE_OK = 0,\r\n /** SQL error or missing database */\r\n BE_SQLITE_ERROR = 1,\r\n /** Internal logic error */\r\n BE_SQLITE_INTERNAL = 2,\r\n /** Access permission denied */\r\n BE_SQLITE_PERM = 3,\r\n /** Callback routine requested an abort */\r\n BE_SQLITE_ABORT = 4,\r\n /** The database file is locked */\r\n BE_SQLITE_BUSY = 5,\r\n /** A table in the database is locked */\r\n BE_SQLITE_LOCKED = 6,\r\n /** A malloc() failed */\r\n BE_SQLITE_NOMEM = 7,\r\n /** Attempt to write a readonly database */\r\n BE_SQLITE_READONLY = 8,\r\n /** Operation terminated by interrupt */\r\n BE_SQLITE_INTERRUPT = 9,\r\n /** Some kind of disk I/O error occurred */\r\n BE_SQLITE_IOERR = 10,\r\n /** The database disk image is malformed */\r\n BE_SQLITE_CORRUPT = 11,\r\n /** NOT USED. Table or record not found */\r\n BE_SQLITE_NOTFOUND = 12,\r\n /** Insertion failed because database is full or write operation failed because disk is full */\r\n BE_SQLITE_FULL = 13,\r\n /** Unable to open the database file */\r\n BE_SQLITE_CANTOPEN = 14,\r\n /** Database lock protocol error */\r\n BE_SQLITE_PROTOCOL = 15,\r\n /** Database is empty */\r\n BE_SQLITE_EMPTY = 16,\r\n /** The database schema changed */\r\n BE_SQLITE_SCHEMA = 17,\r\n /** String or BLOB exceeds size limit */\r\n BE_SQLITE_TOOBIG = 18,\r\n /** Abort due to constraint violation. See extended error values. */\r\n BE_SQLITE_CONSTRAINT_BASE = 19,\r\n /** Data type mismatch */\r\n BE_SQLITE_MISMATCH = 20,\r\n /** Library used incorrectly */\r\n BE_SQLITE_MISUSE = 21,\r\n /** Uses OS features not supported on host */\r\n BE_SQLITE_NOLFS = 22,\r\n /** Authorization denied */\r\n BE_SQLITE_AUTH = 23,\r\n /** Auxiliary database format error */\r\n BE_SQLITE_FORMAT = 24,\r\n /** 2nd parameter to Bind out of range */\r\n BE_SQLITE_RANGE = 25,\r\n /** File opened that is not a database file */\r\n BE_SQLITE_NOTADB = 26,\r\n /** Step() has another row ready */\r\n BE_SQLITE_ROW = 100,\r\n /** Step() has finished executing */\r\n BE_SQLITE_DONE = 101,\r\n\r\n BE_SQLITE_IOERR_READ = (BE_SQLITE_IOERR | (1 << 8)),\r\n BE_SQLITE_IOERR_SHORT_READ = (BE_SQLITE_IOERR | (2 << 8)),\r\n BE_SQLITE_IOERR_WRITE = (BE_SQLITE_IOERR | (3 << 8)),\r\n BE_SQLITE_IOERR_FSYNC = (BE_SQLITE_IOERR | (4 << 8)),\r\n BE_SQLITE_IOERR_DIR_FSYNC = (BE_SQLITE_IOERR | (5 << 8)),\r\n BE_SQLITE_IOERR_TRUNCATE = (BE_SQLITE_IOERR | (6 << 8)),\r\n BE_SQLITE_IOERR_FSTAT = (BE_SQLITE_IOERR | (7 << 8)),\r\n BE_SQLITE_IOERR_UNLOCK = (BE_SQLITE_IOERR | (8 << 8)),\r\n BE_SQLITE_IOERR_RDLOCK = (BE_SQLITE_IOERR | (9 << 8)),\r\n BE_SQLITE_IOERR_DELETE = (BE_SQLITE_IOERR | (10 << 8)),\r\n BE_SQLITE_IOERR_BLOCKED = (BE_SQLITE_IOERR | (11 << 8)),\r\n BE_SQLITE_IOERR_NOMEM = (BE_SQLITE_IOERR | (12 << 8)),\r\n BE_SQLITE_IOERR_ACCESS = (BE_SQLITE_IOERR | (13 << 8)),\r\n BE_SQLITE_IOERR_CHECKRESERVEDLOCK = (BE_SQLITE_IOERR | (14 << 8)),\r\n BE_SQLITE_IOERR_LOCK = (BE_SQLITE_IOERR | (15 << 8)),\r\n BE_SQLITE_IOERR_CLOSE = (BE_SQLITE_IOERR | (16 << 8)),\r\n BE_SQLITE_IOERR_DIR_CLOSE = (BE_SQLITE_IOERR | (17 << 8)),\r\n BE_SQLITE_IOERR_SHMOPEN = (BE_SQLITE_IOERR | (18 << 8)),\r\n BE_SQLITE_IOERR_SHMSIZE = (BE_SQLITE_IOERR | (19 << 8)),\r\n BE_SQLITE_IOERR_SHMLOCK = (BE_SQLITE_IOERR | (20 << 8)),\r\n BE_SQLITE_IOERR_SHMMAP = (BE_SQLITE_IOERR | (21 << 8)),\r\n BE_SQLITE_IOERR_SEEK = (BE_SQLITE_IOERR | (22 << 8)),\r\n BE_SQLITE_IOERR_DELETE_NOENT = (BE_SQLITE_IOERR | (23 << 8)),\r\n\r\n /** attempt to create a new file when a file by that name already exists */\r\n BE_SQLITE_ERROR_FileExists = (BE_SQLITE_IOERR | (1 << 24)),\r\n /** attempt to open a BeSQLite::Db that is already in use somewhere. */\r\n BE_SQLITE_ERROR_AlreadyOpen = (BE_SQLITE_IOERR | (2 << 24)),\r\n /** attempt to open a BeSQLite::Db that doesn't have a property table. */\r\n BE_SQLITE_ERROR_NoPropertyTable = (BE_SQLITE_IOERR | (3 << 24)),\r\n /** the database name is not a file. */\r\n BE_SQLITE_ERROR_FileNotFound = (BE_SQLITE_IOERR | (4 << 24)),\r\n /** there is no transaction active and the database was opened with AllowImplicitTransactions=false */\r\n BE_SQLITE_ERROR_NoTxnActive = (BE_SQLITE_IOERR | (5 << 24)),\r\n /** wrong BeSQLite profile version */\r\n BE_SQLITE_ERROR_BadDbProfile = (BE_SQLITE_IOERR | (6 << 24)),\r\n /** Profile of file could not be determined. */\r\n BE_SQLITE_ERROR_InvalidProfileVersion = (BE_SQLITE_IOERR | (7 << 24)),\r\n /** Upgrade of profile of file failed. */\r\n BE_SQLITE_ERROR_ProfileUpgradeFailed = (BE_SQLITE_IOERR | (8 << 24)),\r\n /** Profile of file is too old. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooOldForReadWrite = (BE_SQLITE_IOERR | (9 << 24)),\r\n /** Profile of file is too old. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooOld = (BE_SQLITE_IOERR | (10 << 24)),\r\n /** Profile of file is too new for read-write access. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooNewForReadWrite = (BE_SQLITE_IOERR | (11 << 24)),\r\n /** Profile of file is too new. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooNew = (BE_SQLITE_IOERR | (12 << 24)),\r\n /** attempt to commit with active changetrack */\r\n BE_SQLITE_ERROR_ChangeTrackError = (BE_SQLITE_IOERR | (13 << 24)),\r\n /** invalid version of the revision file is being imported */\r\n BE_SQLITE_ERROR_InvalidChangeSetVersion = (BE_SQLITE_IOERR | (14 << 24)),\r\n /** The schemas found in the database need to be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRequired = (BE_SQLITE_IOERR | 15 << 24),\r\n /** The schemas found in the database are too new, and the application needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooNew = (BE_SQLITE_IOERR | 16 << 24),\r\n /** The schemas found in the database are too old, and the DgnDb needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooOld = (BE_SQLITE_IOERR | 17 << 24),\r\n /** Error acquiring a lock on the schemas before upgrade. */\r\n BE_SQLITE_ERROR_SchemaLockFailed = (BE_SQLITE_IOERR | 18 << 24),\r\n /** Error upgrading the schemas in the database. */\r\n BE_SQLITE_ERROR_SchemaUpgradeFailed = (BE_SQLITE_IOERR | 19 << 24),\r\n /** Error importing the schemas into the database. */\r\n BE_SQLITE_ERROR_SchemaImportFailed = (BE_SQLITE_IOERR | 20 << 24),\r\n /** Error acquiring locks or codes */\r\n BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes = (BE_SQLITE_IOERR | 21 << 24),\r\n /** Recommended that the schemas found in the database be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRecommended = (BE_SQLITE_IOERR | 22 << 24),\r\n /** schema update require data transform */\r\n BE_SQLITE_ERROR_DataTransformRequired = (BE_SQLITE_IOERR | (23 << 24)),\r\n\r\n BE_SQLITE_LOCKED_SHAREDCACHE = (BE_SQLITE_LOCKED | (1 << 8)),\r\n BE_SQLITE_BUSY_RECOVERY = (BE_SQLITE_BUSY | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_NOTEMPDIR = (BE_SQLITE_CANTOPEN | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_ISDIR = (BE_SQLITE_CANTOPEN | (2 << 8)),\r\n BE_SQLITE_CANTOPEN_FULLPATH = (BE_SQLITE_CANTOPEN | (3 << 8)),\r\n BE_SQLITE_CORRUPT_VTAB = (BE_SQLITE_CORRUPT | (1 << 8)),\r\n BE_SQLITE_READONLY_RECOVERY = (BE_SQLITE_READONLY | (1 << 8)),\r\n BE_SQLITE_READONLY_CANTLOCK = (BE_SQLITE_READONLY | (2 << 8)),\r\n BE_SQLITE_READONLY_ROLLBACK = (BE_SQLITE_READONLY | (3 << 8)),\r\n BE_SQLITE_ABORT_ROLLBACK = (BE_SQLITE_ABORT | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_CHECK = (BE_SQLITE_CONSTRAINT_BASE | (1 << 8)),\r\n BE_SQLITE_CONSTRAINT_COMMITHOOK = (BE_SQLITE_CONSTRAINT_BASE | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_FOREIGNKEY = (BE_SQLITE_CONSTRAINT_BASE | (3 << 8)),\r\n BE_SQLITE_CONSTRAINT_FUNCTION = (BE_SQLITE_CONSTRAINT_BASE | (4 << 8)),\r\n BE_SQLITE_CONSTRAINT_NOTNULL = (BE_SQLITE_CONSTRAINT_BASE | (5 << 8)),\r\n BE_SQLITE_CONSTRAINT_PRIMARYKEY = (BE_SQLITE_CONSTRAINT_BASE | (6 << 8)),\r\n BE_SQLITE_CONSTRAINT_TRIGGER = (BE_SQLITE_CONSTRAINT_BASE | (7 << 8)),\r\n BE_SQLITE_CONSTRAINT_UNIQUE = (BE_SQLITE_CONSTRAINT_BASE | (8 << 8)),\r\n BE_SQLITE_CONSTRAINT_VTAB = (BE_SQLITE_CONSTRAINT_BASE | (9 << 8)),\r\n}\r\n"]}
1
+ {"version":3,"file":"BeSQLite.js","sourceRoot":"","sources":["../../src/BeSQLite.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+CAAqB,CAAA;IACrB,iDAAsB,CAAA;AACxB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY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ACrC,6HAA0E,CAAA;IAC1E,qEAAqE;IACrE,uHAAuE,CAAA;IACvE,2CAA2C;IAC3C,iHAAsE,CAAA;IAEtE,yFAA4D,CAAA;IAC5D,+EAAqD,CAAA;IACrD,yFAA8D,CAAA;IAC9D,iFAA0D,CAAA;IAC1D,uFAA6D,CAAA;IAC7D,6EAAuD,CAAA;IACvD,uFAA6D,CAAA;IAC7D,uFAA6D,CAAA;IAC7D,uFAA6D,CAAA;IAC7D,iFAAuD,CAAA;IACvD,qFAAmE,CAAA;IACnE,+FAAwE,CAAA;IACxE,+FAAwE,CAAA;IACxE,4FAAsE,CAAA;IACtE,0FAAqE,CAAA;IACrE,gGAAwE,CAAA;IACxE,0FAAqE,CAAA;IACrE,wFAAoE,CAAA;IACpE,oFAAkE,CAAA;AACpE,CAAC,EAtJW,QAAQ,KAAR,QAAQ,QAsJnB","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 BeSQLite\n */\n\n/** Whether to open a database readonly or writeable.\n * @public\n */\nexport enum OpenMode {\n Readonly = 0x00000001,\n ReadWrite = 0x00000002,\n}\n\n/** Values, stored in changesets, that indicate what operation was performed on the database.\n * @public\n */\nexport enum DbOpcode {\n /** A row was deleted. */\n Delete = 9,\n /** A new row was inserted. */\n Insert = 18,\n /** Some columns of an existing row were updated. */\n Update = 23,\n}\n\n/** Values for return codes from BeSQLite functions. Consult SQLite documentation for further explanations.\n * @public\n */\n// Disabling for the rest of the file since eslint does not correctly parse the entire enum, only parts of it\nexport enum DbResult {\n /** Success */\n BE_SQLITE_OK = 0,\n /** SQL error or missing database */\n BE_SQLITE_ERROR = 1,\n /** Internal logic error */\n BE_SQLITE_INTERNAL = 2,\n /** Access permission denied */\n BE_SQLITE_PERM = 3,\n /** Callback routine requested an abort */\n BE_SQLITE_ABORT = 4,\n /** The database file is locked */\n BE_SQLITE_BUSY = 5,\n /** A table in the database is locked */\n BE_SQLITE_LOCKED = 6,\n /** A malloc() failed */\n BE_SQLITE_NOMEM = 7,\n /** Attempt to write a readonly database */\n BE_SQLITE_READONLY = 8,\n /** Operation terminated by interrupt */\n BE_SQLITE_INTERRUPT = 9,\n /** Some kind of disk I/O error occurred */\n BE_SQLITE_IOERR = 10,\n /** The database disk image is malformed */\n BE_SQLITE_CORRUPT = 11,\n /** NOT USED. Table or record not found */\n BE_SQLITE_NOTFOUND = 12,\n /** Insertion failed because database is full or write operation failed because disk is full */\n BE_SQLITE_FULL = 13,\n /** Unable to open the database file */\n BE_SQLITE_CANTOPEN = 14,\n /** Database lock protocol error */\n BE_SQLITE_PROTOCOL = 15,\n /** Database is empty */\n BE_SQLITE_EMPTY = 16,\n /** The database schema changed */\n BE_SQLITE_SCHEMA = 17,\n /** String or BLOB exceeds size limit */\n BE_SQLITE_TOOBIG = 18,\n /** Abort due to constraint violation. See extended error values. */\n BE_SQLITE_CONSTRAINT_BASE = 19,\n /** Data type mismatch */\n BE_SQLITE_MISMATCH = 20,\n /** Library used incorrectly */\n BE_SQLITE_MISUSE = 21,\n /** Uses OS features not supported on host */\n BE_SQLITE_NOLFS = 22,\n /** Authorization denied */\n BE_SQLITE_AUTH = 23,\n /** Auxiliary database format error */\n BE_SQLITE_FORMAT = 24,\n /** 2nd parameter to Bind out of range */\n BE_SQLITE_RANGE = 25,\n /** File opened that is not a database file */\n BE_SQLITE_NOTADB = 26,\n /** Step() has another row ready */\n BE_SQLITE_ROW = 100,\n /** Step() has finished executing */\n BE_SQLITE_DONE = 101,\n\n BE_SQLITE_IOERR_READ = (BE_SQLITE_IOERR | (1 << 8)),\n BE_SQLITE_IOERR_SHORT_READ = (BE_SQLITE_IOERR | (2 << 8)),\n BE_SQLITE_IOERR_WRITE = (BE_SQLITE_IOERR | (3 << 8)),\n BE_SQLITE_IOERR_FSYNC = (BE_SQLITE_IOERR | (4 << 8)),\n BE_SQLITE_IOERR_DIR_FSYNC = (BE_SQLITE_IOERR | (5 << 8)),\n BE_SQLITE_IOERR_TRUNCATE = (BE_SQLITE_IOERR | (6 << 8)),\n BE_SQLITE_IOERR_FSTAT = (BE_SQLITE_IOERR | (7 << 8)),\n BE_SQLITE_IOERR_UNLOCK = (BE_SQLITE_IOERR | (8 << 8)),\n BE_SQLITE_IOERR_RDLOCK = (BE_SQLITE_IOERR | (9 << 8)),\n BE_SQLITE_IOERR_DELETE = (BE_SQLITE_IOERR | (10 << 8)),\n BE_SQLITE_IOERR_BLOCKED = (BE_SQLITE_IOERR | (11 << 8)),\n BE_SQLITE_IOERR_NOMEM = (BE_SQLITE_IOERR | (12 << 8)),\n BE_SQLITE_IOERR_ACCESS = (BE_SQLITE_IOERR | (13 << 8)),\n BE_SQLITE_IOERR_CHECKRESERVEDLOCK = (BE_SQLITE_IOERR | (14 << 8)),\n BE_SQLITE_IOERR_LOCK = (BE_SQLITE_IOERR | (15 << 8)),\n BE_SQLITE_IOERR_CLOSE = (BE_SQLITE_IOERR | (16 << 8)),\n BE_SQLITE_IOERR_DIR_CLOSE = (BE_SQLITE_IOERR | (17 << 8)),\n BE_SQLITE_IOERR_SHMOPEN = (BE_SQLITE_IOERR | (18 << 8)),\n BE_SQLITE_IOERR_SHMSIZE = (BE_SQLITE_IOERR | (19 << 8)),\n BE_SQLITE_IOERR_SHMLOCK = (BE_SQLITE_IOERR | (20 << 8)),\n BE_SQLITE_IOERR_SHMMAP = (BE_SQLITE_IOERR | (21 << 8)),\n BE_SQLITE_IOERR_SEEK = (BE_SQLITE_IOERR | (22 << 8)),\n BE_SQLITE_IOERR_DELETE_NOENT = (BE_SQLITE_IOERR | (23 << 8)),\n\n /** attempt to create a new file when a file by that name already exists */\n BE_SQLITE_ERROR_FileExists = (BE_SQLITE_IOERR | (1 << 24)),\n /** attempt to open a BeSQLite::Db that is already in use somewhere. */\n BE_SQLITE_ERROR_AlreadyOpen = (BE_SQLITE_IOERR | (2 << 24)),\n /** attempt to open a BeSQLite::Db that doesn't have a property table. */\n BE_SQLITE_ERROR_NoPropertyTable = (BE_SQLITE_IOERR | (3 << 24)),\n /** the database name is not a file. */\n BE_SQLITE_ERROR_FileNotFound = (BE_SQLITE_IOERR | (4 << 24)),\n /** there is no transaction active and the database was opened with AllowImplicitTransactions=false */\n BE_SQLITE_ERROR_NoTxnActive = (BE_SQLITE_IOERR | (5 << 24)),\n /** wrong BeSQLite profile version */\n BE_SQLITE_ERROR_BadDbProfile = (BE_SQLITE_IOERR | (6 << 24)),\n /** Profile of file could not be determined. */\n BE_SQLITE_ERROR_InvalidProfileVersion = (BE_SQLITE_IOERR | (7 << 24)),\n /** Upgrade of profile of file failed. */\n BE_SQLITE_ERROR_ProfileUpgradeFailed = (BE_SQLITE_IOERR | (8 << 24)),\n /** Profile of file is too old. Therefore file can only be opened read-only. */\n BE_SQLITE_ERROR_ProfileTooOldForReadWrite = (BE_SQLITE_IOERR | (9 << 24)),\n /** Profile of file is too old. Therefore file cannot be opened. */\n BE_SQLITE_ERROR_ProfileTooOld = (BE_SQLITE_IOERR | (10 << 24)),\n /** Profile of file is too new for read-write access. Therefore file can only be opened read-only. */\n BE_SQLITE_ERROR_ProfileTooNewForReadWrite = (BE_SQLITE_IOERR | (11 << 24)),\n /** Profile of file is too new. Therefore file cannot be opened. */\n BE_SQLITE_ERROR_ProfileTooNew = (BE_SQLITE_IOERR | (12 << 24)),\n /** attempt to commit with active changetrack */\n BE_SQLITE_ERROR_ChangeTrackError = (BE_SQLITE_IOERR | (13 << 24)),\n /** invalid version of the revision file is being imported */\n BE_SQLITE_ERROR_InvalidChangeSetVersion = (BE_SQLITE_IOERR | (14 << 24)),\n /** The schemas found in the database need to be upgraded */\n BE_SQLITE_ERROR_SchemaUpgradeRequired = (BE_SQLITE_IOERR | 15 << 24),\n /** The schemas found in the database are too new, and the application needs to be upgraded. */\n BE_SQLITE_ERROR_SchemaTooNew = (BE_SQLITE_IOERR | 16 << 24),\n /** The schemas found in the database are too old, and the DgnDb needs to be upgraded. */\n BE_SQLITE_ERROR_SchemaTooOld = (BE_SQLITE_IOERR | 17 << 24),\n /** Error acquiring a lock on the schemas before upgrade. */\n BE_SQLITE_ERROR_SchemaLockFailed = (BE_SQLITE_IOERR | 18 << 24),\n /** Error upgrading the schemas in the database. */\n BE_SQLITE_ERROR_SchemaUpgradeFailed = (BE_SQLITE_IOERR | 19 << 24),\n /** Error importing the schemas into the database. */\n BE_SQLITE_ERROR_SchemaImportFailed = (BE_SQLITE_IOERR | 20 << 24),\n /** Error acquiring locks or codes */\n BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes = (BE_SQLITE_IOERR | 21 << 24),\n /** Recommended that the schemas found in the database be upgraded */\n BE_SQLITE_ERROR_SchemaUpgradeRecommended = (BE_SQLITE_IOERR | 22 << 24),\n /** schema update require data transform */\n BE_SQLITE_ERROR_DataTransformRequired = (BE_SQLITE_IOERR | (23 << 24)),\n\n BE_SQLITE_LOCKED_SHAREDCACHE = (BE_SQLITE_LOCKED | (1 << 8)),\n BE_SQLITE_BUSY_RECOVERY = (BE_SQLITE_BUSY | (1 << 8)),\n BE_SQLITE_CANTOPEN_NOTEMPDIR = (BE_SQLITE_CANTOPEN | (1 << 8)),\n BE_SQLITE_CANTOPEN_ISDIR = (BE_SQLITE_CANTOPEN | (2 << 8)),\n BE_SQLITE_CANTOPEN_FULLPATH = (BE_SQLITE_CANTOPEN | (3 << 8)),\n BE_SQLITE_CORRUPT_VTAB = (BE_SQLITE_CORRUPT | (1 << 8)),\n BE_SQLITE_READONLY_RECOVERY = (BE_SQLITE_READONLY | (1 << 8)),\n BE_SQLITE_READONLY_CANTLOCK = (BE_SQLITE_READONLY | (2 << 8)),\n BE_SQLITE_READONLY_ROLLBACK = (BE_SQLITE_READONLY | (3 << 8)),\n BE_SQLITE_ABORT_ROLLBACK = (BE_SQLITE_ABORT | (2 << 8)),\n BE_SQLITE_CONSTRAINT_CHECK = (BE_SQLITE_CONSTRAINT_BASE | (1 << 8)),\n BE_SQLITE_CONSTRAINT_COMMITHOOK = (BE_SQLITE_CONSTRAINT_BASE | (2 << 8)),\n BE_SQLITE_CONSTRAINT_FOREIGNKEY = (BE_SQLITE_CONSTRAINT_BASE | (3 << 8)),\n BE_SQLITE_CONSTRAINT_FUNCTION = (BE_SQLITE_CONSTRAINT_BASE | (4 << 8)),\n BE_SQLITE_CONSTRAINT_NOTNULL = (BE_SQLITE_CONSTRAINT_BASE | (5 << 8)),\n BE_SQLITE_CONSTRAINT_PRIMARYKEY = (BE_SQLITE_CONSTRAINT_BASE | (6 << 8)),\n BE_SQLITE_CONSTRAINT_TRIGGER = (BE_SQLITE_CONSTRAINT_BASE | (7 << 8)),\n BE_SQLITE_CONSTRAINT_UNIQUE = (BE_SQLITE_CONSTRAINT_BASE | (8 << 8)),\n BE_SQLITE_CONSTRAINT_VTAB = (BE_SQLITE_CONSTRAINT_BASE | (9 << 8)),\n}\n"]}