@itwin/core-backend 3.6.0-dev.8 → 3.7.0-dev.1

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 (98) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/AliCloudStorageService.d.ts +2 -2
  4. package/lib/cjs/AliCloudStorageService.js +1 -1
  5. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  6. package/lib/cjs/BackendHubAccess.d.ts +3 -3
  7. package/lib/cjs/BackendHubAccess.js.map +1 -1
  8. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  9. package/lib/cjs/BriefcaseManager.js +1 -0
  10. package/lib/cjs/BriefcaseManager.js.map +1 -1
  11. package/lib/cjs/ChangeSummaryManager.d.ts +2 -2
  12. package/lib/cjs/ChangeSummaryManager.js +1 -1
  13. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  14. package/lib/cjs/CheckpointManager.d.ts +3 -2
  15. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  16. package/lib/cjs/CheckpointManager.js +14 -8
  17. package/lib/cjs/CheckpointManager.js.map +1 -1
  18. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  19. package/lib/cjs/ClassRegistry.js +2 -1
  20. package/lib/cjs/ClassRegistry.js.map +1 -1
  21. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  22. package/lib/cjs/CloudSqlite.js +2 -1
  23. package/lib/cjs/CloudSqlite.js.map +1 -1
  24. package/lib/cjs/CloudStorageBackend.d.ts +4 -4
  25. package/lib/cjs/CloudStorageBackend.js +3 -3
  26. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  27. package/lib/cjs/CodeSpecs.d.ts +5 -0
  28. package/lib/cjs/CodeSpecs.d.ts.map +1 -1
  29. package/lib/cjs/CodeSpecs.js +12 -0
  30. package/lib/cjs/CodeSpecs.js.map +1 -1
  31. package/lib/cjs/ECSqlStatement.d.ts +8 -1
  32. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  33. package/lib/cjs/ECSqlStatement.js.map +1 -1
  34. package/lib/cjs/Element.d.ts +10 -3
  35. package/lib/cjs/Element.d.ts.map +1 -1
  36. package/lib/cjs/Element.js +17 -6
  37. package/lib/cjs/Element.js.map +1 -1
  38. package/lib/cjs/ElementAspect.d.ts +5 -2
  39. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  40. package/lib/cjs/ElementAspect.js +1 -1
  41. package/lib/cjs/ElementAspect.js.map +1 -1
  42. package/lib/cjs/IModelCloneContext.d.ts +2 -2
  43. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  44. package/lib/cjs/IModelCloneContext.js +1 -1
  45. package/lib/cjs/IModelCloneContext.js.map +1 -1
  46. package/lib/cjs/IModelDb.d.ts +29 -2
  47. package/lib/cjs/IModelDb.d.ts.map +1 -1
  48. package/lib/cjs/IModelDb.js +40 -28
  49. package/lib/cjs/IModelDb.js.map +1 -1
  50. package/lib/cjs/IModelHost.d.ts +7 -8
  51. package/lib/cjs/IModelHost.d.ts.map +1 -1
  52. package/lib/cjs/IModelHost.js.map +1 -1
  53. package/lib/cjs/IpcHost.js +4 -4
  54. package/lib/cjs/IpcHost.js.map +1 -1
  55. package/lib/cjs/LocalHub.d.ts.map +1 -1
  56. package/lib/cjs/LocalHub.js +1 -3
  57. package/lib/cjs/LocalHub.js.map +1 -1
  58. package/lib/cjs/Material.d.ts +49 -21
  59. package/lib/cjs/Material.d.ts.map +1 -1
  60. package/lib/cjs/Material.js +41 -7
  61. package/lib/cjs/Material.js.map +1 -1
  62. package/lib/cjs/RpcBackend.d.ts.map +1 -1
  63. package/lib/cjs/RpcBackend.js +1 -0
  64. package/lib/cjs/RpcBackend.js.map +1 -1
  65. package/lib/cjs/domains/FunctionalSchema.d.ts +1 -1
  66. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
  67. package/lib/cjs/domains/FunctionalSchema.js +1 -1
  68. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  69. package/lib/cjs/rpc/multipart.d.ts.map +1 -1
  70. package/lib/cjs/rpc/multipart.js +1 -0
  71. package/lib/cjs/rpc/multipart.js.map +1 -1
  72. package/lib/cjs/rpc/tracing.d.ts.map +1 -1
  73. package/lib/cjs/rpc/tracing.js +1 -0
  74. package/lib/cjs/rpc/tracing.js.map +1 -1
  75. package/lib/cjs/rpc/web/logging.d.ts.map +1 -1
  76. package/lib/cjs/rpc/web/logging.js +1 -0
  77. package/lib/cjs/rpc/web/logging.js.map +1 -1
  78. package/lib/cjs/rpc/web/request.d.ts.map +1 -1
  79. package/lib/cjs/rpc/web/request.js +1 -0
  80. package/lib/cjs/rpc/web/request.js.map +1 -1
  81. package/lib/cjs/rpc/web/response.d.ts.map +1 -1
  82. package/lib/cjs/rpc/web/response.js +1 -0
  83. package/lib/cjs/rpc/web/response.js.map +1 -1
  84. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  85. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
  86. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  87. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +34 -31
  88. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  89. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  90. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +10 -7
  91. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  92. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +2 -2
  93. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  94. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  95. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  96. package/lib/cjs/workspace/Workspace.js +2 -2
  97. package/lib/cjs/workspace/Workspace.js.map +1 -1
  98. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiB,cAAc,EAAE,iBAAiB,EAA6B,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACrI,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAGtC,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,YAM9D;AAED,gBAAgB;AAChB,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,+BA4CjE;AAED,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,QAG/F"}
1
+ {"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAiB,cAAc,EAAE,iBAAiB,EAA6B,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACrI,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAKtC,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,YAM9D;AAED,gBAAgB;AAChB,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,+BA4CjE;AAED,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,QAG/F"}
@@ -11,6 +11,7 @@ exports.appendToMultipartForm = exports.parseMultipartRequest = exports.createMu
11
11
  const core_common_1 = require("@itwin/core-common");
12
12
  const FormData = require("form-data");
13
13
  const multiparty = require("multiparty");
14
+ /* eslint-disable deprecation/deprecation */
14
15
  /** @internal */
