@itwin/core-backend 3.7.7 → 3.7.9

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 (247) hide show
  1. package/CHANGELOG.md +13 -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 +414 -414
  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 +121 -121
  30. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  31. package/lib/cjs/CheckpointManager.js +363 -352
  32. package/lib/cjs/CheckpointManager.js.map +1 -1
  33. package/lib/cjs/ClassRegistry.d.ts +79 -79
  34. package/lib/cjs/ClassRegistry.js +250 -250
  35. package/lib/cjs/ClassRegistry.js.map +1 -1
  36. package/lib/cjs/CloudSqlite.d.ts +350 -350
  37. package/lib/cjs/CloudSqlite.js +153 -153
  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 +55 -55
  46. package/lib/cjs/CodeSpecs.js +124 -124
  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 +82 -82
  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 +194 -194
  61. package/lib/cjs/ECDb.js +355 -355
  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 +473 -473
  67. package/lib/cjs/ECSqlStatement.js +791 -791
  68. package/lib/cjs/ECSqlStatement.js.map +1 -1
  69. package/lib/cjs/Element.d.ts +1109 -1109
  70. package/lib/cjs/Element.js +1427 -1427
  71. package/lib/cjs/Element.js.map +1 -1
  72. package/lib/cjs/ElementAspect.d.ts +179 -179
  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 +1213 -1213
  106. package/lib/cjs/IModelDb.js +2392 -2392
  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 -369
  112. package/lib/cjs/IModelHost.d.ts.map +1 -1
  113. package/lib/cjs/IModelHost.js +497 -496
  114. package/lib/cjs/IModelHost.js.map +1 -1
  115. package/lib/cjs/IModelJsFs.d.ts +62 -62
  116. package/lib/cjs/IModelJsFs.js +140 -140
  117. package/lib/cjs/IModelJsFs.js.map +1 -1
  118. package/lib/cjs/IpcHost.d.ts +104 -104
  119. package/lib/cjs/IpcHost.js +278 -278
  120. package/lib/cjs/IpcHost.js.map +1 -1
  121. package/lib/cjs/LineStyle.d.ts +311 -311
  122. package/lib/cjs/LineStyle.js +295 -295
  123. package/lib/cjs/LineStyle.js.map +1 -1
  124. package/lib/cjs/LocalHub.d.ts +162 -162
  125. package/lib/cjs/LocalHub.js +585 -585
  126. package/lib/cjs/LocalHub.js.map +1 -1
  127. package/lib/cjs/LocalhostIpcHost.d.ts +21 -21
  128. package/lib/cjs/LocalhostIpcHost.js +81 -81
  129. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  130. package/lib/cjs/Material.d.ts +131 -131
  131. package/lib/cjs/Material.js +181 -181
  132. package/lib/cjs/Material.js.map +1 -1
  133. package/lib/cjs/Model.d.ts +392 -392
  134. package/lib/cjs/Model.js +485 -485
  135. package/lib/cjs/Model.js.map +1 -1
  136. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  137. package/lib/cjs/NativeAppStorage.js +202 -202
  138. package/lib/cjs/NativeAppStorage.js.map +1 -1
  139. package/lib/cjs/NativeHost.d.ts +52 -52
  140. package/lib/cjs/NativeHost.js +163 -163
  141. package/lib/cjs/NativeHost.js.map +1 -1
  142. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  143. package/lib/cjs/NavigationRelationship.js +225 -225
  144. package/lib/cjs/NavigationRelationship.js.map +1 -1
  145. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  146. package/lib/cjs/PromiseMemoizer.js +101 -101
  147. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  148. package/lib/cjs/PropertyStore.d.ts +132 -132
  149. package/lib/cjs/PropertyStore.js +11 -11
  150. package/lib/cjs/PropertyStore.js.map +1 -1
  151. package/lib/cjs/Relationship.d.ts +416 -416
  152. package/lib/cjs/Relationship.js +494 -494
  153. package/lib/cjs/Relationship.js.map +1 -1
  154. package/lib/cjs/RpcBackend.d.ts +5 -5
  155. package/lib/cjs/RpcBackend.js +32 -32
  156. package/lib/cjs/RpcBackend.js.map +1 -1
  157. package/lib/cjs/SQLiteDb.d.ts +219 -219
  158. package/lib/cjs/SQLiteDb.js +214 -214
  159. package/lib/cjs/SQLiteDb.js.map +1 -1
  160. package/lib/cjs/Schema.d.ts +55 -55
  161. package/lib/cjs/Schema.js +83 -83
  162. package/lib/cjs/Schema.js.map +1 -1
  163. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  164. package/lib/cjs/ServerBasedLocks.js +168 -168
  165. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  166. package/lib/cjs/SqliteStatement.d.ts +360 -360
  167. package/lib/cjs/SqliteStatement.js +586 -586
  168. package/lib/cjs/SqliteStatement.js.map +1 -1
  169. package/lib/cjs/Texture.d.ts +58 -58
  170. package/lib/cjs/Texture.js +82 -82
  171. package/lib/cjs/Texture.js.map +1 -1
  172. package/lib/cjs/TileStorage.d.ts +25 -18
  173. package/lib/cjs/TileStorage.d.ts.map +1 -1
  174. package/lib/cjs/TileStorage.js +102 -90
  175. package/lib/cjs/TileStorage.js.map +1 -1
  176. package/lib/cjs/TxnManager.d.ts +202 -202
  177. package/lib/cjs/TxnManager.js +356 -356
  178. package/lib/cjs/TxnManager.js.map +1 -1
  179. package/lib/cjs/ViewDefinition.d.ts +439 -439
  180. package/lib/cjs/ViewDefinition.js +646 -646
  181. package/lib/cjs/ViewDefinition.js.map +1 -1
  182. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  183. package/lib/cjs/ViewStateHydrator.js +103 -103
  184. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  185. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  186. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  187. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  188. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  189. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  190. package/lib/cjs/core-backend.d.ts +184 -184
  191. package/lib/cjs/core-backend.js +204 -204
  192. package/lib/cjs/core-backend.js.map +1 -1
  193. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  194. package/lib/cjs/domains/FunctionalElements.js +145 -145
  195. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  196. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  197. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  198. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  199. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  200. package/lib/cjs/domains/GenericElements.js +263 -263
  201. package/lib/cjs/domains/GenericElements.js.map +1 -1
  202. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  203. package/lib/cjs/domains/GenericSchema.js +28 -28
  204. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  205. package/lib/cjs/rpc/multipart.d.ts +11 -11
  206. package/lib/cjs/rpc/multipart.js +71 -71
  207. package/lib/cjs/rpc/multipart.js.map +1 -1
  208. package/lib/cjs/rpc/tracing.d.ts +28 -28
  209. package/lib/cjs/rpc/tracing.js +74 -74
  210. package/lib/cjs/rpc/tracing.js.map +1 -1
  211. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  212. package/lib/cjs/rpc/web/logging.js +43 -43
  213. package/lib/cjs/rpc/web/logging.js.map +1 -1
  214. package/lib/cjs/rpc/web/request.d.ts +6 -6
  215. package/lib/cjs/rpc/web/request.js +74 -74
  216. package/lib/cjs/rpc/web/request.js.map +1 -1
  217. package/lib/cjs/rpc/web/response.d.ts +6 -6
  218. package/lib/cjs/rpc/web/response.js +106 -106
  219. package/lib/cjs/rpc/web/response.js.map +1 -1
  220. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  221. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  222. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  223. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  224. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +294 -294
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  226. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  227. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +211 -211
  228. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  229. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  230. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  231. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  232. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  233. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  234. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  235. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  236. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  237. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  238. package/lib/cjs/workspace/Settings.d.ts +186 -186
  239. package/lib/cjs/workspace/Settings.js +155 -155
  240. package/lib/cjs/workspace/Settings.js.map +1 -1
  241. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  242. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  243. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  244. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  245. package/lib/cjs/workspace/Workspace.js +543 -543
  246. package/lib/cjs/workspace/Workspace.js.map +1 -1
  247. package/package.json +17 -16
