@itwin/core-bentley 4.10.0-dev.8 → 5.0.0-dev.0

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 (73) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/lib/cjs/Assert.js +1 -2
  3. package/lib/cjs/Assert.js.map +1 -1
  4. package/lib/cjs/BeSQLite.d.ts.map +1 -1
  5. package/lib/cjs/BeSQLite.js +0 -2
  6. package/lib/cjs/BeSQLite.js.map +1 -1
  7. package/lib/cjs/ByteStream.js +2 -2
  8. package/lib/cjs/ByteStream.js.map +1 -1
  9. package/lib/cjs/ClassUtils.js +2 -3
  10. package/lib/cjs/ClassUtils.js.map +1 -1
  11. package/lib/cjs/Compare.js +9 -10
  12. package/lib/cjs/Compare.js.map +1 -1
  13. package/lib/cjs/CompressedId64Set.d.ts +1 -1
  14. package/lib/cjs/Disposable.d.ts.map +1 -1
  15. package/lib/cjs/Disposable.js +5 -6
  16. package/lib/cjs/Disposable.js.map +1 -1
  17. package/lib/cjs/Id.js +1 -1
  18. package/lib/cjs/Id.js.map +1 -1
  19. package/lib/cjs/JsonUtils.d.ts +1 -1
  20. package/lib/cjs/JsonUtils.js.map +1 -1
  21. package/lib/cjs/ObservableSet.js.map +1 -1
  22. package/lib/cjs/ProcessDetector.js +1 -1
  23. package/lib/cjs/ProcessDetector.js.map +1 -1
  24. package/lib/cjs/SortedArray.js +3 -3
  25. package/lib/cjs/SortedArray.js.map +1 -1
  26. package/lib/cjs/StringUtils.js +3 -4
  27. package/lib/cjs/StringUtils.js.map +1 -1
  28. package/lib/cjs/Time.d.ts.map +1 -1
  29. package/lib/cjs/Tracing.js +3 -3
  30. package/lib/cjs/Tracing.js.map +1 -1
  31. package/lib/cjs/UnexpectedErrors.d.ts +0 -1
  32. package/lib/cjs/UnexpectedErrors.d.ts.map +1 -1
  33. package/lib/cjs/UnexpectedErrors.js +1 -1
  34. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  35. package/lib/cjs/UtilityTypes.d.ts +7 -3
  36. package/lib/cjs/UtilityTypes.d.ts.map +1 -1
  37. package/lib/cjs/UtilityTypes.js +3 -4
  38. package/lib/cjs/UtilityTypes.js.map +1 -1
  39. package/lib/cjs/internal/staticLoggerMetadata.d.ts +1 -1
  40. package/lib/cjs/internal/staticLoggerMetadata.js.map +1 -1
  41. package/lib/cjs/partitionArray.js +1 -2
  42. package/lib/cjs/partitionArray.js.map +1 -1
  43. package/lib/esm/BeSQLite.d.ts.map +1 -1
  44. package/lib/esm/BeSQLite.js +0 -2
  45. package/lib/esm/BeSQLite.js.map +1 -1
  46. package/lib/esm/ByteStream.js +2 -2
  47. package/lib/esm/ByteStream.js.map +1 -1
  48. package/lib/esm/CompressedId64Set.d.ts +1 -1
  49. package/lib/esm/Disposable.d.ts.map +1 -1
  50. package/lib/esm/Disposable.js +0 -1
  51. package/lib/esm/Disposable.js.map +1 -1
  52. package/lib/esm/Id.js +1 -1
  53. package/lib/esm/Id.js.map +1 -1
  54. package/lib/esm/JsonUtils.d.ts +1 -1
  55. package/lib/esm/JsonUtils.js.map +1 -1
  56. package/lib/esm/ObservableSet.js.map +1 -1
  57. package/lib/esm/ProcessDetector.js +1 -1
  58. package/lib/esm/ProcessDetector.js.map +1 -1
  59. package/lib/esm/StringUtils.js +1 -1
  60. package/lib/esm/StringUtils.js.map +1 -1
  61. package/lib/esm/Time.d.ts.map +1 -1
  62. package/lib/esm/Tracing.js +3 -3
  63. package/lib/esm/Tracing.js.map +1 -1
  64. package/lib/esm/UnexpectedErrors.d.ts +0 -1
  65. package/lib/esm/UnexpectedErrors.d.ts.map +1 -1
  66. package/lib/esm/UnexpectedErrors.js +1 -1
  67. package/lib/esm/UnexpectedErrors.js.map +1 -1
  68. package/lib/esm/UtilityTypes.d.ts +7 -3
  69. package/lib/esm/UtilityTypes.d.ts.map +1 -1
  70. package/lib/esm/UtilityTypes.js.map +1 -1
  71. package/lib/esm/internal/staticLoggerMetadata.d.ts +1 -1
  72. package/lib/esm/internal/staticLoggerMetadata.js.map +1 -1
  73. package/package.json +10 -15
@@ -69,7 +69,7 @@ function* getFlatEntries(obj, path = "") {
69
69
  function flattenObject(obj) {
70
70
  return Object.fromEntries(getFlatEntries(obj));
71
71
  }
72
- /* eslint-disable deprecation/deprecation -- lots of self-references here... */
72
+ /* eslint-disable @typescript-eslint/no-deprecated -- lots of self-references here... */
73
73
  /**
74
74
  * Enables OpenTelemetry tracing in addition to traditional logging.
75
75
  * @public
@@ -141,7 +141,7 @@ class Tracing {
141
141
  loggerCategory: category,
142
142
  });
143
143
  }
144
- catch (_e) { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work
144
+ catch { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work
145
145
  const spanContext = Tracing._openTelemetry.trace.getSpan(oTelContext)?.spanContext();
146
146
  base(category, message, {
147
147
  ...serializedMetadata,
@@ -162,5 +162,5 @@ class Tracing {
162
162
  }
163
163
  }
164
164
  exports.Tracing = Tracing;
165
- /* eslint-enable deprecation/deprecation */
165
+ /* eslint-enable @typescript-eslint/no-deprecated */
166
166
  //# sourceMappingURL=Tracing.js.map
@@ -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,6G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AC,CAAC,mHAAmH;gBAEpI,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;gBACrF,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE;oBACtB,GAAG,kBAAkB;oBACrB,yDAAyD;oBACzD,QAAQ,EAAE,WAAW,EAAE,OAAO;oBAC9B,OAAO,EAAE,WAAW,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,2CAA2C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\nimport type { ContextAPI, SpanAttributes, SpanAttributeValue, SpanContext, SpanOptions, TraceAPI, Tracer } from \"@opentelemetry/api\";\r\nimport { LogFunction, Logger, LogLevel } from \"./Logger\";\r\n\r\n// re-export so that consumers can construct full SpanOptions object without external dependencies\r\n/**\r\n * Mirrors the SpanKind enum from [@opentelemetry/api](https://open-telemetry.github.io/opentelemetry-js/enums/_opentelemetry_api.SpanKind.html)\r\n * @public\r\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\r\n */\r\nexport enum SpanKind {\r\n INTERNAL = 0,\r\n SERVER = 1,\r\n CLIENT = 2,\r\n PRODUCER = 3,\r\n CONSUMER = 4\r\n}\r\n\r\nfunction isValidPrimitive(val: unknown): val is SpanAttributeValue {\r\n return typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\";\r\n}\r\n\r\n// Only _homogenous_ arrays of strings, numbers, or booleans are supported as OpenTelemetry Attribute values.\r\n// Per the spec (https://opentelemetry.io/docs/reference/specification/common/common/#attribute), empty arrays and null values are supported too.\r\nfunction isValidPrimitiveArray(val: unknown): val is SpanAttributeValue {\r\n if (!Array.isArray(val))\r\n return false;\r\n\r\n let itemType;\r\n for (const x of val) {\r\n if (x === undefined || x === null)\r\n continue;\r\n\r\n if (!itemType) {\r\n itemType = typeof x;\r\n if (!isValidPrimitive(x))\r\n return false;\r\n }\r\n\r\n if (typeof x !== itemType)\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction isPlainObject(obj: unknown): obj is object {\r\n return typeof obj === \"object\" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\r\n}\r\n\r\nfunction* getFlatEntries(obj: unknown, path = \"\"): Iterable<[string, SpanAttributeValue]> {\r\n if (isValidPrimitiveArray(obj)) {\r\n yield [path, obj];\r\n return;\r\n }\r\n\r\n // Prefer JSON serialization over flattening for any non-POJO types.\r\n // There's just too many ways trying to flatten those can go wrong (Dates, Buffers, TypedArrays, etc.)\r\n if (!isPlainObject(obj) && !Array.isArray(obj)) {\r\n yield [path, isValidPrimitive(obj) ? obj : JSON.stringify(obj)];\r\n return;\r\n }\r\n\r\n // Always serialize empty objects/arrays as empty array values\r\n const entries = Object.entries(obj);\r\n if (entries.length === 0)\r\n yield [path, []];\r\n\r\n for (const [key, val] of entries)\r\n yield* getFlatEntries(val, (path === \"\") ? key : `${path}.${key}`);\r\n}\r\n\r\nfunction flattenObject(obj: object): SpanAttributes {\r\n return Object.fromEntries(getFlatEntries(obj));\r\n}\r\n\r\n/* eslint-disable deprecation/deprecation -- lots of self-references here... */\r\n\r\n/**\r\n * Enables OpenTelemetry tracing in addition to traditional logging.\r\n * @public\r\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\r\n */\r\nexport class Tracing {\r\n private static _tracer?: Tracer;\r\n private static _openTelemetry?: { trace: Pick<TraceAPI, \"setSpan\" | \"setSpanContext\" | \"getSpan\">, context: Pick<ContextAPI, \"active\" | \"with\"> };\r\n\r\n /**\r\n * If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.\r\n * If OpenTelemetry tracing is _not_ enabled, runs the provided function.\r\n * @param name name of the new span\r\n * @param fn function to run inside the new span\r\n * @param options span options\r\n * @param parentContext optional context used to retrieve parent span id\r\n */\r\n public static async withSpan<T>(name: string, fn: () => Promise<T>, options?: SpanOptions, parentContext?: SpanContext): Promise<T> {\r\n if (Tracing._tracer === undefined || Tracing._openTelemetry === undefined)\r\n return fn();\r\n\r\n // this case is for context propagation - parentContext is typically constructed from HTTP headers\r\n const parent = parentContext === undefined\r\n ? Tracing._openTelemetry.context.active()\r\n : Tracing._openTelemetry.trace.setSpanContext(Tracing._openTelemetry.context.active(), parentContext);\r\n\r\n return Tracing._openTelemetry.context.with(\r\n Tracing._openTelemetry.trace.setSpan(\r\n parent,\r\n Tracing._tracer.startSpan(name, options, Tracing._openTelemetry.context.active()),\r\n ),\r\n async () => {\r\n try {\r\n return await fn();\r\n } catch (err) {\r\n if (err instanceof Error) // ignore non-Error throws, such as RpcControlResponse\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttribute(\"error\", true);\r\n throw err;\r\n } finally {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.end();\r\n }\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Adds a span event describing a runtime exception, as advised in OpenTelemetry documentation\r\n * @param e error (exception) object\r\n */\r\n public static recordException(e: Error) {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.recordException(e);\r\n }\r\n\r\n /**\r\n * Enable logging to OpenTelemetry. [[Tracing.withSpan]] will be enabled, all log entries will be attached to active span as span events.\r\n * [IModelHost.startup]($backend) will call this automatically if the `enableOpenTelemetry` option is enabled and it succeeds in requiring `@opentelemetry/api`.\r\n * @note Node.js OpenTelemetry SDK should be initialized by the user.\r\n */\r\n public static enableOpenTelemetry(tracer: Tracer, api: typeof Tracing._openTelemetry) {\r\n Tracing._tracer = tracer;\r\n Tracing._openTelemetry = api;\r\n Logger.logTrace = Tracing.withOpenTelemetry(LogLevel.Trace, Logger.logTrace.bind(Logger)).bind(Logger);\r\n Logger.logInfo = Tracing.withOpenTelemetry(LogLevel.Info, Logger.logInfo.bind(Logger)).bind(Logger);\r\n Logger.logWarning = Tracing.withOpenTelemetry(LogLevel.Warning, Logger.logWarning.bind(Logger)).bind(Logger);\r\n Logger.logError = Tracing.withOpenTelemetry(LogLevel.Error, Logger.logError.bind(Logger)).bind(Logger);\r\n }\r\n\r\n private static withOpenTelemetry(level: LogLevel, base: LogFunction, isError: boolean = false): LogFunction {\r\n return (category, message, metaData) => {\r\n const oTelContext = Tracing._openTelemetry?.context.active();\r\n if(Tracing._openTelemetry === undefined || oTelContext === undefined)\r\n return base(category, message, metaData);\r\n\r\n const serializedMetadata = Logger.getMetaData(metaData);\r\n if(Logger.isEnabled(category, level)) {\r\n try {\r\n Tracing._openTelemetry?.trace\r\n .getSpan(Tracing._openTelemetry.context.active())\r\n ?.addEvent(message, {\r\n ...flattenObject(serializedMetadata),\r\n error: isError,\r\n loggerCategory: category,\r\n });\r\n } catch (_e) { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work\r\n\r\n const spanContext = Tracing._openTelemetry.trace.getSpan(oTelContext)?.spanContext();\r\n base(category, message, {\r\n ...serializedMetadata,\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n trace_id: spanContext?.traceId,\r\n span_id: spanContext?.spanId,\r\n trace_flags: spanContext?.traceFlags,\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n });\r\n }\r\n };\r\n }\r\n\r\n /** Set attributes on currently active openTelemetry span. Doesn't do anything if openTelemetry logging is not initialized.\r\n * @param attributes The attributes to set\r\n */\r\n public static setAttributes(attributes: SpanAttributes) {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttributes(attributes);\r\n }\r\n}\r\n\r\n/* eslint-enable deprecation/deprecation */\r\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,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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c,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAC5G,CAAC;CACF;AAnGD,0BAmGC;AAED,oDAAoD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\nimport type { ContextAPI, SpanAttributes, SpanAttributeValue, SpanContext, SpanOptions, TraceAPI, Tracer } from \"@opentelemetry/api\";\r\nimport { LogFunction, Logger, LogLevel } from \"./Logger\";\r\n\r\n// re-export so that consumers can construct full SpanOptions object without external dependencies\r\n/**\r\n * Mirrors the SpanKind enum from [@opentelemetry/api](https://open-telemetry.github.io/opentelemetry-js/enums/_opentelemetry_api.SpanKind.html)\r\n * @public\r\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\r\n */\r\nexport enum SpanKind {\r\n INTERNAL = 0,\r\n SERVER = 1,\r\n CLIENT = 2,\r\n PRODUCER = 3,\r\n CONSUMER = 4\r\n}\r\n\r\nfunction isValidPrimitive(val: unknown): val is SpanAttributeValue {\r\n return typeof val === \"string\" || typeof val === \"number\" || typeof val === \"boolean\";\r\n}\r\n\r\n// Only _homogenous_ arrays of strings, numbers, or booleans are supported as OpenTelemetry Attribute values.\r\n// Per the spec (https://opentelemetry.io/docs/reference/specification/common/common/#attribute), empty arrays and null values are supported too.\r\nfunction isValidPrimitiveArray(val: unknown): val is SpanAttributeValue {\r\n if (!Array.isArray(val))\r\n return false;\r\n\r\n let itemType;\r\n for (const x of val) {\r\n if (x === undefined || x === null)\r\n continue;\r\n\r\n if (!itemType) {\r\n itemType = typeof x;\r\n if (!isValidPrimitive(x))\r\n return false;\r\n }\r\n\r\n if (typeof x !== itemType)\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction isPlainObject(obj: unknown): obj is object {\r\n return typeof obj === \"object\" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;\r\n}\r\n\r\nfunction* getFlatEntries(obj: unknown, path = \"\"): Iterable<[string, SpanAttributeValue]> {\r\n if (isValidPrimitiveArray(obj)) {\r\n yield [path, obj];\r\n return;\r\n }\r\n\r\n // Prefer JSON serialization over flattening for any non-POJO types.\r\n // There's just too many ways trying to flatten those can go wrong (Dates, Buffers, TypedArrays, etc.)\r\n if (!isPlainObject(obj) && !Array.isArray(obj)) {\r\n yield [path, isValidPrimitive(obj) ? obj : JSON.stringify(obj)];\r\n return;\r\n }\r\n\r\n // Always serialize empty objects/arrays as empty array values\r\n const entries = Object.entries(obj);\r\n if (entries.length === 0)\r\n yield [path, []];\r\n\r\n for (const [key, val] of entries)\r\n yield* getFlatEntries(val, (path === \"\") ? key : `${path}.${key}`);\r\n}\r\n\r\nfunction flattenObject(obj: object): SpanAttributes {\r\n return Object.fromEntries(getFlatEntries(obj));\r\n}\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated -- lots of self-references here... */\r\n\r\n/**\r\n * Enables OpenTelemetry tracing in addition to traditional logging.\r\n * @public\r\n * @deprecated in 4.4 - OpenTelemetry Tracing helpers will become internal in a future release. Apps should use `@opentelemetry/api` directly.\r\n */\r\nexport class Tracing {\r\n private static _tracer?: Tracer;\r\n private static _openTelemetry?: { trace: Pick<TraceAPI, \"setSpan\" | \"setSpanContext\" | \"getSpan\">, context: Pick<ContextAPI, \"active\" | \"with\"> };\r\n\r\n /**\r\n * If OpenTelemetry tracing is enabled, creates a new span and runs the provided function in it.\r\n * If OpenTelemetry tracing is _not_ enabled, runs the provided function.\r\n * @param name name of the new span\r\n * @param fn function to run inside the new span\r\n * @param options span options\r\n * @param parentContext optional context used to retrieve parent span id\r\n */\r\n public static async withSpan<T>(name: string, fn: () => Promise<T>, options?: SpanOptions, parentContext?: SpanContext): Promise<T> {\r\n if (Tracing._tracer === undefined || Tracing._openTelemetry === undefined)\r\n return fn();\r\n\r\n // this case is for context propagation - parentContext is typically constructed from HTTP headers\r\n const parent = parentContext === undefined\r\n ? Tracing._openTelemetry.context.active()\r\n : Tracing._openTelemetry.trace.setSpanContext(Tracing._openTelemetry.context.active(), parentContext);\r\n\r\n return Tracing._openTelemetry.context.with(\r\n Tracing._openTelemetry.trace.setSpan(\r\n parent,\r\n Tracing._tracer.startSpan(name, options, Tracing._openTelemetry.context.active()),\r\n ),\r\n async () => {\r\n try {\r\n return await fn();\r\n } catch (err) {\r\n if (err instanceof Error) // ignore non-Error throws, such as RpcControlResponse\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttribute(\"error\", true);\r\n throw err;\r\n } finally {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.end();\r\n }\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Adds a span event describing a runtime exception, as advised in OpenTelemetry documentation\r\n * @param e error (exception) object\r\n */\r\n public static recordException(e: Error) {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.recordException(e);\r\n }\r\n\r\n /**\r\n * Enable logging to OpenTelemetry. [[Tracing.withSpan]] will be enabled, all log entries will be attached to active span as span events.\r\n * [IModelHost.startup]($backend) will call this automatically if the `enableOpenTelemetry` option is enabled and it succeeds in requiring `@opentelemetry/api`.\r\n * @note Node.js OpenTelemetry SDK should be initialized by the user.\r\n */\r\n public static enableOpenTelemetry(tracer: Tracer, api: typeof Tracing._openTelemetry) {\r\n Tracing._tracer = tracer;\r\n Tracing._openTelemetry = api;\r\n Logger.logTrace = Tracing.withOpenTelemetry(LogLevel.Trace, Logger.logTrace.bind(Logger)).bind(Logger);\r\n Logger.logInfo = Tracing.withOpenTelemetry(LogLevel.Info, Logger.logInfo.bind(Logger)).bind(Logger);\r\n Logger.logWarning = Tracing.withOpenTelemetry(LogLevel.Warning, Logger.logWarning.bind(Logger)).bind(Logger);\r\n Logger.logError = Tracing.withOpenTelemetry(LogLevel.Error, Logger.logError.bind(Logger)).bind(Logger);\r\n }\r\n\r\n private static withOpenTelemetry(level: LogLevel, base: LogFunction, isError: boolean = false): LogFunction {\r\n return (category, message, metaData) => {\r\n const oTelContext = Tracing._openTelemetry?.context.active();\r\n if(Tracing._openTelemetry === undefined || oTelContext === undefined)\r\n return base(category, message, metaData);\r\n\r\n const serializedMetadata = Logger.getMetaData(metaData);\r\n if(Logger.isEnabled(category, level)) {\r\n try {\r\n Tracing._openTelemetry?.trace\r\n .getSpan(Tracing._openTelemetry.context.active())\r\n ?.addEvent(message, {\r\n ...flattenObject(serializedMetadata),\r\n error: isError,\r\n loggerCategory: category,\r\n });\r\n } catch { } // avoid throwing random errors (with stack trace mangled by async hooks) when openTelemetry collector doesn't work\r\n\r\n const spanContext = Tracing._openTelemetry.trace.getSpan(oTelContext)?.spanContext();\r\n base(category, message, {\r\n ...serializedMetadata,\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n trace_id: spanContext?.traceId,\r\n span_id: spanContext?.spanId,\r\n trace_flags: spanContext?.traceFlags,\r\n /* eslint-enable @typescript-eslint/naming-convention */\r\n });\r\n }\r\n };\r\n }\r\n\r\n /** Set attributes on currently active openTelemetry span. Doesn't do anything if openTelemetry logging is not initialized.\r\n * @param attributes The attributes to set\r\n */\r\n public static setAttributes(attributes: SpanAttributes) {\r\n Tracing._openTelemetry?.trace.getSpan(Tracing._openTelemetry.context.active())?.setAttributes(attributes);\r\n }\r\n}\r\n\r\n/* eslint-enable @typescript-eslint/no-deprecated */\r\n"]}
@@ -1,7 +1,6 @@
1
1
  /** @packageDocumentation
2
2
  * @module Errors
3
3
  */
