@itwin/core-bentley 3.6.0-dev.60 → 3.6.0-dev.65

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 (220) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/lib/cjs/AccessToken.d.ts +10 -10
  3. package/lib/cjs/AccessToken.js +9 -9
  4. package/lib/cjs/AccessToken.js.map +1 -1
  5. package/lib/cjs/Assert.d.ts +25 -25
  6. package/lib/cjs/Assert.js +45 -45
  7. package/lib/cjs/Assert.js.map +1 -1
  8. package/lib/cjs/BeEvent.d.ts +81 -81
  9. package/lib/cjs/BeEvent.js +156 -156
  10. package/lib/cjs/BeEvent.js.map +1 -1
  11. package/lib/cjs/BeSQLite.d.ts +170 -170
  12. package/lib/cjs/BeSQLite.js +183 -183
  13. package/lib/cjs/BeSQLite.js.map +1 -1
  14. package/lib/cjs/BentleyError.d.ts +378 -378
  15. package/lib/cjs/BentleyError.js +702 -702
  16. package/lib/cjs/BentleyError.js.map +1 -1
  17. package/lib/cjs/BentleyLoggerCategory.d.ts +11 -11
  18. package/lib/cjs/BentleyLoggerCategory.js +19 -19
  19. package/lib/cjs/BentleyLoggerCategory.js.map +1 -1
  20. package/lib/cjs/ByteStream.d.ts +110 -110
  21. package/lib/cjs/ByteStream.js +159 -159
  22. package/lib/cjs/ByteStream.js.map +1 -1
  23. package/lib/cjs/ClassUtils.d.ts +14 -14
  24. package/lib/cjs/ClassUtils.js +27 -27
  25. package/lib/cjs/ClassUtils.js.map +1 -1
  26. package/lib/cjs/Compare.d.ts +47 -47
  27. package/lib/cjs/Compare.js +75 -75
  28. package/lib/cjs/Compare.js.map +1 -1
  29. package/lib/cjs/CompressedId64Set.d.ts +134 -134
  30. package/lib/cjs/CompressedId64Set.js +428 -428
  31. package/lib/cjs/CompressedId64Set.js.map +1 -1
  32. package/lib/cjs/Dictionary.d.ts +125 -125
  33. package/lib/cjs/Dictionary.js +203 -203
  34. package/lib/cjs/Dictionary.js.map +1 -1
  35. package/lib/cjs/Disposable.d.ts +80 -80
  36. package/lib/cjs/Disposable.js +120 -120
  37. package/lib/cjs/Disposable.js.map +1 -1
  38. package/lib/cjs/Id.d.ts +285 -281
  39. package/lib/cjs/Id.d.ts.map +1 -1
  40. package/lib/cjs/Id.js +643 -637
  41. package/lib/cjs/Id.js.map +1 -1
  42. package/lib/cjs/IndexMap.d.ts +65 -65
  43. package/lib/cjs/IndexMap.js +91 -91
  44. package/lib/cjs/IndexMap.js.map +1 -1
  45. package/lib/cjs/JsonSchema.d.ts +77 -77
  46. package/lib/cjs/JsonSchema.js +9 -9
  47. package/lib/cjs/JsonSchema.js.map +1 -1
  48. package/lib/cjs/JsonUtils.d.ts +78 -78
  49. package/lib/cjs/JsonUtils.js +151 -151
  50. package/lib/cjs/JsonUtils.js.map +1 -1
  51. package/lib/cjs/LRUMap.d.ts +129 -129
  52. package/lib/cjs/LRUMap.js +333 -333
  53. package/lib/cjs/LRUMap.js.map +1 -1
  54. package/lib/cjs/Logger.d.ts +143 -143
  55. package/lib/cjs/Logger.js +258 -258
  56. package/lib/cjs/Logger.js.map +1 -1
  57. package/lib/cjs/ObservableSet.d.ts +23 -23
  58. package/lib/cjs/ObservableSet.js +51 -51
  59. package/lib/cjs/ObservableSet.js.map +1 -1
  60. package/lib/cjs/OneAtATimeAction.d.ts +31 -31
  61. package/lib/cjs/OneAtATimeAction.js +94 -94
  62. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  63. package/lib/cjs/OrderedId64Iterable.d.ts +74 -74
  64. package/lib/cjs/OrderedId64Iterable.js +235 -235
  65. package/lib/cjs/OrderedId64Iterable.js.map +1 -1
  66. package/lib/cjs/OrderedSet.d.ts +40 -40
  67. package/lib/cjs/OrderedSet.js +64 -64
  68. package/lib/cjs/OrderedSet.js.map +1 -1
  69. package/lib/cjs/PriorityQueue.d.ts +70 -70
  70. package/lib/cjs/PriorityQueue.js +140 -140
  71. package/lib/cjs/PriorityQueue.js.map +1 -1
  72. package/lib/cjs/ProcessDetector.d.ts +59 -59
  73. package/lib/cjs/ProcessDetector.js +71 -71
  74. package/lib/cjs/ProcessDetector.js.map +1 -1
  75. package/lib/cjs/SortedArray.d.ts +232 -232
  76. package/lib/cjs/SortedArray.js +303 -303
  77. package/lib/cjs/SortedArray.js.map +1 -1
  78. package/lib/cjs/StatusCategory.d.ts +30 -30
  79. package/lib/cjs/StatusCategory.js +460 -460
  80. package/lib/cjs/StatusCategory.js.map +1 -1
  81. package/lib/cjs/StringUtils.d.ts +22 -22
  82. package/lib/cjs/StringUtils.js +148 -148
  83. package/lib/cjs/StringUtils.js.map +1 -1
  84. package/lib/cjs/Time.d.ts +122 -122
  85. package/lib/cjs/Time.js +152 -152
  86. package/lib/cjs/Time.js.map +1 -1
  87. package/lib/cjs/Tracing.d.ts +40 -40
  88. package/lib/cjs/Tracing.js +130 -130
  89. package/lib/cjs/Tracing.js.map +1 -1
  90. package/lib/cjs/TupleKeyedMap.d.ts +36 -36
  91. package/lib/cjs/TupleKeyedMap.js +102 -102
  92. package/lib/cjs/TupleKeyedMap.js.map +1 -1
  93. package/lib/cjs/TypedArrayBuilder.d.ts +155 -155
  94. package/lib/cjs/TypedArrayBuilder.js +208 -208
  95. package/lib/cjs/TypedArrayBuilder.js.map +1 -1
  96. package/lib/cjs/UnexpectedErrors.d.ts +43 -43
  97. package/lib/cjs/UnexpectedErrors.js +68 -68
  98. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  99. package/lib/cjs/UtilityTypes.d.ts +96 -96
  100. package/lib/cjs/UtilityTypes.js +40 -40
  101. package/lib/cjs/UtilityTypes.js.map +1 -1
  102. package/lib/cjs/YieldManager.d.ts +18 -18
  103. package/lib/cjs/YieldManager.js +34 -34
  104. package/lib/cjs/YieldManager.js.map +1 -1
  105. package/lib/cjs/core-bentley.d.ts +74 -74
  106. package/lib/cjs/core-bentley.js +90 -90
  107. package/lib/cjs/core-bentley.js.map +1 -1
  108. package/lib/cjs/partitionArray.d.ts +21 -21
  109. package/lib/cjs/partitionArray.js +43 -43
  110. package/lib/cjs/partitionArray.js.map +1 -1
  111. package/lib/esm/AccessToken.d.ts +10 -10
  112. package/lib/esm/AccessToken.js +8 -8
  113. package/lib/esm/AccessToken.js.map +1 -1
  114. package/lib/esm/Assert.d.ts +25 -25
  115. package/lib/esm/Assert.js +41 -41
  116. package/lib/esm/Assert.js.map +1 -1
  117. package/lib/esm/BeEvent.d.ts +81 -81
  118. package/lib/esm/BeEvent.js +150 -150
  119. package/lib/esm/BeEvent.js.map +1 -1
  120. package/lib/esm/BeSQLite.d.ts +170 -170
  121. package/lib/esm/BeSQLite.js +180 -180
  122. package/lib/esm/BeSQLite.js.map +1 -1
  123. package/lib/esm/BentleyError.d.ts +378 -378
  124. package/lib/esm/BentleyError.js +698 -698
  125. package/lib/esm/BentleyError.js.map +1 -1
  126. package/lib/esm/BentleyLoggerCategory.d.ts +11 -11
  127. package/lib/esm/BentleyLoggerCategory.js +16 -16
  128. package/lib/esm/BentleyLoggerCategory.js.map +1 -1
  129. package/lib/esm/ByteStream.d.ts +110 -110
  130. package/lib/esm/ByteStream.js +155 -155
  131. package/lib/esm/ByteStream.js.map +1 -1
  132. package/lib/esm/ClassUtils.d.ts +14 -14
  133. package/lib/esm/ClassUtils.js +22 -22
  134. package/lib/esm/ClassUtils.js.map +1 -1
  135. package/lib/esm/Compare.d.ts +47 -47
  136. package/lib/esm/Compare.js +63 -63
  137. package/lib/esm/Compare.js.map +1 -1
  138. package/lib/esm/CompressedId64Set.d.ts +134 -134
  139. package/lib/esm/CompressedId64Set.js +423 -423
  140. package/lib/esm/CompressedId64Set.js.map +1 -1
  141. package/lib/esm/Dictionary.d.ts +125 -125
  142. package/lib/esm/Dictionary.js +199 -199
  143. package/lib/esm/Dictionary.js.map +1 -1
  144. package/lib/esm/Disposable.d.ts +80 -80
  145. package/lib/esm/Disposable.js +112 -112
  146. package/lib/esm/Disposable.js.map +1 -1
  147. package/lib/esm/Id.d.ts +285 -281
  148. package/lib/esm/Id.d.ts.map +1 -1
  149. package/lib/esm/Id.js +639 -633
  150. package/lib/esm/Id.js.map +1 -1
  151. package/lib/esm/IndexMap.d.ts +65 -65
  152. package/lib/esm/IndexMap.js +86 -86
  153. package/lib/esm/IndexMap.js.map +1 -1
  154. package/lib/esm/JsonSchema.d.ts +77 -77
  155. package/lib/esm/JsonSchema.js +8 -8
  156. package/lib/esm/JsonSchema.js.map +1 -1
  157. package/lib/esm/JsonUtils.d.ts +78 -78
  158. package/lib/esm/JsonUtils.js +148 -148
  159. package/lib/esm/JsonUtils.js.map +1 -1
  160. package/lib/esm/LRUMap.d.ts +129 -129
  161. package/lib/esm/LRUMap.js +326 -326
  162. package/lib/esm/LRUMap.js.map +1 -1
  163. package/lib/esm/Logger.d.ts +143 -143
  164. package/lib/esm/Logger.js +253 -253
  165. package/lib/esm/Logger.js.map +1 -1
  166. package/lib/esm/ObservableSet.d.ts +23 -23
  167. package/lib/esm/ObservableSet.js +47 -47
  168. package/lib/esm/ObservableSet.js.map +1 -1
  169. package/lib/esm/OneAtATimeAction.d.ts +31 -31
  170. package/lib/esm/OneAtATimeAction.js +89 -89
  171. package/lib/esm/OneAtATimeAction.js.map +1 -1
  172. package/lib/esm/OrderedId64Iterable.d.ts +74 -74
  173. package/lib/esm/OrderedId64Iterable.js +232 -232
  174. package/lib/esm/OrderedId64Iterable.js.map +1 -1
  175. package/lib/esm/OrderedSet.d.ts +40 -40
  176. package/lib/esm/OrderedSet.js +59 -59
  177. package/lib/esm/OrderedSet.js.map +1 -1
  178. package/lib/esm/PriorityQueue.d.ts +70 -70
  179. package/lib/esm/PriorityQueue.js +136 -136
  180. package/lib/esm/PriorityQueue.js.map +1 -1
  181. package/lib/esm/ProcessDetector.d.ts +59 -59
  182. package/lib/esm/ProcessDetector.js +67 -67
  183. package/lib/esm/ProcessDetector.js.map +1 -1
  184. package/lib/esm/SortedArray.d.ts +232 -232
  185. package/lib/esm/SortedArray.js +296 -296
  186. package/lib/esm/SortedArray.js.map +1 -1
  187. package/lib/esm/StatusCategory.d.ts +30 -30
  188. package/lib/esm/StatusCategory.js +454 -454
  189. package/lib/esm/StatusCategory.js.map +1 -1
  190. package/lib/esm/StringUtils.d.ts +22 -22
  191. package/lib/esm/StringUtils.js +142 -142
  192. package/lib/esm/StringUtils.js.map +1 -1
  193. package/lib/esm/Time.d.ts +122 -122
  194. package/lib/esm/Time.js +146 -146
  195. package/lib/esm/Time.js.map +1 -1
  196. package/lib/esm/Tracing.d.ts +40 -40
  197. package/lib/esm/Tracing.js +126 -126
  198. package/lib/esm/Tracing.js.map +1 -1
  199. package/lib/esm/TupleKeyedMap.d.ts +36 -36
  200. package/lib/esm/TupleKeyedMap.js +98 -98
  201. package/lib/esm/TupleKeyedMap.js.map +1 -1
  202. package/lib/esm/TypedArrayBuilder.d.ts +155 -155
  203. package/lib/esm/TypedArrayBuilder.js +200 -200
  204. package/lib/esm/TypedArrayBuilder.js.map +1 -1
  205. package/lib/esm/UnexpectedErrors.d.ts +43 -43
  206. package/lib/esm/UnexpectedErrors.js +64 -64
  207. package/lib/esm/UnexpectedErrors.js.map +1 -1
  208. package/lib/esm/UtilityTypes.d.ts +96 -96
  209. package/lib/esm/UtilityTypes.js +34 -34
  210. package/lib/esm/UtilityTypes.js.map +1 -1
  211. package/lib/esm/YieldManager.d.ts +18 -18
  212. package/lib/esm/YieldManager.js +30 -30
  213. package/lib/esm/YieldManager.js.map +1 -1
  214. package/lib/esm/core-bentley.d.ts +74 -74
  215. package/lib/esm/core-bentley.js +78 -78
  216. package/lib/esm/core-bentley.js.map +1 -1
  217. package/lib/esm/partitionArray.d.ts +21 -21
  218. package/lib/esm/partitionArray.js +39 -39
  219. package/lib/esm/partitionArray.js.map +1 -1
  220. package/package.json +3 -3
