@itwin/core-bentley 4.0.0-dev.52 → 4.0.0-dev.55

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 (190) hide show
  1. package/lib/cjs/AccessToken.d.ts +10 -10
  2. package/lib/cjs/AccessToken.d.ts.map +1 -1
  3. package/lib/cjs/AccessToken.js +9 -9
  4. package/lib/cjs/Assert.d.ts +25 -25
  5. package/lib/cjs/Assert.js +45 -45
  6. package/lib/cjs/BeEvent.d.ts +81 -81
  7. package/lib/cjs/BeEvent.d.ts.map +1 -1
  8. package/lib/cjs/BeEvent.js +156 -156
  9. package/lib/cjs/BeSQLite.d.ts +172 -172
  10. package/lib/cjs/BeSQLite.js +185 -185
  11. package/lib/cjs/BentleyError.d.ts +378 -378
  12. package/lib/cjs/BentleyError.d.ts.map +1 -1
  13. package/lib/cjs/BentleyError.js +703 -703
  14. package/lib/cjs/BentleyLoggerCategory.d.ts +11 -11
  15. package/lib/cjs/BentleyLoggerCategory.js +19 -19
  16. package/lib/cjs/ByteStream.d.ts +110 -110
  17. package/lib/cjs/ByteStream.js +159 -159
  18. package/lib/cjs/ClassUtils.d.ts +14 -14
  19. package/lib/cjs/ClassUtils.js +27 -27
  20. package/lib/cjs/Compare.d.ts +47 -47
  21. package/lib/cjs/Compare.d.ts.map +1 -1
  22. package/lib/cjs/Compare.js +75 -75
  23. package/lib/cjs/CompressedId64Set.d.ts +134 -134
  24. package/lib/cjs/CompressedId64Set.d.ts.map +1 -1
  25. package/lib/cjs/CompressedId64Set.js +428 -428
  26. package/lib/cjs/CompressedId64Set.js.map +1 -1
  27. package/lib/cjs/Dictionary.d.ts +125 -125
  28. package/lib/cjs/Dictionary.js +203 -203
  29. package/lib/cjs/Disposable.d.ts +80 -80
  30. package/lib/cjs/Disposable.d.ts.map +1 -1
  31. package/lib/cjs/Disposable.js +120 -120
  32. package/lib/cjs/Id.d.ts +285 -285
  33. package/lib/cjs/Id.d.ts.map +1 -1
  34. package/lib/cjs/Id.js +643 -643
  35. package/lib/cjs/IndexMap.d.ts +65 -65
  36. package/lib/cjs/IndexMap.js +91 -91
  37. package/lib/cjs/JsonSchema.d.ts +77 -77
  38. package/lib/cjs/JsonSchema.d.ts.map +1 -1
  39. package/lib/cjs/JsonSchema.js +9 -9
  40. package/lib/cjs/JsonUtils.d.ts +78 -78
  41. package/lib/cjs/JsonUtils.js +151 -151
  42. package/lib/cjs/LRUMap.d.ts +129 -129
  43. package/lib/cjs/LRUMap.js +333 -333
  44. package/lib/cjs/LRUMap.js.map +1 -1
  45. package/lib/cjs/Logger.d.ts +143 -143
  46. package/lib/cjs/Logger.d.ts.map +1 -1
  47. package/lib/cjs/Logger.js +256 -256
  48. package/lib/cjs/Logger.js.map +1 -1
  49. package/lib/cjs/ObservableSet.d.ts +23 -23
  50. package/lib/cjs/ObservableSet.js +51 -51
  51. package/lib/cjs/OneAtATimeAction.d.ts +31 -31
  52. package/lib/cjs/OneAtATimeAction.js +94 -94
  53. package/lib/cjs/OrderedId64Iterable.d.ts +74 -74
  54. package/lib/cjs/OrderedId64Iterable.d.ts.map +1 -1
  55. package/lib/cjs/OrderedId64Iterable.js +235 -235
  56. package/lib/cjs/OrderedSet.d.ts +40 -40
  57. package/lib/cjs/OrderedSet.js +64 -64
  58. package/lib/cjs/PriorityQueue.d.ts +70 -70
  59. package/lib/cjs/PriorityQueue.d.ts.map +1 -1
  60. package/lib/cjs/PriorityQueue.js +140 -140
  61. package/lib/cjs/ProcessDetector.d.ts +59 -59
  62. package/lib/cjs/ProcessDetector.js +71 -71
  63. package/lib/cjs/SortedArray.d.ts +236 -236
  64. package/lib/cjs/SortedArray.d.ts.map +1 -1
  65. package/lib/cjs/SortedArray.js +315 -315
  66. package/lib/cjs/StatusCategory.d.ts +30 -30
  67. package/lib/cjs/StatusCategory.d.ts.map +1 -1
  68. package/lib/cjs/StatusCategory.js +460 -460
  69. package/lib/cjs/StatusCategory.js.map +1 -1
  70. package/lib/cjs/StringUtils.d.ts +22 -22
  71. package/lib/cjs/StringUtils.js +148 -148
  72. package/lib/cjs/Time.d.ts +122 -122
  73. package/lib/cjs/Time.js +152 -152
  74. package/lib/cjs/Time.js.map +1 -1
  75. package/lib/cjs/Tracing.d.ts +40 -40
  76. package/lib/cjs/Tracing.js +127 -127
  77. package/lib/cjs/TupleKeyedMap.d.ts +36 -36
  78. package/lib/cjs/TupleKeyedMap.js +102 -102
  79. package/lib/cjs/TypedArrayBuilder.d.ts +155 -155
  80. package/lib/cjs/TypedArrayBuilder.d.ts.map +1 -1
  81. package/lib/cjs/TypedArrayBuilder.js +206 -206
  82. package/lib/cjs/UnexpectedErrors.d.ts +43 -43
  83. package/lib/cjs/UnexpectedErrors.d.ts.map +1 -1
  84. package/lib/cjs/UnexpectedErrors.js +68 -68
  85. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  86. package/lib/cjs/UtilityTypes.d.ts +112 -112
  87. package/lib/cjs/UtilityTypes.d.ts.map +1 -1
  88. package/lib/cjs/UtilityTypes.js +40 -40
  89. package/lib/cjs/YieldManager.d.ts +18 -18
  90. package/lib/cjs/YieldManager.js +34 -34
  91. package/lib/cjs/core-bentley.d.ts +74 -74
  92. package/lib/cjs/core-bentley.js +94 -90
  93. package/lib/cjs/core-bentley.js.map +1 -1
  94. package/lib/cjs/partitionArray.d.ts +21 -21
  95. package/lib/cjs/partitionArray.js +43 -43
  96. package/lib/esm/AccessToken.d.ts +10 -10
  97. package/lib/esm/AccessToken.d.ts.map +1 -1
  98. package/lib/esm/AccessToken.js +8 -8
  99. package/lib/esm/Assert.d.ts +25 -25
  100. package/lib/esm/Assert.js +41 -41
  101. package/lib/esm/BeEvent.d.ts +81 -81
  102. package/lib/esm/BeEvent.d.ts.map +1 -1
  103. package/lib/esm/BeEvent.js +150 -150
  104. package/lib/esm/BeSQLite.d.ts +172 -172
  105. package/lib/esm/BeSQLite.js +182 -182
  106. package/lib/esm/BentleyError.d.ts +378 -378
  107. package/lib/esm/BentleyError.d.ts.map +1 -1
  108. package/lib/esm/BentleyError.js +699 -699
  109. package/lib/esm/BentleyLoggerCategory.d.ts +11 -11
  110. package/lib/esm/BentleyLoggerCategory.js +16 -16
  111. package/lib/esm/ByteStream.d.ts +110 -110
  112. package/lib/esm/ByteStream.js +155 -155
  113. package/lib/esm/ClassUtils.d.ts +14 -14
  114. package/lib/esm/ClassUtils.js +22 -22
  115. package/lib/esm/Compare.d.ts +47 -47
  116. package/lib/esm/Compare.d.ts.map +1 -1
  117. package/lib/esm/Compare.js +63 -63
  118. package/lib/esm/CompressedId64Set.d.ts +134 -134
  119. package/lib/esm/CompressedId64Set.d.ts.map +1 -1
  120. package/lib/esm/CompressedId64Set.js +423 -423
  121. package/lib/esm/CompressedId64Set.js.map +1 -1
  122. package/lib/esm/Dictionary.d.ts +125 -125
  123. package/lib/esm/Dictionary.js +199 -199
  124. package/lib/esm/Disposable.d.ts +80 -80
  125. package/lib/esm/Disposable.d.ts.map +1 -1
  126. package/lib/esm/Disposable.js +112 -112
  127. package/lib/esm/Id.d.ts +285 -285
  128. package/lib/esm/Id.d.ts.map +1 -1
  129. package/lib/esm/Id.js +639 -639
  130. package/lib/esm/IndexMap.d.ts +65 -65
  131. package/lib/esm/IndexMap.js +86 -86
  132. package/lib/esm/JsonSchema.d.ts +77 -77
  133. package/lib/esm/JsonSchema.d.ts.map +1 -1
  134. package/lib/esm/JsonSchema.js +8 -8
  135. package/lib/esm/JsonUtils.d.ts +78 -78
  136. package/lib/esm/JsonUtils.js +148 -148
  137. package/lib/esm/LRUMap.d.ts +129 -129
  138. package/lib/esm/LRUMap.js +326 -326
  139. package/lib/esm/LRUMap.js.map +1 -1
  140. package/lib/esm/Logger.d.ts +143 -143
  141. package/lib/esm/Logger.d.ts.map +1 -1
  142. package/lib/esm/Logger.js +253 -251
  143. package/lib/esm/Logger.js.map +1 -1
  144. package/lib/esm/ObservableSet.d.ts +23 -23
  145. package/lib/esm/ObservableSet.js +47 -47
  146. package/lib/esm/OneAtATimeAction.d.ts +31 -31
  147. package/lib/esm/OneAtATimeAction.js +89 -89
  148. package/lib/esm/OrderedId64Iterable.d.ts +74 -74
  149. package/lib/esm/OrderedId64Iterable.d.ts.map +1 -1
  150. package/lib/esm/OrderedId64Iterable.js +232 -232
  151. package/lib/esm/OrderedSet.d.ts +40 -40
  152. package/lib/esm/OrderedSet.js +59 -59
  153. package/lib/esm/PriorityQueue.d.ts +70 -70
  154. package/lib/esm/PriorityQueue.d.ts.map +1 -1
  155. package/lib/esm/PriorityQueue.js +136 -136
  156. package/lib/esm/ProcessDetector.d.ts +59 -59
  157. package/lib/esm/ProcessDetector.js +67 -67
  158. package/lib/esm/SortedArray.d.ts +236 -236
  159. package/lib/esm/SortedArray.d.ts.map +1 -1
  160. package/lib/esm/SortedArray.js +308 -308
  161. package/lib/esm/StatusCategory.d.ts +30 -30
  162. package/lib/esm/StatusCategory.d.ts.map +1 -1
  163. package/lib/esm/StatusCategory.js +455 -454
  164. package/lib/esm/StatusCategory.js.map +1 -1
  165. package/lib/esm/StringUtils.d.ts +22 -22
  166. package/lib/esm/StringUtils.js +142 -142
  167. package/lib/esm/Time.d.ts +122 -122
  168. package/lib/esm/Time.js +146 -146
  169. package/lib/esm/Time.js.map +1 -1
  170. package/lib/esm/Tracing.d.ts +40 -40
  171. package/lib/esm/Tracing.js +123 -123
  172. package/lib/esm/TupleKeyedMap.d.ts +36 -36
  173. package/lib/esm/TupleKeyedMap.js +98 -98
  174. package/lib/esm/TypedArrayBuilder.d.ts +155 -155
  175. package/lib/esm/TypedArrayBuilder.d.ts.map +1 -1
  176. package/lib/esm/TypedArrayBuilder.js +198 -198
  177. package/lib/esm/UnexpectedErrors.d.ts +43 -43
  178. package/lib/esm/UnexpectedErrors.d.ts.map +1 -1
  179. package/lib/esm/UnexpectedErrors.js +65 -64
  180. package/lib/esm/UnexpectedErrors.js.map +1 -1
  181. package/lib/esm/UtilityTypes.d.ts +112 -112
  182. package/lib/esm/UtilityTypes.d.ts.map +1 -1
  183. package/lib/esm/UtilityTypes.js +34 -34
  184. package/lib/esm/YieldManager.d.ts +18 -18
  185. package/lib/esm/YieldManager.js +30 -30
  186. package/lib/esm/core-bentley.d.ts +74 -74
  187. package/lib/esm/core-bentley.js +78 -78
  188. package/lib/esm/partitionArray.d.ts +21 -21
  189. package/lib/esm/partitionArray.js +39 -39
  190. package/package.json +4 -4