4
- /// <reference types="node" />
5
4
  /** A function to be notified when an unexpected error happens
6
5
  * @public
7
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"UnexpectedErrors.d.ts","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAIH;;GAEG;AACH,MAA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OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAKlE;;;OAGG;WACW,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,eAAe,UAAO,GAAG,IAAI;IAa9D;;;;OAIG;WACW,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,iBAAiB;CAKxE"}
@@ -37,7 +37,7 @@ class UnexpectedErrors {
37
37
  try {
38
38
  telemetry(error);
39
39
  }
40
- catch (_) {
40
+ catch {
41
41
  // ignore errors from telemetry trackers
42
42
  }
43
43
  });
@@ -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,OAAO,CAAC,EAAE,CAAC;oBACX,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Errors\r\n */\r\n\r\nimport { Logger } from \"./Logger\";\r\n\r\n/** A function to be notified when an unexpected error happens\r\n * @public\r\n */\r\nexport type OnUnexpectedError = (error: any) => void;\r\n\r\n/**\r\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\r\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\r\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\r\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\r\n * @public\r\n */\r\nexport class UnexpectedErrors {\r\n /** handler for re-throwing exceptions directly */\r\n public static readonly reThrowImmediate = (e: any) => { throw e; };\r\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\r\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\r\n /** handler for logging exception to console */\r\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\r\n /** handler for logging exception with [[Logger]] */\r\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\r\n\r\n private static _telemetry: OnUnexpectedError[] = [];\r\n private static _handler = this.errorLog; // default to error logging\r\n private constructor() { } // this is a singleton\r\n\r\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\r\n * @returns a method to remove the tracker\r\n */\r\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\r\n this._telemetry.push(tracker);\r\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\r\n }\r\n\r\n /** call this method when an unexpected error happens so the global handler can process it.\r\n * @param error the unexpected error\r\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\r\n */\r\n public static handle(error: any, notifyTelemetry = true): void {\r\n this._handler(error);\r\n if (notifyTelemetry) {\r\n this._telemetry.forEach((telemetry) => {\r\n try {\r\n telemetry(error);\r\n } catch (_) {\r\n // ignore errors from telemetry trackers\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** establish a new global *unexpected error* handler.\r\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\r\n * The default is [[errorLog]].\r\n * @returns the previous handler. Useful to temporarily change the handler.\r\n */\r\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\r\n const oldHandler = this._handler;\r\n this._handler = handler;\r\n return oldHandler;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UnexpectedErrors.js","sourceRoot":"","sources":["../../src/UnexpectedErrors.ts"],"names":[],"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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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Errors\r\n */\r\n\r\nimport { Logger } from \"./Logger\";\r\n\r\n/** A function to be notified when an unexpected error happens\r\n * @public\r\n */\r\nexport type OnUnexpectedError = (error: any) => void;\r\n\r\n/**\r\n * Utility for handling/reporting unexpected runtime errors. This class establishes a global handler for\r\n * unexpected errors, and programmers should use its `handle` method when they occur. Generally, unexpected\r\n * errors should not cause program termination, and should instead be logged and swallowed. However, for\r\n * development/debugging, it can be helpful to re-throw exceptions so they are not missed.\r\n * @public\r\n */\r\nexport class UnexpectedErrors {\r\n /** handler for re-throwing exceptions directly */\r\n public static readonly reThrowImmediate = (e: any) => { throw e; };\r\n /** handler for re-throwing exceptions from an asynchronous interval (so the current call stack is not aborted) */\r\n public static readonly reThrowDeferred = (e: any) => setTimeout(() => { throw e; }, 0);\r\n /** handler for logging exception to console */\r\n public static readonly consoleLog = (e: any) => console.error(e); // eslint-disable-line no-console\r\n /** handler for logging exception with [[Logger]] */\r\n public static readonly errorLog = (e: any) => Logger.logException(\"unhandled\", e);\r\n\r\n private static _telemetry: OnUnexpectedError[] = [];\r\n private static _handler = this.errorLog; // default to error logging\r\n private constructor() { } // this is a singleton\r\n\r\n /** Add a \"telemetry tracker\" for unexpected errors. Useful for tracking/reporting errors without changing handler.\r\n * @returns a method to remove the tracker\r\n */\r\n public static addTelemetry(tracker: OnUnexpectedError): () => void {\r\n this._telemetry.push(tracker);\r\n return () => this._telemetry.splice(this._telemetry.indexOf(tracker), 1);\r\n }\r\n\r\n /** call this method when an unexpected error happens so the global handler can process it.\r\n * @param error the unexpected error\r\n * @param notifyTelemetry if false, don't notify telemetry trackers. Use this for exceptions from third-party code, for example.\r\n */\r\n public static handle(error: any, notifyTelemetry = true): void {\r\n this._handler(error);\r\n if (notifyTelemetry) {\r\n this._telemetry.forEach((telemetry) => {\r\n try {\r\n telemetry(error);\r\n } catch {\r\n // ignore errors from telemetry trackers\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** establish a new global *unexpected error* handler.\r\n * @param handler the new global handler. You may provide your own function or use one of the static members of this class.\r\n * The default is [[errorLog]].\r\n * @returns the previous handler. Useful to temporarily change the handler.\r\n */\r\n public static setHandler(handler: OnUnexpectedError): OnUnexpectedError {\r\n const oldHandler = this._handler;\r\n this._handler = handler;\r\n return oldHandler;\r\n }\r\n}\r\n"]}
@@ -57,7 +57,7 @@ export declare function asInstanceOf<T>(obj: any, constructor: Constructor<T>):
57
57
  * @public
