@itwin/core-backend 5.0.0-dev.99 → 5.0.0
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.
- package/CHANGELOG.md +109 -1
- package/lib/cjs/BackendHubAccess.d.ts +1 -1
- package/lib/cjs/BackendHubAccess.js +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +10 -2
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +12 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CatalogDb.d.ts +103 -0
- package/lib/cjs/CatalogDb.d.ts.map +1 -0
- package/lib/cjs/CatalogDb.js +271 -0
- package/lib/cjs/CatalogDb.js.map +1 -0
- package/lib/cjs/Category.d.ts +41 -4
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +77 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +12 -10
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +17 -41
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +1 -1
- package/lib/cjs/ClassRegistry.js +1 -1
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +104 -20
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +157 -46
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +1 -1
- package/lib/cjs/CodeSpecs.js +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +9 -4
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +30 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +4 -4
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +4 -4
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +6 -6
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +4 -4
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +217 -61
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +561 -60
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +8 -8
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +8 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/Entity.d.ts +52 -8
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +63 -5
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +54 -8
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js +158 -59
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +42 -54
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +164 -93
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +16 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +9 -3
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +20 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +30 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +64 -28
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +115 -27
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +4 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +1 -1
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +6 -5
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +1 -1
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.d.ts +2 -2
- package/lib/cjs/TextAnnotationElement.js +2 -2
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +4 -4
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +2 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +114 -14
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +222 -14
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js +3 -3
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +27 -27
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +1 -1
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +21 -1
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +4 -4
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/cjs/internal/ElementLRUCache.js +120 -0
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
- package/lib/cjs/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
- package/lib/cjs/internal/HubMock.d.ts.map +1 -0
- package/lib/cjs/{HubMock.js → internal/HubMock.js} +22 -11
- package/lib/cjs/internal/HubMock.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +2 -2
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +3 -3
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +2 -16
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +35 -104
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +3 -3
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +6 -13
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +2 -7
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/lib/esm/BackendHubAccess.d.ts +1 -1
- package/lib/esm/BackendHubAccess.js +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +10 -2
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +12 -0
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CatalogDb.d.ts +103 -0
- package/lib/esm/CatalogDb.d.ts.map +1 -0
- package/lib/esm/CatalogDb.js +267 -0
- package/lib/esm/CatalogDb.js.map +1 -0
- package/lib/esm/Category.d.ts +41 -4
- package/lib/esm/Category.d.ts.map +1 -1
- package/lib/esm/Category.js +77 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/CheckpointManager.d.ts +12 -10
- package/lib/esm/CheckpointManager.d.ts.map +1 -1
- package/lib/esm/CheckpointManager.js +18 -42
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/ClassRegistry.d.ts +1 -1
- package/lib/esm/ClassRegistry.js +1 -1
- package/lib/esm/ClassRegistry.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +104 -20
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js +157 -46
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +1 -1
- package/lib/esm/CodeSpecs.js +1 -1
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +9 -4
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +30 -3
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.d.ts +4 -4
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +4 -4
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSchemaXmlContext.d.ts +1 -1
- package/lib/esm/ECSchemaXmlContext.js +1 -1
- package/lib/esm/ECSchemaXmlContext.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +6 -6
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +4 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +217 -61
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +564 -63
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +8 -8
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +8 -8
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/Entity.d.ts +52 -8
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +63 -5
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/ExportGraphics.d.ts +54 -8
- package/lib/esm/ExportGraphics.d.ts.map +1 -1
- package/lib/esm/ExportGraphics.js +156 -58
- package/lib/esm/ExportGraphics.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +42 -54
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +167 -96
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts +1 -1
- package/lib/esm/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/esm/IModelElementCloneContext.js +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +16 -3
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +9 -3
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/Material.d.ts +20 -1
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +31 -2
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +64 -28
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +116 -28
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/NativeHost.d.ts.map +1 -1
- package/lib/esm/NativeHost.js +4 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts +1 -1
- package/lib/esm/SQLiteDb.d.ts.map +1 -1
- package/lib/esm/SQLiteDb.js +6 -5
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/SqliteStatement.d.ts +1 -1
- package/lib/esm/SqliteStatement.d.ts.map +1 -1
- package/lib/esm/SqliteStatement.js +1 -1
- package/lib/esm/SqliteStatement.js.map +1 -1
- package/lib/esm/TextAnnotationElement.d.ts +2 -2
- package/lib/esm/TextAnnotationElement.js +2 -2
- package/lib/esm/TextAnnotationElement.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +4 -4
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +2 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +114 -14
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +223 -15
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStateHydrator.js +3 -3
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +28 -28
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/core-backend.d.ts +1 -1
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +21 -1
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +5 -5
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/esm/internal/ElementLRUCache.js +116 -0
- package/lib/esm/internal/ElementLRUCache.js.map +1 -0
- package/lib/esm/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
- package/lib/esm/internal/HubMock.d.ts.map +1 -0
- package/lib/esm/{HubMock.js → internal/HubMock.js} +22 -11
- package/lib/esm/internal/HubMock.js.map +1 -0
- package/lib/esm/internal/Symbols.d.ts +2 -2
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +2 -2
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +2 -16
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js +36 -100
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +3 -3
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts +2 -2
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
- package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +212 -0
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts +6 -2
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +27 -6
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.js +1 -1
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
- package/lib/esm/test/TestUtils.d.ts +1 -1
- package/lib/esm/test/TestUtils.d.ts.map +1 -1
- package/lib/esm/test/TestUtils.js +1 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js +4 -4
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -23
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js +4 -3
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +51 -13
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +58 -41
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js +49 -1
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/HubMock.test.js +1 -1
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.d.ts +2 -0
- package/lib/esm/test/standalone/IModelLimits.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/IModelLimits.test.js +103 -0
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -0
- package/lib/esm/test/standalone/IModelWrite.test.js +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +25 -5
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js +4 -3
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +6 -13
- package/lib/esm/workspace/Workspace.d.ts.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.d.ts +2 -7
- package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +13 -13
- package/lib/cjs/HubMock.d.ts.map +0 -1
- package/lib/cjs/HubMock.js.map +0 -1
- package/lib/esm/HubMock.d.ts.map +0 -1
- package/lib/esm/HubMock.js.map +0 -1
- package/lib/esm/test/CloudSqliteMock.d.ts +0 -37
- package/lib/esm/test/CloudSqliteMock.d.ts.map +0 -1
- package/lib/esm/test/CloudSqliteMock.js +0 -117
- package/lib/esm/test/CloudSqliteMock.js.map +0 -1
package/lib/esm/IModelDb.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import * as fs from "fs";
|
|
9
9
|
import { join } from "path";
|
|
10
10
|
import * as touch from "touch";
|
|
11
|
-
import { assert, BeEvent, BentleyStatus, ChangeSetStatus, DbChangeStage, DbConflictCause, DbConflictResolution, DbResult, Guid, Id64, IModelStatus, JsonUtils, Logger, LogLevel,
|
|
12
|
-
import { BriefcaseIdValue, Code, DomainOptions, ECJsNames, ECSqlReader, EntityMetaData, FontMap, IModel, IModelError, IModelNotFoundResponse, ProfileOptions, QueryRowFormat, SchemaState, ViewStoreRpc
|
|
11
|
+
import { assert, BeEvent, BentleyStatus, ChangeSetStatus, DbChangeStage, DbConflictCause, DbConflictResolution, DbResult, Guid, Id64, IModelStatus, JsonUtils, Logger, LogLevel, LRUMap, OpenMode } from "@itwin/core-bentley";
|
|
12
|
+
import { BriefcaseIdValue, Code, DomainOptions, ECJsNames, ECSqlReader, EntityMetaData, FontMap, IModel, IModelError, IModelNotFoundResponse, ProfileOptions, QueryRowFormat, SchemaState, ViewStoreRpc } from "@itwin/core-common";
|
|
13
13
|
import { Range2d, Range3d } from "@itwin/core-geometry";
|
|
14
14
|
import { BackendLoggerCategory } from "./BackendLoggerCategory";
|
|
15
15
|
import { BriefcaseManager } from "./BriefcaseManager";
|
|
@@ -44,9 +44,10 @@ import { SettingsImpl } from "./internal/workspace/SettingsImpl";
|
|
|
44
44
|
import { IModelNative } from "./internal/NativePlatform";
|
|
45
45
|
import { createNoOpLockControl } from "./internal/NoLocks";
|
|
46
46
|
import { createIModelDbFonts } from "./internal/IModelDbFontsImpl";
|
|
47
|
-
import { _close, _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
|
|
47
|
+
import { _cache, _close, _hubAccess, _nativeDb, _releaseAllLocks } from "./internal/Symbols";
|
|
48
48
|
import { SchemaContext, SchemaJsonLocater } from "@itwin/ecschema-metadata";
|
|
49
49
|
import { SchemaMap } from "./Schema";
|
|
50
|
+
import { ElementLRUCache } from "./internal/ElementLRUCache";
|
|
50
51
|
// spell:ignore fontid fontmap
|
|
51
52
|
const loggerCategory = BackendLoggerCategory.IModelDb;
|
|
52
53
|
/** @internal */
|
|
@@ -106,7 +107,7 @@ export class IModelDb extends IModel {
|
|
|
106
107
|
_jsClassMap;
|
|
107
108
|
_schemaMap;
|
|
108
109
|
_schemaContext;
|
|
109
|
-
/** @deprecated in 5.0.0. Use [[fonts]]. */
|
|
110
|
+
/** @deprecated in 5.0.0 - will not be removed until after 2026-06-13. Use [[fonts]]. */
|
|
110
111
|
_fontMap; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
111
112
|
_fonts = createIModelDbFonts(this);
|
|
112
113
|
_workspace;
|
|
@@ -133,6 +134,13 @@ export class IModelDb extends IModel {
|
|
|
133
134
|
this._workspace = constructWorkspace(new IModelSettings());
|
|
134
135
|
return this._workspace;
|
|
135
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* get the cloud container for this iModel, if it was opened from one
|
|
139
|
+
* @beta
|
|
140
|
+
*/
|
|
141
|
+
get cloudContainer() {
|
|
142
|
+
return this[_nativeDb].cloudContainer;
|
|
143
|
+
}
|
|
136
144
|
/** Acquire the exclusive schema lock on this iModel.
|
|
137
145
|
* @note: To acquire the schema lock, all other briefcases must first release *all* their locks. No other briefcases
|
|
138
146
|
* will be able to acquire *any* locks while the schema lock is held.
|
|
@@ -155,7 +163,7 @@ export class IModelDb extends IModel {
|
|
|
155
163
|
restartDefaultTxn() {
|
|
156
164
|
this[_nativeDb].restartDefaultTxn();
|
|
157
165
|
}
|
|
158
|
-
/** @deprecated in 5.0.0. Use [[fonts]]. */
|
|
166
|
+
/** @deprecated in 5.0.0 - will not be removed until after 2026-06-13. Use [[fonts]]. */
|
|
159
167
|
get fontMap() {
|
|
160
168
|
return this._fontMap ?? (this._fontMap = new FontMap(this[_nativeDb].readFontMap())); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
161
169
|
}
|
|
@@ -332,7 +340,7 @@ export class IModelDb extends IModel {
|
|
|
332
340
|
* @returns the value returned by `callback`.
|
|
333
341
|
* @see [[withStatement]]
|
|
334
342
|
* @public
|
|
335
|
-
* @deprecated in 4.11. Use [[createQueryReader]] instead.
|
|
343
|
+
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] instead.
|
|
336
344
|
*/
|
|
337
345
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
338
346
|
withPreparedStatement(ecsql, callback, logErrors = true) {
|
|
@@ -364,7 +372,7 @@ export class IModelDb extends IModel {
|
|
|
364
372
|
* @returns the value returned by `callback`.
|
|
365
373
|
* @see [[withPreparedStatement]]
|
|
366
374
|
* @public
|
|
367
|
-
* @deprecated in 4.11. Use [[createQueryReader]] instead.
|
|
375
|
+
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [[createQueryReader]] instead.
|
|
368
376
|
*/
|
|
369
377
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
370
378
|
withStatement(ecsql, callback, logErrors = true) {
|
|
@@ -569,6 +577,8 @@ export class IModelDb extends IModel {
|
|
|
569
577
|
this._jsClassMap = undefined;
|
|
570
578
|
this._schemaMap = undefined;
|
|
571
579
|
this._schemaContext = undefined;
|
|
580
|
+
this.elements[_cache].clear();
|
|
581
|
+
this.models[_cache].clear();
|
|
572
582
|
}
|
|
573
583
|
/** Update the project extents for this iModel.
|
|
574
584
|
* <p><em>Example:</em>
|
|
@@ -624,6 +634,7 @@ export class IModelDb extends IModel {
|
|
|
624
634
|
* @note This will not delete Txns that have already been saved, even if they have not yet been pushed.
|
|
625
635
|
*/
|
|
626
636
|
abandonChanges() {
|
|
637
|
+
this.clearCaches();
|
|
627
638
|
this[_nativeDb].abandonChanges();
|
|
628
639
|
}
|
|
629
640
|
/**
|
|
@@ -637,11 +648,14 @@ export class IModelDb extends IModel {
|
|
|
637
648
|
performCheckpoint() {
|
|
638
649
|
if (!this.isReadonly) {
|
|
639
650
|
this.saveChanges();
|
|
651
|
+
this.clearCaches();
|
|
652
|
+
this[_nativeDb].concurrentQueryShutdown();
|
|
653
|
+
this[_nativeDb].clearECDbCache();
|
|
640
654
|
this[_nativeDb].performCheckpoint();
|
|
641
655
|
}
|
|
642
656
|
}
|
|
643
657
|
/** @internal
|
|
644
|
-
* @deprecated in 4.8. Use `txns.reverseTxns`.
|
|
658
|
+
* @deprecated in 4.8 - will not be removed until after 2026-06-13. Use `txns.reverseTxns`.
|
|
645
659
|
*/
|
|
646
660
|
reverseTxns(numOperations) {
|
|
647
661
|
return this[_nativeDb].reverseTxns(numOperations);
|
|
@@ -867,7 +881,7 @@ export class IModelDb extends IModel {
|
|
|
867
881
|
}
|
|
868
882
|
/** The registry of entity metadata for this iModel.
|
|
869
883
|
* @internal
|
|
870
|
-
* @deprecated in 5.0. Please use `schemaContext` from the `iModel` instead.
|
|
884
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `schemaContext` from the `iModel` instead.
|
|
871
885
|
*
|
|
872
886
|
* @example
|
|
873
887
|
* ```typescript
|
|
@@ -903,7 +917,7 @@ export class IModelDb extends IModel {
|
|
|
903
917
|
}
|
|
904
918
|
/**
|
|
905
919
|
* Gets the context that allows accessing the metadata (ecschema-metadata package) of this iModel
|
|
906
|
-
* @
|
|
920
|
+
* @public @preview
|
|
907
921
|
*/
|
|
908
922
|
get schemaContext() {
|
|
909
923
|
if (this._schemaContext === undefined) {
|
|
@@ -927,7 +941,7 @@ export class IModelDb extends IModel {
|
|
|
927
941
|
* @param sql The ECSQL statement to prepare
|
|
928
942
|
* @param logErrors Determines if error will be logged if statement fail to prepare
|
|
929
943
|
* @throws [[IModelError]] if there is a problem preparing the statement.
|
|
930
|
-
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
944
|
+
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
931
945
|
*/
|
|
932
946
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
933
947
|
prepareStatement(sql, logErrors = true) {
|
|
@@ -939,7 +953,7 @@ export class IModelDb extends IModel {
|
|
|
939
953
|
/** Prepare an ECSQL statement.
|
|
940
954
|
* @param sql The ECSQL statement to prepare
|
|
941
955
|
* @returns `undefined` if there is a problem preparing the statement.
|
|
942
|
-
* @deprecated in 4.11. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
956
|
+
* @deprecated in 4.11 - will not be removed until after 2026-06-13. Use [IModelDb.createQueryReader]($backend) or [ECDb.createQueryReader]($backend) to query.
|
|
943
957
|
*/
|
|
944
958
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
945
959
|
tryPrepareStatement(sql) {
|
|
@@ -969,9 +983,27 @@ export class IModelDb extends IModel {
|
|
|
969
983
|
return ClassRegistry.getClass(classFullName, this);
|
|
970
984
|
}
|
|
971
985
|
}
|
|
986
|
+
/** Constructs a ResolveInstanceKeyArgs from given parameters
|
|
987
|
+
* @throws [[IModelError]] if the combination of supplied parameters is invalid.
|
|
988
|
+
* @internal
|
|
989
|
+
*/
|
|
990
|
+
getInstanceArgs(instanceId, baseClassName, federationGuid, code) {
|
|
991
|
+
if (instanceId && baseClassName) {
|
|
992
|
+
return { partialKey: { id: instanceId, baseClassName } };
|
|
993
|
+
}
|
|
994
|
+
else if (federationGuid) {
|
|
995
|
+
return { federationGuid };
|
|
996
|
+
}
|
|
997
|
+
else if (code) {
|
|
998
|
+
return { code };
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
throw new IModelError(IModelStatus.InvalidId, "Either instanceId and baseClassName or federationGuid or code must be specified");
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
972
1004
|
/** Get metadata for a class. This method will load the metadata from the iModel into the cache as a side-effect, if necessary.
|
|
973
1005
|
* @throws [[IModelError]] if the metadata cannot be found nor loaded.
|
|
974
|
-
* @deprecated in 5.0. Please use `getSchemaItem` from `SchemaContext` class instead.
|
|
1006
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `getSchemaItem` from `SchemaContext` class instead.
|
|
975
1007
|
*
|
|
976
1008
|
* @example
|
|
977
1009
|
* * ```typescript
|
|
@@ -997,7 +1029,7 @@ export class IModelDb extends IModel {
|
|
|
997
1029
|
return metadata;
|
|
998
1030
|
}
|
|
999
1031
|
/** Identical to [[getMetaData]], except it returns `undefined` instead of throwing an error if the metadata cannot be found nor loaded.
|
|
1000
|
-
* @deprecated in 5.0. Please use `getSchemaItem` from `SchemaContext` class instead.
|
|
1032
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `getSchemaItem` from `SchemaContext` class instead.
|
|
1001
1033
|
*
|
|
1002
1034
|
* @example
|
|
1003
1035
|
* * ```typescript
|
|
@@ -1025,7 +1057,7 @@ export class IModelDb extends IModel {
|
|
|
1025
1057
|
* @param func The callback to be invoked on each property
|
|
1026
1058
|
* @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.
|
|
1027
1059
|
* @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.
|
|
1028
|
-
* @deprecated in 5.0. Please use `forEachProperty` instead.
|
|
1060
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `forEachProperty` instead.
|
|
1029
1061
|
*
|
|
1030
1062
|
* @example
|
|
1031
1063
|
* ```typescript
|
|
@@ -1051,7 +1083,7 @@ export class IModelDb extends IModel {
|
|
|
1051
1083
|
* @param func The callback to be invoked on each property
|
|
1052
1084
|
* @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.
|
|
1053
1085
|
* @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.
|
|
1054
|
-
* @deprecated in 5.0. Use `forEachProperty` from `SchemaContext` class instead.
|
|
1086
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `forEachProperty` from `SchemaContext` class instead.
|
|
1055
1087
|
*
|
|
1056
1088
|
* @example
|
|
1057
1089
|
* ```typescript
|
|
@@ -1081,7 +1113,7 @@ export class IModelDb extends IModel {
|
|
|
1081
1113
|
}
|
|
1082
1114
|
/**
|
|
1083
1115
|
* @internal
|
|
1084
|
-
* @deprecated in 5.0. Please use `schemaContext` from `iModel` instead to get metadata.
|
|
1116
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `schemaContext` from `iModel` instead to get metadata.
|
|
1085
1117
|
*/
|
|
1086
1118
|
loadMetaData(classFullName) {
|
|
1087
1119
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
@@ -1446,11 +1478,13 @@ function processSchemaWriteStatus(status) {
|
|
|
1446
1478
|
/** @public */
|
|
1447
1479
|
(function (IModelDb) {
|
|
1448
1480
|
/** The collection of models in an [[IModelDb]].
|
|
1449
|
-
* @public
|
|
1481
|
+
* @public @preview
|
|
1450
1482
|
*/
|
|
1451
1483
|
class Models {
|
|
1452
1484
|
_iModel;
|
|
1453
1485
|
/** @internal */
|
|
1486
|
+
[_cache] = new LRUMap(500);
|
|
1487
|
+
/** @internal */
|
|
1454
1488
|
constructor(_iModel) {
|
|
1455
1489
|
this._iModel = _iModel;
|
|
1456
1490
|
}
|
|
@@ -1460,7 +1494,10 @@ function processSchemaWriteStatus(status) {
|
|
|
1460
1494
|
* @see tryGetModelProps
|
|
1461
1495
|
*/
|
|
1462
1496
|
getModelProps(id) {
|
|
1463
|
-
|
|
1497
|
+
const model = this.tryGetModelProps(id);
|
|
1498
|
+
if (undefined === model)
|
|
1499
|
+
throw new IModelError(IModelStatus.NotFound, `Model=${id}`);
|
|
1500
|
+
return model;
|
|
1464
1501
|
}
|
|
1465
1502
|
/** Get the ModelProps with the specified identifier.
|
|
1466
1503
|
* @param modelId The Model identifier.
|
|
@@ -1470,7 +1507,25 @@ function processSchemaWriteStatus(status) {
|
|
|
1470
1507
|
* @see getModelProps
|
|
1471
1508
|
*/
|
|
1472
1509
|
tryGetModelProps(id) {
|
|
1473
|
-
|
|
1510
|
+
try {
|
|
1511
|
+
if (IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
|
|
1512
|
+
return this._iModel[_nativeDb].getModel({ id });
|
|
1513
|
+
}
|
|
1514
|
+
const cachedMdl = this[_cache].get(id);
|
|
1515
|
+
if (cachedMdl) {
|
|
1516
|
+
return cachedMdl;
|
|
1517
|
+
}
|
|
1518
|
+
const options = { useJsNames: true };
|
|
1519
|
+
const instanceKey = this.resolveModelKey({ id });
|
|
1520
|
+
const rawInstance = this._iModel[_nativeDb].readInstance(instanceKey, options);
|
|
1521
|
+
const classDef = this._iModel.getJsClass(rawInstance.classFullName);
|
|
1522
|
+
const modelProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel });
|
|
1523
|
+
this[_cache].set(id, modelProps);
|
|
1524
|
+
return modelProps;
|
|
1525
|
+
}
|
|
1526
|
+
catch {
|
|
1527
|
+
return undefined;
|
|
1528
|
+
}
|
|
1474
1529
|
}
|
|
1475
1530
|
/** Query for the last modified time for a [[Model]].
|
|
1476
1531
|
* @param modelId The Id of the model.
|
|
@@ -1517,32 +1572,22 @@ function processSchemaWriteStatus(status) {
|
|
|
1517
1572
|
return model; // modelClass was not specified, cannot call instanceof to validate
|
|
1518
1573
|
return model instanceof modelClass ? model : undefined;
|
|
1519
1574
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
* @internal
|
|
1526
|
-
*/
|
|
1527
|
-
getModelJson(modelIdArg) {
|
|
1528
|
-
const modelJson = this.tryGetModelJson(modelIdArg);
|
|
1529
|
-
if (undefined === modelJson) {
|
|
1530
|
-
throw new IModelError(IModelStatus.NotFound, `Model=(id: ${modelIdArg.id}, code: ${modelIdArg.code})`);
|
|
1575
|
+
resolveModelKey(modelIdArg) {
|
|
1576
|
+
const baseClassName = "BisCore:Model";
|
|
1577
|
+
let args;
|
|
1578
|
+
if (modelIdArg.id) {
|
|
1579
|
+
args = { partialKey: { id: modelIdArg.id, baseClassName } };
|
|
1531
1580
|
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
* @see getModelJson
|
|
1538
|
-
*/
|
|
1539
|
-
tryGetModelJson(modelIdArg) {
|
|
1540
|
-
try {
|
|
1541
|
-
return this._iModel[_nativeDb].getModel(modelIdArg);
|
|
1581
|
+
else if (modelIdArg.code) {
|
|
1582
|
+
const modelId = this._iModel.elements.getElementProps({ code: modelIdArg.code }).id;
|
|
1583
|
+
if (!modelId)
|
|
1584
|
+
throw new IModelError(IModelStatus.NotFound, `Model not found with code: [spec:${modelIdArg.code.spec}, scope:${modelIdArg.code.scope}, value:${modelIdArg.code.value}])`);
|
|
1585
|
+
args = { partialKey: { id: modelId, baseClassName } };
|
|
1542
1586
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1587
|
+
else {
|
|
1588
|
+
throw new IModelError(IModelStatus.InvalidId, `Invalid model identifier: ${JSON.stringify(modelIdArg)}`);
|
|
1545
1589
|
}
|
|
1590
|
+
return this._iModel[_nativeDb].resolveInstanceKey(args);
|
|
1546
1591
|
}
|
|
1547
1592
|
/** Get the sub-model of the specified Element.
|
|
1548
1593
|
* See [[IModelDb.Elements.queryElementIdByCode]] for more on how to find an element by Code.
|
|
@@ -1595,6 +1640,8 @@ function processSchemaWriteStatus(status) {
|
|
|
1595
1640
|
*/
|
|
1596
1641
|
updateModel(props) {
|
|
1597
1642
|
try {
|
|
1643
|
+
if (props.id)
|
|
1644
|
+
this[_cache].delete(props.id);
|
|
1598
1645
|
this._iModel[_nativeDb].updateModel(props);
|
|
1599
1646
|
}
|
|
1600
1647
|
catch (err) {
|
|
@@ -1611,6 +1658,7 @@ function processSchemaWriteStatus(status) {
|
|
|
1611
1658
|
* @see [[TxnManager.onModelGeometryChanged]] for the event emitted in response to such a change.
|
|
1612
1659
|
*/
|
|
1613
1660
|
updateGeometryGuid(modelId) {
|
|
1661
|
+
this._iModel.models[_cache].delete(modelId);
|
|
1614
1662
|
const error = this._iModel[_nativeDb].updateModelGeometryGuid(modelId);
|
|
1615
1663
|
if (error !== IModelStatus.Success)
|
|
1616
1664
|
throw new IModelError(error, `updating geometry guid for model ${modelId}`);
|
|
@@ -1622,6 +1670,7 @@ function processSchemaWriteStatus(status) {
|
|
|
1622
1670
|
deleteModel(ids) {
|
|
1623
1671
|
Id64.toIdSet(ids).forEach((id) => {
|
|
1624
1672
|
try {
|
|
1673
|
+
this[_cache].delete(id);
|
|
1625
1674
|
this._iModel[_nativeDb].deleteModel(id);
|
|
1626
1675
|
}
|
|
1627
1676
|
catch (err) {
|
|
@@ -1655,11 +1704,13 @@ function processSchemaWriteStatus(status) {
|
|
|
1655
1704
|
}
|
|
1656
1705
|
IModelDb.Models = Models;
|
|
1657
1706
|
/** The collection of elements in an [[IModelDb]].
|
|
1658
|
-
* @public
|
|
1707
|
+
* @public @preview
|
|
1659
1708
|
*/
|
|
1660
1709
|
class Elements {
|
|
1661
1710
|
_iModel;
|
|
1662
1711
|
/** @internal */
|
|
1712
|
+
[_cache] = new ElementLRUCache();
|
|
1713
|
+
/** @internal */
|
|
1663
1714
|
constructor(_iModel) {
|
|
1664
1715
|
this._iModel = _iModel;
|
|
1665
1716
|
}
|
|
@@ -1675,50 +1726,40 @@ function processSchemaWriteStatus(status) {
|
|
|
1675
1726
|
return !stmt.nextRow() ? undefined : stmt.getValueId(0);
|
|
1676
1727
|
}) : undefined;
|
|
1677
1728
|
}
|
|
1678
|
-
/** Read element data from the iModel as JSON
|
|
1679
|
-
* @param elementIdArg a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
|
|
1680
|
-
* @returns The JSON properties of the element.
|
|
1681
|
-
* @throws [[IModelError]] if the element is not found or cannot be loaded.
|
|
1682
|
-
* @see tryGetElementJson
|
|
1683
|
-
* @internal
|
|
1684
|
-
*/
|
|
1685
|
-
getElementJson(elementId) {
|
|
1686
|
-
const elementProps = this.tryGetElementJson(elementId);
|
|
1687
|
-
if (undefined === elementProps)
|
|
1688
|
-
throw new IModelError(IModelStatus.NotFound, `reading element={id: ${elementId.id} federationGuid: ${elementId.federationGuid}, code: ${elementId.code}}`);
|
|
1689
|
-
return elementProps;
|
|
1690
|
-
}
|
|
1691
|
-
/** Read element data from the iModel as JSON
|
|
1692
|
-
* @param loadProps - a json string with the identity of the element to load. Must have one of "id", "federationGuid", or "code".
|
|
1693
|
-
* @returns The JSON properties of the element or `undefined` if the element is not found.
|
|
1694
|
-
* @throws [[IModelError]] if the element exists, but cannot be loaded.
|
|
1695
|
-
* @see getElementJson
|
|
1696
|
-
*/
|
|
1697
|
-
tryGetElementJson(loadProps) {
|
|
1698
|
-
try {
|
|
1699
|
-
return this._iModel[_nativeDb].getElement(loadProps);
|
|
1700
|
-
}
|
|
1701
|
-
catch {
|
|
1702
|
-
return undefined;
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
1729
|
/** Get properties of an Element by Id, FederationGuid, or Code
|
|
1706
1730
|
* @throws [[IModelError]] if the element is not found or cannot be loaded.
|
|
1707
1731
|
* @see tryGetElementProps
|
|
1708
1732
|
*/
|
|
1709
1733
|
getElementProps(props) {
|
|
1734
|
+
const elProp = this.tryGetElementProps(props);
|
|
1735
|
+
if (undefined === elProp)
|
|
1736
|
+
throw new IModelError(IModelStatus.NotFound, `element not found`);
|
|
1737
|
+
return elProp;
|
|
1738
|
+
}
|
|
1739
|
+
resolveElementKey(props) {
|
|
1740
|
+
const baseClassName = "BisCore:Element";
|
|
1741
|
+
let args;
|
|
1710
1742
|
if (typeof props === "string") {
|
|
1711
|
-
|
|
1743
|
+
args = Id64.isId64(props) ? { partialKey: { id: props, baseClassName } } : { federationGuid: props };
|
|
1712
1744
|
}
|
|
1713
1745
|
else if (props instanceof Code) {
|
|
1714
|
-
|
|
1746
|
+
args = { code: props };
|
|
1715
1747
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1748
|
+
else {
|
|
1749
|
+
if (props.id) {
|
|
1750
|
+
args = { partialKey: { id: props.id, baseClassName } };
|
|
1751
|
+
}
|
|
1752
|
+
else if (props.federationGuid) {
|
|
1753
|
+
args = { federationGuid: props.federationGuid };
|
|
1754
|
+
}
|
|
1755
|
+
else if (props.code) {
|
|
1756
|
+
args = { code: props.code };
|
|
1757
|
+
}
|
|
1758
|
+
else {
|
|
1759
|
+
throw new IModelError(IModelStatus.InvalidId, "Element Id or FederationGuid or Code is required");
|
|
1760
|
+
}
|
|
1721
1761
|
}
|
|
1762
|
+
return this._iModel[_nativeDb].resolveInstanceKey(args);
|
|
1722
1763
|
}
|
|
1723
1764
|
/** Get properties of an Element by Id, FederationGuid, or Code
|
|
1724
1765
|
* @returns The properties of the element or `undefined` if the element is not found.
|
|
@@ -1726,14 +1767,32 @@ function processSchemaWriteStatus(status) {
|
|
|
1726
1767
|
* @note Useful for cases when an element may or may not exist and throwing an `Error` would be overkill.
|
|
1727
1768
|
* @see getElementProps
|
|
1728
1769
|
*/
|
|
1729
|
-
tryGetElementProps(
|
|
1730
|
-
if (typeof
|
|
1731
|
-
|
|
1770
|
+
tryGetElementProps(props) {
|
|
1771
|
+
if (typeof props === "string") {
|
|
1772
|
+
props = Id64.isId64(props) ? { id: props } : { federationGuid: props };
|
|
1732
1773
|
}
|
|
1733
|
-
else if (
|
|
1734
|
-
|
|
1774
|
+
else if (props instanceof Code) {
|
|
1775
|
+
props = { code: props };
|
|
1776
|
+
}
|
|
1777
|
+
try {
|
|
1778
|
+
if (IModelHost.configuration?.disableThinnedNativeInstanceWorkflow) {
|
|
1779
|
+
return this._iModel[_nativeDb].getElement(props);
|
|
1780
|
+
}
|
|
1781
|
+
const cachedElm = this[_cache].get(props);
|
|
1782
|
+
if (cachedElm) {
|
|
1783
|
+
return cachedElm.elProps;
|
|
1784
|
+
}
|
|
1785
|
+
const options = { ...props, useJsNames: true };
|
|
1786
|
+
const instanceKey = this.resolveElementKey(props);
|
|
1787
|
+
const rawInstance = this._iModel[_nativeDb].readInstance(instanceKey, options);
|
|
1788
|
+
const classDef = this._iModel.getJsClass(rawInstance.classFullName);
|
|
1789
|
+
const elementProps = classDef.deserialize({ row: rawInstance, iModel: this._iModel, options: { element: props } });
|
|
1790
|
+
this[_cache].set({ elProps: elementProps, loadOptions: props });
|
|
1791
|
+
return elementProps;
|
|
1792
|
+
}
|
|
1793
|
+
catch {
|
|
1794
|
+
return undefined;
|
|
1735
1795
|
}
|
|
1736
|
-
return this.tryGetElementJson(elementId);
|
|
1737
1796
|
}
|
|
1738
1797
|
/** Get an element by Id, FederationGuid, or Code
|
|
1739
1798
|
* @param elementId either the element's Id, Code, or FederationGuid, or an ElementLoadProps
|
|
@@ -1766,7 +1825,7 @@ function processSchemaWriteStatus(status) {
|
|
|
1766
1825
|
elementId = { code: elementId };
|
|
1767
1826
|
else
|
|
1768
1827
|
elementId.onlyBaseProperties = false; // we must load all properties to construct the element.
|
|
1769
|
-
const elementProps = this.
|
|
1828
|
+
const elementProps = this.tryGetElementProps(elementId);
|
|
1770
1829
|
if (undefined === elementProps)
|
|
1771
1830
|
return undefined; // no Element with that elementId found
|
|
1772
1831
|
const element = this._iModel.constructEntity(elementProps);
|
|
@@ -1830,6 +1889,11 @@ function processSchemaWriteStatus(status) {
|
|
|
1830
1889
|
*/
|
|
1831
1890
|
insertElement(elProps, options) {
|
|
1832
1891
|
try {
|
|
1892
|
+
this[_cache].delete({
|
|
1893
|
+
id: elProps.id,
|
|
1894
|
+
federationGuid: elProps.federationGuid,
|
|
1895
|
+
code: elProps.code,
|
|
1896
|
+
});
|
|
1833
1897
|
return elProps.id = this._iModel[_nativeDb].insertElement(elProps, options);
|
|
1834
1898
|
}
|
|
1835
1899
|
catch (err) {
|
|
@@ -1851,6 +1915,11 @@ function processSchemaWriteStatus(status) {
|
|
|
1851
1915
|
*/
|
|
1852
1916
|
updateElement(elProps) {
|
|
1853
1917
|
try {
|
|
1918
|
+
this[_cache].delete({
|
|
1919
|
+
id: elProps.id,
|
|
1920
|
+
federationGuid: elProps.federationGuid,
|
|
1921
|
+
code: elProps.code,
|
|
1922
|
+
});
|
|
1854
1923
|
this._iModel[_nativeDb].updateElement(elProps);
|
|
1855
1924
|
}
|
|
1856
1925
|
catch (err) {
|
|
@@ -1868,6 +1937,7 @@ function processSchemaWriteStatus(status) {
|
|
|
1868
1937
|
const iModel = this._iModel;
|
|
1869
1938
|
Id64.toIdSet(ids).forEach((id) => {
|
|
1870
1939
|
try {
|
|
1940
|
+
this[_cache].delete({ id });
|
|
1871
1941
|
iModel[_nativeDb].deleteElement(id);
|
|
1872
1942
|
}
|
|
1873
1943
|
catch (err) {
|
|
@@ -2180,7 +2250,7 @@ function processSchemaWriteStatus(status) {
|
|
|
2180
2250
|
}
|
|
2181
2251
|
IModelDb.Elements = Elements;
|
|
2182
2252
|
/** The collection of views in an [[IModelDb]].
|
|
2183
|
-
* @public
|
|
2253
|
+
* @public @preview
|
|
2184
2254
|
*/
|
|
2185
2255
|
class Views {
|
|
2186
2256
|
_iModel;
|
|
@@ -2356,7 +2426,7 @@ function processSchemaWriteStatus(status) {
|
|
|
2356
2426
|
}
|
|
2357
2427
|
/** Set the default view property the iModel.
|
|
2358
2428
|
* @param viewId The Id of the ViewDefinition to use as the default
|
|
2359
|
-
* @deprecated in 4.2.x. Avoid setting this property - it is not practical for one single view to serve the needs of the many applications
|
|
2429
|
+
* @deprecated in 4.2.x - will not be removed until after 2026-06-13. Avoid setting this property - it is not practical for one single view to serve the needs of the many applications
|
|
2360
2430
|
* that might wish to view the contents of the iModel.
|
|
2361
2431
|
*/
|
|
2362
2432
|
setDefaultViewId(viewId) {
|
|
@@ -2370,9 +2440,9 @@ function processSchemaWriteStatus(status) {
|
|
|
2370
2440
|
}
|
|
2371
2441
|
IModelDb.Views = Views;
|
|
2372
2442
|
/** Represents the current state of a pollable tile content request.
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2443
|
+
* Note: lack of a "completed" state because polling a completed request returns the content as a Uint8Array.
|
|
2444
|
+
* @internal
|
|
2445
|
+
*/
|
|
2376
2446
|
let TileContentState;
|
|
2377
2447
|
(function (TileContentState) {
|
|
2378
2448
|
TileContentState[TileContentState["New"] = 0] = "New";
|
|
@@ -2612,7 +2682,7 @@ export class BriefcaseDb extends IModelDb {
|
|
|
2612
2682
|
const file = { path: args.fileName, key: args.key };
|
|
2613
2683
|
const openMode = (args.readonly || args.watchForChanges) ? OpenMode.Readonly : OpenMode.ReadWrite;
|
|
2614
2684
|
const nativeDb = this.openDgnDb(file, openMode, undefined, args);
|
|
2615
|
-
const briefcaseDb = new
|
|
2685
|
+
const briefcaseDb = new this({ nativeDb, key: file.key ?? Guid.createValue(), openMode, briefcaseId: nativeDb.getBriefcaseId() });
|
|
2616
2686
|
// If they asked to watch for changes, set an fs.watch on the "-watch" file (only it is modified while we hold this connection.)
|
|
2617
2687
|
// Whenever there are changes, restart our defaultTxn. That loads the changes from the other connection and sends
|
|
2618
2688
|
// notifications as if they happened on this connection. Note: the watcher is called only when the backend event loop cycles.
|
|
@@ -2621,6 +2691,7 @@ export class BriefcaseDb extends IModelDb {
|
|
|
2621
2691
|
touch.sync(briefcaseDb.watchFilePathName);
|
|
2622
2692
|
// Restart default txn to trigger events when watch file is changed by some other process.
|
|
2623
2693
|
const watcher = fs.watch(briefcaseDb.watchFilePathName, { persistent: false }, () => {
|
|
2694
|
+
nativeDb.clearECDbCache();
|
|
2624
2695
|
nativeDb.restartDefaultTxn();
|
|
2625
2696
|
briefcaseDb.changeset = briefcaseDb[_nativeDb].getCurrentChangeset();
|
|
2626
2697
|
});
|
|
@@ -2960,7 +3031,7 @@ class RefreshV2CheckpointSas {
|
|
|
2960
3031
|
Logger.logInfo(BackendLoggerCategory.Authorization, "attempting to refresh sasToken for checkpoint");
|
|
2961
3032
|
try {
|
|
2962
3033
|
// this exchanges the supplied user accessToken for an expiring blob-store token to read the checkpoint.
|
|
2963
|
-
const container = iModel
|
|
3034
|
+
const container = iModel.cloudContainer;
|
|
2964
3035
|
if (!container)
|
|
2965
3036
|
throw new Error("checkpoint is not from a cloud container");
|
|
2966
3037
|
assert(undefined !== iModel.iTwinId);
|
|
@@ -3086,7 +3157,7 @@ export class SnapshotDb extends IModelDb {
|
|
|
3086
3157
|
file.key = `${nativeDb.getIModelId()}:${nativeDb.getCurrentChangeset().id}`;
|
|
3087
3158
|
}
|
|
3088
3159
|
assert(undefined !== file.key);
|
|
3089
|
-
const db = new
|
|
3160
|
+
const db = new this(nativeDb, file.key);
|
|
3090
3161
|
this.onOpened.raiseEvent(db);
|
|
3091
3162
|
return db;
|
|
3092
3163
|
}
|
|
@@ -3112,7 +3183,7 @@ export class SnapshotDb extends IModelDb {
|
|
|
3112
3183
|
snapshot._restartDefaultTxnTimer = setTimeout(() => {
|
|
3113
3184
|
snapshot.restartDefaultTxn();
|
|
3114
3185
|
}, (10 * 60) * 1000).unref(); // 10 minutes
|
|
3115
|
-
const cloudContainer = snapshot
|
|
3186
|
+
const cloudContainer = snapshot.cloudContainer;
|
|
3116
3187
|
if (cloudContainer !== undefined) {
|
|
3117
3188
|
snapshot._refreshSas = new RefreshV2CheckpointSas(cloudContainer.accessToken, checkpoint.reattachSafetySeconds);
|
|
3118
3189
|
}
|
|
@@ -3186,7 +3257,7 @@ export class StandaloneDb extends BriefcaseDb {
|
|
|
3186
3257
|
nativeDb.setITwinId(Guid.empty);
|
|
3187
3258
|
nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned);
|
|
3188
3259
|
nativeDb.saveChanges();
|
|
3189
|
-
const db = new
|
|
3260
|
+
const db = new this({ nativeDb, key: Guid.createValue(), briefcaseId: BriefcaseIdValue.Unassigned, openMode: OpenMode.ReadWrite });
|
|
3190
3261
|
db.channels.addAllowedChannel(ChannelControl.sharedChannelName);
|
|
3191
3262
|
return db;
|
|
3192
3263
|
}
|
|
@@ -3232,7 +3303,7 @@ export class StandaloneDb extends BriefcaseDb {
|
|
|
3232
3303
|
if (iTwinId !== Guid.empty) // a "standalone" iModel means it is not associated with an iTwin
|
|
3233
3304
|
throw new IModelError(IModelStatus.WrongIModel, `${filePath} is not a Standalone iModel. iTwinId=${iTwinId}`);
|
|
3234
3305
|
assert(undefined !== file.key);
|
|
3235
|
-
const db = new
|
|
3306
|
+
const db = new this({ nativeDb, key: file.key, openMode, briefcaseId: BriefcaseIdValue.Unassigned });
|
|
3236
3307
|
return db;
|
|
3237
3308
|
}
|
|
3238
3309
|
catch (error) {
|