@itwin/core-backend 4.0.0-dev.51 → 4.0.0-dev.54

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 (267) hide show
  1. package/lib/cjs/AliCloudStorageService.d.ts +23 -23
  2. package/lib/cjs/AliCloudStorageService.js +71 -71
  3. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  4. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  5. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  6. package/lib/cjs/BackendHubAccess.js +41 -41
  7. package/lib/cjs/BackendHubAccess.js.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.d.ts +90 -91
  9. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  10. package/lib/cjs/BackendLoggerCategory.js +98 -99
  11. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  13. package/lib/cjs/BisCoreSchema.js +60 -60
  14. package/lib/cjs/BisCoreSchema.js.map +1 -1
  15. package/lib/cjs/BriefcaseManager.d.ts +170 -170
  16. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  17. package/lib/cjs/BriefcaseManager.js +408 -408
  18. package/lib/cjs/BriefcaseManager.js.map +1 -1
  19. package/lib/cjs/Category.d.ts +153 -153
  20. package/lib/cjs/Category.js +243 -243
  21. package/lib/cjs/Category.js.map +1 -1
  22. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  23. package/lib/cjs/ChangeSummaryManager.js +446 -446
  24. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  25. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  26. package/lib/cjs/ChangedElementsDb.js +165 -165
  27. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  28. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  29. package/lib/cjs/ChangedElementsManager.js +88 -88
  30. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  31. package/lib/cjs/ChannelControl.d.ts +69 -69
  32. package/lib/cjs/ChannelControl.d.ts.map +1 -1
  33. package/lib/cjs/ChannelControl.js +88 -88
  34. package/lib/cjs/ChannelControl.js.map +1 -1
  35. package/lib/cjs/CheckpointManager.d.ts +121 -121
  36. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  37. package/lib/cjs/CheckpointManager.js +351 -351
  38. package/lib/cjs/CheckpointManager.js.map +1 -1
  39. package/lib/cjs/ClassRegistry.d.ts +79 -79
  40. package/lib/cjs/ClassRegistry.js +254 -249
  41. package/lib/cjs/ClassRegistry.js.map +1 -1
  42. package/lib/cjs/CloudSqlite.d.ts +355 -355
  43. package/lib/cjs/CloudSqlite.js +154 -154
  44. package/lib/cjs/CloudSqlite.js.map +1 -1
  45. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  46. package/lib/cjs/CloudStorageBackend.js +170 -170
  47. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  48. package/lib/cjs/CodeService.d.ts +396 -396
  49. package/lib/cjs/CodeService.js +63 -63
  50. package/lib/cjs/CodeService.js.map +1 -1
  51. package/lib/cjs/CodeSpecs.d.ts +55 -55
  52. package/lib/cjs/CodeSpecs.js +124 -124
  53. package/lib/cjs/CodeSpecs.js.map +1 -1
  54. package/lib/cjs/ConcurrentQuery.d.ts +13 -13
  55. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  56. package/lib/cjs/ConcurrentQuery.js +36 -36
  57. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  58. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  59. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  60. package/lib/cjs/CustomViewState3dCreator.js +82 -81
  61. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  62. package/lib/cjs/DevTools.d.ts +74 -73
  63. package/lib/cjs/DevTools.d.ts.map +1 -1
  64. package/lib/cjs/DevTools.js +156 -156
  65. package/lib/cjs/DevTools.js.map +1 -1
  66. package/lib/cjs/DisplayStyle.d.ts +106 -106
  67. package/lib/cjs/DisplayStyle.js +253 -253
  68. package/lib/cjs/DisplayStyle.js.map +1 -1
  69. package/lib/cjs/ECDb.d.ts +194 -191
  70. package/lib/cjs/ECDb.d.ts.map +1 -1
  71. package/lib/cjs/ECDb.js +353 -348
  72. package/lib/cjs/ECDb.js.map +1 -1
  73. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  74. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -1
  75. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  76. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  77. package/lib/cjs/ECSqlStatement.d.ts +473 -473
  78. package/lib/cjs/ECSqlStatement.js +791 -791
  79. package/lib/cjs/ECSqlStatement.js.map +1 -1
  80. package/lib/cjs/Element.d.ts +1113 -1113
  81. package/lib/cjs/Element.js +1424 -1424
  82. package/lib/cjs/Element.js.map +1 -1
  83. package/lib/cjs/ElementAspect.d.ts +176 -176
  84. package/lib/cjs/ElementAspect.js +203 -203
  85. package/lib/cjs/ElementAspect.js.map +1 -1
  86. package/lib/cjs/ElementGraphics.d.ts +9 -9
  87. package/lib/cjs/ElementGraphics.js +41 -41
  88. package/lib/cjs/ElementGraphics.js.map +1 -1
  89. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  90. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  91. package/lib/cjs/ElementTreeWalker.js +409 -409
  92. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  93. package/lib/cjs/Entity.d.ts +106 -106
  94. package/lib/cjs/Entity.d.ts.map +1 -1
  95. package/lib/cjs/Entity.js +134 -134
  96. package/lib/cjs/Entity.js.map +1 -1
  97. package/lib/cjs/EntityReferences.d.ts +49 -49
  98. package/lib/cjs/EntityReferences.d.ts.map +1 -1
  99. package/lib/cjs/EntityReferences.js +95 -95
  100. package/lib/cjs/EntityReferences.js.map +1 -1
  101. package/lib/cjs/ExportGraphics.d.ts +317 -317
  102. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  103. package/lib/cjs/ExportGraphics.js +208 -208
  104. package/lib/cjs/ExportGraphics.js.map +1 -1
  105. package/lib/cjs/ExternalSource.d.ts +96 -96
  106. package/lib/cjs/ExternalSource.js +131 -131
  107. package/lib/cjs/ExternalSource.js.map +1 -1
  108. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  109. package/lib/cjs/GeoCoordConfig.js +85 -85
  110. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  111. package/lib/cjs/GeometrySummary.d.ts +4 -4
  112. package/lib/cjs/GeometrySummary.js +380 -380
  113. package/lib/cjs/GeometrySummary.js.map +1 -1
  114. package/lib/cjs/HubMock.d.ts +94 -94
  115. package/lib/cjs/HubMock.js +220 -220
  116. package/lib/cjs/HubMock.js.map +1 -1
  117. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  118. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  119. package/lib/cjs/IModelCloneContext.js +15 -15
  120. package/lib/cjs/IModelCloneContext.js.map +1 -1
  121. package/lib/cjs/IModelDb.d.ts +1216 -1213
  122. package/lib/cjs/IModelDb.d.ts.map +1 -1
  123. package/lib/cjs/IModelDb.js +2387 -2380
  124. package/lib/cjs/IModelDb.js.map +1 -1
  125. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  126. package/lib/cjs/IModelElementCloneContext.js +159 -159
  127. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  128. package/lib/cjs/IModelHost.d.ts +369 -369
  129. package/lib/cjs/IModelHost.js +488 -488
  130. package/lib/cjs/IModelHost.js.map +1 -1
  131. package/lib/cjs/IModelJsFs.d.ts +62 -62
  132. package/lib/cjs/IModelJsFs.js +139 -139
  133. package/lib/cjs/IModelJsFs.js.map +1 -1
  134. package/lib/cjs/IpcHost.d.ts +104 -104
  135. package/lib/cjs/IpcHost.js +276 -276
  136. package/lib/cjs/IpcHost.js.map +1 -1
  137. package/lib/cjs/LineStyle.d.ts +311 -311
  138. package/lib/cjs/LineStyle.js +295 -295
  139. package/lib/cjs/LineStyle.js.map +1 -1
  140. package/lib/cjs/LocalHub.d.ts +162 -162
  141. package/lib/cjs/LocalHub.d.ts.map +1 -1
  142. package/lib/cjs/LocalHub.js +580 -580
  143. package/lib/cjs/LocalHub.js.map +1 -1
  144. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  145. package/lib/cjs/LocalhostIpcHost.js +79 -79
  146. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  147. package/lib/cjs/Material.d.ts +131 -131
  148. package/lib/cjs/Material.js +180 -180
  149. package/lib/cjs/Material.js.map +1 -1
  150. package/lib/cjs/Model.d.ts +392 -392
  151. package/lib/cjs/Model.js +489 -489
  152. package/lib/cjs/Model.js.map +1 -1
  153. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  154. package/lib/cjs/NativeAppStorage.js +202 -202
  155. package/lib/cjs/NativeAppStorage.js.map +1 -1
  156. package/lib/cjs/NativeHost.d.ts +52 -52
  157. package/lib/cjs/NativeHost.js +160 -160
  158. package/lib/cjs/NativeHost.js.map +1 -1
  159. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  160. package/lib/cjs/NavigationRelationship.js +225 -225
  161. package/lib/cjs/NavigationRelationship.js.map +1 -1
  162. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  163. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  164. package/lib/cjs/PromiseMemoizer.js +101 -101
  165. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  166. package/lib/cjs/PropertyStore.d.ts +132 -132
  167. package/lib/cjs/PropertyStore.js +11 -11
  168. package/lib/cjs/PropertyStore.js.map +1 -1
  169. package/lib/cjs/Relationship.d.ts +416 -416
  170. package/lib/cjs/Relationship.js +494 -494
  171. package/lib/cjs/Relationship.js.map +1 -1
  172. package/lib/cjs/RpcBackend.d.ts +5 -5
  173. package/lib/cjs/RpcBackend.js +32 -32
  174. package/lib/cjs/RpcBackend.js.map +1 -1
  175. package/lib/cjs/SQLiteDb.d.ts +219 -219
  176. package/lib/cjs/SQLiteDb.js +212 -212
  177. package/lib/cjs/SQLiteDb.js.map +1 -1
  178. package/lib/cjs/Schema.d.ts +55 -55
  179. package/lib/cjs/Schema.js +83 -83
  180. package/lib/cjs/Schema.js.map +1 -1
  181. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  182. package/lib/cjs/ServerBasedLocks.js +168 -168
  183. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  184. package/lib/cjs/SqliteStatement.d.ts +360 -360
  185. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  186. package/lib/cjs/SqliteStatement.js +586 -586
  187. package/lib/cjs/SqliteStatement.js.map +1 -1
  188. package/lib/cjs/Texture.d.ts +58 -58
  189. package/lib/cjs/Texture.js +82 -82
  190. package/lib/cjs/Texture.js.map +1 -1
  191. package/lib/cjs/TileStorage.d.ts +18 -18
  192. package/lib/cjs/TileStorage.js +87 -87
  193. package/lib/cjs/TileStorage.js.map +1 -1
  194. package/lib/cjs/TxnManager.d.ts +202 -202
  195. package/lib/cjs/TxnManager.d.ts.map +1 -1
  196. package/lib/cjs/TxnManager.js +356 -356
  197. package/lib/cjs/TxnManager.js.map +1 -1
  198. package/lib/cjs/ViewDefinition.d.ts +435 -435
  199. package/lib/cjs/ViewDefinition.js +646 -646
  200. package/lib/cjs/ViewDefinition.js.map +1 -1
  201. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  202. package/lib/cjs/ViewStateHydrator.js +103 -103
  203. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  204. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  205. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  206. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  207. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  208. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  209. package/lib/cjs/core-backend.d.ts +185 -185
  210. package/lib/cjs/core-backend.js +209 -205
  211. package/lib/cjs/core-backend.js.map +1 -1
  212. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  213. package/lib/cjs/domains/FunctionalElements.js +145 -145
  214. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  215. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  216. package/lib/cjs/domains/FunctionalSchema.js +39 -39
  217. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  218. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  219. package/lib/cjs/domains/GenericElements.js +263 -263
  220. package/lib/cjs/domains/GenericElements.js.map +1 -1
  221. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  222. package/lib/cjs/domains/GenericSchema.js +28 -28
  223. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  224. package/lib/cjs/rpc/multipart.d.ts +11 -11
  225. package/lib/cjs/rpc/multipart.js +71 -71
  226. package/lib/cjs/rpc/multipart.js.map +1 -1
  227. package/lib/cjs/rpc/tracing.d.ts +28 -28
  228. package/lib/cjs/rpc/tracing.js +73 -73
  229. package/lib/cjs/rpc/tracing.js.map +1 -1
  230. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  231. package/lib/cjs/rpc/web/logging.js +43 -43
  232. package/lib/cjs/rpc/web/logging.js.map +1 -1
  233. package/lib/cjs/rpc/web/request.d.ts +6 -6
  234. package/lib/cjs/rpc/web/request.js +73 -73
  235. package/lib/cjs/rpc/web/request.js.map +1 -1
  236. package/lib/cjs/rpc/web/response.d.ts +6 -6
  237. package/lib/cjs/rpc/web/response.js +105 -105
  238. package/lib/cjs/rpc/web/response.js.map +1 -1
  239. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  240. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  241. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  242. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  243. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +293 -293
  244. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  245. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  246. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  247. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  248. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  249. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +166 -166
  250. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  251. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  252. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +42 -42
  253. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  254. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  255. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  256. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  257. package/lib/cjs/workspace/Settings.d.ts +186 -186
  258. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  259. package/lib/cjs/workspace/Settings.js +154 -154
  260. package/lib/cjs/workspace/Settings.js.map +1 -1
  261. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  262. package/lib/cjs/workspace/SettingsSchemas.js +190 -190
  263. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  264. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  265. package/lib/cjs/workspace/Workspace.js +537 -537
  266. package/lib/cjs/workspace/Workspace.js.map +1 -1
  267. 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,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,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACvB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,gCAAkB,CAAC,MAAM,EAAE,CAAC;QAC1C,MAAM,IAAI,GAA4D,EAAE,CAAC;QAEzE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAqB,EAAE,EAAE;YACxC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAsB,EAAE,EAAE;gBACzC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;oBAC3B,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;iBACnC;qBAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;wBACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;qBAC3C;oBAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC;oBACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,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":["/*---------------------------------------------------------------------------------------------\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":"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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/* 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,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
- /* 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
- return core_bentley_1.Tracing.withSpan(activity.rpcMethod ?? "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
+ /* 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
+ return core_bentley_1.Tracing.withSpan(activity.rpcMethod ?? "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
+ RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
52
+ exports.RpcTrace = RpcTrace;
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,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,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,QAAQ,CAAC,SAAS,IAAI,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/* 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,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,QAAQ,CAAC,SAAS,IAAI,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;;AA5Bc,iBAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;AADvC,4BAAQ;AAgCrB,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/* 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