@@ -1,156 +1,156 @@
1
- /** @packageDocumentation
2
- * @module Collections
3
- */
4
- import { Constructor } from "./UtilityTypes";
5
- /** Options used to construct a [[TypedArrayBuilder]].
6
- * @public
7
- */
8
- export interface TypedArrayBuilderOptions {
9
- /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.
10
- * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.
11
- * Default: 1.5
12
- * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.
13
- */
14
- growthFactor?: number;
15
- /** The number of elements to allocate memory for in the TypedArray when creating the builder.
16
- * If you know the minimum number of elements you intend to add to the builder, you should specify that as the
17
- * initial capacity to avoid reallocations when populating the array.
18
- * Default: 0.
19
- * Minimum: 0.
20
- */
21
- initialCapacity?: number;
22
- }
23
- /** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.
24
- * @see [[UintArrayBuilder]] to construct such an array.
25
- * @public
26
- */
27
- export declare type UintArray = Uint8Array | Uint16Array | Uint32Array;
28
- /** 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.
29
- * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
30
- * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
31
- *
32
- * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
33
- * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
34
- * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
35
- * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
36
- *
37
- * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
38
- * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
39
- * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.
40
- * @public
41
- */
42
- export declare class TypedArrayBuilder<T extends UintArray> {
43
- /** The constructor for the specific type of array being populated. */
44
- protected _constructor: Constructor<T>;
45
- /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
46
- protected _data: T;
47
- /** The number of elements added to the array so far. */
48
- protected _length: number;
49
- /** Multiplier applied to required capacity by [[ensureCapacity]]. */
50
- readonly growthFactor: number;
51
- /** Constructs a new builder from the specified options, with a [[length]] of zero. */
52
- protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions);
53
- /** The number of elements currently in the array. */
54
- get length(): number;
55
- /** The number of elements that can fit into the memory currently allocated for the array. */
56
- get capacity(): number;
57
- /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
58
- * returns the element at the specified index, with negative integers counting back from the end of the array.
59
- * @note It is your responsibility to ensure the index falls within the bounds of the array.
60
- */
61
- at(index: number): number;
62
- /** Ensure that [[capacity]] is at least equal to `newCapacity`.
63
- * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
64
- * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
65
- *
66
- * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
67
- * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
68
- * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
69
- */
70
- ensureCapacity(newCapacity: number): number;
71
- /** Append the specified value, resizing if necessary. */
72
- push(value: number): void;
73
- /** Append an array of values, resizing (at most once) if necessary. */
74
- append(values: T): void;
75
- /** Obtain the finished array.
76
- * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
77
- * returned array's length will be equal to [[length]].
78
- */
79
- toTypedArray(includeUnusedCapacity?: boolean): T;
80
- }
81
- /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
82
- * @public
83
- */
84
- export declare class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {
85
- /** See [[TypedArrayBuilder]] constructor. */
86
- constructor(options?: TypedArrayBuilderOptions);
87
- }
88
- /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
89
- * @public
90
- */
91
- export declare class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {
92
- /** See [[TypedArrayBuilder]] constructor. */
93
- constructor(options?: TypedArrayBuilderOptions);
94
- }
95
- /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
96
- * @public
97
- */
98
- export declare class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {
99
- /** See [[TypedArrayBuilder]] constructor. */
100
- constructor(options?: TypedArrayBuilderOptions);
101
- /** Obtain a view of the finished array as an array of bytes. */
102
- toUint8Array(includeUnusedCapacity?: boolean): Uint8Array;
103
- }
104
- /** Options used to construct a [[UintArrayBuilder]].
105
- * @public
106
- */
107
- export interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {
108
- /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than
109
- * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.
110
- * Default: `Uint8Array`.
111
- */
112
- initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;
113
- }
114
- /** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum
115
- * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.
116
- *
117
- * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].
118
- * 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
119
- * 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:
120
- *
121
- * ```ts
122
- * const builder = new UintArrayBuilder();
123
- * builder.append([1, 2, 254, 255]);
124
- * const array = builder.toTypedArray();
125
- * assert(array instanceof Uint8Array);
126
- * ```
127
- *
128
- * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:
129
- *
130
- * ```ts
131
- * const builder = new UintArrayBuilder();
132
- * builder.append([1, 255, 257, 65535]);
133
- * const array = builder.toTypedArray();
134
- * assert(array instanceof Uint16Array);
135
- * ```
136
- *
137
- * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.
138
- * @public
139
- */
140
- export declare class UintArrayBuilder extends TypedArrayBuilder<UintArray> {
141
- constructor(options?: UintArrayBuilderOptions);
142
- /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.
143
- * This may change as larger values are added to the array.
144
- */
145
- get bytesPerElement(): number;
146
- /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.
147
- * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.
148
- * This method is invoked by [[push]] and [[append]].
149
- */
150
- protected ensureBytesPerElement(newValues: Iterable<number>): void;
151
- /** See [[TypedArrayBuilder.push]]. */
152
- push(value: number): void;
153
- /** See [[TypedArrayBuilder.append]]. */
154
- append(values: UintArray): void;
155
- }
1
+ /** @packageDocumentation
2
+ * @module Collections
3
+ */
4
+ import { Constructor } from "./UtilityTypes";
5
+ /** Options used to construct a [[TypedArrayBuilder]].
6
+ * @public
7
+ */
8
+ export interface TypedArrayBuilderOptions {
9
+ /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.
10
+ * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.
11
+ * Default: 1.5
12
+ * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.
13
+ */
14
+ growthFactor?: number;
15
+ /** The number of elements to allocate memory for in the TypedArray when creating the builder.
16
+ * If you know the minimum number of elements you intend to add to the builder, you should specify that as the
17
+ * initial capacity to avoid reallocations when populating the array.
18
+ * Default: 0.
19
+ * Minimum: 0.
20
+ */
21
+ initialCapacity?: number;
22
+ }
23
+ /** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.
24
+ * @see [[UintArrayBuilder]] to construct such an array.
25
+ * @public
26
+ */
27
+ export type UintArray = Uint8Array | Uint16Array | Uint32Array;
28
+ /** 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.
29
+ * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.
30
+ * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.
31
+ *
32
+ * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two "size" properties":
33
+ * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and
34
+ * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].
35
+ * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.
36
+ *
37
+ * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].
38
+ * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.
39
+ * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.
40
+ * @public
41
+ */
42
+ export declare class TypedArrayBuilder<T extends UintArray> {
43
+ /** The constructor for the specific type of array being populated. */
44
+ protected _constructor: Constructor<T>;
45
+ /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
46
+ protected _data: T;
47
+ /** The number of elements added to the array so far. */
48
+ protected _length: number;
49
+ /** Multiplier applied to required capacity by [[ensureCapacity]]. */
50
+ readonly growthFactor: number;
51
+ /** Constructs a new builder from the specified options, with a [[length]] of zero. */
52
+ protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions);
53
+ /** The number of elements currently in the array. */
54
+ get length(): number;
55
+ /** The number of elements that can fit into the memory currently allocated for the array. */
56
+ get capacity(): number;
57
+ /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),
58
+ * returns the element at the specified index, with negative integers counting back from the end of the array.
59
+ * @note It is your responsibility to ensure the index falls within the bounds of the array.
60
+ */
61
+ at(index: number): number;
62
+ /** Ensure that [[capacity]] is at least equal to `newCapacity`.
63
+ * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.
64
+ * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.
65
+ *
66
+ * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.
67
+ * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.
68
+ * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.
69
+ */
70
+ ensureCapacity(newCapacity: number): number;
71
+ /** Append the specified value, resizing if necessary. */
72
+ push(value: number): void;
73
+ /** Append an array of values, resizing (at most once) if necessary. */
74
+ append(values: T): void;
75
+ /** Obtain the finished array.
76
+ * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the
77
+ * returned array's length will be equal to [[length]].
78
+ */
79
+ toTypedArray(includeUnusedCapacity?: boolean): T;
80
+ }
81
+ /** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
82
+ * @public
83
+ */
84
+ export declare class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {
85
+ /** See [[TypedArrayBuilder]] constructor. */
86
+ constructor(options?: TypedArrayBuilderOptions);
87
+ }
88
+ /** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).
89
+ * @public
90
+ */
91
+ export declare class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {
92
+ /** See [[TypedArrayBuilder]] constructor. */
93
+ constructor(options?: TypedArrayBuilderOptions);
94
+ }
95
+ /** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).
96
+ * @public
97
+ */
98
+ export declare class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {
99
+ /** See [[TypedArrayBuilder]] constructor. */
100
+ constructor(options?: TypedArrayBuilderOptions);
101
+ /** Obtain a view of the finished array as an array of bytes. */
102
+ toUint8Array(includeUnusedCapacity?: boolean): Uint8Array;
103
+ }
104
+ /** Options used to construct a [[UintArrayBuilder]].
105
+ * @public
106
+ */
107
+ export interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {
108
+ /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than
109
+ * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.
110
+ * Default: `Uint8Array`.
111
+ */
112
+ initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;
113
+ }
114
+ /** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum
115
+ * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.
116
+ *
117
+ * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].
118
+ * 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
119
+ * 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:
120
+ *
121
+ * ```ts
122
+ * const builder = new UintArrayBuilder();
123
+ * builder.append([1, 2, 254, 255]);
124
+ * const array = builder.toTypedArray();
125
+ * assert(array instanceof Uint8Array);
126
+ * ```
127
+ *
128
+ * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:
129
+ *
130
+ * ```ts
131
+ * const builder = new UintArrayBuilder();
132
+ * builder.append([1, 255, 257, 65535]);
133
+ * const array = builder.toTypedArray();
134
+ * assert(array instanceof Uint16Array);
135
+ * ```
136
+ *
137
+ * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.
138
+ * @public
139
+ */
140
+ export declare class UintArrayBuilder extends TypedArrayBuilder<UintArray> {
141
+ constructor(options?: UintArrayBuilderOptions);
142
+ /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.
143
+ * This may change as larger values are added to the array.
144
+ */
145
+ get bytesPerElement(): number;
146
+ /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.
147
+ * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.
148
+ * This method is invoked by [[push]] and [[append]].
149
+ */
150
+ protected ensureBytesPerElement(newValues: Iterable<number>): void;
151
+ /** See [[TypedArrayBuilder.push]]. */
152
+ push(value: number): void;
153
+ /** See [[TypedArrayBuilder.append]]. */
154
+ append(values: UintArray): void;
155
+ }
156
156
  //# sourceMappingURL=TypedArrayBuilder.d.ts.map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