@itwin/core-bentley 3.4.0-dev.50 → 3.4.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 (245) hide show
  1. package/lib/cjs/AccessToken.d.ts +8 -8
  2. package/lib/cjs/AccessToken.js +9 -9
  3. package/lib/cjs/AccessToken.js.map +1 -1
  4. package/lib/cjs/Assert.d.ts +25 -25
  5. package/lib/cjs/Assert.js +45 -45
  6. package/lib/cjs/Assert.js.map +1 -1
  7. package/lib/cjs/AsyncMutex.d.ts +26 -26
  8. package/lib/cjs/AsyncMutex.js +43 -43
  9. package/lib/cjs/AsyncMutex.js.map +1 -1
  10. package/lib/cjs/BeEvent.d.ts +81 -81
  11. package/lib/cjs/BeEvent.js +156 -156
  12. package/lib/cjs/BeEvent.js.map +1 -1
  13. package/lib/cjs/BeSQLite.d.ts +170 -170
  14. package/lib/cjs/BeSQLite.js +183 -183
  15. package/lib/cjs/BeSQLite.js.map +1 -1
  16. package/lib/cjs/BentleyError.d.ts +376 -376
  17. package/lib/cjs/BentleyError.js +699 -699
  18. package/lib/cjs/BentleyError.js.map +1 -1
  19. package/lib/cjs/BentleyLoggerCategory.d.ts +11 -11
  20. package/lib/cjs/BentleyLoggerCategory.js +19 -19
  21. package/lib/cjs/BentleyLoggerCategory.js.map +1 -1
  22. package/lib/cjs/ByteStream.d.ts +92 -92
  23. package/lib/cjs/ByteStream.d.ts.map +1 -1
  24. package/lib/cjs/ByteStream.js +133 -123
  25. package/lib/cjs/ByteStream.js.map +1 -1
  26. package/lib/cjs/ClassUtils.d.ts +14 -14
  27. package/lib/cjs/ClassUtils.js +27 -27
  28. package/lib/cjs/ClassUtils.js.map +1 -1
  29. package/lib/cjs/Compare.d.ts +47 -47
  30. package/lib/cjs/Compare.d.ts.map +1 -1
  31. package/lib/cjs/Compare.js +75 -63
  32. package/lib/cjs/Compare.js.map +1 -1
  33. package/lib/cjs/CompressedId64Set.d.ts +134 -134
  34. package/lib/cjs/CompressedId64Set.js +428 -428
  35. package/lib/cjs/CompressedId64Set.js.map +1 -1
  36. package/lib/cjs/Dictionary.d.ts +125 -125
  37. package/lib/cjs/Dictionary.d.ts.map +1 -1
  38. package/lib/cjs/Dictionary.js +203 -203
  39. package/lib/cjs/Dictionary.js.map +1 -1
  40. package/lib/cjs/Disposable.d.ts +80 -80
  41. package/lib/cjs/Disposable.js +120 -120
  42. package/lib/cjs/Disposable.js.map +1 -1
  43. package/lib/cjs/Id.d.ts +277 -277
  44. package/lib/cjs/Id.d.ts.map +1 -1
  45. package/lib/cjs/Id.js +629 -619
  46. package/lib/cjs/Id.js.map +1 -1
  47. package/lib/cjs/IndexMap.d.ts +65 -65
  48. package/lib/cjs/IndexMap.js +91 -91
  49. package/lib/cjs/IndexMap.js.map +1 -1
  50. package/lib/cjs/JsonSchema.d.ts +77 -77
  51. package/lib/cjs/JsonSchema.js +9 -9
  52. package/lib/cjs/JsonSchema.js.map +1 -1
  53. package/lib/cjs/JsonUtils.d.ts +78 -78
  54. package/lib/cjs/JsonUtils.d.ts.map +1 -1
  55. package/lib/cjs/JsonUtils.js +151 -133
  56. package/lib/cjs/JsonUtils.js.map +1 -1
  57. package/lib/cjs/LRUMap.d.ts +129 -129
  58. package/lib/cjs/LRUMap.d.ts.map +1 -1
  59. package/lib/cjs/LRUMap.js +333 -333
  60. package/lib/cjs/LRUMap.js.map +1 -1
  61. package/lib/cjs/Logger.d.ts +141 -141
  62. package/lib/cjs/Logger.js +254 -254
  63. package/lib/cjs/Logger.js.map +1 -1
  64. package/lib/cjs/ObservableSet.d.ts +23 -23
  65. package/lib/cjs/ObservableSet.js +51 -51
  66. package/lib/cjs/ObservableSet.js.map +1 -1
  67. package/lib/cjs/OneAtATimeAction.d.ts +31 -31
  68. package/lib/cjs/OneAtATimeAction.d.ts.map +1 -1
  69. package/lib/cjs/OneAtATimeAction.js +94 -91
  70. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  71. package/lib/cjs/OrderedId64Iterable.d.ts +74 -74
  72. package/lib/cjs/OrderedId64Iterable.js +235 -235
  73. package/lib/cjs/OrderedId64Iterable.js.map +1 -1
  74. package/lib/cjs/OrderedSet.d.ts +40 -40
  75. package/lib/cjs/OrderedSet.js +64 -64
  76. package/lib/cjs/OrderedSet.js.map +1 -1
  77. package/lib/cjs/PriorityQueue.d.ts +70 -70
  78. package/lib/cjs/PriorityQueue.js +140 -140
  79. package/lib/cjs/PriorityQueue.js.map +1 -1
  80. package/lib/cjs/ProcessDetector.d.ts +59 -59
  81. package/lib/cjs/ProcessDetector.js +71 -71
  82. package/lib/cjs/ProcessDetector.js.map +1 -1
  83. package/lib/cjs/SortedArray.d.ts +232 -232
  84. package/lib/cjs/SortedArray.d.ts.map +1 -1
  85. package/lib/cjs/SortedArray.js +303 -301
  86. package/lib/cjs/SortedArray.js.map +1 -1
  87. package/lib/cjs/StatusCategory.d.ts +30 -30
  88. package/lib/cjs/StatusCategory.js +460 -460
  89. package/lib/cjs/StatusCategory.js.map +1 -1
  90. package/lib/cjs/StringUtils.d.ts +22 -22
  91. package/lib/cjs/StringUtils.d.ts.map +1 -1
  92. package/lib/cjs/StringUtils.js +148 -146
  93. package/lib/cjs/StringUtils.js.map +1 -1
  94. package/lib/cjs/Time.d.ts +122 -122
  95. package/lib/cjs/Time.d.ts.map +1 -1
  96. package/lib/cjs/Time.js +152 -146
  97. package/lib/cjs/Time.js.map +1 -1
  98. package/lib/cjs/Tracing.d.ts +40 -40
  99. package/lib/cjs/Tracing.d.ts.map +1 -1
  100. package/lib/cjs/Tracing.js +130 -130
  101. package/lib/cjs/Tracing.js.map +1 -1
  102. package/lib/cjs/TypedArrayBuilder.d.ts +98 -0
  103. package/lib/cjs/TypedArrayBuilder.d.ts.map +1 -0
  104. package/lib/cjs/TypedArrayBuilder.js +135 -0
  105. package/lib/cjs/TypedArrayBuilder.js.map +1 -0
  106. package/lib/cjs/UnexpectedErrors.d.ts +43 -43
  107. package/lib/cjs/UnexpectedErrors.d.ts.map +1 -1
  108. package/lib/cjs/UnexpectedErrors.js +68 -65
  109. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  110. package/lib/cjs/UtilityTypes.d.ts +86 -86
  111. package/lib/cjs/UtilityTypes.js +26 -26
  112. package/lib/cjs/UtilityTypes.js.map +1 -1
  113. package/lib/cjs/YieldManager.d.ts +18 -18
  114. package/lib/cjs/YieldManager.js +34 -34
  115. package/lib/cjs/YieldManager.js.map +1 -1
  116. package/lib/cjs/core-bentley.d.ts +74 -73
  117. package/lib/cjs/core-bentley.d.ts.map +1 -1
  118. package/lib/cjs/core-bentley.js +90 -89
  119. package/lib/cjs/core-bentley.js.map +1 -1
  120. package/lib/cjs/partitionArray.d.ts +21 -21
  121. package/lib/cjs/partitionArray.js +43 -43
  122. package/lib/cjs/partitionArray.js.map +1 -1
  123. package/lib/esm/AccessToken.d.ts +8 -8
  124. package/lib/esm/AccessToken.js +8 -8
  125. package/lib/esm/AccessToken.js.map +1 -1
  126. package/lib/esm/Assert.d.ts +25 -25
  127. package/lib/esm/Assert.js +41 -41
  128. package/lib/esm/Assert.js.map +1 -1
  129. package/lib/esm/AsyncMutex.d.ts +26 -26
  130. package/lib/esm/AsyncMutex.js +39 -39
  131. package/lib/esm/AsyncMutex.js.map +1 -1
  132. package/lib/esm/BeEvent.d.ts +81 -81
  133. package/lib/esm/BeEvent.js +150 -150
  134. package/lib/esm/BeEvent.js.map +1 -1
  135. package/lib/esm/BeSQLite.d.ts +170 -170
  136. package/lib/esm/BeSQLite.js +180 -180
  137. package/lib/esm/BeSQLite.js.map +1 -1
  138. package/lib/esm/BentleyError.d.ts +376 -376
  139. package/lib/esm/BentleyError.js +695 -695
  140. package/lib/esm/BentleyError.js.map +1 -1
  141. package/lib/esm/BentleyLoggerCategory.d.ts +11 -11
  142. package/lib/esm/BentleyLoggerCategory.js +16 -16
  143. package/lib/esm/BentleyLoggerCategory.js.map +1 -1
  144. package/lib/esm/ByteStream.d.ts +92 -92
  145. package/lib/esm/ByteStream.d.ts.map +1 -1
  146. package/lib/esm/ByteStream.js +129 -119
  147. package/lib/esm/ByteStream.js.map +1 -1
  148. package/lib/esm/ClassUtils.d.ts +14 -14
  149. package/lib/esm/ClassUtils.js +22 -22
  150. package/lib/esm/ClassUtils.js.map +1 -1
  151. package/lib/esm/Compare.d.ts +47 -47
  152. package/lib/esm/Compare.d.ts.map +1 -1
  153. package/lib/esm/Compare.js +63 -51
  154. package/lib/esm/Compare.js.map +1 -1
  155. package/lib/esm/CompressedId64Set.d.ts +134 -134
  156. package/lib/esm/CompressedId64Set.js +423 -423
  157. package/lib/esm/CompressedId64Set.js.map +1 -1
  158. package/lib/esm/Dictionary.d.ts +125 -125
  159. package/lib/esm/Dictionary.d.ts.map +1 -1
  160. package/lib/esm/Dictionary.js +199 -199
  161. package/lib/esm/Dictionary.js.map +1 -1
  162. package/lib/esm/Disposable.d.ts +80 -80
  163. package/lib/esm/Disposable.js +112 -112
  164. package/lib/esm/Disposable.js.map +1 -1
  165. package/lib/esm/Id.d.ts +277 -277
  166. package/lib/esm/Id.d.ts.map +1 -1
  167. package/lib/esm/Id.js +625 -615
  168. package/lib/esm/Id.js.map +1 -1
  169. package/lib/esm/IndexMap.d.ts +65 -65
  170. package/lib/esm/IndexMap.js +86 -86
  171. package/lib/esm/IndexMap.js.map +1 -1
  172. package/lib/esm/JsonSchema.d.ts +77 -77
  173. package/lib/esm/JsonSchema.js +8 -8
  174. package/lib/esm/JsonSchema.js.map +1 -1
  175. package/lib/esm/JsonUtils.d.ts +78 -78
  176. package/lib/esm/JsonUtils.d.ts.map +1 -1
  177. package/lib/esm/JsonUtils.js +148 -130
  178. package/lib/esm/JsonUtils.js.map +1 -1
  179. package/lib/esm/LRUMap.d.ts +129 -129
  180. package/lib/esm/LRUMap.d.ts.map +1 -1
  181. package/lib/esm/LRUMap.js +326 -326
  182. package/lib/esm/LRUMap.js.map +1 -1
  183. package/lib/esm/Logger.d.ts +141 -141
  184. package/lib/esm/Logger.js +249 -249
  185. package/lib/esm/Logger.js.map +1 -1
  186. package/lib/esm/ObservableSet.d.ts +23 -23
  187. package/lib/esm/ObservableSet.js +47 -47
  188. package/lib/esm/ObservableSet.js.map +1 -1
  189. package/lib/esm/OneAtATimeAction.d.ts +31 -31
  190. package/lib/esm/OneAtATimeAction.d.ts.map +1 -1
  191. package/lib/esm/OneAtATimeAction.js +89 -86
  192. package/lib/esm/OneAtATimeAction.js.map +1 -1
  193. package/lib/esm/OrderedId64Iterable.d.ts +74 -74
  194. package/lib/esm/OrderedId64Iterable.js +232 -232
  195. package/lib/esm/OrderedId64Iterable.js.map +1 -1
  196. package/lib/esm/OrderedSet.d.ts +40 -40
  197. package/lib/esm/OrderedSet.js +59 -59
  198. package/lib/esm/OrderedSet.js.map +1 -1
  199. package/lib/esm/PriorityQueue.d.ts +70 -70
  200. package/lib/esm/PriorityQueue.js +136 -136
  201. package/lib/esm/PriorityQueue.js.map +1 -1
  202. package/lib/esm/ProcessDetector.d.ts +59 -59
  203. package/lib/esm/ProcessDetector.js +67 -67
  204. package/lib/esm/ProcessDetector.js.map +1 -1
  205. package/lib/esm/SortedArray.d.ts +232 -232
  206. package/lib/esm/SortedArray.d.ts.map +1 -1
  207. package/lib/esm/SortedArray.js +296 -294
  208. package/lib/esm/SortedArray.js.map +1 -1
  209. package/lib/esm/StatusCategory.d.ts +30 -30
  210. package/lib/esm/StatusCategory.js +454 -454
  211. package/lib/esm/StatusCategory.js.map +1 -1
  212. package/lib/esm/StringUtils.d.ts +22 -22
  213. package/lib/esm/StringUtils.d.ts.map +1 -1
  214. package/lib/esm/StringUtils.js +142 -140
  215. package/lib/esm/StringUtils.js.map +1 -1
  216. package/lib/esm/Time.d.ts +122 -122
  217. package/lib/esm/Time.d.ts.map +1 -1
  218. package/lib/esm/Time.js +146 -140
  219. package/lib/esm/Time.js.map +1 -1
  220. package/lib/esm/Tracing.d.ts +40 -40
  221. package/lib/esm/Tracing.d.ts.map +1 -1
  222. package/lib/esm/Tracing.js +126 -126
  223. package/lib/esm/Tracing.js.map +1 -1
  224. package/lib/esm/TypedArrayBuilder.d.ts +98 -0
  225. package/lib/esm/TypedArrayBuilder.d.ts.map +1 -0
  226. package/lib/esm/TypedArrayBuilder.js +128 -0
  227. package/lib/esm/TypedArrayBuilder.js.map +1 -0
  228. package/lib/esm/UnexpectedErrors.d.ts +43 -43
  229. package/lib/esm/UnexpectedErrors.d.ts.map +1 -1
  230. package/lib/esm/UnexpectedErrors.js +64 -61
  231. package/lib/esm/UnexpectedErrors.js.map +1 -1
  232. package/lib/esm/UtilityTypes.d.ts +86 -86
  233. package/lib/esm/UtilityTypes.js +21 -21
  234. package/lib/esm/UtilityTypes.js.map +1 -1
  235. package/lib/esm/YieldManager.d.ts +18 -18
  236. package/lib/esm/YieldManager.js +30 -30
  237. package/lib/esm/YieldManager.js.map +1 -1
  238. package/lib/esm/core-bentley.d.ts +74 -73
  239. package/lib/esm/core-bentley.d.ts.map +1 -1
  240. package/lib/esm/core-bentley.js +78 -77
  241. package/lib/esm/core-bentley.js.map +1 -1
  242. package/lib/esm/partitionArray.d.ts +21 -21
  243. package/lib/esm/partitionArray.js +39 -39
  244. package/lib/esm/partitionArray.js.map +1 -1
  245. package/package.json +4 -4
