@itwin/core-backend 3.6.0-dev.11 → 3.6.0-dev.21

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 (245) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/AliCloudStorageService.d.ts +23 -23
  3. package/lib/cjs/AliCloudStorageService.js +71 -71
  4. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  5. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  6. package/lib/cjs/BackendHubAccess.js +41 -41
  7. package/lib/cjs/BackendHubAccess.js.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
  9. package/lib/cjs/BackendLoggerCategory.js +99 -99
  10. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  11. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  12. package/lib/cjs/BisCoreSchema.js +60 -60
  13. package/lib/cjs/BisCoreSchema.js.map +1 -1
  14. package/lib/cjs/BriefcaseManager.d.ts +170 -170
  15. package/lib/cjs/BriefcaseManager.js +413 -413
  16. package/lib/cjs/BriefcaseManager.js.map +1 -1
  17. package/lib/cjs/Category.d.ts +153 -153
  18. package/lib/cjs/Category.js +243 -243
  19. package/lib/cjs/Category.js.map +1 -1
  20. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  21. package/lib/cjs/ChangeSummaryManager.js +447 -447
  22. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  24. package/lib/cjs/ChangedElementsDb.js +165 -165
  25. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  26. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  27. package/lib/cjs/ChangedElementsManager.js +88 -88
  28. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  29. package/lib/cjs/CheckpointManager.d.ts +122 -120
  30. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  31. package/lib/cjs/CheckpointManager.js +343 -343
  32. package/lib/cjs/CheckpointManager.js.map +1 -1
  33. package/lib/cjs/ClassRegistry.d.ts +79 -79
  34. package/lib/cjs/ClassRegistry.js +249 -249
  35. package/lib/cjs/ClassRegistry.js.map +1 -1
  36. package/lib/cjs/CloudSqlite.d.ts +350 -350
  37. package/lib/cjs/CloudSqlite.js +152 -152
  38. package/lib/cjs/CloudSqlite.js.map +1 -1
  39. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  40. package/lib/cjs/CloudStorageBackend.js +173 -173
  41. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  42. package/lib/cjs/CodeService.d.ts +396 -396
  43. package/lib/cjs/CodeService.js +63 -63
  44. package/lib/cjs/CodeService.js.map +1 -1
  45. package/lib/cjs/CodeSpecs.d.ts +50 -50
  46. package/lib/cjs/CodeSpecs.js +112 -112
  47. package/lib/cjs/CodeSpecs.js.map +1 -1
  48. package/lib/cjs/ConcurrentQuery.d.ts +13 -13
  49. package/lib/cjs/ConcurrentQuery.js +36 -36
  50. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  51. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  52. package/lib/cjs/CustomViewState3dCreator.js +81 -81
  53. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  54. package/lib/cjs/DevTools.d.ts +71 -71
  55. package/lib/cjs/DevTools.js +154 -154
  56. package/lib/cjs/DevTools.js.map +1 -1
  57. package/lib/cjs/DisplayStyle.d.ts +106 -106
  58. package/lib/cjs/DisplayStyle.js +256 -256
  59. package/lib/cjs/DisplayStyle.js.map +1 -1
  60. package/lib/cjs/ECDb.d.ts +191 -191
  61. package/lib/cjs/ECDb.js +350 -350
  62. package/lib/cjs/ECDb.js.map +1 -1
  63. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  64. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  65. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  66. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  67. package/lib/cjs/ECSqlStatement.js +791 -791
  68. package/lib/cjs/ECSqlStatement.js.map +1 -1
  69. package/lib/cjs/Element.d.ts +1102 -1102
  70. package/lib/cjs/Element.js +1416 -1416
  71. package/lib/cjs/Element.js.map +1 -1
  72. package/lib/cjs/ElementAspect.d.ts +176 -176
  73. package/lib/cjs/ElementAspect.js +211 -211
  74. package/lib/cjs/ElementAspect.js.map +1 -1
  75. package/lib/cjs/ElementGraphics.d.ts +9 -9
  76. package/lib/cjs/ElementGraphics.js +41 -41
  77. package/lib/cjs/ElementGraphics.js.map +1 -1
  78. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  79. package/lib/cjs/ElementTreeWalker.js +409 -409
  80. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  81. package/lib/cjs/Entity.d.ts +106 -106
  82. package/lib/cjs/Entity.js +134 -134
  83. package/lib/cjs/Entity.js.map +1 -1
  84. package/lib/cjs/EntityReferences.d.ts +49 -49
  85. package/lib/cjs/EntityReferences.js +95 -95
  86. package/lib/cjs/EntityReferences.js.map +1 -1
  87. package/lib/cjs/ExportGraphics.d.ts +317 -317
  88. package/lib/cjs/ExportGraphics.js +208 -208
  89. package/lib/cjs/ExportGraphics.js.map +1 -1
  90. package/lib/cjs/ExternalSource.d.ts +96 -96
  91. package/lib/cjs/ExternalSource.js +131 -131
  92. package/lib/cjs/ExternalSource.js.map +1 -1
  93. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  94. package/lib/cjs/GeoCoordConfig.js +85 -85
  95. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  96. package/lib/cjs/GeometrySummary.d.ts +4 -4
  97. package/lib/cjs/GeometrySummary.js +380 -380
  98. package/lib/cjs/GeometrySummary.js.map +1 -1
  99. package/lib/cjs/HubMock.d.ts +94 -94
  100. package/lib/cjs/HubMock.js +222 -222
  101. package/lib/cjs/HubMock.js.map +1 -1
  102. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  103. package/lib/cjs/IModelCloneContext.js +15 -15
  104. package/lib/cjs/IModelCloneContext.js.map +1 -1
  105. package/lib/cjs/IModelDb.d.ts +1183 -1183
  106. package/lib/cjs/IModelDb.js +2374 -2374
  107. package/lib/cjs/IModelDb.js.map +1 -1
  108. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  109. package/lib/cjs/IModelElementCloneContext.js +159 -159
  110. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  111. package/lib/cjs/IModelHost.d.ts +370 -370
  112. package/lib/cjs/IModelHost.js +496 -496
  113. package/lib/cjs/IModelHost.js.map +1 -1
  114. package/lib/cjs/IModelJsFs.d.ts +62 -62
  115. package/lib/cjs/IModelJsFs.js +140 -140
  116. package/lib/cjs/IModelJsFs.js.map +1 -1
  117. package/lib/cjs/IpcHost.d.ts +104 -104
  118. package/lib/cjs/IpcHost.js +278 -278
  119. package/lib/cjs/IpcHost.js.map +1 -1
  120. package/lib/cjs/LineStyle.d.ts +311 -311
  121. package/lib/cjs/LineStyle.js +295 -295
  122. package/lib/cjs/LineStyle.js.map +1 -1
  123. package/lib/cjs/LocalHub.d.ts +162 -162
  124. package/lib/cjs/LocalHub.js +587 -587
  125. package/lib/cjs/LocalHub.js.map +1 -1
  126. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  127. package/lib/cjs/LocalhostIpcHost.js +81 -81
  128. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  129. package/lib/cjs/Material.d.ts +103 -103
  130. package/lib/cjs/Material.js +147 -147
  131. package/lib/cjs/Material.js.map +1 -1
  132. package/lib/cjs/Model.d.ts +392 -392
  133. package/lib/cjs/Model.js +485 -485
  134. package/lib/cjs/Model.js.map +1 -1
  135. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  136. package/lib/cjs/NativeAppStorage.js +202 -202
  137. package/lib/cjs/NativeAppStorage.js.map +1 -1
  138. package/lib/cjs/NativeHost.d.ts +52 -52
  139. package/lib/cjs/NativeHost.js +163 -163
  140. package/lib/cjs/NativeHost.js.map +1 -1
  141. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  142. package/lib/cjs/NavigationRelationship.js +225 -225
  143. package/lib/cjs/NavigationRelationship.js.map +1 -1
  144. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  145. package/lib/cjs/PromiseMemoizer.js +101 -101
  146. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  147. package/lib/cjs/PropertyStore.d.ts +132 -132
  148. package/lib/cjs/PropertyStore.js +11 -11
  149. package/lib/cjs/PropertyStore.js.map +1 -1
  150. package/lib/cjs/Relationship.d.ts +416 -416
  151. package/lib/cjs/Relationship.js +494 -494
  152. package/lib/cjs/Relationship.js.map +1 -1
  153. package/lib/cjs/RpcBackend.d.ts +5 -5
  154. package/lib/cjs/RpcBackend.js +31 -31
  155. package/lib/cjs/RpcBackend.js.map +1 -1
  156. package/lib/cjs/SQLiteDb.d.ts +219 -219
  157. package/lib/cjs/SQLiteDb.js +214 -214
  158. package/lib/cjs/SQLiteDb.js.map +1 -1
  159. package/lib/cjs/Schema.d.ts +55 -55
  160. package/lib/cjs/Schema.js +83 -83
  161. package/lib/cjs/Schema.js.map +1 -1
  162. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  163. package/lib/cjs/ServerBasedLocks.js +168 -168
  164. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  165. package/lib/cjs/SqliteStatement.d.ts +360 -360
  166. package/lib/cjs/SqliteStatement.js +586 -586
  167. package/lib/cjs/SqliteStatement.js.map +1 -1
  168. package/lib/cjs/Texture.d.ts +58 -58
  169. package/lib/cjs/Texture.js +82 -82
  170. package/lib/cjs/Texture.js.map +1 -1
  171. package/lib/cjs/TileStorage.d.ts +18 -18
  172. package/lib/cjs/TileStorage.js +90 -90
  173. package/lib/cjs/TileStorage.js.map +1 -1
  174. package/lib/cjs/TxnManager.d.ts +202 -202
  175. package/lib/cjs/TxnManager.js +356 -356
  176. package/lib/cjs/TxnManager.js.map +1 -1
  177. package/lib/cjs/ViewDefinition.d.ts +439 -439
  178. package/lib/cjs/ViewDefinition.js +646 -646
  179. package/lib/cjs/ViewDefinition.js.map +1 -1
  180. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  181. package/lib/cjs/ViewStateHydrator.js +103 -103
  182. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  183. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  184. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  185. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  186. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  187. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  188. package/lib/cjs/core-backend.d.ts +184 -184
  189. package/lib/cjs/core-backend.js +204 -204
  190. package/lib/cjs/core-backend.js.map +1 -1
  191. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  192. package/lib/cjs/domains/FunctionalElements.js +145 -145
  193. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  194. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  195. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  196. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  197. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  198. package/lib/cjs/domains/GenericElements.js +263 -263
  199. package/lib/cjs/domains/GenericElements.js.map +1 -1
  200. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  201. package/lib/cjs/domains/GenericSchema.js +28 -28
  202. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  203. package/lib/cjs/rpc/multipart.d.ts +11 -11
  204. package/lib/cjs/rpc/multipart.js +70 -70
  205. package/lib/cjs/rpc/multipart.js.map +1 -1
  206. package/lib/cjs/rpc/tracing.d.ts +28 -28
  207. package/lib/cjs/rpc/tracing.js +73 -73
  208. package/lib/cjs/rpc/tracing.js.map +1 -1
  209. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  210. package/lib/cjs/rpc/web/logging.js +42 -42
  211. package/lib/cjs/rpc/web/logging.js.map +1 -1
  212. package/lib/cjs/rpc/web/request.d.ts +6 -6
  213. package/lib/cjs/rpc/web/request.js +73 -73
  214. package/lib/cjs/rpc/web/request.js.map +1 -1
  215. package/lib/cjs/rpc/web/response.d.ts +6 -6
  216. package/lib/cjs/rpc/web/response.js +105 -105
  217. package/lib/cjs/rpc/web/response.js.map +1 -1
  218. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  219. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  220. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  221. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  222. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +291 -291
  223. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  224. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  225. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  226. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  227. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  228. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  229. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  230. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  231. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  232. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  233. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  234. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  235. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  236. package/lib/cjs/workspace/Settings.d.ts +186 -186
  237. package/lib/cjs/workspace/Settings.js +155 -155
  238. package/lib/cjs/workspace/Settings.js.map +1 -1
  239. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  240. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  241. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  242. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  243. package/lib/cjs/workspace/Workspace.js +543 -543
  244. package/lib/cjs/workspace/Workspace.js.map +1 -1
  245. package/package.json +12 -12