@@ -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,72 +1,72 @@
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
- /* eslint-disable deprecation/deprecation */
15
- /** @internal */
16
- function createMultipartStream(value) {
17
- const form = new FormData();
18
- core_common_1.RpcMultipart.writeValueToForm(form, value);
19
- // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
20
- // fine for now.
21
- return form;
22
- }
23
- exports.createMultipartStream = createMultipartStream;
24
- /** @internal */
25
- async function parseMultipartRequest(req) {
26
- return new Promise((resolve, reject) => {
27
- const form = new multiparty.Form({ maxFieldsSize: Infinity });
28
- form.on("error", (err) => {
29
- reject(err);
30
- });
31
- const value = core_common_1.RpcSerializedValue.create();
32
- const data = {};
33
- form.on("part", (part) => {
34
- part.on("data", (chunk) => {
35
- if (part.name === "objects") {
36
- value.objects += chunk.toString();
37
- }
38
- else if (Buffer.isBuffer(chunk)) {
39
- if (!data[part.name]) {
40
- data[part.name] = { size: 0, chunks: [] };
41
- }
42
- data[part.name].size += chunk.byteLength;
43
- data[part.name].chunks.push(chunk);
44
- }
45
- else {
46
- throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
47
- }
48
- });
49
- });
50
- form.on("close", () => {
51
- let i = 0;
52
- for (;;) {
53
- const part = data[`data-${i}`];
54
- if (!part) {
55
- break;
56
- }
57
- value.data.push(Buffer.concat(part.chunks, part.size));
58
- ++i;
59
- }
60
- resolve(value);
61
- });
62
- form.parse(req);
63
- });
64
- }
65
- exports.parseMultipartRequest = parseMultipartRequest;
66
- /** @internal */
67
- function appendToMultipartForm(i, form, value) {
68
- const buf = value.data[i];
69
- form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
70
- }
71
- 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
+ /* eslint-disable deprecation/deprecation */
15
+ /** @internal */
16
+ function createMultipartStream(value) {
17
+ const form = new FormData();
18
+ core_common_1.RpcMultipart.writeValueToForm(form, value);
19
+ // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
20
+ // fine for now.
21
+ return form;
22
+ }
23
+ exports.createMultipartStream = createMultipartStream;
24
+ /** @internal */
25
+ async function parseMultipartRequest(req) {
26
+ return new Promise((resolve, reject) => {
27
+ const form = new multiparty.Form({ maxFieldsSize: Infinity });
28
+ form.on("error", (err) => {
29
+ reject(err);
30
+ });
31
+ const value = core_common_1.RpcSerializedValue.create();
32
+ const data = {};
33
+ form.on("part", (part) => {
34
+ part.on("data", (chunk) => {
35
+ if (part.name === "objects") {
36
+ value.objects += chunk.toString();
37
+ }
38
+ else if (Buffer.isBuffer(chunk)) {
39
+ if (!data[part.name]) {
40
+ data[part.name] = { size: 0, chunks: [] };
41
+ }
42
+ data[part.name].size += chunk.byteLength;
43
+ data[part.name].chunks.push(chunk);
44
+ }
45
+ else {
46
+ throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
47
+ }
48
+ });
49
+ });
50
+ form.on("close", () => {
51
+ let i = 0;
52
+ for (;;) {
53
+ const part = data[`data-${i}`];
54
+ if (!part) {
55
+ break;
56
+ }
57
+ value.data.push(Buffer.concat(part.chunks, part.size));
58
+ ++i;
59
+ }
60
+ resolve(value);
61
+ });
62
+ form.parse(req);
63
+ });
64
+ }
65
+ exports.parseMultipartRequest = parseMultipartRequest;
66
+ /** @internal */
67
+ function appendToMultipartForm(i, form, value) {
68
+ const buf = value.data[i];
69
+ form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
70
+ }
71
+ exports.appendToMultipartForm = appendToMultipartForm;
72
72
  //# sourceMappingURL=multipart.js.map