@@ -1,24 +1,24 @@
1
- /** @packageDocumentation
2
- * @module Collections
3
- */
4
- import { BeEvent } from "./BeEvent";
5
- /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
6
- * @public
7
- */
8
- export declare class ObservableSet<T> extends Set<T> {
9
- /** Emitted after `item` is added to this set. */
10
- readonly onAdded: BeEvent<(item: T) => void>;
11
- /** Emitted after `item` is deleted from this set. */
12
- readonly onDeleted: BeEvent<(item: T) => void>;
13
- /** Emitted after this set's contents are cleared. */
14
- readonly onCleared: BeEvent<() => void>;
15
- /** Construct a new ObservableSet.
16
- * @param elements Optional elements with which to populate the new set.
17
- */
18
- constructor(elements?: Iterable<T> | undefined);
19
- /** @internal */
20
- delete(item: T): boolean;
21
- /** @internal */
22
- clear(): void;
23
- }
1
+ /** @packageDocumentation
2
+ * @module Collections
3
+ */
4
+ import { BeEvent } from "./BeEvent";
5
+ /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
6
+ * @public
7
+ */
8
+ export declare class ObservableSet<T> extends Set<T> {
9
+ /** Emitted after `item` is added to this set. */
10
+ readonly onAdded: BeEvent<(item: T) => void>;
11
+ /** Emitted after `item` is deleted from this set. */
12
+ readonly onDeleted: BeEvent<(item: T) => void>;
13
+ /** Emitted after this set's contents are cleared. */
14
+ readonly onCleared: BeEvent<() => void>;
15
+ /** Construct a new ObservableSet.
16
+ * @param elements Optional elements with which to populate the new set.
17
+ */
18
+ constructor(elements?: Iterable<T> | undefined);
19
+ /** @internal */
20
+ delete(item: T): boolean;
21
+ /** @internal */
22
+ clear(): void;
23
+ }
24
24
  //# sourceMappingURL=ObservableSet.d.ts.map