15
16
  function createMultipartStream(value) {
16
17
  const form = new FormData();
@@ -1 +1 @@
1
- {"version":3,"file":"multipart.js","sourceRoot":"","sources":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DAGC","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 RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\r\nimport * as FormData from \"form-data\";\r\nimport * as multiparty from \"multiparty\";\r\n\r\n/** @internal */\r\nexport function createMultipartStream(value: RpcSerializedValue) {\r\n const form = new FormData();\r\n RpcMultipart.writeValueToForm(form, value);\r\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\r\n // fine for now.\r\n return form;\r\n}\r\n\r\n/** @internal */\r\nexport async function parseMultipartRequest(req: HttpServerRequest) {\r\n return new Promise<RpcSerializedValue>((resolve, reject) => {\r\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\r\n form.on(\"error\", (err) => {\r\n reject(err);\r\n });\r\n\r\n const value = RpcSerializedValue.create();\r\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\r\n\r\n form.on(\"part\", (part: multiparty.Part) => {\r\n part.on(\"data\", (chunk: string | Buffer) => {\r\n if (part.name === \"objects\") {\r\n value.objects += chunk.toString();\r\n } else if (Buffer.isBuffer(chunk)) {\r\n if (!data[part.name]) {\r\n data[part.name] = { size: 0, chunks: [] };\r\n }\r\n\r\n data[part.name].size += chunk.byteLength;\r\n data[part.name].chunks.push(chunk);\r\n } else {\r\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\r\n }\r\n });\r\n });\r\n\r\n form.on(\"close\", () => {\r\n let i = 0;\r\n for (; ;) {\r\n const part = data[`data-${i}`];\r\n if (!part) {\r\n break;\r\n }\r\n\r\n value.data.push(Buffer.concat(part.chunks, part.size));\r\n ++i;\r\n }\r\n\r\n resolve(value);\r\n });\r\n\r\n form.parse(req);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\r\n const buf = value.data[i];\r\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\r\n}\r\n"]}
1
+ {"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAqI;AACrI,sCAAsC;AACtC,yCAAyC;AAEzC,4CAA4C;AAE5C,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,KAAyB;IAC7D,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,0BAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,mHAAmH;IACnH,gBAAgB;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAND,sDAMC;AAED,gBAAgB;AACT,KAAK,UAAU,qBAAqB,CAAC,GAAsB;IAChE,OAAO,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACvB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,gCAAkB,CAAC,MAAM,EAAE,CAAC;QAC1C,MAAM,IAAI,GAA4D,EAAE,CAAC;QAEzE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAqB,EAAE,EAAE;YACxC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAsB,EAAE,EAAE;gBACzC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;oBAC3B,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QA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AAC,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AACpF,CAAC;AAHD,sDAGC","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 RpcInterface\r\n */\r\n\r\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\r\nimport * as FormData from \"form-data\";\r\nimport * as multiparty from \"multiparty\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/** @internal */\r\nexport function createMultipartStream(value: RpcSerializedValue) {\r\n const form = new FormData();\r\n RpcMultipart.writeValueToForm(form, value);\r\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\r\n // fine for now.\r\n return form;\r\n}\r\n\r\n/** @internal */\r\nexport async function parseMultipartRequest(req: HttpServerRequest) {\r\n return new Promise<RpcSerializedValue>((resolve, reject) => {\r\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\r\n form.on(\"error\", (err) => {\r\n reject(err);\r\n });\r\n\r\n const value = RpcSerializedValue.create();\r\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\r\n\r\n form.on(\"part\", (part: multiparty.Part) => {\r\n part.on(\"data\", (chunk: string | Buffer) => {\r\n if (part.name === \"objects\") {\r\n value.objects += chunk.toString();\r\n } else if (Buffer.isBuffer(chunk)) {\r\n if (!data[part.name]) {\r\n data[part.name] = { size: 0, chunks: [] };\r\n }\r\n\r\n data[part.name].size += chunk.byteLength;\r\n data[part.name].chunks.push(chunk);\r\n } else {\r\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\r\n }\r\n });\r\n });\r\n\r\n form.on(\"close\", () => {\r\n let i = 0;\r\n for (; ;) {\r\n const part = data[`data-${i}`];\r\n if (!part) {\r\n break;\r\n }\r\n\r\n value.data.push(Buffer.concat(part.chunks, part.size));\r\n ++i;\r\n }\r\n\r\n resolve(value);\r\n });\r\n\r\n form.parse(req);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\r\n const buf = value.data[i];\r\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AAKhE;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAElD;;SAEK;IACL,WAAkB,eAAe,IAAI,WAAW,GAAG,SAAS,CAE3D;IAED;;SAEK;IACL,WAAkB,qBAAqB,IAAI,WAAW,CAGrD;IAED,8CAA8C;WAC1B,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAInF,0EAA0E;WACtD,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAM5F;AAED,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,mBAAmB,GAAE,OAAe,QAmBrE"}
1
+ {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AAOhE;;;;;;GAMG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAElD;;SAEK;IACL,WAAkB,eAAe,IAAI,WAAW,GAAG,SAAS,CAE3D;IAED;;SAEK;IACL,WAAkB,qBAAqB,IAAI,WAAW,CAGrD;IAED,8CAA8C;WAC1B,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAInF,0EAA0E;WACtD,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAM5F;AAED,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,mBAAmB,GAAE,OAAe,QAmBrE"}
@@ -14,6 +14,7 @@ const core_common_1 = require("@itwin/core-common");
14
14
  const async_hooks_1 = require("async_hooks");
15
15
  const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
16
16
  const IModelHost_1 = require("../IModelHost");
17
+ /* eslint-disable deprecation/deprecation */
17
18
  /**
18
19
  * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
19
20
  * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;I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AC,CAAC,mEAAmE;SACtH;QAAC,OAAO,CAAC,EAAE;YACV,gEAAgE;YAChE,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC;AAnBD,8CAmBC","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 RpcInterface\r\n */\r\n\r\n// cspell:ignore calltrace\r\n\r\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\r\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\r\nimport { AsyncLocalStorage } from \"async_hooks\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/**\r\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\r\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\r\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\r\n * from the RpcActivity.\r\n * @public\r\n */\r\nexport class RpcTrace {\r\n private static _storage = new AsyncLocalStorage();\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\r\n * RpcActivity in the current call stack.\r\n * */\r\n public static get currentActivity(): RpcActivity | undefined {\r\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\r\n }\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\r\n * exists in the current call stack.\r\n * */\r\n public static get expectCurrentActivity(): RpcActivity {\r\n assert(undefined !== RpcTrace.currentActivity);\r\n return RpcTrace.currentActivity;\r\n }\r\n\r\n /** Start the processing of an RpcActivity. */\r\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return RpcTrace._storage.run(activity, fn);\r\n }\r\n\r\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\r\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\r\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\r\n kind: SpanKind.SERVER,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\r\n RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer\r\n\r\n if (enableOpenTelemetry) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const api = require(\"@opentelemetry/api\");\r\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\r\n Tracing.enableOpenTelemetry(tracer, api);\r\n RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\r\n Logger.logException(BackendLoggerCategory.IModelHost, e);\r\n }\r\n }\r\n\r\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\r\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\r\n}\r\n"]}
1
+ {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0B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AAO,CAAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE,uBAAU,CAAC,cAAc,CAAC,CAAC;YACrF,sBAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,mEAAmE;SACtH;QAAC,OAAO,CAAC,EAAE;YACV,gEAAgE;YAChE,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC;AAnBD,8CAmBC","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 RpcInterface\r\n */\r\n\r\n// cspell:ignore calltrace\r\n\r\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\r\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\r\nimport { AsyncLocalStorage } from \"async_hooks\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\n/**\r\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\r\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\r\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\r\n * from the RpcActivity.\r\n * @public\r\n */\r\nexport class RpcTrace {\r\n private static _storage = new AsyncLocalStorage();\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\r\n * RpcActivity in the current call stack.\r\n * */\r\n public static get currentActivity(): RpcActivity | undefined {\r\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\r\n }\r\n\r\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\r\n * exists in the current call stack.\r\n * */\r\n public static get expectCurrentActivity(): RpcActivity {\r\n assert(undefined !== RpcTrace.currentActivity);\r\n return RpcTrace.currentActivity;\r\n }\r\n\r\n /** Start the processing of an RpcActivity. */\r\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return RpcTrace._storage.run(activity, fn);\r\n }\r\n\r\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\r\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\r\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\r\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\r\n kind: SpanKind.SERVER,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\r\n RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer\r\n\r\n if (enableOpenTelemetry) {\r\n try {\r\n // eslint-disable-next-line @typescript-eslint/no-var-requires\r\n const api = require(\"@opentelemetry/api\");\r\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\r\n Tracing.enableOpenTelemetry(tracer, api);\r\n RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\r\n Logger.logException(BackendLoggerCategory.IModelHost, e);\r\n }\r\n }\r\n\r\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\r\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAwB,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG7G,qBAAa,uBAAwB,SAAQ,gBAAgB;cAClC,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;cAQrF,WAAW,IAAI,MAAM;YAI1B,eAAe;CAiB9B"}
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAwB,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK7G,qBAAa,uBAAwB,SAAQ,gBAAgB;cAClC,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;cAQrF,WAAW,IAAI,MAAM;YAI1B,eAAe;CAiB9B"}
@@ -11,6 +11,7 @@ exports.WebAppRpcLoggingBackend = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  const os = require("os");
14
+ /* eslint-disable deprecation/deprecation */
14
15
  class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
15
16
  async logProtocolEvent(event, object) {
16
17
  switch (event) {
@@ -1 +1 @@
1
- {"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":";AAAA;;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AAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACnG,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM;YACjC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI;YAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,YAAY;YACZ,uGAAuG;YACvG,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,OAAO;SACX,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AA9BD,0DA8BC","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 RpcInterface\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory, RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from \"@itwin/core-common\";\r\nimport * as os from \"os\";\r\n\r\nexport class WebAppRpcLoggingBackend extends WebAppRpcLogging {\r\n protected override async logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void> {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestReceived: return this.logRequest(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.request\", object.request);\r\n case RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend(\"RpcInterface.backend.error\", object);\r\n case RpcProtocolEvent.BackendResponseCreated: return this.logResponse(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.response\", object.request, object.status, object.elapsed);\r\n }\r\n }\r\n\r\n protected override getHostname(): string {\r\n return os.hostname();\r\n }\r\n\r\n private async logErrorBackend(message: string, invocation: RpcInvocation): Promise<void> {\r\n const operationDescriptor = this.buildOperationDescriptor(invocation.operation);\r\n const pathIds = this.findPathIds(invocation.request.path);\r\n const result = await invocation.result;\r\n const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue\r\n\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({\r\n method: invocation.request.method,\r\n path: invocation.request.path,\r\n status: invocation.status,\r\n errorMessage,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: invocation.request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../src/rpc/web/logging.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAA6G;AAC7G,yBAAyB;AAEzB,4CAA4C;AAE5C,MAAa,uBAAwB,SAAQ,8BAAgB;IACxC,KAAK,CAAC,gBAAgB,CAAC,KAAuB,EAAE,MAAqB;QACtF,QAAQ,KAAK,EAAE;YACb,KAAK,8BAAgB,CAAC,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACxJ,KAAK,8BAAgB,CAAC,oBAAoB,CAAC,CAAC,OAAO,IAAI,CAAC,eAAe,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;YAC9G,KAAK,8BAAgB,CAAC,sBAAsB,CAAC,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,+BAA+B,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;SACjM;IACH,CAAC;IAEkB,WAAW;QAC5B,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,OAAe,EAAE,UAAyB;QACtE,MAAM,mBAAmB,GAAG,IAAI,CAAC,wBAAwB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAChF,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC;QACvC,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,2CAA2C;QAElH,qBAAM,CAAC,OAAO,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,GAAG,OAAO,IAAI,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACnG,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM;YACjC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI;YAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,YAAY;YACZ,uGAAuG;YACvG,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,GAAG,OAAO;SACX,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AA9BD,0DA8BC","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 RpcInterface\r\n */\r\n\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { CommonLoggerCategory, RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from \"@itwin/core-common\";\r\nimport * as os from \"os\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nexport class WebAppRpcLoggingBackend extends WebAppRpcLogging {\r\n protected override async logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void> {\r\n switch (event) {\r\n case RpcProtocolEvent.RequestReceived: return this.logRequest(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.request\", object.request);\r\n case RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend(\"RpcInterface.backend.error\", object);\r\n case RpcProtocolEvent.BackendResponseCreated: return this.logResponse(CommonLoggerCategory.RpcInterfaceBackend, \"RpcInterface.backend.response\", object.request, object.status, object.elapsed);\r\n }\r\n }\r\n\r\n protected override getHostname(): string {\r\n return os.hostname();\r\n }\r\n\r\n private async logErrorBackend(message: string, invocation: RpcInvocation): Promise<void> {\r\n const operationDescriptor = this.buildOperationDescriptor(invocation.operation);\r\n const pathIds = this.findPathIds(invocation.request.path);\r\n const result = await invocation.result;\r\n const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue\r\n\r\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({\r\n method: invocation.request.method,\r\n path: invocation.request.path,\r\n status: invocation.status,\r\n errorMessage,\r\n // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!\r\n ActivityId: invocation.request.id, // eslint-disable-line @typescript-eslint/naming-convention\r\n MachineName: this.getHostname(), // eslint-disable-line @typescript-eslint/naming-convention\r\n ...pathIds,\r\n }));\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/request.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAEL,iBAAiB,EASjB,oBAAoB,EAEpB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAgC5B,gBAAgB;AAChB,wBAAsB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoCrH"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/request.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAEL,iBAAiB,EASjB,oBAAoB,EAEpB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAkC5B,gBAAgB;AAChB,wBAAsB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoCrH"}
@@ -9,6 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.parseRequest = void 0;
11
11
  const core_common_1 = require("@itwin/core-common");
12
+ /* eslint-disable deprecation/deprecation */
12
13
  function parseHeaders(protocol, req) {
13
14
  var _a;
14
15
  const headerNames = protocol.serializedClientRequestContextHeaderNames;
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/rpc/web/request.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,SAAS,YAAY,CAAC,QAA2B,EAAE,GAAsB;;IACvE,MAAM,WAAW,GAA0B,QAAQ,CAAC,yCAAyC,CAAC;IAC9F,MAAM,aAAa,GAA0B;QAC3C,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACpC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE;QAC1D,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE;QACpE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE;QAClD,aAAa,EAAE,MAAA,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,mCAAI,EAAE;KAC9F,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED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AC,mBAAmB;YAClD,aAAa,EAAE,SAAS,CAAC,aAAa;YACtC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;SAC7C;QACD,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,oEAAoE;QACpE,IAAI,EAAE,GAAG,CAAC,GAAI;QACd,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC;QAC1F,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAuB,CAAC,SAAS,CAAC,CAAC,CAAC,qCAAuB,CAAC,IAAI;KACrG,CAAC;IAEF,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;IAEpB,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,yBAAyB,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC/D,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SACjD;KACF;IAED,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;QACf,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,gDAAgD,CAAC,CAAC;KAC9F;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AApCD,oCAoCC","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 RpcInterface\r\n */\r\n\r\nimport {\r\n BentleyStatus,\r\n HttpServerRequest,\r\n IModelError,\r\n MarshalingBinaryMarker,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcResponseCacheControl,\r\n RpcSerializedValue,\r\n SerializedRpcActivity,\r\n SerializedRpcOperation,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n} from \"@itwin/core-common\";\r\n\r\nfunction parseHeaders(protocol: WebAppRpcProtocol, req: HttpServerRequest): SerializedRpcActivity {\r\n const headerNames: SerializedRpcActivity = protocol.serializedClientRequestContextHeaderNames;\r\n const parsedHeaders: SerializedRpcActivity = {\r\n id: req.header(headerNames.id) || \"\",\r\n applicationId: req.header(headerNames.applicationId) || \"\",\r\n applicationVersion: req.header(headerNames.applicationVersion) || \"\",\r\n sessionId: req.header(headerNames.sessionId) || \"\",\r\n authorization: (headerNames.authorization ? req.header(headerNames.authorization) : \"\") ?? \"\",\r\n };\r\n return parsedHeaders;\r\n}\r\n\r\nfunction parseFromPath(operation: SerializedRpcOperation): RpcSerializedValue {\r\n const decoded = operation.encodedRequest ? Buffer.from(operation.encodedRequest, \"base64\").toString(\"binary\") : \"\";\r\n return RpcSerializedValue.create(decoded);\r\n}\r\n\r\nasync function parseFromBody(req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n const contentType = WebAppRpcProtocol.computeContentType(req.header(WEB_RPC_CONSTANTS.CONTENT));\r\n if (contentType === RpcContentType.Binary) {\r\n const objects = JSON.stringify([MarshalingBinaryMarker.createDefault()]);\r\n const data = [req.body as Buffer];\r\n return RpcSerializedValue.create(objects, data);\r\n } else if (contentType === RpcContentType.Multipart) {\r\n return RpcMultipart.parseRequest(req);\r\n } else {\r\n return RpcSerializedValue.create(req.body as string);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport async function parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n const operation = protocol.getOperationFromPath(req.url!);\r\n\r\n const parsedHeaders = parseHeaders(protocol, req);\r\n\r\n const request: SerializedRpcRequest = {\r\n ...parsedHeaders,\r\n operation: {\r\n interfaceDefinition: operation.interfaceDefinition,\r\n operationName: operation.operationName,\r\n interfaceVersion: operation.interfaceVersion,\r\n },\r\n method: req.method,\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n path: req.url!,\r\n parameters: operation.encodedRequest ? parseFromPath(operation) : await parseFromBody(req),\r\n caching: operation.encodedRequest ? RpcResponseCacheControl.Immutable : RpcResponseCacheControl.None,\r\n };\r\n\r\n request.ip = req.ip;\r\n\r\n request.protocolVersion = 0;\r\n\r\n if (protocol.protocolVersionHeaderName) {\r\n const version = req.header(protocol.protocolVersionHeaderName);\r\n if (version) {\r\n request.protocolVersion = parseInt(version, 10);\r\n }\r\n }\r\n\r\n if (!request.id) {\r\n throw new IModelError(BentleyStatus.ERROR, `Invalid request: Missing required activity ID.`);\r\n }\r\n\r\n return request;\r\n}\r\n"]}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/rpc/web/request.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,4CAA4C;AAE5C,SAAS,YAAY,CAAC,QAA2B,EAAE,GAAsB;;IACvE,MAAM,WAAW,GAA0B,QAAQ,CAAC,yCAAyC,CAAC;IAC9F,MAAM,aAAa,GAA0B;QAC3C,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACpC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE;QAC1D,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE;QACpE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE;QAClD,aAAa,EAAE,MAAA,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,C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AAM,OAAO,GAAyB;QACpC,GAAG,aAAa;QAChB,SAAS,EAAE;YACT,mBAAmB,EAAE,SAAS,CAAC,mBAAmB;YAClD,aAAa,EAAE,SAAS,CAAC,aAAa;YACtC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;SAC7C;QACD,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,oEAAoE;QACpE,IAAI,EAAE,GAAG,CAAC,GAAI;QACd,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC;QAC1F,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,qCAAuB,CAAC,SAAS,CAAC,CAAC,CAAC,qCAAuB,CAAC,IAAI;KACrG,CAAC;IAEF,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;IAEpB,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,yBAAyB,EAAE;QACtC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC/D,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,eAAe,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;SACjD;KACF;IAED,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;QACf,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,gDAAgD,CAAC,CAAC;KAC9F;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AApCD,oCAoCC","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 RpcInterface\r\n */\r\n\r\nimport {\r\n BentleyStatus,\r\n HttpServerRequest,\r\n IModelError,\r\n MarshalingBinaryMarker,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcResponseCacheControl,\r\n RpcSerializedValue,\r\n SerializedRpcActivity,\r\n SerializedRpcOperation,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n} from \"@itwin/core-common\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nfunction parseHeaders(protocol: WebAppRpcProtocol, req: HttpServerRequest): SerializedRpcActivity {\r\n const headerNames: SerializedRpcActivity = protocol.serializedClientRequestContextHeaderNames;\r\n const parsedHeaders: SerializedRpcActivity = {\r\n id: req.header(headerNames.id) || \"\",\r\n applicationId: req.header(headerNames.applicationId) || \"\",\r\n applicationVersion: req.header(headerNames.applicationVersion) || \"\",\r\n sessionId: req.header(headerNames.sessionId) || \"\",\r\n authorization: (headerNames.authorization ? req.header(headerNames.authorization) : \"\") ?? \"\",\r\n };\r\n return parsedHeaders;\r\n}\r\n\r\nfunction parseFromPath(operation: SerializedRpcOperation): RpcSerializedValue {\r\n const decoded = operation.encodedRequest ? Buffer.from(operation.encodedRequest, \"base64\").toString(\"binary\") : \"\";\r\n return RpcSerializedValue.create(decoded);\r\n}\r\n\r\nasync function parseFromBody(req: HttpServerRequest): Promise<RpcSerializedValue> {\r\n const contentType = WebAppRpcProtocol.computeContentType(req.header(WEB_RPC_CONSTANTS.CONTENT));\r\n if (contentType === RpcContentType.Binary) {\r\n const objects = JSON.stringify([MarshalingBinaryMarker.createDefault()]);\r\n const data = [req.body as Buffer];\r\n return RpcSerializedValue.create(objects, data);\r\n } else if (contentType === RpcContentType.Multipart) {\r\n return RpcMultipart.parseRequest(req);\r\n } else {\r\n return RpcSerializedValue.create(req.body as string);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport async function parseRequest(protocol: WebAppRpcProtocol, req: HttpServerRequest): Promise<SerializedRpcRequest> {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n const operation = protocol.getOperationFromPath(req.url!);\r\n\r\n const parsedHeaders = parseHeaders(protocol, req);\r\n\r\n const request: SerializedRpcRequest = {\r\n ...parsedHeaders,\r\n operation: {\r\n interfaceDefinition: operation.interfaceDefinition,\r\n operationName: operation.operationName,\r\n interfaceVersion: operation.interfaceVersion,\r\n },\r\n method: req.method,\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n path: req.url!,\r\n parameters: operation.encodedRequest ? parseFromPath(operation) : await parseFromBody(req),\r\n caching: operation.encodedRequest ? RpcResponseCacheControl.Immutable : RpcResponseCacheControl.None,\r\n };\r\n\r\n request.ip = req.ip;\r\n\r\n request.protocolVersion = 0;\r\n\r\n if (protocol.protocolVersionHeaderName) {\r\n const version = req.header(protocol.protocolVersionHeaderName);\r\n if (version) {\r\n request.protocolVersion = parseInt(version, 10);\r\n }\r\n }\r\n\r\n if (!request.id) {\r\n throw new IModelError(BentleyStatus.ERROR, `Invalid request: Missing required activity ID.`);\r\n }\r\n\r\n return request;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAKlB,qBAAqB,EAGrB,oBAAoB,EAEpB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AA2D5B,gBAAgB;AAChB,wBAAsB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,kBAAkB,iBAqCjL"}
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAKlB,qBAAqB,EAGrB,oBAAoB,EAEpB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AA6D5B,gBAAgB;AAChB,wBAAsB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,EAAE,iBAAiB,EAAE,GAAG,EAAE,kBAAkB,iBAqCjL"}
@@ -9,6 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.sendResponse = void 0;
11
11
  const core_common_1 = require("@itwin/core-common");
12
+ /* eslint-disable deprecation/deprecation */
12
13
  function configureResponse(protocol, request, fulfillment, res) {
13
14
  const success = protocol.getStatus(fulfillment.status) === core_common_1.RpcRequestStatus.Resolved;
14
15
  // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.
@@ -1 +1 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,SAAS,iBAAiB,CAAC,QAA2B,EAAE,OAA6B,EAAE,WAAkC,EAAE,GAAuB;IAChJ,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,8BAAgB,CAAC,QAAQ,CAAC;IACrF,iJAAiJ;IACjJ,kJAAkJ;IAElJ,yFAAyF;IACzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,qCAAuB,CAAC,SAAS,EAAE;QACpE,gDAAgD;QAChD,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;YACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,qBAAqB,EAAE;YACpE,GAAG,CAAC,GAAG,CA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MAAM,EAAE;QAC3C,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KAClD;SAAM,IAAI,aAAa,KAAK,4BAAc,CAAC,SAAS,EAAE;QACrD,YAAY,GAAG,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KACrD;SAAM,IAAI,aAAa,KAAK,4BAAc,CAAC,MAAM,EAAE;QAClD,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;KAC7C;SAAM;QACL,YAAY,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KAChD;IAED,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IACvD,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAE/B,IAAI,WAAW,CAAC,gBAAgB,KAAI,MAAA,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,0CAAE,QAAQ,CAAC,MAAM,CAAC,CAAA,EAAE;QACnF,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,oBAAoB,GAAG,CAAC,YAAY,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3G,YAAY,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;KACxD;IAED,6GAA6G;IAC7G,iCAAiC;IACjC,IAAI,YAAY,YAAY,MAAM,EAAE;QAClC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;SAAM;QACL,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACxB;AACH,CAAC;AArCD,oCAqCC","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 RpcInterface\r\n */\r\n\r\nimport {\r\n HttpServerRequest,\r\n HttpServerResponse,\r\n ReadableFormData,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcProtocol,\r\n RpcRequestFulfillment,\r\n RpcRequestStatus,\r\n RpcResponseCacheControl,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n WebAppRpcRequest,\r\n} from \"@itwin/core-common\";\r\n\r\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\r\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\r\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\r\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\r\n\r\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\r\n const oneHourInSeconds = 3600;\r\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\r\n // If response size is > 50 MB, do not cache it.\r\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"generateTileContent\") {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"getConnectionProps\") {\r\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\r\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\r\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\r\n } else {\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\r\n }\r\n }\r\n\r\n if (fulfillment.retry) {\r\n res.set(\"Retry-After\", fulfillment.retry);\r\n }\r\n}\r\n\r\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\r\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\r\n}\r\n\r\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\r\n const data = fulfillment.result.data[0];\r\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\r\n}\r\n\r\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\r\n const response = RpcMultipart.createStream(fulfillment.result);\r\n const headers = response.getHeaders();\r\n for (const header in headers) {\r\n if (headers.hasOwnProperty(header)) {\r\n res.set(header, headers[header]);\r\n }\r\n }\r\n\r\n return response;\r\n}\r\n\r\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n return fulfillment.result.stream!;\r\n}\r\n\r\n/** @internal */\r\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\r\n const versionHeader = protocol.protocolVersionHeaderName;\r\n if (versionHeader && RpcProtocol.protocolVersion) {\r\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\r\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\r\n\r\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\r\n let responseBody;\r\n if (transportType === RpcContentType.Binary) {\r\n responseBody = configureBinary(fulfillment, res);\r\n } else if (transportType === RpcContentType.Multipart) {\r\n responseBody = configureMultipart(fulfillment, res);\r\n } else if (transportType === RpcContentType.Stream) {\r\n responseBody = configureStream(fulfillment);\r\n } else {\r\n responseBody = configureText(fulfillment, res);\r\n }\r\n\r\n configureResponse(protocol, request, fulfillment, res);\r\n res.status(fulfillment.status);\r\n\r\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\r\n res.set(\"Content-Encoding\", \"gzip\");\r\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\r\n responseBody = readableResponseBody.pipe(createGzip());\r\n }\r\n\r\n // This check should in theory look for instances of Readable, but that would break backend implementation at\r\n // core/backend/src/RpcBackend.ts\r\n if (responseBody instanceof Stream) {\r\n responseBody.pipe(res);\r\n } else {\r\n res.send(responseBody);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,4CAA4C;AAE5C,SAAS,iBAAiB,CAAC,QAA2B,EAAE,OAA6B,EAAE,WAAkC,EAAE,GAAuB;IAChJ,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,8BAAgB,CAAC,QAAQ,CAAC;IACrF,iJAAiJ;IACjJ,kJAAkJ;IAElJ,yFAAyF;IACzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,qCAAuB,CAAC,SAAS,EAAE;QACpE,gDAAgD;QAChD,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;YACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UA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ourcesContent":["/*---------------------------------------------------------------------------------------------\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 RpcInterface\r\n */\r\n\r\nimport {\r\n HttpServerRequest,\r\n HttpServerResponse,\r\n ReadableFormData,\r\n RpcContentType,\r\n RpcMultipart,\r\n RpcProtocol,\r\n RpcRequestFulfillment,\r\n RpcRequestStatus,\r\n RpcResponseCacheControl,\r\n SerializedRpcRequest,\r\n WEB_RPC_CONSTANTS,\r\n WebAppRpcProtocol,\r\n WebAppRpcRequest,\r\n} from \"@itwin/core-common\";\r\n\r\n/* eslint-disable deprecation/deprecation */\r\n\r\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\r\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\r\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\r\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\r\n\r\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\r\n const oneHourInSeconds = 3600;\r\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\r\n // If response size is > 50 MB, do not cache it.\r\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"generateTileContent\") {\r\n res.set(\"Cache-Control\", \"no-store\");\r\n } else if (request.operation.operationName === \"getConnectionProps\") {\r\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\r\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\r\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\r\n } else {\r\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\r\n }\r\n }\r\n\r\n if (fulfillment.retry) {\r\n res.set(\"Retry-After\", fulfillment.retry);\r\n }\r\n}\r\n\r\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\r\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\r\n}\r\n\r\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\r\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\r\n const data = fulfillment.result.data[0];\r\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\r\n}\r\n\r\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\r\n const response = RpcMultipart.createStream(fulfillment.result);\r\n const headers = response.getHeaders();\r\n for (const header in headers) {\r\n if (headers.hasOwnProperty(header)) {\r\n res.set(header, headers[header]);\r\n }\r\n }\r\n\r\n return response;\r\n}\r\n\r\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n return fulfillment.result.stream!;\r\n}\r\n\r\n/** @internal */\r\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\r\n const versionHeader = protocol.protocolVersionHeaderName;\r\n if (versionHeader && RpcProtocol.protocolVersion) {\r\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\r\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\r\n\r\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\r\n let responseBody;\r\n if (transportType === RpcContentType.Binary) {\r\n responseBody = configureBinary(fulfillment, res);\r\n } else if (transportType === RpcContentType.Multipart) {\r\n responseBody = configureMultipart(fulfillment, res);\r\n } else if (transportType === RpcContentType.Stream) {\r\n responseBody = configureStream(fulfillment);\r\n } else {\r\n responseBody = configureText(fulfillment, res);\r\n }\r\n\r\n configureResponse(protocol, request, fulfillment, res);\r\n res.status(fulfillment.status);\r\n\r\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\r\n res.set(\"Content-Encoding\", \"gzip\");\r\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\r\n responseBody = readableResponseBody.pipe(createGzip());\r\n }\r\n\r\n // This check should in theory look for instances of Readable, but that would break backend implementation at\r\n // core/backend/src/RpcBackend.ts\r\n if (responseBody instanceof Stream) {\r\n responseBody.pipe(res);\r\n } else {\r\n res.send(responseBody);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DevToolsRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/DevToolsRpcImpl.ts"],"names":[],"mappings":";;;AAQA,oDAA0H;AAC1H,0CAA+D;AAE/D;;GAEG;AACH,MAAa,eAAgB,SAAQ,0BAAY;IACxC,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,kCAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE5F,gDAAgD;IACzC,KAAK,CAAC,IAAI,CAAC,WAA2B;QAC3C,OAAO,mBAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,KAAK,CAAC,WAA2B,EAAE,OAA6B;QAC3E,MAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,kCAAoB,CAAC,IAAI;YACvC,OAAO,KAAK,CAAC;QACf,MAAM,cAAc,GAAG,iCAAsB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,uEAAuE;IAChE,KAAK,CAAC,QAAQ,CAAC,WAA2B;QAC/C,OAAO,mBAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,WAAW,CAAC,WAA2B,EAAE,cAAsB,EAAE,QAAkB;QAC9F,OAAO,mBAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA1BD,0CA0BC","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 RpcInterface\r\n */\r\nimport { LogLevel } from \"@itwin/core-bentley\";\r\nimport { DevToolsRpcInterface, DevToolsStatsOptions, IModelRpcProps, RpcInterface, RpcManager } from \"@itwin/core-common\";\r\nimport { DevTools, DevToolsStatsFormatter } from \"../DevTools\";\r\n\r\n/** The backend implementation of WipRpcInterface.\r\n * @internal\r\n */\r\nexport class DevToolsRpcImpl extends RpcInterface implements DevToolsRpcInterface {\r\n public static register() { RpcManager.registerImpl(DevToolsRpcInterface, DevToolsRpcImpl); }\r\n\r\n // Returns true if the backend received the ping\r\n public async ping(_tokenProps: IModelRpcProps): Promise<boolean> {\r\n return DevTools.ping();\r\n }\r\n\r\n // Returns JSON object with statistics\r\n public async stats(_tokenProps: IModelRpcProps, options: DevToolsStatsOptions): Promise<any> {\r\n const stats = DevTools.stats();\r\n if (options === DevToolsStatsOptions.None)\r\n return stats;\r\n const formattedStats = DevToolsStatsFormatter.toFormattedJson(stats);\r\n return formattedStats;\r\n }\r\n\r\n // Returns JSON object with backend versions (application and iModelJs)\r\n public async versions(_tokenProps: IModelRpcProps): Promise<any> {\r\n return DevTools.versions();\r\n }\r\n\r\n // Sets up a log level at the backend\r\n public async setLogLevel(_tokenProps: IModelRpcProps, loggerCategory: string, logLevel: LogLevel): Promise<LogLevel | undefined> {\r\n return DevTools.setLogLevel(loggerCategory, logLevel);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DevToolsRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/DevToolsRpcImpl.ts"],"names":[],"mappings":";;;AAQA,oDAA0H;AAC1H,0CAA+D;AAE/D;;GAEG;AACH,MAAa,eAAgB,SAAQ,0BAAY;IACxC,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,kCAAoB,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE5F,gDAAgD;IACzC,KAAK,CAAC,IAAI,CAAC,WAA2B;QAC3C,OAAO,mBAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,KAAK,CAAC,WAA2B,EAAE,OAA6B;QAC3E,MAAM,KAAK,GAAG,mBAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,kCAAoB,CAAC,IAAI;YACvC,OAAO,KAAK,CAAC;QACf,MAAM,cAAc,GAAG,iCAAsB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,uEAAuE;IAChE,KAAK,CAAC,QAAQ,CAAC,WAA2B;QAC/C,OAAO,mBAAQ,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,WAAW,CAAC,WAA2B,EAAE,cAAsB,EAAE,QAAkB;QAC9F,OAAO,mBAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA1BD,0CA0BC","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 RpcInterface\r\n */\r\nimport { LogLevel } from \"@itwin/core-bentley\";\r\nimport { DevToolsRpcInterface, DevToolsStatsOptions, IModelRpcProps, RpcInterface, RpcManager } from \"@itwin/core-common\";\r\nimport { DevTools, DevToolsStatsFormatter } from \"../DevTools\";\r\n\r\n/** The backend implementation of WipRpcInterface.\r\n * @internal\r\n */\r\nexport class DevToolsRpcImpl extends RpcInterface implements DevToolsRpcInterface { // eslint-disable-line deprecation/deprecation\r\n public static register() { RpcManager.registerImpl(DevToolsRpcInterface, DevToolsRpcImpl); }\r\n\r\n // Returns true if the backend received the ping\r\n public async ping(_tokenProps: IModelRpcProps): Promise<boolean> {\r\n return DevTools.ping();\r\n }\r\n\r\n // Returns JSON object with statistics\r\n public async stats(_tokenProps: IModelRpcProps, options: DevToolsStatsOptions): Promise<any> {\r\n const stats = DevTools.stats();\r\n if (options === DevToolsStatsOptions.None)\r\n return stats;\r\n const formattedStats = DevToolsStatsFormatter.toFormattedJson(stats);\r\n return formattedStats;\r\n }\r\n\r\n // Returns JSON object with backend versions (application and iModelJs)\r\n public async versions(_tokenProps: IModelRpcProps): Promise<any> {\r\n return DevTools.versions();\r\n }\r\n\r\n // Sets up a log level at the backend\r\n public async setLogLevel(_tokenProps: IModelRpcProps, loggerCategory: string, logLevel: LogLevel): Promise<LogLevel | undefined> {\r\n return DevTools.setLogLevel(loggerCategory, logLevel);\r\n }\r\n}\r\n"]}
@@ -35,7 +35,7 @@ export declare class IModelReadRpcImpl extends RpcInterface implements IModelRea
35
35
  getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]>;