@@ -1,29 +1,29 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Schema
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.GenericSchema = void 0;
11
- const path = require("path");
12
- const ClassRegistry_1 = require("../ClassRegistry");
13
- const IModelHost_1 = require("../IModelHost");
14
- const Schema_1 = require("../Schema");
15
- const elementsModule = require("./GenericElements");
16
- /** @public */
17
- class GenericSchema extends Schema_1.Schema {
18
- static get schemaName() { return "Generic"; }
19
- static get schemaFilePath() { return path.join(IModelHost_1.KnownLocations.nativeAssetsDir, "ECSchemas", "Dgn", `${GenericSchema.schemaName}.ecschema.xml`); }
20
- static registerSchema() {
21
- if (this !== Schema_1.Schemas.getRegisteredSchema(this.schemaName)) {
22
- Schema_1.Schemas.unregisterSchema(this.schemaName);
23
- Schema_1.Schemas.registerSchema(this);
24
- ClassRegistry_1.ClassRegistry.registerModule(elementsModule, this);
25
- }
26
- }
27
- }
28
- exports.GenericSchema = GenericSchema;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Schema
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GenericSchema = void 0;
11
+ const path = require("path");
12
+ const ClassRegistry_1 = require("../ClassRegistry");
13
+ const IModelHost_1 = require("../IModelHost");
14
+ const Schema_1 = require("../Schema");
15
+ const elementsModule = require("./GenericElements");
16
+ /** @public */
17
+ class GenericSchema extends Schema_1.Schema {
18
+ static get schemaName() { return "Generic"; }
19
+ static get schemaFilePath() { return path.join(IModelHost_1.KnownLocations.nativeAssetsDir, "ECSchemas", "Dgn", `${GenericSchema.schemaName}.ecschema.xml`); }
20
+ static registerSchema() {
21
+ if (this !== Schema_1.Schemas.getRegisteredSchema(this.schemaName)) {
22
+ Schema_1.Schemas.unregisterSchema(this.schemaName);
23
+ Schema_1.Schemas.registerSchema(this);
24
+ ClassRegistry_1.ClassRegistry.registerModule(elementsModule, this);
25
+ }
26
+ }
27
+ }
28
+ exports.GenericSchema = GenericSchema;
29
29
  //# sourceMappingURL=GenericSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","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 Schema\r\n */\r\n\r\nimport * as path from \"path\";\r\nimport { ClassRegistry } from \"../ClassRegistry\";\r\nimport { KnownLocations } from \"../IModelHost\";\r\nimport { Schema, Schemas } from \"../Schema\";\r\nimport * as elementsModule from \"./GenericElements\";\r\n\r\n/** @public */\r\nexport class GenericSchema extends Schema {\r\n public static override get schemaName(): string { return \"Generic\"; }\r\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\r\n public static registerSchema() {\r\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\r\n Schemas.unregisterSchema(this.schemaName);\r\n Schemas.registerSchema(this);\r\n ClassRegistry.registerModule(elementsModule, this);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport * as path from \"path\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./GenericElements\";\n\n/** @public */\nexport class GenericSchema extends Schema {\n public static override get schemaName(): string { return \"Generic\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n}\n"]}