@@ -1 +1 @@
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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AAE;YACpB,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,SAAU;gBACR,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBAC/B,IAAI,CAAC,IAAI,EAAE;oBACT,MAAM;iBACP;gBAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvD,EAAE,CAAC,CAAC;aACL;YAED,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,sDA4CC;AAED,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,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
+ {"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,GAA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,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACpC;qBAAM;oBACL,MAAM,IAAI,yBAAW,CAAC,2BAAa,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;iBAC9D;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACpB,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,SAAU;gBACR,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBAC/B,IAAI,CAAC,IAAI,EAAE;oBACT,MAAM;iBACP;gBAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvD,EAAE,CAAC,CAAC;aACL;YAED,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AA5CD,sDA4CC;AAED,gBAAgB;AAChB,SAAgB,qBAAqB,CAAC,CAAS,EAAE,IAAoB,EAAE,KAAyB;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,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":["/*---------------------------------------------------------------------------------------------\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/* eslint-disable deprecation/deprecation */\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,75 +1,75 @@
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
- /* eslint-disable deprecation/deprecation */
18
- /**
19
- * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
20
- * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
21
- * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
22
- * from the RpcActivity.
23
- * @public
24
- */
25
- class RpcTrace {
26
- /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
27
- * RpcActivity in the current call stack.
28
- * */
29
- static get currentActivity() {
30
- return RpcTrace._storage.getStore();
31
- }
32
- /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
33
- * exists in the current call stack.
34
- * */
35
- static get expectCurrentActivity() {
36
- (0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
37
- return RpcTrace.currentActivity;
38
- }
39
- /** Start the processing of an RpcActivity. */
40
- static async run(activity, fn) {
41
- return RpcTrace._storage.run(activity, fn);
42
- }
43
- /** Start the processing of an RpcActivity inside an OpenTelemetry span */
44
- static async runWithSpan(activity, fn) {
45
- var _a;
46
- return core_bentley_1.Tracing.withSpan((_a = activity.rpcMethod) !== null && _a !== void 0 ? _a : "unknown RPC method", async () => RpcTrace.run(activity, fn), {
47
- attributes: { ...core_common_1.RpcInvocation.sanitizeForLog(activity) },
48
- kind: core_bentley_1.SpanKind.SERVER,
49
- });
50
- }
51
- }
52
- exports.RpcTrace = RpcTrace;
53
- RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
54
- /** @internal */
55
- function initializeTracing(enableOpenTelemetry = false) {
56
- core_common_1.RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer
57
- if (enableOpenTelemetry) {
58
- try {
59
- // eslint-disable-next-line @typescript-eslint/no-var-requires
60
- const api = require("@opentelemetry/api");
61
- const tracer = api.trace.getTracer("@itwin/core-backend", IModelHost_1.IModelHost.backendVersion);
62
- core_bentley_1.Tracing.enableOpenTelemetry(tracer, api);
63
- core_common_1.RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace
64
- }
65
- catch (e) {
66
- // eslint-disable-next-line @typescript-eslint/naming-convention
67
- core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, "Failed to initialize OpenTelemetry");
68
- core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, e);
69
- }
70
- }
71
- // set up static logger metadata to include current RpcActivity information for logs during rpc processing
72
- core_bentley_1.Logger.staticMetaData.set("rpc", () => core_common_1.RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));
73
- }
74
- 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
+ /* eslint-disable deprecation/deprecation */
18
+ /**
19
+ * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
20
+ * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
21
+ * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
22
+ * from the RpcActivity.
23
+ * @public
24
+ */
25
+ class RpcTrace {
26
+ /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
27
+ * RpcActivity in the current call stack.
28
+ * */
29
+ static get currentActivity() {
30
+ return RpcTrace._storage.getStore();
31
+ }
32
+ /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
33
+ * exists in the current call stack.
34
+ * */
35
+ static get expectCurrentActivity() {
36
+ (0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
37
+ return RpcTrace.currentActivity;
38
+ }
39
+ /** Start the processing of an RpcActivity. */
40
+ static async run(activity, fn) {
41
+ return RpcTrace._storage.run(activity, fn);
42
+ }
43
+ /** Start the processing of an RpcActivity inside an OpenTelemetry span */
44
+ static async runWithSpan(activity, fn) {
45
+ var _a;
46
+ return core_bentley_1.Tracing.withSpan((_a = activity.rpcMethod) !== null && _a !== void 0 ? _a : "unknown RPC method", async () => RpcTrace.run(activity, fn), {
47
+ attributes: { ...core_common_1.RpcInvocation.sanitizeForLog(activity) },
48
+ kind: core_bentley_1.SpanKind.SERVER,
49
+ });
50
+ }
51
+ }
52
+ exports.RpcTrace = RpcTrace;
53
+ RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
54
+ /** @internal */
55
+ function initializeTracing(enableOpenTelemetry = false) {
56
+ core_common_1.RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer
57
+ if (enableOpenTelemetry) {
58
+ try {
59
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
60
+ const api = require("@opentelemetry/api");
61
+ const tracer = api.trace.getTracer("@itwin/core-backend", IModelHost_1.IModelHost.backendVersion);
62
+ core_bentley_1.Tracing.enableOpenTelemetry(tracer, api);
63
+ core_common_1.RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace
64
+ }
65
+ catch (e) {
66
+ // eslint-disable-next-line @typescript-eslint/naming-convention
67
+ core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, "Failed to initialize OpenTelemetry");
68
+ core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, e);
69
+ }
70
+ }
71
+ // set up static logger metadata to include current RpcActivity information for logs during rpc processing
72
+ core_bentley_1.Logger.staticMetaData.set("rpc", () => core_common_1.RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));
73
+ }
74
+ exports.initializeTracing = initializeTracing;
75
75
  //# 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,4CAA4C;AAE5C;;;;;;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,C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AAE,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
+ {"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,4CAA4C;AAE5C;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;SAEK;IACE,MAAM,KAAK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mB,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/* eslint-disable deprecation/deprecation */\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,44 +1,44 @@
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
- /* eslint-disable deprecation/deprecation */
15
- class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
16
- async logProtocolEvent(event, object) {
17
- switch (event) {
18
- case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
19
- case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
20
- case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
21
- }
22
- }
23
- getHostname() {
24
- return os.hostname();
25
- }
26
- async logErrorBackend(message, invocation) {
27
- const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
28
- const pathIds = this.findPathIds(invocation.request.path);
29
- const result = await invocation.result;
30
- const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
31
- core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
32
- method: invocation.request.method,
33
- path: invocation.request.path,
34
- status: invocation.status,
35
- errorMessage,
36
- // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
37
- ActivityId: invocation.request.id,
38
- MachineName: this.getHostname(),
39
- ...pathIds,
40
- }));
41
- }
42
- }
43
- 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
+ /* eslint-disable deprecation/deprecation */
15
+ class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
16
+ async logProtocolEvent(event, object) {
17
+ switch (event) {
18
+ case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
19
+ case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
20
+ case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
21
+ }
22
+ }
23
+ getHostname() {
24
+ return os.hostname();
25
+ }
26
+ async logErrorBackend(message, invocation) {
27
+ const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
28
+ const pathIds = this.findPathIds(invocation.request.path);
29
+ const result = await invocation.result;
30
+ const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
31
+ core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
32
+ method: invocation.request.method,
33
+ path: invocation.request.path,
34
+ status: invocation.status,
35
+ errorMessage,
36
+ // Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
37
+ ActivityId: invocation.request.id,
38
+ MachineName: this.getHostname(),
39
+ ...pathIds,
40
+ }));
41
+ }
42
+ }
43
+ exports.WebAppRpcLoggingBackend = WebAppRpcLoggingBackend;
44
44
  //# sourceMappingURL=logging.js.map