@@ -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,48 +1,48 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Collections
7
- */
8
- import { BeEvent } from "./BeEvent";
9
- /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
10
- * @public
11
- */
12
- export class ObservableSet extends Set {
13
- /** Construct a new ObservableSet.
14
- * @param elements Optional elements with which to populate the new set.
15
- */
16
- constructor(elements) {
17
- // NB: Set constructor will invoke add(). Do not override until initialized.
18
- super(elements);
19
- /** Emitted after `item` is added to this set. */
20
- this.onAdded = new BeEvent();
21
- /** Emitted after `item` is deleted from this set. */
22
- this.onDeleted = new BeEvent();
23
- /** Emitted after this set's contents are cleared. */
24
- this.onCleared = new BeEvent();
25
- this.add = (item) => {
26
- const prevSize = this.size;
27
- const ret = super.add(item);
28
- if (this.size !== prevSize)
29
- this.onAdded.raiseEvent(item);
30
- return ret;
31
- };
32
- }
33
- /** @internal */
34
- delete(item) {
35
- const ret = super.delete(item);
36
- if (ret)
37
- this.onDeleted.raiseEvent(item);
38
- return ret;
39
- }
40
- /** @internal */
41
- clear() {
42
- if (0 !== this.size) {
43
- super.clear();
44
- this.onCleared.raiseEvent();
45
- }
46
- }
47
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Collections
7
+ */
8
+ import { BeEvent } from "./BeEvent";
9
+ /** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.
10
+ * @public
11
+ */
12
+ export class ObservableSet extends Set {
13
+ /** Construct a new ObservableSet.
14
+ * @param elements Optional elements with which to populate the new set.
15
+ */
16
+ constructor(elements) {
17
+ // NB: Set constructor will invoke add(). Do not override until initialized.
18
+ super(elements);
19
+ /** Emitted after `item` is added to this set. */
20
+ this.onAdded = new BeEvent();
21
+ /** Emitted after `item` is deleted from this set. */
22
+ this.onDeleted = new BeEvent();
23
+ /** Emitted after this set's contents are cleared. */
24
+ this.onCleared = new BeEvent();
25
+ this.add = (item) => {
26
+ const prevSize = this.size;
27
+ const ret = super.add(item);
28
+ if (this.size !== prevSize)
29
+ this.onAdded.raiseEvent(item);
30
+ return ret;
31
+ };
32
+ }
33
+ /** @internal */
34
+ delete(item) {
35
+ const ret = super.delete(item);
36
+ if (ret)
37
+ this.onDeleted.raiseEvent(item);
38
+ return ret;
39
+ }
40
+ /** @internal */
41
+ clear() {
42
+ if (0 !== this.size) {
43
+ super.clear();
44
+ this.onCleared.raiseEvent();
45
+ }
46
+ }
47
+ }
48
48
  //# 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,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,OAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,OAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,OAAO,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","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,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,OAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,OAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,OAAO,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","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,90 +1,90 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Utils
7
- */
8
- import { BentleyError } from "./BentleyError";
9
- /** @beta */
10
- export class AbandonedError extends Error {
11
- }
12
- /**
13
- * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.
14
- * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that
15
- * creates the real Promise for the underlying action. Notice that to use this class there are really two
16
- * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.
17
- */
18
- class PromiseWithAbandon {
19
- /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.
20
- * @param _run The method that creates the underlying Promise.
21
- * @param _args An array of args to be passed to run when [[start]] is called.
22
- */
23
- constructor(_run, _args) {
24
- this._run = _run;
25
- this._args = _args;
26
- }
27
- /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */
28
- async init(msg) {
29
- return new Promise((resolve, reject) => {
30
- this.abandon = (message) => reject(new AbandonedError(message !== null && message !== void 0 ? message : msg));
31
- this._resolve = resolve;
32
- });
33
- }
34
- /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */
35
- async start() {
36
- try {
37
- this._resolve(await this._run(...this._args));
38
- }
39
- catch (err) {
40
- this.abandon(BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message
41
- }
42
- }
43
- }
44
- /**
45
- * 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
46
- * 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
47
- * request queue to grow such that the delay to service new requests is unbounded.
48
- *
49
- * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
50
- * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
51
- * 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
52
- * of operation, but the first and last request will always eventually complete.
53
- * @beta
54
- */
55
- export class OneAtATimeAction {
56
- /** Ctor for OneAtATimePromise.
57
- * @param run The method that performs an action that creates the Promise.
58
- */
59
- constructor(run, msg = "abandoned") {
60
- this._run = run;
61
- this.msg = msg;
62
- }
63
- /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
64
- * @note Callers of this method *must* handle AbandonedError rejections.
65
- */
66
- async request(...args) {
67
- const entry = new PromiseWithAbandon(this._run, args); // create an "abandon-able promise" object
68
- const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.
69
- if (this._active !== undefined) { // is there an active request?
70
- if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned
71
- this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.
72
- this._pending = entry;
73
- }
74
- else {
75
- this._active = entry; // this is the first request, start it.
76
- entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
77
- }
78
- try {
79
- return await promise;
80
- }
81
- finally {
82
- // do all of this whether promise was fulfilled or rejected
83
- this._active = this._pending; // see if there's a pending request waiting
84
- this._pending = undefined; // clear pending
85
- if (this._active)
86
- this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
87
- }
88
- }
89
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Utils
7
+ */
8
+ import { BentleyError } from "./BentleyError";
9
+ /** @beta */
10
+ export class AbandonedError extends Error {
11
+ }
12
+ /**
13
+ * An object that returns a Promise when you call [[init]], but supplies a way to abandon the promise if it is no longer relevant.
14
+ * When you call abandon, the promise will be rejected. You must supply a [[run]] method to the constructor that
15
+ * creates the real Promise for the underlying action. Notice that to use this class there are really two
16
+ * Promises involved that are chained together. That makes this class less efficient than just using a Promise directly.
17
+ */
18
+ class PromiseWithAbandon {
19
+ /** Create a PromiseWithAbandon. After this call you must call [[init]] to create the underlying Promise.
20
+ * @param _run The method that creates the underlying Promise.
21
+ * @param _args An array of args to be passed to run when [[start]] is called.
22
+ */
23
+ constructor(_run, _args) {
24
+ this._run = _run;
25
+ this._args = _args;
26
+ }
27
+ /** Create a Promise that is chained to the underlying Promise, but is connected to the abandon method. */
28
+ async init(msg) {
29
+ return new Promise((resolve, reject) => {
30
+ this.abandon = (message) => reject(new AbandonedError(message !== null && message !== void 0 ? message : msg));
31
+ this._resolve = resolve;
32
+ });
33
+ }
34
+ /** Call the [[run]] method supplied to the ctor to start the underlying Promise. */
35
+ async start() {
36
+ try {
37
+ this._resolve(await this._run(...this._args));
38
+ }
39
+ catch (err) {
40
+ this.abandon(BentleyError.getErrorMessage(err)); // turn all errors from execution into abandoned errors, but keep the message
41
+ }
42
+ }
43
+ }
44
+ /**
45
+ * 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
46
+ * 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
47
+ * request queue to grow such that the delay to service new requests is unbounded.
48
+ *
49
+ * With this class, we issue the initial request immediately. When the second request arrives before the first one completes, it becomes *pending*. If subsequent
50
+ * requests arrive with a pending request, the current pending request is *abandoned* (its Promise is rejected) and the new request becomes pending.
51
+ * 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
52
+ * of operation, but the first and last request will always eventually complete.
53
+ * @beta
54
+ */
55
+ export class OneAtATimeAction {
56
+ /** Ctor for OneAtATimePromise.
57
+ * @param run The method that performs an action that creates the Promise.
58
+ */
59
+ constructor(run, msg = "abandoned") {
60
+ this._run = run;
61
+ this.msg = msg;
62
+ }
63
+ /** Add a new request to this OneAtATimePromise. The request will only run when no other outstanding requests are active.
64
+ * @note Callers of this method *must* handle AbandonedError rejections.
65
+ */
66
+ async request(...args) {
67
+ const entry = new PromiseWithAbandon(this._run, args); // create an "abandon-able promise" object
68
+ const promise = entry.init(this.msg); // create the Promise from PromiseWithAbandon. Note: this must be called before we call start.
69
+ if (this._active !== undefined) { // is there an active request?
70
+ if (this._pending) // yes. If there is also a pending request, this one replaces it and previous one is abandoned
71
+ this._pending.abandon(); // rejects previous call to this method, throwing AbandonedError.
72
+ this._pending = entry;
73
+ }
74
+ else {
75
+ this._active = entry; // this is the first request, start it.
76
+ entry.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
77
+ }
78
+ try {
79
+ return await promise;
80
+ }
81
+ finally {
82
+ // do all of this whether promise was fulfilled or rejected
83
+ this._active = this._pending; // see if there's a pending request waiting
84
+ this._pending = undefined; // clear pending
85
+ if (this._active)
86
+ this._active.start(); // eslint-disable-line @typescript-eslint/no-floating-promises
87
+ }
88
+ }
89
+ }
90
90
  //# 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,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY;AACZ,MAAM,OAAO,cAAe,SAAQ,KAAK;CAAI;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,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,6EAA6E;SAC/H;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,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","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\") {\r\n this._run = run;\r\n this.msg = msg;\r\n }\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,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY;AACZ,MAAM,OAAO,cAAe,SAAQ,KAAK;CAAI;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,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,6EAA6E;SAC/H;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,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","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"]}
@@ -1,75 +1,75 @@
1
- /** @packageDocumentation
2
- * @module Ids
3
- */
4
- import { CompressedId64Set } from "./CompressedId64Set";
5
- import { Id64Array, Id64String } from "./Id";
6
- /** @public */
7
- export declare type OrderedId64Iterable = Iterable<Id64String>;
8
- /** A collection of **valid** [[Id64String]]s sorted in ascending order by the unsigned 64-bit integer value of the Ids.
9
- * This ordering is a requirement for several groups of APIs including [[CompressedId64Set]].
10
- * When used as input to a function, duplicate Ids are ignored; when returned as a function output, no duplicates are present.
11
- * @see [[CompressedId64Set]] for a compact string representation of such an ordered collection.
12
- * @see [[OrderedId64Iterable.compare]] for a function that compares Ids based on this criterion.
13
- * @see [[OrderedId64Array]] for a mutable implementation.
14
- * @public
15
- */
16
- export declare namespace OrderedId64Iterable {
17
- /** An ordered comparison of [[Id64String]]s suitable for use with sorting routines like
18
- * [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) and sorted containers
19
- * like [[SortedArray]] and [[Dictionary]]. The comparison compares the 64-bit numerical values of the two Ids, returning a negative number if lhs < rhs,
20
- * a positive number if lhs > rhs, or zero if lhs == rhs.
21
- * The default string comparison is fine (and more efficient) when numerical ordering is not required; use this instead if you want e.g., "0x100" to be greater than "0xf".
22
- * @see [[OrderedId64Iterable.sortArray]] for a convenient way to sort an array of Id64Strings.
23
- */
24
- function compare(lhs: Id64String, rhs: Id64String): number;
25
- /** Sort an array of [[Id64String]]s **in-place** in ascending order by their 64-bit numerical values.
26
- * @see [[OrderedId64Iterable.compare]] for the comparison routine used.
27
- * @returns the input array.
28
- * @note This function returns its input for consistency with Javascript's
29
- * [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method.
30
- * It **does not** create a **new** array.
31
- */
32
- function sortArray(ids: Id64Array): Id64Array;
33
- /** Given two ordered collections of [[Id64String]]s, determine whether they are identical sets. Duplicate Ids are ignored.
34
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
35
- */
36
- function areEqualSets(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): boolean;
37
- /** Given an ordered collection of [[Id64String]]s, determine if it contains any Ids.
38
- * @param ids A well-formed, ordered collection of zero or more valid Ids.
39
- * @returns true if the input represents an empty set of Ids. The result is unspecified if the input does not meet the criteria for the input type.
40
- */
41
- function isEmptySet(ids: OrderedId64Iterable | CompressedId64Set): boolean;
42
- /** Given an ordered collection of [[Id64String]]s possibly containing duplicates, produce an ordered collection containing no duplicates.
43
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
44
- */
45
- function unique(ids: OrderedId64Iterable): OrderedId64Iterable;
46
- /** Given an ordered collection of [[Id64String]]s possibly containing duplicates, produce an ordered iterator over the distinct Ids, eliminating duplicates.
47
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
48
- */
49
- function uniqueIterator(ids: OrderedId64Iterable): Generator<string, void, unknown>;
50
- /** Given two ordered collections of [[Id64String]]s, produce a collection representing their union - i.e., the Ids that are present in either or both collections.
51
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
52
- */
53
- function union(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
54
- /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their intersection - i.e., the Ids that are present in both collections.
55
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
56
- */
57
- function intersection(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
58
- /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their difference - i.e., the Ids that are present in `ids1` but not present in `ids2`.
59
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
60
- */
61
- function difference(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
62
- /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their union - i.e., the Ids that are present in either or both collections.
63
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
64
- */
65
- function unionIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
66
- /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their intersection - i.e., the Ids that are present in both collections.
67
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
68
- */
69
- function intersectionIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
70
- /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their difference - i.e., the Ids that are present in `ids1` but not present in `ids2`.
71
- * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
72
- */
73
- function differenceIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
74
- }
1
+ /** @packageDocumentation
2
+ * @module Ids
3
+ */
4
+ import { CompressedId64Set } from "./CompressedId64Set";
5
+ import { Id64Array, Id64String } from "./Id";
6
+ /** @public */
7
+ export declare type OrderedId64Iterable = Iterable<Id64String>;
8
+ /** A collection of **valid** [[Id64String]]s sorted in ascending order by the unsigned 64-bit integer value of the Ids.
9
+ * This ordering is a requirement for several groups of APIs including [[CompressedId64Set]].
10
+ * When used as input to a function, duplicate Ids are ignored; when returned as a function output, no duplicates are present.
11
+ * @see [[CompressedId64Set]] for a compact string representation of such an ordered collection.
12
+ * @see [[OrderedId64Iterable.compare]] for a function that compares Ids based on this criterion.
13
+ * @see [[OrderedId64Array]] for a mutable implementation.
14
+ * @public
15
+ */
16
+ export declare namespace OrderedId64Iterable {
17
+ /** An ordered comparison of [[Id64String]]s suitable for use with sorting routines like
18
+ * [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) and sorted containers
19
+ * like [[SortedArray]] and [[Dictionary]]. The comparison compares the 64-bit numerical values of the two Ids, returning a negative number if lhs < rhs,
20
+ * a positive number if lhs > rhs, or zero if lhs == rhs.
21
+ * The default string comparison is fine (and more efficient) when numerical ordering is not required; use this instead if you want e.g., "0x100" to be greater than "0xf".
22
+ * @see [[OrderedId64Iterable.sortArray]] for a convenient way to sort an array of Id64Strings.
23
+ */
24
+ function compare(lhs: Id64String, rhs: Id64String): number;
25
+ /** Sort an array of [[Id64String]]s **in-place** in ascending order by their 64-bit numerical values.
26
+ * @see [[OrderedId64Iterable.compare]] for the comparison routine used.
27
+ * @returns the input array.
28
+ * @note This function returns its input for consistency with Javascript's
29
+ * [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) method.
30
+ * It **does not** create a **new** array.
31
+ */
32
+ function sortArray(ids: Id64Array): Id64Array;
33
+ /** Given two ordered collections of [[Id64String]]s, determine whether they are identical sets. Duplicate Ids are ignored.
34
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
35
+ */
36
+ function areEqualSets(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): boolean;
37
+ /** Given an ordered collection of [[Id64String]]s, determine if it contains any Ids.
38
+ * @param ids A well-formed, ordered collection of zero or more valid Ids.
39
+ * @returns true if the input represents an empty set of Ids. The result is unspecified if the input does not meet the criteria for the input type.
40
+ */
41
+ function isEmptySet(ids: OrderedId64Iterable | CompressedId64Set): boolean;
42
+ /** Given an ordered collection of [[Id64String]]s possibly containing duplicates, produce an ordered collection containing no duplicates.
43
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
44
+ */
45
+ function unique(ids: OrderedId64Iterable): OrderedId64Iterable;
46
+ /** Given an ordered collection of [[Id64String]]s possibly containing duplicates, produce an ordered iterator over the distinct Ids, eliminating duplicates.
47
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
48
+ */
49
+ function uniqueIterator(ids: OrderedId64Iterable): Generator<string, void, unknown>;
50
+ /** Given two ordered collections of [[Id64String]]s, produce a collection representing their union - i.e., the Ids that are present in either or both collections.
51
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
52
+ */
53
+ function union(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
54
+ /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their intersection - i.e., the Ids that are present in both collections.
55
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
56
+ */
57
+ function intersection(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
58
+ /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their difference - i.e., the Ids that are present in `ids1` but not present in `ids2`.
59
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
60
+ */
61
+ function difference(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): OrderedId64Iterable;
62
+ /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their union - i.e., the Ids that are present in either or both collections.
63
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
64
+ */
65
+ function unionIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
66
+ /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their intersection - i.e., the Ids that are present in both collections.
67
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
68
+ */
69
+ function intersectionIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
70
+ /** Given two ordered collections of [[Id64String]]s, produce an iterator representing their difference - i.e., the Ids that are present in `ids1` but not present in `ids2`.
71
+ * @note If the inputs are not ordered as required by [[OrderedId64Iterable]], the results are unpredictable.
72
+ */
73
+ function differenceIterator(ids1: OrderedId64Iterable, ids2: OrderedId64Iterable): Generator<string, void, unknown>;
74
+ }
75
75
  //# sourceMappingURL=OrderedId64Iterable.d.ts.map