@@ -1,12 +1,12 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { FormDataCommon, HttpServerRequest, RpcSerializedValue } from "@itwin/core-common";
5
- import * as FormData from "form-data";
6
- /** @internal */
7
- export declare function createMultipartStream(value: RpcSerializedValue): FormData;
8
- /** @internal */
9
- export declare function parseMultipartRequest(req: HttpServerRequest): Promise<RpcSerializedValue>;
10
- /** @internal */
11
- export declare function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void;
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ import { FormDataCommon, HttpServerRequest, RpcSerializedValue } from "@itwin/core-common";
5
+ import * as FormData from "form-data";
6
+ /** @internal */
7
+ export declare function createMultipartStream(value: RpcSerializedValue): FormData;
8
+ /** @internal */
9
+ export declare function parseMultipartRequest(req: HttpServerRequest): Promise<RpcSerializedValue>;
10
+ /** @internal */
11
+ export declare function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void;
12
12
  //# sourceMappingURL=multipart.d.ts.map
@@ -1,71 +1,71 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module RpcInterface
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.appendToMultipartForm = exports.parseMultipartRequest = exports.createMultipartStream = void 0;
11
- const core_common_1 = require("@itwin/core-common");
12
- const FormData = require("form-data");
13
- const multiparty = require("multiparty");
14
- /** @internal */
15
- function createMultipartStream(value) {
16
- const form = new FormData();
17
- core_common_1.RpcMultipart.writeValueToForm(form, value);
18
- // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
19
- // fine for now.
20
- return form;
21
- }
22
- exports.createMultipartStream = createMultipartStream;
23
- /** @internal */
24
- async function parseMultipartRequest(req) {
25
- return new Promise((resolve, reject) => {
26
- const form = new multiparty.Form({ maxFieldsSize: Infinity });
27
- form.on("error", (err) => {
28
- reject(err);
29
- });
30
- const value = core_common_1.RpcSerializedValue.create();
31
- const data = {};
32
- form.on("part", (part) => {
33
- part.on("data", (chunk) => {
34
- if (part.name === "objects") {
35
- value.objects += chunk.toString();
36
- }
37
- else if (Buffer.isBuffer(chunk)) {
38
- if (!data[part.name]) {
39
- data[part.name] = { size: 0, chunks: [] };
40
- }
41
- data[part.name].size += chunk.byteLength;
42
- data[part.name].chunks.push(chunk);
43
- }
44
- else {
45
- throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
46
- }
47
- });
48
- });
49
- form.on("close", () => {
50
- let i = 0;
51
- for (;;) {
52
- const part = data[`data-${i}`];
53
- if (!part) {
54
- break;
55
- }
56
- value.data.push(Buffer.concat(part.chunks, part.size));
57
- ++i;
58
- }
59
- resolve(value);
60
- });
61
- form.parse(req);
62
- });
63
- }
64
- exports.parseMultipartRequest = parseMultipartRequest;
65
- /** @internal */
66
- function appendToMultipartForm(i, form, value) {
67
- const buf = value.data[i];
68
- form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
69
- }
70
- exports.appendToMultipartForm = appendToMultipartForm;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module RpcInterface
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.appendToMultipartForm = exports.parseMultipartRequest = exports.createMultipartStream = void 0;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const FormData = require("form-data");
13
+ const multiparty = require("multiparty");
14
+ /** @internal */
15
+ function createMultipartStream(value) {
16
+ const form = new FormData();
17
+ core_common_1.RpcMultipart.writeValueToForm(form, value);
18
+ // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
19
+ // fine for now.
20
+ return form;
21
+ }
22
+ exports.createMultipartStream = createMultipartStream;
23
+ /** @internal */
24
+ async function parseMultipartRequest(req) {
25
+ return new Promise((resolve, reject) => {
26
+ const form = new multiparty.Form({ maxFieldsSize: Infinity });
27
+ form.on("error", (err) => {
28
+ reject(err);
29
+ });
30
+ const value = core_common_1.RpcSerializedValue.create();
31
+ const data = {};
32
+ form.on("part", (part) => {
33
+ part.on("data", (chunk) => {
34
+ if (part.name === "objects") {
35
+ value.objects += chunk.toString();
36
+ }
37
+ else if (Buffer.isBuffer(chunk)) {
38
+ if (!data[part.name]) {
39
+ data[part.name] = { size: 0, chunks: [] };
40
+ }
41
+ data[part.name].size += chunk.byteLength;
42
+ data[part.name].chunks.push(chunk);
43
+ }
44
+ else {
45
+ throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
46
+ }
47
+ });
48
+ });
49
+ form.on("close", () => {
50
+ let i = 0;
51
+ for (;;) {
52
+ const part = data[`data-${i}`];
53
+ if (!part) {
54
+ break;
55
+ }
56
+ value.data.push(Buffer.concat(part.chunks, part.size));
57
+ ++i;
58
+ }
59
+ resolve(value);
60
+ });
61
+ form.parse(req);
62
+ });
63
+ }
64
+ exports.parseMultipartRequest = parseMultipartRequest;
65
+ /** @internal */
66
+ function appendToMultipartForm(i, form, value) {
67
+ const buf = value.data[i];
68
+ form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
69
+ }
70
+ exports.appendToMultipartForm = appendToMultipartForm;
71
71
  //# sourceMappingURL=multipart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":"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","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":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\nimport * as FormData from \"form-data\";\nimport * as multiparty from \"multiparty\";\n\n/** @internal */\nexport function createMultipartStream(value: RpcSerializedValue) {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\n // fine for now.\n return form;\n}\n\n/** @internal */\nexport async function parseMultipartRequest(req: HttpServerRequest) {\n return new Promise<RpcSerializedValue>((resolve, reject) => {\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\n form.on(\"error\", (err) => {\n reject(err);\n });\n\n const value = RpcSerializedValue.create();\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\n\n form.on(\"part\", (part: multiparty.Part) => {\n part.on(\"data\", (chunk: string | Buffer) => {\n if (part.name === \"objects\") {\n value.objects += chunk.toString();\n } else if (Buffer.isBuffer(chunk)) {\n if (!data[part.name]) {\n data[part.name] = { size: 0, chunks: [] };\n }\n\n data[part.name].size += chunk.byteLength;\n data[part.name].chunks.push(chunk);\n } else {\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\n }\n });\n });\n\n form.on(\"close\", () => {\n let i = 0;\n for (; ;) {\n const part = data[`data-${i}`];\n if (!part) {\n break;\n }\n\n value.data.push(Buffer.concat(part.chunks, part.size));\n ++i;\n }\n\n resolve(value);\n });\n\n form.parse(req);\n });\n}\n\n/** @internal */\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\n const buf = value.data[i];\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\n}\n"]}