58
58
  */
59
59
  export type NonFunctionPropertyNamesOf<T> = {
60
- [K in keyof T]: T[K] extends Function ? never : K;
60
+ [K in keyof T]: T[K] extends (...args: any) => any ? never : K;
61
61
  }[keyof T];
62
62
  /** Produces a type consisting of all of the public properties of `T` except for those of type `function`.
63
63
  * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.
@@ -82,6 +82,10 @@ export type PickAsyncMethods<T> = {
82
82
  export type AsyncMethodsOf<T> = {
83
83
  [P in keyof T]: T[P] extends AsyncFunction ? P : never;
84
84
  }[keyof T];
85
+ /** A type that is either `T` or `Promise<T>`.
86
+ * @public
87
+ */
88
+ export type MaybePromise<T> = T | Promise<T>;
85
89
  /** Extracts the type to which the Promise returned by an async function resolves.
86
90
  * @public
87
91
  */
@@ -90,7 +94,7 @@ export type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any
90
94
  * @public
91
95
  */
92
96
  export type PickMethods<T> = {
93
- [P in keyof T]: T[P] extends Function ? T[P] : never;
97
+ [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never;
94
98
  };
95
99
  /** The members of `T` that are functions that do not return a Promise
96
100
  * @public
@@ -103,7 +107,7 @@ export type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;
103
107
  * ```
104
108
  * @public
105
109
  */
106
- export declare function omit<T extends {}, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]>;
110
+ export declare function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]>;
107
111
  /** Defines a type wherein at least one of the properties of T is required to exist.
108
112
  * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.
109
113
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"UtilityTypes.d.ts","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,C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AC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAKxG;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC/E,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -7,7 +7,9 @@
7
7
  * @module Utils
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.omit = exports.asInstanceOf = exports.isInstanceOf = void 0;
10
+ exports.isInstanceOf = isInstanceOf;
11
+ exports.asInstanceOf = asInstanceOf;
12
+ exports.omit = omit;
11
13
  /** Returns true if `obj` is an object of class `T`.
12
14
  * @see [[asInstanceOf]] to cast `obj` to class `T`.
13
15
  * @public
@@ -15,7 +17,6 @@ exports.omit = exports.asInstanceOf = exports.isInstanceOf = void 0;
15
17
  function isInstanceOf(obj, constructor) {
16
18
  return "object" === typeof obj && obj instanceof constructor;
17
19
  }
18
- exports.isInstanceOf = isInstanceOf;
19
20
  /** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.
20
21
  * @see [[isInstanceOf]] to query whether `obj` is of class `T`.
21
22
  * @public
@@ -23,7 +24,6 @@ exports.isInstanceOf = isInstanceOf;
23
24
  function asInstanceOf(obj, constructor) {
24
25
  return isInstanceOf(obj, constructor) ? obj : undefined;
25
26
  }
26
- exports.asInstanceOf = asInstanceOf;
27
27
  /** A runtime property omitter, makes a shallow copy of the given object without the specified properties
28
28
  * Compatible with the typescript `Omit` mapped type:
29
29
  * ```js
@@ -37,5 +37,4 @@ function omit(t, keys) {
37
37
  delete clone[key];
38
38
  return clone;
39
39
  }
40
- exports.omit = omit;
41
40
  //# sourceMappingURL=UtilityTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA2BH;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAFD,oCAEC;AAoED;;;;;;GAMG;AACH,SAAgB,IAAI,CAA+C,CAAI,EAAE,IAAO;IAC9E,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oBAKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\r\n * @public\r\n */\r\nexport type Mutable<T> = {\r\n -readonly [K in keyof T]: T[K];\r\n};\r\n\r\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\r\n * @public\r\n */\r\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\r\n\r\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\r\n * @public\r\n */\r\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\r\n\r\n/** Generically represents a class `T`, for use in type annotations.\r\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\r\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\r\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\r\n * @public\r\n */\r\nexport type Constructor<T> = new (...args: any[]) => T;\r\n\r\n/** Returns true if `obj` is an object of class `T`.\r\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\r\n * @public\r\n */\r\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\r\n return \"object\" === typeof obj && obj instanceof constructor;\r\n}\r\n\r\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\r\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\r\n * @public\r\n */\r\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\r\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\r\n}\r\n\r\n/** Extracts the names of all public properties of `T` that are not of type `function`.\r\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\r\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\r\n * so too does the type that TypeScript infers from that operator.\r\n * `get` syntax. For example:\r\n * ```ts\r\n * class Thing {\r\n * private _a = \"a\"; // a private variable\r\n * public b = \"b\"; // a public variable\r\n * public get c() { return \"c\"; } // a public property\r\n * public d() { return \"d\"; } // a public method\r\n * public e = () => \"e\"; // a public variable of type `function`\r\n * }\r\n *\r\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\r\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\r\n *\r\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\r\n * const thing1 = new Thing();\r\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\r\n * ```\r\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\r\n * @public\r\n */\r\nexport type NonFunctionPropertyNamesOf<T> = {\r\n [K in keyof T]: T[K] extends Function ? never : K;\r\n}[keyof T];\r\n\r\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\r\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\r\n * @public\r\n */\r\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\r\n\r\n/** Any function returning a Promise.\r\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\r\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\r\n * @public\r\n */\r\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\r\n\r\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\r\n * @public\r\n */\r\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\r\n\r\n/** Extracts the names of all function properties of `T` that return a Promise.\r\n * @public\r\n */\r\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\r\n\r\n/** Extracts the type to which the Promise returned by an async function resolves.\r\n * @public\r\n */\r\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\r\n\r\n/** The members of `T` that are functions and no other properties\r\n * @public\r\n */\r\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends Function ? T[P] : never; };\r\n\r\n/** The members of `T` that are functions that do not return a Promise\r\n * @public\r\n */\r\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\r\n\r\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\r\n * Compatible with the typescript `Omit` mapped type:\r\n * ```js\r\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\r\n * ```\r\n * @public\r\n */\r\nexport function omit<T extends {}, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\r\n const clone = { ...t };\r\n for (const key of keys)\r\n delete clone[key];\r\n return clone;\r\n}\r\n\r\n/** Defines a type wherein at least one of the properties of T is required to exist.\r\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\r\n * ```ts\r\n * interface Wallet {\r\n * cash?: number;\r\n * card?: CreditCard;\r\n * }\r\n *\r\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\r\n * ```\r\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\r\n * @public\r\n */\r\nexport type RequireAtLeastOne<T> = {\r\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\r\n}[keyof T];\r\n"]}
1
+ {"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA+BH,oCAEC;AAMD,oCAEC;AAgFD,oBAKC;AAnGD;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAyED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAmD,CAAI,EAAE,IAAO;IAClF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\r\n * @public\r\n */\r\nexport type Mutable<T> = {\r\n -readonly [K in keyof T]: T[K];\r\n};\r\n\r\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\r\n * @public\r\n */\r\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\r\n\r\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\r\n * @public\r\n */\r\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\r\n\r\n/** Generically represents a class `T`, for use in type annotations.\r\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\r\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\r\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\r\n * @public\r\n */\r\nexport type Constructor<T> = new (...args: any[]) => T;\r\n\r\n/** Returns true if `obj` is an object of class `T`.\r\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\r\n * @public\r\n */\r\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\r\n return \"object\" === typeof obj && obj instanceof constructor;\r\n}\r\n\r\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\r\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\r\n * @public\r\n */\r\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\r\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\r\n}\r\n\r\n/** Extracts the names of all public properties of `T` that are not of type `function`.\r\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\r\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\r\n * so too does the type that TypeScript infers from that operator.\r\n * `get` syntax. For example:\r\n * ```ts\r\n * class Thing {\r\n * private _a = \"a\"; // a private variable\r\n * public b = \"b\"; // a public variable\r\n * public get c() { return \"c\"; } // a public property\r\n * public d() { return \"d\"; } // a public method\r\n * public e = () => \"e\"; // a public variable of type `function`\r\n * }\r\n *\r\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\r\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\r\n *\r\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\r\n * const thing1 = new Thing();\r\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\r\n * ```\r\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\r\n * @public\r\n */\r\nexport type NonFunctionPropertyNamesOf<T> = {\r\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K;\r\n}[keyof T];\r\n\r\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\r\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\r\n * @public\r\n */\r\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\r\n\r\n/** Any function returning a Promise.\r\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\r\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\r\n * @public\r\n */\r\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\r\n\r\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\r\n * @public\r\n */\r\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\r\n\r\n/** Extracts the names of all function properties of `T` that return a Promise.\r\n * @public\r\n */\r\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\r\n\r\n/** A type that is either `T` or `Promise<T>`.\r\n * @public\r\n */\r\nexport type MaybePromise<T> = T | Promise<T>;\r\n\r\n/** Extracts the type to which the Promise returned by an async function resolves.\r\n * @public\r\n */\r\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\r\n\r\n/** The members of `T` that are functions and no other properties\r\n * @public\r\n */\r\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never; };\r\n\r\n/** The members of `T` that are functions that do not return a Promise\r\n * @public\r\n */\r\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\r\n\r\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\r\n * Compatible with the typescript `Omit` mapped type:\r\n * ```js\r\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\r\n * ```\r\n * @public\r\n */\r\nexport function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\r\n const clone = { ...t };\r\n for (const key of keys)\r\n delete clone[key];\r\n return clone;\r\n}\r\n\r\n/** Defines a type wherein at least one of the properties of T is required to exist.\r\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\r\n * ```ts\r\n * interface Wallet {\r\n * cash?: number;\r\n * card?: CreditCard;\r\n * }\r\n *\r\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\r\n * ```\r\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\r\n * @public\r\n */\r\nexport type RequireAtLeastOne<T> = {\r\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\r\n}[keyof T];\r\n"]}
@@ -7,5 +7,5 @@ import { LoggingMetaData } from "../BentleyError";
7
7
  * Use a key to identify entries in the map so the can be removed individually.
8
8
  * @internal
9
9
  */
10
- export declare const staticLoggerMetadata: Map<String, LoggingMetaData>;
10
+ export declare const staticLoggerMetadata: Map<string, LoggingMetaData>;
11
11
  //# sourceMappingURL=staticLoggerMetadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"staticLoggerMetadata.js","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,IAAI,GAAG,EAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\nimport { LoggingMetaData } from \"../BentleyError\";\r\n\r\n/** All static metadata is combined with per-call metadata and stringified in every log message.\r\n * Static metadata can either be an object or a function that returns an object.\r\n * Use a key to identify entries in the map so the can be removed individually.\r\n * @internal\r\n */\r\nexport const staticLoggerMetadata = new Map<String, LoggingMetaData>();\r\n"]}
1
+ {"version":3,"file":"staticLoggerMetadata.js","sourceRoot":"","sources":["../../../src/internal/staticLoggerMetadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;;;GAIG;AACU,QAAA,oBAAoB,GAAG,IAAI,GAAG,EAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Logging\r\n */\r\n\r\nimport { LoggingMetaData } from \"../BentleyError\";\r\n\r\n/** All static metadata is combined with per-call metadata and stringified in every log message.\r\n * Static metadata can either be an object or a function that returns an object.\r\n * Use a key to identify entries in the map so the can be removed individually.\r\n * @internal\r\n */\r\nexport const staticLoggerMetadata = new Map<string, LoggingMetaData>();\r\n"]}
@@ -7,7 +7,7 @@
7
7
  * @module Collections
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.partitionArray = void 0;
10
+ exports.partitionArray = partitionArray;
11
11
  /** Partitions an array in-place according to some criterion, such that elements that fulfill the criterion are grouped in the lower
12
12
  * portion of the array, and those that fail to fulfill the criterion are grouped in the upper portion of the array.
13
13
  * @param array The array to be partitioned.
@@ -40,5 +40,4 @@ function partitionArray(array, criterion) {
40
40
  }
41
41
  return partition;
42
42
  }
43
- exports.partitionArray = partitionArray;
44
43
  //# sourceMappingURL=partitionArray.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"partitionArray.js","sourceRoot":"","sources":["../../src/partitionArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAI,KAAU,EAAE,SAAkC;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,OAAO,KAAK,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,EAAE,KAAK,CAAC;QACV,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;YAClC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAdD,wCAcC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\n/** Partitions an array in-place according to some criterion, such that elements that fulfill the criterion are grouped in the lower\r\n * portion of the array, and those that fail to fulfill the criterion are grouped in the upper portion of the array.\r\n * @param array The array to be partitioned.\r\n * @param criterion A function invoked for each element of the array, returning whether the element fulfills the criterion.\r\n * @returns The index of the upper partition, i.e., of the first element that fails the criterion. If all elements fulfill the criterion, this is the length of the array.\r\n * @note The relative ordering of elements within each partition is unspecified.\r\n * Example:\r\n * ```ts\r\n * function isEven(n: number) { return 0 === n % 2; }\r\n * const list = [ 1, 2, 3, 4, 5 ];\r\n * const firstOddIndex = partitionArray(list, isEven); // firstOddIndex = 2\r\n * // 2 and 4 now appear before 1, 3, and 5 in the list; their ordering is otherwise unspecified.\r\n * for (let i = 0; i < list.length; i++)\r\n * assert(isEven(list[i]) === i < firstOddIndex);\r\n * ```\r\n * @public\r\n */\r\nexport function partitionArray<T>(array: T[], criterion: (element: T) => boolean): number {\r\n let index = 0;\r\n let partition = array.length;\r\n while (index < partition) {\r\n const elem = array[index];\r\n if (criterion(elem)) {\r\n ++index;\r\n } else {\r\n array[index] = array[--partition];\r\n array[partition] = elem;\r\n }\r\n }\r\n\r\n return partition;\r\n}\r\n"]}
