@itwin/core-bentley 5.0.0-dev.8 → 5.0.0-dev.83

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 (134) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/lib/cjs/BeEvent.js +3 -7
  3. package/lib/cjs/BeEvent.js.map +1 -1
  4. package/lib/cjs/BentleyError.d.ts +3 -0
  5. package/lib/cjs/BentleyError.d.ts.map +1 -1
  6. package/lib/cjs/BentleyError.js +6 -1
  7. package/lib/cjs/BentleyError.js.map +1 -1
  8. package/lib/cjs/ByteStream.d.ts +3 -22
  9. package/lib/cjs/ByteStream.d.ts.map +1 -1
  10. package/lib/cjs/ByteStream.js +7 -21
  11. package/lib/cjs/ByteStream.js.map +1 -1
  12. package/lib/cjs/Compare.d.ts +15 -0
  13. package/lib/cjs/Compare.d.ts.map +1 -1
  14. package/lib/cjs/Compare.js +48 -0
  15. package/lib/cjs/Compare.js.map +1 -1
  16. package/lib/cjs/CompressedId64Set.js +6 -3
  17. package/lib/cjs/CompressedId64Set.js.map +1 -1
  18. package/lib/cjs/Dictionary.js +8 -3
  19. package/lib/cjs/Dictionary.js.map +1 -1
  20. package/lib/cjs/Disposable.d.ts +18 -0
  21. package/lib/cjs/Disposable.d.ts.map +1 -1
  22. package/lib/cjs/Disposable.js +25 -25
  23. package/lib/cjs/Disposable.js.map +1 -1
  24. package/lib/cjs/Id.d.ts +0 -4
  25. package/lib/cjs/Id.d.ts.map +1 -1
  26. package/lib/cjs/Id.js +9 -11
  27. package/lib/cjs/Id.js.map +1 -1
  28. package/lib/cjs/IndexMap.js +6 -1
  29. package/lib/cjs/IndexMap.js.map +1 -1
  30. package/lib/cjs/LRUMap.js +16 -0
  31. package/lib/cjs/LRUMap.js.map +1 -1
  32. package/lib/cjs/Logger.d.ts +24 -2
  33. package/lib/cjs/Logger.d.ts.map +1 -1
  34. package/lib/cjs/Logger.js +26 -7
  35. package/lib/cjs/Logger.js.map +1 -1
  36. package/lib/cjs/ObservableSet.js +6 -6
  37. package/lib/cjs/ObservableSet.js.map +1 -1
  38. package/lib/cjs/OneAtATimeAction.js +9 -0
  39. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  40. package/lib/cjs/OrderedSet.js +1 -0
  41. package/lib/cjs/OrderedSet.js.map +1 -1
  42. package/lib/cjs/PriorityQueue.js +3 -1
  43. package/lib/cjs/PriorityQueue.js.map +1 -1
  44. package/lib/cjs/SortedArray.js +4 -1
  45. package/lib/cjs/SortedArray.js.map +1 -1
  46. package/lib/cjs/StatusCategory.js +42 -105
  47. package/lib/cjs/StatusCategory.js.map +1 -1
  48. package/lib/cjs/Time.js +5 -0
  49. package/lib/cjs/Time.js.map +1 -1
  50. package/lib/cjs/Tracing.js +2 -0
  51. package/lib/cjs/Tracing.js.map +1 -1
  52. package/lib/cjs/TupleKeyedMap.js +2 -2
  53. package/lib/cjs/TupleKeyedMap.js.map +1 -1
  54. package/lib/cjs/TypedArrayBuilder.js +8 -0
  55. package/lib/cjs/TypedArrayBuilder.js.map +1 -1
  56. package/lib/cjs/UnexpectedErrors.js +10 -12
  57. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  58. package/lib/cjs/YieldManager.js +3 -1
  59. package/lib/cjs/YieldManager.js.map +1 -1
  60. package/lib/cjs/internal/cross-package.d.ts +0 -1
  61. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  62. package/lib/cjs/internal/cross-package.js +1 -3
  63. package/lib/cjs/internal/cross-package.js.map +1 -1
  64. package/lib/esm/BeEvent.js +3 -7
  65. package/lib/esm/BeEvent.js.map +1 -1
  66. package/lib/esm/BentleyError.d.ts +3 -0
  67. package/lib/esm/BentleyError.d.ts.map +1 -1
  68. package/lib/esm/BentleyError.js +6 -1
  69. package/lib/esm/BentleyError.js.map +1 -1
  70. package/lib/esm/ByteStream.d.ts +3 -22
  71. package/lib/esm/ByteStream.d.ts.map +1 -1
  72. package/lib/esm/ByteStream.js +7 -21
  73. package/lib/esm/ByteStream.js.map +1 -1
  74. package/lib/esm/Compare.d.ts +15 -0
  75. package/lib/esm/Compare.d.ts.map +1 -1
  76. package/lib/esm/Compare.js +46 -0
  77. package/lib/esm/Compare.js.map +1 -1
  78. package/lib/esm/CompressedId64Set.js +6 -3
  79. package/lib/esm/CompressedId64Set.js.map +1 -1
  80. package/lib/esm/Dictionary.js +8 -3
  81. package/lib/esm/Dictionary.js.map +1 -1
  82. package/lib/esm/Disposable.d.ts +18 -0
  83. package/lib/esm/Disposable.d.ts.map +1 -1
  84. package/lib/esm/Disposable.js +24 -25
  85. package/lib/esm/Disposable.js.map +1 -1
  86. package/lib/esm/Id.d.ts +0 -4
  87. package/lib/esm/Id.d.ts.map +1 -1
  88. package/lib/esm/Id.js +9 -11
  89. package/lib/esm/Id.js.map +1 -1
  90. package/lib/esm/IndexMap.js +6 -1
  91. package/lib/esm/IndexMap.js.map +1 -1
  92. package/lib/esm/LRUMap.js +16 -0
  93. package/lib/esm/LRUMap.js.map +1 -1
  94. package/lib/esm/Logger.d.ts +24 -2
  95. package/lib/esm/Logger.d.ts.map +1 -1
  96. package/lib/esm/Logger.js +26 -7
  97. package/lib/esm/Logger.js.map +1 -1
  98. package/lib/esm/ObservableSet.js +6 -6
  99. package/lib/esm/ObservableSet.js.map +1 -1
  100. package/lib/esm/OneAtATimeAction.js +9 -0
  101. package/lib/esm/OneAtATimeAction.js.map +1 -1
  102. package/lib/esm/OrderedSet.js +1 -0
  103. package/lib/esm/OrderedSet.js.map +1 -1
  104. package/lib/esm/PriorityQueue.js +3 -1
  105. package/lib/esm/PriorityQueue.js.map +1 -1
  106. package/lib/esm/SortedArray.js +4 -1
  107. package/lib/esm/SortedArray.js.map +1 -1
  108. package/lib/esm/StatusCategory.js +42 -105
  109. package/lib/esm/StatusCategory.js.map +1 -1
  110. package/lib/esm/Time.js +5 -0
  111. package/lib/esm/Time.js.map +1 -1
  112. package/lib/esm/Tracing.js +2 -0
  113. package/lib/esm/Tracing.js.map +1 -1
  114. package/lib/esm/TupleKeyedMap.js +2 -2
  115. package/lib/esm/TupleKeyedMap.js.map +1 -1
  116. package/lib/esm/TypedArrayBuilder.js +8 -0
  117. package/lib/esm/TypedArrayBuilder.js.map +1 -1
  118. package/lib/esm/UnexpectedErrors.js +10 -12
  119. package/lib/esm/UnexpectedErrors.js.map +1 -1
  120. package/lib/esm/YieldManager.js +3 -1
  121. package/lib/esm/YieldManager.js.map +1 -1
  122. package/lib/esm/internal/cross-package.d.ts +0 -1
  123. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  124. package/lib/esm/internal/cross-package.js +0 -1
  125. package/lib/esm/internal/cross-package.js.map +1 -1
  126. package/package.json +8 -8
  127. package/lib/cjs/internal/staticLoggerMetadata.d.ts +0 -11
  128. package/lib/cjs/internal/staticLoggerMetadata.d.ts.map +0 -1
  129. package/lib/cjs/internal/staticLoggerMetadata.js +0 -17
  130. package/lib/cjs/internal/staticLoggerMetadata.js.map +0 -1
  131. package/lib/esm/internal/staticLoggerMetadata.d.ts +0 -11
  132. package/lib/esm/internal/staticLoggerMetadata.d.ts.map +0 -1
  133. package/lib/esm/internal/staticLoggerMetadata.js +0 -14
  134. package/lib/esm/internal/staticLoggerMetadata.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,MAAa,UAAU;IAErB,YAAoB,eAAuB,CAAC,IAAI,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC;IAEpF,mCAAmC;IACnC,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IACxD,IAAW,OAAO,KAAK,OAAO,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;IAE1D;;OAEG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,IAAI,OAAO,IAAI,UAAU,CAAC,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AY,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpM,mFAAmF;IACnF,IAAW,cAAc,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE;;;OAGG;IACH,YAAmB,WAAoB,EAAE,gBAAgB,GAAG,KAAK;QAA9C,gBAAW,GAAX,WAAW,CAAS;QACrC,IAAI,gBAAgB;YAClB,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,yFAAyF;IAClF,KAAK;QACV,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;IAED,mEAAmE;IAC5D,IAAI;QACT,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,0BAA0B;IACnB,KAAK,KAAW,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;CAC/D;AAlCD,8BAkCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/** A duration of time. Can be either positive (towards future) or negative (in the past).\n * BeDurations are immutable.\n * @public\n */\nexport class BeDuration {\n private readonly _milliseconds: number;\n private constructor(milliseconds: number = 0) { this._milliseconds = milliseconds; }\n\n /** The duration in milliseconds */\n public get milliseconds() { return this._milliseconds; }\n public get seconds() { return this._milliseconds / 1000; }\n\n /** Create a BeDuration from seconds.\n * @param seconds the number of seconds for this BeDuration\n */\n public static fromSeconds(seconds: number) { return new BeDuration(seconds * 1000); }\n /** Create a BeDuration from milliseconds.\n * @param milliseconds the number of milliseconds for this BeDuration\n */\n public static fromMilliseconds(milliseconds: number) { return new BeDuration(milliseconds); }\n /** Determine whether this BeDuration is 0 seconds */\n public get isZero() { return this._milliseconds === 0; }\n /** Determine whether this BeDuration is towards the future */\n public get isTowardsFuture(): boolean { return this._milliseconds > 0; }\n /** Determine whether this BeDuration is towards the past */\n public get isTowardsPast(): boolean { return this._milliseconds < 0; }\n /** Subtract a BeDuration from this BeDuration, returning a new BeDuration. */\n public minus(other: BeDuration): BeDuration { return new BeDuration(this._milliseconds - other._milliseconds); }\n /** Add a BeDuration to this BeDuration, returning a new BeDuration */\n public plus(other: BeDuration): BeDuration { return new BeDuration(this._milliseconds + other._milliseconds); }\n\n /** Utility function to just wait for the specified time\n * @param ms Duration in milliseconds to wait\n * @return Promise that resolves after the specified wait period\n */\n public static async wait(ms: number): Promise<void> {\n return new Promise<void>((resolve: any) => setTimeout(resolve, ms));\n }\n\n /** Utility function to wait for either the specified time or a promise, whichever resolves first\n * @param ms Maximum duration in milliseconds to wait\n * @param promise A pending promise to wait for\n * @return Promise that resolves after the specified wait period or the provided promise resolves, whichever comes first\n */\n public static async race<T>(ms: number, promise: PromiseLike<T>): Promise<T | void> {\n let timeout: any;\n const waitPromise = new Promise<void>((resolve) => {\n timeout = setTimeout(resolve, ms);\n });\n return Promise.race([waitPromise, promise]).finally(() => {\n if (timeout)\n clearTimeout(timeout);\n });\n }\n\n /** Utility function to just wait for the specified time\n * @return Promise that resolves after the specified wait period\n */\n public async wait(): Promise<void> {\n return new Promise<void>((resolve: any) => setTimeout(resolve, this._milliseconds));\n }\n\n /** Execute a function after delaying by this duration.\n * @param fn the function to execute after the delay\n * @param scope An optional object scope to serve as the 'this' pointer when `fn` is invoked.\n * @param args optional arguments to `fn`\n * @return Promise resolved by `fn`\n */\n public async executeAfter<T>(fn: (...args: any[]) => T, scope?: any, ...args: any[]): Promise<T> {\n return new Promise<T>((resolve: any) => setTimeout(() => resolve(fn.apply(scope, args)), this._milliseconds));\n }\n}\n\n/** A specific point in time relative to the current time.\n * BeTimePoints are used for timing operations. They are created from a BeDuration relative to the \"now\".\n * BeTimePoints are immutable.\n * @public\n */\nexport class BeTimePoint {\n private readonly _milliseconds: number;\n /** the time in milliseconds, of this BeTimePoint (relative to January 1, 1970 00:00:00 UTC.) */\n public get milliseconds() { return this._milliseconds; }\n private constructor(milliseconds: number) { this._milliseconds = milliseconds; }\n\n /** Create a BeTimePoint from Date.now() */\n public static now() { return new BeTimePoint(Date.now()); }\n\n /** Create a BeTimePoint at a specified duration in the future from now\n * @param val the duration from now\n */\n public static fromNow(val: BeDuration) { return new BeTimePoint(Date.now() + val.milliseconds); }\n\n /** Create a BeTimePoint at a specified duration in the past before now\n * @param val the duration before now\n */\n public static beforeNow(val: BeDuration) { return new BeTimePoint(Date.now() - val.milliseconds); }\n\n /** Determine whether this BeTimePoint is a time in the future from the time this method is called (it calls now()!) */\n public get isInFuture(): boolean { return Date.now() < this._milliseconds; }\n\n /** Determine whether this BeTimePoint is a time that has already passed before the time this method is called (it calls now()!) */\n public get isInPast(): boolean { return Date.now() > this._milliseconds; }\n\n /** Determine whether this BeTimePoint happens before another one.\n * @param other the other BeTimePoint.\n */\n public before(other: BeTimePoint): boolean { return this._milliseconds < other._milliseconds; }\n\n /** Determine whether this BeTimePoint happens after another one.\n * @param other the other BeTimePoint.\n */\n public after(other: BeTimePoint): boolean { return this._milliseconds > other._milliseconds; }\n\n /** Subtract a BeDuration from this BeTimePoint, returning a new BeTimePoint. This moves this BeTimePoint backwards in time if BeDuration.isTowardsFuture() === true\n * @param duration the duration to subtract.\n */\n public minus(duration: BeDuration): BeTimePoint { return new BeTimePoint(this._milliseconds - duration.milliseconds); }\n\n /** Subtract a BeDuration from this BeTimePoint, returning a new BeTimePoint. This moves this BeTimePoint backwards in time if BeDuration.isTowardsFuture() === true\n * @param duration the duration to subtract.\n */\n public plus(duration: BeDuration) { return new BeTimePoint(this._milliseconds + duration.milliseconds); }\n}\n\n/** A StopWatch for timing operations.\n * @public\n */\nexport class StopWatch {\n private _start?: BeTimePoint;\n private _stop?: BeTimePoint;\n /** Get the elapsed time since start() on a running timer. */\n public get current(): BeDuration { return BeDuration.fromMilliseconds(BeTimePoint.now().milliseconds - (!!this._start ? this._start.milliseconds : 0)); }\n /** Get the elapsed time, in seconds, since start() on a running timer. */\n public get currentSeconds(): number { return this.current.seconds; }\n /** Get the elapsed time between start() and stop() on this timer in milliseconds. */\n public get elapsed(): BeDuration { return BeDuration.fromMilliseconds((!!this._stop ? this._stop.milliseconds : BeTimePoint.now().milliseconds) - (!!this._start ? this._start.milliseconds : 0)); }\n /** Get the elapsed time, in seconds, between start() and stop() on this timer. */\n public get elapsedSeconds(): number { return this.elapsed.seconds; }\n /** ctor for StopWatch\n * @param description optional string stored with the StopWatch\n * @param startImmediately if true, StopWatch is started when created. Otherwise, call start() explicitly.\n */\n constructor(public description?: string, startImmediately = false) {\n if (startImmediately)\n this.start();\n }\n\n /** Start the stopwatch. Any future time measurements will be based on this new value. */\n public start(): void {\n this.reset();\n this._start = BeTimePoint.now();\n }\n\n /** Stop the stopwatch so that the duration can be viewed later. */\n public stop(): BeDuration {\n this._stop = BeTimePoint.now();\n return this.elapsed;\n }\n\n /** Clear the StopWatch */\n public reset(): void { this._start = this._stop = undefined; }\n}\n"]}
1
+ {"version":3,"file":"Time.js","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,MAAa,UAAU;IACJ,aAAa,CAAS;IACvC,YAAoB,eAAuB,CAAC,IAAI,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC;IAEpF,mCAAmC;IACnC,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IACx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AAa,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,qFAAqF;IACrF,IAAW,OAAO,KAAiB,OAAO,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpM,mFAAmF;IACnF,IAAW,cAAc,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE;;;OAGG;IACH,YAAmB,WAAoB,EAAE,gBAAgB,GAAG,KAAK;QAA9C,gBAAW,GAAX,WAAW,CAAS;QACrC,IAAI,gBAAgB;YAClB,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,yFAAyF;IAClF,KAAK;QACV,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAClC,CAAC;IAED,mEAAmE;IAC5D,IAAI;QACT,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,0BAA0B;IACnB,KAAK,KAAW,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;CAC/D;AAlCD,8BAkCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/** A duration of time. Can be either positive (towards future) or negative (in the past).\n * BeDurations are immutable.\n * @public\n */\nexport class BeDuration {\n private readonly _milliseconds: number;\n private constructor(milliseconds: number = 0) { this._milliseconds = milliseconds; }\n\n /** The duration in milliseconds */\n public get milliseconds() { return this._milliseconds; }\n public get seconds() { return this._milliseconds / 1000; }\n\n /** Create a BeDuration from seconds.\n * @param seconds the number of seconds for this BeDuration\n */\n public static fromSeconds(seconds: number) { return new BeDuration(seconds * 1000); }\n /** Create a BeDuration from milliseconds.\n * @param milliseconds the number of milliseconds for this BeDuration\n */\n public static fromMilliseconds(milliseconds: number) { return new BeDuration(milliseconds); }\n /** Determine whether this BeDuration is 0 seconds */\n public get isZero() { return this._milliseconds === 0; }\n /** Determine whether this BeDuration is towards the future */\n public get isTowardsFuture(): boolean { return this._milliseconds > 0; }\n /** Determine whether this BeDuration is towards the past */\n public get isTowardsPast(): boolean { return this._milliseconds < 0; }\n /** Subtract a BeDuration from this BeDuration, returning a new BeDuration. */\n public minus(other: BeDuration): BeDuration { return new BeDuration(this._milliseconds - other._milliseconds); }\n /** Add a BeDuration to this BeDuration, returning a new BeDuration */\n public plus(other: BeDuration): BeDuration { return new BeDuration(this._milliseconds + other._milliseconds); }\n\n /** Utility function to just wait for the specified time\n * @param ms Duration in milliseconds to wait\n * @return Promise that resolves after the specified wait period\n */\n public static async wait(ms: number): Promise<void> {\n return new Promise<void>((resolve: any) => setTimeout(resolve, ms));\n }\n\n /** Utility function to wait for either the specified time or a promise, whichever resolves first\n * @param ms Maximum duration in milliseconds to wait\n * @param promise A pending promise to wait for\n * @return Promise that resolves after the specified wait period or the provided promise resolves, whichever comes first\n */\n public static async race<T>(ms: number, promise: PromiseLike<T>): Promise<T | void> {\n let timeout: any;\n const waitPromise = new Promise<void>((resolve) => {\n timeout = setTimeout(resolve, ms);\n });\n return Promise.race([waitPromise, promise]).finally(() => {\n if (timeout)\n clearTimeout(timeout);\n });\n }\n\n /** Utility function to just wait for the specified time\n * @return Promise that resolves after the specified wait period\n */\n public async wait(): Promise<void> {\n return new Promise<void>((resolve: any) => setTimeout(resolve, this._milliseconds));\n }\n\n /** Execute a function after delaying by this duration.\n * @param fn the function to execute after the delay\n * @param scope An optional object scope to serve as the 'this' pointer when `fn` is invoked.\n * @param args optional arguments to `fn`\n * @return Promise resolved by `fn`\n */\n public async executeAfter<T>(fn: (...args: any[]) => T, scope?: any, ...args: any[]): Promise<T> {\n return new Promise<T>((resolve: any) => setTimeout(() => resolve(fn.apply(scope, args)), this._milliseconds));\n }\n}\n\n/** A specific point in time relative to the current time.\n * BeTimePoints are used for timing operations. They are created from a BeDuration relative to the \"now\".\n * BeTimePoints are immutable.\n * @public\n */\nexport class BeTimePoint {\n private readonly _milliseconds: number;\n /** the time in milliseconds, of this BeTimePoint (relative to January 1, 1970 00:00:00 UTC.) */\n public get milliseconds() { return this._milliseconds; }\n private constructor(milliseconds: number) { this._milliseconds = milliseconds; }\n\n /** Create a BeTimePoint from Date.now() */\n public static now() { return new BeTimePoint(Date.now()); }\n\n /** Create a BeTimePoint at a specified duration in the future from now\n * @param val the duration from now\n */\n public static fromNow(val: BeDuration) { return new BeTimePoint(Date.now() + val.milliseconds); }\n\n /** Create a BeTimePoint at a specified duration in the past before now\n * @param val the duration before now\n */\n public static beforeNow(val: BeDuration) { return new BeTimePoint(Date.now() - val.milliseconds); }\n\n /** Determine whether this BeTimePoint is a time in the future from the time this method is called (it calls now()!) */\n public get isInFuture(): boolean { return Date.now() < this._milliseconds; }\n\n /** Determine whether this BeTimePoint is a time that has already passed before the time this method is called (it calls now()!) */\n public get isInPast(): boolean { return Date.now() > this._milliseconds; }\n\n /** Determine whether this BeTimePoint happens before another one.\n * @param other the other BeTimePoint.\n */\n public before(other: BeTimePoint): boolean { return this._milliseconds < other._milliseconds; }\n\n /** Determine whether this BeTimePoint happens after another one.\n * @param other the other BeTimePoint.\n */\n public after(other: BeTimePoint): boolean { return this._milliseconds > other._milliseconds; }\n\n /** Subtract a BeDuration from this BeTimePoint, returning a new BeTimePoint. This moves this BeTimePoint backwards in time if BeDuration.isTowardsFuture() === true\n * @param duration the duration to subtract.\n */\n public minus(duration: BeDuration): BeTimePoint { return new BeTimePoint(this._milliseconds - duration.milliseconds); }\n\n /** Subtract a BeDuration from this BeTimePoint, returning a new BeTimePoint. This moves this BeTimePoint backwards in time if BeDuration.isTowardsFuture() === true\n * @param duration the duration to subtract.\n */\n public plus(duration: BeDuration) { return new BeTimePoint(this._milliseconds + duration.milliseconds); }\n}\n\n/** A StopWatch for timing operations.\n * @public\n */\nexport class StopWatch {\n private _start?: BeTimePoint;\n private _stop?: BeTimePoint;\n /** Get the elapsed time since start() on a running timer. */\n public get current(): BeDuration { return BeDuration.fromMilliseconds(BeTimePoint.now().milliseconds - (!!this._start ? this._start.milliseconds : 0)); }\n /** Get the elapsed time, in seconds, since start() on a running timer. */\n public get currentSeconds(): number { return this.current.seconds; }\n /** Get the elapsed time between start() and stop() on this timer in milliseconds. */\n public get elapsed(): BeDuration { return BeDuration.fromMilliseconds((!!this._stop ? this._stop.milliseconds : BeTimePoint.now().milliseconds) - (!!this._start ? this._start.milliseconds : 0)); }\n /** Get the elapsed time, in seconds, between start() and stop() on this timer. */\n public get elapsedSeconds(): number { return this.elapsed.seconds; }\n /** ctor for StopWatch\n * @param description optional string stored with the StopWatch\n * @param startImmediately if true, StopWatch is started when created. Otherwise, call start() explicitly.\n */\n constructor(public description?: string, startImmediately = false) {\n if (startImmediately)\n this.start();\n }\n\n /** Start the stopwatch. Any future time measurements will be based on this new value. */\n public start(): void {\n this.reset();\n this._start = BeTimePoint.now();\n }\n\n /** Stop the stopwatch so that the duration can be viewed later. */\n public stop(): BeDuration {\n this._stop = BeTimePoint.now();\n return this.elapsed;\n }\n\n /** Clear the StopWatch */\n public reset(): void { this._start = this._stop = undefined; }\n}\n"]}
@@ -76,6 +76,8 @@ function flattenObject(obj) {
76
76
  * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.
77
77
  */
78
78
  class Tracing {
79
+ static _tracer;
80
+ static _openTelemetry;
79
81
  /**
80
82
  * If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.
81
83
  * If OpenTelemetry tracing is _not_ enabled, runs the provided function.
@@ -1 +1 @@
1
- {"version":3,"file":"Tracing.js","sourceRoot":"","sources":["../../src/Tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAyD;AAEzD,kGAAkG;AAClG;;;;GAIG;AACH,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,+CAAY,CAAA;IACZ,2CAAU,CAAA;IACV,2CAAU,CAAA;IACV,+CAAY,CAAA;IACZ,+CAAY,CAAA;AACd,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,CAAC;AACxF,CAAC;AAED,6GAA6G;AAC7G,iJAAiJ;AACjJ,SAAS,qBAAqB,CAAC,GAAY;IACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACrB,OAAO,KAAK,CAAC;IAEf,IAAI,QAAQ,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI;YAC/B,SAAS;QAEX,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,OAAO,CAAC,CAAC;YACpB,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBACtB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,QAAQ;YACvB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,GAAY;IACjC,OAAO,OAAO,G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5G,CAAC;CACF;AAnGD,0BAmGC;AAED,oDAAoD","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 Logging\n */\n\nimport type { ContextAPI, SpanAttributes, SpanAttributeValue, SpanContext, SpanOptions, TraceAPI, Tracer } from \"@opentelemetry/api\";\nimport { LogFunction, Logger, LogLevel } from \"./Logger\";\n\n// re-export so that consumers can construct full SpanOptions object without external dependencies\n/**\n * Mirrors the SpanKind enum from [@opentelemetry/api](https://open-telemetry.github.io/opentelemetry-js/enums/_opentelemetry_api.SpanKind.html)\n * @public\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\n */\nexport enum SpanKind {\n INTERNAL = 0,\n SERVER = 1,\n CLIENT = 2,\n PRODUCER = 3,\n CONSUMER = 4\n}\n\nfunction isValidPrimitive(val: unknown): val is SpanAttributeValue {\n return typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\";\n}\n\n// Only _homogenous_ arrays of strings, numbers, or booleans are supported as OpenTelemetry Attribute values.\n// Per the spec (https://opentelemetry.io/docs/reference/specification/common/common/#attribute), empty arrays and null values are supported too.\nfunction isValidPrimitiveArray(val: unknown): val is SpanAttributeValue {\n if (!Array.isArray(val))\n return false;\n\n let itemType;\n for (const x of val) {\n if (x === undefined || x === null)\n continue;\n\n if (!itemType) {\n itemType = typeof x;\n if (!isValidPrimitive(x))\n return false;\n }\n\n if (typeof x !== itemType)\n return false;\n }\n return true;\n}\n\nfunction isPlainObject(obj: unknown): obj is object {\n return typeof obj === \"object\" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\n}\n\nfunction* getFlatEntries(obj: unknown, path = \"\"): Iterable<[string, SpanAttributeValue]> {\n if (isValidPrimitiveArray(obj)) {\n yield [path, obj];\n return;\n }\n\n // Prefer JSON serialization over flattening for any non-POJO types.\n // There's just too many ways trying to flatten those can go wrong (Dates, Buffers, TypedArrays, etc.)\n if (!isPlainObject(obj) && !Array.isArray(obj)) {\n yield [path, isValidPrimitive(obj) ? obj : JSON.stringify(obj)];\n return;\n }\n\n // Always serialize empty objects/arrays as empty array values\n const entries = Object.entries(obj);\n if (entries.length === 0)\n yield [path, []];\n\n for (const [key, val] of entries)\n yield* getFlatEntries(val, (path === \"\") ? key : `${path}.${key}`);\n}\n\nfunction flattenObject(obj: object): SpanAttributes {\n return Object.fromEntries(getFlatEntries(obj));\n}\n\n/* eslint-disable @typescript-eslint/no-deprecated -- lots of self-references here... */\n\n/**\n * Enables OpenTelemetry tracing in addition to traditional logging.\n * @public\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\n */\nexport class Tracing {\n private static _tracer?: Tracer;\n private static _openTelemetry?: { trace: Pick<TraceAPI, \"setSpan\" | \"setSpanContext\" | \"getSpan\">, context: Pick<ContextAPI, \"active\" | \"with\"> };\n\n /**\n * If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.\n * If OpenTelemetry tracing is _not_ enabled, runs the provided function.\n * @param name name of the new span\n * @param fn function to run inside the new span\n * @param options span options\n * @param parentContext optional context used to retrieve parent span id\n */\n public static async withSpan<T>(name: string, fn: () => Promise<T>, options?: SpanOptions, parentContext?: SpanContext): Promise<T> {\n if (Tracing._tracer === undefined || Tracing._openTelemetry === undefined)\n return fn();\n\n // this case is for context propagation - parentContext is typically constructed from HTTP headers\n const parent = parentContext === undefined\n ? Tracing._openTelemetry.context.active()\n : Tracing._openTelemetry.trace.setSpanContext(Tracing._openTelemetry.context.active(), parentContext);\n\n return Tracing._openTelemetry.context.with(\n Tracing._openTelemetry.trace.setSpan(\n parent,\n Tracing._tracer.startSpan(name, options, Tracing._openTelemetry.context.active()),\n ),\n async () => {\n try {\n return await fn();\n } catch (err) {\n if (err instanceof Error) // ignore non-Error throws, such as RpcControlResponse\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttribute(\"error\", true);\n throw err;\n } finally {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.end();\n }\n },\n );\n }\n\n /**\n * Adds a span event describing a runtime exception, as advised in OpenTelemetry documentation\n * @param e error (exception) object\n */\n public static recordException(e: Error) {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.recordException(e);\n }\n\n /**\n * Enable logging to OpenTelemetry. [[Tracing.withSpan]] will be enabled, all log entries will be attached to active span as span events.\n * [IModelHost.startup]($backend) will call this automatically if the `enableOpenTelemetry` option is enabled and it succeeds in requiring `@opentelemetry/api`.\n * @note Node.js OpenTelemetry SDK should be initialized by the user.\n */\n public static enableOpenTelemetry(tracer: Tracer, api: typeof Tracing._openTelemetry) {\n Tracing._tracer = tracer;\n Tracing._openTelemetry = api;\n Logger.logTrace = Tracing.withOpenTelemetry(LogLevel.Trace, Logger.logTrace.bind(Logger)).bind(Logger);\n Logger.logInfo = Tracing.withOpenTelemetry(LogLevel.Info, Logger.logInfo.bind(Logger)).bind(Logger);\n Logger.logWarning = Tracing.withOpenTelemetry(LogLevel.Warning, Logger.logWarning.bind(Logger)).bind(Logger);\n Logger.logError = Tracing.withOpenTelemetry(LogLevel.Error, Logger.logError.bind(Logger)).bind(Logger);\n }\n\n private static withOpenTelemetry(level: LogLevel, base: LogFunction, isError: boolean = false): LogFunction {\n return (category, message, metaData) => {\n const oTelContext = Tracing._openTelemetry?.context.active();\n if(Tracing._openTelemetry === undefined || oTelContext === undefined)\n return base(category, message, metaData);\n\n const serializedMetadata = Logger.getMetaData(metaData);\n if(Logger.isEnabled(category, level)) {\n try {\n Tracing._openTelemetry?.trace\n .getSpan(Tracing._openTelemetry.context.active())\n ?.addEvent(message, {\n ...flattenObject(serializedMetadata),\n error: isError,\n loggerCategory: category,\n });\n } catch { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work\n\n const spanContext = Tracing._openTelemetry.trace.getSpan(oTelContext)?.spanContext();\n base(category, message, {\n ...serializedMetadata,\n /* eslint-disable @typescript-eslint/naming-convention */\n trace_id: spanContext?.traceId,\n span_id: spanContext?.spanId,\n trace_flags: spanContext?.traceFlags,\n /* eslint-enable @typescript-eslint/naming-convention */\n });\n }\n };\n }\n\n /** Set attributes on currently active openTelemetry span. Doesn't do anything if openTelemetry logging is not initialized.\n * @param attributes The attributes to set\n */\n public static setAttributes(attributes: SpanAttributes) {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttributes(attributes);\n }\n}\n\n/* eslint-enable @typescript-eslint/no-deprecated */\n"]}
1
+ {"version":3,"file":"Tracing.js","sourceRoot":"","sources":["../../src/Tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAyD;AAEzD,kGAAkG;AAClG;;;;GAIG;AACH,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,+CAAY,CAAA;IACZ,2CAAU,CAAA;IACV,2CAAU,CAAA;IACV,+CAAY,CAAA;IACZ,+CAAY,CAAA;AACd,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,CAAC;AACxF,CAAC;AAED,6GAA6G;AAC7G,iJAAiJ;AACjJ,SAAS,qBAAqB,CAAC,GAAY;IACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QACrB,OAAO,KAAK,CAAC;IAEf,IAAI,QAAQ,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI;YAC/B,SAAS;QAEX,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAA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W,EAAE,MAAM;oBAC5B,WAAW,EAAE,WAAW,EAAE,UAAU;oBACpC,wDAAwD;iBACzD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAAC,UAA0B;QACpD,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAC5G,CAAC;CACF;AAnGD,0BAmGC;AAED,oDAAoD","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 Logging\n */\n\nimport type { ContextAPI, SpanAttributes, SpanAttributeValue, SpanContext, SpanOptions, TraceAPI, Tracer } from \"@opentelemetry/api\";\nimport { LogFunction, Logger, LogLevel } from \"./Logger\";\n\n// re-export so that consumers can construct full SpanOptions object without external dependencies\n/**\n * Mirrors the SpanKind enum from [@opentelemetry/api](https://open-telemetry.github.io/opentelemetry-js/enums/_opentelemetry_api.SpanKind.html)\n * @public\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\n */\nexport enum SpanKind {\n INTERNAL = 0,\n SERVER = 1,\n CLIENT = 2,\n PRODUCER = 3,\n CONSUMER = 4\n}\n\nfunction isValidPrimitive(val: unknown): val is SpanAttributeValue {\n return typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\";\n}\n\n// Only _homogenous_ arrays of strings, numbers, or booleans are supported as OpenTelemetry Attribute values.\n// Per the spec (https://opentelemetry.io/docs/reference/specification/common/common/#attribute), empty arrays and null values are supported too.\nfunction isValidPrimitiveArray(val: unknown): val is SpanAttributeValue {\n if (!Array.isArray(val))\n return false;\n\n let itemType;\n for (const x of val) {\n if (x === undefined || x === null)\n continue;\n\n if (!itemType) {\n itemType = typeof x;\n if (!isValidPrimitive(x))\n return false;\n }\n\n if (typeof x !== itemType)\n return false;\n }\n return true;\n}\n\nfunction isPlainObject(obj: unknown): obj is object {\n return typeof obj === \"object\" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\n}\n\nfunction* getFlatEntries(obj: unknown, path = \"\"): Iterable<[string, SpanAttributeValue]> {\n if (isValidPrimitiveArray(obj)) {\n yield [path, obj];\n return;\n }\n\n // Prefer JSON serialization over flattening for any non-POJO types.\n // There's just too many ways trying to flatten those can go wrong (Dates, Buffers, TypedArrays, etc.)\n if (!isPlainObject(obj) && !Array.isArray(obj)) {\n yield [path, isValidPrimitive(obj) ? obj : JSON.stringify(obj)];\n return;\n }\n\n // Always serialize empty objects/arrays as empty array values\n const entries = Object.entries(obj);\n if (entries.length === 0)\n yield [path, []];\n\n for (const [key, val] of entries)\n yield* getFlatEntries(val, (path === \"\") ? key : `${path}.${key}`);\n}\n\nfunction flattenObject(obj: object): SpanAttributes {\n return Object.fromEntries(getFlatEntries(obj));\n}\n\n/* eslint-disable @typescript-eslint/no-deprecated -- lots of self-references here... */\n\n/**\n * Enables OpenTelemetry tracing in addition to traditional logging.\n * @public\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\n */\nexport class Tracing {\n private static _tracer?: Tracer;\n private static _openTelemetry?: { trace: Pick<TraceAPI, \"setSpan\" | \"setSpanContext\" | \"getSpan\">, context: Pick<ContextAPI, \"active\" | \"with\"> };\n\n /**\n * If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.\n * If OpenTelemetry tracing is _not_ enabled, runs the provided function.\n * @param name name of the new span\n * @param fn function to run inside the new span\n * @param options span options\n * @param parentContext optional context used to retrieve parent span id\n */\n public static async withSpan<T>(name: string, fn: () => Promise<T>, options?: SpanOptions, parentContext?: SpanContext): Promise<T> {\n if (Tracing._tracer === undefined || Tracing._openTelemetry === undefined)\n return fn();\n\n // this case is for context propagation - parentContext is typically constructed from HTTP headers\n const parent = parentContext === undefined\n ? Tracing._openTelemetry.context.active()\n : Tracing._openTelemetry.trace.setSpanContext(Tracing._openTelemetry.context.active(), parentContext);\n\n return Tracing._openTelemetry.context.with(\n Tracing._openTelemetry.trace.setSpan(\n parent,\n Tracing._tracer.startSpan(name, options, Tracing._openTelemetry.context.active()),\n ),\n async () => {\n try {\n return await fn();\n } catch (err) {\n if (err instanceof Error) // ignore non-Error throws, such as RpcControlResponse\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttribute(\"error\", true);\n throw err;\n } finally {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.end();\n }\n },\n );\n }\n\n /**\n * Adds a span event describing a runtime exception, as advised in OpenTelemetry documentation\n * @param e error (exception) object\n */\n public static recordException(e: Error) {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.recordException(e);\n }\n\n /**\n * Enable logging to OpenTelemetry. [[Tracing.withSpan]] will be enabled, all log entries will be attached to active span as span events.\n * [IModelHost.startup]($backend) will call this automatically if the `enableOpenTelemetry` option is enabled and it succeeds in requiring `@opentelemetry/api`.\n * @note Node.js OpenTelemetry SDK should be initialized by the user.\n */\n public static enableOpenTelemetry(tracer: Tracer, api: typeof Tracing._openTelemetry) {\n Tracing._tracer = tracer;\n Tracing._openTelemetry = api;\n Logger.logTrace = Tracing.withOpenTelemetry(LogLevel.Trace, Logger.logTrace.bind(Logger)).bind(Logger);\n Logger.logInfo = Tracing.withOpenTelemetry(LogLevel.Info, Logger.logInfo.bind(Logger)).bind(Logger);\n Logger.logWarning = Tracing.withOpenTelemetry(LogLevel.Warning, Logger.logWarning.bind(Logger)).bind(Logger);\n Logger.logError = Tracing.withOpenTelemetry(LogLevel.Error, Logger.logError.bind(Logger)).bind(Logger);\n }\n\n private static withOpenTelemetry(level: LogLevel, base: LogFunction, isError: boolean = false): LogFunction {\n return (category, message, metaData) => {\n const oTelContext = Tracing._openTelemetry?.context.active();\n if(Tracing._openTelemetry === undefined || oTelContext === undefined)\n return base(category, message, metaData);\n\n const serializedMetadata = Logger.getMetaData(metaData);\n if(Logger.isEnabled(category, level)) {\n try {\n Tracing._openTelemetry?.trace\n .getSpan(Tracing._openTelemetry.context.active())\n ?.addEvent(message, {\n ...flattenObject(serializedMetadata),\n error: isError,\n loggerCategory: category,\n });\n } catch { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work\n\n const spanContext = Tracing._openTelemetry.trace.getSpan(oTelContext)?.spanContext();\n base(category, message, {\n ...serializedMetadata,\n /* eslint-disable @typescript-eslint/naming-convention */\n trace_id: spanContext?.traceId,\n span_id: spanContext?.spanId,\n trace_flags: spanContext?.traceFlags,\n /* eslint-enable @typescript-eslint/naming-convention */\n });\n }\n };\n }\n\n /** Set attributes on currently active openTelemetry span. Doesn't do anything if openTelemetry logging is not initialized.\n * @param attributes The attributes to set\n */\n public static setAttributes(attributes: SpanAttributes) {\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttributes(attributes);\n }\n}\n\n/* eslint-enable @typescript-eslint/no-deprecated */\n"]}
@@ -29,10 +29,9 @@ exports.TupleKeyedMap = void 0;
29
29
  * @public