@@ -1,29 +1,29 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { RpcActivity } from "@itwin/core-common";
5
- /**
6
- * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
7
- * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
8
- * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
9
- * from the RpcActivity.
10
- * @public
11
- */
12
- export declare class RpcTrace {
13
- private static _storage;
14
- /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
15
- * RpcActivity in the current call stack.
16
- * */
17
- static get currentActivity(): RpcActivity | undefined;
18
- /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
19
- * exists in the current call stack.
20
- * */
21
- static get expectCurrentActivity(): RpcActivity;
22
- /** Start the processing of an RpcActivity. */
23
- static run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
24
- /** Start the processing of an RpcActivity inside an OpenTelemetry span */
25
- static runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
26
- }
27
- /** @internal */
28
- export declare function initializeTracing(enableOpenTelemetry?: boolean): void;
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ import { RpcActivity } from "@itwin/core-common";
5
+ /**
6
+ * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
7
+ * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
8
+ * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
9
+ * from the RpcActivity.
10
+ * @public
11
+ */
12
+ export declare class RpcTrace {
13
+ private static _storage;
14
+ /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
15
+ * RpcActivity in the current call stack.
16
+ * */
17
+ static get currentActivity(): RpcActivity | undefined;
18
+ /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
19
+ * exists in the current call stack.
20
+ * */
21
+ static get expectCurrentActivity(): RpcActivity;
22
+ /** Start the processing of an RpcActivity. */
23
+ static run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
24
+ /** Start the processing of an RpcActivity inside an OpenTelemetry span */
25
+ static runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
26
+ }
27
+ /** @internal */
28
+ export declare function initializeTracing(enableOpenTelemetry?: boolean): void;
29
29
  //# sourceMappingURL=tracing.d.ts.map