36
36
  getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]>;
37
37
  /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
38
- * @deprecated
38
+ * @deprecated in 3.x with no replacement; thumbnails are rarely added to the iModel.
39
39
  */
40
40
  getViewThumbnail(_tokenProps: IModelRpcProps, _viewId: string): Promise<Uint8Array>;
41
41
  getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String>;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelReadRpcImpl.d.ts","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAC2C,iBAAiB,EAAE,UAAU,EAAQ,UAAU,EAChG,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACC,SAAS,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAC5J,uBAAuB,EAAE,YAAY,EAAkB,iBAAiB,EAAE,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,+BAA+B,EAChL,gCAAgC,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,6BAA6B,EAC1H,qBAAqB,EAAE,6BAA6B,EAAE,8BAA8B,EAAe,sBAAsB,EAAE,kBAAkB,EAC7I,cAAc,EAAE,sCAAsC,EAAE,uCAAuC,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,iBAAiB,EAC3K,UAAU,EAAkB,YAAY,EAAkC,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAY,WAAW,EAAE,gBAAgB,EAC5K,kBAAkB,EAAE,cAAc,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAmEpD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAa,YAAW,sBAAsB;WAErE,QAAQ;IAET,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,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46
46
  await core_bentley_1.BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);
47
47
  if (memo.isPending)
