@itwin/core-bentley 4.1.0-dev.6 → 4.1.0-dev.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,56 @@
1
1
  # Change Log - @itwin/core-bentley
2
2
 
3
- This log was last generated on Tue, 25 Apr 2023 17:50:35 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 03 Jul 2023 15:28:41 GMT and should not be manually modified.
4
+
5
+ ## 4.0.3
6
+ Mon, 03 Jul 2023 15:28:41 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.0.2
11
+ Wed, 21 Jun 2023 22:04:43 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.0.1
16
+ Wed, 21 Jun 2023 20:29:13 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.0.0
21
+ Mon, 22 May 2023 15:34:14 GMT
22
+
23
+ ### Updates
24
+
25
+ - added PickMethods utility type
26
+ - Update to eslint@8
27
+ - Added DataTransformRequired flag to DbResult enum.
28
+ - Add RequireAtLeastOne utility type.
29
+
30
+ ## 3.7.9
31
+ Tue, 20 Jun 2023 12:51:02 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 3.7.8
36
+ Thu, 01 Jun 2023 17:00:39 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 3.7.7
41
+ Wed, 24 May 2023 17:27:09 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 3.7.6
46
+ Mon, 15 May 2023 18:23:40 GMT
47
+
48
+ _Version update only_
49
+
50
+ ## 3.7.5
51
+ Thu, 04 May 2023 19:43:18 GMT
52
+
53
+ _Version update only_
4
54
 
5
55
  ## 3.7.4
6
56
  Tue, 25 Apr 2023 17:50:35 GMT
@@ -1,15 +1,20 @@
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
1
4
  /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
2
- * @internal
3
5
  * @param subclass the class that may be a subclass of `superclass`
4
6
  * @param superclass the class that may be a base class of `subclass`
7
+ * @note The constructors of all types must be `public`.
5
8
  * @returns whether `subclass` is a proper subclass of `superclass`
9
+ * @public
6
10
  */
7
11
  export declare function isProperSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass;
8
12
  /** Check if class `subclass` is `superclass` or extends from `superclass`
9
- * @internal
10
- * @param subclass the class that may be a subclass of `superclass`
11
- * @param superclass the class that may be a base class of `subclass`
13
+ * @param subclass the class that may be a subclass of `superclass`.
14
+ * @param superclass the class that may be a base class of `subclass`.
15
+ * @note The constructors of all types must be `public`.
12
16
  * @returns whether `subclass` is a subclass of `superclass`
17
+ * @public
13
18
  */
14
19
  export declare function isSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass;
15
20
  //# sourceMappingURL=ClassUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassUtils.d.ts","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,GAAG,UAAU,CAE1G"}
1
+ {"version":3,"file":"ClassUtils.d.ts","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,GAAG,UAAU,CAE1G"}
@@ -3,23 +3,28 @@
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Utils
8
+ */
6
9
  Object.defineProperty(exports, "__esModule", { value: true });
7
10
  exports.isSubclassOf = exports.isProperSubclassOf = void 0;
8
11
  /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
9
- * @internal
10
12
  * @param subclass the class that may be a subclass of `superclass`
11
13
  * @param superclass the class that may be a base class of `subclass`
14
+ * @note The constructors of all types must be `public`.
12
15
  * @returns whether `subclass` is a proper subclass of `superclass`
16
+ * @public
13
17
  */
14
18
  function isProperSubclassOf(subclass, superclass) {
15
19
  return subclass.prototype instanceof superclass;
16
20
  }
17
21
  exports.isProperSubclassOf = isProperSubclassOf;
18
22
  /** Check if class `subclass` is `superclass` or extends from `superclass`
19
- * @internal
20
- * @param subclass the class that may be a subclass of `superclass`
21
- * @param superclass the class that may be a base class of `subclass`
23
+ * @param subclass the class that may be a subclass of `superclass`.
24
+ * @param superclass the class that may be a base class of `subclass`.
25
+ * @note The constructors of all types must be `public`.
22
26
  * @returns whether `subclass` is a subclass of `superclass`
27
+ * @public
23
28
  */