@@ -1,74 +1,74 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module RpcInterface
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.initializeTracing = exports.RpcTrace = void 0;
11
- // cspell:ignore calltrace
12
- const core_bentley_1 = require("@itwin/core-bentley");
13
- const core_common_1 = require("@itwin/core-common");
14
- const async_hooks_1 = require("async_hooks");
15
- const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
16
- const IModelHost_1 = require("../IModelHost");
17
- /**
18
- * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
19
- * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
20
- * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
21
- * from the RpcActivity.
22
- * @public
23
- */
24
- class RpcTrace {
25
- /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
26
- * RpcActivity in the current call stack.
27
- * */
28
- static get currentActivity() {
29
- return RpcTrace._storage.getStore();
30
- }
31
- /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
32
- * exists in the current call stack.
33
- * */
34
- static get expectCurrentActivity() {
35
- (0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
36
- return RpcTrace.currentActivity;
37
- }
38
- /** Start the processing of an RpcActivity. */
39
- static async run(activity, fn) {
40
- return RpcTrace._storage.run(activity, fn);
41
- }
42
- /** Start the processing of an RpcActivity inside an OpenTelemetry span */
43
- static async runWithSpan(activity, fn) {
44
- var _a;
45
- return core_bentley_1.Tracing.withSpan((_a = activity.rpcMethod) !== null && _a !== void 0 ? _a : "unknown RPC method", async () => RpcTrace.run(activity, fn), {
46
- attributes: { ...core_common_1.RpcInvocation.sanitizeForLog(activity) },
47
- kind: core_bentley_1.SpanKind.SERVER,
48
- });
49
- }
50
- }
51
- exports.RpcTrace = RpcTrace;
52
- RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
53
- /** @internal */
54
- function initializeTracing(enableOpenTelemetry = false) {
55
- core_common_1.RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer
56
- if (enableOpenTelemetry) {
57
- try {
58
- // eslint-disable-next-line @typescript-eslint/no-var-requires
59
- const api = require("@opentelemetry/api");
60
- const tracer = api.trace.getTracer("@itwin/core-backend", IModelHost_1.IModelHost.backendVersion);
61
- core_bentley_1.Tracing.enableOpenTelemetry(tracer, api);
62
- core_common_1.RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace
63
- }
64
- catch (e) {
65
- // eslint-disable-next-line @typescript-eslint/naming-convention
66
- core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, "Failed to initialize OpenTelemetry");
67
- core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, e);
68
- }
69
- }
70
- // set up static logger metadata to include current RpcActivity information for logs during rpc processing
71
- core_bentley_1.Logger.staticMetaData.set("rpc", () => core_common_1.RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));
72
- }
73
- exports.initializeTracing = initializeTracing;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module RpcInterface
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.initializeTracing = exports.RpcTrace = void 0;
11
+ // cspell:ignore calltrace
12
+ const core_bentley_1 = require("@itwin/core-bentley");
13
+ const core_common_1 = require("@itwin/core-common");
14
+ const async_hooks_1 = require("async_hooks");
15
+ const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
16
+ const IModelHost_1 = require("../IModelHost");
17
+ /**
18
+ * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
19
+ * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
20
+ * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
21
+ * from the RpcActivity.
22
+ * @public
23
+ */
24
+ class RpcTrace {
25
+ /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
26
+ * RpcActivity in the current call stack.
27
+ * */
28
+ static get currentActivity() {
29
+ return RpcTrace._storage.getStore();
30
+ }
31
+ /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
32
+ * exists in the current call stack.
33
+ * */
34
+ static get expectCurrentActivity() {
35
+ (0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
36
+ return RpcTrace.currentActivity;
37
+ }
38
+ /** Start the processing of an RpcActivity. */
39
+ static async run(activity, fn) {
40
+ return RpcTrace._storage.run(activity, fn);
41
+ }
42
+ /** Start the processing of an RpcActivity inside an OpenTelemetry span */
43
+ static async runWithSpan(activity, fn) {
44
+ var _a;
45
+ return core_bentley_1.Tracing.withSpan((_a = activity.rpcMethod) !== null && _a !== void 0 ? _a : "unknown RPC method", async () => RpcTrace.run(activity, fn), {
46
+ attributes: { ...core_common_1.RpcInvocation.sanitizeForLog(activity) },
47
+ kind: core_bentley_1.SpanKind.SERVER,
48
+ });
49
+ }
50
+ }
51
+ exports.RpcTrace = RpcTrace;
52
+ RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
53
+ /** @internal */
54
+ function initializeTracing(enableOpenTelemetry = false) {
55
+ core_common_1.RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer
56
+ if (enableOpenTelemetry) {
57
+ try {
58
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
59
+ const api = require("@opentelemetry/api");
60
+ const tracer = api.trace.getTracer("@itwin/core-backend", IModelHost_1.IModelHost.backendVersion);
61
+ core_bentley_1.Tracing.enableOpenTelemetry(tracer, api);
62
+ core_common_1.RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace
63
+ }
64
+ catch (e) {
65
+ // eslint-disable-next-line @typescript-eslint/naming-convention
66
+ core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, "Failed to initialize OpenTelemetry");
67
+ core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, e);
68
+ }
69
+ }
70
+ // set up static logger metadata to include current RpcActivity information for logs during rpc processing
71
+ core_bentley_1.Logger.staticMetaData.set("rpc", () => core_common_1.RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));
72
+ }
73
+ exports.initializeTracing = initializeTracing;
74
74
  //# sourceMappingURL=tracing.js.map