@@ -1,52 +1,52 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Collections
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ObservableSet = void 0;
11
- const BeEvent_1 = require("./BeEvent");
12
- /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
13
- * @public
14
- */
15
- class ObservableSet extends Set {
16
- /** Construct a new ObservableSet.
17
- * @param elements Optional elements with which to populate the new set.
18
- */
19
- constructor(elements) {
20
- // NB: Set constructor will invoke add(). Do not override until initialized.
21
- super(elements);
22
- /** Emitted after `item` is added to this set. */
23
- this.onAdded = new BeEvent_1.BeEvent();
24
- /** Emitted after `item` is deleted from this set. */
25
- this.onDeleted = new BeEvent_1.BeEvent();
26
- /** Emitted after this set's contents are cleared. */
27
- this.onCleared = new BeEvent_1.BeEvent();
28
- this.add = (item) => {
29
- const prevSize = this.size;
30
- const ret = super.add(item);
31
- if (this.size !== prevSize)
32
- this.onAdded.raiseEvent(item);
33
- return ret;
34
- };
35
- }
36
- /** @internal */
37
- delete(item) {
38
- const ret = super.delete(item);
39
- if (ret)
40
- this.onDeleted.raiseEvent(item);
41
- return ret;
42
- }
43
- /** @internal */
44
- clear() {
45
- if (0 !== this.size) {
46
- super.clear();
47
- this.onCleared.raiseEvent();
48
- }
49
- }
50
- }
51
- exports.ObservableSet = ObservableSet;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Collections
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ObservableSet = void 0;
11
+ const BeEvent_1 = require("./BeEvent");
12
+ /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
13
+ * @public
14
+ */
15
+ class ObservableSet extends Set {
16
+ /** Construct a new ObservableSet.
17
+ * @param elements Optional elements with which to populate the new set.
18
+ */
19
+ constructor(elements) {
20
+ // NB: Set constructor will invoke add(). Do not override until initialized.
21
+ super(elements);
22
+ /** Emitted after `item` is added to this set. */
23
+ this.onAdded = new BeEvent_1.BeEvent();
24
+ /** Emitted after `item` is deleted from this set. */
25
+ this.onDeleted = new BeEvent_1.BeEvent();
26
+ /** Emitted after this set's contents are cleared. */
27
+ this.onCleared = new BeEvent_1.BeEvent();
28
+ this.add = (item) => {
29
+ const prevSize = this.size;
30
+ const ret = super.add(item);
31
+ if (this.size !== prevSize)
32
+ this.onAdded.raiseEvent(item);
33
+ return ret;
34
+ };
35
+ }
36
+ /** @internal */
37
+ delete(item) {
38
+ const ret = super.delete(item);
39
+ if (ret)
40
+ this.onDeleted.raiseEvent(item);
41
+ return ret;
42
+ }
43
+ /** @internal */
44
+ clear() {
45
+ if (0 !== this.size) {
46
+ super.clear();
47
+ this.onCleared.raiseEvent();
48
+ }
49
+ }
50
+ }
51
+ exports.ObservableSet = ObservableSet;
52
52
  //# sourceMappingURL=ObservableSet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableSet.js","sourceRoot":"","sources":["../../src/ObservableSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uCAAoC;AAEpC;;GAEG;AACH,MAAa,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAc,CAAC;QASpD,IAAI,CAAC,GAAG,GAAG,CAAC,IAAO,EAAE,EAAE;YACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACxB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;IACJ,CAAC;IAED,gBAAgB;IACA,MAAM,CAAC,IAAO;QAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG;YACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gBAAgB;IACA,KAAK;QACnB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;YACnB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;SAC7B;IACH,CAAC;CACF;AAzCD,sCAyCC","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 { BeEvent } from \"./BeEvent\";\r\n\r\n/** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.\r\n * @public\r\n */\r\nexport class ObservableSet<T> extends Set<T> {\r\n /** Emitted after `item` is added to this set. */\r\n public readonly onAdded = new BeEvent<(item: T) => void>();\r\n /** Emitted after `item` is deleted from this set. */\r\n public readonly onDeleted = new BeEvent<(item: T) => void>();\r\n /** Emitted after this set's contents are cleared. */\r\n public readonly onCleared = new BeEvent<() => void>();\r\n\r\n /** Construct a new ObservableSet.\r\n * @param elements Optional elements with which to populate the new set.\r\n */\r\n public constructor(elements?: Iterable<T> | undefined) {\r\n // NB: Set constructor will invoke add(). Do not override until initialized.\r\n super(elements);\r\n\r\n this.add = (item: T) => { // eslint-disable-line @typescript-eslint/unbound-method\r\n const prevSize = this.size;\r\n const ret = super.add(item);\r\n if (this.size !== prevSize)\r\n this.onAdded.raiseEvent(item);\r\n\r\n return ret;\r\n };\r\n }\r\n\r\n /** @internal */\r\n public override delete(item: T): boolean {\r\n const ret = super.delete(item);\r\n if (ret)\r\n this.onDeleted.raiseEvent(item);\r\n\r\n return ret;\r\n }\r\n\r\n /** @internal */\r\n public override clear(): void {\r\n if (0 !== this.size) {\r\n super.clear();\r\n this.onCleared.raiseEvent();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ObservableSet.js","sourceRoot":"","sources":["../../src/ObservableSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uCAAoC;AAEpC;;GAEG;AACH,MAAa,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAc,CAAC;QASpD,IAAI,CAAC,GAAG,GAAG,CAAC,IAAO,EAAE,EAAE;YACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACxB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;IACJ,CAAC;IAED,gBAAgB;IACA,MAAM,CAAC,IAAO;QAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG;YACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gBAAgB;IACA,KAAK;QACnB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;YACnB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;SAC7B;IACH,CAAC;CACF;AAzCD,sCAyCC","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 { BeEvent } from \"./BeEvent\";\n\n/** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.\n * @public\n */\nexport class ObservableSet<T> extends Set<T> {\n /** Emitted after `item` is added to this set. */\n public readonly onAdded = new BeEvent<(item: T) => void>();\n /** Emitted after `item` is deleted from this set. */\n public readonly onDeleted = new BeEvent<(item: T) => void>();\n /** Emitted after this set's contents are cleared. */\n public readonly onCleared = new BeEvent<() => void>();\n\n /** Construct a new ObservableSet.\n * @param elements Optional elements with which to populate the new set.\n */\n public constructor(elements?: Iterable<T> | undefined) {\n // NB: Set constructor will invoke add(). Do not override until initialized.\n super(elements);\n\n this.add = (item: T) => { // eslint-disable-line @typescript-eslint/unbound-method\n const prevSize = this.size;\n const ret = super.add(item);\n if (this.size !== prevSize)\n this.onAdded.raiseEvent(item);\n\n return ret;\n };\n }\n\n /** @internal */\n public override delete(item: T): boolean {\n const ret = super.delete(item);\n if (ret)\n this.onDeleted.raiseEvent(item);\n\n return ret;\n }\n\n /** @internal */\n public override clear(): void {\n if (0 !== this.size) {\n super.clear();\n this.onCleared.raiseEvent();\n }\n }\n}\n"]}
@@ -1,32 +1,32 @@
1
- /** @packageDocumentation
2
- * @module Utils
3
- */
4
- /** @beta */
5
- export declare class AbandonedError extends Error {
6
- }
7
- /**
8
- * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate
9
- * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP
10
- * request queue to grow such that the delay to service new requests is unbounded.
11
- *
12
- * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
13
- * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
14
- * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type
15
- * of operation, but the first and last request will always eventually complete.
16
- * @beta
17
- */
18
- export declare class OneAtATimeAction<T> {
19
- private _active?;
20
- private _pending?;
21
- private _run;
22
- msg: string;
23
- /** Ctor for OneAtATimePromise.
24
- * @param run The method that performs an action that creates the Promise.
25
- */
26
- constructor(run: (...args: any[]) => Promise<T>, msg?: string);
27
- /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
28
- * @note Callers of this method *must* handle AbandonedError rejections.
29
- */
30
- request(...args: any[]): Promise<T>;
31
- }
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
4
+ /** @beta */
5
+ export declare class AbandonedError extends Error {
6
+ }
7
+ /**
8
+ * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate
9
+ * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP
10
+ * request queue to grow such that the delay to service new requests is unbounded.
11
+ *
12
+ * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
13
+ * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
14
+ * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type
15
+ * of operation, but the first and last request will always eventually complete.
16
+ * @beta
17
+ */
18
+ export declare class OneAtATimeAction<T> {
19
+ private _active?;
20
+ private _pending?;
21
+ private _run;
22
+ msg: string;
23
+ /** Ctor for OneAtATimePromise.
24
+ * @param run The method that performs an action that creates the Promise.
25
+ */
26
+ constructor(run: (...args: any[]) => Promise<T>, msg?: string);
27
+ /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
28
+ * @note Callers of this method *must* handle AbandonedError rejections.
29
+ */
30
+ request(...args: any[]): Promise<T>;
31
+ }
32
32
  //# sourceMappingURL=OneAtATimeAction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OneAtATimeAction.d.ts","sourceRoot":"","sources":["../../src/OneAtATimeAction.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,YAAY;AACZ,qBAAa,cAAe,SAAQ,KAAK;CAAI;AAqC7C;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAwB;IACxC,OAAO,CAAC,QAAQ,CAAC,CAAwB;IACzC,OAAO,CAAC,IAAI,CAAiC;IACtC,GAAG,EAAE,MAAM,CAAC;IAEnB;;OAEG;gBACS,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,SAAc;IAElE;;OAEG;IACU,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;CAuBjD"}
