@itwin/core-backend 5.9.0-dev.3 → 5.9.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BriefcaseManager.js +3 -3
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +37 -7
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +33 -42
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +5 -2
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +29 -0
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +32 -3
- package/lib/cjs/CodeSpecs.d.ts.map +1 -1
- package/lib/cjs/CodeSpecs.js +48 -20
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +18 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +10 -21
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/EditTxn.d.ts +262 -0
- package/lib/cjs/EditTxn.d.ts.map +1 -0
- package/lib/cjs/EditTxn.js +548 -0
- package/lib/cjs/EditTxn.js.map +1 -0
- package/lib/cjs/Element.d.ts +74 -5
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +63 -75
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +10 -0
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +21 -12
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +56 -3
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +53 -40
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +11 -2
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js +10 -8
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +66 -22
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +174 -288
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +22 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +9 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IpcHost.js +2 -2
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +47 -7
- package/lib/cjs/LineStyle.d.ts.map +1 -1
- package/lib/cjs/LineStyle.js +38 -33
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/Material.d.ts +8 -1
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +6 -12
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +59 -20
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +38 -80
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +72 -7
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +39 -21
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SchemaSync.js +4 -4
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SheetIndex.d.ts +9 -0
- package/lib/cjs/SheetIndex.d.ts.map +1 -1
- package/lib/cjs/SheetIndex.js +38 -35
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/StashManager.js +1 -1
- package/lib/cjs/StashManager.js.map +1 -1
- package/lib/cjs/Texture.d.ts +6 -0
- package/lib/cjs/Texture.d.ts.map +1 -1
- package/lib/cjs/Texture.js +6 -14
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +5 -5
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +23 -7
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +21 -1
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +27 -66
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +33 -27
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js +6 -5
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +1 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +6 -2
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +8 -13
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +11 -4
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +13 -24
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts +15 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +5 -3
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +4 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +5 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.d.ts +3 -2
- package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
- package/lib/cjs/internal/annotations/fields.js +7 -6
- package/lib/cjs/internal/annotations/fields.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/BriefcaseManager.js +3 -3
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +37 -7
- package/lib/esm/Category.d.ts.map +1 -1
- package/lib/esm/Category.js +33 -42
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +5 -2
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChannelControl.d.ts +29 -0
- package/lib/esm/ChannelControl.d.ts.map +1 -1
- package/lib/esm/ChannelControl.js.map +1 -1
- package/lib/esm/CheckpointManager.js +1 -1
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +32 -3
- package/lib/esm/CodeSpecs.d.ts.map +1 -1
- package/lib/esm/CodeSpecs.js +49 -21
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +18 -3
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +10 -21
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +262 -0
- package/lib/esm/EditTxn.d.ts.map +1 -0
- package/lib/esm/EditTxn.js +543 -0
- package/lib/esm/EditTxn.js.map +1 -0
- package/lib/esm/Element.d.ts +74 -5
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +64 -76
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +10 -0
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +22 -13
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts +56 -3
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
- package/lib/esm/ElementTreeWalker.js +53 -40
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/ExternalSource.d.ts +11 -2
- package/lib/esm/ExternalSource.d.ts.map +1 -1
- package/lib/esm/ExternalSource.js +10 -8
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +66 -22
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +176 -290
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +22 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +9 -0
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IpcHost.js +3 -3
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.d.ts +47 -7
- package/lib/esm/LineStyle.d.ts.map +1 -1
- package/lib/esm/LineStyle.js +38 -33
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/Material.d.ts +8 -1
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +6 -12
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +59 -20
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +39 -81
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/Relationship.d.ts +72 -7
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +40 -22
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SchemaSync.js +5 -5
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/SheetIndex.d.ts +9 -0
- package/lib/esm/SheetIndex.d.ts.map +1 -1
- package/lib/esm/SheetIndex.js +38 -35
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/StashManager.js +1 -1
- package/lib/esm/StashManager.js.map +1 -1
- package/lib/esm/Texture.d.ts +6 -0
- package/lib/esm/Texture.d.ts.map +1 -1
- package/lib/esm/Texture.js +6 -14
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +5 -5
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +23 -7
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +21 -1
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +27 -66
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +14 -6
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js +33 -27
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js +6 -5
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/core-backend.d.ts +1 -0
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +1 -0
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts +6 -2
- package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/esm/domains/FunctionalElements.js +8 -13
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/GenericElements.d.ts +11 -4
- package/lib/esm/domains/GenericElements.d.ts.map +1 -1
- package/lib/esm/domains/GenericElements.js +13 -24
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts +15 -0
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +6 -4
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +4 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +4 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.d.ts +3 -2
- package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
- package/lib/esm/internal/annotations/fields.js +7 -6
- package/lib/esm/internal/annotations/fields.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts +20 -19
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.js +111 -96
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js +56 -2
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +23 -23
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +466 -449
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/PropertyDb.test.js +2 -2
- package/lib/esm/test/PropertyDb.test.js.map +1 -1
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js +27 -18
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.d.ts.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.js +11 -7
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
- package/lib/esm/test/TestEditTxn.d.ts +8 -0
- package/lib/esm/test/TestEditTxn.d.ts.map +1 -0
- package/lib/esm/test/TestEditTxn.js +34 -0
- package/lib/esm/test/TestEditTxn.js.map +1 -0
- package/lib/esm/test/TestUtils.d.ts +1 -0
- package/lib/esm/test/TestUtils.d.ts.map +1 -1
- package/lib/esm/test/TestUtils.js +8 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/annotations/Fields.test.js +82 -90
- package/lib/esm/test/annotations/Fields.test.js.map +1 -1
- package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js +156 -99
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/annotations/TextBlock.test.js +5 -3
- package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/old.config.js.map +1 -1
- package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
- package/lib/esm/test/categories/Category.test.js +63 -3
- package/lib/esm/test/categories/Category.test.js.map +1 -1
- package/lib/esm/test/codespec/CodeSpec.test.js +88 -5
- package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +3 -2
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +2 -2
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +0 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/QueryReaders.test.js +17 -14
- package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -2
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.d.ts.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js +30 -28
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestParser.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js +159 -143
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementAspect.test.js +68 -60
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.d.ts.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.js +51 -43
- package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +37 -38
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/ExcludedElements.test.js +2 -2
- package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
- package/lib/esm/test/element/ExternalSource.test.js +40 -38
- package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
- package/lib/esm/test/element/NullStructArray.test.js +10 -9
- package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
- package/lib/esm/test/element/ProjectInformationRecord.test.js +5 -2
- package/lib/esm/test/element/ProjectInformationRecord.test.js.map +1 -1
- package/lib/esm/test/element/SheetInformationAspect.test.js +43 -11
- package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
- package/lib/esm/test/element/UrlLink.test.js +2 -2
- package/lib/esm/test/element/UrlLink.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js +87 -73
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +164 -125
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +2 -4
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +313 -247
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +322 -247
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.js +31 -31
- package/lib/esm/test/imodel/Code.test.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +57 -48
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +419 -344
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/ProjectExtents.test.js +2 -2
- package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/TestContext.d.ts.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/TestContext.js +2 -2
- package/lib/esm/test/incrementalSchemaLocater/TestContext.js.map +1 -1
- package/lib/esm/test/index.d.ts +1 -0
- package/lib/esm/test/index.d.ts.map +1 -1
- package/lib/esm/test/index.js +1 -0
- package/lib/esm/test/index.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +23 -22
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/schema/FunctionalDomain.test.js +36 -34
- package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js +114 -94
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js +2 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js +207 -192
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts +1 -3
- package/lib/esm/test/sheetindex/SheetIndex.test.d.ts.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js +312 -247
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +101 -82
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +114 -85
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js +43 -40
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/Drawing.test.js +4 -3
- package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
- package/lib/esm/test/standalone/EditTxn.test.d.ts +2 -0
- package/lib/esm/test/standalone/EditTxn.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/EditTxn.test.js +219 -0
- package/lib/esm/test/standalone/EditTxn.test.js.map +1 -0
- package/lib/esm/test/standalone/ElementMesh.test.js +16 -13
- package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +26 -20
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js +11 -15
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js +212 -165
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/HubMock.test.js +31 -25
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.js +11 -8
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.d.ts +2 -2
- package/lib/esm/test/standalone/IModelWrite.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js +184 -142
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js +25 -22
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
- package/lib/esm/test/standalone/IntegrityCheck.test.js +20 -18
- package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.d.ts +2 -2
- package/lib/esm/test/standalone/MergeConflict.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js +49 -33
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +5 -5
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderTimeline.test.js +3 -2
- package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
- package/lib/esm/test/standalone/SectionDrawing.test.js +7 -7
- package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js +21 -19
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
- package/lib/esm/test/standalone/Settings.test.js +7 -4
- package/lib/esm/test/standalone/Settings.test.js.map +1 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js +2 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +3 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/StandaloneDb.test.js +7 -6
- package/lib/esm/test/standalone/StandaloneDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Texture.test.js +5 -4
- package/lib/esm/test/standalone/Texture.test.js.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.d.ts.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.js +5 -3
- package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
- package/lib/esm/test/standalone/TileTree.test.js +35 -31
- package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +700 -653
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js +295 -229
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js +25 -23
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/package.json +12 -12
|
@@ -5,6 +5,7 @@ import { ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, Rela
|
|
|
5
5
|
import { Entity } from "./Entity";
|
|
6
6
|
import { IModelDb } from "./IModelDb";
|
|
7
7
|
import { Id64String } from "@itwin/core-bentley";
|
|
8
|
+
import { EditTxn } from "./EditTxn";
|
|
8
9
|
/** Argument for the `ElementAspect.onXxx` static methods
|
|
9
10
|
* @beta
|
|
10
11
|
*/
|
|
@@ -115,8 +116,17 @@ export declare class SheetInformationAspect extends ElementUniqueAspect {
|
|
|
115
116
|
* If `information` is `undefined`, any existing aspect will be deleted.
|
|
116
117
|
* Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.
|
|
117
118
|
* @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.
|
|
119
|
+
* @deprecated Use SheetInformationAspect.setSheetInformation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.
|
|
118
120
|
*/
|
|
119
121
|
static setSheetInformation(information: SheetInformation | undefined, sheetId: Id64String, iModel: IModelDb): void;
|
|
122
|
+
/** Sets the `information` for the [[Sheet]] element specified by `sheetId`, using an explicit EditTxn.
|
|
123
|
+
* If `information` is `undefined`, any existing aspect will be deleted.
|
|
124
|
+
* Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.
|
|
125
|
+
* @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.
|
|
126
|
+
* @throws EditTxnError if the EditTxn is not active.
|
|
127
|
+
* @beta
|
|
128
|
+
*/
|
|
129
|
+
static setSheetInformation(txn: EditTxn, information: SheetInformation | undefined, sheetId: Id64String): void;
|
|
120
130
|
}
|
|
121
131
|
/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.
|
|
122
132
|
* @note The associated ECClass was added to the BisCore schema in version 1.0.2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementAspect.d.ts","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA0B,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,cAAc,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ElementAspect.d.ts","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA0B,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,cAAc,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,MAAM,EAAE,QAAQ,CAAC;IACjB,sDAAsD;IACtD,KAAK,EAAE,UAAU,CAAC;CACnB;AACD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,+DAA+D;IAC/D,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;CACrC;AACD;;G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E,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAA;KAAE,CAAC;IAe9I,MAAM,IAAI,yBAAyB;cAYhC,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;CAQ/E;AAED,uBAAuB;AACvB,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,KAAY,IAAI;QACd,oFAAoF;QACpF,OAAO,YAAY;QACnB,yFAAyF;QACzF,YAAY,iBAAiB;QAC7B;;WAEG;QACH,KAAK,UAAU;KAChB;CACF"}
|
package/lib/esm/ElementAspect.js
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
import { RelatedElement } from "@itwin/core-common";
|
|
9
9
|
import { Entity } from "./Entity";
|
|
10
10
|
import { assert, DbResult } from "@itwin/core-bentley";
|
|
11
|
-
import { _verifyChannel } from "./internal/Symbols";
|
|
11
|
+
import { _implicitTxn, _verifyChannel } from "./internal/Symbols";
|
|
12
12
|
import { SheetOwnsSheetInformationAspect } from "./NavigationRelationship";
|
|
13
13
|
import { Sheet } from "./Element";
|
|
14
14
|
import { ECVersion } from "@itwin/ecschema-metadata";
|
|
15
|
+
import { EditTxn } from "./EditTxn";
|
|
15
16
|
/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.
|
|
16
17
|
* Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.
|
|
17
18
|
* BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.
|
|
@@ -99,7 +100,7 @@ export class ChannelRootAspect extends ElementUniqueAspect {
|
|
|
99
100
|
*/
|
|
100
101
|
static insert(iModel, ownerId, channelName) {
|
|
101
102
|
const props = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };
|
|
102
|
-
iModel.
|
|
103
|
+
iModel[_implicitTxn].insertAspect(props);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
const minimumBisCoreVersion = new ECVersion(1, 0, 25);
|
|
@@ -159,23 +160,31 @@ export class SheetInformationAspect extends ElementUniqueAspect {
|
|
|
159
160
|
const aspect = this.findForSheet(sheetId, iModel);
|
|
160
161
|
return aspect?.sheetInformation;
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
static setSheetInformation(arg1, arg2, arg3) {
|
|
164
|
+
let txn;
|
|
165
|
+
let information;
|
|
166
|
+
let sheetId;
|
|
167
|
+
if (arg1 instanceof EditTxn) {
|
|
168
|
+
txn = arg1;
|
|
169
|
+
information = arg2;
|
|
170
|
+
sheetId = arg3;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
txn = arg3[_implicitTxn];
|
|
174
|
+
information = arg1;
|
|
175
|
+
sheetId = arg2;
|
|
176
|
+
}
|
|
177
|
+
txn.iModel.requireMinimumSchemaVersion("BisCore", minimumBisCoreVersion, "SheetInformationAspect");
|
|
178
|
+
const aspect = this.findForSheet(sheetId, txn.iModel);
|
|
170
179
|
if (!information) {
|
|
171
180
|
if (aspect) {
|
|
172
|
-
|
|
181
|
+
txn.deleteAspect(aspect.id);
|
|
173
182
|
}
|
|
174
183
|
return;
|
|
175
184
|
}
|
|
176
185
|
if (aspect) {
|
|
177
186
|
aspect.sheetInformation = { ...information };
|
|
178
|
-
|
|
187
|
+
txn.updateAspect(aspect.toJSON());
|
|
179
188
|
}
|
|
180
189
|
else {
|
|
181
190
|
const info = { ...information };
|
|
@@ -195,7 +204,7 @@ export class SheetInformationAspect extends ElementUniqueAspect {
|
|
|
195
204
|
},
|
|
196
205
|
...info,
|
|
197
206
|
};
|
|
198
|
-
|
|
207
|
+
txn.insertAspect(props);
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Element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AAI,IAAI,CAAC,KAAK;YACZ,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,uBAAuB;AACvB,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,KAApB,oBAAoB,QAcpC","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 ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement, SheetInformation, SheetInformationAspectProps } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { assert, DbResult, Id64String } from \"@itwin/core-bentley\";\nimport { _verifyChannel } from \"./internal/Symbols\";\nimport { SheetOwnsSheetInformationAspect } from \"./NavigationRelationship\";\nimport { Sheet } from \"./Element\";\nimport { ECVersion } from \"@itwin/ecschema-metadata\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n /** The model for the aspect affected by this event */\n model: Id64String;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public @preview\n */\nexport class ElementAspect extends Entity {\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\n }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\n }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(arg: OnAspectIdArg): void {\n const { aspectId, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n const { element } = iModel.elements.getAspect(aspectId);\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\n }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementUniqueAspect extends ElementAspect {\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementMultiAspect extends ElementAspect {\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/**\n * @public @preview\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n public static override get className(): string { return \"ChannelRootAspect\"; }\n /** Insert a ChannelRootAspect on the specified element.\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\n */\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\n iModel.elements.insertAspect(props);\n }\n}\n\nconst minimumBisCoreVersion = new ECVersion(1, 0, 25);\n\n/** An [[ElementUniqueAspect]] that captures common metadata about a single [[Sheet]].\n * Use [[getSheetInformation]] to retrieve the metadata for a Sheet and [[setSheetInformation]] to create, update, or delete it.\n * @beta\n */\nexport class SheetInformationAspect extends ElementUniqueAspect {\n public static override get className() { return \"SheetInformationAspect\"; }\n \n /** The sheet's metadata. */\n public sheetInformation: SheetInformation;\n\n protected static override onInsert(arg: OnAspectPropsArg): void {\n super.onInsert(arg);\n\n const sheet = arg.iModel.elements.tryGetElement<Sheet>(arg.props.element);\n if (!(sheet instanceof Sheet)) {\n throw new Error(\"SheetInformationAspect can only be applied to a Sheet element\");\n }\n }\n\n private constructor(props: SheetInformationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n\n const designedDate = undefined !== props.designedDate ? new Date(props.designedDate) : undefined;\n\n this.sheetInformation = {\n designedBy: props.designedBy,\n designedDate,\n drawnBy: props.drawnBy,\n checkedBy: props.checkedBy,\n };\n }\n\n public override toJSON(): SheetInformationAspectProps {\n const props = super.toJSON() as SheetInformationAspectProps;\n for (const key of [\"designedBy\", \"drawnBy\", \"checkedBy\"] as const) {\n const value = this.sheetInformation[key];\n if (undefined !== value) {\n props[key] = value;\n }\n }\n\n if (undefined !== this.sheetInformation.designedDate) {\n props.designedDate = this.sheetInformation.designedDate.toISOString();\n }\n\n return props;\n }\n\n private static findForSheet(sheetId: Id64String, iModel: IModelDb): SheetInformationAspect | undefined {\n if (!iModel.meetsMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion)) {\n return undefined;\n }\n\n const aspects = iModel.elements.getAspects(sheetId, this.classFullName);\n if (aspects[0]) {\n assert(aspects[0] instanceof SheetInformationAspect);\n return aspects[0];\n }\n\n return undefined;\n }\n\n /** Retrieves the metadata hosted by the aspect on the specified sheet, returning `undefined` if no such metadata could be retrieved.\n * @see [[setSheetInformation]] to create, update, or delete the aspect.\n */\n public static getSheetInformation(sheetId: Id64String, iModel: IModelDb): SheetInformation | undefined {\n const aspect = this.findForSheet(sheetId, iModel);\n return aspect?.sheetInformation;\n }\n\n /** Sets the `information` for the [[Sheet]] element specified by ``sheetId`.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n */\n public static setSheetInformation(information: SheetInformation | undefined, sheetId: Id64String, iModel: IModelDb): void {\n iModel.requireMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion, \"SheetInformationAspect\");\n\n const aspect = this.findForSheet(sheetId, iModel);\n if (!information) {\n if (aspect) {\n iModel.elements.deleteAspect(aspect.id);\n }\n\n return;\n }\n\n if (aspect) {\n aspect.sheetInformation = { ...information };\n iModel.elements.updateAspect(aspect.toJSON());\n } else {\n const info = { ...information } as any;\n for (const key of Object.keys(info)) {\n if (info[key] === undefined) {\n delete info[key];\n }\n }\n\n if (undefined !== info.designedDate) {\n info.designedDate = info.designedDate.toISOString();\n }\n\n const props: SheetInformationAspectProps = {\n classFullName: this.classFullName,\n element: {\n id: sheetId,\n relClassName: SheetOwnsSheetInformationAspect.classFullName,\n },\n ...info,\n };\n\n iModel.elements.insertAspect(props);\n }\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public @preview\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\n }\n });\n return found;\n }\n\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public @preview */\nexport namespace ExternalSourceAspect {\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public @preview\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]]\n */\n Scope = \"Scope\",\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA6F,cAAc,EAAiD,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAc,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC;;;;GAIG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C,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,uBAAuB;AACvB,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,KAApB,oBAAoB,QAcpC","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 ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement, SheetInformation, SheetInformationAspectProps } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { assert, DbResult, Id64String } from \"@itwin/core-bentley\";\nimport { _implicitTxn, _verifyChannel } from \"./internal/Symbols\";\nimport { SheetOwnsSheetInformationAspect } from \"./NavigationRelationship\";\nimport { Sheet } from \"./Element\";\nimport { ECVersion } from \"@itwin/ecschema-metadata\";\nimport { EditTxn } from \"./EditTxn\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n /** The model for the aspect affected by this event */\n model: Id64String;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public @preview\n */\nexport class ElementAspect extends Entity {\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\n }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\n }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(arg: OnAspectIdArg): void {\n const { aspectId, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n const { element } = iModel.elements.getAspect(aspectId);\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\n }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementUniqueAspect extends ElementAspect {\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public @preview\n */\nexport class ElementMultiAspect extends ElementAspect {\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/**\n * @public @preview\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n public static override get className(): string { return \"ChannelRootAspect\"; }\n /** Insert a ChannelRootAspect on the specified element.\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\n */\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\n iModel[_implicitTxn].insertAspect(props);\n }\n}\n\nconst minimumBisCoreVersion = new ECVersion(1, 0, 25);\n\n/** An [[ElementUniqueAspect]] that captures common metadata about a single [[Sheet]].\n * Use [[getSheetInformation]] to retrieve the metadata for a Sheet and [[setSheetInformation]] to create, update, or delete it.\n * @beta\n */\nexport class SheetInformationAspect extends ElementUniqueAspect {\n public static override get className() { return \"SheetInformationAspect\"; }\n\n /** The sheet's metadata. */\n public sheetInformation: SheetInformation;\n\n protected static override onInsert(arg: OnAspectPropsArg): void {\n super.onInsert(arg);\n\n const sheet = arg.iModel.elements.tryGetElement<Sheet>(arg.props.element);\n if (!(sheet instanceof Sheet)) {\n throw new Error(\"SheetInformationAspect can only be applied to a Sheet element\");\n }\n }\n\n private constructor(props: SheetInformationAspectProps, iModel: IModelDb) {\n super(props, iModel);\n\n const designedDate = undefined !== props.designedDate ? new Date(props.designedDate) : undefined;\n\n this.sheetInformation = {\n designedBy: props.designedBy,\n designedDate,\n drawnBy: props.drawnBy,\n checkedBy: props.checkedBy,\n };\n }\n\n public override toJSON(): SheetInformationAspectProps {\n const props = super.toJSON() as SheetInformationAspectProps;\n for (const key of [\"designedBy\", \"drawnBy\", \"checkedBy\"] as const) {\n const value = this.sheetInformation[key];\n if (undefined !== value) {\n props[key] = value;\n }\n }\n\n if (undefined !== this.sheetInformation.designedDate) {\n props.designedDate = this.sheetInformation.designedDate.toISOString();\n }\n\n return props;\n }\n\n private static findForSheet(sheetId: Id64String, iModel: IModelDb): SheetInformationAspect | undefined {\n if (!iModel.meetsMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion)) {\n return undefined;\n }\n\n const aspects = iModel.elements.getAspects(sheetId, this.classFullName);\n if (aspects[0]) {\n assert(aspects[0] instanceof SheetInformationAspect);\n return aspects[0];\n }\n\n return undefined;\n }\n\n /** Retrieves the metadata hosted by the aspect on the specified sheet, returning `undefined` if no such metadata could be retrieved.\n * @see [[setSheetInformation]] to create, update, or delete the aspect.\n */\n public static getSheetInformation(sheetId: Id64String, iModel: IModelDb): SheetInformation | undefined {\n const aspect = this.findForSheet(sheetId, iModel);\n return aspect?.sheetInformation;\n }\n\n /** Sets the `information` for the [[Sheet]] element specified by ``sheetId`.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @deprecated Use SheetInformationAspect.setSheetInformation(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.\n */\n public static setSheetInformation(information: SheetInformation | undefined, sheetId: Id64String, iModel: IModelDb): void;\n\n /** Sets the `information` for the [[Sheet]] element specified by `sheetId`, using an explicit EditTxn.\n * If `information` is `undefined`, any existing aspect will be deleted.\n * Otherwise, a new aspect will be inserted, or an existing aspect will be updated with the new metadata.\n * @throws Error if the iModel contains a version of the BisCore schema older than 01.00.25.\n * @throws EditTxnError if the EditTxn is not active.\n * @beta\n */\n public static setSheetInformation(txn: EditTxn, information: SheetInformation | undefined, sheetId: Id64String): void;\n public static setSheetInformation(arg1: EditTxn | SheetInformation | undefined, arg2: SheetInformation | Id64String | undefined, arg3: Id64String | IModelDb): void {\n let txn: EditTxn;\n let information: SheetInformation | undefined;\n let sheetId: Id64String;\n\n if (arg1 instanceof EditTxn) {\n txn = arg1;\n information = arg2 as SheetInformation | undefined;\n sheetId = arg3 as Id64String;\n } else {\n txn = (arg3 as IModelDb)[_implicitTxn];\n information = arg1;\n sheetId = arg2 as Id64String;\n }\n\n txn.iModel.requireMinimumSchemaVersion(\"BisCore\", minimumBisCoreVersion, \"SheetInformationAspect\");\n\n const aspect = this.findForSheet(sheetId, txn.iModel);\n if (!information) {\n if (aspect) {\n txn.deleteAspect(aspect.id);\n }\n\n return;\n }\n\n if (aspect) {\n aspect.sheetInformation = { ...information };\n txn.updateAspect(aspect.toJSON());\n } else {\n const info = { ...information } as any;\n for (const key of Object.keys(info)) {\n if (info[key] === undefined) {\n delete info[key];\n }\n }\n\n if (undefined !== info.designedDate) {\n info.designedDate = info.designedDate.toISOString();\n }\n\n const props: SheetInformationAspectProps = {\n classFullName: this.classFullName,\n element: {\n id: sheetId,\n relClassName: SheetOwnsSheetInformationAspect.classFullName,\n },\n ...info,\n };\n\n txn.insertAspect(props);\n }\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public @preview\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\n }\n });\n return found;\n }\n\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public @preview */\nexport namespace ExternalSourceAspect {\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public @preview\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]]\n */\n Scope = \"Scope\",\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module Elements
|
|
3
3
|
*/
|
|
4
4
|
import { Id64Array, Id64String } from "@itwin/core-bentley";
|
|
5
|
+
import { EditTxn } from "./EditTxn";
|
|
5
6
|
import { IModelDb } from "./IModelDb";
|
|
6
7
|
import { Model } from "./Model";
|
|
7
8
|
/** @beta */
|
|
@@ -39,8 +40,8 @@ export declare class ElementTreeWalkerScope {
|
|
|
39
40
|
* @beta
|
|
40
41
|
*/
|
|
41
42
|
export declare abstract class ElementTreeBottomUp {
|
|
42
|
-
protected
|
|
43
|
-
constructor(
|
|
43
|
+
protected readonly txn: EditTxn;
|
|
44
|
+
constructor(iModelOrTxn: IModelDb | EditTxn);
|
|
44
45
|
/** Return true if the search should recurse into this model */
|
|
45
46
|
protected shouldExploreModel(_model: Model, _scope: ElementTreeWalkerScope): boolean;
|
|
46
47
|
/** Return true if the search should recurse into the children (if any) of this element */
|
|
@@ -62,9 +63,12 @@ export declare abstract class ElementTreeBottomUp {
|
|
|
62
63
|
}
|
|
63
64
|
/** Helper class that manages the deletion of definitions and subjects */
|
|
64
65
|
declare class SpecialElements {
|
|
66
|
+
private readonly _txn?;
|
|
65
67
|
definitionModels: Id64Array;
|
|
66
68
|
definitions: Id64Array;
|
|
67
69
|
subjects: Id64Array;
|
|
70
|
+
constructor(_txn?: EditTxn | undefined);
|
|
71
|
+
private getTxn;
|
|
68
72
|
recordSpecialElement(iModel: IModelDb, elementId: Id64String): boolean;
|
|
69
73
|
/** Delete special elements - This calls Elements.deleteDefinitionElements to process the collected definition elements as a group and then
|
|
70
74
|
* calls Models.deleteModel on collected definition models. It then deletes all collected Subjects by calling Element.deleteElement on them.
|
|
@@ -80,6 +84,15 @@ declare class SpecialElements {
|
|
|
80
84
|
*/
|
|
81
85
|
export declare class ElementTreeDeleter extends ElementTreeBottomUp {
|
|
82
86
|
protected _special: SpecialElements;
|
|
87
|
+
/**
|
|
88
|
+
* Create an ElementTreeDeleter that uses an explicit EditTxn.
|
|
89
|
+
*/
|
|
90
|
+
constructor(txn: EditTxn);
|
|
91
|
+
/**
|
|
92
|
+
* Create an ElementTreeDeleter.
|
|
93
|
+
* @deprecated Supply an explicit EditTxn.
|
|
94
|
+
*/
|
|
95
|
+
constructor(iModel: IModelDb);
|
|
83
96
|
protected shouldExploreModel(_model: Model): boolean;
|
|
84
97
|
protected shouldVisitElement(_elementId: Id64String): boolean;
|
|
85
98
|
protected visitModel(model: Model, _scope: ElementTreeWalkerScope): void;
|
|
@@ -130,6 +143,15 @@ export declare class ElementSubTreeDeleter extends ElementTreeTopDown {
|
|
|
130
143
|
* @param iModel The iModel
|
|
131
144
|
* @param topElement Where to start the search.
|
|
132
145
|
* @param shouldPruneCb Callback that selects sub-trees that should be deleted.
|
|
146
|
+
* @param txn The EditTxn used to perform the deletes.
|
|
147
|
+
* @see deleteElementSubTrees for a simple way to use this class.
|
|
148
|
+
*/
|
|
149
|
+
constructor(txn: EditTxn, shouldPruneCb: ElementSubTreeDeleteFilter);
|
|
150
|
+
/** Construct an ElementSubTreeDeleter.
|
|
151
|
+
* @param iModel The iModel
|
|
152
|
+
* @param topElement Where to start the search.
|
|
153
|
+
* @param shouldPruneCb Callback that selects sub-trees that should be deleted.
|
|
154
|
+
* @deprecated Supply an explicit EditTxn.
|
|
133
155
|
* @see deleteElementSubTrees for a simple way to use this class.
|
|
134
156
|
*/
|
|
135
157
|
constructor(iModel: IModelDb, shouldPruneCb: ElementSubTreeDeleteFilter);
|
|
@@ -150,6 +172,8 @@ export declare class ElementSubTreeDeleter extends ElementTreeTopDown {
|
|
|
150
172
|
export interface DeleteElementTreeArgs {
|
|
151
173
|
/** The iModel containing the elements to delete. */
|
|
152
174
|
iModel: IModelDb;
|
|
175
|
+
/** The EditTxn used to perform the deletes. */
|
|
176
|
+
txn: EditTxn;
|
|
153
177
|
/** The Id of the root element of the tree to delete. */
|
|
154
178
|
topElement: Id64String;
|
|
155
179
|
/** The maximum number of passes to make when deleting definition elements.
|
|
@@ -157,17 +181,45 @@ export interface DeleteElementTreeArgs {
|
|
|
157
181
|
*/
|
|
158
182
|
maxPasses?: number;
|
|
159
183
|
}
|
|
184
|
+
/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.
|
|
185
|
+
* @param txn The EditTxn used to perform the deletes.
|
|
186
|
+
* @param topElement The parent of the sub-tree
|
|
187
|
+
* @param maxPasses The maximum number of passes to make when deleting definition elements.
|
|
188
|
+
* @beta
|
|
189
|
+
*/
|
|
190
|
+
export declare function deleteElementTree(txn: EditTxn, topElement: Id64String, maxPasses?: number): void;
|
|
160
191
|
/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.
|
|
161
192
|
* @param iModel The iModel
|
|
162
193
|
* @param topElement The parent of the sub-tree
|
|
194
|
+
* @deprecated Supply an explicit `txn`.
|
|
163
195
|
* @beta
|
|
164
196
|
*/
|
|
165
197
|
export declare function deleteElementTree(iModel: IModelDb, topElement: Id64String): void;
|
|
166
198
|
/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.
|
|
167
|
-
* @param args Specifies the
|
|
199
|
+
* @param args Specifies the transaction and top element.
|
|
168
200
|
* @beta
|
|
169
201
|
*/
|
|
170
202
|
export declare function deleteElementTree(args: DeleteElementTreeArgs): void;
|
|
203
|
+
/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.
|
|
204
|
+
* @param args Specifies the iModel and top element.
|
|
205
|
+
* @deprecated Supply `txn` via [[DeleteElementTreeArgs]].
|
|
206
|
+
* @beta
|
|
207
|
+
*/
|
|
208
|
+
export declare function deleteElementTree(args: {
|
|
209
|
+
iModel: IModelDb;
|
|
210
|
+
topElement: Id64String;
|
|
211
|
+
maxPasses?: number;
|
|
212
|
+
}): void;
|
|
213
|
+
/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.
|
|
214
|
+
* If the filter selects the top element itself, then the entire tree (including the top element) is deleted.
|
|
215
|
+
* That has the same effect as calling [[deleteElementTree]] on the top element.
|
|
216
|
+
* @note The caller may have to call this function multiple times if there are multiple layers of dependencies among definition elements.
|
|
217
|
+
* @param txn The EditTxn used to perform the deletes.
|
|
218
|
+
* @param topElement Where to start the search.
|
|
219
|
+
* @param filter Callback that selects sub-trees that should be deleted.
|
|
220
|
+
* @beta
|
|
221
|
+
*/
|
|
222
|
+
export declare function deleteElementSubTrees(txn: EditTxn, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void;
|
|
171
223
|
/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.
|
|
172
224
|
* If the filter selects the top element itself, then the entire tree (including the top element) is deleted.
|
|
173
225
|
* That has the same effect as calling [[deleteElementTree]] on the top element.
|
|
@@ -175,6 +227,7 @@ export declare function deleteElementTree(args: DeleteElementTreeArgs): void;
|
|
|
175
227
|
* @param iModel The iModel
|
|
176
228
|
* @param topElement Where to start the search.
|
|
177
229
|
* @param filter Callback that selects sub-trees that should be deleted.
|
|
230
|
+
* @deprecated Supply `txn` explicitly.
|
|
178
231
|
* @beta
|
|
179
232
|
*/
|
|
180
233
|
export declare function deleteElementSubTrees(iModel: IModelDb, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTreeWalker.d.ts","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ElementTreeWalker.d.ts","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAGhG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,O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,KAAK,CAAC,EAAE,sBAAsB;IAKzF;;OAEG;IACI,4BAA4B;CAGpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,MAAM,EAAE,QAAQ,CAAC;IACjB,+CAA+C;IAC/C,GAAG,EAAE,OAAO,CAAC;IACb,wDAAwD;IACxD,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;AAClG;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;AAClF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAkChH;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;AACtH;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC"}
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
import { assert, DbResult, Logger, LogLevel } from "@itwin/core-bentley";
|
|
9
9
|
import { IModel } from "@itwin/core-common";
|
|
10
10
|
import { BackendLoggerCategory } from "./BackendLoggerCategory";
|
|
11
|
+
import { EditTxn } from "./EditTxn";
|
|
11
12
|
import { DefinitionContainer, DefinitionElement, DefinitionPartition, Element, Subject } from "./Element";
|
|
12
13
|
import { IModelDb } from "./IModelDb";
|
|
13
14
|
import { DefinitionModel, Model } from "./Model";
|
|
15
|
+
import { _implicitTxn } from "./internal/Symbols";
|
|
14
16
|
const loggerCategory = `${BackendLoggerCategory.IModelDb}.ElementTreeWalker`;
|
|
15
17
|
function sortChildrenBeforeParents(iModel, ids) {
|
|
16
18
|
const children = [];
|
|
@@ -154,9 +156,9 @@ function logModel(op, iModel, modelId, scope, logElements) {
|
|
|
154
156
|
* @beta
|
|
155
157
|
*/
|
|
156
158
|
export class ElementTreeBottomUp {
|
|
157
|
-
|
|
158
|
-
constructor(
|
|
159
|
-
this.
|
|
159
|
+
txn;
|
|
160
|
+
constructor(iModelOrTxn) {
|
|
161
|
+
this.txn = iModelOrTxn instanceof EditTxn ? iModelOrTxn : iModelOrTxn[_implicitTxn];
|
|
160
162
|
}
|
|
161
163
|
/** Return true if the search should recurse into this model */
|
|
162
164
|
shouldExploreModel(_model, _scope) { return true; }
|
|
@@ -168,7 +170,7 @@ export class ElementTreeBottomUp {
|
|
|
168
170
|
shouldVisitModel(_model, _scope) { return true; }
|
|
169
171
|
/** The main tree-walking function */
|
|
170
172
|
processElementTree(element, scope) {
|
|
171
|
-
const subModel = this.
|
|
173
|
+
const subModel = this.txn.iModel.models.tryGetModel(element);
|
|
172
174
|
if (subModel !== undefined) {
|
|
173
175
|
if (this.shouldExploreModel(subModel, scope))
|
|
174
176
|
this._processSubModel(subModel, scope);
|
|
@@ -182,7 +184,7 @@ export class ElementTreeBottomUp {
|
|
|
182
184
|
}
|
|
183
185
|
/** process the children of the specified parent element */
|
|
184
186
|
_processChildren(parentElement, parentScope) {
|
|
185
|
-
const children = this.
|
|
187
|
+
const children = this.txn.iModel.elements.queryChildren(parentElement);
|
|
186
188
|
if (children.length === 0)
|
|
187
189
|
return;
|
|
188
190
|
const childrenScope = new ElementTreeWalkerScope(parentScope, parentElement);
|
|
@@ -205,9 +207,18 @@ export class ElementTreeBottomUp {
|
|
|
205
207
|
}
|
|
206
208
|
/** Helper class that manages the deletion of definitions and subjects */
|
|
207
209
|
class SpecialElements {
|
|
210
|
+
_txn;
|
|
208
211
|
definitionModels = [];
|
|
209
212
|
definitions = [];
|
|
210
213
|
subjects = [];
|
|
214
|
+
constructor(_txn) {
|
|
215
|
+
this._txn = _txn;
|
|
216
|
+
}
|
|
217
|
+
getTxn(iModel) {
|
|
218
|
+
if (undefined !== this._txn)
|
|
219
|
+
return this._txn;
|
|
220
|
+
return iModel[_implicitTxn];
|
|
221
|
+
}
|
|
211
222
|
recordSpecialElement(iModel, elementId) {
|
|
212
223
|
// Defer Definitions and Subjects
|
|
213
224
|
const cls = classifyElementForPruning(iModel, elementId);
|
|
@@ -230,6 +241,7 @@ class SpecialElements {
|
|
|
230
241
|
* @note Caller must ensure that the special elements were recorded in a depth-first search.
|
|
231
242
|
*/
|
|
232
243
|
deleteSpecialElements(iModel) {
|
|
244
|
+
const txn = this.getTxn(iModel);
|
|
233
245
|
// It's dangerous to pass a mixture of SubCategories and Categories to deleteDefinitionElements.
|
|
234
246
|
// That function will delete the Categories first, which automatically deletes all their child
|
|
235
247
|
// SubCategories (in native code). If a SubCategory in the list is one of those children, then
|
|
@@ -241,7 +253,7 @@ class SpecialElements {
|
|
|
241
253
|
for (const definitions of sortChildrenBeforeParents(iModel, this.definitions)) {
|
|
242
254
|
if (isTraceEnabled())
|
|
243
255
|
definitions.forEach((e) => logElement("try delete", iModel, e));
|
|
244
|
-
|
|
256
|
+
txn.deleteDefinitionElements(definitions); // will not delete definitions that are still in use.
|
|
245
257
|
}
|
|
246
258
|
for (const m of this.definitionModels) {
|
|
247
259
|
if (!isModelEmpty(iModel, m)) {
|
|
@@ -249,8 +261,8 @@ class SpecialElements {
|
|
|
249
261
|
}
|
|
250
262
|
else {
|
|
251
263
|
logModel("delete", iModel, m);
|
|
252
|
-
|
|
253
|
-
|
|
264
|
+
txn.deleteModel(m);
|
|
265
|
+
txn.deleteElement(m);
|
|
254
266
|
}
|
|
255
267
|
}
|
|
256
268
|
for (const e of this.subjects) {
|
|
@@ -259,7 +271,7 @@ class SpecialElements {
|
|
|
259
271
|
}
|
|
260
272
|
else {
|
|
261
273
|
logElement("delete", iModel, e);
|
|
262
|
-
|
|
274
|
+
txn.deleteElement(e);
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
277
|
}
|
|
@@ -271,20 +283,24 @@ class SpecialElements {
|
|
|
271
283
|
* @beta
|
|
272
284
|
*/
|
|
273
285
|
export class ElementTreeDeleter extends ElementTreeBottomUp {
|
|
274
|
-
_special
|
|
286
|
+
_special;
|
|
287
|
+
constructor(iModelOrTxn) {
|
|
288
|
+
super(iModelOrTxn);
|
|
289
|
+
this._special = new SpecialElements(iModelOrTxn instanceof EditTxn ? iModelOrTxn : undefined);
|
|
290
|
+
}
|
|
275
291
|
shouldExploreModel(_model) { return true; }
|
|
276
292
|
shouldVisitElement(_elementId) { return true; }
|
|
277
293
|
visitModel(model, _scope) {
|
|
278
294
|
if (isDefinitionModel(model))
|
|
279
295
|
return; // we recorded definition models in visitElement when we encountered the DefinitionPartition elements.
|
|
280
296
|
// visitElement has already deleted the elements in the model. So, now it's safe to delete the model itself.
|
|
281
|
-
logModel("delete", this.
|
|
282
|
-
model.
|
|
297
|
+
logModel("delete", this.txn.iModel, model.id, _scope);
|
|
298
|
+
this.txn.deleteModel(model.id);
|
|
283
299
|
}
|
|
284
300
|
visitElement(elementId, _scope) {
|
|
285
|
-
if (!this._special.recordSpecialElement(this.
|
|
286
|
-
logElement("delete", this.
|
|
287
|
-
this.
|
|
301
|
+
if (!this._special.recordSpecialElement(this.txn.iModel, elementId)) {
|
|
302
|
+
logElement("delete", this.txn.iModel, elementId, _scope);
|
|
303
|
+
this.txn.deleteElement(elementId);
|
|
288
304
|
}
|
|
289
305
|
}
|
|
290
306
|
/**
|
|
@@ -294,14 +310,14 @@ export class ElementTreeDeleter extends ElementTreeBottomUp {
|
|
|
294
310
|
* @see deleteSpecialElements
|
|
295
311
|
*/
|
|
296
312
|
deleteNormalElements(topElement, scope) {
|
|
297
|
-
const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this.
|
|
313
|
+
const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this.txn.iModel, topElement);
|
|
298
314
|
this.processElementTree(topElement, topScope); //
|
|
299
315
|
}
|
|
300
316
|
/** Delete all special elements that were found and deferred by deleteNormalElements. Call this
|
|
301
317
|
* function once after all element trees are processed by deleteNormalElements.
|
|
302
318
|
*/
|
|
303
319
|
deleteSpecialElements() {
|
|
304
|
-
this._special.deleteSpecialElements(this.
|
|
320
|
+
this._special.deleteSpecialElements(this.txn.iModel);
|
|
305
321
|
}
|
|
306
322
|
}
|
|
307
323
|
/** Does a breadth-first search on the tree defined by an element and its sub-models and children.
|
|
@@ -356,15 +372,10 @@ class ElementTreeTopDown {
|
|
|
356
372
|
export class ElementSubTreeDeleter extends ElementTreeTopDown {
|
|
357
373
|
_treeDeleter;
|
|
358
374
|
_shouldPruneCb;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
* @see deleteElementSubTrees for a simple way to use this class.
|
|
364
|
-
*/
|
|
365
|
-
constructor(iModel, shouldPruneCb) {
|
|
366
|
-
super(iModel);
|
|
367
|
-
this._treeDeleter = new ElementTreeDeleter(this._iModel);
|
|
375
|
+
constructor(iModelOrTxn, shouldPruneCb) {
|
|
376
|
+
super(iModelOrTxn instanceof EditTxn ? iModelOrTxn.iModel : iModelOrTxn);
|
|
377
|
+
const effectiveTxn = iModelOrTxn instanceof EditTxn ? iModelOrTxn : iModelOrTxn[_implicitTxn];
|
|
378
|
+
this._treeDeleter = new ElementTreeDeleter(effectiveTxn);
|
|
368
379
|
this._shouldPruneCb = shouldPruneCb;
|
|
369
380
|
}
|
|
370
381
|
shouldPrune(elementId, scope) { return this._shouldPruneCb(elementId, scope); }
|
|
@@ -386,39 +397,41 @@ export class ElementSubTreeDeleter extends ElementTreeTopDown {
|
|
|
386
397
|
}
|
|
387
398
|
}
|
|
388
399
|
/** @internal */
|
|
389
|
-
export function deleteElementTree(arg0, arg1) {
|
|
400
|
+
export function deleteElementTree(arg0, arg1, arg2) {
|
|
390
401
|
let maxPasses;
|
|
402
|
+
let txn;
|
|
391
403
|
let iModel;
|
|
392
404
|
let topElement;
|
|
393
|
-
if (arg0 instanceof
|
|
405
|
+
if (arg0 instanceof EditTxn) {
|
|
406
|
+
assert(typeof arg1 === "string");
|
|
407
|
+
txn = arg0;
|
|
408
|
+
iModel = txn.iModel;
|
|
409
|
+
topElement = arg1;
|
|
410
|
+
maxPasses = arg2;
|
|
411
|
+
}
|
|
412
|
+
else if (arg0 instanceof IModelDb) {
|
|
394
413
|
assert(typeof arg1 === "string");
|
|
395
414
|
iModel = arg0;
|
|
396
415
|
topElement = arg1;
|
|
397
416
|
}
|
|
398
417
|
else {
|
|
399
418
|
iModel = arg0.iModel;
|
|
419
|
+
txn = "txn" in arg0 ? arg0.txn : undefined;
|
|
400
420
|
topElement = arg0.topElement;
|
|
401
421
|
maxPasses = arg0.maxPasses;
|
|
402
422
|
}
|
|
403
423
|
maxPasses = maxPasses ?? 5;
|
|
404
424
|
let pass = 0;
|
|
405
425
|
do {
|
|
406
|
-
const
|
|
426
|
+
const effectiveTxn = txn ?? iModel[_implicitTxn];
|
|
427
|
+
const del = new ElementTreeDeleter(effectiveTxn);
|
|
407
428
|
del.deleteNormalElements(topElement);
|
|
408
429
|
del.deleteSpecialElements();
|
|
409
430
|
} while ((iModel.elements.tryGetElement(topElement) !== undefined) && (++pass < maxPasses));
|
|
410
431
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
* @note The caller may have to call this function multiple times if there are multiple layers of dependencies among definition elements.
|
|
415
|
-
* @param iModel The iModel
|
|
416
|
-
* @param topElement Where to start the search.
|
|
417
|
-
* @param filter Callback that selects sub-trees that should be deleted.
|
|
418
|
-
* @beta
|
|
419
|
-
*/
|
|
420
|
-
export function deleteElementSubTrees(iModel, topElement, filter) {
|
|
421
|
-
const del = new ElementSubTreeDeleter(iModel, filter);
|
|
432
|
+
export function deleteElementSubTrees(arg0, topElement, filter) {
|
|
433
|
+
const effectiveTxn = arg0 instanceof EditTxn ? arg0 : arg0[_implicitTxn];
|
|
434
|
+
const del = new ElementSubTreeDeleter(effectiveTxn, filter);
|
|
422
435
|
del.deleteNormalElementSubTrees(topElement);
|
|
423
436
|
del.deleteSpecialElementSubTrees();
|
|
424
437
|
}
|