@@ -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;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,8CAA8C;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAI,QAAqB,EAAE,EAAoB;QACpE,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,QAAqB,EAAE,EAAoB;;QAC5E,OAAO,sBAAO,CAAC,QAAQ,CAAC,MAAA,QAAQ,CAAC,SAAS,mCAAI,oBAAoB,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YAC1G,UAAU,EAAE,EAAE,GAAG,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACzD,IAAI,EAAE,uBAAQ,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;;AA7BH,4BA8BC;AA7BgB,iBAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;AA+BpD,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,sBAA+B,KAAK;IACpE,2BAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,mDAAmD;IAE7F,IAAI,mBAAmB,EAAE;QACvB,IAAI;YACF,8DAA8D;YAC9D,MAAM,GAAG,GAAG,OAAO,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/**\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,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;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,8CAA8C;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAI,QAAqB,EAAE,EAAoB;QACpE,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,QAAqB,EAAE,EAAoB;;QAC5E,OAAO,sBAAO,CAAC,QAAQ,CAAC,MAAA,QAAQ,CAAC,SAAS,mCAAI,oBAAoB,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YAC1G,UAAU,EAAE,EAAE,GAAG,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACzD,IAAI,EAAE,uBAAQ,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;;AA7BH,4BA8BC;AA7BgB,iBAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;AA+BpD,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,sBAA+B,KAAK;IACpE,2BAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,mDAAmD;IAE7F,IAAI,mBAAmB,EAAE;QACvB,IAAI;YACF,8DAA8D;YAC9D,MAAM,GAAG,GAAG,OAAO,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\n// cspell:ignore calltrace\n\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\nimport { AsyncLocalStorage } from \"async_hooks\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { IModelHost } from \"../IModelHost\";\n\n/**\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\n * from the RpcActivity.\n * @public\n */\nexport class RpcTrace {\n private static _storage = new AsyncLocalStorage();\n\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\n * RpcActivity in the current call stack.\n * */\n public static get currentActivity(): RpcActivity | undefined {\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\n }\n\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\n * exists in the current call stack.\n * */\n public static get expectCurrentActivity(): RpcActivity {\n assert(undefined !== RpcTrace.currentActivity);\n return RpcTrace.currentActivity;\n }\n\n /** Start the processing of an RpcActivity. */\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return RpcTrace._storage.run(activity, fn);\n }\n\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\n kind: SpanKind.SERVER,\n });\n }\n}\n\n/** @internal */\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\n RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer\n\n if (enableOpenTelemetry) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const api = require(\"@opentelemetry/api\");\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\n Tracing.enableOpenTelemetry(tracer, api);\n RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace\n } catch (e) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\n Logger.logException(BackendLoggerCategory.IModelHost, e);\n }\n }\n\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\n}\n"]}
@@ -1,10 +1,10 @@
1
- /** @packageDocumentation
2
- * @module RpcInterface
3
- */
4
- import { RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from "@itwin/core-common";
5
- export declare class WebAppRpcLoggingBackend extends WebAppRpcLogging {
6
- protected logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void>;
7
- protected getHostname(): string;
8
- private logErrorBackend;
9
- }
1
+ /** @packageDocumentation
2
+ * @module RpcInterface
3
+ */
4
+ import { RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from "@itwin/core-common";
5
+ export declare class WebAppRpcLoggingBackend extends WebAppRpcLogging {
6
+ protected logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void>;
7
+ protected getHostname(): string;
8
+ private logErrorBackend;
9
+ }
10
10
  //# sourceMappingURL=logging.d.ts.map
@@ -1,43 +1,43 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module RpcInterface
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.WebAppRpcLoggingBackend = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const core_common_1 = require("@itwin/core-common");
13
- const os = require("os");
14
- class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
15
- async logProtocolEvent(event, object) {
16
- switch (event) {
17
- case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
18
- case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
19
- case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
20
- }
21
- }
22
- getHostname() {
23
- return os.hostname();
24
- }
25
- async logErrorBackend(message, invocation) {
26
- const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
27
- const pathIds = this.findPathIds(invocation.request.path);
28
- const result = await invocation.result;
29
- const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
30
- core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
31
- method: invocation.request.method,
32
- path: invocation.request.path,
33
- status: invocation.status,
34
- errorMessage,
35
- // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
36
- ActivityId: invocation.request.id,
37
- MachineName: this.getHostname(),
38
- ...pathIds,
39
- }));
40
- }
41
- }
42
- exports.WebAppRpcLoggingBackend = WebAppRpcLoggingBackend;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module RpcInterface
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WebAppRpcLoggingBackend = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_common_1 = require("@itwin/core-common");
13
+ const os = require("os");
14
+ class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
15
+ async logProtocolEvent(event, object) {
16
+ switch (event) {
17
+ case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
18
+ case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
19
+ case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
20
+ }
21
+ }
22
+ getHostname() {
23
+ return os.hostname();
24
+ }
25
+ async logErrorBackend(message, invocation) {
26
+ const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
27
+ const pathIds = this.findPathIds(invocation.request.path);
28
+ const result = await invocation.result;
29
+ const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
30
+ core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
31
+ method: invocation.request.method,
32
+ path: invocation.request.path,
33
+ status: invocation.status,
34
+ errorMessage,
35
+ // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
36
+ ActivityId: invocation.request.id,
37
+ MachineName: this.getHostname(),
38
+ ...pathIds,
39
+ }));
40
+ }
41
+ }
42
+ exports.WebAppRpcLoggingBackend = WebAppRpcLoggingBackend;
43
43
  //# sourceMappingURL=logging.js.map