1
+ {"version":3,"file":"partitionArray.js","sourceRoot":"","sources":["../../src/partitionArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAmBH,wCAcC;AA/BD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,cAAc,CAAI,KAAU,EAAE,SAAkC;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IAC7B,OAAO,KAAK,GAAG,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,EAAE,KAAK,CAAC;QACV,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;YAClC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\n/** Partitions an array in-place according to some criterion, such that elements that fulfill the criterion are grouped in the lower\r\n * portion of the array, and those that fail to fulfill the criterion are grouped in the upper portion of the array.\r\n * @param array The array to be partitioned.\r\n * @param criterion A function invoked for each element of the array, returning whether the element fulfills the criterion.\r\n * @returns The index of the upper partition, i.e., of the first element that fails the criterion. If all elements fulfill the criterion, this is the length of the array.\r\n * @note The relative ordering of elements within each partition is unspecified.\r\n * Example:\r\n * ```ts\r\n * function isEven(n: number) { return 0 === n % 2; }\r\n * const list = [ 1, 2, 3, 4, 5 ];\r\n * const firstOddIndex = partitionArray(list, isEven); // firstOddIndex = 2\r\n * // 2 and 4 now appear before 1, 3, and 5 in the list; their ordering is otherwise unspecified.\r\n * for (let i = 0; i < list.length; i++)\r\n * assert(isEven(list[i]) === i < firstOddIndex);\r\n * ```\r\n * @public\r\n */\r\nexport function partitionArray<T>(array: T[], criterion: (element: T) => boolean): number {\r\n let index = 0;\r\n let partition = array.length;\r\n while (index < partition) {\r\n const elem = array[index];\r\n if (criterion(elem)) {\r\n ++index;\r\n } else {\r\n array[index] = array[--partition];\r\n array[partition] = elem;\r\n }\r\n }\r\n\r\n return partition;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BeSQLite.d.ts","sourceRoot":"","sources":["../../src/BeSQLite.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,oBAAY,QAAQ;IAClB,QAAQ,IAAa;IACrB,SAAS,IAAa;CACvB;AAED;;GAEG;AACH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,WAAgC;IAC3D,qCAAqC;IACrC,4BAA4B,YAAgC;IAC5D,+CAA+C;IAC/C,qCAAqC,YAAgC;IACrE,yCAAyC;IACzC,oCAAoC,YAAgC;IACpE,+EAA+E;IAC/E,yCAAyC,YAAgC;IACzE,mEAAmE;IACnE,6BAA6B,YAAiC;IAC9D,qGAAqG;IACrG,yCAAyC,YAAiC;IAC1E,mEAAmE;IACnE,6BAA6B,YAAiC;IAC9D,gDAAgD;IAChD,gCAAgC,YAAiC;IACjE,6DAA6D;IAC7D,uCAAuC,YAAiC;IACxE,4DAA4D;IAC5D,qCAAqC,YAA+B;IACpE,+FAA+F;IAC/F,4BAA4B,YAA+B;IAC3D,yFAAyF;IACzF,4BAA4B,YAA+B;IAC3D,4DAA4D;IAC5D,gCAAgC,YAA+B;IAC/D,mDAAmD;IACnD,mCAAmC,YAA+B;IAClE,qDAAqD;IACrD,kCAAkC,YAA+B;IACjE,qCAAqC;IACrC,2CAA2C,YAA+B;IAC1E,qEAAqE;IACrE,wCAAwC,YAA+B;IACvE,2CAA2C;IAC3C,qCAAqC,YAAiC;IAEtE,4BAA4B,MAAgC;IAC5D,uBAAuB,MAA8B;IACrD,4BAA4B,MAAkC;IAC9D,wBAAwB,MAAkC;IAC1D,2BAA2B,MAAkC;IAC7D,sBAAsB,MAAiC;IACvD,2BAA2B,MAAkC;IAC7D,2BAA2B,MAAkC;IAC7D,2BAA2B,MAAkC;IAC7D,wBAAwB,MAA+B;IACvD,0BAA0B,MAAyC;IACnE,+BAA+B,MAAyC;IACxE,+BAA+B,MAAyC;IACxE,6BAA6B,OAAyC;IACtE,4BAA4B,OAAyC;IACrE,+BAA+B,OAAyC;IACxE,4BAA4B,OAAyC;IACrE,2BAA2B,OAAyC;IACpE,yBAAyB,OAAyC;CACnE"}
@@ -28,7 +28,6 @@ export var DbOpcode;
28
28
  /** Values for return codes from BeSQLite functions. Consult SQLite documentation for further explanations.
29
29
  * @public
30
30
  */
31
- /* eslint-disable @typescript-eslint/naming-convention */
32
31
  // Disabling for the rest of the file since eslint does not correctly parse the entire enum, only parts of it
33
32
  export var DbResult;
34
33
  (function (DbResult) {
@@ -179,5 +178,4 @@ export var DbResult;
179
178
  DbResult[DbResult["BE_SQLITE_CONSTRAINT_UNIQUE"] = 2067] = "BE_SQLITE_CONSTRAINT_UNIQUE";
180
179
  DbResult[DbResult["BE_SQLITE_CONSTRAINT_VTAB"] = 2323] = "BE_SQLITE_CONSTRAINT_VTAB";
181
180
  })(DbResult || (DbResult = {}));
182
- /* eslint-enable @typescript-eslint/naming-convention */
183
181
  //# sourceMappingURL=BeSQLite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BeSQLite.js","sourceRoot":"","sources":["../../src/BeSQLite.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+CAAqB,CAAA;IACrB,iDAAsB,CAAA;AACxB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,yBAAyB;IACzB,2CAAU,CAAA;IACV,8BAA8B;IAC9B,4CAAW,CAAA;IACX,oDAAoD;IACpD,4CAAW,CAAA;AACb,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB;AAED;;GAEG;AACH,yDAAyD;AACzD,8GAA8G;AAC9G,MAAM,CAAN,IAAY,QAsJX;AAtJD,WAAY,QAAQ;IAClB,cAAc;IACd,uDAAgB,CAAA;IAChB,oCAAoC;IACpC,6DAAmB,CAAA;IACnB,2BAA2B;IAC3B,mEAAsB,CAAA;IACtB,+BAA+B;IAC/B,2DAAkB,CAAA;IAClB,0CAA0C;IAC1C,6DAAmB,CAAA;IACnB,kCAAkC;IAClC,2DAAkB,CAAA;IAClB,wCAAwC;IACxC,+DAAoB,CAAA;IACpB,wBAAwB;IACxB,6DAAmB,CAAA;IACnB,2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AAR,QAAQ,QAsJnB;AACD,wDAAwD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BeSQLite\r\n */\r\n\r\n/** Whether to open a database readonly or writeable.\r\n * @public\r\n */\r\nexport enum OpenMode {\r\n Readonly = 0x00000001,\r\n ReadWrite = 0x00000002,\r\n}\r\n\r\n/** Values, stored in changesets, that indicate what operation was performed on the database.\r\n * @public\r\n */\r\nexport enum DbOpcode {\r\n /** A row was deleted. */\r\n Delete = 9,\r\n /** A new row was inserted. */\r\n Insert = 18,\r\n /** Some columns of an existing row were updated. */\r\n Update = 23,\r\n}\r\n\r\n/** Values for return codes from BeSQLite functions. Consult SQLite documentation for further explanations.\r\n * @public\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\n// Disabling for the rest of the file since eslint does not correctly parse the entire enum, only parts of it\r\nexport enum DbResult {\r\n /** Success */\r\n BE_SQLITE_OK = 0,\r\n /** SQL error or missing database */\r\n BE_SQLITE_ERROR = 1,\r\n /** Internal logic error */\r\n BE_SQLITE_INTERNAL = 2,\r\n /** Access permission denied */\r\n BE_SQLITE_PERM = 3,\r\n /** Callback routine requested an abort */\r\n BE_SQLITE_ABORT = 4,\r\n /** The database file is locked */\r\n BE_SQLITE_BUSY = 5,\r\n /** A table in the database is locked */\r\n BE_SQLITE_LOCKED = 6,\r\n /** A malloc() failed */\r\n BE_SQLITE_NOMEM = 7,\r\n /** Attempt to write a readonly database */\r\n BE_SQLITE_READONLY = 8,\r\n /** Operation terminated by interrupt */\r\n BE_SQLITE_INTERRUPT = 9,\r\n /** Some kind of disk I/O error occurred */\r\n BE_SQLITE_IOERR = 10,\r\n /** The database disk image is malformed */\r\n BE_SQLITE_CORRUPT = 11,\r\n /** NOT USED. Table or record not found */\r\n BE_SQLITE_NOTFOUND = 12,\r\n /** Insertion failed because database is full or write operation failed because disk is full */\r\n BE_SQLITE_FULL = 13,\r\n /** Unable to open the database file */\r\n BE_SQLITE_CANTOPEN = 14,\r\n /** Database lock protocol error */\r\n BE_SQLITE_PROTOCOL = 15,\r\n /** Database is empty */\r\n BE_SQLITE_EMPTY = 16,\r\n /** The database schema changed */\r\n BE_SQLITE_SCHEMA = 17,\r\n /** String or BLOB exceeds size limit */\r\n BE_SQLITE_TOOBIG = 18,\r\n /** Abort due to constraint violation. See extended error values. */\r\n BE_SQLITE_CONSTRAINT_BASE = 19,\r\n /** Data type mismatch */\r\n BE_SQLITE_MISMATCH = 20,\r\n /** Library used incorrectly */\r\n BE_SQLITE_MISUSE = 21,\r\n /** Uses OS features not supported on host */\r\n BE_SQLITE_NOLFS = 22,\r\n /** Authorization denied */\r\n BE_SQLITE_AUTH = 23,\r\n /** Auxiliary database format error */\r\n BE_SQLITE_FORMAT = 24,\r\n /** 2nd parameter to Bind out of range */\r\n BE_SQLITE_RANGE = 25,\r\n /** File opened that is not a database file */\r\n BE_SQLITE_NOTADB = 26,\r\n /** Step() has another row ready */\r\n BE_SQLITE_ROW = 100,\r\n /** Step() has finished executing */\r\n BE_SQLITE_DONE = 101,\r\n\r\n BE_SQLITE_IOERR_READ = (BE_SQLITE_IOERR | (1 << 8)),\r\n BE_SQLITE_IOERR_SHORT_READ = (BE_SQLITE_IOERR | (2 << 8)),\r\n BE_SQLITE_IOERR_WRITE = (BE_SQLITE_IOERR | (3 << 8)),\r\n BE_SQLITE_IOERR_FSYNC = (BE_SQLITE_IOERR | (4 << 8)),\r\n BE_SQLITE_IOERR_DIR_FSYNC = (BE_SQLITE_IOERR | (5 << 8)),\r\n BE_SQLITE_IOERR_TRUNCATE = (BE_SQLITE_IOERR | (6 << 8)),\r\n BE_SQLITE_IOERR_FSTAT = (BE_SQLITE_IOERR | (7 << 8)),\r\n BE_SQLITE_IOERR_UNLOCK = (BE_SQLITE_IOERR | (8 << 8)),\r\n BE_SQLITE_IOERR_RDLOCK = (BE_SQLITE_IOERR | (9 << 8)),\r\n BE_SQLITE_IOERR_DELETE = (BE_SQLITE_IOERR | (10 << 8)),\r\n BE_SQLITE_IOERR_BLOCKED = (BE_SQLITE_IOERR | (11 << 8)),\r\n BE_SQLITE_IOERR_NOMEM = (BE_SQLITE_IOERR | (12 << 8)),\r\n BE_SQLITE_IOERR_ACCESS = (BE_SQLITE_IOERR | (13 << 8)),\r\n BE_SQLITE_IOERR_CHECKRESERVEDLOCK = (BE_SQLITE_IOERR | (14 << 8)),\r\n BE_SQLITE_IOERR_LOCK = (BE_SQLITE_IOERR | (15 << 8)),\r\n BE_SQLITE_IOERR_CLOSE = (BE_SQLITE_IOERR | (16 << 8)),\r\n BE_SQLITE_IOERR_DIR_CLOSE = (BE_SQLITE_IOERR | (17 << 8)),\r\n BE_SQLITE_IOERR_SHMOPEN = (BE_SQLITE_IOERR | (18 << 8)),\r\n BE_SQLITE_IOERR_SHMSIZE = (BE_SQLITE_IOERR | (19 << 8)),\r\n BE_SQLITE_IOERR_SHMLOCK = (BE_SQLITE_IOERR | (20 << 8)),\r\n BE_SQLITE_IOERR_SHMMAP = (BE_SQLITE_IOERR | (21 << 8)),\r\n BE_SQLITE_IOERR_SEEK = (BE_SQLITE_IOERR | (22 << 8)),\r\n BE_SQLITE_IOERR_DELETE_NOENT = (BE_SQLITE_IOERR | (23 << 8)),\r\n\r\n /** attempt to create a new file when a file by that name already exists */\r\n BE_SQLITE_ERROR_FileExists = (BE_SQLITE_IOERR | (1 << 24)),\r\n /** attempt to open a BeSQLite::Db that is already in use somewhere. */\r\n BE_SQLITE_ERROR_AlreadyOpen = (BE_SQLITE_IOERR | (2 << 24)),\r\n /** attempt to open a BeSQLite::Db that doesn't have a property table. */\r\n BE_SQLITE_ERROR_NoPropertyTable = (BE_SQLITE_IOERR | (3 << 24)),\r\n /** the database name is not a file. */\r\n BE_SQLITE_ERROR_FileNotFound = (BE_SQLITE_IOERR | (4 << 24)),\r\n /** there is no transaction active and the database was opened with AllowImplicitTransactions=false */\r\n BE_SQLITE_ERROR_NoTxnActive = (BE_SQLITE_IOERR | (5 << 24)),\r\n /** wrong BeSQLite profile version */\r\n BE_SQLITE_ERROR_BadDbProfile = (BE_SQLITE_IOERR | (6 << 24)),\r\n /** Profile of file could not be determined. */\r\n BE_SQLITE_ERROR_InvalidProfileVersion = (BE_SQLITE_IOERR | (7 << 24)),\r\n /** Upgrade of profile of file failed. */\r\n BE_SQLITE_ERROR_ProfileUpgradeFailed = (BE_SQLITE_IOERR | (8 << 24)),\r\n /** Profile of file is too old. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooOldForReadWrite = (BE_SQLITE_IOERR | (9 << 24)),\r\n /** Profile of file is too old. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooOld = (BE_SQLITE_IOERR | (10 << 24)),\r\n /** Profile of file is too new for read-write access. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooNewForReadWrite = (BE_SQLITE_IOERR | (11 << 24)),\r\n /** Profile of file is too new. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooNew = (BE_SQLITE_IOERR | (12 << 24)),\r\n /** attempt to commit with active changetrack */\r\n BE_SQLITE_ERROR_ChangeTrackError = (BE_SQLITE_IOERR | (13 << 24)),\r\n /** invalid version of the revision file is being imported */\r\n BE_SQLITE_ERROR_InvalidChangeSetVersion = (BE_SQLITE_IOERR | (14 << 24)),\r\n /** The schemas found in the database need to be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRequired = (BE_SQLITE_IOERR | 15 << 24),\r\n /** The schemas found in the database are too new, and the application needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooNew = (BE_SQLITE_IOERR | 16 << 24),\r\n /** The schemas found in the database are too old, and the DgnDb needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooOld = (BE_SQLITE_IOERR | 17 << 24),\r\n /** Error acquiring a lock on the schemas before upgrade. */\r\n BE_SQLITE_ERROR_SchemaLockFailed = (BE_SQLITE_IOERR | 18 << 24),\r\n /** Error upgrading the schemas in the database. */\r\n BE_SQLITE_ERROR_SchemaUpgradeFailed = (BE_SQLITE_IOERR | 19 << 24),\r\n /** Error importing the schemas into the database. */\r\n BE_SQLITE_ERROR_SchemaImportFailed = (BE_SQLITE_IOERR | 20 << 24),\r\n /** Error acquiring locks or codes */\r\n BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes = (BE_SQLITE_IOERR | 21 << 24),\r\n /** Recommended that the schemas found in the database be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRecommended = (BE_SQLITE_IOERR | 22 << 24),\r\n /** schema update require data transform */\r\n BE_SQLITE_ERROR_DataTransformRequired = (BE_SQLITE_IOERR | (23 << 24)),\r\n\r\n BE_SQLITE_LOCKED_SHAREDCACHE = (BE_SQLITE_LOCKED | (1 << 8)),\r\n BE_SQLITE_BUSY_RECOVERY = (BE_SQLITE_BUSY | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_NOTEMPDIR = (BE_SQLITE_CANTOPEN | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_ISDIR = (BE_SQLITE_CANTOPEN | (2 << 8)),\r\n BE_SQLITE_CANTOPEN_FULLPATH = (BE_SQLITE_CANTOPEN | (3 << 8)),\r\n BE_SQLITE_CORRUPT_VTAB = (BE_SQLITE_CORRUPT | (1 << 8)),\r\n BE_SQLITE_READONLY_RECOVERY = (BE_SQLITE_READONLY | (1 << 8)),\r\n BE_SQLITE_READONLY_CANTLOCK = (BE_SQLITE_READONLY | (2 << 8)),\r\n BE_SQLITE_READONLY_ROLLBACK = (BE_SQLITE_READONLY | (3 << 8)),\r\n BE_SQLITE_ABORT_ROLLBACK = (BE_SQLITE_ABORT | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_CHECK = (BE_SQLITE_CONSTRAINT_BASE | (1 << 8)),\r\n BE_SQLITE_CONSTRAINT_COMMITHOOK = (BE_SQLITE_CONSTRAINT_BASE | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_FOREIGNKEY = (BE_SQLITE_CONSTRAINT_BASE | (3 << 8)),\r\n BE_SQLITE_CONSTRAINT_FUNCTION = (BE_SQLITE_CONSTRAINT_BASE | (4 << 8)),\r\n BE_SQLITE_CONSTRAINT_NOTNULL = (BE_SQLITE_CONSTRAINT_BASE | (5 << 8)),\r\n BE_SQLITE_CONSTRAINT_PRIMARYKEY = (BE_SQLITE_CONSTRAINT_BASE | (6 << 8)),\r\n BE_SQLITE_CONSTRAINT_TRIGGER = (BE_SQLITE_CONSTRAINT_BASE | (7 << 8)),\r\n BE_SQLITE_CONSTRAINT_UNIQUE = (BE_SQLITE_CONSTRAINT_BASE | (8 << 8)),\r\n BE_SQLITE_CONSTRAINT_VTAB = (BE_SQLITE_CONSTRAINT_BASE | (9 << 8)),\r\n}\r\n/* eslint-enable @typescript-eslint/naming-convention */\r\n"]}
1
+ {"version":3,"file":"BeSQLite.js","sourceRoot":"","sources":["../../src/BeSQLite.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,+CAAqB,CAAA;IACrB,iDAAsB,CAAA;AACxB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,yBAAyB;IACzB,2CAAU,CAAA;IACV,8BAA8B;IAC9B,4CAAW,CAAA;IACX,oDAAoD;IACpD,4CAAW,CAAA;AACb,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB;AAED;;GAEG;AACH,8GAA8G;AAC9G,MAAM,CAAN,IAAY,QAsJX;AAtJD,WAAY,QAAQ;IAClB,cAAc;IACd,uDAAgB,CAAA;IAChB,oCAAoC;IACpC,6DAAmB,CAAA;IACnB,2BAA2B;IAC3B,mEAAsB,CAAA;I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AAwE,CAAA;IACxE,+FAAwE,CAAA;IACxE,4FAAsE,CAAA;IACtE,0FAAqE,CAAA;IACrE,gGAAwE,CAAA;IACxE,0FAAqE,CAAA;IACrE,wFAAoE,CAAA;IACpE,oFAAkE,CAAA;AACpE,CAAC,EAtJW,QAAQ,KAAR,QAAQ,QAsJnB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module BeSQLite\r\n */\r\n\r\n/** Whether to open a database readonly or writeable.\r\n * @public\r\n */\r\nexport enum OpenMode {\r\n Readonly = 0x00000001,\r\n ReadWrite = 0x00000002,\r\n}\r\n\r\n/** Values, stored in changesets, that indicate what operation was performed on the database.\r\n * @public\r\n */\r\nexport enum DbOpcode {\r\n /** A row was deleted. */\r\n Delete = 9,\r\n /** A new row was inserted. */\r\n Insert = 18,\r\n /** Some columns of an existing row were updated. */\r\n Update = 23,\r\n}\r\n\r\n/** Values for return codes from BeSQLite functions. Consult SQLite documentation for further explanations.\r\n * @public\r\n */\r\n// Disabling for the rest of the file since eslint does not correctly parse the entire enum, only parts of it\r\nexport enum DbResult {\r\n /** Success */\r\n BE_SQLITE_OK = 0,\r\n /** SQL error or missing database */\r\n BE_SQLITE_ERROR = 1,\r\n /** Internal logic error */\r\n BE_SQLITE_INTERNAL = 2,\r\n /** Access permission denied */\r\n BE_SQLITE_PERM = 3,\r\n /** Callback routine requested an abort */\r\n BE_SQLITE_ABORT = 4,\r\n /** The database file is locked */\r\n BE_SQLITE_BUSY = 5,\r\n /** A table in the database is locked */\r\n BE_SQLITE_LOCKED = 6,\r\n /** A malloc() failed */\r\n BE_SQLITE_NOMEM = 7,\r\n /** Attempt to write a readonly database */\r\n BE_SQLITE_READONLY = 8,\r\n /** Operation terminated by interrupt */\r\n BE_SQLITE_INTERRUPT = 9,\r\n /** Some kind of disk I/O error occurred */\r\n BE_SQLITE_IOERR = 10,\r\n /** The database disk image is malformed */\r\n BE_SQLITE_CORRUPT = 11,\r\n /** NOT USED. Table or record not found */\r\n BE_SQLITE_NOTFOUND = 12,\r\n /** Insertion failed because database is full or write operation failed because disk is full */\r\n BE_SQLITE_FULL = 13,\r\n /** Unable to open the database file */\r\n BE_SQLITE_CANTOPEN = 14,\r\n /** Database lock protocol error */\r\n BE_SQLITE_PROTOCOL = 15,\r\n /** Database is empty */\r\n BE_SQLITE_EMPTY = 16,\r\n /** The database schema changed */\r\n BE_SQLITE_SCHEMA = 17,\r\n /** String or BLOB exceeds size limit */\r\n BE_SQLITE_TOOBIG = 18,\r\n /** Abort due to constraint violation. See extended error values. */\r\n BE_SQLITE_CONSTRAINT_BASE = 19,\r\n /** Data type mismatch */\r\n BE_SQLITE_MISMATCH = 20,\r\n /** Library used incorrectly */\r\n BE_SQLITE_MISUSE = 21,\r\n /** Uses OS features not supported on host */\r\n BE_SQLITE_NOLFS = 22,\r\n /** Authorization denied */\r\n BE_SQLITE_AUTH = 23,\r\n /** Auxiliary database format error */\r\n BE_SQLITE_FORMAT = 24,\r\n /** 2nd parameter to Bind out of range */\r\n BE_SQLITE_RANGE = 25,\r\n /** File opened that is not a database file */\r\n BE_SQLITE_NOTADB = 26,\r\n /** Step() has another row ready */\r\n BE_SQLITE_ROW = 100,\r\n /** Step() has finished executing */\r\n BE_SQLITE_DONE = 101,\r\n\r\n BE_SQLITE_IOERR_READ = (BE_SQLITE_IOERR | (1 << 8)),\r\n BE_SQLITE_IOERR_SHORT_READ = (BE_SQLITE_IOERR | (2 << 8)),\r\n BE_SQLITE_IOERR_WRITE = (BE_SQLITE_IOERR | (3 << 8)),\r\n BE_SQLITE_IOERR_FSYNC = (BE_SQLITE_IOERR | (4 << 8)),\r\n BE_SQLITE_IOERR_DIR_FSYNC = (BE_SQLITE_IOERR | (5 << 8)),\r\n BE_SQLITE_IOERR_TRUNCATE = (BE_SQLITE_IOERR | (6 << 8)),\r\n BE_SQLITE_IOERR_FSTAT = (BE_SQLITE_IOERR | (7 << 8)),\r\n BE_SQLITE_IOERR_UNLOCK = (BE_SQLITE_IOERR | (8 << 8)),\r\n BE_SQLITE_IOERR_RDLOCK = (BE_SQLITE_IOERR | (9 << 8)),\r\n BE_SQLITE_IOERR_DELETE = (BE_SQLITE_IOERR | (10 << 8)),\r\n BE_SQLITE_IOERR_BLOCKED = (BE_SQLITE_IOERR | (11 << 8)),\r\n BE_SQLITE_IOERR_NOMEM = (BE_SQLITE_IOERR | (12 << 8)),\r\n BE_SQLITE_IOERR_ACCESS = (BE_SQLITE_IOERR | (13 << 8)),\r\n BE_SQLITE_IOERR_CHECKRESERVEDLOCK = (BE_SQLITE_IOERR | (14 << 8)),\r\n BE_SQLITE_IOERR_LOCK = (BE_SQLITE_IOERR | (15 << 8)),\r\n BE_SQLITE_IOERR_CLOSE = (BE_SQLITE_IOERR | (16 << 8)),\r\n BE_SQLITE_IOERR_DIR_CLOSE = (BE_SQLITE_IOERR | (17 << 8)),\r\n BE_SQLITE_IOERR_SHMOPEN = (BE_SQLITE_IOERR | (18 << 8)),\r\n BE_SQLITE_IOERR_SHMSIZE = (BE_SQLITE_IOERR | (19 << 8)),\r\n BE_SQLITE_IOERR_SHMLOCK = (BE_SQLITE_IOERR | (20 << 8)),\r\n BE_SQLITE_IOERR_SHMMAP = (BE_SQLITE_IOERR | (21 << 8)),\r\n BE_SQLITE_IOERR_SEEK = (BE_SQLITE_IOERR | (22 << 8)),\r\n BE_SQLITE_IOERR_DELETE_NOENT = (BE_SQLITE_IOERR | (23 << 8)),\r\n\r\n /** attempt to create a new file when a file by that name already exists */\r\n BE_SQLITE_ERROR_FileExists = (BE_SQLITE_IOERR | (1 << 24)),\r\n /** attempt to open a BeSQLite::Db that is already in use somewhere. */\r\n BE_SQLITE_ERROR_AlreadyOpen = (BE_SQLITE_IOERR | (2 << 24)),\r\n /** attempt to open a BeSQLite::Db that doesn't have a property table. */\r\n BE_SQLITE_ERROR_NoPropertyTable = (BE_SQLITE_IOERR | (3 << 24)),\r\n /** the database name is not a file. */\r\n BE_SQLITE_ERROR_FileNotFound = (BE_SQLITE_IOERR | (4 << 24)),\r\n /** there is no transaction active and the database was opened with AllowImplicitTransactions=false */\r\n BE_SQLITE_ERROR_NoTxnActive = (BE_SQLITE_IOERR | (5 << 24)),\r\n /** wrong BeSQLite profile version */\r\n BE_SQLITE_ERROR_BadDbProfile = (BE_SQLITE_IOERR | (6 << 24)),\r\n /** Profile of file could not be determined. */\r\n BE_SQLITE_ERROR_InvalidProfileVersion = (BE_SQLITE_IOERR | (7 << 24)),\r\n /** Upgrade of profile of file failed. */\r\n BE_SQLITE_ERROR_ProfileUpgradeFailed = (BE_SQLITE_IOERR | (8 << 24)),\r\n /** Profile of file is too old. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooOldForReadWrite = (BE_SQLITE_IOERR | (9 << 24)),\r\n /** Profile of file is too old. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooOld = (BE_SQLITE_IOERR | (10 << 24)),\r\n /** Profile of file is too new for read-write access. Therefore file can only be opened read-only. */\r\n BE_SQLITE_ERROR_ProfileTooNewForReadWrite = (BE_SQLITE_IOERR | (11 << 24)),\r\n /** Profile of file is too new. Therefore file cannot be opened. */\r\n BE_SQLITE_ERROR_ProfileTooNew = (BE_SQLITE_IOERR | (12 << 24)),\r\n /** attempt to commit with active changetrack */\r\n BE_SQLITE_ERROR_ChangeTrackError = (BE_SQLITE_IOERR | (13 << 24)),\r\n /** invalid version of the revision file is being imported */\r\n BE_SQLITE_ERROR_InvalidChangeSetVersion = (BE_SQLITE_IOERR | (14 << 24)),\r\n /** The schemas found in the database need to be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRequired = (BE_SQLITE_IOERR | 15 << 24),\r\n /** The schemas found in the database are too new, and the application needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooNew = (BE_SQLITE_IOERR | 16 << 24),\r\n /** The schemas found in the database are too old, and the DgnDb needs to be upgraded. */\r\n BE_SQLITE_ERROR_SchemaTooOld = (BE_SQLITE_IOERR | 17 << 24),\r\n /** Error acquiring a lock on the schemas before upgrade. */\r\n BE_SQLITE_ERROR_SchemaLockFailed = (BE_SQLITE_IOERR | 18 << 24),\r\n /** Error upgrading the schemas in the database. */\r\n BE_SQLITE_ERROR_SchemaUpgradeFailed = (BE_SQLITE_IOERR | 19 << 24),\r\n /** Error importing the schemas into the database. */\r\n BE_SQLITE_ERROR_SchemaImportFailed = (BE_SQLITE_IOERR | 20 << 24),\r\n /** Error acquiring locks or codes */\r\n BE_SQLITE_ERROR_CouldNotAcquireLocksOrCodes = (BE_SQLITE_IOERR | 21 << 24),\r\n /** Recommended that the schemas found in the database be upgraded */\r\n BE_SQLITE_ERROR_SchemaUpgradeRecommended = (BE_SQLITE_IOERR | 22 << 24),\r\n /** schema update require data transform */\r\n BE_SQLITE_ERROR_DataTransformRequired = (BE_SQLITE_IOERR | (23 << 24)),\r\n\r\n BE_SQLITE_LOCKED_SHAREDCACHE = (BE_SQLITE_LOCKED | (1 << 8)),\r\n BE_SQLITE_BUSY_RECOVERY = (BE_SQLITE_BUSY | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_NOTEMPDIR = (BE_SQLITE_CANTOPEN | (1 << 8)),\r\n BE_SQLITE_CANTOPEN_ISDIR = (BE_SQLITE_CANTOPEN | (2 << 8)),\r\n BE_SQLITE_CANTOPEN_FULLPATH = (BE_SQLITE_CANTOPEN | (3 << 8)),\r\n BE_SQLITE_CORRUPT_VTAB = (BE_SQLITE_CORRUPT | (1 << 8)),\r\n BE_SQLITE_READONLY_RECOVERY = (BE_SQLITE_READONLY | (1 << 8)),\r\n BE_SQLITE_READONLY_CANTLOCK = (BE_SQLITE_READONLY | (2 << 8)),\r\n BE_SQLITE_READONLY_ROLLBACK = (BE_SQLITE_READONLY | (3 << 8)),\r\n BE_SQLITE_ABORT_ROLLBACK = (BE_SQLITE_ABORT | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_CHECK = (BE_SQLITE_CONSTRAINT_BASE | (1 << 8)),\r\n BE_SQLITE_CONSTRAINT_COMMITHOOK = (BE_SQLITE_CONSTRAINT_BASE | (2 << 8)),\r\n BE_SQLITE_CONSTRAINT_FOREIGNKEY = (BE_SQLITE_CONSTRAINT_BASE | (3 << 8)),\r\n BE_SQLITE_CONSTRAINT_FUNCTION = (BE_SQLITE_CONSTRAINT_BASE | (4 << 8)),\r\n BE_SQLITE_CONSTRAINT_NOTNULL = (BE_SQLITE_CONSTRAINT_BASE | (5 << 8)),\r\n BE_SQLITE_CONSTRAINT_PRIMARYKEY = (BE_SQLITE_CONSTRAINT_BASE | (6 << 8)),\r\n BE_SQLITE_CONSTRAINT_TRIGGER = (BE_SQLITE_CONSTRAINT_BASE | (7 << 8)),\r\n BE_SQLITE_CONSTRAINT_UNIQUE = (BE_SQLITE_CONSTRAINT_BASE | (8 << 8)),\r\n BE_SQLITE_CONSTRAINT_VTAB = (BE_SQLITE_CONSTRAINT_BASE | (9 << 8)),\r\n}\r\n"]}
@@ -45,14 +45,14 @@ export class ByteStream {
45
45
  */
46
46
  static fromUint8Array(bytes) {
47
47
  const { byteOffset, byteLength } = bytes;
48
- return new ByteStream(bytes.buffer, { byteOffset, byteLength }); // eslint-disable-line deprecation/deprecation
48
+ return new ByteStream(bytes.buffer, { byteOffset, byteLength }); // eslint-disable-line @typescript-eslint/no-deprecated
49
49
  }
50
50
  /** Construct a new ByteStream with the read position set to the beginning.
51
51
  * @param buffer The underlying buffer from which data is to be extracted.
52
52
  * @param subView If defined, specifies the subset of the underlying buffer's data to use.
53
53
  */
54
54
  static fromArrayBuffer(buffer, subView) {
55
- return new ByteStream(buffer, subView); // eslint-disable-line deprecation/deprecation
55
+ return new ByteStream(buffer, subView); // eslint-disable-line @typescript-eslint/no-deprecated
56
56
  }
57
57
  /** The number of bytes in this stream */
58
58
  get length() {
@@ -1 +1 @@
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AC,WAAW,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC9F,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0CAA0C;IAC1C,IAAW,WAAW,KAAsC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/E,IAAI,CAAC,QAAgB,EAAE,IAAgC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { assert } from \"./Assert\";\r\nimport { Id64, Id64String } from \"./Id\";\r\n\r\n/** Allows the contents of an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)\r\n * to be consumed sequentially using methods to extract\r\n * data of a particular type from the bytes beginning at the current read position.\r\n * Methods and properties beginning with 'read' and taking no arguments consume data at the current read position and advance it\r\n * by the size of the data read. The read position can also be directly adjusted by the caller.\r\n * @public\r\n */\r\nexport class ByteStream {\r\n private readonly _view: DataView;\r\n private readonly _byteOffset: number;\r\n private _curPos: number = 0;\r\n\r\n /** Construct a new ByteStream with the read position set to the beginning.\r\n * @param buffer The underlying buffer from which data is to be extracted.\r\n * @param subView If defined, specifies the subset of the underlying buffer's data to use.\r\n * This constructor is subject to two common mistakes:\r\n *\r\n * 1. Given `bytes: Uint8Array`, `new ByteStream(bytes)` will compile but at run-time will produce an error asserting that\r\n * the DataView constructor requires an ArrayBuffer. The correct usage is `new ByteStream(bytes.buffer)`.\r\n * 2. Given `bytes: Uint8Array`, `new ByteStream(bytes.buffer)` creates a stream for the entire range of bytes represented by the underlying\r\n * ArrayBuffer. If `bytes` represents only a **sub-range** of the underlying buffer's data, the results will be unexpected unless the optional `subView`\r\n * argument is supplied, with correct offset and length.\r\n *\r\n * For both of the above reasons, prefer to use [[fromUint8Array]].\r\n * @deprecated in 3.x. Use [[fromUint8Array]] or [[fromArrayBuffer]].\r\n */\r\n public constructor(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteOffset: number, byteLength: number }) {\r\n if (undefined !== subView) {\r\n this._view = new DataView(buffer, subView.byteOffset, subView.byteLength);\r\n this._byteOffset = subView.byteOffset;\r\n } else {\r\n this._view = new DataView(buffer);\r\n this._byteOffset = 0;\r\n }\r\n }\r\n\r\n /** Construct a new ByteStream for the range of bytes represented by `bytes`, which may be a subset of the range of bytes\r\n * represented by the underlying ArrayBuffer. The read position will be set to the beginning of the range of bytes.\r\n */\r\n public static fromUint8Array(bytes: Uint8Array): ByteStream {\r\n const { byteOffset, byteLength } = bytes;\r\n return new ByteStream(bytes.buffer, { byteOffset, byteLength }); // eslint-disable-line deprecation/deprecation\r\n }\r\n\r\n /** Construct a new ByteStream with the read position set to the beginning.\r\n * @param buffer The underlying buffer from which data is to be extracted.\r\n * @param subView If defined, specifies the subset of the underlying buffer's data to use.\r\n */\r\n public static fromArrayBuffer(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteOffset: number, byteLength: number }): ByteStream {\r\n return new ByteStream(buffer, subView); // eslint-disable-line deprecation/deprecation\r\n }\r\n\r\n /** The number of bytes in this stream */\r\n public get length(): number {\r\n return this._view.byteLength;\r\n }\r\n\r\n /** The number of bytes remaining to be read, from [[curPos]] to the end of the stream. */\r\n public get remainingLength(): number {\r\n return this.length - this.curPos;\r\n }\r\n\r\n /** Returns true if the current read position has been advanced past the end of the stream. This generally indicates that an attempt was made to read more data than is available.\r\n * @see [[isAtTheEnd]]\r\n */\r\n public get isPastTheEnd(): boolean {\r\n return this.curPos > this.length;\r\n }\r\n\r\n /** Returns true if the current read position has advanced precisely to the end of the stream, indicating all of the data has been consumed.\r\n * @see [[isPastTheEnd]].\r\n */\r\n public get isAtTheEnd(): boolean {\r\n return this.curPos === this.length;\r\n }\r\n\r\n /** The current read position as an index into the stream of bytes. */\r\n public get curPos(): number { return this._curPos; }\r\n public set curPos(pos: number) {\r\n this._curPos = pos;\r\n assert(!this.isPastTheEnd);\r\n }\r\n\r\n /** Adds the specified number of bytes to the current read position */\r\n public advance(numBytes: number): boolean {\r\n this.curPos = (this.curPos + numBytes);\r\n return !this.isPastTheEnd;\r\n }\r\n\r\n /** Subtracts the specified number of bytes from the current read position */\r\n public rewind(numBytes: number): boolean {\r\n if (this.curPos - numBytes < 0)\r\n return false;\r\n\r\n this.curPos = this.curPos - numBytes;\r\n return true;\r\n }\r\n\r\n /** Resets the current read position to the beginning of the stream */\r\n public reset(): void { this.curPos = 0; }\r\n\r\n /** Read a unsigned 8-bit integer from the current read position and advance by 1 byte. */\r\n public readUint8(): number { return this.read(1, (view) => view.getUint8(this.curPos)); }\r\n /** Read an unsigned 16-bit integer from the current read position and advance by 2 bytes. */\r\n public readUint16(): number { return this.read(2, (view) => view.getUint16(this.curPos, true)); }\r\n /** Read an unsigned 32-bit integer from the current read position and advance by 4 bytes. */\r\n public readUint32(): number { return this.read(4, (view) => view.getUint32(this.curPos, true)); }\r\n /** Read a signed 32-bit integer from the current read position and advance by 4 bytes. */\r\n public readInt32(): number { return this.read(4, (view) => view.getInt32(this.curPos, true)); }\r\n /** Read a 32-bit floating point number from the current read position and advance by 4 bytes. */\r\n public readFloat32(): number { return this.read(4, (view) => view.getFloat32(this.curPos, true)); }\r\n /** Read a 64-bit floating point number from the current read position and advance by 8 bytes. */\r\n public readFloat64(): number { return this.read(8, (view) => view.getFloat64(this.curPos, true)); }\r\n /** Read an unsigned 64-bit integer from the current read position, advance by 8 bytes, and return the 64-bit value as an Id64String. */\r\n public readId64(): Id64String { return Id64.fromUint32Pair(this.readUint32(), this.readUint32()); }\r\n /** Read an unsigned 24-bit integer from the current read position and advance by 3 bytes. */\r\n public readUint24(): number { return this.readUint8() | (this.readUint8() << 8) | (this.readUint8() << 16); }\r\n\r\n /** @deprecated in 3.x. use [[readUint8]]. */\r\n public get nextUint8(): number { return this.readUint8(); }\r\n /** @deprecated in 3.x. use [[readUint16]]. */\r\n public get nextUint16(): number { return this.readUint16(); }\r\n /** @deprecated in 3.x. use [[readUint32]]. */\r\n public get nextUint32(): number { return this.readUint32(); }\r\n /** @deprecated in 3.x. use [[readInt32]]. */\r\n public get nextInt32(): number { return this.readInt32(); }\r\n /** @deprecated in 3.x. use [[readFloat32]]. */\r\n public get nextFloat32(): number { return this.readFloat32(); }\r\n /** @deprecated in 3.x. use [[readFloat64]]. */\r\n public get nextFloat64(): number { return this.readFloat64(); }\r\n /** @deprecated in 3.x. use [[readId64]]. */\r\n public get nextId64(): Id64String { return this.readId64(); }\r\n /** @deprecated in 3.x. use [[readUint32]]. */\r\n public get nextUint24(): number { return this.readUint24(); }\r\n\r\n /** Read the specified number of bytes beginning at the current read position into a Uint8Array and advance by the specified number of byte.\r\n * @param numBytes The number of bytes to read.\r\n */\r\n public nextBytes(numBytes: number): Uint8Array {\r\n const bytes = new Uint8Array(this.arrayBuffer, this.curPos + this._byteOffset, numBytes);\r\n this.advance(numBytes);\r\n return bytes;\r\n }\r\n\r\n /** Read the specified number of bytes at the specified offset without changing the read position. */\r\n public readBytes(readPos: number, numBytes: number): Uint8Array {\r\n return new Uint8Array(this.arrayBuffer, readPos + this._byteOffset, numBytes);\r\n }\r\n\r\n /** Read the specified number of unsigned 32-bit integers from the current read position and advance the read position. */\r\n public nextUint32s(numUint32s: number): Uint32Array {\r\n const numBytes = numUint32s * 4;\r\n const uint32s = new Uint32Array(this.arrayBuffer, this.curPos + this._byteOffset, numUint32s);\r\n this.advance(numBytes);\r\n return uint32s;\r\n }\r\n\r\n /** Returns the underlying array buffer */\r\n public get arrayBuffer(): ArrayBuffer | SharedArrayBuffer { return this._view.buffer; }\r\n\r\n private read(numBytes: number, read: (view: DataView) => number) {\r\n const result = read(this._view);\r\n this.advance(numBytes);\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ByteStream.js","sourceRoot":"","sources":["../../src/ByteStream.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAc,MAAM,MAAM,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IAKrB;;;;;;;;;;;;;OAaG;IACH,YAAmB,MAAuC,EAAE,OAAoD;QAhBxG,YAAO,GAAW,CAAC,CAAC;QAiB1B,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;YAC1E,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,cAAc,CAAC,KAAiB;QAC5C,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;QACzC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,uDAAuD;IAC1H,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,MAAuC,EAAE,OAAoD;QACzH,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAA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QAAQ,CAAC,CAAC;IAChF,CAAC;IAED,0HAA0H;IACnH,WAAW,CAAC,UAAkB;QACnC,MAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,CAAC;QAChC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC9F,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,0CAA0C;IAC1C,IAAW,WAAW,KAAsC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/E,IAAI,CAAC,QAAgB,EAAE,IAAgC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { assert } from \"./Assert\";\r\nimport { Id64, Id64String } from \"./Id\";\r\n\r\n/** Allows the contents of an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)\r\n * to be consumed sequentially using methods to extract\r\n * data of a particular type from the bytes beginning at the current read position.\r\n * Methods and properties beginning with 'read' and taking no arguments consume data at the current read position and advance it\r\n * by the size of the data read. The read position can also be directly adjusted by the caller.\r\n * @public\r\n */\r\nexport class ByteStream {\r\n private readonly _view: DataView;\r\n private readonly _byteOffset: number;\r\n private _curPos: number = 0;\r\n\r\n /** Construct a new ByteStream with the read position set to the beginning.\r\n * @param buffer The underlying buffer from which data is to be extracted.\r\n * @param subView If defined, specifies the subset of the underlying buffer's data to use.\r\n * This constructor is subject to two common mistakes:\r\n *\r\n * 1. Given `bytes: Uint8Array`, `new ByteStream(bytes)` will compile but at run-time will produce an error asserting that\r\n * the DataView constructor requires an ArrayBuffer. The correct usage is `new ByteStream(bytes.buffer)`.\r\n * 2. Given `bytes: Uint8Array`, `new ByteStream(bytes.buffer)` creates a stream for the entire range of bytes represented by the underlying\r\n * ArrayBuffer. If `bytes` represents only a **sub-range** of the underlying buffer's data, the results will be unexpected unless the optional `subView`\r\n * argument is supplied, with correct offset and length.\r\n *\r\n * For both of the above reasons, prefer to use [[fromUint8Array]].\r\n * @deprecated in 3.x. Use [[fromUint8Array]] or [[fromArrayBuffer]].\r\n */\r\n public constructor(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteOffset: number, byteLength: number }) {\r\n if (undefined !== subView) {\r\n this._view = new DataView(buffer, subView.byteOffset, subView.byteLength);\r\n this._byteOffset = subView.byteOffset;\r\n } else {\r\n this._view = new DataView(buffer);\r\n this._byteOffset = 0;\r\n }\r\n }\r\n\r\n /** Construct a new ByteStream for the range of bytes represented by `bytes`, which may be a subset of the range of bytes\r\n * represented by the underlying ArrayBuffer. The read position will be set to the beginning of the range of bytes.\r\n */\r\n public static fromUint8Array(bytes: Uint8Array): ByteStream {\r\n const { byteOffset, byteLength } = bytes;\r\n return new ByteStream(bytes.buffer, { byteOffset, byteLength }); // eslint-disable-line @typescript-eslint/no-deprecated\r\n }\r\n\r\n /** Construct a new ByteStream with the read position set to the beginning.\r\n * @param buffer The underlying buffer from which data is to be extracted.\r\n * @param subView If defined, specifies the subset of the underlying buffer's data to use.\r\n */\r\n public static fromArrayBuffer(buffer: ArrayBuffer | SharedArrayBuffer, subView?: { byteOffset: number, byteLength: number }): ByteStream {\r\n return new ByteStream(buffer, subView); // eslint-disable-line @typescript-eslint/no-deprecated\r\n }\r\n\r\n /** The number of bytes in this stream */\r\n public get length(): number {\r\n return this._view.byteLength;\r\n }\r\n\r\n /** The number of bytes remaining to be read, from [[curPos]] to the end of the stream. */\r\n public get remainingLength(): number {\r\n return this.length - this.curPos;\r\n }\r\n\r\n /** Returns true if the current read position has been advanced past the end of the stream. This generally indicates that an attempt was made to read more data than is available.\r\n * @see [[isAtTheEnd]]\r\n */\r\n public get isPastTheEnd(): boolean {\r\n return this.curPos > this.length;\r\n }\r\n\r\n /** Returns true if the current read position has advanced precisely to the end of the stream, indicating all of the data has been consumed.\r\n * @see [[isPastTheEnd]].\r\n */\r\n public get isAtTheEnd(): boolean {\r\n return this.curPos === this.length;\r\n }\r\n\r\n /** The current read position as an index into the stream of bytes. */\r\n public get curPos(): number { return this._curPos; }\r\n public set curPos(pos: number) {\r\n this._curPos = pos;\r\n assert(!this.isPastTheEnd);\r\n }\r\n\r\n /** Adds the specified number of bytes to the current read position */\r\n public advance(numBytes: number): boolean {\r\n this.curPos = (this.curPos + numBytes);\r\n return !this.isPastTheEnd;\r\n }\r\n\r\n /** Subtracts the specified number of bytes from the current read position */\r\n public rewind(numBytes: number): boolean {\r\n if (this.curPos - numBytes < 0)\r\n return false;\r\n\r\n this.curPos = this.curPos - numBytes;\r\n return true;\r\n }\r\n\r\n /** Resets the current read position to the beginning of the stream */\r\n public reset(): void { this.curPos = 0; }\r\n\r\n /** Read a unsigned 8-bit integer from the current read position and advance by 1 byte. */\r\n public readUint8(): number { return this.read(1, (view) => view.getUint8(this.curPos)); }\r\n /** Read an unsigned 16-bit integer from the current read position and advance by 2 bytes. */\r\n public readUint16(): number { return this.read(2, (view) => view.getUint16(this.curPos, true)); }\r\n /** Read an unsigned 32-bit integer from the current read position and advance by 4 bytes. */\r\n public readUint32(): number { return this.read(4, (view) => view.getUint32(this.curPos, true)); }\r\n /** Read a signed 32-bit integer from the current read position and advance by 4 bytes. */\r\n public readInt32(): number { return this.read(4, (view) => view.getInt32(this.curPos, true)); }\r\n /** Read a 32-bit floating point number from the current read position and advance by 4 bytes. */\r\n public readFloat32(): number { return this.read(4, (view) => view.getFloat32(this.curPos, true)); }\r\n /** Read a 64-bit floating point number from the current read position and advance by 8 bytes. */\r\n public readFloat64(): number { return this.read(8, (view) => view.getFloat64(this.curPos, true)); }\r\n /** Read an unsigned 64-bit integer from the current read position, advance by 8 bytes, and return the 64-bit value as an Id64String. */\r\n public readId64(): Id64String { return Id64.fromUint32Pair(this.readUint32(), this.readUint32()); }\r\n /** Read an unsigned 24-bit integer from the current read position and advance by 3 bytes. */\r\n public readUint24(): number { return this.readUint8() | (this.readUint8() << 8) | (this.readUint8() << 16); }\r\n\r\n /** @deprecated in 3.x. use [[readUint8]]. */\r\n public get nextUint8(): number { return this.readUint8(); }\r\n /** @deprecated in 3.x. use [[readUint16]]. */\r\n public get nextUint16(): number { return this.readUint16(); }\r\n /** @deprecated in 3.x. use [[readUint32]]. */\r\n public get nextUint32(): number { return this.readUint32(); }\r\n /** @deprecated in 3.x. use [[readInt32]]. */\r\n public get nextInt32(): number { return this.readInt32(); }\r\n /** @deprecated in 3.x. use [[readFloat32]]. */\r\n public get nextFloat32(): number { return this.readFloat32(); }\r\n /** @deprecated in 3.x. use [[readFloat64]]. */\r\n public get nextFloat64(): number { return this.readFloat64(); }\r\n /** @deprecated in 3.x. use [[readId64]]. */\r\n public get nextId64(): Id64String { return this.readId64(); }\r\n /** @deprecated in 3.x. use [[readUint32]]. */\r\n public get nextUint24(): number { return this.readUint24(); }\r\n\r\n /** Read the specified number of bytes beginning at the current read position into a Uint8Array and advance by the specified number of byte.\r\n * @param numBytes The number of bytes to read.\r\n */\r\n public nextBytes(numBytes: number): Uint8Array {\r\n const bytes = new Uint8Array(this.arrayBuffer, this.curPos + this._byteOffset, numBytes);\r\n this.advance(numBytes);\r\n return bytes;\r\n }\r\n\r\n /** Read the specified number of bytes at the specified offset without changing the read position. */\r\n public readBytes(readPos: number, numBytes: number): Uint8Array {\r\n return new Uint8Array(this.arrayBuffer, readPos + this._byteOffset, numBytes);\r\n }\r\n\r\n /** Read the specified number of unsigned 32-bit integers from the current read position and advance the read position. */\r\n public nextUint32s(numUint32s: number): Uint32Array {\r\n const numBytes = numUint32s * 4;\r\n const uint32s = new Uint32Array(this.arrayBuffer, this.curPos + this._byteOffset, numUint32s);\r\n this.advance(numBytes);\r\n return uint32s;\r\n }\r\n\r\n /** Returns the underlying array buffer */\r\n public get arrayBuffer(): ArrayBuffer | SharedArrayBuffer { return this._view.buffer; }\r\n\r\n private read(numBytes: number, read: (view: DataView) => number) {\r\n const result = read(this._view);\r\n this.advance(numBytes);\r\n return result;\r\n }\r\n}\r\n"]}
@@ -116,7 +116,7 @@ export declare class MutableCompressedId64Set implements OrderedId64Iterable {
116
116
  /** Remove all Ids from the set, then add the specified Ids. */
117
117
  reset(ids?: CompressedId64Set): void;
118
118
  /** Obtain an iterator over the Ids in this set. The Ids are returned in ascending order based on their unsigned 64-bit integer values. */
119
- [Symbol.iterator](): Iterator<string, any, undefined>;
119
+ [Symbol.iterator](): Iterator<string, any, any>;
120
120
  /** Compute a compact string representation of the union of this and another set of Ids - i.e., those Ids present in either this and/or the other set. */
121
121
  computeUnion(ids: OrderedId64Iterable | CompressedId64Set | MutableCompressedId64Set): CompressedId64Set;
122
122
  /** Compute a compact string representation of the intersection of this and another set of Ids - i.e., those Ids present in both this and the other set. */
@@ -1 +1 @@
1
- {"version":3,"file":"Disposable.d.ts","sourceRoot":"","sources":["../../src/Disposable.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAG9D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,SAAS,CAI3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,CAAC,EA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EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,GAAG,OAAO,CAkB/G;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAQrC;;GAEG;AACH,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,YAAY,CAAgB;IAEpC,iCAAiC;gBACrB,WAAW,GAAE,KAAK,CAAC,WAAW,GAAG,WAAW,CAAM;IAO9D,OAAO,CAAC,YAAY;IAIpB,uCAAuC;IAChC,GAAG,CAAC,UAAU,EAAE,WAAW,GAAG,WAAW;IAOhD,oCAAoC;IAC7B,MAAM,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI;IAM5C,uCAAuC;IAChC,OAAO,IAAI,IAAI;CAIvB"}
@@ -10,7 +10,6 @@
10
10
  * @public
11
11
  */
12
12
  export function isIDisposable(obj) {
13
- // eslint-disable-next-line @typescript-eslint/unbound-method
14
13
  return !!obj && (obj instanceof Object) && !!obj.dispose && (typeof obj.dispose === "function");
15
14
  }
16
15
  /** Convenience function for disposing of a disposable object that may be undefined.
@@ -1 +1 @@
1
- {"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../src/Disposable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAwBH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,6DAA6D;IAC7D,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,YAAY,MAAM,CAAC,IAAI,CAAC,CAAE,GAAmB,CAAC,OAAO,IAAI,CAAC,OAAQ,GAAmB,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;AACpI,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,OAAO,CAAC,UAAwB;IAC9C,IAAI,SAAS,KAAK,UAAU;QAC1B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MA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OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACjC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,YAAY,CAAC,CAA4B;QAC/C,OAAQ,CAAiB,CAAC,OAAO,KAAK,SAAS,CAAC;IAClD,CAAC;IAED,uCAAuC;IAChC,GAAG,CAAC,UAAqC;QAC9C,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;;YAEnC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,oCAAoC;IAC7B,MAAM,CAAC,UAAuB;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,CAAC,KAAK,GAAG;YACZ,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY;YACxC,UAAU,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Interface adopted by a type which has deterministic cleanup logic.\r\n * For example:\r\n * - Most rendering-related types, such as [[RenderGraphic]] and [[Viewport]], own WebGL resources which must be explicitly released when no longer needed.\r\n * - Some low-level objects like [[ECDb]] own native types defined in C++ code which must be explicitly released when no longer needed.\r\n *\r\n * A similar concept exists in languages like C++ (implemented as \"destructors\") and C# (\"IDisposable\").\r\n * However, because TypeScript and Javascript lack any built-in support for deterministic destruction, it is up to the programmer to ensure dispose() is called appropriately.\r\n * Failure to do so may result in memory leaks or leaking of other resources.\r\n *\r\n * IDisposable tends to be contagious; that is, if a type has members which implement IDisposable, that type should also implement IDisposable to dispose of those members.\r\n *\r\n * Implementations of IDisposable tend to be more \"low-level\" types. The disposal of such types is often handled on your behalf.\r\n * However, always consult the documentation for an IDisposable type to determine under what circumstances you are expected to explicitly dispose of it.\r\n * @public\r\n */\r\nexport interface IDisposable {\r\n /** Disposes of any resources owned by this object.\r\n * @note The object is generally considered unusable after it has been disposed of.\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * A type guard that checks whether the given argument implements `IDisposable` interface\r\n * @public\r\n */\r\nexport function isIDisposable(obj: unknown): obj is IDisposable {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n return !!obj && (obj instanceof Object) && !!(obj as IDisposable).dispose && (typeof (obj as IDisposable).dispose === \"function\");\r\n}\r\n\r\n/** Convenience function for disposing of a disposable object that may be undefined.\r\n * This is primarily used to simplify implementations of [[IDisposable.dispose]].\r\n * As a simple example:\r\n * ```ts\r\n * class Disposable implements IDisposable {\r\n * public member1?: DisposableType1;\r\n * public member2?: DisposableType2;\r\n *\r\n * public dispose() {\r\n * this.member1 = dispose(this.member1); // If member1 is defined, dispose of it and set it to undefined.\r\n * this.member2 = dispose(this.member2); // Likewise for member2.\r\n * }\r\n * }\r\n * ```\r\n * @param disposable The object to be disposed of.\r\n * @returns undefined\r\n * @public\r\n */\r\nexport function dispose(disposable?: IDisposable): undefined {\r\n if (undefined !== disposable)\r\n disposable.dispose();\r\n return undefined;\r\n}\r\n\r\n/** Disposes of and empties a list of disposable objects.\r\n * @param list The list of disposable objects.\r\n * @returns undefined\r\n * @public\r\n */\r\nexport function disposeArray(list?: IDisposable[]): undefined {\r\n if (undefined === list)\r\n return undefined;\r\n\r\n for (const entry of list)\r\n dispose(entry);\r\n\r\n list.length = 0;\r\n return undefined;\r\n}\r\n\r\n/** A 'using' function which is a substitution for .NET's using statement. It makes sure that 'dispose'\r\n * is called on the resource no matter if the func returns or throws. If func returns, the return value\r\n * of this function is equal to return value of func. If func throws, this function also throws (after\r\n * disposing the resource).\r\n * @public\r\n */\r\nexport function using<T extends IDisposable, TResult>(resources: T | T[], func: (...r: T[]) => TResult): TResult {\r\n if (!Array.isArray(resources))\r\n return using([resources], func);\r\n\r\n const doDispose = () => resources.forEach((disposable) => disposable.dispose());\r\n let shouldDisposeImmediately = true;\r\n\r\n try {\r\n const result = func(...resources);\r\n if (result instanceof Promise) {\r\n shouldDisposeImmediately = false;\r\n result.then(doDispose, doDispose);\r\n }\r\n return result;\r\n } finally {\r\n if (shouldDisposeImmediately)\r\n doDispose();\r\n }\r\n}\r\n\r\n/** A definition of function which may be called to dispose an object\r\n * @public\r\n */\r\nexport type DisposeFunc = () => void;\r\n\r\nclass FuncDisposable implements IDisposable {\r\n private _disposeFunc: () => void;\r\n constructor(disposeFunc: () => void) { this._disposeFunc = disposeFunc; }\r\n public dispose() { this._disposeFunc(); }\r\n}\r\n\r\n/** A disposable container of disposable objects.\r\n * @public\r\n */\r\nexport class DisposableList implements IDisposable {\r\n private _disposables: IDisposable[];\r\n\r\n /** Creates a disposable list. */\r\n constructor(disposables: Array<IDisposable | DisposeFunc> = []) {\r\n this._disposables = [];\r\n disposables.forEach((disposable) => {\r\n this.add(disposable);\r\n });\r\n }\r\n\r\n private isDisposable(x: IDisposable | DisposeFunc): x is IDisposable {\r\n return (x as IDisposable).dispose !== undefined;\r\n }\r\n\r\n /** Register an object for disposal. */\r\n public add(disposable: IDisposable | DisposeFunc) {\r\n if (this.isDisposable(disposable))\r\n this._disposables.push(disposable);\r\n else\r\n this._disposables.push(new FuncDisposable(disposable));\r\n }\r\n\r\n /** Unregister disposable object. */\r\n public remove(disposable: IDisposable): void {\r\n const idx = this._disposables.indexOf(disposable);\r\n if (-1 !== idx)\r\n this._disposables.splice(idx, 1);\r\n }\r\n\r\n /** Disposes all registered objects. */\r\n public dispose(): void {\r\n for (const disposable of this._disposables)\r\n disposable.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Disposable.js","sourceRoot":"","sources":["../../src/Disposable.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAwBH;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,YAAY,MAAM,CAAC,IAAI,CAAC,CAAE,GAAmB,CAAC,OAAO,IAAI,CAAC,OAAQ,GAAmB,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;AACpI,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,OAAO,CAAC,UAAwB;IAC9C,IAAI,SAAS,KAAK,UAAU;QAC1B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAoB;IAC/C,IAAI,SAAS,KAAK,IAAI;QACpB,OAAO,SAAS,CAAC;IAEnB,KAAK,MAAM,KAAK,IAAI,IAAI;QACtB,OAAO,CAAC,KAAK,CAAC,CAAC;IAEjB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAChB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAiC,SAAkB,EAAE,IAA4B;IACpG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;QAC3B,OAAO,KAAK,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;IAElC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IAChF,IAAI,wBAAwB,GAAG,IAAI,CAAC;IAEpC,IAAI,CAAC;QACH,MAA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CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,uCAAuC;IAChC,OAAO;QACZ,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY;YACxC,UAAU,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Interface adopted by a type which has deterministic cleanup logic.\r\n * For example:\r\n * - Most rendering-related types, such as [[RenderGraphic]] and [[Viewport]], own WebGL resources which must be explicitly released when no longer needed.\r\n * - Some low-level objects like [[ECDb]] own native types defined in C++ code which must be explicitly released when no longer needed.\r\n *\r\n * A similar concept exists in languages like C++ (implemented as \"destructors\") and C# (\"IDisposable\").\r\n * However, because TypeScript and Javascript lack any built-in support for deterministic destruction, it is up to the programmer to ensure dispose() is called appropriately.\r\n * Failure to do so may result in memory leaks or leaking of other resources.\r\n *\r\n * IDisposable tends to be contagious; that is, if a type has members which implement IDisposable, that type should also implement IDisposable to dispose of those members.\r\n *\r\n * Implementations of IDisposable tend to be more \"low-level\" types. The disposal of such types is often handled on your behalf.\r\n * However, always consult the documentation for an IDisposable type to determine under what circumstances you are expected to explicitly dispose of it.\r\n * @public\r\n */\r\nexport interface IDisposable {\r\n /** Disposes of any resources owned by this object.\r\n * @note The object is generally considered unusable after it has been disposed of.\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * A type guard that checks whether the given argument implements `IDisposable` interface\r\n * @public\r\n */\r\nexport function isIDisposable(obj: unknown): obj is IDisposable {\r\n return !!obj && (obj instanceof Object) && !!(obj as IDisposable).dispose && (typeof (obj as IDisposable).dispose === \"function\");\r\n}\r\n\r\n/** Convenience function for disposing of a disposable object that may be undefined.\r\n * This is primarily used to simplify implementations of [[IDisposable.dispose]].\r\n * As a simple example:\r\n * ```ts\r\n * class Disposable implements IDisposable {\r\n * public member1?: DisposableType1;\r\n * public member2?: DisposableType2;\r\n *\r\n * public dispose() {\r\n * this.member1 = dispose(this.member1); // If member1 is defined, dispose of it and set it to undefined.\r\n * this.member2 = dispose(this.member2); // Likewise for member2.\r\n * }\r\n * }\r\n * ```\r\n * @param disposable The object to be disposed of.\r\n * @returns undefined\r\n * @public\r\n */\r\nexport function dispose(disposable?: IDisposable): undefined {\r\n if (undefined !== disposable)\r\n disposable.dispose();\r\n return undefined;\r\n}\r\n\r\n/** Disposes of and empties a list of disposable objects.\r\n * @param list The list of disposable objects.\r\n * @returns undefined\r\n * @public\r\n */\r\nexport function disposeArray(list?: IDisposable[]): undefined {\r\n if (undefined === list)\r\n return undefined;\r\n\r\n for (const entry of list)\r\n dispose(entry);\r\n\r\n list.length = 0;\r\n return undefined;\r\n}\r\n\r\n/** A 'using' function which is a substitution for .NET's using statement. It makes sure that 'dispose'\r\n * is called on the resource no matter if the func returns or throws. If func returns, the return value\r\n * of this function is equal to return value of func. If func throws, this function also throws (after\r\n * disposing the resource).\r\n * @public\r\n */\r\nexport function using<T extends IDisposable, TResult>(resources: T | T[], func: (...r: T[]) => TResult): TResult {\r\n if (!Array.isArray(resources))\r\n return using([resources], func);\r\n\r\n const doDispose = () => resources.forEach((disposable) => disposable.dispose());\r\n let shouldDisposeImmediately = true;\r\n\r\n try {\r\n const result = func(...resources);\r\n if (result instanceof Promise) {\r\n shouldDisposeImmediately = false;\r\n result.then(doDispose, doDispose);\r\n }\r\n return result;\r\n } finally {\r\n if (shouldDisposeImmediately)\r\n doDispose();\r\n }\r\n}\r\n\r\n/** A definition of function which may be called to dispose an object\r\n * @public\r\n */\r\nexport type DisposeFunc = () => void;\r\n\r\nclass FuncDisposable implements IDisposable {\r\n private _disposeFunc: () => void;\r\n constructor(disposeFunc: () => void) { this._disposeFunc = disposeFunc; }\r\n public dispose() { this._disposeFunc(); }\r\n}\r\n\r\n/** A disposable container of disposable objects.\r\n * @public\r\n */\r\nexport class DisposableList implements IDisposable {\r\n private _disposables: IDisposable[];\r\n\r\n /** Creates a disposable list. */\r\n constructor(disposables: Array<IDisposable | DisposeFunc> = []) {\r\n this._disposables = [];\r\n disposables.forEach((disposable) => {\r\n this.add(disposable);\r\n });\r\n }\r\n\r\n private isDisposable(x: IDisposable | DisposeFunc): x is IDisposable {\r\n return (x as IDisposable).dispose !== undefined;\r\n }\r\n\r\n /** Register an object for disposal. */\r\n public add(disposable: IDisposable | DisposeFunc) {\r\n if (this.isDisposable(disposable))\r\n this._disposables.push(disposable);\r\n else\r\n this._disposables.push(new FuncDisposable(disposable));\r\n }\r\n\r\n /** Unregister disposable object. */\r\n public remove(disposable: IDisposable): void {\r\n const idx = this._disposables.indexOf(disposable);\r\n if (-1 !== idx)\r\n this._disposables.splice(idx, 1);\r\n }\r\n\r\n /** Disposes all registered objects. */\r\n public dispose(): void {\r\n for (const disposable of this._disposables)\r\n disposable.dispose();\r\n }\r\n}\r\n"]}
package/lib/esm/Id.js CHANGED
@@ -305,7 +305,7 @@ export var Id64;
305
305
  Id64.iterable = iterable;
306
306
  /** Return the first [[Id64String]] of an [[Id64Arg]]. */
307
307
  function getFirst(arg) {
308
- return typeof arg === "string" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value);
308
+ return typeof arg === "string" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;
309
309
  }
310
310
  Id64.getFirst = getFirst;
311
311
  /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */