@itwin/core-backend 5.1.0-dev.9 → 5.2.0-dev.2
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 +117 -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/BisCoreSchema.d.ts.map +1 -1
- package/lib/cjs/BisCoreSchema.js +4 -2
- package/lib/cjs/BisCoreSchema.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 +16 -0
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +67 -8
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +248 -33
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +9 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +9 -1
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js +1 -1
- 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 +4 -4
- package/lib/cjs/DisplayStyle.js +3 -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/ECSqlStatement.d.ts +15 -6
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +19 -4
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +54 -51
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +67 -52
- 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 +10 -7
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +35 -13
- 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/GeographicCRSServices.d.ts +6 -2
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +37 -26
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +124 -47
- 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 +2 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +2 -3
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js +69 -0
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +6 -4
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/Material.d.ts +4 -3
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +5 -5
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +22 -22
- package/lib/cjs/Model.js +22 -22
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +3 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +15 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +1 -1
- package/lib/cjs/SQLiteDb.js +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +25 -0
- package/lib/cjs/Schema.d.ts.map +1 -1
- package/lib/cjs/Schema.js +25 -0
- package/lib/cjs/Schema.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/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.js +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +40 -14
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +42 -14
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +110 -0
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts +51 -0
- package/lib/cjs/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/FrameGeometry.js +249 -0
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/LeaderGeometry.js +184 -0
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationElement.js +411 -0
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js +137 -0
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/cjs/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +174 -49
- package/lib/cjs/annotations/TextBlockLayout.js.map +1 -0
- package/lib/cjs/core-backend.d.ts +7 -3
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +27 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts +23 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.js +167 -3
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +22 -0
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -0
- package/lib/cjs/internal/annotations/fields.js +237 -0
- package/lib/cjs/internal/annotations/fields.js.map +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -1
- 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 +0 -1
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.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/BisCoreSchema.d.ts.map +1 -1
- package/lib/esm/BisCoreSchema.js +4 -2
- package/lib/esm/BisCoreSchema.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 +17 -1
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +67 -8
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +248 -33
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ClassRegistry.d.ts +9 -1
- package/lib/esm/ClassRegistry.d.ts.map +1 -1
- package/lib/esm/ClassRegistry.js +9 -1
- package/lib/esm/ClassRegistry.js.map +1 -1
- package/lib/esm/CloudSqlite.js +1 -1
- 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 +4 -4
- package/lib/esm/DisplayStyle.js +3 -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/ECSqlStatement.d.ts +15 -6
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +19 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.d.ts +54 -51
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +67 -52
- 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 +10 -7
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +36 -14
- 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/GeographicCRSServices.d.ts +6 -2
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +1 -1
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +37 -26
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +128 -51
- 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 +2 -3
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +2 -3
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts +36 -0
- package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js +65 -0
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -0
- package/lib/esm/LocalHub.d.ts.map +1 -1
- package/lib/esm/LocalHub.js +6 -4
- package/lib/esm/LocalHub.js.map +1 -1
- package/lib/esm/Material.d.ts +4 -3
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +5 -5
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +22 -22
- package/lib/esm/Model.js +22 -22
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/Relationship.d.ts +3 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +15 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts +1 -1
- package/lib/esm/SQLiteDb.js +1 -1
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/Schema.d.ts +25 -0
- package/lib/esm/Schema.d.ts.map +1 -1
- package/lib/esm/Schema.js +25 -0
- package/lib/esm/Schema.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/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.js +1 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +40 -14
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +42 -14
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +61 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +105 -0
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -0
- package/lib/esm/annotations/FrameGeometry.d.ts +51 -0
- package/lib/esm/annotations/FrameGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/FrameGeometry.js +244 -0
- package/lib/esm/annotations/FrameGeometry.js.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/LeaderGeometry.js +179 -0
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts +204 -0
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationElement.js +405 -0
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts +33 -0
- package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js +134 -0
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts +16 -0
- package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationGeometry.js → annotations/TextBlockGeometry.js} +28 -70
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -0
- package/lib/esm/{TextAnnotationLayout.d.ts → annotations/TextBlockLayout.d.ts} +69 -22
- package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -0
- package/lib/esm/{TextAnnotationLayout.js → annotations/TextBlockLayout.js} +172 -48
- package/lib/esm/annotations/TextBlockLayout.js.map +1 -0
- package/lib/esm/core-backend.d.ts +7 -3
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +27 -3
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts +23 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -1
- package/lib/esm/internal/ElementLRUCache.js +165 -2
- package/lib/esm/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +22 -0
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -0
- package/lib/esm/internal/annotations/fields.js +231 -0
- package/lib/esm/internal/annotations/fields.js.map +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -1
- 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/AnnotationTestUtils.d.ts +15 -0
- package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
- package/lib/esm/test/AnnotationTestUtils.js +41 -0
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +224 -1
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +1 -0
- package/lib/esm/test/IModelTestUtils.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/annotations/Fields.test.d.ts +2 -0
- package/lib/esm/test/annotations/Fields.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/Fields.test.js +576 -0
- package/lib/esm/test/annotations/Fields.test.js.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/FrameGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js +86 -0
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js +256 -0
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
- package/lib/esm/test/annotations/TextAnnotation.test.js +269 -1047
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.d.ts +2 -0
- package/lib/esm/test/annotations/TextBlock.test.d.ts.map +1 -0
- package/lib/esm/test/annotations/TextBlock.test.js +1199 -0
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts +60 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js +69 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +1442 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +817 -0
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts +2 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +164 -0
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -0
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +22 -32
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +29 -8
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -55
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +192 -0
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +86 -0
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -0
- package/lib/esm/test/imodel/IModel.test.js +313 -5
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +343 -0
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts +2 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +207 -0
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts +11 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js +36 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +17 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +116 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +9 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +20 -0
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -0
- package/lib/esm/test/misc/GeoServices.test.js +36 -10
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +104 -2
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +547 -136
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +53 -1
- 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/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/RenderMaterialElement.test.js +24 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +19 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +0 -1
- package/lib/esm/workspace/Workspace.d.ts.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/package.json +22 -16
- package/lib/cjs/TextAnnotationElement.d.ts +0 -54
- package/lib/cjs/TextAnnotationElement.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationElement.js +0 -94
- package/lib/cjs/TextAnnotationElement.js.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +0 -32
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +0 -1
- package/lib/cjs/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/cjs/TextAnnotationLayout.js.map +0 -1
- package/lib/esm/TextAnnotationElement.d.ts +0 -54
- package/lib/esm/TextAnnotationElement.d.ts.map +0 -1
- package/lib/esm/TextAnnotationElement.js +0 -89
- package/lib/esm/TextAnnotationElement.js.map +0 -1
- package/lib/esm/TextAnnotationGeometry.d.ts +0 -32
- package/lib/esm/TextAnnotationGeometry.d.ts.map +0 -1
- package/lib/esm/TextAnnotationGeometry.js.map +0 -1
- package/lib/esm/TextAnnotationLayout.d.ts.map +0 -1
- package/lib/esm/TextAnnotationLayout.js.map +0 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createUpdateContext = createUpdateContext;
|
|
8
|
+
exports.updateField = updateField;
|
|
9
|
+
exports.updateFields = updateFields;
|
|
10
|
+
exports.updateElementFields = updateElementFields;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
+
const BackendLoggerCategory_1 = require("../../BackendLoggerCategory");
|
|
14
|
+
const ElementDrivesTextAnnotation_1 = require("../../annotations/ElementDrivesTextAnnotation");
|
|
15
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
16
|
+
// Resolve the raw primitive value of the property that a field points to.
|
|
17
|
+
function getFieldProperty(field, iModel) {
|
|
18
|
+
const host = field.propertyHost;
|
|
19
|
+
const schemaItem = iModel.schemaContext.getSchemaItemSync(host.schemaName, host.className);
|
|
20
|
+
if (!ecschema_metadata_1.EntityClass.isEntityClass(schemaItem)) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
let ecClass = schemaItem;
|
|
24
|
+
const { propertyName, accessors } = field.propertyPath;
|
|
25
|
+
let ecProp = ecClass.getPropertySync(propertyName);
|
|
26
|
+
if (!ecProp) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const isAspect = ecClass.isSync("ElementAspect", "BisCore");
|
|
30
|
+
const where = ` WHERE ${isAspect ? "Element.Id" : "ECInstanceId"}=${host.elementId}`;
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
32
|
+
let curValue = iModel.withPreparedStatement(`SELECT ${propertyName} FROM ${host.schemaName}.${host.className} ${where}`, (stmt) => {
|
|
33
|
+
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const rootValue = stmt.getValue(0);
|
|
37
|
+
if (undefined === rootValue || rootValue.isNull) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
switch (rootValue.columnInfo.getType()) {
|
|
41
|
+
case core_common_1.ECSqlValueType.Blob:
|
|
42
|
+
return { primitive: rootValue.getBlob() };
|
|
43
|
+
case core_common_1.ECSqlValueType.Boolean:
|
|
44
|
+
return { primitive: rootValue.getBoolean() };
|
|
45
|
+
case core_common_1.ECSqlValueType.DateTime:
|
|
46
|
+
return { primitive: rootValue.getDateTime() };
|
|
47
|
+
case core_common_1.ECSqlValueType.Double:
|
|
48
|
+
return { primitive: rootValue.getDouble() };
|
|
49
|
+
case core_common_1.ECSqlValueType.Guid:
|
|
50
|
+
return { primitive: rootValue.getGuid() };
|
|
51
|
+
case core_common_1.ECSqlValueType.Int:
|
|
52
|
+
case core_common_1.ECSqlValueType.Int64:
|
|
53
|
+
return { primitive: rootValue.getInteger() };
|
|
54
|
+
case core_common_1.ECSqlValueType.Point2d:
|
|
55
|
+
return { primitive: rootValue.getXAndY() };
|
|
56
|
+
case core_common_1.ECSqlValueType.Point3d:
|
|
57
|
+
return { primitive: rootValue.getXYAndZ() };
|
|
58
|
+
case core_common_1.ECSqlValueType.String:
|
|
59
|
+
return { primitive: rootValue.getString() };
|
|
60
|
+
case core_common_1.ECSqlValueType.Struct: {
|
|
61
|
+
(0, core_bentley_1.assert)(ecProp.isStruct());
|
|
62
|
+
ecClass = ecProp.structClass;
|
|
63
|
+
return { struct: rootValue.getStruct() };
|
|
64
|
+
}
|
|
65
|
+
case core_common_1.ECSqlValueType.PrimitiveArray: {
|
|
66
|
+
return { primitiveArray: rootValue.getArray() };
|
|
67
|
+
}
|
|
68
|
+
case core_common_1.ECSqlValueType.StructArray: {
|
|
69
|
+
return { structArray: rootValue.getArray() };
|
|
70
|
+
}
|
|
71
|
+
// Unsupported:
|
|
72
|
+
// case ECSqlValueType.Geometry:
|
|
73
|
+
// case ECSqlValueType.Navigation:
|
|
74
|
+
// case ECSqlValueType.Id:
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
});
|
|
78
|
+
if (undefined === curValue) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (accessors) {
|
|
82
|
+
for (const accessor of accessors) {
|
|
83
|
+
if (undefined !== curValue.primitive) {
|
|
84
|
+
// Can't index into a primitive.
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
if (typeof accessor === "number") {
|
|
88
|
+
const array = curValue.primitiveArray ?? curValue.structArray;
|
|
89
|
+
if (!array) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const index = accessor < 0 ? (array.length + accessor) : accessor;
|
|
93
|
+
const item = array[index];
|
|
94
|
+
if (undefined === item) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
else if (curValue.primitiveArray) {
|
|
98
|
+
curValue = { primitive: curValue.primitiveArray[index] };
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, core_bentley_1.assert)(undefined !== curValue.structArray);
|
|
102
|
+
(0, core_bentley_1.assert)(ecProp instanceof ecschema_metadata_1.StructArrayProperty);
|
|
103
|
+
ecClass = ecProp.structClass;
|
|
104
|
+
curValue = { struct: curValue.structArray[index] };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (undefined === curValue.struct) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
const item = curValue.struct[accessor];
|
|
112
|
+
if (undefined === item) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
ecProp = ecClass.getPropertySync(accessor);
|
|
116
|
+
if (!ecProp) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
if (ecProp.isArray()) {
|
|
120
|
+
curValue = ecProp.isStruct() ? { structArray: item } : { primitiveArray: item };
|
|
121
|
+
}
|
|
122
|
+
else if (ecProp.isStruct()) {
|
|
123
|
+
ecClass = ecProp.structClass;
|
|
124
|
+
curValue = { struct: item };
|
|
125
|
+
}
|
|
126
|
+
else if (ecProp.isPrimitive()) {
|
|
127
|
+
curValue = { primitive: item };
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (field.propertyPath.jsonAccessors) {
|
|
136
|
+
if (!ecProp.isPrimitive() || ecProp.isArray() || ecProp.extendedTypeName !== "Json" || typeof curValue.primitive !== "string") {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
let json = JSON.parse(curValue.primitive);
|
|
140
|
+
for (const accessor of field.propertyPath.jsonAccessors) {
|
|
141
|
+
if (typeof accessor === "number") {
|
|
142
|
+
if (!Array.isArray(json)) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
json = json[accessor < 0 ? json.length + accessor : accessor];
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
if (typeof json !== "object" || json === null) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
json = json[accessor];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
switch (typeof json) {
|
|
155
|
+
case "string":
|
|
156
|
+
case "number":
|
|
157
|
+
case "boolean":
|
|
158
|
+
curValue = { primitive: json };
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// The ultimate result must be a primitive value.
|
|
165
|
+
if (undefined === curValue.primitive) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
value: curValue.primitive,
|
|
170
|
+
metadata: { property: ecProp },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function createUpdateContext(hostElementId, iModel, deleted) {
|
|
174
|
+
return {
|
|
175
|
+
hostElementId,
|
|
176
|
+
getProperty: deleted ? () => undefined : (field) => getFieldProperty(field, iModel),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// Recompute the display value of a single field, return false if it couldn't be evaluated.
|
|
180
|
+
function updateField(field, context) {
|
|
181
|
+
if (context.hostElementId !== field.propertyHost.elementId) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
let newContent;
|
|
185
|
+
try {
|
|
186
|
+
const prop = context.getProperty(field);
|
|
187
|
+
if (undefined !== prop) {
|
|
188
|
+
// ###TODO formatting etc.
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
190
|
+
newContent = prop.value.toString();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, err);
|
|
195
|
+
}
|
|
196
|
+
newContent = newContent ?? core_common_1.FieldRun.invalidContentIndicator;
|
|
197
|
+
if (newContent === field.cachedContent) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
field.setCachedContent(newContent);
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
// Re-evaluates the display strings for all fields that target the element specified by `context` and returns the number
|
|
204
|
+
// of fields whose display strings changed as a result.
|
|
205
|
+
function updateFields(textBlock, context) {
|
|
206
|
+
let numUpdated = 0;
|
|
207
|
+
for (const paragraph of textBlock.paragraphs) {
|
|
208
|
+
for (const run of paragraph.runs) {
|
|
209
|
+
if (run.type === "field" && updateField(run, context)) {
|
|
210
|
+
++numUpdated;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return numUpdated;
|
|
215
|
+
}
|
|
216
|
+
// Invoked by ElementDrivesTextAnnotation to update fields in target element when source element changes or is deleted.
|
|
217
|
+
function updateElementFields(props, iModel, deleted) {
|
|
218
|
+
try {
|
|
219
|
+
const target = iModel.elements.getElement(props.targetId);
|
|
220
|
+
if ((0, ElementDrivesTextAnnotation_1.isITextAnnotation)(target)) {
|
|
221
|
+
const context = createUpdateContext(props.sourceId, iModel, deleted);
|
|
222
|
+
const updatedBlocks = [];
|
|
223
|
+
for (const block of target.getTextBlocks()) {
|
|
224
|
+
if (updateFields(block.textBlock, context)) {
|
|
225
|
+
updatedBlocks.push(block);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (updatedBlocks.length > 0) {
|
|
229
|
+
target.updateTextBlocks(updatedBlocks);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, err);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AAqO/F,kDAKC;AAGD,kCAwBC;AAID,oCAWC;AAGD,kDAmBC;AAxSD,oDAA4F;AAE5F,sDAA2E;AAC3E,uEAAoE;AAEpE,+FAAkF;AAClF,gEAAgG;AAkDhG,0EAA0E;AAC1E,SAAS,gBAAgB,CAAC,KAAe,EAAE,MAAgB;IACzD,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IAChC,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAA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,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;YACjC,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;gBACtD,EAAE,UAAU,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,uHAAuH;AACvH,SAAgB,mBAAmB,CAAC,KAAwB,EAAE,MAAgB,EAAE,OAAgB;IAC9F,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,IAAA,+CAAiB,EAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,EAAE,CAAC;YACzB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;gBAC3C,IAAI,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;oBAC3C,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;AACH,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\nimport { ECSqlValueType, FieldRun, RelationshipProps, TextBlock } from \"@itwin/core-common\";\nimport { IModelDb } from \"../../IModelDb\";\nimport { assert, DbResult, Id64String, Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"../../BackendLoggerCategory\";\nimport { XAndY, XYAndZ } from \"@itwin/core-geometry\";\nimport { isITextAnnotation } from \"../../annotations/ElementDrivesTextAnnotation\";\nimport { AnyClass, EntityClass, Property, StructArrayProperty } from \"@itwin/ecschema-metadata\";\n\n// A FieldPropertyPath must ultimately resolve to one of these primitive types.\nexport type FieldPrimitiveValue = boolean | number | string | Date | XAndY | XYAndZ | Uint8Array;\n\ninterface FieldStructValue { [key: string]: any }\n\n// An intermediate value obtained while evaluating a FieldPropertyPath.\ntype FieldValue = {\n primitive: FieldPrimitiveValue;\n struct?: never;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct: FieldStructValue;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray: FieldPrimitiveValue[];\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray?: never;\n structArray: FieldStructValue[];\n}\n\n// Metadata associated with a FieldProperty, providing info needed for formatting like kind-of-quantity, extended type, etc.\n// That information can be obtained from the EC Property. For JSON fields, we will need to allow the user to specify it explicitly\n// (TBD because formatting is not yet implemented).\nexport interface FieldPropertyMetadata {\n readonly property: Property;\n // ###TODO probably want to know if it's a JSON property.\n}\n\n// The resolved primitive value of a field with metadata.\nexport interface FieldProperty {\n value: FieldPrimitiveValue;\n metadata: FieldPropertyMetadata;\n}\n\nexport interface UpdateFieldsContext {\n readonly hostElementId: Id64String;\n\n getProperty(field: FieldRun): FieldProperty | undefined\n}\n\n// Resolve the raw primitive value of the property that a field points to.\nfunction getFieldProperty(field: FieldRun, iModel: IModelDb): FieldProperty | undefined {\n const host = field.propertyHost;\n const schemaItem = iModel.schemaContext.getSchemaItemSync(host.schemaName, host.className);\n if (!EntityClass.isEntityClass(schemaItem)) {\n return undefined;\n }\n\n let ecClass: AnyClass = schemaItem;\n const { propertyName, accessors } = field.propertyPath;\n let ecProp = ecClass.getPropertySync(propertyName);\n if (!ecProp) {\n return undefined;\n }\n\n const isAspect = ecClass.isSync(\"ElementAspect\", \"BisCore\");\n const where = ` WHERE ${isAspect ? \"Element.Id\" : \"ECInstanceId\"}=${host.elementId}`;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n let curValue: FieldValue | undefined = iModel.withPreparedStatement(`SELECT ${propertyName} FROM ${host.schemaName}.${host.className} ${where}`, (stmt) => {\n if (stmt.step() !== DbResult.BE_SQLITE_ROW) {\n return undefined;\n }\n\n const rootValue = stmt.getValue(0);\n if (undefined === rootValue || rootValue.isNull) {\n return undefined;\n }\n\n switch (rootValue.columnInfo.getType()) {\n case ECSqlValueType.Blob:\n return { primitive: rootValue.getBlob() };\n case ECSqlValueType.Boolean:\n return { primitive: rootValue.getBoolean() };\n case ECSqlValueType.DateTime:\n return { primitive: rootValue.getDateTime() };\n case ECSqlValueType.Double:\n return { primitive: rootValue.getDouble() };\n case ECSqlValueType.Guid:\n return { primitive: rootValue.getGuid() };\n case ECSqlValueType.Int:\n case ECSqlValueType.Int64:\n return { primitive: rootValue.getInteger() };\n case ECSqlValueType.Point2d:\n return { primitive: rootValue.getXAndY() };\n case ECSqlValueType.Point3d:\n return { primitive: rootValue.getXYAndZ() };\n case ECSqlValueType.String:\n return { primitive: rootValue.getString() };\n case ECSqlValueType.Struct: {\n assert(ecProp!.isStruct());\n ecClass = ecProp.structClass;\n return { struct: rootValue.getStruct() };\n }\n case ECSqlValueType.PrimitiveArray: {\n return { primitiveArray: rootValue.getArray() };\n }\n case ECSqlValueType.StructArray: {\n return { structArray: rootValue.getArray() };\n }\n // Unsupported:\n // case ECSqlValueType.Geometry:\n // case ECSqlValueType.Navigation:\n // case ECSqlValueType.Id:\n }\n\n return undefined;\n });\n\n if (undefined === curValue) {\n return undefined;\n }\n\n if (accessors) {\n for (const accessor of accessors) {\n if (undefined !== curValue.primitive) {\n // Can't index into a primitive.\n return undefined;\n }\n\n if (typeof accessor === \"number\") {\n const array: FieldPrimitiveValue[] | FieldStructValue[] | undefined = curValue.primitiveArray ?? curValue.structArray;\n if (!array) {\n return undefined;\n }\n\n const index: number = accessor < 0 ? (array.length + accessor) : accessor;\n const item: FieldPrimitiveValue | FieldStructValue = array[index];\n if (undefined === item) {\n return undefined;\n } else if (curValue.primitiveArray) {\n curValue = { primitive: curValue.primitiveArray[index] };\n } else {\n assert(undefined !== curValue.structArray);\n assert(ecProp instanceof StructArrayProperty);\n\n ecClass = ecProp.structClass;\n curValue = { struct: curValue.structArray[index] };\n }\n } else {\n if (undefined === curValue.struct) {\n return undefined;\n }\n\n const item: any = curValue.struct[accessor];\n if (undefined === item) {\n return undefined;\n }\n\n ecProp = ecClass.getPropertySync(accessor);\n if (!ecProp) {\n return undefined;\n }\n\n if (ecProp.isArray()) {\n curValue = ecProp.isStruct() ? { structArray: item } : { primitiveArray: item };\n } else if (ecProp.isStruct()) {\n ecClass = ecProp.structClass;\n curValue = { struct: item };\n } else if (ecProp.isPrimitive()) {\n curValue = { primitive: item };\n } else {\n return undefined;\n }\n }\n }\n }\n\n if (field.propertyPath.jsonAccessors) {\n if (!ecProp.isPrimitive() || ecProp.isArray() || ecProp.extendedTypeName !== \"Json\" || typeof curValue.primitive !== \"string\") {\n return undefined;\n }\n\n let json = JSON.parse(curValue.primitive);\n for (const accessor of field.propertyPath.jsonAccessors) {\n if (typeof accessor === \"number\") {\n if (!Array.isArray(json)) {\n return undefined;\n }\n\n json = json[accessor < 0 ? json.length + accessor : accessor];\n } else {\n if (typeof json !== \"object\" || json === null) {\n return undefined;\n }\n\n json = json[accessor];\n }\n }\n\n switch (typeof json) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n curValue = { primitive: json };\n break;\n default:\n return undefined;\n }\n }\n\n // The ultimate result must be a primitive value.\n if (undefined === curValue.primitive) {\n return undefined;\n }\n\n return {\n value: curValue.primitive,\n metadata: { property: ecProp },\n };\n}\n\nexport function createUpdateContext(hostElementId: string, iModel: IModelDb, deleted: boolean): UpdateFieldsContext {\n return {\n hostElementId,\n getProperty: deleted ? () => undefined : (field) => getFieldProperty(field, iModel),\n };\n}\n\n// Recompute the display value of a single field, return false if it couldn't be evaluated.\nexport function updateField(field: FieldRun, context: UpdateFieldsContext): boolean {\n if (context.hostElementId !== field.propertyHost.elementId) {\n return false;\n }\n\n let newContent: string | undefined;\n try {\n const prop = context.getProperty(field);\n if (undefined !== prop) {\n // ###TODO formatting etc.\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n newContent = prop.value.toString();\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n\n newContent = newContent ?? FieldRun.invalidContentIndicator;\n if (newContent === field.cachedContent) {\n return false;\n }\n\n field.setCachedContent(newContent);\n return true;\n}\n\n// Re-evaluates the display strings for all fields that target the element specified by `context` and returns the number\n// of fields whose display strings changed as a result.\nexport function updateFields(textBlock: TextBlock, context: UpdateFieldsContext): number {\n let numUpdated = 0;\n for (const paragraph of textBlock.paragraphs) {\n for (const run of paragraph.runs) {\n if (run.type === \"field\" && updateField(run, context)) {\n ++numUpdated;\n }\n }\n }\n\n return numUpdated;\n}\n\n// Invoked by ElementDrivesTextAnnotation to update fields in target element when source element changes or is deleted.\nexport function updateElementFields(props: RelationshipProps, iModel: IModelDb, deleted: boolean): void {\n try {\n const target = iModel.elements.getElement(props.targetId);\n if (isITextAnnotation(target)) {\n const context = createUpdateContext(props.sourceId, iModel, deleted);\n const updatedBlocks = [];\n for (const block of target.getTextBlocks()) {\n if (updateFields(block.textBlock, context)) {\n updatedBlocks.push(block);\n }\n }\n\n if (updatedBlocks.length > 0) {\n target.updateTextBlocks(updatedBlocks);\n }\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n}\n\n"]}
|
|
@@ -36,7 +36,7 @@ export declare class IModelReadRpcImpl extends RpcInterface implements IModelRea
|
|
|
36
36
|
getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]>;
|
|
37
37
|
getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]>;
|
|
38
38
|
/** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
|
|
39
|
-
* @deprecated in 3.
|
|
39
|
+
* @deprecated in 3.6.0 - might be removed in next major version. Use queryViewThumbnail instead
|
|
40
40
|
*/
|
|
41
41
|
getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array>;
|
|
42
42
|
getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String>;
|
|
@@ -259,7 +259,7 @@ class IModelReadRpcImpl extends core_common_1.RpcInterface {
|
|
|
259
259
|
return (el === undefined) ? [] : el.getToolTipMessage();
|
|
260
260
|
}
|
|
261
261
|
/** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
|
|
262
|
-
* @deprecated in 3.
|
|
262
|
+
* @deprecated in 3.6.0 - might be removed in next major version. Use queryViewThumbnail instead
|
|
263
263
|
*/
|
|
264
264
|
async getViewThumbnail(tokenProps, viewId) {
|
|
265
265
|
const iModelDb = await getIModelForRpc(tokenProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAC5D,iDAAgD;AAQhD,MAAM,wBAAyB,SAAQ,iCAAuC;IAC3D,UAAU,CAAS;IAC5B,MAAM,CAAC,SAA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AAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,UAA0B,EAAE,KAA8B;QAC3F,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,OAAO,EAAE,CAAC,mBAAS,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED,gBAAgB;IACT,KAAK,CAAC,aAAa,CAAC,UAA0B,EAAE,OAAe,EAAE,QAAiB,EAAE,UAAkB,EAAE,GAAG,IAAW;QAC3H,IAAI,CAAC,0BAAY,CAAC,mBAAmB,CAAC,0BAAY,CAAC,OAAO,EAAE,OAAO,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAErE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AArSD,8CAqSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error;\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.queryAllUsedSpatialSubCategories();\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelProps(id);\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementProps({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb[_nativeDb].readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.x - Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db[_nativeDb].generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../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AAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AArSD,8CAqSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error;\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.queryAllUsedSpatialSubCategories();\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelProps(id);\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementProps({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb[_nativeDb].readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.6.0 - might be removed in next major version. Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db[_nativeDb].generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
|
|
@@ -31,14 +31,14 @@ export declare class RpcBriefcaseUtility {
|
|
|
31
31
|
syncMode: SyncMode.FixedVersion;
|
|
32
32
|
}): Promise<IModelDb>;
|
|
33
33
|
/**
|
|
34
|
-
* @deprecated in 4.4.0 -
|
|
34
|
+
* @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends
|
|
35
35
|
*/
|
|
36
36
|
static open(args: DownloadAndOpenArgs & {
|
|
37
37
|
syncMode: Exclude<SyncMode, "FixedVersion">;
|
|
38
38
|
}): Promise<IModelDb>;
|
|
39
39
|
static openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;
|
|
40
40
|
/**
|
|
41
|
-
* @deprecated in 4.4.0 -
|
|
41
|
+
* @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends
|
|
42
42
|
*/
|
|
43
43
|
static openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, "FixedVersion">, timeout?: number): Promise<IModelConnectionProps>;
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,oDAE4B;AAC5B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C,CAAC;QAElE,MAAM,UAAU,GAAG;YACjB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC;QAEF,wBAAwB;QACxB,IAAI,EAAqB,CAAC;QAC1B,mCAAmC;QACnC,EAAE,GAAG,qBAAU,CAAC,YAAY,CAAC,qCAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,EAAE,CAAC;YACP,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,EAAE,UAAU,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAQM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA7JH,kDA+JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\nimport { _hubAccess } from \"../internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity;\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined) {\n if (briefcaseDb.isBriefcaseDb()) {\n return briefcaseDb;\n } else {\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\n }\n }\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAAyD;AACzD,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAC3C,iDAAiD;AAEjD,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;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AE,QAAQ,CAAC,WAAW;SAClC,CAAC;QAEF,wBAAwB;QACxB,IAAI,EAAqB,CAAC;QAC1B,mCAAmC;QACnC,EAAE,GAAG,qBAAU,CAAC,YAAY,CAAC,qCAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,EAAE,CAAC;YACP,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,EAAE,UAAU,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAQM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA7JH,kDA+JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\nimport { _hubAccess } from \"../internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity;\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined) {\n if (briefcaseDb.isBriefcaseDb()) {\n return briefcaseDb;\n } else {\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\n }\n }\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { IModelConnectionProps, IModelRpcProps, RpcInterface, SnapshotIModelRpcInterface, SnapshotOpenOptions } from "@itwin/core-common";
|
|
5
5
|
/** The backend implementation of SnapshotIModelRpcInterface.
|
|
6
6
|
* @internal
|
|
7
|
-
* @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.
|
|
7
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.
|
|
8
8
|
*/
|
|
9
9
|
export declare class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {
|
|
10
10
|
static register(): void;
|
|
@@ -14,7 +14,7 @@ const IModelHost_1 = require("../IModelHost");
|
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
15
15
|
/** The backend implementation of SnapshotIModelRpcInterface.
|
|
16
16
|
* @internal
|
|
17
|
-
* @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.
|
|
17
|
+
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.
|
|
18
18
|
*/
|
|
19
19
|
class SnapshotIModelRpcImpl extends core_common_1.RpcInterface {
|
|
20
20
|
static register() { core_common_1.RpcManager.registerImpl(core_common_1.SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModelRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAE4B;AAC5B,0CAAyC;AACzC,8CAA2C;AAE3C,qDAAqD;AAErD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,wCAA0B,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAExG,kGAAkG;IAC3F,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,IAA0B;QAChE,IAAI,gBAAgB,GAAuB,QAAQ,CAAC;QACpD,IAAI,uBAAU,CAAC,wBAAwB,EAAE,CAAC;YACxC,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACpF,IAAI,SAAS,KAAK,gBAAgB;gBAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAClG,CAAC;QACD,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC1E,CAAC;IAED,4FAA4F;IACrF,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,IAA0B;QACjE,MAAM,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,SAAS,KAAK,gBAAgB;YAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAEhG,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC/F,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,KAAK,CAAC,UAA0B;QAC3C,qBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA5BD,sDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n IModelConnectionProps, IModelNotFoundResponse, IModelRpcProps, RpcInterface, RpcManager, SnapshotIModelRpcInterface, SnapshotOpenOptions,\n} from \"@itwin/core-common\";\nimport { SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** The backend implementation of SnapshotIModelRpcInterface.\n * @internal\n * @deprecated in 5.0. Check [[IpcAppFunctions]] for replacements.\n */\nexport class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {\n public static register() { RpcManager.registerImpl(SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }\n\n /** Ask the backend to open a snapshot iModel from a file name that is resolved by the backend. */\n public async openFile(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) {\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n\n /** Ask the backend to open a snapshot iModel from a key that is resolved by the backend. */\n public async openRemote(fileKey: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n const resolvedFileName = IModelHost.snapshotFileNameResolver?.resolveKey(fileKey);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n return SnapshotDb.openFile(resolvedFileName, { key: fileKey, ...opts }).getConnectionProps();\n }\n\n /** Ask the backend to close a snapshot iModel. */\n public async close(tokenProps: IModelRpcProps): Promise<boolean> {\n SnapshotDb.findByKey(tokenProps.key).close();\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModelRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAE4B;AAC5B,0CAAyC;AACzC,8CAA2C;AAE3C,qDAAqD;AAErD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,wCAA0B,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAExG,kGAAkG;IAC3F,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,IAA0B;QAChE,IAAI,gBAAgB,GAAuB,QAAQ,CAAC;QACpD,IAAI,uBAAU,CAAC,wBAAwB,EAAE,CAAC;YACxC,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACpF,IAAI,SAAS,KAAK,gBAAgB;gBAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAClG,CAAC;QACD,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC1E,CAAC;IAED,4FAA4F;IACrF,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,IAA0B;QACjE,MAAM,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,SAAS,KAAK,gBAAgB;YAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAEhG,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC/F,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,KAAK,CAAC,UAA0B;QAC3C,qBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA5BD,sDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n IModelConnectionProps, IModelNotFoundResponse, IModelRpcProps, RpcInterface, RpcManager, SnapshotIModelRpcInterface, SnapshotOpenOptions,\n} from \"@itwin/core-common\";\nimport { SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** The backend implementation of SnapshotIModelRpcInterface.\n * @internal\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.\n */\nexport class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {\n public static register() { RpcManager.registerImpl(SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }\n\n /** Ask the backend to open a snapshot iModel from a file name that is resolved by the backend. */\n public async openFile(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) {\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n\n /** Ask the backend to open a snapshot iModel from a key that is resolved by the backend. */\n public async openRemote(fileKey: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n const resolvedFileName = IModelHost.snapshotFileNameResolver?.resolveKey(fileKey);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n return SnapshotDb.openFile(resolvedFileName, { key: fileKey, ...opts }).getConnectionProps();\n }\n\n /** Ask the backend to close a snapshot iModel. */\n public async close(tokenProps: IModelRpcProps): Promise<boolean> {\n SnapshotDb.findByKey(tokenProps.key).close();\n return true;\n }\n}\n"]}
|
|
@@ -157,7 +157,6 @@ export interface WorkspaceDbSettingsProps extends WorkspaceDbCloudProps {
|
|
|
157
157
|
export type WorkspaceResourceName = string;
|
|
158
158
|
/** A SQLite database in a [[Workspace]] containing named resources that the application is configured to use.
|
|
159
159
|
* Resources are referred to by their [[WorkspaceResourceName]]s and can represent any number of things, including:
|
|
160
|
-
* - Fonts and [TextStyle]($common)s used when placing [TextAnnotation]($common)s.
|
|
161
160
|
* - [GeographicCRS]($common)es used to define the coordinate reference system of an iTwin.
|
|
162
161
|
* - [[SettingsDictionary]]'s that contribute to the [[Workspace.settings]].
|
|
163
162
|
* - Files that can be extracted temporarily to the local file system to be accessed by programs directly from disk.
|