1
+ {"version":3,"file":"OneAtATimeAction.d.ts","sourceRoot":"","sources":["../../src/OneAtATimeAction.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,YAAY;AACZ,qBAAa,cAAe,SAAQ,KAAK;CAAI;AAqC7C;;;;;;;;;;GAUG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAwB;IACxC,OAAO,CAAC,QAAQ,CAAC,CAAwB;IACzC,OAAO,CAAC,IAAI,CAAiC;IACtC,GAAG,EAAE,MAAM,CAAC;IAEnB;;OAEG;gBACS,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,SAAc;IAKlE;;OAEG;IACU,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;CAuBjD"}
@@ -1,92 +1,95 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Utils
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.OneAtATimeAction = exports.AbandonedError = void 0;
11
- const BentleyError_1 = require("./BentleyError");
12
- /** @beta */
13
- class AbandonedError extends Error {
14
- }
15
- exports.AbandonedError = AbandonedError;
16
- /**
17
- * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.
18
- * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that
19
- * creates the real Promise for the underlying action. Notice that to use this class there are really two
20
- * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.
21
- */
22
- class PromiseWithAbandon {
23
- /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.
24
- * @param _run The method that creates the underlying Promise.
25
- * @param _args An array of args to be passed to run when [[start]] is called.
26
- */
27
- constructor(_run, _args) {
28
- this._run = _run;
29
- this._args = _args;
30
- }
31
- /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */
32
- async init(msg) {
33
- return new Promise((resolve, reject) => {
34
- this.abandon = (message) => reject(new AbandonedError(message !== null && message !== void 0 ? message : msg));
35
- this._resolve = resolve;
36
- });
37
- }
38
- /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */
39
- async start() {
40
- try {
41
- this._resolve(await this._run(...this._args));
42
- }
43
- catch (err) {
44
- this.abandon(BentleyError_1.BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message
45
- }
46
- }
47
- }
48
- /**
49
- * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate
50
- * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP
51
- * request queue to grow such that the delay to service new requests is unbounded.
52
- *
53
- * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
54
- * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
55
- * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type
56
- * of operation, but the first and last request will always eventually complete.
57
- * @beta
58
- */
59
- class OneAtATimeAction {
60
- /** Ctor for OneAtATimePromise.
61
- * @param run The method that performs an action that creates the Promise.
62
- */
63
- constructor(run, msg = "abandoned") { this._run = run; this.msg = msg; }
64
- /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
65
- * @note Callers of this method *must* handle AbandonedError rejections.
66
- */
67
- async request(...args) {
68
- const entry = new PromiseWithAbandon(this._run, args); // create an "abandon-able promise" object
69
- const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.
70
- if (this._active !== undefined) { // is there an active request?
71
- if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned
72
- this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.
73
- this._pending = entry;
74
- }
75
- else {
76
- this._active = entry; // this is the first request, start it.
77
- entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
78
- }
79
- try {
80
- return await promise;
81
- }
82
- finally {
83
- // do all of this whether promise was fulfilled or rejected
84
- this._active = this._pending; // see if there's a pending request waiting
85
- this._pending = undefined; // clear pending
86
- if (this._active)
87
- this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
88
- }
89
- }
90
- }
91
- exports.OneAtATimeAction = OneAtATimeAction;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Utils
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.OneAtATimeAction = exports.AbandonedError = void 0;
11
+ const BentleyError_1 = require("./BentleyError");
12
+ /** @beta */
13
+ class AbandonedError extends Error {
14
+ }
15
+ exports.AbandonedError = AbandonedError;
16
+ /**
17
+ * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.
18
+ * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that
19
+ * creates the real Promise for the underlying action. Notice that to use this class there are really two
20
+ * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.
21
+ */
22
+ class PromiseWithAbandon {
23
+ /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.
24
+ * @param _run The method that creates the underlying Promise.
25
+ * @param _args An array of args to be passed to run when [[start]] is called.
26
+ */
27
+ constructor(_run, _args) {
28
+ this._run = _run;
29
+ this._args = _args;
30
+ }
31
+ /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */
32
+ async init(msg) {
33
+ return new Promise((resolve, reject) => {
34
+ this.abandon = (message) => reject(new AbandonedError(message !== null && message !== void 0 ? message : msg));
35
+ this._resolve = resolve;
36
+ });
37
+ }
38
+ /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */
39
+ async start() {
40
+ try {
41
+ this._resolve(await this._run(...this._args));
42
+ }
43
+ catch (err) {
44
+ this.abandon(BentleyError_1.BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message
45
+ }
46
+ }
47
+ }
48
+ /**
49
+ * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate
50
+ * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP
51
+ * request queue to grow such that the delay to service new requests is unbounded.
52
+ *
53
+ * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
54
+ * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
55
+ * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type
56
+ * of operation, but the first and last request will always eventually complete.
57
+ * @beta
58
+ */
59
+ class OneAtATimeAction {
60
+ /** Ctor for OneAtATimePromise.
61
+ * @param run The method that performs an action that creates the Promise.
62
+ */
63
+ constructor(run, msg = "abandoned") {
64
+ this._run = run;
65
+ this.msg = msg;
66
+ }
67
+ /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
68
+ * @note Callers of this method *must* handle AbandonedError rejections.
69
+ */
70
+ async request(...args) {
71
+ const entry = new PromiseWithAbandon(this._run, args); // create an "abandon-able promise" object
72
+ const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.
73
+ if (this._active !== undefined) { // is there an active request?
74
+ if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned
75
+ this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.
76
+ this._pending = entry;
77
+ }
78
+ else {
79
+ this._active = entry; // this is the first request, start it.
80
+ entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
81
+ }
82
+ try {
83
+ return await promise;
84
+ }
85
+ finally {
86
+ // do all of this whether promise was fulfilled or rejected
87
+ this._active = this._pending; // see if there's a pending request waiting
88
+ this._pending = undefined; // clear pending
89
+ if (this._active)
90
+ this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
91
+ }
92
+ }
93
+ }
94
+ exports.OneAtATimeAction = OneAtATimeAction;
92
95
  //# sourceMappingURL=OneAtATimeAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OneAtATimeAction.js","sourceRoot":"","sources":["../../src/OneAtATimeAction.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iDAA8C;AAE9C,YAAY;AACZ,MAAa,cAAe,SAAQ,KAAK;CAAI;AAA7C,wCAA6C;AAE7C;;;;;GAKG;AACH,MAAM,kBAAkB;IAKtB;;;OAGG;IACH,YAAoB,IAAoC,EAAU,KAAY;QAA1D,SAAI,GAAJ,IAAI,CAAgC;QAAU,UAAK,GAAL,KAAK,CAAO;IAAI,CAAC;IAEnF,0GAA0G;IACnG,KAAK,CAAC,IAAI,CAAC,GAAW;QAC3B,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,GAAG,CAAC,CAAC,CAAC;YAChF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oFAAoF;IAC7E,KAAK,CAAC,KAAK;QAChB,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC/C;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,2BAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,6EAA6E;SAC/H;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAa,gBAAgB;IAM3B;;OAEG;IACH,YAAY,GAAmC,EAAE,GAAG,GAAG,WAAW,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;IAExG;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,GAAG,IAAW;QACjC,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,0CAA0C;QACpG,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,8FAA8F;QAEpI,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,EAAE,8BAA8B;YAC9D,IAAI,IAAI,CAAC,QAAQ,EAAE,8FAA8F;gBAC/G,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,iEAAiE;YAC5F,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACvB;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,uCAAuC;YAC7D,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,8DAA8D;SAC9E;QAED,IAAI;YACF,OAAO,MAAM,OAAO,CAAC;SACtB;gBAAS;YACR,2DAA2D;YAC3D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,2CAA2C;YACzE,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,gBAAgB;YAC3C,IAAI,IAAI,CAAC,OAAO;gBACd,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,8DAA8D;SACvF;IACH,CAAC;CACF;AArCD,4CAqCC","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\nimport { BentleyError } from \"./BentleyError\";\r\n\r\n/** @beta */\r\nexport class AbandonedError extends Error { }\r\n\r\n/**\r\n * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.\r\n * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that\r\n * creates the real Promise for the underlying action. Notice that to use this class there are really two\r\n * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.\r\n */\r\nclass PromiseWithAbandon<T> {\r\n /** Method to abandon the Promise created by [[init]] while it is outstanding. The promise will be rejected. */\r\n public abandon!: (msg?: string) => void;\r\n private _resolve!: (val: any) => void;\r\n\r\n /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.\r\n * @param _run The method that creates the underlying Promise.\r\n * @param _args An array of args to be passed to run when [[start]] is called.\r\n */\r\n constructor(private _run: (...args: any[]) => Promise<T>, private _args: any[]) { }\r\n\r\n /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */\r\n public async init(msg: string): Promise<T> {\r\n return new Promise<T>((resolve, reject) => {\r\n this.abandon = (message?: string) => reject(new AbandonedError(message ?? msg));\r\n this._resolve = resolve;\r\n });\r\n }\r\n\r\n /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */\r\n public async start() {\r\n try {\r\n this._resolve(await this._run(...this._args));\r\n } catch (err) {\r\n this.abandon(BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate\r\n * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP\r\n * request queue to grow such that the delay to service new requests is unbounded.\r\n *\r\n * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent\r\n * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.\r\n * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type\r\n * of operation, but the first and last request will always eventually complete.\r\n * @beta\r\n */\r\nexport class OneAtATimeAction<T> {\r\n private _active?: PromiseWithAbandon<T>;\r\n private _pending?: PromiseWithAbandon<T>;\r\n private _run: (...args: any[]) => Promise<T>;\r\n public msg: string;\r\n\r\n /** Ctor for OneAtATimePromise.\r\n * @param run The method that performs an action that creates the Promise.\r\n */\r\n constructor(run: (...args: any[]) => Promise<T>, msg = \"abandoned\") { this._run = run; this.msg = msg; }\r\n\r\n /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.\r\n * @note Callers of this method *must* handle AbandonedError rejections.\r\n */\r\n public async request(...args: any[]): Promise<T> {\r\n const entry = new PromiseWithAbandon<T>(this._run, args); // create an \"abandon-able promise\" object\r\n const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.\r\n\r\n if (this._active !== undefined) { // is there an active request?\r\n if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned\r\n this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.\r\n this._pending = entry;\r\n } else {\r\n this._active = entry; // this is the first request, start it.\r\n entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n try {\r\n return await promise;\r\n } finally {\r\n // do all of this whether promise was fulfilled or rejected\r\n this._active = this._pending; // see if there's a pending request waiting\r\n this._pending = undefined; // clear pending\r\n if (this._active)\r\n this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"OneAtATimeAction.js","sourceRoot":"","sources":["../../src/OneAtATimeAction.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iDAA8C;AAE9C,YAAY;AACZ,MAAa,cAAe,SAAQ,KAAK;CAAI;AAA7C,wCAA6C;AAE7C;;;;;GAKG;AACH,MAAM,kBAAkB;IAKtB;;;OAGG;IACH,YAAoB,IAAoC,EAAU,KAAY;QAA1D,SAAI,GAAJ,IAAI,CAAgC;QAAU,UAAK,GAAL,KAAK,CAAO;IAAI,CAAC;IAEnF,0GAA0G;IACnG,KAAK,CAAC,IAAI,CAAC,GAAW;QAC3B,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,IAAI,CAAC,OAAO,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,GAAG,CAAC,CAAC,CAAC;YAChF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oFAAoF;IAC7E,KAAK,CAAC,KAAK;QAChB,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAC/C;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,2BAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,6EAA6E;SAC/H;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAa,gBAAgB;IAM3B;;OAEG;IACH,YAAY,GAAmC,EAAE,GAAG,GAAG,WAAW;QAChE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,GAAG,IAAW;QACjC,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAI,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,0CAA0C;QACpG,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,8FAA8F;QAEpI,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,EAAE,8BAA8B;YAC9D,IAAI,IAAI,CAAC,QAAQ,EAAE,8FAA8F;gBAC/G,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,iEAAiE;YAC5F,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACvB;aAAM;YACL,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,uCAAuC;YAC7D,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,8DAA8D;SAC9E;QAED,IAAI;YACF,OAAO,MAAM,OAAO,CAAC;SACtB;gBAAS;YACR,2DAA2D;YAC3D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,2CAA2C;YACzE,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,gBAAgB;YAC3C,IAAI,IAAI,CAAC,OAAO;gBACd,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,8DAA8D;SACvF;IACH,CAAC;CACF;AAxCD,4CAwCC","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\nimport { BentleyError } from \"./BentleyError\";\n\n/** @beta */\nexport class AbandonedError extends Error { }\n\n/**\n * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.\n * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that\n * creates the real Promise for the underlying action. Notice that to use this class there are really two\n * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.\n */\nclass PromiseWithAbandon<T> {\n /** Method to abandon the Promise created by [[init]] while it is outstanding. The promise will be rejected. */\n public abandon!: (msg?: string) => void;\n private _resolve!: (val: any) => void;\n\n /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.\n * @param _run The method that creates the underlying Promise.\n * @param _args An array of args to be passed to run when [[start]] is called.\n */\n constructor(private _run: (...args: any[]) => Promise<T>, private _args: any[]) { }\n\n /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */\n public async init(msg: string): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n this.abandon = (message?: string) => reject(new AbandonedError(message ?? msg));\n this._resolve = resolve;\n });\n }\n\n /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */\n public async start() {\n try {\n this._resolve(await this._run(...this._args));\n } catch (err) {\n this.abandon(BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message\n }\n }\n}\n\n/**\n * Orchestrator of a one-at-a-time activity. This concept is useful only for *replaceable* operations (that is, operations where subsequent requests replace and obviate\n * the need for previous requests. E.g. over slow HTTP connections, without this class, the stream of requests can overwhelm the connection, and cause the HTTP\n * request queue to grow such that the delay to service new requests is unbounded.\n *\n * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent\n * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.\n * When the active request completes, the pending request (if present) is started. In this manner there will only ever be one outstanding HTTP request for this type\n * of operation, but the first and last request will always eventually complete.\n * @beta\n */\nexport class OneAtATimeAction<T> {\n private _active?: PromiseWithAbandon<T>;\n private _pending?: PromiseWithAbandon<T>;\n private _run: (...args: any[]) => Promise<T>;\n public msg: string;\n\n /** Ctor for OneAtATimePromise.\n * @param run The method that performs an action that creates the Promise.\n */\n constructor(run: (...args: any[]) => Promise<T>, msg = \"abandoned\") {\n this._run = run;\n this.msg = msg;\n }\n\n /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.\n * @note Callers of this method *must* handle AbandonedError rejections.\n */\n public async request(...args: any[]): Promise<T> {\n const entry = new PromiseWithAbandon<T>(this._run, args); // create an \"abandon-able promise\" object\n const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.\n\n if (this._active !== undefined) { // is there an active request?\n if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned\n this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.\n this._pending = entry;\n } else {\n this._active = entry; // this is the first request, start it.\n entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n try {\n return await promise;\n } finally {\n // do all of this whether promise was fulfilled or rejected\n this._active = this._pending; // see if there's a pending request waiting\n this._pending = undefined; // clear pending\n if (this._active)\n this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n}\n"]}