48
- throw new core_common_1.RpcPendingResponse();
48
+ throw new core_common_1.RpcPendingResponse(); // eslint-disable-line deprecation/deprecation
49
49
  this.deleteMemoized(props);
50
50
  if (memo.isFulfilled) {
51
51
  (0, core_bentley_1.assert)(undefined !== memo.result);
@@ -55,30 +55,33 @@ class ViewStateRequestMemoizer extends PromiseMemoizer_1.PromiseMemoizer {
55
55
  throw memo.error; // eslint-disable-line no-throw-literal
56
56
  }
57
57
  }
58
+ function currentActivity() {
59
+ return tracing_1.RpcTrace.expectCurrentActivity; // eslint-disable-line deprecation/deprecation
60
+ }
58
61
  /** The backend implementation of IModelReadRpcInterface.
59
62
  * @internal
60
63
  */
61
64
  class IModelReadRpcImpl extends core_common_1.RpcInterface {
62
65
  static register() { core_common_1.RpcManager.registerImpl(core_common_1.IModelReadRpcInterface, IModelReadRpcImpl); }
63
66
  async getConnectionProps(tokenProps) {
64
- return RpcBriefcaseUtility_1.RpcBriefcaseUtility.openWithTimeout(tracing_1.RpcTrace.expectCurrentActivity, tokenProps, core_common_1.SyncMode.FixedVersion);
67
+ return RpcBriefcaseUtility_1.RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, core_common_1.SyncMode.FixedVersion);
65
68
  }