30
30
  */
31
31
  class TupleKeyedMap {
32
+ _map = new Map();
32
33
  // argument types match those of Map
33
34
  constructor(entries) {
34
- this._map = new Map();
35
- this._size = 0;
36
35
  if (entries)
37
36
  for (const [k, v] of entries) {
38
37
  this.set(k, v);
@@ -92,6 +91,7 @@ class TupleKeyedMap {
92
91
  }
93
92
  yield* impl(this._map, []);
94
93
  }
94
+ _size = 0;
95
95
  get size() {
96
96
  return this._size;
97
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TupleKeyedMap.js","sourceRoot":"","sources":["../../src/TupleKeyedMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;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;IAED,IAAW,CAAC,MAAM,CAAC,WAAW,CAAC;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CACF;AAhFD,sCAgFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\n/** A map similar to the standard JavaScript Map collection except that the keys must be a tuple\n * (javascript array), and two keys are considered equal if their elements in order are strict-equal,\n * and the tuples have the same amount of elements\n *\n * This means you can use array literals to key data in Maps that would otherwise be reference-compared\n * if using JavaScript's built in Map\n *\n * Note that JavaScript's Map type, unlike this one that uses strict equality, uses instead\n * SameValueZero equality comparison\n * @see https://262.ecma-international.org/6.0/#sec-samevaluezero\n *\n * ```js\n * const map = new TupleKeyedMap([[1,\"y\"], \"value\"]);\n * const value = map.get([1, \"y\"]); // a normal map would identify these keys as different because they are independent objects\n * ```\n *\n * It is implemented by each index of the tuple key being used as a singular key into a submap\n * @note this only implements a subset of the Map interface\n * @public\n */\nexport class TupleKeyedMap<K extends readonly any[], V> {\n private _map = new Map<K[0], Map<any, V> | V>();\n\n // argument types match those of Map\n public constructor(entries?: readonly (readonly [K, V])[] | null) {\n if (entries)\n for (const [k, v] of entries) {\n this.set(k, v);\n }\n }\n\n public clear(): void {\n return this._map.clear();\n }\n\n private makeKeyError() {\n return Error(\n \"A Bad key was used, it didn't match the key type of the the map.\",\n );\n }\n\n public get(key: K): V | undefined {\n let cursor: Map<any, any> | V = this._map;\n for (const subkey of key) {\n if (!(cursor instanceof Map))\n throw this.makeKeyError();\n cursor = cursor.get(subkey);\n if (cursor === undefined)\n return undefined;\n }\n if (cursor instanceof Map)\n throw this.makeKeyError();\n return cursor;\n }\n\n public has(key: K): boolean {\n return this.get(key) !== undefined;\n }\n\n public set(key: K, value: V): this {\n let cursor: Map<any, any> = this._map;\n for (let i = 0; i < key.length - 1; ++i) {\n const subkey = key[i];\n let next = cursor.get(subkey);\n if (next === undefined) {\n next = new Map();\n cursor.set(subkey, next);\n }\n cursor = next;\n }\n const finalSubkey = key[key.length - 1];\n if (!(cursor instanceof Map))\n throw this.makeKeyError();\n cursor.set(finalSubkey, value);\n this._size++;\n return this;\n }\n\n public *[Symbol.iterator](): IterableIterator<[K, V]> {\n function *impl(map: Map<any, any>, keyPrefix: readonly any[]): IterableIterator<[K, V]> {\n for (const [k, v] of map) {\n const nextKey = [...keyPrefix, k];\n if (v instanceof Map) {\n yield* impl(v, nextKey);\n } else {\n yield [nextKey as any as K, v];\n }\n }\n }\n yield* impl(this._map, []);\n }\n\n private _size: number = 0;\n public get size(): number {\n return this._size;\n }\n\n public get [Symbol.toStringTag](): string {\n return this.constructor.name;\n }\n}\n"]}
1
+ {"version":3,"file":"TupleKeyedMap.js","sourceRoot":"","sources":["../../src/TupleKeyedMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,aAAa;IAChB,IAAI,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEhD,oCAAoC;IACpC,YAAmB,OAA6C;QAC9D,IAAI,OAAO;YACT,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;gBAC7B,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACjB,CAAC;IACL,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAEO,YAAY;QAClB,OAAO,KAAK,CACV,kEAAkE,CACnE,CAAC;IACJ,CAAC;IAEM,GAAG,CAAC,GAAM;QACf,IAAI,MAAM,GAAsB,IAAI,CAAC,IAAI,CAAC;QAC1C,KAAK,MAAM,MAAM,IAAI,GAAG,EAAE,CAAC;YACzB,IAAI,CAAC,CAAC,MA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EM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,QAAS,CAAC,CAAA,IAAI,CAAC,GAAkB,EAAE,SAAyB;YAC1D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;gBACzB,MAAM,OAAO,GAAG,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC;gBAClC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;oBACrB,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,OAAmB,EAAE,CAAC,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;QACD,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;IAEO,KAAK,GAAW,CAAC,CAAC;IAC1B,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAW,CAAC,MAAM,CAAC,WAAW,CAAC;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CACF;AAhFD,sCAgFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\n/** A map similar to the standard JavaScript Map collection except that the keys must be a tuple\n * (javascript array), and two keys are considered equal if their elements in order are strict-equal,\n * and the tuples have the same amount of elements\n *\n * This means you can use array literals to key data in Maps that would otherwise be reference-compared\n * if using JavaScript's built in Map\n *\n * Note that JavaScript's Map type, unlike this one that uses strict equality, uses instead\n * SameValueZero equality comparison\n * @see https://262.ecma-international.org/6.0/#sec-samevaluezero\n *\n * ```js\n * const map = new TupleKeyedMap([[1,\"y\"], \"value\"]);\n * const value = map.get([1, \"y\"]); // a normal map would identify these keys as different because they are independent objects\n * ```\n *\n * It is implemented by each index of the tuple key being used as a singular key into a submap\n * @note this only implements a subset of the Map interface\n * @public\n */\nexport class TupleKeyedMap<K extends readonly any[], V> {\n private _map = new Map<K[0], Map<any, V> | V>();\n\n // argument types match those of Map\n public constructor(entries?: readonly (readonly [K, V])[] | null) {\n if (entries)\n for (const [k, v] of entries) {\n this.set(k, v);\n }\n }\n\n public clear(): void {\n return this._map.clear();\n }\n\n private makeKeyError() {\n return Error(\n \"A Bad key was used, it didn't match the key type of the the map.\",\n );\n }\n\n public get(key: K): V | undefined {\n let cursor: Map<any, any> | V = this._map;\n for (const subkey of key) {\n if (!(cursor instanceof Map))\n throw this.makeKeyError();\n cursor = cursor.get(subkey);\n if (cursor === undefined)\n return undefined;\n }\n if (cursor instanceof Map)\n throw this.makeKeyError();\n return cursor;\n }\n\n public has(key: K): boolean {\n return this.get(key) !== undefined;\n }\n\n public set(key: K, value: V): this {\n let cursor: Map<any, any> = this._map;\n for (let i = 0; i < key.length - 1; ++i) {\n const subkey = key[i];\n let next = cursor.get(subkey);\n if (next === undefined) {\n next = new Map();\n cursor.set(subkey, next);\n }\n cursor = next;\n }\n const finalSubkey = key[key.length - 1];\n if (!(cursor instanceof Map))\n throw this.makeKeyError();\n cursor.set(finalSubkey, value);\n this._size++;\n return this;\n }\n\n public *[Symbol.iterator](): IterableIterator<[K, V]> {\n function *impl(map: Map<any, any>, keyPrefix: readonly any[]): IterableIterator<[K, V]> {\n for (const [k, v] of map) {\n const nextKey = [...keyPrefix, k];\n if (v instanceof Map) {\n yield* impl(v, nextKey);\n } else {\n yield [nextKey as any as K, v];\n }\n }\n }\n yield* impl(this._map, []);\n }\n\n private _size: number = 0;\n public get size(): number {\n return this._size;\n }\n\n public get [Symbol.toStringTag](): string {\n return this.constructor.name;\n }\n}\n"]}
@@ -24,6 +24,14 @@ const Assert_1 = require("./Assert");
24
24
  * @public
25
25
  */
26
26
  class TypedArrayBuilder {
27
+ /** The constructor for the specific type of array being populated. */
28
+ _constructor;
29
+ /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */
30
+ _data;
31
+ /** The number of elements added to the array so far. */
32
+ _length;
33
+ /** Multiplier applied to required capacity by [[ensureCapacity]]. */
34
+ growthFactor;
27
35
  /** Constructs a new builder from the specified options, with a [[length]] of zero. */
28
36
  constructor(constructor, options) {
29
37
  this._constructor = constructor;
@@ -1 +1 @@
1
- {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAa,iBAAiB;IAU5B,sFAAsF;IACtF,YAAsB,WAA2B,EAAE,OAAkC;QACnF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,IAAI,GAAG,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,qDAAqD;IACrD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,6FAA6F;IAC7F,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,EAAE,CAAC,KAAa;QACrB,IAAI,KAAK,GAAG,CAAC;YACX,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAE9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAChC,IAAA,eAAM,EAAC,KAAK,KAAK,SAAS,EAAE,qBAAqB,CAAC,C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qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAlDD,4CAkDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { Constructor } from \"./UtilityTypes\";\nimport { assert } from \"./Assert\";\n\n/** Options used to construct a [[TypedArrayBuilder]].\n * @public\n */\nexport interface TypedArrayBuilderOptions {\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\n * Default: 1.5\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\n */\n growthFactor?: number;\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\n * initial capacity to avoid reallocations when populating the array.\n * Default: 0.\n * Minimum: 0.\n */\n initialCapacity?: number;\n}\n\n/** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.\n * @see [[UintArrayBuilder]] to construct such an array.\n * @public\n */\nexport type UintArray = Uint8Array | Uint16Array | Uint32Array;\n\n/** Incrementally builds a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of unsigned 8-, 16-, or 32-bit integers.\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\n *\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\n *\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\n * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.\n * @public\n */\nexport class TypedArrayBuilder<T extends UintArray> {\n /** The constructor for the specific type of array being populated. */\n protected _constructor: Constructor<T>;\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\n protected _data: T;\n /** The number of elements added to the array so far. */\n protected _length: number;\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\n public readonly growthFactor: number;\n\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\n this._constructor = constructor;\n this._data = new constructor(options?.initialCapacity ?? 0);\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\n this._length = 0;\n }\n\n /** The number of elements currently in the array. */\n public get length(): number {\n return this._length;\n }\n\n /** The number of elements that can fit into the memory currently allocated for the array. */\n public get capacity(): number {\n return this._data.length;\n }\n\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\n * returns the element at the specified index, with negative integers counting back from the end of the array.\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\n */\n public at(index: number): number {\n if (index < 0)\n index = this.length - index;\n\n const value = this._data[index];\n assert(value !== undefined, \"index out of bounds\");\n return value;\n }\n\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\n *\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\n */\n public ensureCapacity(newCapacity: number): number {\n if (this.capacity >= newCapacity)\n return this.capacity;\n\n assert(this.growthFactor >= 1.0);\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\n const prevData = this._data;\n this._data = new this._constructor(newCapacity);\n this._data.set(prevData, 0);\n\n assert(this.capacity === newCapacity);\n return this.capacity;\n }\n\n /** Append the specified value, resizing if necessary. */\n public push(value: number): void {\n this.ensureCapacity(this.length + 1);\n this._data[this.length] = value;\n ++this._length;\n }\n\n /** Append an array of values, resizing (at most once) if necessary. */\n public append(values: T): void {\n const newLength = this.length + values.length;\n this.ensureCapacity(newLength);\n this._data.set(values, this.length);\n this._length = newLength;\n }\n\n /** Obtain the finished array.\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\n * returned array's length will be equal to [[length]].\n */\n public toTypedArray(includeUnusedCapacity = false): T {\n if (includeUnusedCapacity)\n return this._data;\n\n const subarray = this._data.subarray(0, this.length);\n assert(subarray instanceof this._constructor);\n assert(subarray.buffer === this._data.buffer);\n return subarray;\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * @public\n */\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint8Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\n * @public\n */\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint16Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\n * @public\n */\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint32Array, options);\n }\n\n /** Obtain a view of the finished array as an array of bytes. */\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\n if (includeUnusedCapacity)\n return new Uint8Array(this._data.buffer);\n\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\n }\n}\n\n/** Options used to construct a [[UintArrayBuilder]].\n * @public\n */\nexport interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {\n /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than\n * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.\n * Default: `Uint8Array`.\n */\n initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;\n}\n\n/** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum\n * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.\n *\n * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].\n * As values are added to the array, if the bytes per element supported by the underlying array is too small to hold one of the new values, the array is\n * reallocated to a type large enough to hold all of the new values. For example, the following produces a `Uint8Array` because all values are less than 256:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 2, 254, 255]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint8Array);\n * ```\n *\n * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 255, 257, 65535]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint16Array);\n * ```\n *\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.\n * @public\n */\nexport class UintArrayBuilder extends TypedArrayBuilder<UintArray> {\n public constructor(options?: UintArrayBuilderOptions) {\n super(options?.initialType ?? Uint8Array, options);\n }\n\n /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.\n * This may change as larger values are added to the array.\n */\n public get bytesPerElement(): number {\n return this._data.BYTES_PER_ELEMENT;\n }\n\n /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.\n * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.\n * This method is invoked by [[push]] and [[append]].\n */\n protected ensureBytesPerElement(newValues: Iterable<number>): void {\n const curBytesPerElem = this.bytesPerElement;\n assert(curBytesPerElem === 1 || curBytesPerElem === 2 || curBytesPerElem === 4);\n if (curBytesPerElem >= 4)\n return;\n\n let neededBytesPerElem = curBytesPerElem;\n for (const value of newValues) {\n if (value > 0xffff) {\n neededBytesPerElem = 4;\n break;\n } else if (value > 0xff) {\n neededBytesPerElem = 2;\n }\n }\n\n if (neededBytesPerElem <= curBytesPerElem)\n return;\n\n this._constructor = neededBytesPerElem === 1 ? Uint8Array : (neededBytesPerElem === 2 ? Uint16Array : Uint32Array);\n this._data = new this._constructor(this._data);\n }\n\n /** See [[TypedArrayBuilder.push]]. */\n public override push(value: number): void {\n this.ensureBytesPerElement([value]);\n super.push(value);\n }\n\n /** See [[TypedArrayBuilder.append]]. */\n public override append(values: UintArray): void {\n this.ensureBytesPerElement(values);\n super.append(values);\n }\n}\n"]}
1
+ {"version":3,"file":"TypedArrayBuilder.js","sourceRoot":"","sources":["../../src/TypedArrayBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,qCAAkC;AA2BlC;;;;;;;;;;;;;GAaG;AACH,MAAa,iBAAiB;IAC5B,sEAAsE;IAC5D,YAAY,CAAiB;IACvC,8FAA8F;IACpF,KAAK,CAAI;IAC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OAAO;QAET,IAAI,kBAAkB,GAAG,eAAe,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;YAC9B,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC;gBACnB,kBAAkB,GAAG,CAAC,CAAC;gBACvB,MAAM;YACR,CAAC;iBAAM,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;gBACxB,kBAAkB,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,kBAAkB,IAAI,eAAe;YACvC,OAAO;QAET,IAAI,CAAC,YAAY,GAAG,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACnH,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,sCAAsC;IACtB,IAAI,CAAC,KAAa;QAChC,IAAI,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,wCAAwC;IACxB,MAAM,CAAC,MAAiB;QACtC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAlDD,4CAkDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Collections\n */\n\nimport { Constructor } from \"./UtilityTypes\";\nimport { assert } from \"./Assert\";\n\n/** Options used to construct a [[TypedArrayBuilder]].\n * @public\n */\nexport interface TypedArrayBuilderOptions {\n /** Controls how much additional memory is allocated when the TypedArray needs to be resized to accomodate more elements.\n * [[TypedArrayBuilder.ensureCapacity]] multiplies the required capacity by this factor to determine the new capacity.\n * Default: 1.5\n * Minimum: 1.0, which causes the TypedArray to allocate exactly the space it needs each time it is resized.\n */\n growthFactor?: number;\n /** The number of elements to allocate memory for in the TypedArray when creating the builder.\n * If you know the minimum number of elements you intend to add to the builder, you should specify that as the\n * initial capacity to avoid reallocations when populating the array.\n * Default: 0.\n * Minimum: 0.\n */\n initialCapacity?: number;\n}\n\n/** A [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) containing unsigned 8-, 16-, or 32-bit integers.\n * @see [[UintArrayBuilder]] to construct such an array.\n * @public\n */\nexport type UintArray = Uint8Array | Uint16Array | Uint32Array;\n\n/** Incrementally builds a [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) of unsigned 8-, 16-, or 32-bit integers.\n * Sometimes you wish to populate a `TypedArray`, but you don't know how many elements you will need.\n * `TypedArray` requires you to specify the size upon construction, and does not permit you to change the size later.\n *\n * `TypedArrayBuilder` manages a `TypedArray`, permitting you to [[push]] and [[append]] elements to it. It exposes two \"size\" properties\":\n * - [[capacity]], the number of elements it has currently allocated space for - i.e., the length of the underlying TypedArray; and\n * - [[length]], the number of elements that have so far been added to it, which is never bigger than [[capacity]].\n * When [[capacity]] is exceeded, a new, bigger TypedArray is allocated and the contents of the previous array are copied over to it.\n *\n * Once you've finished adding elements, you can obtain the finished `TypedArray` via [[toTypedArray]].\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], and [[Uint32ArrayBuilder]] to build specific types of arrays.\n * @see [[UintArrayBuilder]] when you don't know the maximum number of bytes required for each element in the array.\n * @public\n */\nexport class TypedArrayBuilder<T extends UintArray> {\n /** The constructor for the specific type of array being populated. */\n protected _constructor: Constructor<T>;\n /** The underlying typed array, to be reallocated and copied when its capacity is exceeded. */\n protected _data: T;\n /** The number of elements added to the array so far. */\n protected _length: number;\n /** Multiplier applied to required capacity by [[ensureCapacity]]. */\n public readonly growthFactor: number;\n\n /** Constructs a new builder from the specified options, with a [[length]] of zero. */\n protected constructor(constructor: Constructor<T>, options?: TypedArrayBuilderOptions) {\n this._constructor = constructor;\n this._data = new constructor(options?.initialCapacity ?? 0);\n this.growthFactor = Math.max(1.0, options?.growthFactor ?? 1.5);\n this._length = 0;\n }\n\n /** The number of elements currently in the array. */\n public get length(): number {\n return this._length;\n }\n\n /** The number of elements that can fit into the memory currently allocated for the array. */\n public get capacity(): number {\n return this._data.length;\n }\n\n /** Like [TypedArray.at](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/at),\n * returns the element at the specified index, with negative integers counting back from the end of the array.\n * @note It is your responsibility to ensure the index falls within the bounds of the array.\n */\n public at(index: number): number {\n if (index < 0)\n index = this.length - index;\n\n const value = this._data[index];\n assert(value !== undefined, \"index out of bounds\");\n return value;\n }\n\n /** Ensure that [[capacity]] is at least equal to `newCapacity`.\n * This is used internally by methods like [[push]] and [[append]] to ensure the array has room for the element(s) to be added.\n * It can also be useful when you know you intend to add some number of additional elements, to minimize reallocations.\n *\n * If `newCapacity` is not greater than the current [[capacity]], this function does nothing.\n * Otherwise, it allocates a new `TypedArray` with room for `newCapacity * growthFactor` elements, and copies the contents of the previous `TypedArray` into it.\n * [[length]] remains unchanged; [[capacity]] reflects the size of the new TypeArray.\n */\n public ensureCapacity(newCapacity: number): number {\n if (this.capacity >= newCapacity)\n return this.capacity;\n\n assert(this.growthFactor >= 1.0);\n newCapacity = Math.ceil(newCapacity * this.growthFactor);\n const prevData = this._data;\n this._data = new this._constructor(newCapacity);\n this._data.set(prevData, 0);\n\n assert(this.capacity === newCapacity);\n return this.capacity;\n }\n\n /** Append the specified value, resizing if necessary. */\n public push(value: number): void {\n this.ensureCapacity(this.length + 1);\n this._data[this.length] = value;\n ++this._length;\n }\n\n /** Append an array of values, resizing (at most once) if necessary. */\n public append(values: T): void {\n const newLength = this.length + values.length;\n this.ensureCapacity(newLength);\n this._data.set(values, this.length);\n this._length = newLength;\n }\n\n /** Obtain the finished array.\n * @param includeUnusedCapacity If true, the length of the returned array will be equal to [[capacity]], with extra bytes initialized to zero; otherwise, the\n * returned array's length will be equal to [[length]].\n */\n public toTypedArray(includeUnusedCapacity = false): T {\n if (includeUnusedCapacity)\n return this._data;\n\n const subarray = this._data.subarray(0, this.length);\n assert(subarray instanceof this._constructor);\n assert(subarray.buffer === this._data.buffer);\n return subarray;\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).\n * @public\n */\nexport class Uint8ArrayBuilder extends TypedArrayBuilder<Uint8Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint8Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint16Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array).\n * @public\n */\nexport class Uint16ArrayBuilder extends TypedArrayBuilder<Uint16Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint16Array, options);\n }\n}\n\n/** A [[TypedArrayBuilder]] for producing a [Uint32Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array).\n * @public\n */\nexport class Uint32ArrayBuilder extends TypedArrayBuilder<Uint32Array> {\n /** See [[TypedArrayBuilder]] constructor. */\n public constructor(options?: TypedArrayBuilderOptions) {\n super(Uint32Array, options);\n }\n\n /** Obtain a view of the finished array as an array of bytes. */\n public toUint8Array(includeUnusedCapacity = false): Uint8Array {\n if (includeUnusedCapacity)\n return new Uint8Array(this._data.buffer);\n\n return new Uint8Array(this._data.buffer, 0, this.length * 4);\n }\n}\n\n/** Options used to construct a [[UintArrayBuilder]].\n * @public\n */\nexport interface UintArrayBuilderOptions extends TypedArrayBuilderOptions {\n /** The type of the initial empty `TypedArray` created by the builder. For example, if you know that you will be adding values larger than\n * 255 to the array, specify `{ initialType: Uint16Array }` to avoid replacing the otherwise default `Uint8Array` when the first such value is added.\n * Default: `Uint8Array`.\n */\n initialType?: typeof Uint8Array | typeof Uint16Array | typeof Uint32Array;\n}\n\n/** A [[TypedArrayBuilder]] that can populate a [[UintArray]] with the minimum\n * [bytes per element](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) required.\n *\n * By default, the underlying array is a `Uint8Array`, though this can be configured via [[UintArrayBuilderOptions.initialType]].\n * As values are added to the array, if the bytes per element supported by the underlying array is too small to hold one of the new values, the array is\n * reallocated to a type large enough to hold all of the new values. For example, the following produces a `Uint8Array` because all values are less than 256:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 2, 254, 255]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint8Array);\n * ```\n *\n * However, the following produces a `Uint16Array` because one of the values is larger than 255 but none are larger than 65,535:\n *\n * ```ts\n * const builder = new UintArrayBuilder();\n * builder.append([1, 255, 257, 65535]);\n * const array = builder.toTypedArray();\n * assert(array instanceof Uint16Array);\n * ```\n *\n * @see [[Uint8ArrayBuilder]], [[Uint16ArrayBuilder]], or [[Uint32ArrayBuilder]] if you know the number of bytes you want to allocate for each element in the array.\n * @public\n */\nexport class UintArrayBuilder extends TypedArrayBuilder<UintArray> {\n public constructor(options?: UintArrayBuilderOptions) {\n super(options?.initialType ?? Uint8Array, options);\n }\n\n /** The number of bytes (1, 2, or 4) currently allocated per element by the underlying array.\n * This may change as larger values are added to the array.\n */\n public get bytesPerElement(): number {\n return this._data.BYTES_PER_ELEMENT;\n }\n\n /** Ensures that the underlying array is of a type that can contain the largest value in `newValues`.\n * For example, if `_data` is a `Uint16Array` and `newValues` contains any value(s) larger than 65,535, it will be replaced with a `Uint32Array`.\n * This method is invoked by [[push]] and [[append]].\n */\n protected ensureBytesPerElement(newValues: Iterable<number>): void {\n const curBytesPerElem = this.bytesPerElement;\n assert(curBytesPerElem === 1 || curBytesPerElem === 2 || curBytesPerElem === 4);\n if (curBytesPerElem >= 4)\n return;\n\n let neededBytesPerElem = curBytesPerElem;\n for (const value of newValues) {\n if (value > 0xffff) {\n neededBytesPerElem = 4;\n break;\n } else if (value > 0xff) {\n neededBytesPerElem = 2;\n }\n }\n\n if (neededBytesPerElem <= curBytesPerElem)\n return;\n\n this._constructor = neededBytesPerElem === 1 ? Uint8Array : (neededBytesPerElem === 2 ? Uint16Array : Uint32Array);\n this._data = new this._constructor(this._data);\n }\n\n /** See [[TypedArrayBuilder.push]]. */\n public override push(value: number): void {\n this.ensureBytesPerElement([value]);\n super.push(value);\n }\n\n /** See [[TypedArrayBuilder.append]]. */\n public override append(values: UintArray): void {\n this.ensureBytesPerElement(values);\n super.append(values);\n }\n}\n"]}
@@ -6,7 +6,6 @@
6
6
  /** @packageDocumentation
7
7
  * @module Errors
8
8
  */
9
- var _a;
10
9
  Object.defineProperty(exports, "__esModule", { value: true });
11
10
  exports.UnexpectedErrors = void 0;
12
11
  const Logger_1 = require("./Logger");
@@ -18,6 +17,16 @@ const Logger_1 = require("./Logger");
18
17
  * @public
19
18
  */
20
19
  class UnexpectedErrors {
20
+ /** handler for re-throwing exceptions directly */
21
+ static reThrowImmediate = (e) => { throw e; };
22
+ /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
23
+ static reThrowDeferred = (e) => setTimeout(() => { throw e; }, 0);
24
+ /** handler for logging exception to console */
25
+ static consoleLog = (e) => console.error(e); // eslint-disable-line no-console
26
+ /** handler for logging exception with [[Logger]] */
27
+ static errorLog = (e) => Logger_1.Logger.logException("unhandled", e);
28
+ static _telemetry = [];
29
+ static _handler = this.errorLog; // default to error logging
21
30
  constructor() { } // this is a singleton
22
31
  /** Add a "telemetry tracker" for unexpected errors. Useful for tracking/reporting errors without changing handler.
23
32
  * @returns a method to remove the tracker
@@ -55,15 +64,4 @@ class UnexpectedErrors {
55
64
  }
56
65
  }
57
66
  exports.UnexpectedErrors = UnexpectedErrors;
58
- _a = UnexpectedErrors;
59
- /** handler for re-throwing exceptions directly */
60
- UnexpectedErrors.reThrowImmediate = (e) => { throw e; };
61
- /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */
62
- UnexpectedErrors.reThrowDeferred = (e) => setTimeout(() => { throw e; }, 0);
63
- /** handler for logging exception to console */
64
- UnexpectedErrors.consoleLog = (e) => console.error(e); // eslint-disable-line no-console
65
- /** handler for logging exception with [[Logger]] */
66
- UnexpectedErrors.errorLog = (e) => Logger_1.Logger.logException("unhandled", e);
67
- UnexpectedErrors._telemetry = [];
68
- UnexpectedErrors._handler = _a.errorLog; // default to error logging
69
67
  //# sourceMappingURL=UnexpectedErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAEH,qCAAkC;AAOlC;;;;;;GAMG;AACH,MAAa,gBAAgB;IAY3B,gBAAwB,CAAC,CAAC,sBAAsB;IAEhD;;OAEG;IACI,MAAM,CAAC,YAAY,CAAC,OAA0B;QACnD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,KAAU,EAAE,eAAe,GAAG,IAAI;QACrD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACpC,IAAI,CAAC;oBACH,SAAS,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC;gBAAC,MAAM,CAAC;oBACP,wCAAwC;gBAC1C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,OAA0B;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;;AAhDH,4CAiDC;;AAhDC,kDAAkD;AAC3B,iCAAgB,GAAG,CAAC,CAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,AAA3B,CAA4B;AACnE,kHAAkH;AAC3F,gCAAe,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,AAAhD,CAAiD;AACvF,+CAA+C;AACxB,2BAAU,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,AAA/B,CAAgC,CAAC,iCAAiC;AACnG,oDAAoD;AAC7B,yBAAQ,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,eAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,AAAlD,CAAmD;AAEnE,2BAAU,GAAwB,EAAE,AAA1B,CAA2B;AACrC,yBAAQ,GAAG,EAAI,CAAC,QAAQ,AAAhB,CAAiB,CAAC,2BAA2B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Errors\n */\n\nimport { Logger } from \"./Logger\";\n\n/** A function to be notified when an unexpected error happens\n * @public\n */\nexport type OnUnexpectedError = (error: any) => void;\n\n/**\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\n * @public\n */\nexport class UnexpectedErrors {\n /** handler for re-throwing exceptions directly */\n public static readonly reThrowImmediate = (e: any) => { throw e; };\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\n /** handler for logging exception to console */\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\n /** handler for logging exception with [[Logger]] */\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\n\n private static _telemetry: OnUnexpectedError[] = [];\n private static _handler = this.errorLog; // default to error logging\n private constructor() { } // this is a singleton\n\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\n * @returns a method to remove the tracker\n */\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\n this._telemetry.push(tracker);\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\n }\n\n /** call this method when an unexpected error happens so the global handler can process it.\n * @param error the unexpected error\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\n */\n public static handle(error: any, notifyTelemetry = true): void {\n this._handler(error);\n if (notifyTelemetry) {\n this._telemetry.forEach((telemetry) => {\n try {\n telemetry(error);\n } catch {\n // ignore errors from telemetry trackers\n }\n });\n }\n }\n\n /** establish a new global *unexpected error* handler.\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\n * The default is [[errorLog]].\n * @returns the previous handler. Useful to temporarily change the handler.\n */\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\n const oldHandler = this._handler;\n this._handler = handler;\n return oldHandler;\n }\n}\n"]}
1
+ {"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/Unex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AC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBACpC,IAAI,CAAC;oBACH,SAAS,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC;gBAAC,MAAM,CAAC;oBACP,wCAAwC;gBAC1C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU,CAAC,OAA0B;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;;AAhDH,4CAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Errors\n */\n\nimport { Logger } from \"./Logger\";\n\n/** A function to be notified when an unexpected error happens\n * @public\n */\nexport type OnUnexpectedError = (error: any) => void;\n\n/**\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\n * @public\n */\nexport class UnexpectedErrors {\n /** handler for re-throwing exceptions directly */\n public static readonly reThrowImmediate = (e: any) => { throw e; };\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\n /** handler for logging exception to console */\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\n /** handler for logging exception with [[Logger]] */\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\n\n private static _telemetry: OnUnexpectedError[] = [];\n private static _handler = this.errorLog; // default to error logging\n private constructor() { } // this is a singleton\n\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\n * @returns a method to remove the tracker\n */\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\n this._telemetry.push(tracker);\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\n }\n\n /** call this method when an unexpected error happens so the global handler can process it.\n * @param error the unexpected error\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\n */\n public static handle(error: any, notifyTelemetry = true): void {\n this._handler(error);\n if (notifyTelemetry) {\n this._telemetry.forEach((telemetry) => {\n try {\n telemetry(error);\n } catch {\n // ignore errors from telemetry trackers\n }\n });\n }\n }\n\n /** establish a new global *unexpected error* handler.\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\n * The default is [[errorLog]].\n * @returns the previous handler. Useful to temporarily change the handler.\n */\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\n const oldHandler = this._handler;\n this._handler = handler;\n return oldHandler;\n }\n}\n"]}
@@ -20,11 +20,13 @@ const defaultYieldManagerOptions = {
20
20
  * @public
21
21
  */
22
22
  class YieldManager {
23
+ /** Options controlling the yield behavior. */
24
+ options;
25
+ _counter = 0;
23
26
  /** Constructor.
24
27
  * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.
25
28
  */
26
29
  constructor(options = {}) {
27
- this._counter = 0;
28
30
  this.options = { ...defaultYieldManagerOptions, ...options };
29
31
  }
30
32
  /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */
@@ -1 +1 @@
1
- {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAa,YAAY;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,CAAC;YACxB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAvBD,oCAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/** Options supplied to a [[YieldManager]].\n * @public\n */\nexport interface YieldManagerOptions {\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\n * Default: 1000.\n */\n iterationsBeforeYield?: number;\n}\n\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\n iterationsBeforeYield: 1000,\n};\n\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\n * It maintains a count of the number of iterations that have occurred since the last yield.\n * The constructor specifies how many iterations of the loop are permitted before yielding.\n * The loop should `await` [[allowYield]] on each iteration.\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\n * @public\n */\nexport class YieldManager {\n /** Options controlling the yield behavior. */\n public readonly options: Readonly<Required<YieldManagerOptions>>;\n private _counter = 0;\n\n /** Constructor.\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\n */\n public constructor(options: YieldManagerOptions = {}) {\n this.options = { ...defaultYieldManagerOptions, ...options };\n }\n\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\n public async allowYield() {\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\n if (this._counter === 0) {\n await this.actualYield();\n }\n }\n\n private async actualYield() {\n await new Promise((r) => setTimeout(r, 0));\n }\n}\n"]}
1
+ {"version":3,"file":"YieldManager.js","sourceRoot":"","sources":["../../src/YieldManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAYH,MAAM,0BAA0B,GAAkC;IAChE,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAa,YAAY;IACvB,8CAA8C;IAC9B,OAAO,CAA0C;IACzD,QAAQ,GAAG,CAAC,CAAC;IAErB;;OAEG;IACH,YAAmB,UAA+B,EAAE;QAClD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,0BAA0B,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/D,CAAC;IAED,oIAAoI;IAC7H,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAvBD,oCAuBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/** Options supplied to a [[YieldManager]].\n * @public\n */\nexport interface YieldManagerOptions {\n /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield.\n * Default: 1000.\n */\n iterationsBeforeYield?: number;\n}\n\nconst defaultYieldManagerOptions: Required<YieldManagerOptions> = {\n iterationsBeforeYield: 1000,\n};\n\n/** Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment.\n * This can alleviate [performance and memory consumption issues](https://github.com/nodejs/node-addon-api/issues/1140).\n * It maintains a count of the number of iterations that have occurred since the last yield.\n * The constructor specifies how many iterations of the loop are permitted before yielding.\n * The loop should `await` [[allowYield]] on each iteration.\n * [[allowYield]] will yield (and reset the iteration counter) if the counter exceeds the specified maximum.\n * @public\n */\nexport class YieldManager {\n /** Options controlling the yield behavior. */\n public readonly options: Readonly<Required<YieldManagerOptions>>;\n private _counter = 0;\n\n /** Constructor.\n * @param options Options customizing the yield behavior. Omitted properties are assigned their default values.\n */\n public constructor(options: YieldManagerOptions = {}) {\n this.options = { ...defaultYieldManagerOptions, ...options };\n }\n\n /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */\n public async allowYield() {\n this._counter = (this._counter + 1) % this.options.iterationsBeforeYield;\n if (this._counter === 0) {\n await this.actualYield();\n }\n }\n\n private async actualYield() {\n await new Promise((r) => setTimeout(r, 0));\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- export { staticLoggerMetadata } from "./staticLoggerMetadata";
2
1
  export { RepositoryStatus } from "./RepositoryStatus";
3
2
  export { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from "./BeSQLiteInternal";
4
3
  //# sourceMappingURL=cross-package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cross-package.d.ts","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"cross-package.d.ts","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
@@ -4,9 +4,7 @@
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DbValueType = exports.DbConflictResolution = exports.DbConflictCause = exports.DbChangeStage = exports.RepositoryStatus = exports.staticLoggerMetadata = void 0;
8
- var staticLoggerMetadata_1 = require("./staticLoggerMetadata");
9
- Object.defineProperty(exports, "staticLoggerMetadata", { enumerable: true, get: function () { return staticLoggerMetadata_1.staticLoggerMetadata; } });
7
+ exports.DbValueType = exports.DbConflictResolution = exports.DbConflictCause = exports.DbChangeStage = exports.RepositoryStatus = void 0;
10
8
  var RepositoryStatus_1 = require("./RepositoryStatus");
11
9
  Object.defineProperty(exports, "RepositoryStatus", { enumerable: true, get: function () { return RepositoryStatus_1.RepositoryStatus; } });
12
10
  var BeSQLiteInternal_1 = require("./BeSQLiteInternal");
@@ -1 +1 @@
1
- {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,uDAAuG;AAA9F,iHAAA,aAAa,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,+GAAA,WAAW,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nexport { staticLoggerMetadata } from \"./staticLoggerMetadata\";\nexport { RepositoryStatus } from \"./RepositoryStatus\";\nexport { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from \"./BeSQLiteInternal\";\n"]}
1
+ {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,uDAAuG;AAA9F,iHAAA,aAAa,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,+GAAA,WAAW,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nexport { RepositoryStatus } from \"./RepositoryStatus\";\nexport { DbChangeStage, DbConflictCause, DbConflictResolution, DbValueType } from \"./BeSQLiteInternal\";\n"]}
@@ -13,10 +13,8 @@ import { UnexpectedErrors } from "./UnexpectedErrors";
13
13
  * @public
14
14
  */
15
15
  export class BeEvent {
16
- constructor() {
17
- this._listeners = [];
18
- this._insideRaiseEvent = false;
19
- }
16
+ _listeners = [];
17
+ _insideRaiseEvent = false;
20
18
  /** The number of listeners currently subscribed to the event. */
21
19
  get numberOfListeners() { return this._listeners.length; }
22
20
  /**
@@ -125,9 +123,7 @@ export class BeUiEvent extends BeEvent {
125
123
  * @public
126
124
  */
127
125
  export class BeEventList {
128
- constructor() {
129
- this._events = {};
130
- }
126
+ _events = {};
131
127
  /**
132
128
  * Gets the event associated with the specified name, creating the event if it does not already exist.
133
129
  * @param name The name of the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C,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QAEhF,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED;;;OAGG;IACI,GAAG,CAAC,QAAW,EAAE,KAAW;QACjC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBACrD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6CAA6C;IACtC,KAAK,KAAW,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,OAAO,SAAsB,SAAQ,OAAmC;IAC5E,wDAAwD;IACjD,IAAI,CAAC,IAAgB,IAAU,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAAxB;QACU,YAAO,GAA+C,EAAE,CAAC;IAuBnE,CAAC;IArBC;;;OAGG;IACI,GAAG,CAAC,IAAY;QACrB,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QAEf,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Events\n */\n\nimport { UnexpectedErrors } from \"./UnexpectedErrors\";\n\n/** A function invoked when a BeEvent is raised.\n * @public\n */\nexport type Listener = (...arg: any[]) => void;\n\ninterface EventContext {\n listener: Listener | undefined;\n scope: any;\n once: boolean;\n}\n\n/**\n * Manages a set of *listeners* for a particular event and notifies them when the event is raised.\n * This class is usually instantiated inside of a container class and\n * exposed as a property for others to *subscribe* via [[BeEvent.addListener]].\n * @public\n */\nexport class BeEvent<T extends Listener> {\n private _listeners: EventContext[] = [];\n private _insideRaiseEvent: boolean = false;\n\n /** The number of listeners currently subscribed to the event. */\n public get numberOfListeners() { return this._listeners.length; }\n\n /**\n * Registers a Listener to be executed whenever this event is raised.\n * @param listener The function to be executed when the event is raised.\n * @param scope An optional object scope to serve as the 'this' pointer when listener is invoked.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addListener(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: false });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Registers a callback function to be executed *only once* when the event is raised.\n * @param listener The function to be executed once when the event is raised.\n * @param scope An optional object scope to serve as the `this` pointer in which the listener function will execute.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addOnce(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: true });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Un-register a previously registered listener.\n * @param listener The listener to be unregistered.\n * @param scope The scope that was originally passed to addListener.\n * @returns 'true' if the listener was removed; 'false' if the listener and scope are not registered with the event.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.addListener]]\n */\n public removeListener(listener: T, scope?: any): boolean {\n const listeners = this._listeners;\n\n for (let i = 0; i < listeners.length; ++i) {\n const context = listeners[i];\n if (context.listener === listener && context.scope === scope) {\n if (this._insideRaiseEvent) {\n context.listener = undefined;\n } else {\n listeners.splice(i, 1);\n }\n return true;\n }\n }\n return false;\n }\n\n /**\n * Raises the event by calling each registered listener with the supplied arguments.\n * @param args This method takes any number of parameters and passes them through to the listeners.\n * @see [[BeEvent.removeListener]], [[BeEvent.addListener]]\n */\n public raiseEvent(...args: Parameters<T>) {\n this._insideRaiseEvent = true;\n\n const listeners = this._listeners;\n const length = listeners.length;\n let dropped = false;\n\n for (let i = 0; i < length; ++i) {\n const context = listeners[i];\n if (!context.listener) {\n dropped = true;\n } else {\n try {\n context.listener.apply(context.scope, args);\n } catch (e) {\n UnexpectedErrors.handle(e);\n }\n if (context.once) {\n context.listener = undefined;\n dropped = true;\n }\n }\n }\n\n // if we had dropped listeners, remove them now\n if (dropped)\n this._listeners = this._listeners.filter((ctx) => ctx.listener !== undefined);\n\n this._insideRaiseEvent = false;\n }\n\n /** Determine whether this BeEvent has a specified listener registered.\n * @param listener The listener to check.\n * @param scope optional scope argument to match call to addListener\n */\n public has(listener: T, scope?: any): boolean {\n for (const ctx of this._listeners) {\n if (ctx.listener === listener && ctx.scope === scope) {\n return true;\n }\n }\n return false;\n }\n\n /** Clear all Listeners from this BeEvent. */\n public clear(): void { this._listeners.length = 0; }\n}\n\n/** Specialization of BeEvent for events that take a single strongly typed argument, primarily used for UI events.\n * @public\n */\nexport class BeUiEvent<TEventArgs> extends BeEvent<(args: TEventArgs) => void> {\n /** Raises event with single strongly typed argument. */\n public emit(args: TEventArgs): void { this.raiseEvent(args); }\n}\n\n/**\n * A list of BeEvent objects, accessible by an event name.\n * This class may be used instead of explicitly declaring each BeEvent as a member of a containing class.\n * @public\n */\nexport class BeEventList<T extends Listener> {\n private _events: { [name: string]: BeEvent<T> | undefined } = {};\n\n /**\n * Gets the event associated with the specified name, creating the event if it does not already exist.\n * @param name The name of the event.\n */\n public get(name: string): BeEvent<T> {\n let event = this._events[name];\n if (event)\n return event;\n\n event = new BeEvent();\n this._events[name] = event;\n return event;\n }\n\n /**\n * Removes the event associated with a name.\n * @param name The name of the event.\n */\n public remove(name: string): void {\n this._events[name] = undefined;\n }\n}\n\n/**\n * Retrieves the type of the callback function for an event type like [[BeEvent]].\n * For example:\n * ```ts\n * const event = new BeEvent<(x: number, y: string) => void>();\n * const callback: ListenerType<typeof event> = (x, y) => {\n * console.log(`${x}, ${y}`);\n * };\n * ```\n *\n * @public\n */\nexport type ListenerType<TEvent extends {\n addListener(listener: Listener): () => void;\n}> =\n TEvent extends {\n addListener(listener: infer TListener): () => void;\n } ? TListener : never;\n"]}
1
+ {"version":3,"file":"BeEvent.js","sourceRoot":"","sources":["../../src/BeEvent.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAatD;;;;;GAKG;AACH,MAAM,OAAO,OAAO;IACV,UAAU,GAAmB,EAAE,CAAC;IAChC,iBAAiB,GAAY,KAAK,CAAC;IAE3C,iEAAiE;IACjE,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE;;;;;;OAMG;IACI,WAAW,CAAC,QAAW,EAAE,KAAW;QACzC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,QAAW,EAAE,KAAW;QACrC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpD,CA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,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAY;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACjC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Events\n */\n\nimport { UnexpectedErrors } from \"./UnexpectedErrors\";\n\n/** A function invoked when a BeEvent is raised.\n * @public\n */\nexport type Listener = (...arg: any[]) => void;\n\ninterface EventContext {\n listener: Listener | undefined;\n scope: any;\n once: boolean;\n}\n\n/**\n * Manages a set of *listeners* for a particular event and notifies them when the event is raised.\n * This class is usually instantiated inside of a container class and\n * exposed as a property for others to *subscribe* via [[BeEvent.addListener]].\n * @public\n */\nexport class BeEvent<T extends Listener> {\n private _listeners: EventContext[] = [];\n private _insideRaiseEvent: boolean = false;\n\n /** The number of listeners currently subscribed to the event. */\n public get numberOfListeners() { return this._listeners.length; }\n\n /**\n * Registers a Listener to be executed whenever this event is raised.\n * @param listener The function to be executed when the event is raised.\n * @param scope An optional object scope to serve as the 'this' pointer when listener is invoked.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addListener(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: false });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Registers a callback function to be executed *only once* when the event is raised.\n * @param listener The function to be executed once when the event is raised.\n * @param scope An optional object scope to serve as the `this` pointer in which the listener function will execute.\n * @returns A function that will remove this event listener.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.removeListener]]\n */\n public addOnce(listener: T, scope?: any): () => void {\n this._listeners.push({ listener, scope, once: true });\n return () => this.removeListener(listener, scope);\n }\n\n /**\n * Un-register a previously registered listener.\n * @param listener The listener to be unregistered.\n * @param scope The scope that was originally passed to addListener.\n * @returns 'true' if the listener was removed; 'false' if the listener and scope are not registered with the event.\n * @see [[BeEvent.raiseEvent]], [[BeEvent.addListener]]\n */\n public removeListener(listener: T, scope?: any): boolean {\n const listeners = this._listeners;\n\n for (let i = 0; i < listeners.length; ++i) {\n const context = listeners[i];\n if (context.listener === listener && context.scope === scope) {\n if (this._insideRaiseEvent) {\n context.listener = undefined;\n } else {\n listeners.splice(i, 1);\n }\n return true;\n }\n }\n return false;\n }\n\n /**\n * Raises the event by calling each registered listener with the supplied arguments.\n * @param args This method takes any number of parameters and passes them through to the listeners.\n * @see [[BeEvent.removeListener]], [[BeEvent.addListener]]\n */\n public raiseEvent(...args: Parameters<T>) {\n this._insideRaiseEvent = true;\n\n const listeners = this._listeners;\n const length = listeners.length;\n let dropped = false;\n\n for (let i = 0; i < length; ++i) {\n const context = listeners[i];\n if (!context.listener) {\n dropped = true;\n } else {\n try {\n context.listener.apply(context.scope, args);\n } catch (e) {\n UnexpectedErrors.handle(e);\n }\n if (context.once) {\n context.listener = undefined;\n dropped = true;\n }\n }\n }\n\n // if we had dropped listeners, remove them now\n if (dropped)\n this._listeners = this._listeners.filter((ctx) => ctx.listener !== undefined);\n\n this._insideRaiseEvent = false;\n }\n\n /** Determine whether this BeEvent has a specified listener registered.\n * @param listener The listener to check.\n * @param scope optional scope argument to match call to addListener\n */\n public has(listener: T, scope?: any): boolean {\n for (const ctx of this._listeners) {\n if (ctx.listener === listener && ctx.scope === scope) {\n return true;\n }\n }\n return false;\n }\n\n /** Clear all Listeners from this BeEvent. */\n public clear(): void { this._listeners.length = 0; }\n}\n\n/** Specialization of BeEvent for events that take a single strongly typed argument, primarily used for UI events.\n * @public\n */\nexport class BeUiEvent<TEventArgs> extends BeEvent<(args: TEventArgs) => void> {\n /** Raises event with single strongly typed argument. */\n public emit(args: TEventArgs): void { this.raiseEvent(args); }\n}\n\n/**\n * A list of BeEvent objects, accessible by an event name.\n * This class may be used instead of explicitly declaring each BeEvent as a member of a containing class.\n * @public\n */\nexport class BeEventList<T extends Listener> {\n private _events: { [name: string]: BeEvent<T> | undefined } = {};\n\n /**\n * Gets the event associated with the specified name, creating the event if it does not already exist.\n * @param name The name of the event.\n */\n public get(name: string): BeEvent<T> {\n let event = this._events[name];\n if (event)\n return event;\n\n event = new BeEvent();\n this._events[name] = event;\n return event;\n }\n\n /**\n * Removes the event associated with a name.\n * @param name The name of the event.\n */\n public remove(name: string): void {\n this._events[name] = undefined;\n }\n}\n\n/**\n * Retrieves the type of the callback function for an event type like [[BeEvent]].\n * For example:\n * ```ts\n * const event = new BeEvent<(x: number, y: string) => void>();\n * const callback: ListenerType<typeof event> = (x, y) => {\n * console.log(`${x}, ${y}`);\n * };\n * ```\n *\n * @public\n */\nexport type ListenerType<TEvent extends {\n addListener(listener: Listener): () => void;\n}> =\n TEvent extends {\n addListener(listener: infer TListener): () => void;\n } ? TListener : never;\n"]}
@@ -265,6 +265,9 @@ export declare enum GeoServiceStatus {
265
265
  NoDatumConverter = 147459,
266
266
  VerticalDatumConvertError = 147460,
267
267
  CSMapError = 147461,
268
+ /**
269
+ * @deprecated in 5.0. This status is never returned.
270
+ */
268
271
  Pending = 147462
269
272
  }
270
273
  /** Error status from various reality data operations
@@ -1 +1 @@
1
- {"version":3,"file":"BentleyError.d.ts","sourceRoot":"","sources":["../../src/BentleyError.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH;;;;;GAKG;AACH,oBAAY,aAAa;IACvB,OAAO,IAAS;IAChB,KAAK,QAAS;CACf;AAED;;;GAGG;AACH,oBAAY,YAAY;IACtB,iBAAiB,QAAU;IAC3B,OAAO,IAAI;IACX,aAAa,QAAwB;IACrC,WAAW,QAAwB;IACnC,MAAM,QAAwB;IAC9B,UAAU,QAAwB;IAClC,QAAQ,QAAwB;IAChC,UAAU,QAAwB;IAClC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;WAC9D,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAIxE,mHAAmH;IACnH,SAAS,CAAC,SAAS,IAAI,MAAM;IA0R7B;;;OAGG;WACW,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAsBrD;;;OAGG;WACW,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAO/D;;;;OAIG;WACW,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAUlE;;;;OAIG;WACW,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU;CAexD"}
@@ -282,6 +282,9 @@ export var GeoServiceStatus;
282
282
  GeoServiceStatus[GeoServiceStatus["NoDatumConverter"] = 147459] = "NoDatumConverter";
283
283
  GeoServiceStatus[GeoServiceStatus["VerticalDatumConvertError"] = 147460] = "VerticalDatumConvertError";
284
284
  GeoServiceStatus[GeoServiceStatus["CSMapError"] = 147461] = "CSMapError";
285
+ /**
286
+ * @deprecated in 5.0. This status is never returned.
287
+ */
285
288
  GeoServiceStatus[GeoServiceStatus["Pending"] = 147462] = "Pending";
286
289
  })(GeoServiceStatus || (GeoServiceStatus = {}));
287
290
  /** Error status from various reality data operations
@@ -300,6 +303,8 @@ function isObject(obj) {
300
303
  * @public
301
304
  */
302
305
  export class BentleyError extends Error {
306
+ errorNumber;
307
+ _metaData;
303
308
  /**
304
309
  * @param errorNumber The a number that identifies of the problem.
305
310
  * @param message message that describes the problem (should not be localized).
@@ -591,7 +596,7 @@ export class BentleyError extends Error {
591
596
  case GeoServiceStatus.NoDatumConverter: return "No datum converter";
592
597
  case GeoServiceStatus.VerticalDatumConvertError: return "Vertical datum convert error";
593
598
  case GeoServiceStatus.CSMapError: return "CSMap error";
594
- case GeoServiceStatus.Pending: return "Pending";
599
+ case GeoServiceStatus.Pending: return "Pending"; // eslint-disable-line @typescript-eslint/no-deprecated
595
600
  case RealityDataStatus.InvalidData: return "Invalid or unknown data";
596
601
  case DbResult.BE_SQLITE_OK:
597
602
  case DbResult.BE_SQLITE_ROW: