@itwin/core-backend 5.5.0-dev.2 → 5.5.0-dev.5

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 (398) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/lib/cjs/BackendHubAccess.js.map +1 -1
  3. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  4. package/lib/cjs/BisCoreSchema.js.map +1 -1
  5. package/lib/cjs/BlobContainerService.js.map +1 -1
  6. package/lib/cjs/BriefcaseManager.js.map +1 -1
  7. package/lib/cjs/CatalogDb.js.map +1 -1
  8. package/lib/cjs/Category.js.map +1 -1
  9. package/lib/cjs/ChangeSummaryManager.js +2 -2
  10. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  11. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  12. package/lib/cjs/ChangesetECAdaptor.js +248 -248
  13. package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
  14. package/lib/cjs/ChannelControl.js.map +1 -1
  15. package/lib/cjs/CheckpointManager.js.map +1 -1
  16. package/lib/cjs/ClassRegistry.js +5 -5
  17. package/lib/cjs/ClassRegistry.js.map +1 -1
  18. package/lib/cjs/CloudSqlite.js.map +1 -1
  19. package/lib/cjs/CodeService.js.map +1 -1
  20. package/lib/cjs/CodeSpecs.js.map +1 -1
  21. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  22. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  23. package/lib/cjs/DevTools.js.map +1 -1
  24. package/lib/cjs/DisplayStyle.js.map +1 -1
  25. package/lib/cjs/ECDb.js.map +1 -1
  26. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  27. package/lib/cjs/ECSqlStatement.js.map +1 -1
  28. package/lib/cjs/Element.js.map +1 -1
  29. package/lib/cjs/ElementAspect.js.map +1 -1
  30. package/lib/cjs/ElementGraphics.js.map +1 -1
  31. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  32. package/lib/cjs/Entity.js.map +1 -1
  33. package/lib/cjs/EntityReferences.js.map +1 -1
  34. package/lib/cjs/ExportGraphics.js.map +1 -1
  35. package/lib/cjs/ExternalSource.js.map +1 -1
  36. package/lib/cjs/FontFile.js.map +1 -1
  37. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  38. package/lib/cjs/GeographicCRSServices.js.map +1 -1
  39. package/lib/cjs/GeometrySummary.js +47 -47
  40. package/lib/cjs/GeometrySummary.js.map +1 -1
  41. package/lib/cjs/IModelDb.js +8 -8
  42. package/lib/cjs/IModelDb.js.map +1 -1
  43. package/lib/cjs/IModelDbFonts.js.map +1 -1
  44. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  45. package/lib/cjs/IModelHost.js.map +1 -1
  46. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  47. package/lib/cjs/IModelJsFs.js.map +1 -1
  48. package/lib/cjs/ImageSourceConversion.js.map +1 -1
  49. package/lib/cjs/IpcHost.js.map +1 -1
  50. package/lib/cjs/LineStyle.js.map +1 -1
  51. package/lib/cjs/LocalHub.js +1 -1
  52. package/lib/cjs/LocalHub.js.map +1 -1
  53. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  54. package/lib/cjs/LockControl.js.map +1 -1
  55. package/lib/cjs/Material.js.map +1 -1
  56. package/lib/cjs/Model.js.map +1 -1
  57. package/lib/cjs/NativeAppStorage.js.map +1 -1
  58. package/lib/cjs/NativeHost.js.map +1 -1
  59. package/lib/cjs/NavigationRelationship.js.map +1 -1
  60. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  61. package/lib/cjs/PropertyStore.js.map +1 -1
  62. package/lib/cjs/Relationship.js.map +1 -1
  63. package/lib/cjs/RpcBackend.js.map +1 -1
  64. package/lib/cjs/SQLiteDb.js.map +1 -1
  65. package/lib/cjs/Schema.js.map +1 -1
  66. package/lib/cjs/SchemaSync.js.map +1 -1
  67. package/lib/cjs/SchemaUtils.js.map +1 -1
  68. package/lib/cjs/SheetIndex.js.map +1 -1
  69. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  70. package/lib/cjs/SqliteStatement.js.map +1 -1
  71. package/lib/cjs/StashManager.js.map +1 -1
  72. package/lib/cjs/Texture.js.map +1 -1
  73. package/lib/cjs/TileStorage.js.map +1 -1
  74. package/lib/cjs/TxnManager.js.map +1 -1
  75. package/lib/cjs/ViewDefinition.js.map +1 -1
  76. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  77. package/lib/cjs/ViewStore.js.map +1 -1
  78. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  79. package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
  80. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  81. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  82. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  83. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  84. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  85. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  86. package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
  87. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
  88. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
  89. package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
  90. package/lib/cjs/core-backend.js.map +1 -1
  91. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  92. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  93. package/lib/cjs/domains/GenericElements.js.map +1 -1
  94. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  95. package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
  96. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  97. package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
  98. package/lib/cjs/internal/FontFileImpl.js.map +1 -1
  99. package/lib/cjs/internal/HubMock.js.map +1 -1
  100. package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
  101. package/lib/cjs/internal/NativePlatform.js.map +1 -1
  102. package/lib/cjs/internal/NoLocks.js.map +1 -1
  103. package/lib/cjs/internal/OnlineStatus.js.map +1 -1
  104. package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
  105. package/lib/cjs/internal/Symbols.js.map +1 -1
  106. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  107. package/lib/cjs/internal/cross-package.js.map +1 -1
  108. package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
  109. package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  110. package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
  111. package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  112. package/lib/cjs/rpc/multipart.js.map +1 -1
  113. package/lib/cjs/rpc/tracing.js.map +1 -1
  114. package/lib/cjs/rpc/web/logging.js.map +1 -1
  115. package/lib/cjs/rpc/web/request.js.map +1 -1
  116. package/lib/cjs/rpc/web/response.js.map +1 -1
  117. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  118. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  119. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  120. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  121. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  122. package/lib/cjs/workspace/Settings.js.map +1 -1
  123. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  124. package/lib/cjs/workspace/Workspace.js.map +1 -1
  125. package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
  126. package/lib/esm/BackendHubAccess.js.map +1 -1
  127. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  128. package/lib/esm/BisCoreSchema.js.map +1 -1
  129. package/lib/esm/BlobContainerService.js.map +1 -1
  130. package/lib/esm/BriefcaseManager.js.map +1 -1
  131. package/lib/esm/CatalogDb.js.map +1 -1
  132. package/lib/esm/Category.js.map +1 -1
  133. package/lib/esm/ChangeSummaryManager.js +2 -2
  134. package/lib/esm/ChangeSummaryManager.js.map +1 -1
  135. package/lib/esm/ChangedElementsDb.js.map +1 -1
  136. package/lib/esm/ChangesetECAdaptor.js +248 -248
  137. package/lib/esm/ChangesetECAdaptor.js.map +1 -1
  138. package/lib/esm/ChannelControl.js.map +1 -1
  139. package/lib/esm/CheckpointManager.js.map +1 -1
  140. package/lib/esm/ClassRegistry.js +5 -5
  141. package/lib/esm/ClassRegistry.js.map +1 -1
  142. package/lib/esm/CloudSqlite.js.map +1 -1
  143. package/lib/esm/CodeService.js.map +1 -1
  144. package/lib/esm/CodeSpecs.js.map +1 -1
  145. package/lib/esm/ConcurrentQuery.js.map +1 -1
  146. package/lib/esm/CustomViewState3dCreator.js.map +1 -1
  147. package/lib/esm/DevTools.js.map +1 -1
  148. package/lib/esm/DisplayStyle.js.map +1 -1
  149. package/lib/esm/ECDb.js.map +1 -1
  150. package/lib/esm/ECSchemaXmlContext.js.map +1 -1
  151. package/lib/esm/ECSqlStatement.js.map +1 -1
  152. package/lib/esm/Element.js.map +1 -1
  153. package/lib/esm/ElementAspect.js.map +1 -1
  154. package/lib/esm/ElementGraphics.js.map +1 -1
  155. package/lib/esm/ElementTreeWalker.js.map +1 -1
  156. package/lib/esm/Entity.js.map +1 -1
  157. package/lib/esm/EntityReferences.js.map +1 -1
  158. package/lib/esm/ExportGraphics.js.map +1 -1
  159. package/lib/esm/ExternalSource.js.map +1 -1
  160. package/lib/esm/FontFile.js.map +1 -1
  161. package/lib/esm/GeoCoordConfig.js.map +1 -1
  162. package/lib/esm/GeographicCRSServices.js.map +1 -1
  163. package/lib/esm/GeometrySummary.js +47 -47
  164. package/lib/esm/GeometrySummary.js.map +1 -1
  165. package/lib/esm/IModelDb.js +8 -8
  166. package/lib/esm/IModelDb.js.map +1 -1
  167. package/lib/esm/IModelDbFonts.js.map +1 -1
  168. package/lib/esm/IModelElementCloneContext.js.map +1 -1
  169. package/lib/esm/IModelHost.js.map +1 -1
  170. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  171. package/lib/esm/IModelJsFs.js.map +1 -1
  172. package/lib/esm/ImageSourceConversion.js.map +1 -1
  173. package/lib/esm/IpcHost.js.map +1 -1
  174. package/lib/esm/LineStyle.js.map +1 -1
  175. package/lib/esm/LocalHub.js +1 -1
  176. package/lib/esm/LocalHub.js.map +1 -1
  177. package/lib/esm/LocalhostIpcHost.js.map +1 -1
  178. package/lib/esm/LockControl.js.map +1 -1
  179. package/lib/esm/Material.js.map +1 -1
  180. package/lib/esm/Model.js.map +1 -1
  181. package/lib/esm/NativeAppStorage.js.map +1 -1
  182. package/lib/esm/NativeHost.js.map +1 -1
  183. package/lib/esm/NavigationRelationship.js.map +1 -1
  184. package/lib/esm/PromiseMemoizer.js.map +1 -1
  185. package/lib/esm/PropertyStore.js.map +1 -1
  186. package/lib/esm/Relationship.js.map +1 -1
  187. package/lib/esm/RpcBackend.js.map +1 -1
  188. package/lib/esm/SQLiteDb.js.map +1 -1
  189. package/lib/esm/Schema.js.map +1 -1
  190. package/lib/esm/SchemaSync.js.map +1 -1
  191. package/lib/esm/SchemaUtils.js.map +1 -1
  192. package/lib/esm/SheetIndex.js.map +1 -1
  193. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  194. package/lib/esm/SqliteStatement.js.map +1 -1
  195. package/lib/esm/StashManager.js.map +1 -1
  196. package/lib/esm/Texture.js.map +1 -1
  197. package/lib/esm/TileStorage.js.map +1 -1
  198. package/lib/esm/TxnManager.js.map +1 -1
  199. package/lib/esm/ViewDefinition.js.map +1 -1
  200. package/lib/esm/ViewStateHydrator.js.map +1 -1
  201. package/lib/esm/ViewStore.js.map +1 -1
  202. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  203. package/lib/esm/annotations/FrameGeometry.js.map +1 -1
  204. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  205. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  206. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  207. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  208. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  209. package/lib/esm/core-backend.js.map +1 -1
  210. package/lib/esm/domains/FunctionalElements.js.map +1 -1
  211. package/lib/esm/domains/FunctionalSchema.js.map +1 -1
  212. package/lib/esm/domains/GenericElements.js.map +1 -1
  213. package/lib/esm/domains/GenericSchema.js.map +1 -1
  214. package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
  215. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  216. package/lib/esm/internal/ElementLRUCache.js.map +1 -1
  217. package/lib/esm/internal/FontFileImpl.js.map +1 -1
  218. package/lib/esm/internal/HubMock.js.map +1 -1
  219. package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
  220. package/lib/esm/internal/NativePlatform.js.map +1 -1
  221. package/lib/esm/internal/NoLocks.js.map +1 -1
  222. package/lib/esm/internal/OnlineStatus.js.map +1 -1
  223. package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
  224. package/lib/esm/internal/Symbols.js.map +1 -1
  225. package/lib/esm/internal/annotations/fields.js.map +1 -1
  226. package/lib/esm/internal/cross-package.js.map +1 -1
  227. package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
  228. package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
  229. package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
  230. package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
  231. package/lib/esm/rpc/multipart.js.map +1 -1
  232. package/lib/esm/rpc/tracing.js.map +1 -1
  233. package/lib/esm/rpc/web/logging.js.map +1 -1
  234. package/lib/esm/rpc/web/request.js.map +1 -1
  235. package/lib/esm/rpc/web/response.js.map +1 -1
  236. package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  237. package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  238. package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  239. package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  240. package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  241. package/lib/esm/test/AdvancedEqual.js.map +1 -1
  242. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  243. package/lib/esm/test/AttachDb.test.js +11 -11
  244. package/lib/esm/test/AttachDb.test.js.map +1 -1
  245. package/lib/esm/test/ElementDrivesElement.test.js +23 -23
  246. package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
  247. package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
  248. package/lib/esm/test/GeometryTestUtil.js.map +1 -1
  249. package/lib/esm/test/IModelHost.test.js.map +1 -1
  250. package/lib/esm/test/IModelTestUtils.js.map +1 -1
  251. package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
  252. package/lib/esm/test/IpcHost.test.js.map +1 -1
  253. package/lib/esm/test/KnownTestLocations.js.map +1 -1
  254. package/lib/esm/test/PrintElementTree.js.map +1 -1
  255. package/lib/esm/test/PropertyDb.test.js.map +1 -1
  256. package/lib/esm/test/RevisionUtility.js.map +1 -1
  257. package/lib/esm/test/SchemaUtils.test.js +25 -25
  258. package/lib/esm/test/SchemaUtils.test.js.map +1 -1
  259. package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
  260. package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
  261. package/lib/esm/test/TestUtils.js.map +1 -1
  262. package/lib/esm/test/annotations/Fields.test.js +53 -53
  263. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  264. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  265. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  266. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  267. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  268. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
  269. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +5 -5
  270. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  271. package/lib/esm/test/categories/Category.test.js.map +1 -1
  272. package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
  273. package/lib/esm/test/ecdb/CTE.test.js +88 -88
  274. package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
  275. package/lib/esm/test/ecdb/ConcurrentQuery.test.js +15 -15
  276. package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
  277. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
  278. package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
  279. package/lib/esm/test/ecdb/ECDb.test.js +72 -72
  280. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  281. package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
  282. package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
  283. package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
  284. package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
  285. package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
  286. package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
  287. package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
  288. package/lib/esm/test/ecdb/ECSqlStatement.test.js +332 -332
  289. package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
  290. package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
  291. package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
  292. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +21 -21
  293. package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
  294. package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
  295. package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
  296. package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
  297. package/lib/esm/test/element/ElementAspect.test.js +22 -22
  298. package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
  299. package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
  300. package/lib/esm/test/element/ElementRoundTrip.test.js +139 -139
  301. package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
  302. package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
  303. package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
  304. package/lib/esm/test/element/NullStructArray.test.js +13 -13
  305. package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
  306. package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
  307. package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
  308. package/lib/esm/test/element/UrlLink.test.js.map +1 -1
  309. package/lib/esm/test/font/FontFile.test.js.map +1 -1
  310. package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
  311. package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
  312. package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
  313. package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
  314. package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
  315. package/lib/esm/test/hubaccess/Rebase.test.js +40 -40
  316. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
  317. package/lib/esm/test/imageData.js.map +1 -1
  318. package/lib/esm/test/imodel/Code.test.js.map +1 -1
  319. package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
  320. package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
  321. package/lib/esm/test/imodel/IModel.test.js +44 -44
  322. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  323. package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
  324. package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
  325. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +432 -198
  326. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  327. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +272 -190
  328. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  329. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts +27 -0
  330. package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -0
  331. package/lib/esm/test/incrementalSchemaLocater/TestContext.js +136 -0
  332. package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -0
  333. package/lib/esm/test/index.js.map +1 -1
  334. package/lib/esm/test/misc/DevTools.test.js.map +1 -1
  335. package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
  336. package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
  337. package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
  338. package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
  339. package/lib/esm/test/rpc/response.test.js.map +1 -1
  340. package/lib/esm/test/schema/ClassRegistry.test.js +99 -99
  341. package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
  342. package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
  343. package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
  344. package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
  345. package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
  346. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  347. package/lib/esm/test/standalone/ChangesetReader.test.js +346 -127
  348. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  349. package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
  350. package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
  351. package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
  352. package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
  353. package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
  354. package/lib/esm/test/standalone/ExportGraphics.test.js +14 -14
  355. package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
  356. package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
  357. package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
  358. package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
  359. package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
  360. package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
  361. package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
  362. package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
  363. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  364. package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
  365. package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
  366. package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
  367. package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
  368. package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
  369. package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
  370. package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
  371. package/lib/esm/test/standalone/Setting.test.js.map +1 -1
  372. package/lib/esm/test/standalone/Settings.test.js.map +1 -1
  373. package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
  374. package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
  375. package/lib/esm/test/standalone/Texture.test.js.map +1 -1
  376. package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
  377. package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
  378. package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
  379. package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
  380. package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
  381. package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
  382. package/lib/esm/workspace/Settings.js.map +1 -1
  383. package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
  384. package/lib/esm/workspace/Workspace.js.map +1 -1
  385. package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
  386. package/package.json +14 -14
  387. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +0 -11
  388. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +0 -1
  389. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +0 -36
  390. package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +0 -1
  391. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +0 -20
  392. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +0 -1
  393. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +0 -126
  394. package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +0 -1
  395. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +0 -24
  396. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +0 -1
  397. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +0 -67
  398. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"IModelDbFonts.js","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAGH,gDAA+D","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 iModels\n */\n\nimport { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from \"@itwin/core-common\";\nimport { _implementationProhibited } from \"./internal/Symbols\";\nimport { FontFile } from \"./FontFile\";\n\n/** Arguments supplied to [[IModelDbFonts.embedFontFile]].\n * @beta\n */\nexport interface EmbedFontFileArgs {\n /** The file to embed. */\n file: FontFile;\n /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */\n skipFontIdAllocation?: boolean;\n}\n\n/** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].\n * @beta\n */\nexport interface QueryMappedFamiliesArgs {\n /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */\n includeNonEmbedded?: boolean;\n}\n\n/** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].\n * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.\n * @beta\n */\nexport interface IModelDbFonts {\n /** @internal */\n readonly [_implementationProhibited]: unknown;\n\n /** Obtain the collection of font families that have been assigned a [FontId]($common).\n * By default, font families with no corresponding embedded font faces are omitted.\n */\n queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;\n\n /** Obtain the collection of [[FontFile]]s embedded in the iModel.\n * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open\n */\n queryEmbeddedFontFiles(): Iterable<FontFile>;\n\n /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */\n embedFontFile(args: EmbedFontFileArgs): Promise<void>;\n\n /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.\n * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then\n * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).\n * @see [[acquireId]] to assign an Id.\n * @see [[findDescriptor]] to perform a reverse lookup.\n */\n findId(selector: FontFamilySelector): FontId | undefined;\n\n /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.\n * @see [[findId]] to perform a reverse lookup.\n */\n findDescriptor(id: FontId): FontFamilyDescriptor | undefined;\n\n /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */\n acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;\n}\n"]}
1
+ {"version":3,"file":"IModelDbFonts.js","sourceRoot":"","sources":["../../src/IModelDbFonts.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAGH,gDAA+D","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 iModels\r\n */\r\n\r\nimport { FontFamilyDescriptor, FontFamilySelector, FontId, FontProps } from \"@itwin/core-common\";\r\nimport { _implementationProhibited } from \"./internal/Symbols\";\r\nimport { FontFile } from \"./FontFile\";\r\n\r\n/** Arguments supplied to [[IModelDbFonts.embedFontFile]].\r\n * @beta\r\n */\r\nexport interface EmbedFontFileArgs {\r\n /** The file to embed. */\r\n file: FontFile;\r\n /** Unless true, [[IModelDbFonts.acquireId]] will be used to ensure that every font family in [[file]] is assigned a [FontId]($common). */\r\n skipFontIdAllocation?: boolean;\r\n}\r\n\r\n/** Arguments supplied to [[IModelDbFonts.queryMappedFamilies]].\r\n * @beta\r\n */\r\nexport interface QueryMappedFamiliesArgs {\r\n /** If true, include families that have been assigned a [FontId]($common) but for which no [FontFace]($common)s have been embedded. */\r\n includeNonEmbedded?: boolean;\r\n}\r\n\r\n/** Provides read-write access to the [font-related information]($docs/learning/backend/Fonts.md) stored in an [[IModelDb]].\r\n * @see [[IModelDb.fonts]] to access the fonts for a specific iModel.\r\n * @beta\r\n */\r\nexport interface IModelDbFonts {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** Obtain the collection of font families that have been assigned a [FontId]($common).\r\n * By default, font families with no corresponding embedded font faces are omitted.\r\n */\r\n queryMappedFamilies(args?: QueryMappedFamiliesArgs): Iterable<FontProps>;\r\n\r\n /** Obtain the collection of [[FontFile]]s embedded in the iModel.\r\n * A FontFile obtained from one iModel can be embedded into another iModel using [[embedFontFile]], but the source iModel must remain open\r\n */\r\n queryEmbeddedFontFiles(): Iterable<FontFile>;\r\n\r\n /** Store a [[FontFile]] in the iModel. By default, this method also ensures a [FontId]($common) is assigned to each font family in the file. */\r\n embedFontFile(args: EmbedFontFileArgs): Promise<void>;\r\n\r\n /** Returns the Id assigned to the specified font family, or `undefined` if no Id has been assigned.\r\n * If only a name is supplied instead of a descriptor, and more than one family with the same name but different types exist, then\r\n * [FontType.TrueType]($common) will be preferred over [FontType.Rsc]($common), and [FontType.Rsc]($common) over [FontType.Shx]($common).\r\n * @see [[acquireId]] to assign an Id.\r\n * @see [[findDescriptor]] to perform a reverse lookup.\r\n */\r\n findId(selector: FontFamilySelector): FontId | undefined;\r\n\r\n /** Returns the font family associated with the specified Id, or `undefined` if no such mapping exists.\r\n * @see [[findId]] to perform a reverse lookup.\r\n */\r\n findDescriptor(id: FontId): FontFamilyDescriptor | undefined;\r\n\r\n /** Look up the Id assigned to the specified font family, allocating a new Id if one has not already been assigned. */\r\n acquireId(descriptor: FontFamilyDescriptor): Promise<FontId>;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,8DAAyD;AAEzD,gDAA+C;AAE/C;;GAEG;AACH,MAAa,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;IAErD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAA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,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;gBAC9G,kBAAkB,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAM,CAAC,aAAa,CAAC;YACvD,CAAC;QACH,CAAC;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,mBAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAI,CAAC,OAAO,EAAE,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QAC5E,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AA5KD,8DA4KC","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 iModels\n */\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { SQLiteDb } from \"./SQLiteDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\n\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public async cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): Promise<ElementProps> {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n await jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db[_nativeDb]);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\n }\n}\n"]}
1
+ {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,8DAAyD;AAEzD,gDAA+C;AAE/C;;GAEG;AACH,MAAa,yBAAyB;IACpC,2BAA2B;IACX,QAAQ,CAAW;IACnC,2BAA2B;IACX,QAAQ,CAAW;IACnC,gCAAgC;IACxB,cAAc,CAA+B;IAErD;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,mBAAS,CAAC,CAAC,CAAC;IACpH,CAAC;IAED,0HAA0H;IACnH,KAAK,CAAC,U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CAAC,OAAO,EAAE,CAAC;YACpG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QAC5E,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAS,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AA5KD,8DA4KC","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 iModels\r\n */\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { SubCategory } from \"./Category\";\r\nimport { Element } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { SQLiteDb } from \"./SQLiteDb\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\n\r\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\r\n * @beta\r\n */\r\nexport class IModelElementCloneContext {\r\n /** The source IModelDb. */\r\n public readonly sourceDb: IModelDb;\r\n /** The target IModelDb. */\r\n public readonly targetDb: IModelDb;\r\n /** The native import context */\r\n private _nativeContext: IModelJsNative.ImportContext;\r\n\r\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\r\n * @param sourceDb The source IModelDb.\r\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\r\n */\r\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\r\n this.sourceDb = sourceDb;\r\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\r\n this._nativeContext = new IModelNative.platform.ImportContext(this.sourceDb[_nativeDb], this.targetDb[_nativeDb]);\r\n }\r\n\r\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\r\n public async initialize() {\r\n }\r\n\r\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\r\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\r\n const instance = new this(...args);\r\n await instance.initialize();\r\n return instance;\r\n }\r\n\r\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\r\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\r\n\r\n /** Dispose any native resources associated with this IModelElementCloneContext. */\r\n public [Symbol.dispose](): void { this._nativeContext.dispose(); }\r\n\r\n /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */\r\n public dispose() {\r\n this[Symbol.dispose]();\r\n }\r\n\r\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\r\n * @internal\r\n */\r\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\r\n\r\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\r\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\r\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\r\n * @throws [[IModelError]] if either CodeSpec could not be found.\r\n */\r\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\r\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\r\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\r\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\r\n }\r\n\r\n /** Add a rule that remaps the specified source class to the specified target class. */\r\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\r\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\r\n }\r\n\r\n /** Add a rule that remaps the specified source Element to the specified target Element. */\r\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\r\n this._nativeContext.addElementId(sourceId, targetId);\r\n }\r\n\r\n /** Remove a rule that remaps the specified source Element. */\r\n public removeElement(sourceId: Id64String): void {\r\n this._nativeContext.removeElementId(sourceId);\r\n }\r\n\r\n /** Look up a target CodeSpecId from the source CodeSpecId.\r\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\r\n if (Id64.invalid === sourceId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findCodeSpecId(sourceId);\r\n }\r\n\r\n /** Look up a target ElementId from the source ElementId.\r\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetElementId(sourceElementId: Id64String): Id64String {\r\n if (Id64.invalid === sourceElementId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findElementId(sourceElementId);\r\n }\r\n\r\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\r\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\r\n * @see [SubCategory.isDefaultSubCategory]($backend)\r\n */\r\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\r\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\r\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\r\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\r\n }\r\n }\r\n\r\n /** Returns `true` if there are any SubCategories being filtered. */\r\n public get hasSubCategoryFilter(): boolean {\r\n return this._nativeContext.hasSubCategoryFilter();\r\n }\r\n\r\n /** Returns `true` if this SubCategory is being filtered. */\r\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\r\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\r\n }\r\n\r\n /** Import the specified font from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importFont(sourceFontNumber: number): void {\r\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\r\n this._nativeContext.importFont(sourceFontNumber);\r\n }\r\n\r\n /** Import a single CodeSpec from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\r\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\r\n }\r\n\r\n /** Clone the specified source Element into ElementProps for the target iModel.\r\n * @internal\r\n */\r\n public async cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): Promise<ElementProps> {\r\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\r\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\r\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\r\n (targetElementProps as any)[propertyName] = RelatedElement.none;\r\n }\r\n }, false); // exclude custom because C++ has already handled them\r\n if (this.isBetweenIModels) {\r\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\r\n targetElementProps.federationGuid = sourceElement.federationGuid;\r\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\r\n targetElementProps.code.scope = IModel.rootSubjectId;\r\n }\r\n }\r\n // unlike other references, code cannot be null. If it is null, use an empty code instead\r\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\r\n targetElementProps.code = Code.createEmpty();\r\n }\r\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\r\n // eslint-disable-next-line @typescript-eslint/dot-notation\r\n await jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\r\n return targetElementProps;\r\n }\r\n\r\n /**\r\n * serialize state to a sqlite database at a given path\r\n * assumes the database has not already had any context state serialized to it\r\n * @internal\r\n */\r\n public saveStateToDb(db: SQLiteDb): void {\r\n this._nativeContext.saveStateToDb(db[_nativeDb]);\r\n }\r\n\r\n /**\r\n * load state from a sqlite database at a given path\r\n * @internal\r\n */\r\n public loadStateFromDb(db: SQLiteDb): void {\r\n this._nativeContext.loadStateFromDb(db[_nativeDb]);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yFAAyF;AACzF,sBAAoB,CAAC,mCAAmC;AAExD,8DAA6E;AAC7E,8BAA8B;AAC9B,8DAAyD;AACzD,sDAA8J;AAC9J,oDAAkG;AAClG,sEAAqH;AACrH,sDAAoF;AAGpF,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAC5C,iEAA8D;AAC9D,2DAAwD;AACxD,qDAAkD;AAClD,6CAA0C;AAC1C,gEAA6D;AAC7D,oEAAiE;AACjE,oEAAiE;AACjE,4EAAyE;AACzE,6CAAoD;AACpD,+CAA4C;AAC5C,mDAA2E;AAG3E,+BAAuD;AACvD,sEAAwF;AACxF,oEAAiE;AACjE,kFAAoF;AACpF,gDAA8E;AAE9E,MAAM,cAAc,GAAG,6CAAqB,CAAC,UAAU,CAAC;AA6KxD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CAAC;IACD;;;OAGG;IACI,kBAAkB,CAAC,UAAkB,IAAwB,OAAO,UAAU,CAAC,CAAC,CAAC;IACxF;;;;OAIG;IACI,eAAe,CAAC,UAAkB;QACvC,MAAM,gBAAgB,GAAuB,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACjF,IAAI,SAAS,KAAK,gBAAgB,EAAE,CAAC;YACnC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,eAAe,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAnCD,4CAmCC","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 IModelHost\n */\n\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\n\nimport { IModelNative, loadNativePlatform } from \"./internal/NativePlatform\";\nimport * as os from \"node:os\";\nimport { NativeLibrary } from \"@bentley/imodeljs-native\";\nimport { AccessToken, assert, BeEvent, BentleyStatus, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\nimport { AuthorizationClient, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\nimport { AzureServerStorage, AzureServerStorageConfig, BlobServiceClientWrapper } from \"@itwin/object-storage-azure\";\nimport { BlobServiceClient, StorageSharedKeyCredential } from \"@azure/storage-blob\";\nimport type { ServerStorage } from \"@itwin/object-storage-core\";\nimport { BackendHubAccess, CreateNewIModelProps } from \"./BackendHubAccess\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { BisCoreSchema } from \"./BisCoreSchema\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\nimport { GenericSchema } from \"./domains/GenericSchema\";\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\nimport { initializeRpcBackend } from \"./RpcBackend\";\nimport { TileStorage } from \"./TileStorage\";\nimport { SettingsContainer, SettingsPriority } from \"./workspace/Settings\";\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\nimport { join, normalize as normalizeDir } from \"path\";\nimport { constructWorkspace, OwnedWorkspace } from \"./internal/workspace/WorkspaceImpl\";\nimport { SettingsImpl } from \"./internal/workspace/SettingsImpl\";\nimport { constructSettingsSchemas } from \"./internal/workspace/SettingsSchemasImpl\";\nimport { _getHubAccess, _hubAccess, _setHubAccess } from \"./internal/Symbols\";\n\nconst loggerCategory = BackendLoggerCategory.IModelHost;\n\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs\n\n/** @internal */\nexport interface CrashReportingConfigNameValuePair {\n name: string;\n value: string;\n}\n\n/** Configuration of the crash-reporting system.\n * @internal\n */\nexport interface CrashReportingConfig {\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\n crashDir: string;\n /** max # .dmp files that may exist in crashDir. The default is 50. */\n maxDumpsInDir?: number;\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\n enableCrashDumps?: boolean;\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\n wantFullMemoryDumps?: boolean;\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\n enableNodeReport?: boolean;\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\n params?: CrashReportingConfigNameValuePair[];\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\n * Since it runs in a separate process, this script will have no access to the Javascript\n * context of the exiting backend. No default.\n */\n dumpProcessorScriptFileName?: string;\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\n uploadToBentley?: boolean;\n}\n\n/** @beta */\nexport interface AzureBlobStorageCredentials {\n account: string;\n accessKey: string;\n baseUrl?: string;\n}\n\n/**\n * Options for [[IModelHost.startup]]\n * @public\n */\nexport interface IModelHostOptions {\n /**\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\n * @see [[IModelHost.profileName]]\n * @beta\n */\n profileName?: string;\n\n /**\n * Root of the directory holding all the files that iTwin.js caches\n * - If not specified at startup a platform specific default is used -\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\n * - if specified, ensure it is set to a folder with read/write access.\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\n */\n cacheDir?: LocalDirName;\n\n /** The directory where application assets are found. */\n appAssetsDir?: LocalDirName;\n\n /**\n * Options for creating the [[IModelHost.appWorkspace]]\n * @beta\n */\n workspace?: WorkspaceOpts;\n\n /**\n * The kind of iModel hub server to use.\n */\n hubAccess?: BackendHubAccess;\n\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\n * @beta\n */\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n\n /**\n * @beta\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\n * set this property with a custom ServerStorage.\n */\n tileCacheStorage?: ServerStorage;\n\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\n * @beta\n */\n maxTileCacheDbSize?: number;\n\n /** Whether to restrict tile cache URLs by client IP address (if available).\n * @beta\n */\n restrictTileUrlsByClientIp?: boolean;\n\n /** Whether to enable OpenTelemetry tracing.\n * Defaults to `false`.\n */\n enableOpenTelemetry?: boolean;\n\n /** Whether to compress cached tiles.\n * Defaults to `true`.\n */\n compressCachedTiles?: boolean;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileTreeRequestTimeout?: number;\n\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\n * @internal\n */\n tileContentRequestTimeout?: number;\n\n /** The backend will log when a tile took longer to load than this threshold in seconds.\n * @internal\n */\n logTileLoadTimeThreshold?: number;\n\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\n * @internal\n */\n logTileSizeThreshold?: number;\n\n /** Crash-reporting configuration\n * @internal\n */\n crashReportingConfig?: CrashReportingConfig;\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n authorizationClient?: AuthorizationClient;\n\n /**\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\n * Will be changed to default to `false` in 5.0.\n */\n allowSharedChannel?: boolean;\n\n /**\n * Setting this to true will revert to the previous behavior of using the native side for all CRUD operations.\n * While set to false, the getElement(), getModel() and getAspect() functions will use a thinned down native workflow to read the entities from the database.\n * This workflow performs work previously done on the native side in the TS side, resulting in performance improvements, if errors are detected,\n * this option can be set to true to revert to old workflow.\n */\n disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n disableRestorePointOnPullMerge?: true;\n /**\n * Configuration controlling whether incremental schema loading is enabled or disabled.\n * @beta\n */\n incrementalSchemaLoading?: \"enabled\" | \"disabled\";\n}\n\n/** Configuration of core-backend.\n * @public\n */\nexport class IModelHostConfiguration implements IModelHostOptions {\n public static defaultTileRequestTimeout = 20 * 1000;\n public static defaultLogTileLoadTimeThreshold = 40;\n public static defaultLogTileSizeThreshold = 20 * 1000000;\n /** @internal */\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\n public appAssetsDir?: LocalDirName;\n public cacheDir?: LocalDirName;\n\n /** @beta */\n public workspace?: WorkspaceOpts;\n public hubAccess?: BackendHubAccess;\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public authorizationClient?: AuthorizationClient;\n /** @beta */\n public restrictTileUrlsByClientIp?: boolean;\n public compressCachedTiles?: boolean;\n /** @beta */\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\n /** @internal */\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\n /** @internal */\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n /** @internal */\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\n /** @internal */\n public crashReportingConfig?: CrashReportingConfig;\n /**\n * Configuration controlling whether to use the thinned down native instance functions for element, model, and aspect CRUD operations\n * or use the previous behavior of using the native side for all CRUD operations. Set to true to revert to the previous behavior.\n * @beta\n */\n public disableThinnedNativeInstanceWorkflow?: boolean;\n\n /**\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\n * @beta\n */\n public disableRestorePointOnPullMerge?: true;\n /**\n * Configuration controlling whether incremental schema loading is disabled.\n * Default is \"disabled\" at the moment to preserve existing behavior.\n * @beta\n */\n public incrementalSchemaLoading: \"enabled\" | \"disabled\" = \"disabled\";\n}\n\n/**\n * Settings for `IModelHost.appWorkspace`.\n * @note this includes the default dictionary from the SettingsSpecRegistry\n */\nclass ApplicationSettings extends SettingsImpl {\n private _remove?: VoidFunction;\n protected override verifyPriority(priority: SettingsPriority) {\n if (priority > SettingsPriority.application) // only application or lower may appear in ApplicationSettings\n throw new Error(\"Use IModelSettings\");\n }\n private updateDefaults() {\n const defaults: SettingsContainer = {};\n for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {\n if (val.default)\n defaults[schemaName] = val.default;\n }\n this.addDictionary({ name: \"_default_\", priority: 0 }, defaults);\n }\n\n public constructor() {\n super();\n this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\n this.updateDefaults();\n }\n\n public override close() {\n if (this._remove) {\n this._remove();\n this._remove = undefined;\n }\n }\n}\n\nconst definedInStartup = <T>(obj: T | undefined): T => {\n if (obj === undefined)\n throw new Error(\"IModelHost.startup must be called first\");\n return obj;\n};\n\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\n * See [the learning article]($docs/learning/backend/IModelHost.md)\n * @public\n */\nexport class IModelHost {\n private constructor() { }\n\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\n public static authorizationClient?: AuthorizationClient;\n\n public static backendVersion = \"\";\n private static _profileName: string;\n private static _cacheDir = \"\";\n private static _settingsSchemas?: SettingsSchemas;\n private static _appWorkspace?: OwnedWorkspace;\n\n // Omit the hubAccess field from configuration so it stays internal.\n public static configuration?: Omit<IModelHostOptions, \"hubAccess\">;\n\n /**\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\n *\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\n * data for a profile is maintained between runs, but each profile is completely independent and\n * unaffected by the presence or use of others.)\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\n * if a second process attempts to use the same profile.\n * @beta\n */\n public static get profileName(): string {\n return this._profileName;\n }\n\n /** The full path of the Profile directory.\n * @see [[profileName]]\n * @beta\n */\n public static get profileDir(): LocalDirName {\n return join(this._cacheDir, \"profiles\", this._profileName);\n }\n\n /** Event raised during startup to allow loading settings data */\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\n\n /** Event raised just after the backend IModelHost was started */\n public static readonly onAfterStartup = new BeEvent<() => void>();\n\n /** Event raised just before the backend IModelHost is to be shut down */\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\n\n /** @internal */\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\n\n /** A uniqueId for this session */\n public static get sessionId() { return this.session.sessionId; }\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\n\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\n public static get applicationId() { return this.session.applicationId; }\n public static set applicationId(id: string) { this.session.applicationId = id; }\n\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\n public static get applicationVersion() { return this.session.applicationVersion; }\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\n\n /** A string that can identify the current user to other users when collaborating. */\n public static userMoniker = \"unknown\";\n\n /** Root directory holding files that iTwin.js caches */\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\n\n /** The application [[Workspace]] for this `IModelHost`\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\n * attempting to add them to this Workspace will fail.\n * @beta\n */\n public static get appWorkspace(): Workspace { return definedInStartup(this._appWorkspace); }\n\n /** The registry of schemas describing the [[Setting]]s for the application session.\n * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].\n * @beta\n */\n public static get settingsSchemas(): SettingsSchemas { return definedInStartup(this._settingsSchemas); }\n\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels.\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\n public static snapshotFileNameResolver?: FileNameResolver; // eslint-disable-line @typescript-eslint/no-deprecated\n\n /** Get the current access token for this IModelHost, or a blank string if none is available.\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\n * obtains the token and forwards it to the frontend.\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\n * returned by this method may change over time throughout the course of a session.\n */\n public static async getAccessToken(): Promise<AccessToken> {\n try {\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\n } catch {\n return \"\";\n }\n }\n\n private static loadNative(options: IModelHostOptions) {\n loadNativePlatform();\n\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\n IModelNative.platform.setCrashReporting(options.crashReportingConfig);\n\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\n });\n\n if (options.crashReportingConfig.enableNodeReport) {\n if (process.report !== undefined) {\n process.report.reportOnFatalError = true;\n process.report.reportOnUncaughtException = true;\n process.report.directory = options.crashReportingConfig.crashDir;\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\n } else {\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\n }\n }\n }\n }\n\n /** @internal */\n public static tileStorage?: TileStorage;\n\n private static _hubAccess?: BackendHubAccess;\n /** @internal */\n public static [_setHubAccess](hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\n\n /** get the current hubAccess, if present.\n * @internal\n */\n public static [_getHubAccess](): BackendHubAccess | undefined { return this._hubAccess; }\n\n /** Provides access to the IModelHub for this IModelHost\n * @internal\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\n * To determine whether one is present, use [[_getHubAccess]].\n */\n public static get [_hubAccess](): BackendHubAccess {\n if (IModelHost._hubAccess === undefined)\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\n return IModelHost._hubAccess;\n }\n\n private static initializeWorkspace(configuration: IModelHostOptions) {\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\n this._settingsSchemas = constructSettingsSchemas();\n this._settingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\n this._appWorkspace = constructWorkspace(new ApplicationSettings(), configuration.workspace);\n\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\n try {\n this.appWorkspace.getCloudCache();\n } catch (e: any) {\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\n }\n\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\n\n GeoCoordConfig.onStartup();\n // allow applications to load their default settings\n this.onWorkspaceStartup.raiseEvent();\n }\n\n private static _isValid = false;\n\n /** true between a successful call to [[startup]] and before [[shutdown]] */\n public static get isValid() {\n return IModelHost._isValid;\n }\n\n /** This method must be called before any iTwin.js services are used.\n * @param options Host configuration data.\n * Raises [[onAfterStartup]].\n * @see [[shutdown]].\n */\n public static async startup(options?: IModelHostOptions): Promise<void> {\n if (this._isValid)\n return; // we're already initialized\n this._isValid = true;\n\n options = options ?? {};\n if (this.sessionId === \"\")\n this.sessionId = Guid.createValue();\n\n this.authorizationClient = options.authorizationClient;\n\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-require-imports\n initializeRpcBackend(options.enableOpenTelemetry);\n\n this.loadNative(options);\n this.setupCacheDir(options);\n this.initializeWorkspace(options);\n\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\n\n [\n IModelReadRpcImpl,\n IModelTileRpcImpl,\n SnapshotIModelRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated\n DevToolsRpcImpl,\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\n\n [\n BisCoreSchema,\n GenericSchema,\n FunctionalSchema,\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\n\n const { hubAccess, ...otherOptions } = options;\n if (undefined !== hubAccess)\n this._hubAccess = hubAccess;\n\n this.configuration = otherOptions;\n this.setupTileCache();\n\n process.once(\"beforeExit\", IModelHost.shutdown);\n this.onAfterStartup.raiseEvent();\n }\n\n private static setupCacheDir(configuration: IModelHostOptions) {\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\n\n this._profileName = configuration.profileName ?? \"default\";\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\n }\n\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\n public static async shutdown(this: void): Promise<void> {\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\n // ensure `this` is correct. Don't combine these methods.\n return IModelHost.doShutdown();\n }\n\n /**\n * Create a new iModel.\n * @returns the Guid of the newly created iModel.\n * @throws [IModelError]($common) in case of errors.\n * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.\n */\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\n return this[_hubAccess].createNewIModel(arg);\n }\n\n private static async doShutdown() {\n if (!this._isValid)\n return;\n\n this._isValid = false;\n this.onBeforeShutdown.raiseEvent();\n\n this.configuration = undefined;\n this.tileStorage = undefined;\n\n this._appWorkspace?.close();\n this._appWorkspace = undefined;\n this._settingsSchemas = undefined;\n\n CloudSqlite.CloudCaches.destroy();\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\n }\n\n /**\n * Add or update a property that should be included in a crash report.\n * @internal\n */\n public static setCrashReportProperty(name: string, value: string): void {\n IModelNative.platform.setCrashReportProperty(name, value);\n }\n\n /**\n * Remove a previously defined property so that will not be included in a crash report.\n * @internal\n */\n public static removeCrashReportProperty(name: string): void {\n IModelNative.platform.setCrashReportProperty(name, undefined);\n }\n\n /**\n * Get all properties that will be included in a crash report.\n * @internal\n */\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\n return IModelNative.platform.getCrashReportProperties();\n }\n\n /** The directory where application assets may be found */\n public static get appAssetsDir(): string | undefined {\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\n }\n\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileTreeRequestTimeout(): number {\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\n * @internal\n */\n public static get tileContentRequestTimeout(): number {\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\n }\n\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\n public static get logTileLoadTimeThreshold(): number {\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\n }\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\n public static get logTileSizeThreshold(): number {\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\n }\n\n /** Whether external tile caching is active.\n * @internal\n */\n public static get usingExternalTileCache(): boolean {\n return undefined !== IModelHost.tileStorage;\n }\n\n /** Whether to restrict tile cache URLs by client IP address.\n * @internal\n */\n public static get restrictTileUrlsByClientIp(): boolean {\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\n }\n\n /** Whether to compress cached tiles.\n * @internal\n */\n public static get compressCachedTiles(): boolean {\n return false !== IModelHost.configuration?.compressCachedTiles;\n }\n\n private static setupTileCache() {\n assert(undefined !== IModelHost.configuration);\n const config = IModelHost.configuration;\n const storage = config.tileCacheStorage;\n const credentials = config.tileCacheAzureCredentials;\n\n if (!storage && !credentials) {\n IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\n return;\n }\n\n IModelNative.platform.setMaxTileCacheSize(0);\n if (credentials) {\n if (storage)\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\n this.setupAzureTileCache(credentials);\n }\n if (storage)\n IModelHost.tileStorage = new TileStorage(storage);\n }\n\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\n const storageConfig: AzureServerStorageConfig = {\n accountName: credentials.account,\n accountKey: credentials.accessKey,\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\n }\n const blobServiceClient = new BlobServiceClient(\n storageConfig.baseUrl,\n new StorageSharedKeyCredential(storageConfig.accountName, storageConfig.accountKey),\n );\n const azureStorage: ServerStorage = new AzureServerStorage(storageConfig, new BlobServiceClientWrapper(blobServiceClient))\n IModelHost.tileStorage = new TileStorage(azureStorage);\n }\n\n /** @internal */\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\n return IModelNative.platform.computeSchemaChecksum(arg);\n }\n}\n\n/** Information about the platform on which the app is running.\n * @public\n */\nexport class Platform {\n /** Get the name of the platform. */\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\n return process.platform as any;\n }\n}\n\n/** Well known directories that may be used by the application.\n * @public\n */\nexport class KnownLocations {\n\n /** The directory where the imodeljs-native assets are stored. */\n public static get nativeAssetsDir(): LocalDirName {\n return IModelNative.platform.DgnDb.getAssetsDir();\n }\n\n /** The directory where the core-backend assets are stored. */\n public static get packageAssetsDir(): LocalDirName {\n return join(__dirname, \"assets\");\n }\n\n /** The temporary directory. */\n public static get tmpdir(): LocalDirName {\n return os.tmpdir();\n }\n}\n\n/** Extend this class to provide custom file name resolution behavior.\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\n * @see [[IModelHost.snapshotFileNameResolver]]\n * @public\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\n */\nexport abstract class FileNameResolver {\n /** Resolve a file name from the specified key.\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name or `undefined` if not found.\n */\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\n /** Resolve a file name from the specified key.\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\n * @returns The resolved file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveKey(fileKey: string): string {\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\n }\n return resolvedFileName;\n }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name or `undefined` if not found.\n */\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\n /** Resolve the input file name, which may be a partial name, into a full path file name.\n * @param inFileName The partial file name.\n * @returns The resolved full path file name.\n * @throws [[IModelError]] if not found.\n */\n public resolveFileName(inFileName: string): string {\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\n if (undefined === resolvedFileName) {\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\n }\n return resolvedFileName;\n }\n}\n"]}
1
+ {"version":3,"file":"IModelHost.js","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yFAAyF;AACzF,sBAAoB,CAAC,mCAAmC;AAExD,8DAA6E;AAC7E,8BAA8B;AAC9B,8DAAyD;AACzD,sDAA8J;AAC9J,oDAAkG;AAClG,sEAAqH;AACrH,sDAAoF;AAGpF,mEAAgE;AAChE,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAC5C,iEAA8D;AAC9D,2DAAwD;AACxD,qDAAkD;AAClD,6CAA0C;AAC1C,gEAA6D;AAC7D,oEAAiE;AACjE,oEAAiE;AACjE,4EAAyE;AACzE,6CAAoD;AACpD,+CAA4C;AAC5C,mDAA2E;AAG3E,+BAAuD;AACvD,sEAAwF;AACxF,oEAAiE;AACjE,kFAAoF;AACpF,gDAA8E;AAE9E,MAAM,cAAc,GAAG,6CAAqB,CAAC,UAAU,CAAC;AA6KxD;;GAEG;AACH,MAAa,uBAAuB;IAC3B,MAAM,CAAC,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;IAC7C,MAAM,CAAC,+BAA+B,GAAG,EAAE,CAAC;IAC5C,MAAM,CAAC,2BAA2B,GAAG,EAAE,GAAG,OAAO,CAAC;IACzD,gBAAgB;IACT,MAAM,CAAC,yBAAyB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtD,YAAY,CAAgB;IAC5B,QAAQ,CAAgB;IAE/B,YAAY;IACL,SAAS,CAAiB;IAC1B,SAAS,CAAoB;IACpC,uEAAuE;IAChE,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AAnCD,4CAmCC","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 IModelHost\r\n */\r\n\r\n// To avoid circular load errors, the \"Element\" classes must be loaded before IModelHost.\r\nimport \"./IModelDb\"; // DO NOT REMOVE OR MOVE THIS LINE!\r\n\r\nimport { IModelNative, loadNativePlatform } from \"./internal/NativePlatform\";\r\nimport * as os from \"node:os\";\r\nimport { NativeLibrary } from \"@bentley/imodeljs-native\";\r\nimport { AccessToken, assert, BeEvent, BentleyStatus, DbResult, Guid, GuidString, IModelStatus, Logger, Mutable, ProcessDetector } from \"@itwin/core-bentley\";\r\nimport { AuthorizationClient, IModelError, LocalDirName, SessionProps } from \"@itwin/core-common\";\r\nimport { AzureServerStorage, AzureServerStorageConfig, BlobServiceClientWrapper } from \"@itwin/object-storage-azure\";\r\nimport { BlobServiceClient, StorageSharedKeyCredential } from \"@azure/storage-blob\";\r\nimport type { ServerStorage } from \"@itwin/object-storage-core\";\r\nimport { BackendHubAccess, CreateNewIModelProps } from \"./BackendHubAccess\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { BisCoreSchema } from \"./BisCoreSchema\";\r\nimport { BriefcaseManager } from \"./BriefcaseManager\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { FunctionalSchema } from \"./domains/FunctionalSchema\";\r\nimport { GenericSchema } from \"./domains/GenericSchema\";\r\nimport { GeoCoordConfig } from \"./GeoCoordConfig\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { DevToolsRpcImpl } from \"./rpc-impl/DevToolsRpcImpl\";\r\nimport { IModelReadRpcImpl } from \"./rpc-impl/IModelReadRpcImpl\";\r\nimport { IModelTileRpcImpl } from \"./rpc-impl/IModelTileRpcImpl\";\r\nimport { SnapshotIModelRpcImpl } from \"./rpc-impl/SnapshotIModelRpcImpl\";\r\nimport { initializeRpcBackend } from \"./RpcBackend\";\r\nimport { TileStorage } from \"./TileStorage\";\r\nimport { SettingsContainer, SettingsPriority } from \"./workspace/Settings\";\r\nimport { SettingsSchemas } from \"./workspace/SettingsSchemas\";\r\nimport { Workspace, WorkspaceOpts } from \"./workspace/Workspace\";\r\nimport { join, normalize as normalizeDir } from \"path\";\r\nimport { constructWorkspace, OwnedWorkspace } from \"./internal/workspace/WorkspaceImpl\";\r\nimport { SettingsImpl } from \"./internal/workspace/SettingsImpl\";\r\nimport { constructSettingsSchemas } from \"./internal/workspace/SettingsSchemasImpl\";\r\nimport { _getHubAccess, _hubAccess, _setHubAccess } from \"./internal/Symbols\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.IModelHost;\r\n\r\n// cspell:ignore nodereport fatalerror apicall alicloud rpcs\r\n\r\n/** @internal */\r\nexport interface CrashReportingConfigNameValuePair {\r\n name: string;\r\n value: string;\r\n}\r\n\r\n/** Configuration of the crash-reporting system.\r\n * @internal\r\n */\r\nexport interface CrashReportingConfig {\r\n /** The directory to which *.dmp and/or iModelJsNativeCrash*.properties.txt files are written. This directory will be created if it does not already exist. */\r\n crashDir: string;\r\n /** max # .dmp files that may exist in crashDir. The default is 50. */\r\n maxDumpsInDir?: number;\r\n /** Enable crash-dumps? If so, .dmp and .properties.txt files will be generated and written to crashDir in the event of an unhandled native-code exception. If not, only .properties.txt files will be written. The default is false. */\r\n enableCrashDumps?: boolean;\r\n /** If enableCrashDumps is true, do you want a full-memory dump? Defaults to false. */\r\n wantFullMemoryDumps?: boolean;\r\n /** Enable Node.js crash reporting? If so, report files will be generated in the event of an unhandled exception or fatal error and written to crashDir. The default is false. */\r\n enableNodeReport?: boolean;\r\n /** Additional name, value pairs to write to iModelJsNativeCrash*.properties.txt file in the event of a crash. */\r\n params?: CrashReportingConfigNameValuePair[];\r\n /** Run this .js file to process .dmp and Node.js crash reporting .json files in the event of a crash.\r\n * This script will be executed with a single command-line parameter: the name of the dump or Node.js report file.\r\n * In the case of a dump file, there will be a second file with the same basename and the extension \".properties.txt\".\r\n * Since it runs in a separate process, this script will have no access to the Javascript\r\n * context of the exiting backend. No default.\r\n */\r\n dumpProcessorScriptFileName?: string;\r\n /** Upload crash dump and node-reports to Bentley's crash-reporting service? Defaults to false */\r\n uploadToBentley?: boolean;\r\n}\r\n\r\n/** @beta */\r\nexport interface AzureBlobStorageCredentials {\r\n account: string;\r\n accessKey: string;\r\n baseUrl?: string;\r\n}\r\n\r\n/**\r\n * Options for [[IModelHost.startup]]\r\n * @public\r\n */\r\nexport interface IModelHostOptions {\r\n /**\r\n * The name of the *Profile* subdirectory of [[cacheDir]] for this process. If not present, \"default\" is used.\r\n * @see [[IModelHost.profileName]]\r\n * @beta\r\n */\r\n profileName?: string;\r\n\r\n /**\r\n * Root of the directory holding all the files that iTwin.js caches\r\n * - If not specified at startup a platform specific default is used -\r\n * - Windows: $(HOMEDIR)/AppData/Local/iModelJs/\r\n * - Mac/iOS: $(HOMEDIR)/Library/Caches/iModelJs/\r\n * - Linux: $(HOMEDIR)/.cache/iModelJs/\r\n * where $(HOMEDIR) is documented [here](https://nodejs.org/api/os.html#os_os_homedir)\r\n * - if specified, ensure it is set to a folder with read/write access.\r\n * @see [[IModelHost.cacheDir]] for the value it's set to after startup\r\n */\r\n cacheDir?: LocalDirName;\r\n\r\n /** The directory where application assets are found. */\r\n appAssetsDir?: LocalDirName;\r\n\r\n /**\r\n * Options for creating the [[IModelHost.appWorkspace]]\r\n * @beta\r\n */\r\n workspace?: WorkspaceOpts;\r\n\r\n /**\r\n * The kind of iModel hub server to use.\r\n */\r\n hubAccess?: BackendHubAccess;\r\n\r\n /** The Azure blob storage credentials to use for the tile cache service. If omitted and no external service implementation is provided, a local cache will be used.\r\n * @beta\r\n */\r\n tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n\r\n /**\r\n * @beta\r\n * @note A reference implementation is set for AzureServerStorage from @itwin/object-storage-azure if [[tileCacheAzureCredentials]] property is set. To supply a different implementation for any service provider (such as AWS),\r\n * set this property with a custom ServerStorage.\r\n */\r\n tileCacheStorage?: ServerStorage;\r\n\r\n /** The maximum size in bytes to which a local sqlite database used for caching tiles can grow before it is purged of least-recently-used tiles.\r\n * The local cache is used only if an external cache has not been configured via [[tileCacheStorage]], and [[tileCacheAzureCredentials]].\r\n * Defaults to 1 GB. Must be an unsigned integer. A value of zero disables the local cache entirely.\r\n * @beta\r\n */\r\n maxTileCacheDbSize?: number;\r\n\r\n /** Whether to restrict tile cache URLs by client IP address (if available).\r\n * @beta\r\n */\r\n restrictTileUrlsByClientIp?: boolean;\r\n\r\n /** Whether to enable OpenTelemetry tracing.\r\n * Defaults to `false`.\r\n */\r\n enableOpenTelemetry?: boolean;\r\n\r\n /** Whether to compress cached tiles.\r\n * Defaults to `true`.\r\n */\r\n compressCachedTiles?: boolean;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileTreeProps]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileTreeRequestTimeout?: number;\r\n\r\n /** The time, in milliseconds, for which [IModelTileRpcInterface.requestTileContent]($common) should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n tileContentRequestTimeout?: number;\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds.\r\n * @internal\r\n */\r\n logTileLoadTimeThreshold?: number;\r\n\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold.\r\n * @internal\r\n */\r\n logTileSizeThreshold?: number;\r\n\r\n /** Crash-reporting configuration\r\n * @internal\r\n */\r\n crashReportingConfig?: CrashReportingConfig;\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n authorizationClient?: AuthorizationClient;\r\n\r\n /**\r\n * Automatically enable shared channel when opening iModels for read/write (see [Working With Channels]($docs/learning/backend/Channel.md)).\r\n * If not present, defaults to `true` for backwards compatibility. This means that the shared channel may be edited by default. Generally\r\n * that is undesirable because it allows applications to \"accidentally\" modify data it shouldn't be allowed to modify. Unfortunately the\r\n * previous versions of iTwin.js allowed it so this is necessary so they won't break.\r\n * Will be changed to default to `false` in 5.0.\r\n */\r\n allowSharedChannel?: boolean;\r\n\r\n /**\r\n * Setting this to true will revert to the previous behavior of using the native side for all CRUD operations.\r\n * While set to false, the getElement(), getModel() and getAspect() functions will use a thinned down native workflow to read the entities from the database.\r\n * This workflow performs work previously done on the native side in the TS side, resulting in performance improvements, if errors are detected,\r\n * this option can be set to true to revert to old workflow.\r\n */\r\n disableThinnedNativeInstanceWorkflow?: boolean;\r\n\r\n /**\r\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\r\n * @beta\r\n */\r\n disableRestorePointOnPullMerge?: true;\r\n /**\r\n * Configuration controlling whether incremental schema loading is enabled or disabled.\r\n * @beta\r\n */\r\n incrementalSchemaLoading?: \"enabled\" | \"disabled\";\r\n}\r\n\r\n/** Configuration of core-backend.\r\n * @public\r\n */\r\nexport class IModelHostConfiguration implements IModelHostOptions {\r\n public static defaultTileRequestTimeout = 20 * 1000;\r\n public static defaultLogTileLoadTimeThreshold = 40;\r\n public static defaultLogTileSizeThreshold = 20 * 1000000;\r\n /** @internal */\r\n public static defaultMaxTileCacheDbSize = 1024 * 1024 * 1024;\r\n public appAssetsDir?: LocalDirName;\r\n public cacheDir?: LocalDirName;\r\n\r\n /** @beta */\r\n public workspace?: WorkspaceOpts;\r\n public hubAccess?: BackendHubAccess;\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public authorizationClient?: AuthorizationClient;\r\n /** @beta */\r\n public restrictTileUrlsByClientIp?: boolean;\r\n public compressCachedTiles?: boolean;\r\n /** @beta */\r\n public tileCacheAzureCredentials?: AzureBlobStorageCredentials;\r\n /** @internal */\r\n public tileTreeRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public tileContentRequestTimeout = IModelHostConfiguration.defaultTileRequestTimeout;\r\n /** @internal */\r\n public logTileLoadTimeThreshold = IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n /** @internal */\r\n public logTileSizeThreshold = IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n /** @internal */\r\n public crashReportingConfig?: CrashReportingConfig;\r\n /**\r\n * Configuration controlling whether to use the thinned down native instance functions for element, model, and aspect CRUD operations\r\n * or use the previous behavior of using the native side for all CRUD operations. Set to true to revert to the previous behavior.\r\n * @beta\r\n */\r\n public disableThinnedNativeInstanceWorkflow?: boolean;\r\n\r\n /**\r\n * Configuration controlling whether to disable the creation of restore points during pull/merge operations.\r\n * @beta\r\n */\r\n public disableRestorePointOnPullMerge?: true;\r\n /**\r\n * Configuration controlling whether incremental schema loading is disabled.\r\n * Default is \"disabled\" at the moment to preserve existing behavior.\r\n * @beta\r\n */\r\n public incrementalSchemaLoading: \"enabled\" | \"disabled\" = \"disabled\";\r\n}\r\n\r\n/**\r\n * Settings for `IModelHost.appWorkspace`.\r\n * @note this includes the default dictionary from the SettingsSpecRegistry\r\n */\r\nclass ApplicationSettings extends SettingsImpl {\r\n private _remove?: VoidFunction;\r\n protected override verifyPriority(priority: SettingsPriority) {\r\n if (priority > SettingsPriority.application) // only application or lower may appear in ApplicationSettings\r\n throw new Error(\"Use IModelSettings\");\r\n }\r\n private updateDefaults() {\r\n const defaults: SettingsContainer = {};\r\n for (const [schemaName, val] of IModelHost.settingsSchemas.settingDefs) {\r\n if (val.default)\r\n defaults[schemaName] = val.default;\r\n }\r\n this.addDictionary({ name: \"_default_\", priority: 0 }, defaults);\r\n }\r\n\r\n public constructor() {\r\n super();\r\n this._remove = IModelHost.settingsSchemas.onSchemaChanged.addListener(() => this.updateDefaults());\r\n this.updateDefaults();\r\n }\r\n\r\n public override close() {\r\n if (this._remove) {\r\n this._remove();\r\n this._remove = undefined;\r\n }\r\n }\r\n}\r\n\r\nconst definedInStartup = <T>(obj: T | undefined): T => {\r\n if (obj === undefined)\r\n throw new Error(\"IModelHost.startup must be called first\");\r\n return obj;\r\n};\r\n\r\n/** IModelHost initializes ($backend) and captures its configuration. A backend must call [[IModelHost.startup]] before using any backend classes.\r\n * See [the learning article]($docs/learning/backend/IModelHost.md)\r\n * @public\r\n */\r\nexport class IModelHost {\r\n private constructor() { }\r\n\r\n /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */\r\n public static authorizationClient?: AuthorizationClient;\r\n\r\n public static backendVersion = \"\";\r\n private static _profileName: string;\r\n private static _cacheDir = \"\";\r\n private static _settingsSchemas?: SettingsSchemas;\r\n private static _appWorkspace?: OwnedWorkspace;\r\n\r\n // Omit the hubAccess field from configuration so it stays internal.\r\n public static configuration?: Omit<IModelHostOptions, \"hubAccess\">;\r\n\r\n /**\r\n * The name of the *Profile* directory (a subdirectory of \"[[cacheDir]]/profiles/\") for this process.\r\n *\r\n * The *Profile* directory is used to cache data that is specific to a type-of-usage of the iTwin.js library.\r\n * It is important that information in the profile cache be consistent but isolated across sessions (i.e.\r\n * data for a profile is maintained between runs, but each profile is completely independent and\r\n * unaffected by the presence or use of others.)\r\n * @note **Only one process at a time may be using a given profile**, and an exception will be thrown by [[startup]]\r\n * if a second process attempts to use the same profile.\r\n * @beta\r\n */\r\n public static get profileName(): string {\r\n return this._profileName;\r\n }\r\n\r\n /** The full path of the Profile directory.\r\n * @see [[profileName]]\r\n * @beta\r\n */\r\n public static get profileDir(): LocalDirName {\r\n return join(this._cacheDir, \"profiles\", this._profileName);\r\n }\r\n\r\n /** Event raised during startup to allow loading settings data */\r\n public static readonly onWorkspaceStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just after the backend IModelHost was started */\r\n public static readonly onAfterStartup = new BeEvent<() => void>();\r\n\r\n /** Event raised just before the backend IModelHost is to be shut down */\r\n public static readonly onBeforeShutdown = new BeEvent<() => void>();\r\n\r\n /** @internal */\r\n public static readonly session: Mutable<SessionProps> = { applicationId: \"2686\", applicationVersion: \"1.0.0\", sessionId: \"\" };\r\n\r\n /** A uniqueId for this session */\r\n public static get sessionId() { return this.session.sessionId; }\r\n public static set sessionId(id: GuidString) { this.session.sessionId = id; }\r\n\r\n /** The Id of this application - needs to be set only if it is an agent application. The applicationId will otherwise originate at the frontend. */\r\n public static get applicationId() { return this.session.applicationId; }\r\n public static set applicationId(id: string) { this.session.applicationId = id; }\r\n\r\n /** The version of this application - needs to be set if is an agent application. The applicationVersion will otherwise originate at the frontend. */\r\n public static get applicationVersion() { return this.session.applicationVersion; }\r\n public static set applicationVersion(version: string) { this.session.applicationVersion = version; }\r\n\r\n /** A string that can identify the current user to other users when collaborating. */\r\n public static userMoniker = \"unknown\";\r\n\r\n /** Root directory holding files that iTwin.js caches */\r\n public static get cacheDir(): LocalDirName { return this._cacheDir; }\r\n\r\n /** The application [[Workspace]] for this `IModelHost`\r\n * @note this `Workspace` only holds [[WorkspaceContainer]]s and [[Settings]] scoped to the currently loaded application(s).\r\n * All organization, iTwin, and iModel based containers or settings must be accessed through [[IModelDb.workspace]] and\r\n * attempting to add them to this Workspace will fail.\r\n * @beta\r\n */\r\n public static get appWorkspace(): Workspace { return definedInStartup(this._appWorkspace); }\r\n\r\n /** The registry of schemas describing the [[Setting]]s for the application session.\r\n * Applications should register their schemas via methods like [[SettingsSchemas.addGroup]].\r\n * @beta\r\n */\r\n public static get settingsSchemas(): SettingsSchemas { return definedInStartup(this._settingsSchemas); }\r\n\r\n /** The optional [[FileNameResolver]] that resolves keys and partial file names for snapshot iModels.\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\r\n */\r\n public static snapshotFileNameResolver?: FileNameResolver; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n /** Get the current access token for this IModelHost, or a blank string if none is available.\r\n * @note for web backends, this will *always* return a blank string because the backend itself has no token (but never needs one either.)\r\n * For all IpcHosts, where this backend is servicing a single frontend, this will be the user's token. For ElectronHost, the backend\r\n * obtains the token and forwards it to the frontend.\r\n * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value\r\n * returned by this method may change over time throughout the course of a session.\r\n */\r\n public static async getAccessToken(): Promise<AccessToken> {\r\n try {\r\n return (await IModelHost.authorizationClient?.getAccessToken()) ?? \"\";\r\n } catch {\r\n return \"\";\r\n }\r\n }\r\n\r\n private static loadNative(options: IModelHostOptions) {\r\n loadNativePlatform();\r\n\r\n if (options.crashReportingConfig && options.crashReportingConfig.crashDir && !ProcessDetector.isElectronAppBackend && !ProcessDetector.isMobileAppBackend) {\r\n IModelNative.platform.setCrashReporting(options.crashReportingConfig);\r\n\r\n Logger.logTrace(loggerCategory, \"Configured crash reporting\", {\r\n enableCrashDumps: options.crashReportingConfig?.enableCrashDumps,\r\n wantFullMemoryDumps: options.crashReportingConfig?.wantFullMemoryDumps,\r\n enableNodeReport: options.crashReportingConfig?.enableNodeReport,\r\n uploadToBentley: options.crashReportingConfig?.uploadToBentley,\r\n });\r\n\r\n if (options.crashReportingConfig.enableNodeReport) {\r\n if (process.report !== undefined) {\r\n process.report.reportOnFatalError = true;\r\n process.report.reportOnUncaughtException = true;\r\n process.report.directory = options.crashReportingConfig.crashDir;\r\n Logger.logTrace(loggerCategory, \"Configured Node.js crash reporting\");\r\n } else {\r\n Logger.logWarning(loggerCategory, \"Unable to configure Node.js crash reporting\");\r\n }\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static tileStorage?: TileStorage;\r\n\r\n private static _hubAccess?: BackendHubAccess;\r\n /** @internal */\r\n public static [_setHubAccess](hubAccess: BackendHubAccess | undefined) { this._hubAccess = hubAccess; }\r\n\r\n /** get the current hubAccess, if present.\r\n * @internal\r\n */\r\n public static [_getHubAccess](): BackendHubAccess | undefined { return this._hubAccess; }\r\n\r\n /** Provides access to the IModelHub for this IModelHost\r\n * @internal\r\n * @note If [[IModelHostOptions.hubAccess]] was undefined when initializing this class, accessing this property will throw an error.\r\n * To determine whether one is present, use [[_getHubAccess]].\r\n */\r\n public static get [_hubAccess](): BackendHubAccess {\r\n if (IModelHost._hubAccess === undefined)\r\n throw new IModelError(IModelStatus.BadRequest, \"No BackendHubAccess supplied in IModelHostOptions\");\r\n return IModelHost._hubAccess;\r\n }\r\n\r\n private static initializeWorkspace(configuration: IModelHostOptions) {\r\n const settingAssets = join(KnownLocations.packageAssetsDir, \"Settings\");\r\n this._settingsSchemas = constructSettingsSchemas();\r\n this._settingsSchemas.addDirectory(join(settingAssets, \"Schemas\"));\r\n this._appWorkspace = constructWorkspace(new ApplicationSettings(), configuration.workspace);\r\n\r\n // Create the CloudCache for Workspaces. This will fail if another process is already using the same profile.\r\n try {\r\n this.appWorkspace.getCloudCache();\r\n } catch (e: any) {\r\n throw (e.errorNumber === DbResult.BE_SQLITE_BUSY) ? new IModelError(DbResult.BE_SQLITE_BUSY, `Profile [${this.profileDir}] is already in use by another process`) : e;\r\n }\r\n\r\n this.appWorkspace.settings.addDirectory(settingAssets, SettingsPriority.defaults);\r\n\r\n GeoCoordConfig.onStartup();\r\n // allow applications to load their default settings\r\n this.onWorkspaceStartup.raiseEvent();\r\n }\r\n\r\n private static _isValid = false;\r\n\r\n /** true between a successful call to [[startup]] and before [[shutdown]] */\r\n public static get isValid() {\r\n return IModelHost._isValid;\r\n }\r\n\r\n /** This method must be called before any iTwin.js services are used.\r\n * @param options Host configuration data.\r\n * Raises [[onAfterStartup]].\r\n * @see [[shutdown]].\r\n */\r\n public static async startup(options?: IModelHostOptions): Promise<void> {\r\n if (this._isValid)\r\n return; // we're already initialized\r\n this._isValid = true;\r\n\r\n options = options ?? {};\r\n if (this.sessionId === \"\")\r\n this.sessionId = Guid.createValue();\r\n\r\n this.authorizationClient = options.authorizationClient;\r\n\r\n this.backendVersion = require(\"../../package.json\").version; // eslint-disable-line @typescript-eslint/no-require-imports\r\n initializeRpcBackend(options.enableOpenTelemetry);\r\n\r\n this.loadNative(options);\r\n this.setupCacheDir(options);\r\n this.initializeWorkspace(options);\r\n\r\n BriefcaseManager.initialize(join(this._cacheDir, \"imodels\"));\r\n\r\n [\r\n IModelReadRpcImpl,\r\n IModelTileRpcImpl,\r\n SnapshotIModelRpcImpl, // eslint-disable-line @typescript-eslint/no-deprecated\r\n DevToolsRpcImpl,\r\n ].forEach((rpc) => rpc.register()); // register all of the RPC implementations\r\n\r\n [\r\n BisCoreSchema,\r\n GenericSchema,\r\n FunctionalSchema,\r\n ].forEach((schema) => schema.registerSchema()); // register all of the schemas\r\n\r\n const { hubAccess, ...otherOptions } = options;\r\n if (undefined !== hubAccess)\r\n this._hubAccess = hubAccess;\r\n\r\n this.configuration = otherOptions;\r\n this.setupTileCache();\r\n\r\n process.once(\"beforeExit\", IModelHost.shutdown);\r\n this.onAfterStartup.raiseEvent();\r\n }\r\n\r\n private static setupCacheDir(configuration: IModelHostOptions) {\r\n this._cacheDir = normalizeDir(configuration.cacheDir ?? NativeLibrary.defaultCacheDir);\r\n IModelJsFs.recursiveMkDirSync(this._cacheDir);\r\n\r\n this._profileName = configuration.profileName ?? \"default\";\r\n Logger.logInfo(loggerCategory, `cacheDir: [${this.cacheDir}], profileDir: [${this.profileDir}]`);\r\n }\r\n\r\n /** This method must be called when an iTwin.js host is shut down. Raises [[onBeforeShutdown]] */\r\n public static async shutdown(this: void): Promise<void> {\r\n // Note: This method is set as a node listener where `this` is unbound. Call private method to\r\n // ensure `this` is correct. Don't combine these methods.\r\n return IModelHost.doShutdown();\r\n }\r\n\r\n /**\r\n * Create a new iModel.\r\n * @returns the Guid of the newly created iModel.\r\n * @throws [IModelError]($common) in case of errors.\r\n * @note If [[IModelHostOptions.hubAccess]] was undefined in the call to [[startup]], this function will throw an error.\r\n */\r\n public static async createNewIModel(arg: CreateNewIModelProps): Promise<GuidString> {\r\n return this[_hubAccess].createNewIModel(arg);\r\n }\r\n\r\n private static async doShutdown() {\r\n if (!this._isValid)\r\n return;\r\n\r\n this._isValid = false;\r\n this.onBeforeShutdown.raiseEvent();\r\n\r\n this.configuration = undefined;\r\n this.tileStorage = undefined;\r\n\r\n this._appWorkspace?.close();\r\n this._appWorkspace = undefined;\r\n this._settingsSchemas = undefined;\r\n\r\n CloudSqlite.CloudCaches.destroy();\r\n process.removeListener(\"beforeExit\", IModelHost.shutdown);\r\n }\r\n\r\n /**\r\n * Add or update a property that should be included in a crash report.\r\n * @internal\r\n */\r\n public static setCrashReportProperty(name: string, value: string): void {\r\n IModelNative.platform.setCrashReportProperty(name, value);\r\n }\r\n\r\n /**\r\n * Remove a previously defined property so that will not be included in a crash report.\r\n * @internal\r\n */\r\n public static removeCrashReportProperty(name: string): void {\r\n IModelNative.platform.setCrashReportProperty(name, undefined);\r\n }\r\n\r\n /**\r\n * Get all properties that will be included in a crash report.\r\n * @internal\r\n */\r\n public static getCrashReportProperties(): CrashReportingConfigNameValuePair[] {\r\n return IModelNative.platform.getCrashReportProperties();\r\n }\r\n\r\n /** The directory where application assets may be found */\r\n public static get appAssetsDir(): string | undefined {\r\n return undefined !== IModelHost.configuration ? IModelHost.configuration.appAssetsDir : undefined;\r\n }\r\n\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileTreeProps should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileTreeRequestTimeout(): number {\r\n return IModelHost.configuration?.tileTreeRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n /** The time, in milliseconds, for which IModelTileRpcInterface.requestTileContent should wait before returning a \"pending\" status.\r\n * @internal\r\n */\r\n public static get tileContentRequestTimeout(): number {\r\n return IModelHost.configuration?.tileContentRequestTimeout ?? IModelHostConfiguration.defaultTileRequestTimeout;\r\n }\r\n\r\n /** The backend will log when a tile took longer to load than this threshold in seconds. */\r\n public static get logTileLoadTimeThreshold(): number {\r\n return IModelHost.configuration?.logTileLoadTimeThreshold ?? IModelHostConfiguration.defaultLogTileLoadTimeThreshold;\r\n }\r\n /** The backend will log when a tile is loaded with a size in bytes above this threshold. */\r\n public static get logTileSizeThreshold(): number {\r\n return IModelHost.configuration?.logTileSizeThreshold ?? IModelHostConfiguration.defaultLogTileSizeThreshold;\r\n }\r\n\r\n /** Whether external tile caching is active.\r\n * @internal\r\n */\r\n public static get usingExternalTileCache(): boolean {\r\n return undefined !== IModelHost.tileStorage;\r\n }\r\n\r\n /** Whether to restrict tile cache URLs by client IP address.\r\n * @internal\r\n */\r\n public static get restrictTileUrlsByClientIp(): boolean {\r\n return undefined !== IModelHost.configuration && (IModelHost.configuration.restrictTileUrlsByClientIp ? true : false);\r\n }\r\n\r\n /** Whether to compress cached tiles.\r\n * @internal\r\n */\r\n public static get compressCachedTiles(): boolean {\r\n return false !== IModelHost.configuration?.compressCachedTiles;\r\n }\r\n\r\n private static setupTileCache() {\r\n assert(undefined !== IModelHost.configuration);\r\n const config = IModelHost.configuration;\r\n const storage = config.tileCacheStorage;\r\n const credentials = config.tileCacheAzureCredentials;\r\n\r\n if (!storage && !credentials) {\r\n IModelNative.platform.setMaxTileCacheSize(config.maxTileCacheDbSize ?? IModelHostConfiguration.defaultMaxTileCacheDbSize);\r\n return;\r\n }\r\n\r\n IModelNative.platform.setMaxTileCacheSize(0);\r\n if (credentials) {\r\n if (storage)\r\n throw new IModelError(BentleyStatus.ERROR, \"Cannot use both Azure and custom cloud storage providers for tile cache.\");\r\n this.setupAzureTileCache(credentials);\r\n }\r\n if (storage)\r\n IModelHost.tileStorage = new TileStorage(storage);\r\n }\r\n\r\n private static setupAzureTileCache(credentials: AzureBlobStorageCredentials) {\r\n const storageConfig: AzureServerStorageConfig = {\r\n accountName: credentials.account,\r\n accountKey: credentials.accessKey,\r\n baseUrl: credentials.baseUrl ?? `https://${credentials.account}.blob.core.windows.net`,\r\n }\r\n const blobServiceClient = new BlobServiceClient(\r\n storageConfig.baseUrl,\r\n new StorageSharedKeyCredential(storageConfig.accountName, storageConfig.accountKey),\r\n );\r\n const azureStorage: ServerStorage = new AzureServerStorage(storageConfig, new BlobServiceClientWrapper(blobServiceClient))\r\n IModelHost.tileStorage = new TileStorage(azureStorage);\r\n }\r\n\r\n /** @internal */\r\n public static computeSchemaChecksum(arg: { schemaXmlPath: string, referencePaths: string[], exactMatch?: boolean }): string {\r\n return IModelNative.platform.computeSchemaChecksum(arg);\r\n }\r\n}\r\n\r\n/** Information about the platform on which the app is running.\r\n * @public\r\n */\r\nexport class Platform {\r\n /** Get the name of the platform. */\r\n public static get platformName(): \"win32\" | \"linux\" | \"darwin\" | \"ios\" | \"android\" | \"uwp\" {\r\n return process.platform as any;\r\n }\r\n}\r\n\r\n/** Well known directories that may be used by the application.\r\n * @public\r\n */\r\nexport class KnownLocations {\r\n\r\n /** The directory where the imodeljs-native assets are stored. */\r\n public static get nativeAssetsDir(): LocalDirName {\r\n return IModelNative.platform.DgnDb.getAssetsDir();\r\n }\r\n\r\n /** The directory where the core-backend assets are stored. */\r\n public static get packageAssetsDir(): LocalDirName {\r\n return join(__dirname, \"assets\");\r\n }\r\n\r\n /** The temporary directory. */\r\n public static get tmpdir(): LocalDirName {\r\n return os.tmpdir();\r\n }\r\n}\r\n\r\n/** Extend this class to provide custom file name resolution behavior.\r\n * @note Only `tryResolveKey` and/or `tryResolveFileName` need to be overridden as the implementations of `resolveKey` and `resolveFileName` work for most purposes.\r\n * @see [[IModelHost.snapshotFileNameResolver]]\r\n * @public\r\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. When opening a snapshot by file name, ensure to pass already resolved path. Using a key to open a snapshot is now deprecated.\r\n */\r\nexport abstract class FileNameResolver {\r\n /** Resolve a file name from the specified key.\r\n * @param _fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name or `undefined` if not found.\r\n */\r\n public tryResolveKey(_fileKey: string): string | undefined { return undefined; }\r\n /** Resolve a file name from the specified key.\r\n * @param fileKey The key that identifies the file name in a `Map` or other similar data structure.\r\n * @returns The resolved file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveKey(fileKey: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveKey(fileKey);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${fileKey} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name or `undefined` if not found.\r\n */\r\n public tryResolveFileName(inFileName: string): string | undefined { return inFileName; }\r\n /** Resolve the input file name, which may be a partial name, into a full path file name.\r\n * @param inFileName The partial file name.\r\n * @returns The resolved full path file name.\r\n * @throws [[IModelError]] if not found.\r\n */\r\n public resolveFileName(inFileName: string): string {\r\n const resolvedFileName: string | undefined = this.tryResolveFileName(inFileName);\r\n if (undefined === resolvedFileName) {\r\n throw new IModelError(IModelStatus.NotFound, `${inFileName} not resolved`);\r\n }\r\n return resolvedFileName;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,gEAAoI;AACpI,oDAAiE;AAGjE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sCAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAC,SAAoB;QACjD,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAc,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAO,KAAa,EAAE,OAA2B;QAC3E,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzG,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE;YACzC,SAAS,EAAE,4BAAc,CAAC,qBAAqB;YAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAhDD,wEAgDC","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 iModels\n */\nimport { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\n\n/**\n * A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.\n * @beta\n */\nexport class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {\n private readonly _iModel: IModelDb;\n\n /**\n * Constructs a new IModelIncrementalSchemaLocater instance.\n * @param iModel The [[IModelDb]] to query.\n * @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).\n */\n constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions) {\n super(options ?? { useMultipleQueries: true });\n this._iModel = iModel;\n }\n\n /**\n * Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).\n * This is the full schema json with all elements that are defined in the schema.\n * @param schemaKey The key of the schema to be resolved.\n */\n protected async getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined> {\n // To keep the main thread from being blocked in sync loading cases the resolving\n // is triggered through a timeout. Even if there is no delay, it improves loading\n // time by ~3x.\n return new Promise((resolve, reject) => setTimeout(() => {\n try {\n resolve(this._iModel.getSchemaProps(schemaKey.name) as SchemaProps);\n }\n catch (error: any) {\n reject(error as Error);\n }\n }, 0));\n }\n\n /**\n * Executes an ECSql query against the IModelDb.\n * @param query The query to execute\n * @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.\n * @returns A promise that resolves to read-only array of type TRow.\n */\n protected async executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>> {\n const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;\n\n return this._iModel\n .createQueryReader(query, queryParameters, {\n rowFormat: QueryRowFormat.UseECSqlPropertyNames,\n limit: { count: options?.limit },\n })\n .toArray();\n }\n}"]}
1
+ {"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,gEAAoI;AACpI,oDAAiE;AAGjE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sCAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAC,SAAoB;QACjD,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAgB,CAAC,CAAC;YACtE,CAAC;YACD,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAc,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAO,KAAa,EAAE,OAA2B;QAC3E,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzG,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE;YACzC,SAAS,EAAE,4BAAc,CAAC,qBAAqB;YAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAhDD,wEAgDC","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 iModels\r\n */\r\nimport { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from \"@itwin/ecschema-metadata\";\r\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/**\r\n * A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.\r\n * @beta\r\n */\r\nexport class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {\r\n private readonly _iModel: IModelDb;\r\n\r\n /**\r\n * Constructs a new IModelIncrementalSchemaLocater instance.\r\n * @param iModel The [[IModelDb]] to query.\r\n * @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).\r\n */\r\n constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions) {\r\n super(options ?? { useMultipleQueries: true });\r\n this._iModel = iModel;\r\n }\r\n\r\n /**\r\n * Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).\r\n * This is the full schema json with all elements that are defined in the schema.\r\n * @param schemaKey The key of the schema to be resolved.\r\n */\r\n protected async getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined> {\r\n // To keep the main thread from being blocked in sync loading cases the resolving\r\n // is triggered through a timeout. Even if there is no delay, it improves loading\r\n // time by ~3x.\r\n return new Promise((resolve, reject) => setTimeout(() => {\r\n try {\r\n resolve(this._iModel.getSchemaProps(schemaKey.name) as SchemaProps);\r\n }\r\n catch (error: any) {\r\n reject(error as Error);\r\n }\r\n }, 0));\r\n }\r\n\r\n /**\r\n * Executes an ECSql query against the IModelDb.\r\n * @param query The query to execute\r\n * @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.\r\n * @returns A promise that resolves to read-only array of type TRow.\r\n */\r\n protected async executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>> {\r\n const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;\r\n\r\n return this._iModel\r\n .createQueryReader(query, queryParameters, {\r\n rowFormat: QueryRowFormat.UseECSqlPropertyNames,\r\n limit: { count: options?.limit },\r\n })\r\n .toArray();\r\n }\r\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,6B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AC;IACL,CAAC;CACF;AAtID,gCAsIC","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\n/** @packageDocumentation\n * @module Portability\n */\n\n// cspell: ignore wflag\n\nimport * as fs from \"fs-extra\";\nimport * as path from \"path\";\n\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\n/** Information about a file. See [[IModelJsFs.lstatSync]]\n * @public\n */\nexport class IModelJsFsStats {\n constructor(\n public size: number,\n public atimeMs: number,\n public mtimeMs: number,\n public birthtimeMs: number,\n public isDirectory: boolean,\n public isFile: boolean,\n public isSocket: boolean,\n public isSymbolicLink: boolean,\n public isReadOnly: boolean,\n ) { }\n}\n\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\n * @public\n */\nexport class IModelJsFs {\n\n /** Does file or directory exist? */\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\n\n /** Delete a file. */\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\n\n /** Delete a file or remove a directory (rm -r). */\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\n\n /** Create a directory. */\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\n\n /** Remove a directory. */\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\n\n /** Write to a file. */\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\n\n /** Append to a file. */\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\n\n /** Make a copy of a file */\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\n\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\n\n /** Read file */\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\n\n /** Test if the current user has permission to write to a file. */\n private static isFileWritable(pathname: string): boolean {\n try {\n fs.accessSync(pathname, fs.constants.W_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n /** Get information about a file. */\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\n const stats = fs.lstatSync(pathname);\n if (stats === undefined)\n return undefined;\n\n return new IModelJsFsStats(\n stats.size,\n stats.atime.getTime(),\n stats.mtime.getTime(),\n stats.birthtime.getTime(),\n stats.isDirectory(),\n stats.isFile(),\n stats.isSocket(),\n stats.isSymbolicLink(),\n !IModelJsFs.isFileWritable(pathname));\n }\n\n /**\n * Finds files recursively based on a pattern\n * @param rootDir Directory from where to start searching for files.\n * @param pattern A Regex that would be match to basename of files including extension\n * @returns list of file that match the pattern.\n */\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\n const files: string[] = [];\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\n if (!isDir) {\n const fileName = path.basename(pathname);\n if (pattern.test(fileName)) {\n files.push(pathname);\n }\n }\n return true;\n });\n return files;\n }\n\n /**\n * Walks a directory in breadth first fashion\n * @param rootDir directory from where the traversal starts\n * @param cb callback that would be called with full path of file or directory\n */\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\n const subDir = [];\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\n const fullPath = path.join(rootDir, childPath);\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\n if (!cb(fullPath, isDir ?? false)) {\n return;\n }\n // Need to check if the directory still exists in case the callback has deleted it.\n if (isDir && IModelJsFs.existsSync(fullPath)) {\n subDir.push(fullPath);\n }\n }\n subDir.forEach((v) => {\n IModelJsFs.walkDirSync(v, cb);\n });\n }\n\n /** Create a directory, recursively setting up the path as necessary */\n public static recursiveMkDirSync(dirPath: string) {\n if (IModelJsFs.existsSync(dirPath))\n return;\n const parentPath = path.dirname(dirPath);\n if (parentPath !== dirPath)\n IModelJsFs.recursiveMkDirSync(parentPath);\n try {\n IModelJsFs.mkdirSync(dirPath);\n } catch (err: any) {\n // Ignore the error if the folder has been created since the existence check\n if (err?.code !== \"EEXIST\")\n throw err;\n }\n }\n\n /** Remove a directory, recursively */\n public static purgeDirSync(dirPath: string) {\n if (!IModelJsFs.existsSync(dirPath))\n return;\n\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\n if (isDir) {\n IModelJsFs.purgeDirSync(pathName);\n IModelJsFs.removeSync(pathName);\n } else {\n IModelJsFs.unlinkSync(pathName);\n }\n return true;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAAuD;AACvD;;GAEG;AACH,MAAa,eAAe;IAEjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IATT,YACS,IAAY,EACZ,OAAe,EACf,OAAe,EACf,WAAmB,EACnB,WAAoB,EACpB,MAAe,EACf,QAAiB,EACjB,cAAuB,EACvB,UAAmB;QARnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cAAc,CAAS;QACvB,eAAU,GAAV,UAAU,CAAS;IACxB,CAAC;CACN;AAZD,0CAYC;AAED;;GAEG;AACH,MAAa,UAAU;IAErB,oCAAoC;IAC7B,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAa,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CA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CAAC;YAClB,4EAA4E;YAC5E,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ;gBACxB,MAAM,GAAG,CAAC;QACd,CAAC;IACH,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAC,YAAY,CAAC,OAAe;QACxC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,OAAO;QAET,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE;YACnE,IAAI,KAAK,EAAE,CAAC;gBACV,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAClC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtID,gCAsIC","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\r\n/** @packageDocumentation\r\n * @module Portability\r\n */\r\n\r\n// cspell: ignore wflag\r\n\r\nimport * as fs from \"fs-extra\";\r\nimport * as path from \"path\";\r\n\r\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\r\n/** Information about a file. See [[IModelJsFs.lstatSync]]\r\n * @public\r\n */\r\nexport class IModelJsFsStats {\r\n constructor(\r\n public size: number,\r\n public atimeMs: number,\r\n public mtimeMs: number,\r\n public birthtimeMs: number,\r\n public isDirectory: boolean,\r\n public isFile: boolean,\r\n public isSocket: boolean,\r\n public isSymbolicLink: boolean,\r\n public isReadOnly: boolean,\r\n ) { }\r\n}\r\n\r\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\r\n * @public\r\n */\r\nexport class IModelJsFs {\r\n\r\n /** Does file or directory exist? */\r\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\r\n\r\n /** Delete a file. */\r\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\r\n\r\n /** Delete a file or remove a directory (rm -r). */\r\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\r\n\r\n /** Create a directory. */\r\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\r\n\r\n /** Remove a directory. */\r\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\r\n\r\n /** Write to a file. */\r\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\r\n\r\n /** Append to a file. */\r\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\r\n\r\n /** Make a copy of a file */\r\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\r\n\r\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\r\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\r\n\r\n /** Read file */\r\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\r\n\r\n /** Test if the current user has permission to write to a file. */\r\n private static isFileWritable(pathname: string): boolean {\r\n try {\r\n fs.accessSync(pathname, fs.constants.W_OK);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n /** Get information about a file. */\r\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\r\n const stats = fs.lstatSync(pathname);\r\n if (stats === undefined)\r\n return undefined;\r\n\r\n return new IModelJsFsStats(\r\n stats.size,\r\n stats.atime.getTime(),\r\n stats.mtime.getTime(),\r\n stats.birthtime.getTime(),\r\n stats.isDirectory(),\r\n stats.isFile(),\r\n stats.isSocket(),\r\n stats.isSymbolicLink(),\r\n !IModelJsFs.isFileWritable(pathname));\r\n }\r\n\r\n /**\r\n * Finds files recursively based on a pattern\r\n * @param rootDir Directory from where to start searching for files.\r\n * @param pattern A Regex that would be match to basename of files including extension\r\n * @returns list of file that match the pattern.\r\n */\r\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\r\n const files: string[] = [];\r\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\r\n if (!isDir) {\r\n const fileName = path.basename(pathname);\r\n if (pattern.test(fileName)) {\r\n files.push(pathname);\r\n }\r\n }\r\n return true;\r\n });\r\n return files;\r\n }\r\n\r\n /**\r\n * Walks a directory in breadth first fashion\r\n * @param rootDir directory from where the traversal starts\r\n * @param cb callback that would be called with full path of file or directory\r\n */\r\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\r\n const subDir = [];\r\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\r\n const fullPath = path.join(rootDir, childPath);\r\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\r\n if (!cb(fullPath, isDir ?? false)) {\r\n return;\r\n }\r\n // Need to check if the directory still exists in case the callback has deleted it.\r\n if (isDir && IModelJsFs.existsSync(fullPath)) {\r\n subDir.push(fullPath);\r\n }\r\n }\r\n subDir.forEach((v) => {\r\n IModelJsFs.walkDirSync(v, cb);\r\n });\r\n }\r\n\r\n /** Create a directory, recursively setting up the path as necessary */\r\n public static recursiveMkDirSync(dirPath: string) {\r\n if (IModelJsFs.existsSync(dirPath))\r\n return;\r\n const parentPath = path.dirname(dirPath);\r\n if (parentPath !== dirPath)\r\n IModelJsFs.recursiveMkDirSync(parentPath);\r\n try {\r\n IModelJsFs.mkdirSync(dirPath);\r\n } catch (err: any) {\r\n // Ignore the error if the folder has been created since the existence check\r\n if (err?.code !== \"EEXIST\")\r\n throw err;\r\n }\r\n }\r\n\r\n /** Remove a directory, recursively */\r\n public static purgeDirSync(dirPath: string) {\r\n if (!IModelJsFs.existsSync(dirPath))\r\n return;\r\n\r\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\r\n if (isDir) {\r\n IModelJsFs.purgeDirSync(pathName);\r\n IModelJsFs.removeSync(pathName);\r\n } else {\r\n IModelJsFs.unlinkSync(pathName);\r\n }\r\n return true;\r\n });\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageSourceConversion.js","sourceRoot":"","sources":["../../src/ImageSourceConversion.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAsBH,gEAaC;AA6BD,gEAcC;AA5ED,oDAA0G;AAC1G,8DAAyD;AAczD;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,IAAoC;IAC7E,MAAM,GAAG,GAAG,6BAAY,CAAC,QAAQ,CAAC,0BAA0B,CAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,EAClB,IAAI,CAAC,MAAM,CAAC,IAAI,EAChB,IAAI,CAAC,YAAY,IAAI,GAAG,EACxB,KAAK,CACN,CAAC;IAEF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,yBAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAwBD;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,IAAoC;IAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,+BAAiB,CAAC,KAAK,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,6BAAY,CAAC,QAAQ,CAAC,0BAA0B,CACrD,IAAI,CAAC,KAAK,CAAC,MAAM,EACjB,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,KAAK,EAChB,IAAI,CAAC,KAAK,CAAC,MAAM,EACjB,IAAI,CAAC,YAAY,IAAI,GAAG,EACxB,IAAI,CAAC,cAAc,IAAI,KAAK,EAC5B,IAAI,CAAC,WAAW,IAAI,GAAG,CACxB,CAAC;AACJ,CAAC","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 Images\n */\n\nimport { BinaryImageSource, ImageBuffer, ImageBufferFormat, ImageSourceFormat } from \"@itwin/core-common\";\nimport { IModelNative } from \"./internal/NativePlatform\";\n\n/** Arguments supplied to [[imageBufferFromImageSource]].\n * @public\n */\nexport interface ImageBufferFromImageSourceArgs {\n /** The encoded image to be decoded into an [ImageBuffer]($common). */\n source: BinaryImageSource;\n /** The desired format for the decoded [ImageBuffer]($common).\n * If unspecified, it defaults to [ImageBufferFormat.Rgb]($common) unless an alpha channel is present in [[source]].\n */\n targetFormat?: ImageBufferFormat.Rgb | ImageBufferFormat.Rgba;\n}\n\n/** Decode a [BinaryImageSource]($common) into an [ImageBuffer]($common).\n * Returns `undefined` if decoding fails, typically because the input was invalid.\n * @see [[imageSourceFromImageBuffer]] for the inverse conversion.\n * @public\n */\nexport function imageBufferFromImageSource(args: ImageBufferFromImageSourceArgs): ImageBuffer | undefined {\n const ret = IModelNative.platform.imageBufferFromImageSource(\n args.source.format,\n args.source.data,\n args.targetFormat ?? 255,\n false\n );\n\n if (!ret) {\n return undefined;\n }\n\n return ImageBuffer.create(ret.data, ret.format, ret.width);\n}\n\n/** Arguments supplied to [[imageSourceFromImageBuffer]].\n * @public\n */\nexport interface ImageSourceFromImageBufferArgs {\n /** The image to be encoded.\n * The image must be in [ImageBufferFormat.Rgb]($common) or [ImageBufferFormat.Rgba]($common) - [ImageBufferFormat.Alpha]($common) cannot be converted to an [ImageSource]($common).\n */\n image: ImageBuffer;\n /** The desired encoding for the resultant [BinaryImageSource]($common).\n * Defaults to [ImageSourceFormat.Jpeg]($common) unless an alpha channel is present in [[image]].\n */\n targetFormat?: ImageSourceFormat.Png | ImageSourceFormat.Jpeg;\n /** If true, invert the order of the rows of the encoded image. */\n flipVertically?: boolean;\n /** If [[targetFormat]] is (or defaults to) [ImageSourceFormat.Jpeg]($common), an integer between 0 and 100 indicating\n * the desired trade-off between image compression and image fidelity. This is a scale where 0 sacrifices image quality\n * in favor of minimizing the size of the encoded image, and 100 minimizes compression artifacts at the expense of size.\n * Default: 100.\n */\n jpegQuality?: number;\n}\n\n/** Encode an [ImageBuffer]($common) into a [BinaryImageSource]($common).\n * Returns `undefined` if encoding fails, typically because the input was invalid.\n * @throws Error if the ImageBuffer is of [ImageBufferFormat.Alpha]($common).\n * @public\n */\nexport function imageSourceFromImageBuffer(args: ImageSourceFromImageBufferArgs): BinaryImageSource | undefined {\n if (args.image.format === ImageBufferFormat.Alpha) {\n throw new Error(\"imageSourceFromImageBuffer cannot be used with alpha-only images\");\n }\n\n return IModelNative.platform.imageSourceFromImageBuffer(\n args.image.format,\n args.image.data,\n args.image.width,\n args.image.height,\n args.targetFormat ?? 255,\n args.flipVertically ?? false,\n args.jpegQuality ?? 100\n );\n}\n"]}
1
+ {"version":3,"file":"ImageSourceConversion.js","sourceRoot":"","sources":["../../src/ImageSourceConversion.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAsBH,gEAaC;AA6BD,gEAcC;AA5ED,oDAA0G;AAC1G,8DAAyD;AAczD;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,IAAoC;IAC7E,MAAM,GAAG,GAAG,6BAAY,CAAC,QAAQ,CAAC,0BAA0B,CAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,EAClB,IAAI,CAAC,MAAM,CAAC,IAAI,EAChB,IAAI,CAAC,YAAY,IAAI,GAAG,EACxB,KAAK,CACN,CAAC;IAEF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,yBAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAwBD;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,IAAoC;IAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,+BAAiB,CAAC,KAAK,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,6BAAY,CAAC,QAAQ,CAAC,0BAA0B,CACrD,IAAI,CAAC,KAAK,CAAC,MAAM,EACjB,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,KAAK,EAChB,IAAI,CAAC,KAAK,CAAC,MAAM,EACjB,IAAI,CAAC,YAAY,IAAI,GAAG,EACxB,IAAI,CAAC,cAAc,IAAI,KAAK,EAC5B,IAAI,CAAC,WAAW,IAAI,GAAG,CACxB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Images\r\n */\r\n\r\nimport { BinaryImageSource, ImageBuffer, ImageBufferFormat, ImageSourceFormat } from \"@itwin/core-common\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\n\r\n/** Arguments supplied to [[imageBufferFromImageSource]].\r\n * @public\r\n */\r\nexport interface ImageBufferFromImageSourceArgs {\r\n /** The encoded image to be decoded into an [ImageBuffer]($common). */\r\n source: BinaryImageSource;\r\n /** The desired format for the decoded [ImageBuffer]($common).\r\n * If unspecified, it defaults to [ImageBufferFormat.Rgb]($common) unless an alpha channel is present in [[source]].\r\n */\r\n targetFormat?: ImageBufferFormat.Rgb | ImageBufferFormat.Rgba;\r\n}\r\n\r\n/** Decode a [BinaryImageSource]($common) into an [ImageBuffer]($common).\r\n * Returns `undefined` if decoding fails, typically because the input was invalid.\r\n * @see [[imageSourceFromImageBuffer]] for the inverse conversion.\r\n * @public\r\n */\r\nexport function imageBufferFromImageSource(args: ImageBufferFromImageSourceArgs): ImageBuffer | undefined {\r\n const ret = IModelNative.platform.imageBufferFromImageSource(\r\n args.source.format,\r\n args.source.data,\r\n args.targetFormat ?? 255,\r\n false\r\n );\r\n\r\n if (!ret) {\r\n return undefined;\r\n }\r\n\r\n return ImageBuffer.create(ret.data, ret.format, ret.width);\r\n}\r\n\r\n/** Arguments supplied to [[imageSourceFromImageBuffer]].\r\n * @public\r\n */\r\nexport interface ImageSourceFromImageBufferArgs {\r\n /** The image to be encoded.\r\n * The image must be in [ImageBufferFormat.Rgb]($common) or [ImageBufferFormat.Rgba]($common) - [ImageBufferFormat.Alpha]($common) cannot be converted to an [ImageSource]($common).\r\n */\r\n image: ImageBuffer;\r\n /** The desired encoding for the resultant [BinaryImageSource]($common).\r\n * Defaults to [ImageSourceFormat.Jpeg]($common) unless an alpha channel is present in [[image]].\r\n */\r\n targetFormat?: ImageSourceFormat.Png | ImageSourceFormat.Jpeg;\r\n /** If true, invert the order of the rows of the encoded image. */\r\n flipVertically?: boolean;\r\n /** If [[targetFormat]] is (or defaults to) [ImageSourceFormat.Jpeg]($common), an integer between 0 and 100 indicating\r\n * the desired trade-off between image compression and image fidelity. This is a scale where 0 sacrifices image quality\r\n * in favor of minimizing the size of the encoded image, and 100 minimizes compression artifacts at the expense of size.\r\n * Default: 100.\r\n */\r\n jpegQuality?: number;\r\n}\r\n\r\n/** Encode an [ImageBuffer]($common) into a [BinaryImageSource]($common).\r\n * Returns `undefined` if encoding fails, typically because the input was invalid.\r\n * @throws Error if the ImageBuffer is of [ImageBufferFormat.Alpha]($common).\r\n * @public\r\n */\r\nexport function imageSourceFromImageBuffer(args: ImageSourceFromImageBufferArgs): BinaryImageSource | undefined {\r\n if (args.image.format === ImageBufferFormat.Alpha) {\r\n throw new Error(\"imageSourceFromImageBuffer cannot be used with alpha-only images\");\r\n }\r\n\r\n return IModelNative.platform.imageSourceFromImageBuffer(\r\n args.image.format,\r\n args.image.data,\r\n args.image.width,\r\n args.image.height,\r\n args.targetFormat ?? 255,\r\n args.flipVertically ?? false,\r\n args.jpegQuality ?? 100\r\n );\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8UH,4DAaC;AAxVD,sDAAgH;AAChH,oDAI4B;AAC5B,2DAAuE;AACvE,yCAA6E;AAC7E,6CAA6D;AAC7D,8DAAyD;AACzD,gDAA+C;AAC/C,oEAAyE;AAmBzE;;;;GAIG;AACH,MAAa,OAAO;IACX,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,IAAI,CAA+B;IAClD,2EAA2E;IACnE,MAAM,KAAK,GAAG,KAAuB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,+DAA+D;IACjI,gIAAgI;IACzH,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,GAAG,IAAW;QAChD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAAe,EAAE,OAAyC;QAC7E,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,QAAqB;QAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC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a,CAAC,GAAW;QACpC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,UAAU,EAAE,CAAC;IACzD,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,GAAW;QACnC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACM,KAAK,CAAC,iBAAiB,CAAC,GAAW;QACxC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAAkB;QAC9C,OAAO,6BAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,IAAsB,EAAE,UAAgC,EAAE,gBAAyB;IAC1H,MAAM,QAAQ,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,+DAA+D;IACzG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC","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 NativeApp\n */\n\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\nimport {\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, RemoveFunction, SnapshotOpenOptions, StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\n} from \"@itwin/core-common\";\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\n\n/**\n * Options for [[IpcHost.startup]]\n * @public\n */\nexport interface IpcHostOpts {\n iModelHost?: IModelHostOptions;\n ipcHost?: {\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\n socket?: IpcSocketBackend;\n\n /** don't send stack information on exceptions */\n exceptions?: {\n noStack?: boolean;\n };\n };\n}\n\n/**\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\n * @note if either end terminates, the other must too.\n * @public\n */\nexport class IpcHost {\n public static noStack = false;\n private static _ipc: IpcSocketBackend | undefined;\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Send a message to the frontend over an Ipc channel.\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\n * @param data The content of the message.\n */\n public static send(channel: string, ...data: any[]): void {\n this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @note returns A function to call to remove the handler.\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n return this.ipc.handle(iTwinChannel(channel), handler);\n }\n /**\n * Establish a handler to receive messages sent via [[IpcApp.send]].\n * @param channel The name of the channel for the messages.\n * @param listener A function called when messages are sent over `channel`\n * @note returns A function to call to remove the listener.\n */\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), listener);\n }\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener): void {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\n if (this.isValid)\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\n }\n\n /** @internal */\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\n }\n\n /** @internal */\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\n }\n\n /** @internal */\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\n }\n\n /**\n * Start the backend of an Ipc app.\n * @param opt\n * @note this method calls [[IModelHost.startup]] internally.\n */\n public static async startup(opt?: IpcHostOpts): Promise<void> {\n this._ipc = opt?.ipcHost?.socket;\n if (opt?.ipcHost?.exceptions?.noStack)\n this.noStack = true;\n\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\n IpcAppHandler.register();\n }\n\n await IModelHost.startup(opt?.iModelHost);\n }\n\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._ipc = undefined;\n await IModelHost.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @public\n */\nexport abstract class IpcHandler {\n /**\n * All subclasses *must* implement this method to specify their channel name.\n *\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\n */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\n\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\n try {\n if (prohibitedFunctions.includes(funcName))\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\n\n const func = (impl as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\n\n return { result: await func.call(impl, ...args) };\n } catch (err: unknown) {\n\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\n return { error: err as any };\n\n const ret = { error: { ...err } };\n ret.error.message = err.message; // NB: .message, and .stack members of Error are not enumerable, so spread operator above does not copy them.\n if (!IpcHost.noStack)\n ret.error.stack = err.stack;\n\n if (err instanceof BentleyError) {\n ret.error.iTwinErrorId = err.iTwinErrorId;\n if (err.hasMetaData)\n ret.error.loggingMetadata = err.loggingMetadata;\n delete ret.error._metaData;\n }\n return ret;\n }\n });\n }\n}\n\n/**\n * Implementation of IpcAppFunctions\n */\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\n public get channelName() { return ipcAppChannels.functions; }\n\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\n\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\n switch (level) {\n case LogLevel.Error:\n Logger.logError(category, message, metaData);\n break;\n case LogLevel.Info:\n Logger.logInfo(category, message, metaData);\n break;\n case LogLevel.Trace:\n Logger.logTrace(category, message, metaData);\n break;\n case LogLevel.Warning:\n Logger.logWarning(category, message, metaData);\n break;\n }\n }\n\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n return cancelTileContentRequests(tokenProps, contentIds);\n }\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\n }\n public async openBriefcase(args: OpenBriefcaseProps): Promise<IModelConnectionProps> {\n const db = await BriefcaseDb.open(args);\n return db.toJSON();\n }\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\n }\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\n }\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\n if (!resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n public async closeIModel(key: string): Promise<void> {\n IModelDb.findByKey(key).close();\n }\n public async saveChanges(key: string, description?: string): Promise<void> {\n IModelDb.findByKey(key).saveChanges(description);\n }\n public async abandonChanges(key: string): Promise<void> {\n IModelDb.findByKey(key).abandonChanges();\n }\n public async hasPendingTxns(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\n }\n\n public async isUndoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\n }\n public async isRedoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\n }\n public async getUndoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\n }\n public async getRedoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\n }\n\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\n\n let onProgress: ProgressFunction | undefined;\n if (options?.reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\n return checkAbort();\n };\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\n } else if (options?.enableCancellation) {\n onProgress = checkAbort;\n }\n\n try {\n await iModelDb.pullChanges({ toIndex, onProgress });\n } finally {\n this._iModelKeyToPullStatus.delete(key);\n }\n\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n public async cancelPullChangesRequest(key: string): Promise<void> {\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\n }\n\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n await iModelDb.pushChanges({ description });\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\n if (val.error)\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\n assert(undefined !== val.result);\n return val.result;\n }\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\n }\n\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reverseTxns(numOperations);\n }\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reverseAll();\n }\n public async reinstateTxn(key: string): Promise<IModelStatus> {\n return IModelDb.findByKey(key)[_nativeDb].reinstateTxn();\n }\n public async restartTxnSession(key: string): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].restartTxnSession();\n }\n\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\n return IModelNative.platform.queryConcurrency(pool);\n }\n}\n\n/**\n * Prevents progress callback being called more frequently when provided interval.\n * @internal\n */\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\n let nextTime = Date.now() + interval;\n const progressCallback: ProgressFunction = (loaded, total) => {\n const now = Date.now();\n if (loaded >= total || now >= nextTime) {\n nextTime = now + interval;\n return func(loaded, total);\n }\n return checkAbort();\n };\n\n return progressCallback;\n}\n"]}
1
+ {"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8UH,4DAaC;AAxVD,sDAAgH;AAChH,oDAI4B;AAC5B,2DAAuE;AACvE,yCAA6E;AAC7E,6CAA6D;AAC7D,8DAAyD;AACzD,gDAA+C;AAC/C,oEAAyE;AAmBzE;;;;GAIG;AACH,MAAa,OAAO;IACX,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,IAAI,CAA+B;IAClD,2EAA2E;IACnE,MAAM,KAAK,GAAG,KAAuB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,+DAA+D;IACjI,gIAAgI;IACzH,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE;;;;OAIG;IACI,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,GAAG,IAAW;QAChD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAAe,EAAE,OAAyC;QAC7E,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,0BAAY,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,OAAe,EAAE,QAAqB;QAC9D,OAAO,IAAI,CAAC,GAAG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AAa,CAAC,CAAC;IACvE,CAAC;IACM,KAAK,CAAC,aAAa,CAAC,GAAW;QACpC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,UAAU,EAAE,CAAC;IACzD,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,GAAW;QACnC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACM,KAAK,CAAC,iBAAiB,CAAC,GAAW;QACxC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,mBAAS,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAAkB;QAC9C,OAAO,6BAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,IAAsB,EAAE,UAAgC,EAAE,gBAAyB;IAC1H,MAAM,QAAQ,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,+DAA+D;IACzG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\r\nimport {\r\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\r\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\r\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, RemoveFunction, SnapshotOpenOptions, StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\r\n} from \"@itwin/core-common\";\r\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\r\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\r\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\r\n\r\n/**\r\n * Options for [[IpcHost.startup]]\r\n * @public\r\n */\r\nexport interface IpcHostOpts {\r\n iModelHost?: IModelHostOptions;\r\n ipcHost?: {\r\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\r\n socket?: IpcSocketBackend;\r\n\r\n /** don't send stack information on exceptions */\r\n exceptions?: {\r\n noStack?: boolean;\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\r\n * @note if either end terminates, the other must too.\r\n * @public\r\n */\r\nexport class IpcHost {\r\n public static noStack = false;\r\n private static _ipc: IpcSocketBackend | undefined;\r\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\r\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\r\n public static get isValid(): boolean { return undefined !== this._ipc; }\r\n\r\n /**\r\n * Send a message to the frontend over an Ipc channel.\r\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\r\n * @param data The content of the message.\r\n */\r\n public static send(channel: string, ...data: any[]): void {\r\n this.ipc.send(iTwinChannel(channel), ...data);\r\n }\r\n\r\n /**\r\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\r\n * @param channel The name of the channel for this handler.\r\n * @param handler A function that supplies the implementation for `channel`\r\n * @note returns A function to call to remove the handler.\r\n */\r\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\r\n return this.ipc.handle(iTwinChannel(channel), handler);\r\n }\r\n /**\r\n * Establish a handler to receive messages sent via [[IpcApp.send]].\r\n * @param channel The name of the channel for the messages.\r\n * @param listener A function called when messages are sent over `channel`\r\n * @note returns A function to call to remove the listener.\r\n */\r\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\r\n return this.ipc.addListener(iTwinChannel(channel), listener);\r\n }\r\n /**\r\n * Remove a previously registered listener\r\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\r\n * @param listener The function passed to [[addListener]]\r\n */\r\n public static removeListener(channel: string, listener: IpcListener): void {\r\n this.ipc.removeListener(iTwinChannel(channel), listener);\r\n }\r\n\r\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\r\n if (this.isValid)\r\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\r\n }\r\n\r\n /** @internal */\r\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\r\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\r\n }\r\n\r\n /** @internal */\r\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\r\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\r\n }\r\n\r\n /** @internal */\r\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\r\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\r\n }\r\n\r\n /**\r\n * Start the backend of an Ipc app.\r\n * @param opt\r\n * @note this method calls [[IModelHost.startup]] internally.\r\n */\r\n public static async startup(opt?: IpcHostOpts): Promise<void> {\r\n this._ipc = opt?.ipcHost?.socket;\r\n if (opt?.ipcHost?.exceptions?.noStack)\r\n this.noStack = true;\r\n\r\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\r\n IpcAppHandler.register();\r\n }\r\n\r\n await IModelHost.startup(opt?.iModelHost);\r\n }\r\n\r\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\r\n public static async shutdown(): Promise<void> {\r\n this._ipc = undefined;\r\n await IModelHost.shutdown();\r\n }\r\n}\r\n\r\n/**\r\n * Base class for all implementations of an Ipc interface.\r\n *\r\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\r\n * ```ts\r\n * class MyHandler extends IpcHandler implements MyInterface\r\n * ```\r\n * to ensure all methods and signatures are correct.\r\n *\r\n * Then, call `MyClass.register` at startup to connect your class to your channel.\r\n * @public\r\n */\r\nexport abstract class IpcHandler {\r\n /**\r\n * All subclasses *must* implement this method to specify their channel name.\r\n *\r\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\r\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\r\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\r\n */\r\n public abstract get channelName(): string;\r\n\r\n /**\r\n * Register this class as the handler for methods on its channel. This static method creates a new instance\r\n * that becomes the handler and is `this` when its methods are called.\r\n * @returns A function that can be called to remove the handler.\r\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\r\n */\r\n public static register(): RemoveFunction {\r\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\r\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\r\n\r\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\r\n try {\r\n if (prohibitedFunctions.includes(funcName))\r\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\r\n\r\n const func = (impl as any)[funcName];\r\n if (typeof func !== \"function\")\r\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\r\n\r\n return { result: await func.call(impl, ...args) };\r\n } catch (err: unknown) {\r\n\r\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\r\n return { error: err as any };\r\n\r\n const ret = { error: { ...err } };\r\n ret.error.message = err.message; // NB: .message, and .stack members of Error are not enumerable, so spread operator above does not copy them.\r\n if (!IpcHost.noStack)\r\n ret.error.stack = err.stack;\r\n\r\n if (err instanceof BentleyError) {\r\n ret.error.iTwinErrorId = err.iTwinErrorId;\r\n if (err.hasMetaData)\r\n ret.error.loggingMetadata = err.loggingMetadata;\r\n delete ret.error._metaData;\r\n }\r\n return ret;\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Implementation of IpcAppFunctions\r\n */\r\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\r\n public get channelName() { return ipcAppChannels.functions; }\r\n\r\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\r\n\r\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\r\n switch (level) {\r\n case LogLevel.Error:\r\n Logger.logError(category, message, metaData);\r\n break;\r\n case LogLevel.Info:\r\n Logger.logInfo(category, message, metaData);\r\n break;\r\n case LogLevel.Trace:\r\n Logger.logTrace(category, message, metaData);\r\n break;\r\n case LogLevel.Warning:\r\n Logger.logWarning(category, message, metaData);\r\n break;\r\n }\r\n }\r\n\r\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\r\n return cancelTileContentRequests(tokenProps, contentIds);\r\n }\r\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\r\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\r\n }\r\n public async openBriefcase(args: OpenBriefcaseProps): Promise<IModelConnectionProps> {\r\n const db = await BriefcaseDb.open(args);\r\n return db.toJSON();\r\n }\r\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\r\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\r\n }\r\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\r\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\r\n }\r\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\r\n let resolvedFileName: string | undefined = filePath;\r\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\r\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\r\n if (!resolvedFileName)\r\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\r\n }\r\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\r\n }\r\n public async closeIModel(key: string): Promise<void> {\r\n IModelDb.findByKey(key).close();\r\n }\r\n public async saveChanges(key: string, description?: string): Promise<void> {\r\n IModelDb.findByKey(key).saveChanges(description);\r\n }\r\n public async abandonChanges(key: string): Promise<void> {\r\n IModelDb.findByKey(key).abandonChanges();\r\n }\r\n public async hasPendingTxns(key: string): Promise<boolean> {\r\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\r\n }\r\n\r\n public async isUndoPossible(key: string): Promise<boolean> {\r\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\r\n }\r\n public async isRedoPossible(key: string): Promise<boolean> {\r\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\r\n }\r\n public async getUndoString(key: string): Promise<string> {\r\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\r\n }\r\n public async getRedoString(key: string): Promise<string> {\r\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\r\n }\r\n\r\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\r\n const iModelDb = BriefcaseDb.findByKey(key);\r\n\r\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\r\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\r\n\r\n let onProgress: ProgressFunction | undefined;\r\n if (options?.reportProgress) {\r\n const progressCallback: ProgressFunction = (loaded, total) => {\r\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\r\n return checkAbort();\r\n };\r\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\r\n } else if (options?.enableCancellation) {\r\n onProgress = checkAbort;\r\n }\r\n\r\n try {\r\n await iModelDb.pullChanges({ toIndex, onProgress });\r\n } finally {\r\n this._iModelKeyToPullStatus.delete(key);\r\n }\r\n\r\n return iModelDb.changeset as ChangesetIndexAndId;\r\n }\r\n public async cancelPullChangesRequest(key: string): Promise<void> {\r\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\r\n }\r\n\r\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\r\n const iModelDb = BriefcaseDb.findByKey(key);\r\n await iModelDb.pushChanges({ description });\r\n return iModelDb.changeset as ChangesetIndexAndId;\r\n }\r\n\r\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\r\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\r\n if (val.error)\r\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\r\n assert(undefined !== val.result);\r\n return val.result;\r\n }\r\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\r\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\r\n }\r\n\r\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\r\n return IModelDb.findByKey(key)[_nativeDb].reverseTxns(numOperations);\r\n }\r\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\r\n return IModelDb.findByKey(key)[_nativeDb].reverseAll();\r\n }\r\n public async reinstateTxn(key: string): Promise<IModelStatus> {\r\n return IModelDb.findByKey(key)[_nativeDb].reinstateTxn();\r\n }\r\n public async restartTxnSession(key: string): Promise<void> {\r\n return IModelDb.findByKey(key)[_nativeDb].restartTxnSession();\r\n }\r\n\r\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\r\n return IModelNative.platform.queryConcurrency(pool);\r\n }\r\n}\r\n\r\n/**\r\n * Prevents progress callback being called more frequently when provided interval.\r\n * @internal\r\n */\r\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\r\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\r\n let nextTime = Date.now() + interval;\r\n const progressCallback: ProgressFunction = (loaded, total) => {\r\n const now = Date.now();\r\n if (loaded >= total || now >= nextTime) {\r\n nextTime = now + interval;\r\n return func(loaded, total);\r\n }\r\n return checkAbort();\r\n };\r\n\r\n return progressCallback;\r\n}\r\n"]}