66
69
  async getCustomViewState3dData(tokenProps, options) {
67
- const accessToken = tracing_1.RpcTrace.expectCurrentActivity.accessToken;
70
+ const accessToken = currentActivity().accessToken;
68
71
  return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });
69
72
  }
70
73
  async hydrateViewState(tokenProps, options) {
71
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
74
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
72
75
  const viewHydrater = new ViewStateHydrator_1.ViewStateHydrator(iModelDb);
73
76
  return viewHydrater.getHydrateResponseProps(options);
74
77
  }
75
78
  async querySubCategories(tokenProps, compressedCategoryIds) {
76
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
79
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
77
80
  const decompressedIds = core_bentley_1.CompressedId64Set.decompressArray(compressedCategoryIds);
78
81
  return iModelDb.querySubCategories(decompressedIds);
79
82
  }
80
83
  async queryRows(tokenProps, request) {
81
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
84
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
82
85
  if (iModelDb.isReadonly && request.usePrimaryConn === true) {
83
86
  core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
84
87
  request.usePrimaryConn = false;
@@ -86,7 +89,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
86
89
  return ConcurrentQuery_1.ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);
87
90
  }
88
91
  async queryBlob(tokenProps, request) {
89
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
92
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
90
93
  if (iModelDb.isReadonly && request.usePrimaryConn === true) {
91
94
  core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
92
95
  request.usePrimaryConn = false;
@@ -100,12 +103,12 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
100
103
  return results.filter((x) => x.status === core_bentley_1.IModelStatus.Success).map((x) => x.extents);
101
104
  }
102
105
  async queryModelExtents(tokenProps, modelIds) {
103
- const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
106
+ const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
104
107
  return iModel.models.queryExtents(modelIds);
105
108
  }
106
109
  async getModelProps(tokenProps, modelIdsList) {
107
110
  const modelIds = new Set(modelIdsList);
108
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
111
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
109
112
  const modelJsonArray = [];
110
113
  for (const id of modelIds) {
111
114
  try {
@@ -125,7 +128,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
125
128
  }
126
129
  async getElementProps(tokenProps, elementIdsList) {
127
130
  const elementIds = new Set(elementIdsList);
128
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
131
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
129
132
  const elementProps = [];
130
133
  for (const id of elementIds) {
131
134
  try {
@@ -149,11 +152,11 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
149
152
  else {
150
153
  props.code = core_common_1.Code.fromJSON(identifier);
151
154
  }
152
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
155
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
153
156
  return iModelDb.elements.tryGetElementProps(props);
154
157
  }
155
158
  async getGeometrySummary(tokenProps, request) {
156
- const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
159
+ const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
157
160
  return (0, GeometrySummary_1.generateGeometrySummaries)(request, iModel);
158
161
  }
159
162
  async queryElementProps(tokenProps, params) {
@@ -162,12 +165,12 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
162
165
  return res;
163
166
  }
164
167
  async queryEntityIds(tokenProps, params) {
165
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
168
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
166
169
  const res = iModelDb.queryEntityIds(params);
167
170
  return [...res];
168
171
  }
169
172
  async getClassHierarchy(tokenProps, classFullName) {
170
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
173
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
171
174
  const classArray = [];
172
175
  while (true) {
173
176
  const classMetaData = iModelDb.getMetaData(classFullName);
@@ -180,7 +183,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
180
183
  }
181
184
  async getAllCodeSpecs(tokenProps) {
182
185
  const codeSpecs = [];
183
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
186
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
184
187
  iModelDb.withPreparedStatement("SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec", (statement) => {
185
188
  for (const row of statement)
186
189
  codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });
@@ -188,31 +191,31 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
188
191
  return codeSpecs;
189
192
  }
190
193
  async getViewStateData(tokenProps, viewDefinitionId, options) {
191
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
194
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
192
195
  return iModelDb.views.getViewStateProps(viewDefinitionId, options);
193
196
  }
194
197
  async readFontJson(tokenProps) {
195
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
198
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
196
199
  return iModelDb.nativeDb.readFontMap();
197
200
  }
198
201
  async requestSnap(tokenProps, sessionId, props) {
199
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
202
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
200
203
  return iModelDb.requestSnap(sessionId, props);
201
204
  }
202
205
  async cancelSnap(tokenProps, sessionId) {
203
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
206
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
204
207
  return iModelDb.cancelSnap(sessionId);
205
208
  }
206
209
  async getGeometryContainment(tokenProps, props) {
207
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
210
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
208
211
  return iModelDb.getGeometryContainment(props);
209
212
  }
210
213
  async getMassProperties(tokenProps, props) {
211
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
214
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
212
215
  return iModelDb.getMassProperties(props);
213
216
  }
214
217
  async getMassPropertiesPerCandidate(tokenProps, props) {
215
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
218
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
216
219
  const getSingleCandidateMassProperties = async (candidate) => {
217
220
  try {
218
221
  const massPropResults = [];
@@ -240,15 +243,15 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
240
243
  return Promise.all(promises);
241
244
  }
242
245
  async getToolTipMessage(tokenProps, id) {
243
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
246
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
244
247
  const el = iModelDb.elements.getElement(id);
245
248
  return (el === undefined) ? [] : el.getToolTipMessage();
246
249
  }
247
250
  /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
248
- * @deprecated
251
+ * @deprecated in 3.x with no replacement; thumbnails are rarely added to the iModel.
249
252
  */
250
253
  async getViewThumbnail(_tokenProps, _viewId) {
251
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, _tokenProps);
254
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, _tokenProps);
252
255
  const thumbnail = iModelDb.views.getThumbnail(_viewId);
253
256
  if (undefined === thumbnail || 0 === thumbnail.image.length)
254
257
  throw new core_common_1.NoContentError();
@@ -258,7 +261,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
258
261
  return val;
259
262
  }
260
263
  async getDefaultViewId(tokenProps) {
261
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
264
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
262
265
  const spec = { namespace: "dgn_View", name: "DefaultView" };
263
266
  const blob = iModelDb.queryFilePropertyBlob(spec);
264
267
  if (undefined === blob || 8 !== blob.length)
@@ -267,24 +270,24 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
267
270
  return core_bentley_1.Id64.fromUint32Pair(view[0], view[1]);
268
271
  }
269
272
  async getSpatialCategoryId(tokenProps, categoryName) {
270
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
273
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
271
274
  const dictionary = iModelDb.models.getModel(core_common_1.IModel.dictionaryId);
272
275
  return Category_1.SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);
273
276
  }
274
277
  async getIModelCoordinatesFromGeoCoordinates(tokenProps, props) {
275
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
278
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
276
279
  return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);
277
280
  }
278
281
  async getGeoCoordinatesFromIModelCoordinates(tokenProps, props) {
279
- const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
282
+ const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
280
283
  return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);
281
284
  }
282
285
  async queryTextureData(tokenProps, textureLoadProps) {
283
- const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
286
+ const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);
284
287
  return db.queryTextureData(textureLoadProps);
285
288
  }
286
289
  async generateElementMeshes(iModelToken, props) {
287
- const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(tracing_1.RpcTrace.expectCurrentActivity.accessToken, iModelToken);
290
+ const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, iModelToken);
288
291
  return db.nativeDb.generateElementMeshes(props);
289
292
  }
290
293
  }