24
29
  function isSubclassOf(subclass, superclass) {
25
30
  return subclass === superclass || isProperSubclassOf(subclass, superclass);
@@ -1 +1 @@
1
- {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;;;;GAKG;AACH,SAAgB,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAND,gDAMC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAND,oCAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a proper subclass of `superclass`\r\n */\r\nexport function isProperSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\r\n return subclass.prototype instanceof superclass;\r\n}\r\n\r\n/** Check if class `subclass` is `superclass` or extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a subclass of `superclass`\r\n */\r\nexport function isSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\r\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\r\n}\r\n"]}
1
+ {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAND,gDAMC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAND,oCAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @note The constructors of all types must be `public`.\r\n * @returns whether `subclass` is a proper subclass of `superclass`\r\n * @public\r\n */\r\nexport function isProperSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\r\n return subclass.prototype instanceof superclass;\r\n}\r\n\r\n/** Check if class `subclass` is `superclass` or extends from `superclass`\r\n * @param subclass the class that may be a subclass of `superclass`.\r\n * @param superclass the class that may be a base class of `subclass`.\r\n * @note The constructors of all types must be `public`.\r\n * @returns whether `subclass` is a subclass of `superclass`\r\n * @public\r\n */\r\nexport function isSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\r\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\r\n}\r\n"]}
@@ -1,19 +1,34 @@
1
- /** @internal options for constructing yield managers */
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
4
+ /** Options supplied to a [[YieldManager]].
5
+ * @public
6
+ */
2
7
  export interface YieldManagerOptions {
8
+ /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.
9
+ * Default: 1000.
10
+ */
3
11
  iterationsBeforeYield?: number;
4
12
  }
5
- /**
6
- * @internal
7
- * An object allowing code to optionally yield with some frequency.
8
- * useful in some intense loops that make processes unresponsive.
9
- * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140
10
- * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000
13
+ /** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.
14
+ * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).
15
+ * It maintains a count of the number of iterations that have occurred since the last yield.
16
+ * The constructor specifies how many iterations of the loop are permitted before yielding.
17
+ * The loop should `await` [[allowYield]] on each iteration.
18
+ * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.
19
+ * @public
11
20
  */
12
21
  export declare class YieldManager {
13
- options: Readonly<Required<YieldManagerOptions>>;
22
+ /** Options controlling the yield behavior. */
23
+ readonly options: Readonly<Required<YieldManagerOptions>>;
14
24
  private _counter;
25
+ /** Constructor.
26
+ * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
27
+ */
15
28
  constructor(options?: YieldManagerOptions);
29
+ /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
16
30
  allowYield(): Promise<void>;
31
+ /** @internal */
17
32
  protected actualYield(): Promise<void>;
18
33
  }
19
34
  //# sourceMappingURL=YieldManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"YieldManager.d.ts","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAKA,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAOD;;;;;;GAMG;AACH,qBAAa,YAAY;IAChB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,QAAQ,CAAK;gBAEF,OAAO,GAAE,mBAAwB;IAIvC,UAAU;cAOP,WAAW;CAG5B"}
1
+ {"version":3,"file":"YieldManager.d.ts","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAMD;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,8CAA8C;IAC9C,SAAgB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAK;IAErB;;OAEG;gBACgB,OAAO,GAAE,mBAAwB;IAIpD,oIAAoI;IACvH,UAAU;IAOvB,gBAAgB;cACA,WAAW;CAG5B"}
@@ -3,30 +3,38 @@
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Utils
8
+ */
6
9
  Object.defineProperty(exports, "__esModule", { value: true });
7
10
  exports.YieldManager = void 0;
8
- /** @internal the default options when constructing yield managers */
9
11
  const defaultYieldManagerOptions = {
10
12
  iterationsBeforeYield: 1000,
11
13
  };
12
- /**
13
- * @internal
14
- * An object allowing code to optionally yield with some frequency.
15
- * useful in some intense loops that make processes unresponsive.
16
- * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140
17
- * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000
14
+ /** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.
15
+ * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).
16
+ * It maintains a count of the number of iterations that have occurred since the last yield.
17
+ * The constructor specifies how many iterations of the loop are permitted before yielding.
18
+ * The loop should `await` [[allowYield]] on each iteration.
19
+ * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.
20
+ * @public
18
21
  */
19
22
  class YieldManager {
23
+ /** Constructor.
24
+ * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
25
+ */
20
26
  constructor(options = {}) {
21
27
  this._counter = 0;
22
28
  this.options = { ...defaultYieldManagerOptions, ...options };
23
29
  }
30
+ /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
24
31
  async allowYield() {
25
32
  this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;
26
33
  if (this._counter === 0) {
27
34
  await this.actualYield();
28
35
  }
29
36
  }
37
+ /** @internal */
30
38
  async actualYield() {
31
39
  await new Promise((r) => setTimeout(r, 0));
32
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,qEAAqE;AACrE,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAa,YAAY;IAIvB,YAAmB,UAA+B,EAAE;QAF5C,aAAQ,GAAG,CAAC,CAAC;QAGnB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;SAC1B;IACH,CAAC;IAES,KAAK,CAAC,WAAW;QACzB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAlBD,oCAkBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @internal options for constructing yield managers */\r\nexport interface YieldManagerOptions {\r\n iterationsBeforeYield?: number;\r\n}\r\n\r\n/** @internal the default options when constructing yield managers */\r\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\r\n iterationsBeforeYield: 1000,\r\n};\r\n\r\n/**\r\n * @internal\r\n * An object allowing code to optionally yield with some frequency.\r\n * useful in some intense loops that make processes unresponsive.\r\n * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140\r\n * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000\r\n */\r\nexport class YieldManager {\r\n public options: Readonly<Required<YieldManagerOptions>>;\r\n private _counter = 0;\r\n\r\n public constructor(options: YieldManagerOptions = {}) {\r\n this.options = { ...defaultYieldManagerOptions, ...options };\r\n }\r\n\r\n public async allowYield() {\r\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\r\n if (this._counter === 0) {\r\n await this.actualYield();\r\n }\r\n }\r\n\r\n protected async actualYield() {\r\n await new Promise((r) => setTimeout(r, 0));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAa,YAAY;IAKvB;;OAEG;IACH,YAAmB,UAA+B,EAAE;QAL5C,aAAQ,GAAG,CAAC,CAAC;QAMnB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAED,oIAAoI;IAC7H,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;SAC1B;IACH,CAAC;IAED,gBAAgB;IACN,KAAK,CAAC,WAAW;QACzB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAxBD,oCAwBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Options supplied to a [[YieldManager]].\r\n * @public\r\n */\r\nexport interface YieldManagerOptions {\r\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\r\n * Default: 1000.\r\n */\r\n iterationsBeforeYield?: number;\r\n}\r\n\r\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\r\n iterationsBeforeYield: 1000,\r\n};\r\n\r\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\r\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\r\n * It maintains a count of the number of iterations that have occurred since the last yield.\r\n * The constructor specifies how many iterations of the loop are permitted before yielding.\r\n * The loop should `await` [[allowYield]] on each iteration.\r\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\r\n * @public\r\n */\r\nexport class YieldManager {\r\n /** Options controlling the yield behavior. */\r\n public readonly options: Readonly<Required<YieldManagerOptions>>;\r\n private _counter = 0;\r\n\r\n /** Constructor.\r\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\r\n */\r\n public constructor(options: YieldManagerOptions = {}) {\r\n this.options = { ...defaultYieldManagerOptions, ...options };\r\n }\r\n\r\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\r\n public async allowYield() {\r\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\r\n if (this._counter === 0) {\r\n await this.actualYield();\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected async actualYield() {\r\n await new Promise((r) => setTimeout(r, 0));\r\n }\r\n}\r\n"]}
@@ -1,15 +1,20 @@
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
1
4
  /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
2
- * @internal
3
5
  * @param subclass the class that may be a subclass of `superclass`
4
6
  * @param superclass the class that may be a base class of `subclass`
7
+ * @note The constructors of all types must be `public`.
5
8
  * @returns whether `subclass` is a proper subclass of `superclass`
9
+ * @public
6
10
  */
7
11
  export declare function isProperSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass;
8
12
  /** Check if class `subclass` is `superclass` or extends from `superclass`
9
- * @internal
10
- * @param subclass the class that may be a subclass of `superclass`
11
- * @param superclass the class that may be a base class of `subclass`
13
+ * @param subclass the class that may be a subclass of `superclass`.
14
+ * @param superclass the class that may be a base class of `subclass`.
15
+ * @note The constructors of all types must be `public`.
12
16
  * @returns whether `subclass` is a subclass of `superclass`
17
+ * @public
13
18
  */
14
19
  export declare function isSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass;
15
20
  //# sourceMappingURL=ClassUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassUtils.d.ts","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,GAAG,UAAU,CAE1G"}
1
+ {"version":3,"file":"ClassUtils.d.ts","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC3C,WAAW,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,EAC5C,QAAQ,SAAS,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,YAAY,CAAC,UAAU,CAAC,EAC9D,QAAQ,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,QAAQ,IAAI,QAAQ,GAAG,UAAU,CAE1G"}
@@ -2,20 +2,25 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Utils
7
+ */
5
8
  /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
6
- * @internal
7
9
  * @param subclass the class that may be a subclass of `superclass`
8
10
  * @param superclass the class that may be a base class of `subclass`
11
+ * @note The constructors of all types must be `public`.
9
12
  * @returns whether `subclass` is a proper subclass of `superclass`
13
+ * @public
10
14
  */
11
15
  export function isProperSubclassOf(subclass, superclass) {
12
16
  return subclass.prototype instanceof superclass;
13
17
  }
14
18
  /** Check if class `subclass` is `superclass` or extends from `superclass`
15
- * @internal
16
- * @param subclass the class that may be a subclass of `superclass`
17
- * @param superclass the class that may be a base class of `subclass`
19
+ * @param subclass the class that may be a subclass of `superclass`.
20
+ * @param superclass the class that may be a base class of `subclass`.
21
+ * @note The constructors of all types must be `public`.
18
22
  * @returns whether `subclass` is a subclass of `superclass`
23
+ * @public
19
24
  */
20
25
  export function isSubclassOf(subclass, superclass) {
21
26
  return subclass === superclass || isProperSubclassOf(subclass, superclass);
@@ -1 +1 @@
1
- {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a proper subclass of `superclass`\r\n */\r\nexport function isProperSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\r\n return subclass.prototype instanceof superclass;\r\n}\r\n\r\n/** Check if class `subclass` is `superclass` or extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a subclass of `superclass`\r\n */\r\nexport function isSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\r\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\r\n}\r\n"]}
1
+ {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @note The constructors of all types must be `public`.\r\n * @returns whether `subclass` is a proper subclass of `superclass`\r\n * @public\r\n */\r\nexport function isProperSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\r\n return subclass.prototype instanceof superclass;\r\n}\r\n\r\n/** Check if class `subclass` is `superclass` or extends from `superclass`\r\n * @param subclass the class that may be a subclass of `superclass`.\r\n * @param superclass the class that may be a base class of `subclass`.\r\n * @note The constructors of all types must be `public`.\r\n * @returns whether `subclass` is a subclass of `superclass`\r\n * @public\r\n */\r\nexport function isSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\r\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\r\n}\r\n"]}
@@ -1,19 +1,34 @@
1
- /** @internal options for constructing yield managers */
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
4
+ /** Options supplied to a [[YieldManager]].
5
+ * @public
6
+ */
2
7
  export interface YieldManagerOptions {
8
+ /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.
9
+ * Default: 1000.
10
+ */
3
11
  iterationsBeforeYield?: number;
4
12
  }
5
- /**
6
- * @internal
7
- * An object allowing code to optionally yield with some frequency.
8
- * useful in some intense loops that make processes unresponsive.
9
- * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140
10
- * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000
13
+ /** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.
14
+ * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).
15
+ * It maintains a count of the number of iterations that have occurred since the last yield.
16
+ * The constructor specifies how many iterations of the loop are permitted before yielding.
17
+ * The loop should `await` [[allowYield]] on each iteration.
18
+ * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.
19
+ * @public
11
20
  */
12
21
  export declare class YieldManager {
13
- options: Readonly<Required<YieldManagerOptions>>;
22
+ /** Options controlling the yield behavior. */
23
+ readonly options: Readonly<Required<YieldManagerOptions>>;
14
24
  private _counter;
25
+ /** Constructor.
26
+ * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
27
+ */
15
28
  constructor(options?: YieldManagerOptions);
29
+ /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
16
30
  allowYield(): Promise<void>;
31
+ /** @internal */
17
32
  protected actualYield(): Promise<void>;
18
33
  }
19
34
  //# sourceMappingURL=YieldManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"YieldManager.d.ts","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAKA,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAOD;;;;;;GAMG;AACH,qBAAa,YAAY;IAChB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,QAAQ,CAAK;gBAEF,OAAO,GAAE,mBAAwB;IAIvC,UAAU;cAOP,WAAW;CAG5B"}
1
+ {"version":3,"file":"YieldManager.d.ts","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAMD;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,8CAA8C;IAC9C,SAAgB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAK;IAErB;;OAEG;gBACgB,OAAO,GAAE,mBAAwB;IAIpD,oIAAoI;IACvH,UAAU;IAOvB,gBAAgB;cACA,WAAW;CAG5B"}
@@ -2,28 +2,36 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- /** @internal the default options when constructing yield managers */
5
+ /** @packageDocumentation
6
+ * @module Utils
7
+ */
6
8
  const defaultYieldManagerOptions = {
7
9
  iterationsBeforeYield: 1000,
8
10
  };
9
- /**
10
- * @internal
11
- * An object allowing code to optionally yield with some frequency.
12
- * useful in some intense loops that make processes unresponsive.
13
- * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140
14
- * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000
11
+ /** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.
12
+ * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).
13
+ * It maintains a count of the number of iterations that have occurred since the last yield.
14
+ * The constructor specifies how many iterations of the loop are permitted before yielding.
15
+ * The loop should `await` [[allowYield]] on each iteration.
16
+ * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.
17
+ * @public
15
18
  */
16
19
  export class YieldManager {
20
+ /** Constructor.
21
+ * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
22
+ */
17
23
  constructor(options = {}) {
18
24
  this._counter = 0;
19
25
  this.options = { ...defaultYieldManagerOptions, ...options };
20
26
  }
27
+ /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
21
28
  async allowYield() {
22
29
  this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;
23
30
  if (this._counter === 0) {
24
31
  await this.actualYield();
25
32
  }
26
33
  }
34
+ /** @internal */
27
35
  async actualYield() {
28
36
  await new Promise((r) => setTimeout(r, 0));
29
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,qEAAqE;AACrE,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IAIvB,YAAmB,UAA+B,EAAE;QAF5C,aAAQ,GAAG,CAAC,CAAC;QAGnB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;SAC1B;IACH,CAAC;IAES,KAAK,CAAC,WAAW;QACzB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,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\r\n/** @internal options for constructing yield managers */\r\nexport interface YieldManagerOptions {\r\n iterationsBeforeYield?: number;\r\n}\r\n\r\n/** @internal the default options when constructing yield managers */\r\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\r\n iterationsBeforeYield: 1000,\r\n};\r\n\r\n/**\r\n * @internal\r\n * An object allowing code to optionally yield with some frequency.\r\n * useful in some intense loops that make processes unresponsive.\r\n * primarily a workaround for: https://github.com/nodejs/node-addon-api/issues/1140\r\n * @note see [[defaultYieldManagerOptions]], the default amount of times it must be called to cause an actual yield is 1000\r\n */\r\nexport class YieldManager {\r\n public options: Readonly<Required<YieldManagerOptions>>;\r\n private _counter = 0;\r\n\r\n public constructor(options: YieldManagerOptions = {}) {\r\n this.options = { ...defaultYieldManagerOptions, ...options };\r\n }\r\n\r\n public async allowYield() {\r\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\r\n if (this._counter === 0) {\r\n await this.actualYield();\r\n }\r\n }\r\n\r\n protected async actualYield() {\r\n await new Promise((r) => setTimeout(r, 0));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IAKvB;;OAEG;IACH,YAAmB,UAA+B,EAAE;QAL5C,aAAQ,GAAG,CAAC,CAAC;QAMnB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAED,oIAAoI;IAC7H,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;SAC1B;IACH,CAAC;IAED,gBAAgB;IACN,KAAK,CAAC,WAAW;QACzB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,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\n/** Options supplied to a [[YieldManager]].\r\n * @public\r\n */\r\nexport interface YieldManagerOptions {\r\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\r\n * Default: 1000.\r\n */\r\n iterationsBeforeYield?: number;\r\n}\r\n\r\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\r\n iterationsBeforeYield: 1000,\r\n};\r\n\r\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\r\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\r\n * It maintains a count of the number of iterations that have occurred since the last yield.\r\n * The constructor specifies how many iterations of the loop are permitted before yielding.\r\n * The loop should `await` [[allowYield]] on each iteration.\r\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\r\n * @public\r\n */\r\nexport class YieldManager {\r\n /** Options controlling the yield behavior. */\r\n public readonly options: Readonly<Required<YieldManagerOptions>>;\r\n private _counter = 0;\r\n\r\n /** Constructor.\r\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\r\n */\r\n public constructor(options: YieldManagerOptions = {}) {\r\n this.options = { ...defaultYieldManagerOptions, ...options };\r\n }\r\n\r\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\r\n public async allowYield() {\r\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\r\n if (this._counter === 0) {\r\n await this.actualYield();\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected async actualYield() {\r\n await new Promise((r) => setTimeout(r, 0));\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-bentley",
3
- "version": "4.1.0-dev.6",
3
+ "version": "4.1.0-dev.63",
4
4
  "description": "Bentley JavaScript core components",
5
5
  "main": "lib/cjs/core-bentley.js",
6
6
  "module": "lib/esm/core-bentley.js",
@@ -22,12 +22,12 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "devDependencies": {
25
- "@itwin/eslint-plugin": "^4.0.0-dev.33",
25
+ "@itwin/eslint-plugin": "4.0.0-dev.36",
26
26
  "@opentelemetry/api": "1.0.4",
27
27
  "@types/chai": "4.3.1",
28
28
  "@types/chai-as-promised": "^7",
29
29
  "@types/mocha": "^8.2.2",
30
- "@types/node": "^18.11.5",
30
+ "@types/node": "18.16.1",
31
31
  "chai": "^4.1.2",
32
32
  "chai-as-promised": "^7",
33
33
  "eslint": "^8.36.0",
@@ -35,7 +35,7 @@
35
35
  "nyc": "^15.1.0",
36
36
  "rimraf": "^3.0.2",
37
37
  "typescript": "~5.0.2",
38
- "@itwin/build-tools": "4.1.0-dev.6"
38
+ "@itwin/build-tools": "4.1.0-dev.63"
39
39
  },
40
40
  "nyc": {
41
41
  "extends": "./node_modules/@itwin/build-tools/.nycrc"