@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
|
@@ -10,24 +10,40 @@ import { HubWrappers, IModelTestUtils, KnownTestLocations } from "..";
|
|
|
10
10
|
import { _nativeDb, BriefcaseManager, ChangesetECAdaptor, ChannelControl, DrawingCategory, ElementGroupsMembers, SqliteChangesetReader } from "../../core-backend";
|
|
11
11
|
import { HubMock } from "../../internal/HubMock";
|
|
12
12
|
import { StashManager } from "../../StashManager";
|
|
13
|
+
import { EditTxn } from "../../EditTxn";
|
|
13
14
|
import { TestUtils } from "../TestUtils";
|
|
14
15
|
import { existsSync, unlinkSync, writeFileSync } from "fs";
|
|
15
16
|
import * as path from "path";
|
|
16
17
|
import { LineSegment3d, Point3d } from "@itwin/core-geometry";
|
|
17
18
|
chai.use(chaiAsPromised);
|
|
19
|
+
function startTestTxn(iModel, description = "rebase") {
|
|
20
|
+
const txn = new EditTxn(iModel, description);
|
|
21
|
+
txn.start();
|
|
22
|
+
return txn;
|
|
23
|
+
}
|
|
24
|
+
async function importSchemaStrings(txn, schemas) {
|
|
25
|
+
if (txn.isActive)
|
|
26
|
+
txn.saveChanges();
|
|
27
|
+
await txn.iModel.importSchemaStrings(schemas);
|
|
28
|
+
}
|
|
18
29
|
class TestIModel {
|
|
19
30
|
iModelId = "";
|
|
20
31
|
drawingModelId = "";
|
|
21
32
|
drawingCategoryId = "";
|
|
22
33
|
briefcases = [];
|
|
23
34
|
_data = 0;
|
|
35
|
+
_nextAccessToken = 1;
|
|
24
36
|
constructor() { }
|
|
37
|
+
acquireAccessToken() {
|
|
38
|
+
return `user${this._nextAccessToken++}`;
|
|
39
|
+
}
|
|
25
40
|
async startup() {
|
|
26
41
|
HubMock.startup("TestIModel", KnownTestLocations.outputDir);
|
|
27
|
-
|
|
28
|
-
|
|
42
|
+
const accessToken = this.acquireAccessToken();
|
|
43
|
+
this.iModelId = await HubMock.createNewIModel({ accessToken, iTwinId: HubMock.iTwinId, iModelName: "Test", description: "TestSubject" });
|
|
44
|
+
const b1 = await HubWrappers.downloadAndOpenBriefcase({ accessToken, iTwinId: HubMock.iTwinId, iModelId: this.iModelId });
|
|
45
|
+
const b1Txn = startTestTxn(b1, "rebase startup");
|
|
29
46
|
b1.channels.addAllowedChannel(ChannelControl.sharedChannelName);
|
|
30
|
-
b1.saveChanges();
|
|
31
47
|
const schema1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
32
48
|
<ECSchema schemaName="TestDomain" alias="ts" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
33
49
|
<ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
|
|
@@ -49,29 +65,30 @@ class TestIModel {
|
|
|
49
65
|
</Target>
|
|
50
66
|
</ECRelationshipClass>
|
|
51
67
|
</ECSchema>`;
|
|
52
|
-
await
|
|
68
|
+
await importSchemaStrings(b1Txn, [schema1]);
|
|
53
69
|
chai.expect(b1.txns.hasPendingTxns).to.be.true;
|
|
54
70
|
await b1.pushChanges({ description: "schema1" });
|
|
55
71
|
const codeProps = Code.createEmpty();
|
|
56
72
|
codeProps.value = "DrawingModel";
|
|
57
73
|
await b1.locks.acquireLocks({ shared: IModel.dictionaryId });
|
|
58
|
-
this.drawingModelId = IModelTestUtils.createAndInsertDrawingPartitionAndModel(
|
|
74
|
+
this.drawingModelId = IModelTestUtils.createAndInsertDrawingPartitionAndModel(b1Txn, codeProps, true)[1];
|
|
59
75
|
let drawingCategoryId = DrawingCategory.queryCategoryIdByName(b1, IModel.dictionaryId, "MyDrawingCategory");
|
|
60
76
|
if (undefined === drawingCategoryId)
|
|
61
|
-
drawingCategoryId = DrawingCategory.insert(
|
|
77
|
+
drawingCategoryId = DrawingCategory.insert(b1Txn, IModel.dictionaryId, "MyDrawingCategory", new SubCategoryAppearance());
|
|
62
78
|
this.drawingCategoryId = drawingCategoryId;
|
|
63
|
-
|
|
79
|
+
b1Txn.saveChanges();
|
|
64
80
|
await b1.pushChanges({ description: "drawing category" });
|
|
65
81
|
b1.close();
|
|
66
82
|
}
|
|
67
83
|
async openBriefcase() {
|
|
68
|
-
const b = await HubWrappers.downloadAndOpenBriefcase({ iTwinId: HubMock.iTwinId, iModelId: this.iModelId });
|
|
84
|
+
const b = await HubWrappers.downloadAndOpenBriefcase({ accessToken: this.acquireAccessToken(), iTwinId: HubMock.iTwinId, iModelId: this.iModelId });
|
|
69
85
|
b.channels.addAllowedChannel(ChannelControl.sharedChannelName);
|
|
70
|
-
b.saveChanges();
|
|
86
|
+
b[_nativeDb].saveChanges();
|
|
71
87
|
this.briefcases.push(b);
|
|
72
88
|
return b;
|
|
73
89
|
}
|
|
74
|
-
async insertRecipe2d(
|
|
90
|
+
async insertRecipe2d(txn, markAsIndirect) {
|
|
91
|
+
const b = txn.iModel;
|
|
75
92
|
await b.locks.acquireLocks({ shared: [IModel.dictionaryId] });
|
|
76
93
|
const baseProps = {
|
|
77
94
|
classFullName: "TestDomain:A1Recipe2d",
|
|
@@ -81,25 +98,27 @@ class TestIModel {
|
|
|
81
98
|
let id = "";
|
|
82
99
|
if (markAsIndirect) {
|
|
83
100
|
b.txns.withIndirectTxnMode(() => {
|
|
84
|
-
id =
|
|
101
|
+
id = txn.insertElement({ ...baseProps, prop1: `${this._data++}` });
|
|
85
102
|
});
|
|
86
103
|
return id;
|
|
87
104
|
}
|
|
88
|
-
return
|
|
105
|
+
return txn.insertElement({ ...baseProps, prop1: `${this._data++}` });
|
|
89
106
|
}
|
|
90
|
-
async updateRecipe2d(
|
|
107
|
+
async updateRecipe2d(txn, id, markAsIndirect) {
|
|
108
|
+
const b = txn.iModel;
|
|
91
109
|
await b.locks.acquireLocks({ shared: [IModel.dictionaryId], exclusive: [id] });
|
|
92
110
|
const elProps = b.elements.getElementProps(id);
|
|
93
111
|
if (markAsIndirect) {
|
|
94
112
|
b.txns.withIndirectTxnMode(() => {
|
|
95
|
-
|
|
113
|
+
txn.updateElement({ ...elProps, prop1: `${this._data++}` });
|
|
96
114
|
});
|
|
97
115
|
}
|
|
98
116
|
else {
|
|
99
|
-
|
|
117
|
+
txn.updateElement({ ...elProps, prop1: `${this._data++}` });
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
|
-
async insertElement(
|
|
120
|
+
async insertElement(txn, markAsIndirect) {
|
|
121
|
+
const b = txn.iModel;
|
|
103
122
|
await b.locks.acquireLocks({ shared: [this.drawingModelId] });
|
|
104
123
|
const builder = new GeometryStreamBuilder();
|
|
105
124
|
const p1 = Point3d.createZero();
|
|
@@ -117,14 +136,15 @@ class TestIModel {
|
|
|
117
136
|
let id = "";
|
|
118
137
|
if (markAsIndirect) {
|
|
119
138
|
b.txns.withIndirectTxnMode(() => {
|
|
120
|
-
id =
|
|
139
|
+
id = txn.insertElement(baseProps);
|
|
121
140
|
});
|
|
122
141
|
return id;
|
|
123
142
|
}
|
|
124
143
|
baseProps.prop1 = `${this._data++}`;
|
|
125
|
-
return
|
|
144
|
+
return txn.insertElement(baseProps);
|
|
126
145
|
}
|
|
127
|
-
async insertElementEx(
|
|
146
|
+
async insertElementEx(txn, args) {
|
|
147
|
+
const b = txn.iModel;
|
|
128
148
|
await b.locks.acquireLocks({ shared: [this.drawingModelId] });
|
|
129
149
|
const builder = new GeometryStreamBuilder();
|
|
130
150
|
const p1 = Point3d.createZero();
|
|
@@ -143,13 +163,14 @@ class TestIModel {
|
|
|
143
163
|
let id = "";
|
|
144
164
|
if (args?.markAsIndirect) {
|
|
145
165
|
b.txns.withIndirectTxnMode(() => {
|
|
146
|
-
id =
|
|
166
|
+
id = txn.insertElement(props);
|
|
147
167
|
});
|
|
148
168
|
return id;
|
|
149
169
|
}
|
|
150
|
-
return
|
|
170
|
+
return txn.insertElement(props);
|
|
151
171
|
}
|
|
152
|
-
async updateElement(
|
|
172
|
+
async updateElement(txn, id, markAsIndirect, updateGeom) {
|
|
173
|
+
const b = txn.iModel;
|
|
153
174
|
await b.locks.acquireLocks({ shared: [this.drawingModelId], exclusive: [id] });
|
|
154
175
|
const elProps = b.elements.getElementProps(id);
|
|
155
176
|
if (updateGeom) {
|
|
@@ -162,22 +183,23 @@ class TestIModel {
|
|
|
162
183
|
}
|
|
163
184
|
if (markAsIndirect) {
|
|
164
185
|
b.txns.withIndirectTxnMode(() => {
|
|
165
|
-
|
|
186
|
+
txn.updateElement({ ...elProps, prop1: `${this._data++}` });
|
|
166
187
|
});
|
|
167
188
|
}
|
|
168
189
|
else {
|
|
169
|
-
|
|
190
|
+
txn.updateElement({ ...elProps, prop1: `${this._data++}` });
|
|
170
191
|
}
|
|
171
192
|
}
|
|
172
|
-
async deleteElement(
|
|
193
|
+
async deleteElement(txn, id, markAsIndirect) {
|
|
194
|
+
const b = txn.iModel;
|
|
173
195
|
await b.locks.acquireLocks({ shared: [this.drawingModelId], exclusive: [id] });
|
|
174
196
|
if (markAsIndirect) {
|
|
175
197
|
b.txns.withIndirectTxnMode(() => {
|
|
176
|
-
|
|
198
|
+
txn.deleteElement(id);
|
|
177
199
|
});
|
|
178
200
|
}
|
|
179
201
|
else {
|
|
180
|
-
|
|
202
|
+
txn.deleteElement(id);
|
|
181
203
|
}
|
|
182
204
|
}
|
|
183
205
|
async shutdown() {
|
|
@@ -217,8 +239,9 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
217
239
|
});
|
|
218
240
|
it("save changes args", async () => {
|
|
219
241
|
const b1 = await testIModel.openBriefcase();
|
|
220
|
-
|
|
221
|
-
|
|
242
|
+
const b1Txn = startTestTxn(b1, "save changes args");
|
|
243
|
+
await testIModel.insertElement(b1Txn);
|
|
244
|
+
b1Txn.saveChanges({
|
|
222
245
|
source: "test",
|
|
223
246
|
description: "test description",
|
|
224
247
|
appData: {
|
|
@@ -243,8 +266,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
243
266
|
chai.expect(lastTxn.reversed).to.be.false;
|
|
244
267
|
chai.expect(lastTxn.grouped).to.be.false;
|
|
245
268
|
}
|
|
246
|
-
await testIModel.insertElement(
|
|
247
|
-
|
|
269
|
+
await testIModel.insertElement(b1Txn);
|
|
270
|
+
b1Txn.saveChanges({
|
|
248
271
|
source: "test2",
|
|
249
272
|
description: "test description 2",
|
|
250
273
|
appData: {
|
|
@@ -269,8 +292,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
269
292
|
chai.expect(lastTxn.reversed).to.be.false;
|
|
270
293
|
chai.expect(lastTxn.grouped).to.be.false;
|
|
271
294
|
}
|
|
272
|
-
await testIModel.insertElement(
|
|
273
|
-
|
|
295
|
+
await testIModel.insertElement(b1Txn);
|
|
296
|
+
b1Txn.saveChanges("new element");
|
|
274
297
|
lastTxn = b1.txns.getLastSavedTxnProps();
|
|
275
298
|
chai.assert.isDefined(lastTxn);
|
|
276
299
|
if (lastTxn) {
|
|
@@ -292,11 +315,12 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
292
315
|
});
|
|
293
316
|
it("direct / indirect", async () => {
|
|
294
317
|
const b1 = await testIModel.openBriefcase();
|
|
295
|
-
const
|
|
296
|
-
const
|
|
318
|
+
const b1Txn = startTestTxn(b1, "direct indirect");
|
|
319
|
+
const directElId = await testIModel.insertElement(b1Txn);
|
|
320
|
+
const indirectElId = await testIModel.insertElement(b1Txn, true);
|
|
297
321
|
chai.expect(directElId).to.not.be.undefined;
|
|
298
322
|
chai.expect(indirectElId).to.not.be.undefined;
|
|
299
|
-
|
|
323
|
+
b1Txn.saveChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
300
324
|
const txn = b1.txns.getLastSavedTxnProps();
|
|
301
325
|
chai.assert.isDefined(txn);
|
|
302
326
|
if (txn) {
|
|
@@ -327,51 +351,54 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
327
351
|
it("rebase handler", async () => {
|
|
328
352
|
const b1 = await testIModel.openBriefcase();
|
|
329
353
|
const b2 = await testIModel.openBriefcase();
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
|
|
354
|
+
const b1Txn = startTestTxn(b1, "rebase handler b1");
|
|
355
|
+
const b2Txn = startTestTxn(b2, "rebase handler b2");
|
|
356
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
357
|
+
const e2 = await testIModel.insertElement(b1Txn, true);
|
|
358
|
+
b1Txn.saveChanges();
|
|
333
359
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
334
360
|
await b2.pullChanges();
|
|
335
|
-
await testIModel.updateElement(
|
|
336
|
-
await testIModel.updateElement(
|
|
337
|
-
|
|
361
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
362
|
+
await testIModel.updateElement(b1Txn, e2, true);
|
|
363
|
+
b1Txn.saveChanges();
|
|
338
364
|
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
339
|
-
await testIModel.insertElement(
|
|
340
|
-
await testIModel.insertElement(
|
|
341
|
-
|
|
342
|
-
await testIModel.insertElement(
|
|
343
|
-
await testIModel.insertElement(
|
|
344
|
-
|
|
345
|
-
await testIModel.insertElement(
|
|
346
|
-
await testIModel.insertElement(
|
|
347
|
-
|
|
365
|
+
await testIModel.insertElement(b2Txn);
|
|
366
|
+
await testIModel.insertElement(b2Txn, true);
|
|
367
|
+
b2Txn.saveChanges("first change");
|
|
368
|
+
await testIModel.insertElement(b2Txn);
|
|
369
|
+
await testIModel.insertElement(b2Txn, true);
|
|
370
|
+
b2Txn.saveChanges("second change");
|
|
371
|
+
await testIModel.insertElement(b2Txn);
|
|
372
|
+
await testIModel.insertElement(b2Txn, true);
|
|
373
|
+
b2Txn.saveChanges("third change");
|
|
348
374
|
b2.txns.rebaser.setCustomHandler({
|
|
349
375
|
shouldReinstate: (_txn) => {
|
|
350
376
|
return true;
|
|
351
377
|
},
|
|
352
378
|
recompute: async (_txn) => {
|
|
353
|
-
await testIModel.insertElement(
|
|
354
|
-
await testIModel.insertElement(
|
|
379
|
+
await testIModel.insertElement(b2Txn);
|
|
380
|
+
await testIModel.insertElement(b2Txn, true);
|
|
355
381
|
},
|
|
356
382
|
});
|
|
357
383
|
await b1.pullChanges();
|
|
358
384
|
});
|
|
359
385
|
it("stash & drop", async () => {
|
|
360
386
|
const b1 = await testIModel.openBriefcase();
|
|
361
|
-
const
|
|
362
|
-
|
|
387
|
+
const b1Txn = startTestTxn(b1, "stash drop");
|
|
388
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
389
|
+
b1Txn.saveChanges();
|
|
363
390
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
364
|
-
const e2 = await testIModel.insertElement(
|
|
365
|
-
|
|
391
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
392
|
+
b1Txn.saveChanges();
|
|
366
393
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
367
|
-
await testIModel.insertElement(
|
|
368
|
-
|
|
369
|
-
await testIModel.updateElement(
|
|
370
|
-
|
|
371
|
-
await testIModel.deleteElement(
|
|
372
|
-
|
|
373
|
-
await testIModel.insertElement(
|
|
374
|
-
|
|
394
|
+
await testIModel.insertElement(b1Txn);
|
|
395
|
+
b1Txn.saveChanges(`first`);
|
|
396
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
397
|
+
b1Txn.saveChanges(`second`);
|
|
398
|
+
await testIModel.deleteElement(b1Txn, e2);
|
|
399
|
+
b1Txn.saveChanges(`third`);
|
|
400
|
+
await testIModel.insertElement(b1Txn);
|
|
401
|
+
b1Txn.saveChanges(`fourth`);
|
|
375
402
|
const stash1 = await StashManager.stash({ db: b1, description: "stash test 1" });
|
|
376
403
|
chai.expect(stash1).to.exist;
|
|
377
404
|
chai.assert(Guid.isGuid(stash1.id));
|
|
@@ -395,12 +422,12 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
395
422
|
chai.expect(stash1.txns[1].id).to.equals("0x100000001");
|
|
396
423
|
chai.expect(stash1.txns[2].id).to.equals("0x100000002");
|
|
397
424
|
chai.expect(stash1.txns[3].id).to.equals("0x100000003");
|
|
398
|
-
await testIModel.insertElement(
|
|
399
|
-
|
|
400
|
-
await testIModel.updateElement(
|
|
401
|
-
|
|
402
|
-
await testIModel.insertElement(
|
|
403
|
-
|
|
425
|
+
await testIModel.insertElement(b1Txn);
|
|
426
|
+
b1Txn.saveChanges(`fifth`);
|
|
427
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
428
|
+
b1Txn.saveChanges(`sixth`);
|
|
429
|
+
await testIModel.insertElement(b1Txn);
|
|
430
|
+
b1Txn.saveChanges(`seventh`);
|
|
404
431
|
const stash2 = await StashManager.stash({ db: b1, description: "stash test 2" });
|
|
405
432
|
chai.expect(stash2).to.exist;
|
|
406
433
|
chai.expect(stash2.description).to.equals("stash test 2");
|
|
@@ -464,6 +491,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
464
491
|
});
|
|
465
492
|
it("should fail to importSchemas() & importSchemaStrings() in indirect scope", async () => {
|
|
466
493
|
const b1 = await testIModel.openBriefcase();
|
|
494
|
+
const b1Txn = startTestTxn(b1, "indirect schema import failures");
|
|
467
495
|
const schema = `<?xml version="1.0" encoding="UTF-8"?>
|
|
468
496
|
<ECSchema schemaName="MySchema" alias="ms1" version="01.00.00" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
469
497
|
<ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
|
|
@@ -477,28 +505,29 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
477
505
|
unlinkSync(schemaFile);
|
|
478
506
|
}
|
|
479
507
|
writeFileSync(schemaFile, schema, { encoding: "utf8" });
|
|
508
|
+
b1Txn.end("abandon");
|
|
480
509
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
481
510
|
await b1.importSchemas([schema]);
|
|
482
511
|
})).to.be.rejectedWith("Cannot import schemas while in an indirect change scope");
|
|
483
|
-
|
|
512
|
+
b1Txn.start();
|
|
513
|
+
b1Txn.end("abandon");
|
|
484
514
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
485
515
|
await b1.importSchemaStrings([schema]);
|
|
486
516
|
})).to.be.rejectedWith("Cannot import schemas while in an indirect change scope");
|
|
487
|
-
b1.abandonChanges();
|
|
488
517
|
await b1.importSchemaStrings([schema]);
|
|
489
|
-
b1.saveChanges();
|
|
490
518
|
await b1.pushChanges({ description: "import schema" });
|
|
491
519
|
});
|
|
492
520
|
it("should fail to saveChanges() & pushChanges() in indirect scope", async () => {
|
|
493
521
|
const b1 = await testIModel.openBriefcase();
|
|
494
|
-
|
|
522
|
+
const b1Txn = startTestTxn(b1, "indirect save push failures");
|
|
523
|
+
await testIModel.insertElement(b1Txn);
|
|
495
524
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
496
|
-
|
|
525
|
+
b1Txn.saveChanges();
|
|
497
526
|
})).to.be.rejectedWith("Cannot save changes while in an indirect change scope");
|
|
498
527
|
chai.expect(() => b1.txns.withIndirectTxnMode(() => {
|
|
499
|
-
|
|
528
|
+
b1Txn.saveChanges();
|
|
500
529
|
})).to.be.throws("Cannot save changes while in an indirect change scope");
|
|
501
|
-
|
|
530
|
+
b1Txn.saveChanges();
|
|
502
531
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
503
532
|
await b1.pushChanges({ description: "test" });
|
|
504
533
|
})).to.be.rejectedWith("Cannot pull and apply changeset while in an indirect change scope");
|
|
@@ -507,23 +536,24 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
507
536
|
it("should fail to saveFileProperty/deleteFileProperty in indirect scope", async () => {
|
|
508
537
|
// pull/push/saveFileProperty/deleteFileProperty should be called inside indirect change scope.
|
|
509
538
|
const b1 = await testIModel.openBriefcase();
|
|
510
|
-
|
|
539
|
+
const b1Txn = startTestTxn(b1, "indirect file property failures");
|
|
540
|
+
b1Txn.saveFileProperty({ namespace: "test", name: "test" }, "Hello, World");
|
|
511
541
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
512
|
-
|
|
542
|
+
b1Txn.saveFileProperty({ namespace: "test", name: "test" }, "This should fail 1");
|
|
513
543
|
})).to.be.rejectedWith("Cannot save file property while in an indirect change scope");
|
|
514
544
|
chai.expect(b1.queryFilePropertyString({ namespace: "test", name: "test" })).to.equal("Hello, World");
|
|
515
545
|
await chai.expect(b1.txns.withIndirectTxnModeAsync(async () => {
|
|
516
|
-
|
|
517
|
-
})).to.be.rejectedWith("Cannot
|
|
546
|
+
b1Txn.deleteFileProperty({ namespace: "test", name: "test" });
|
|
547
|
+
})).to.be.rejectedWith("Cannot save file property while in an indirect change scope");
|
|
518
548
|
chai.expect(b1.queryFilePropertyString({ namespace: "test", name: "test" })).to.equal("Hello, World");
|
|
519
549
|
chai.expect(() => b1.txns.withIndirectTxnMode(() => {
|
|
520
|
-
|
|
550
|
+
b1Txn.saveFileProperty({ namespace: "test", name: "test" }, "This should fail 2");
|
|
521
551
|
})).to.be.throws("Cannot save file property while in an indirect change scope");
|
|
522
552
|
chai.expect(b1.queryFilePropertyString({ namespace: "test", name: "test" })).to.equal("Hello, World");
|
|
523
553
|
chai.expect(() => b1.txns.withIndirectTxnMode(() => {
|
|
524
|
-
|
|
525
|
-
})).to.be.throws("Cannot
|
|
526
|
-
|
|
554
|
+
b1Txn.deleteFileProperty({ namespace: "test", name: "test" });
|
|
555
|
+
})).to.be.throws("Cannot save file property while in an indirect change scope");
|
|
556
|
+
b1Txn.saveChanges();
|
|
527
557
|
});
|
|
528
558
|
it("recursively calling withIndirectTxnModeAsync()", async () => {
|
|
529
559
|
const b1 = await testIModel.openBriefcase();
|
|
@@ -561,19 +591,20 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
561
591
|
});
|
|
562
592
|
it("should restore mutually exclusive stashes", async () => {
|
|
563
593
|
const b1 = await testIModel.openBriefcase();
|
|
594
|
+
const b1Txn = startTestTxn(b1, "restore mutually exclusive stashes");
|
|
564
595
|
// stash 1
|
|
565
|
-
const e1 = await testIModel.insertElement(
|
|
596
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
566
597
|
chai.expect(e1).to.exist;
|
|
567
|
-
|
|
598
|
+
b1Txn.saveChanges("first");
|
|
568
599
|
const stash1 = await StashManager.stash({ db: b1, description: "stash test 1", discardLocalChanges: true, retainLocks: true });
|
|
569
600
|
chai.expect(stash1).to.exist;
|
|
570
601
|
chai.expect(b1.elements.tryGetElement(e1)).to.undefined;
|
|
571
602
|
chai.expect(b1.txns.isUndoPossible).to.be.false;
|
|
572
603
|
chai.expect(b1.txns.isRedoPossible).to.be.false;
|
|
573
604
|
// stash 2
|
|
574
|
-
const e2 = await testIModel.insertElement(
|
|
605
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
575
606
|
chai.expect(e2).to.exist;
|
|
576
|
-
|
|
607
|
+
b1Txn.saveChanges("second");
|
|
577
608
|
const stash2 = await StashManager.stash({ db: b1, description: "stash test 2", discardLocalChanges: true, retainLocks: true });
|
|
578
609
|
chai.expect(stash2).to.exist;
|
|
579
610
|
chai.expect(b1.elements.tryGetElement(e1)).to.undefined;
|
|
@@ -581,9 +612,9 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
581
612
|
chai.expect(b1.txns.isUndoPossible).to.be.false;
|
|
582
613
|
chai.expect(b1.txns.isRedoPossible).to.be.false;
|
|
583
614
|
// stash 3
|
|
584
|
-
const e3 = await testIModel.insertElement(
|
|
615
|
+
const e3 = await testIModel.insertElement(b1Txn);
|
|
585
616
|
chai.expect(e3).to.exist;
|
|
586
|
-
|
|
617
|
+
b1Txn.saveChanges("third");
|
|
587
618
|
const stash3 = await StashManager.stash({ db: b1, description: "stash test 3", discardLocalChanges: true, retainLocks: true });
|
|
588
619
|
chai.expect(stash3).to.exist;
|
|
589
620
|
chai.expect(b1.elements.tryGetElement(e1)).to.undefined;
|
|
@@ -617,10 +648,11 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
617
648
|
});
|
|
618
649
|
it("should restore stash in any order", async () => {
|
|
619
650
|
const b1 = await testIModel.openBriefcase();
|
|
651
|
+
const b1Txn = startTestTxn(b1, "restore stash any order");
|
|
620
652
|
// stash 1
|
|
621
|
-
const e1 = await testIModel.insertElement(
|
|
653
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
622
654
|
chai.expect(e1).to.exist;
|
|
623
|
-
|
|
655
|
+
b1Txn.saveChanges("first");
|
|
624
656
|
// do not discard local changes
|
|
625
657
|
const stash1 = await StashManager.stash({ db: b1, description: "stash test 1" });
|
|
626
658
|
chai.expect(stash1).to.exist;
|
|
@@ -628,9 +660,9 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
628
660
|
chai.expect(b1.txns.isUndoPossible).to.be.true;
|
|
629
661
|
chai.expect(b1.txns.isRedoPossible).to.be.false;
|
|
630
662
|
// stash 2
|
|
631
|
-
const e2 = await testIModel.insertElement(
|
|
663
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
632
664
|
chai.expect(e2).to.exist;
|
|
633
|
-
|
|
665
|
+
b1Txn.saveChanges("second");
|
|
634
666
|
// do not discard local changes
|
|
635
667
|
const stash2 = await StashManager.stash({ db: b1, description: "stash test 2" });
|
|
636
668
|
chai.expect(stash2).to.exist;
|
|
@@ -639,9 +671,9 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
639
671
|
chai.expect(b1.txns.isUndoPossible).to.be.true;
|
|
640
672
|
chai.expect(b1.txns.isRedoPossible).to.be.false;
|
|
641
673
|
// stash 3
|
|
642
|
-
const e3 = await testIModel.insertElement(
|
|
674
|
+
const e3 = await testIModel.insertElement(b1Txn);
|
|
643
675
|
chai.expect(e3).to.exist;
|
|
644
|
-
|
|
676
|
+
b1Txn.saveChanges("third");
|
|
645
677
|
// do not discard local changes
|
|
646
678
|
const stash3 = await StashManager.stash({ db: b1, description: "stash test 3" });
|
|
647
679
|
chai.expect(stash3).to.exist;
|
|
@@ -680,16 +712,18 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
680
712
|
it("should restore stash when briefcase has advanced to latest changeset", async () => {
|
|
681
713
|
const b1 = await testIModel.openBriefcase();
|
|
682
714
|
const b2 = await testIModel.openBriefcase();
|
|
715
|
+
const b1Txn = startTestTxn(b1, "restore stash latest changeset b1");
|
|
716
|
+
const b2Txn = startTestTxn(b2, "restore stash latest changeset b2");
|
|
683
717
|
chai.expect(b1.changeset.index).to.equals(2);
|
|
684
718
|
chai.expect(b2.changeset.index).to.equals(2);
|
|
685
|
-
const e1 = await testIModel.insertElement(
|
|
719
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
686
720
|
chai.expect(e1).to.exist;
|
|
687
|
-
|
|
721
|
+
b1Txn.saveChanges();
|
|
688
722
|
await b1.pushChanges({ description: `${e1} inserted` });
|
|
689
723
|
chai.expect(b1.changeset.index).to.equals(3);
|
|
690
|
-
const e2 = await testIModel.insertElement(
|
|
724
|
+
const e2 = await testIModel.insertElement(b2Txn);
|
|
691
725
|
chai.expect(e2).to.exist;
|
|
692
|
-
|
|
726
|
+
b2Txn.saveChanges();
|
|
693
727
|
chai.expect(b2.elements.tryGetElement(e1)).to.undefined;
|
|
694
728
|
chai.expect(b2.elements.tryGetElement(e2)).to.exist;
|
|
695
729
|
const b2Stash1 = await StashManager.stash({ db: b2, description: "stash test 1", discardLocalChanges: true });
|
|
@@ -715,24 +749,26 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
715
749
|
it("restore stash that has element changed by another briefcase", async () => {
|
|
716
750
|
const b1 = await testIModel.openBriefcase();
|
|
717
751
|
const b2 = await testIModel.openBriefcase();
|
|
752
|
+
const b1Txn = startTestTxn(b1, "restore stash changed element b1");
|
|
753
|
+
const b2Txn = startTestTxn(b2, "restore stash changed element b2");
|
|
718
754
|
chai.expect(b1.changeset.index).to.equals(2);
|
|
719
755
|
chai.expect(b2.changeset.index).to.equals(2);
|
|
720
|
-
const e1 = await testIModel.insertElement(
|
|
756
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
721
757
|
chai.expect(e1).to.exist;
|
|
722
|
-
|
|
758
|
+
b1Txn.saveChanges();
|
|
723
759
|
await b1.pushChanges({ description: `${e1} inserted` });
|
|
724
760
|
chai.expect(b1.changeset.index).to.equals(3);
|
|
725
761
|
await b2.pullChanges();
|
|
726
762
|
chai.expect(b2.changeset.index).to.equals(3);
|
|
727
|
-
await testIModel.updateElement(
|
|
728
|
-
|
|
763
|
+
await testIModel.updateElement(b2Txn, e1);
|
|
764
|
+
b2Txn.saveChanges();
|
|
729
765
|
chai.expect(b2.locks.holdsExclusiveLock(e1)).to.be.true;
|
|
730
766
|
const b2Stash1 = await StashManager.stash({ db: b2, description: "stash test 1", discardLocalChanges: true });
|
|
731
767
|
chai.expect(b2Stash1.parentChangeset.index).to.equals(3);
|
|
732
768
|
chai.expect(b2.locks.holdsExclusiveLock(e1)).to.be.false;
|
|
733
769
|
// stash release lock so b2 should have released lock and b1 should be able to update.
|
|
734
|
-
await testIModel.updateElement(
|
|
735
|
-
|
|
770
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
771
|
+
b1Txn.saveChanges();
|
|
736
772
|
// restore stash should fail because of lock not obtained on e1
|
|
737
773
|
await chai.expect(StashManager.restore({ db: b2, stash: b2Stash1 })).to.be.rejectedWith("exclusive lock is already held");
|
|
738
774
|
// push b1 changes to release lock
|
|
@@ -751,6 +787,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
751
787
|
});
|
|
752
788
|
it("schema change should not be stashed", async () => {
|
|
753
789
|
const b1 = await testIModel.openBriefcase();
|
|
790
|
+
const b1Txn = startTestTxn(b1, "schema change should not be stashed");
|
|
754
791
|
const schema1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
755
792
|
<ECSchema schemaName="TestDomain" alias="ts" version="01.00.01" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
756
793
|
<ECSchemaReference name="BisCore" version="01.00.00" alias="bis"/>
|
|
@@ -773,27 +810,28 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
773
810
|
</Target>
|
|
774
811
|
</ECRelationshipClass>
|
|
775
812
|
</ECSchema>`;
|
|
776
|
-
await
|
|
777
|
-
b1.saveChanges();
|
|
813
|
+
await importSchemaStrings(b1Txn, [schema1]);
|
|
778
814
|
await chai.expect(StashManager.stash({ db: b1, description: "stash test 1" })).to.not.rejectedWith("Bad Arg: Pending schema changeset stashing is not currently supported");
|
|
779
815
|
});
|
|
780
816
|
it("abort rebase", async () => {
|
|
781
817
|
const b1 = await testIModel.openBriefcase();
|
|
782
818
|
const b2 = await testIModel.openBriefcase();
|
|
783
|
-
const
|
|
784
|
-
|
|
819
|
+
const b1Txn = startTestTxn(b1, "abort rebase b1");
|
|
820
|
+
const b2Txn = startTestTxn(b2, "abort rebase b2");
|
|
821
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
822
|
+
b1Txn.saveChanges();
|
|
785
823
|
await b1.pushChanges({ description: `${e1} inserted` });
|
|
786
|
-
const e2 = await testIModel.insertElement(
|
|
824
|
+
const e2 = await testIModel.insertElement(b2Txn);
|
|
787
825
|
chai.expect(e2).to.exist;
|
|
788
826
|
let e3 = "";
|
|
789
|
-
|
|
827
|
+
b2Txn.saveChanges();
|
|
790
828
|
b2.txns.rebaser.setCustomHandler({
|
|
791
829
|
shouldReinstate: (_txnProps) => {
|
|
792
830
|
return true;
|
|
793
831
|
},
|
|
794
832
|
recompute: async (_txnProps) => {
|
|
795
833
|
chai.expect(BriefcaseManager.containsRestorePoint(b2, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)).is.true;
|
|
796
|
-
e3 = await testIModel.insertElement(
|
|
834
|
+
e3 = await testIModel.insertElement(b2Txn);
|
|
797
835
|
throw new Error("Rebase failed");
|
|
798
836
|
},
|
|
799
837
|
});
|
|
@@ -818,24 +856,27 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
818
856
|
});
|
|
819
857
|
it("calling discardChanges() from inside indirect scope is not allowed", async () => {
|
|
820
858
|
const b1 = await testIModel.openBriefcase();
|
|
821
|
-
|
|
822
|
-
|
|
859
|
+
const b1Txn = startTestTxn(b1, "discard changes inside indirect scope");
|
|
860
|
+
await testIModel.insertElement(b1Txn);
|
|
861
|
+
b1Txn.saveChanges();
|
|
823
862
|
const p1 = b1.txns.withIndirectTxnModeAsync(async () => {
|
|
824
863
|
await b1.discardChanges();
|
|
825
864
|
});
|
|
826
865
|
await chai.expect(p1).to.be.rejectedWith("Cannot discard changes when there are indirect changes");
|
|
827
|
-
|
|
866
|
+
b1Txn.saveChanges();
|
|
828
867
|
});
|
|
829
868
|
it("calling discardChanges() during rebasing is not allowed", async () => {
|
|
830
869
|
const b1 = await testIModel.openBriefcase();
|
|
831
870
|
const b2 = await testIModel.openBriefcase();
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
871
|
+
const b1Txn = startTestTxn(b1, "discard changes during rebasing b1");
|
|
872
|
+
const b2Txn = startTestTxn(b2, "discard changes during rebasing b2");
|
|
873
|
+
await testIModel.insertElement(b1Txn);
|
|
874
|
+
await testIModel.insertElement(b1Txn);
|
|
875
|
+
b1Txn.saveChanges();
|
|
835
876
|
await b1.pushChanges({ description: "inserted element" });
|
|
836
|
-
await testIModel.insertElement(
|
|
837
|
-
await testIModel.insertElement(
|
|
838
|
-
|
|
877
|
+
await testIModel.insertElement(b2Txn);
|
|
878
|
+
await testIModel.insertElement(b2Txn);
|
|
879
|
+
b2Txn.saveChanges();
|
|
839
880
|
b2.txns.rebaser.setCustomHandler({
|
|
840
881
|
shouldReinstate: (_txnProps) => {
|
|
841
882
|
return true;
|
|
@@ -859,17 +900,19 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
859
900
|
it("edge case: a indirect update can cause FK violation", async () => {
|
|
860
901
|
const b1 = await testIModel.openBriefcase();
|
|
861
902
|
const b2 = await testIModel.openBriefcase();
|
|
862
|
-
const
|
|
863
|
-
const
|
|
864
|
-
|
|
903
|
+
const b1Txn = startTestTxn(b1, "indirect update fk violation b1");
|
|
904
|
+
const b2Txn = startTestTxn(b2, "indirect update fk violation b2");
|
|
905
|
+
const parentId = await testIModel.insertElement(b1Txn);
|
|
906
|
+
const childId = await testIModel.insertElementEx(b1Txn, { parent: { id: parentId, relClassName: "TestDomain:A1OwnsA1" } });
|
|
907
|
+
b1Txn.saveChanges("insert parent and child");
|
|
865
908
|
await b1.pushChanges({ description: `inserted parent ${parentId} and child ${childId}` });
|
|
866
909
|
await b2.pullChanges();
|
|
867
910
|
// b1 delete childId while b1 create a child of childId as indirect change
|
|
868
|
-
await testIModel.deleteElement(
|
|
869
|
-
|
|
911
|
+
await testIModel.deleteElement(b1Txn, childId);
|
|
912
|
+
b1Txn.saveChanges("delete child");
|
|
870
913
|
// no exclusive lock required on child1
|
|
871
|
-
const grandChildId = await testIModel.insertElementEx(
|
|
872
|
-
|
|
914
|
+
const grandChildId = await testIModel.insertElementEx(b2Txn, { parent: { id: childId, relClassName: "TestDomain:A1OwnsA1" }, markAsIndirect: true });
|
|
915
|
+
b2Txn.saveChanges("delete child and insert grandchild");
|
|
873
916
|
await b1.pushChanges({ description: `deleted child ${childId}` });
|
|
874
917
|
// should fail to pull and rebase changes.
|
|
875
918
|
await chai.expect(b2.pushChanges({ description: `deleted child ${childId} and inserted grandchild ${grandChildId}` }))
|
|
@@ -877,6 +920,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
877
920
|
});
|
|
878
921
|
it("ECSqlReader unable to read updates after saveChanges()", async () => {
|
|
879
922
|
const b1 = await testIModel.openBriefcase();
|
|
923
|
+
const b1Txn = startTestTxn(b1, "ecsql reader updates after saveChanges");
|
|
880
924
|
const findElement = async (id) => {
|
|
881
925
|
const reader = b1.createQueryReader(`SELECT ECInstanceId, ec_className(ECClassId), Prop1 FROM ts.A1 WHERE ECInstanceId = ${id}`, QueryBinder.from([id]));
|
|
882
926
|
if (await reader.step())
|
|
@@ -897,45 +941,47 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
897
941
|
// Following query have open cached statement against BisCore.Element that will prevent
|
|
898
942
|
// updates from being visible until the statement is finalized.
|
|
899
943
|
await runQueryParallel(`SELECT $ FROM BisCore.Element`, 10);
|
|
900
|
-
const e1 = await testIModel.insertElement(
|
|
944
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
901
945
|
chai.expect(await findElement(e1)).to.be.undefined;
|
|
902
|
-
|
|
946
|
+
b1Txn.saveChanges("insert element");
|
|
903
947
|
const e1Props = await findElement(e1);
|
|
904
948
|
chai.expect(e1Props).to.exist;
|
|
905
949
|
await runQueryParallel(`SELECT $ FROM BisCore.Element`, 10);
|
|
906
|
-
const e2 = await testIModel.insertElement(
|
|
950
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
907
951
|
chai.expect(await findElement(e2)).to.be.undefined;
|
|
908
|
-
|
|
952
|
+
b1Txn.saveChanges("insert second element");
|
|
909
953
|
const e2Props = await findElement(e2);
|
|
910
954
|
chai.expect(e2Props).to.exist;
|
|
911
955
|
await runQueryParallel(`SELECT $ FROM BisCore.Element`, 10);
|
|
912
|
-
const e3 = await testIModel.insertElement(
|
|
956
|
+
const e3 = await testIModel.insertElement(b1Txn);
|
|
913
957
|
chai.expect(await findElement(e3)).to.be.undefined;
|
|
914
|
-
|
|
958
|
+
b1Txn.saveChanges("insert third element");
|
|
915
959
|
const e3Props = await findElement(e3);
|
|
916
960
|
chai.expect(e3Props).to.exist;
|
|
917
961
|
});
|
|
918
962
|
it("enum txn changes in recompute", async () => {
|
|
919
963
|
const b1 = await testIModel.openBriefcase();
|
|
920
964
|
const b2 = await testIModel.openBriefcase();
|
|
921
|
-
const
|
|
922
|
-
const
|
|
923
|
-
|
|
965
|
+
const b1Txn = startTestTxn(b1, "enum txn changes in recompute b1");
|
|
966
|
+
const b2Txn = startTestTxn(b2, "enum txn changes in recompute b2");
|
|
967
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
968
|
+
const e2 = await testIModel.insertElement(b1Txn, true);
|
|
969
|
+
b1Txn.saveChanges();
|
|
924
970
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
925
971
|
await b2.pullChanges();
|
|
926
|
-
await testIModel.updateElement(
|
|
927
|
-
await testIModel.updateElement(
|
|
928
|
-
|
|
972
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
973
|
+
await testIModel.updateElement(b1Txn, e2, true);
|
|
974
|
+
b1Txn.saveChanges();
|
|
929
975
|
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
930
|
-
await testIModel.insertElement(
|
|
931
|
-
await testIModel.insertElement(
|
|
932
|
-
|
|
933
|
-
await testIModel.insertElement(
|
|
934
|
-
await testIModel.insertElement(
|
|
935
|
-
|
|
936
|
-
await testIModel.insertElement(
|
|
937
|
-
await testIModel.insertElement(
|
|
938
|
-
|
|
976
|
+
await testIModel.insertElement(b2Txn);
|
|
977
|
+
await testIModel.insertElement(b2Txn, true);
|
|
978
|
+
b2Txn.saveChanges("first change");
|
|
979
|
+
await testIModel.insertElement(b2Txn);
|
|
980
|
+
await testIModel.insertElement(b2Txn, true);
|
|
981
|
+
b2Txn.saveChanges("second change");
|
|
982
|
+
await testIModel.insertElement(b2Txn);
|
|
983
|
+
await testIModel.insertElement(b2Txn, true);
|
|
984
|
+
b2Txn.saveChanges("third change");
|
|
939
985
|
let txnVerified = 0;
|
|
940
986
|
b2.txns.rebaser.setCustomHandler({
|
|
941
987
|
shouldReinstate: (_txn) => {
|
|
@@ -974,24 +1020,26 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
974
1020
|
it("before and after rebase events", async () => {
|
|
975
1021
|
const b1 = await testIModel.openBriefcase();
|
|
976
1022
|
const b2 = await testIModel.openBriefcase();
|
|
977
|
-
const
|
|
978
|
-
const
|
|
979
|
-
|
|
1023
|
+
const b1Txn = startTestTxn(b1, "before and after rebase events b1");
|
|
1024
|
+
const b2Txn = startTestTxn(b2, "before and after rebase events b2");
|
|
1025
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1026
|
+
const e2 = await testIModel.insertElement(b1Txn, true);
|
|
1027
|
+
b1Txn.saveChanges();
|
|
980
1028
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
981
1029
|
await b2.pullChanges();
|
|
982
|
-
await testIModel.updateElement(
|
|
983
|
-
await testIModel.updateElement(
|
|
984
|
-
|
|
1030
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
1031
|
+
await testIModel.updateElement(b1Txn, e2, true);
|
|
1032
|
+
b1Txn.saveChanges();
|
|
985
1033
|
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
986
|
-
await testIModel.insertElement(
|
|
987
|
-
await testIModel.insertElement(
|
|
988
|
-
|
|
989
|
-
await testIModel.insertElement(
|
|
990
|
-
await testIModel.insertElement(
|
|
991
|
-
|
|
992
|
-
await testIModel.insertElement(
|
|
993
|
-
await testIModel.insertElement(
|
|
994
|
-
|
|
1034
|
+
await testIModel.insertElement(b2Txn);
|
|
1035
|
+
await testIModel.insertElement(b2Txn, true);
|
|
1036
|
+
b2Txn.saveChanges("first change");
|
|
1037
|
+
await testIModel.insertElement(b2Txn);
|
|
1038
|
+
await testIModel.insertElement(b2Txn, true);
|
|
1039
|
+
b2Txn.saveChanges("second change");
|
|
1040
|
+
await testIModel.insertElement(b2Txn);
|
|
1041
|
+
await testIModel.insertElement(b2Txn, true);
|
|
1042
|
+
b2Txn.saveChanges("third change");
|
|
995
1043
|
const events = {
|
|
996
1044
|
onRebase: {
|
|
997
1045
|
beginCount: 0,
|
|
@@ -1177,13 +1225,13 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1177
1225
|
chai.expect(events.onRebaseTxn.endTxns.map((txn) => txn.id)).to.deep.equal(["0x100000000", "0x100000001", "0x100000002"]);
|
|
1178
1226
|
chai.expect(events.rebaseHandler.shouldReinstate.map((txn) => txn.id)).to.deep.equal(["0x100000000", "0x100000001", "0x100000002"]);
|
|
1179
1227
|
chai.expect(events.rebaseHandler.recompute.map((txn) => txn.id)).to.deep.equal(["0x100000000", "0x100000001", "0x100000002"]);
|
|
1180
|
-
await testIModel.updateElement(
|
|
1181
|
-
await testIModel.updateElement(
|
|
1182
|
-
|
|
1228
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
1229
|
+
await testIModel.updateElement(b1Txn, e2, true);
|
|
1230
|
+
b1Txn.saveChanges();
|
|
1183
1231
|
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
1184
|
-
await testIModel.insertElement(
|
|
1185
|
-
await testIModel.insertElement(
|
|
1186
|
-
|
|
1232
|
+
await testIModel.insertElement(b2Txn);
|
|
1233
|
+
await testIModel.insertElement(b2Txn, true);
|
|
1234
|
+
b2Txn.saveChanges("fourth change");
|
|
1187
1235
|
resetEvent();
|
|
1188
1236
|
await b2.pullChanges();
|
|
1189
1237
|
chai.expect(events.onRebase.beginCount).to.equal(1);
|
|
@@ -1244,10 +1292,11 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1244
1292
|
it("onModelGeometryChanged() not fired during rebase/pullMerge with no local change", async () => {
|
|
1245
1293
|
const b1 = await testIModel.openBriefcase();
|
|
1246
1294
|
const b2 = await testIModel.openBriefcase();
|
|
1295
|
+
const b2Txn = startTestTxn(b2, "model geometry changed no local change b2");
|
|
1247
1296
|
const pushChangeFromB2 = async () => {
|
|
1248
1297
|
await b2.pullChanges();
|
|
1249
|
-
await testIModel.insertElement(
|
|
1250
|
-
|
|
1298
|
+
await testIModel.insertElement(b2Txn);
|
|
1299
|
+
b2Txn.saveChanges();
|
|
1251
1300
|
await b2.pushChanges({ description: "insert element on b2" });
|
|
1252
1301
|
};
|
|
1253
1302
|
const events = {
|
|
@@ -1283,10 +1332,12 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1283
1332
|
it("onModelGeometryChanged() fired during rebase with geometric local change", async () => {
|
|
1284
1333
|
const b1 = await testIModel.openBriefcase();
|
|
1285
1334
|
const b2 = await testIModel.openBriefcase();
|
|
1335
|
+
const b1Txn = startTestTxn(b1, "model geometry changed geometric local change b1");
|
|
1336
|
+
const b2Txn = startTestTxn(b2, "model geometry changed geometric local change b2");
|
|
1286
1337
|
const pushChangeFromB2 = async () => {
|
|
1287
1338
|
await b2.pullChanges();
|
|
1288
|
-
await testIModel.insertElement(
|
|
1289
|
-
|
|
1339
|
+
await testIModel.insertElement(b2Txn);
|
|
1340
|
+
b2Txn.saveChanges();
|
|
1290
1341
|
await b2.pushChanges({ description: "insert element on b2" });
|
|
1291
1342
|
};
|
|
1292
1343
|
const events = {
|
|
@@ -1308,11 +1359,11 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1308
1359
|
events.onGeometryChanged.push(changes);
|
|
1309
1360
|
});
|
|
1310
1361
|
clearEvents();
|
|
1311
|
-
const e1 = await testIModel.insertElement(
|
|
1312
|
-
const e2 = await testIModel.insertElement(
|
|
1362
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1363
|
+
const e2 = await testIModel.insertElement(b1Txn, true);
|
|
1313
1364
|
chai.expect(e1).to.exist;
|
|
1314
1365
|
chai.expect(e2).to.exist;
|
|
1315
|
-
|
|
1366
|
+
b1Txn.saveChanges(`insert element ${e1} and ${e2}`);
|
|
1316
1367
|
chai.expect(events.modelGeometryChanged.length).to.equal(1);
|
|
1317
1368
|
chai.expect(events.modelGeometryChanged[0].length).to.equal(1);
|
|
1318
1369
|
chai.expect(events.modelGeometryChanged[0][0].id).to.equal("0x20000000001");
|
|
@@ -1322,8 +1373,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1322
1373
|
return true;
|
|
1323
1374
|
},
|
|
1324
1375
|
recompute: async (_txn) => {
|
|
1325
|
-
await testIModel.updateElement(
|
|
1326
|
-
await testIModel.updateElement(
|
|
1376
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
1377
|
+
await testIModel.updateElement(b1Txn, e2);
|
|
1327
1378
|
},
|
|
1328
1379
|
});
|
|
1329
1380
|
await pushChangeFromB2();
|
|
@@ -1337,10 +1388,12 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1337
1388
|
it("onModelGeometryChanged() fired during rebase with non-geometric local change", async () => {
|
|
1338
1389
|
const b1 = await testIModel.openBriefcase();
|
|
1339
1390
|
const b2 = await testIModel.openBriefcase();
|
|
1391
|
+
const b1Txn = startTestTxn(b1, "model geometry changed non geometric local change b1");
|
|
1392
|
+
const b2Txn = startTestTxn(b2, "model geometry changed non geometric local change b2");
|
|
1340
1393
|
const pushChangeFromB2 = async () => {
|
|
1341
1394
|
await b2.pullChanges();
|
|
1342
|
-
await testIModel.insertElement(
|
|
1343
|
-
|
|
1395
|
+
await testIModel.insertElement(b2Txn);
|
|
1396
|
+
b2Txn.saveChanges();
|
|
1344
1397
|
await b2.pushChanges({ description: "insert element on b2" });
|
|
1345
1398
|
};
|
|
1346
1399
|
const events = {
|
|
@@ -1365,8 +1418,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1365
1418
|
},
|
|
1366
1419
|
});
|
|
1367
1420
|
await pushChangeFromB2();
|
|
1368
|
-
await testIModel.insertRecipe2d(
|
|
1369
|
-
|
|
1421
|
+
await testIModel.insertRecipe2d(b1Txn);
|
|
1422
|
+
b1Txn.saveChanges();
|
|
1370
1423
|
clearEvents();
|
|
1371
1424
|
const geomGuidBeforePull = getGeometryGuidFromB1("0x20000000001");
|
|
1372
1425
|
chai.expect(geomGuidBeforePull).is.undefined;
|
|
@@ -1378,10 +1431,12 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1378
1431
|
it("onModelGeometryChanged() fired during rebase with geometric local change", async () => {
|
|
1379
1432
|
const b1 = await testIModel.openBriefcase();
|
|
1380
1433
|
const b2 = await testIModel.openBriefcase();
|
|
1434
|
+
const b1Txn = startTestTxn(b1, "model geometry changed geometric local recipe b1");
|
|
1435
|
+
const b2Txn = startTestTxn(b2, "model geometry changed geometric local recipe b2");
|
|
1381
1436
|
const pushChangeFromB2 = async () => {
|
|
1382
1437
|
await b2.pullChanges();
|
|
1383
|
-
await testIModel.insertRecipe2d(
|
|
1384
|
-
|
|
1438
|
+
await testIModel.insertRecipe2d(b2Txn);
|
|
1439
|
+
b2Txn.saveChanges();
|
|
1385
1440
|
await b2.pushChanges({ description: "insert element on b2" });
|
|
1386
1441
|
};
|
|
1387
1442
|
const events = {
|
|
@@ -1408,7 +1463,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1408
1463
|
return true;
|
|
1409
1464
|
},
|
|
1410
1465
|
recompute: async (_txn) => {
|
|
1411
|
-
await testIModel.insertElement(
|
|
1466
|
+
await testIModel.insertElement(b1Txn);
|
|
1412
1467
|
},
|
|
1413
1468
|
});
|
|
1414
1469
|
await pushChangeFromB2();
|
|
@@ -1423,22 +1478,24 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1423
1478
|
it("rebase multi txn", async () => {
|
|
1424
1479
|
const b1 = await testIModel.openBriefcase();
|
|
1425
1480
|
const b2 = await testIModel.openBriefcase();
|
|
1426
|
-
const
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1481
|
+
const b1Txn = startTestTxn(b1, "rebase multi txn b1");
|
|
1482
|
+
const b2Txn = startTestTxn(b2, "rebase multi txn b2");
|
|
1483
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1484
|
+
const e2 = await testIModel.insertElement(b1Txn, true);
|
|
1485
|
+
b1Txn.saveChanges();
|
|
1429
1486
|
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
1430
1487
|
await b2.pullChanges();
|
|
1431
1488
|
chai.expect(b2.txns.beginMultiTxnOperation()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1432
|
-
let elId = await testIModel.insertElement(
|
|
1433
|
-
|
|
1434
|
-
elId = await testIModel.insertElement(
|
|
1435
|
-
|
|
1436
|
-
elId = await testIModel.insertElement(
|
|
1437
|
-
|
|
1489
|
+
let elId = await testIModel.insertElement(b2Txn);
|
|
1490
|
+
b2Txn.saveChanges(`insert element ${elId}`);
|
|
1491
|
+
elId = await testIModel.insertElement(b2Txn);
|
|
1492
|
+
b2Txn.saveChanges(`insert element ${elId}`);
|
|
1493
|
+
elId = await testIModel.insertElement(b2Txn);
|
|
1494
|
+
b2Txn.saveChanges(`insert element ${elId}`);
|
|
1438
1495
|
chai.expect(b2.txns.endMultiTxnOperation()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1439
|
-
|
|
1440
|
-
elId = await testIModel.insertElement(
|
|
1441
|
-
|
|
1496
|
+
b2Txn.saveChanges();
|
|
1497
|
+
elId = await testIModel.insertElement(b2Txn);
|
|
1498
|
+
b2Txn.saveChanges(`insert element ${elId}`);
|
|
1442
1499
|
let txns = Array.from(b2.txns.queryTxns());
|
|
1443
1500
|
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1444
1501
|
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
@@ -1555,9 +1612,9 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1555
1612
|
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1556
1613
|
chai.expect(txns[3].reversed).to.be.equals(false);
|
|
1557
1614
|
chai.expect(b2.txns.isRedoPossible).to.be.equals(false);
|
|
1558
|
-
await testIModel.updateElement(
|
|
1559
|
-
await testIModel.updateElement(
|
|
1560
|
-
|
|
1615
|
+
await testIModel.updateElement(b1Txn, e1);
|
|
1616
|
+
await testIModel.updateElement(b1Txn, e2, true);
|
|
1617
|
+
b1Txn.saveChanges();
|
|
1561
1618
|
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
1562
1619
|
const recomputeTxnIds = [];
|
|
1563
1620
|
b2.txns.rebaser.setCustomHandler({
|
|
@@ -1579,20 +1636,22 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1579
1636
|
it("abort rebase should discard in-memory changes", async () => {
|
|
1580
1637
|
const b1 = await testIModel.openBriefcase();
|
|
1581
1638
|
const b2 = await testIModel.openBriefcase();
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1639
|
+
const b1Txn = startTestTxn(b1, "abort rebase discard memory b1");
|
|
1640
|
+
const b2Txn = startTestTxn(b2, "abort rebase discard memory b2");
|
|
1641
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1642
|
+
b1Txn.saveChanges();
|
|
1584
1643
|
await b1.pushChanges({ description: `${e1} inserted` });
|
|
1585
|
-
const e2 = await testIModel.insertElement(
|
|
1644
|
+
const e2 = await testIModel.insertElement(b2Txn);
|
|
1586
1645
|
chai.expect(e2).to.exist;
|
|
1587
1646
|
let e3 = "";
|
|
1588
|
-
|
|
1647
|
+
b2Txn.saveChanges();
|
|
1589
1648
|
b2.txns.rebaser.setCustomHandler({
|
|
1590
1649
|
shouldReinstate: (_txnProps) => {
|
|
1591
1650
|
return true;
|
|
1592
1651
|
},
|
|
1593
1652
|
recompute: async (_txnProps) => {
|
|
1594
1653
|
chai.expect(BriefcaseManager.containsRestorePoint(b2, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)).is.true;
|
|
1595
|
-
e3 = await testIModel.insertElement(
|
|
1654
|
+
e3 = await testIModel.insertElement(b2Txn);
|
|
1596
1655
|
throw new Error("Rebase failed");
|
|
1597
1656
|
},
|
|
1598
1657
|
});
|
|
@@ -1608,7 +1667,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1608
1667
|
chai.expect(b2.elements.tryGetElementProps(e3)).to.undefined; // was insert by reCompute() but due to exception the rebase attempt was abandoned.
|
|
1609
1668
|
chai.expect(BriefcaseManager.containsRestorePoint(b2, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)).is.true;
|
|
1610
1669
|
// make temp change
|
|
1611
|
-
|
|
1670
|
+
b2Txn.saveFileProperty({ name: "test", namespace: "testNamespace" }, "testValue");
|
|
1612
1671
|
chai.expect(b2.txns.hasUnsavedChanges).is.true;
|
|
1613
1672
|
chai.expect(b2.txns.rebaser.canAbort()).is.true;
|
|
1614
1673
|
// should abort with unsaved local changes
|
|
@@ -1622,28 +1681,30 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1622
1681
|
it("two users insert same ElementGroupsMembers instance", async () => {
|
|
1623
1682
|
const b1 = await testIModel.openBriefcase();
|
|
1624
1683
|
const b2 = await testIModel.openBriefcase();
|
|
1625
|
-
const
|
|
1626
|
-
const
|
|
1627
|
-
const
|
|
1628
|
-
const
|
|
1684
|
+
const b1Txn = startTestTxn(b1, "same ElementGroupsMembers b1");
|
|
1685
|
+
const b2Txn = startTestTxn(b2, "same ElementGroupsMembers b2");
|
|
1686
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1687
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
1688
|
+
const e3 = await testIModel.insertElement(b1Txn);
|
|
1689
|
+
const e4 = await testIModel.insertElement(b1Txn);
|
|
1629
1690
|
chai.expect(e1).to.exist;
|
|
1630
1691
|
chai.expect(e2).to.exist;
|
|
1631
1692
|
chai.expect(e3).to.exist;
|
|
1632
1693
|
chai.expect(e4).to.exist;
|
|
1633
|
-
|
|
1694
|
+
b1Txn.saveChanges();
|
|
1634
1695
|
await b1.pushChanges({ description: `inserted elements` });
|
|
1635
1696
|
await b2.pullChanges();
|
|
1636
|
-
const r1 =
|
|
1637
|
-
const r2 =
|
|
1697
|
+
const r1 = b1Txn.insertRelationship(ElementGroupsMembers.create(b1, e1, e2, 10).toJSON());
|
|
1698
|
+
const r2 = b1Txn.insertRelationship(ElementGroupsMembers.create(b1, e3, e4, 20).toJSON());
|
|
1638
1699
|
chai.expect(r1).to.exist;
|
|
1639
1700
|
chai.expect(r2).to.exist;
|
|
1640
|
-
|
|
1701
|
+
b1Txn.saveChanges();
|
|
1641
1702
|
await b1.pushChanges({ description: `inserted relationship` });
|
|
1642
|
-
const r3 =
|
|
1643
|
-
const r4 =
|
|
1703
|
+
const r3 = b2Txn.insertRelationship(ElementGroupsMembers.create(b2, e1, e2, 10).toJSON());
|
|
1704
|
+
const r4 = b2Txn.insertRelationship(ElementGroupsMembers.create(b2, e3, e4, 20).toJSON());
|
|
1644
1705
|
chai.expect(r3).to.exist;
|
|
1645
1706
|
chai.expect(r4).to.exist;
|
|
1646
|
-
|
|
1707
|
+
b2Txn.saveChanges();
|
|
1647
1708
|
await b2.pushChanges({ description: `inserted relationship` });
|
|
1648
1709
|
await b2.pullChanges();
|
|
1649
1710
|
chai.expect(b2.relationships.tryGetInstanceProps(ElementGroupsMembers.classFullName, r1)).to.exist;
|
|
@@ -1658,41 +1719,43 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1658
1719
|
it("one user update and other delete the link table relationships", async () => {
|
|
1659
1720
|
const b1 = await testIModel.openBriefcase();
|
|
1660
1721
|
const b2 = await testIModel.openBriefcase();
|
|
1661
|
-
const
|
|
1662
|
-
const
|
|
1663
|
-
const
|
|
1664
|
-
const
|
|
1722
|
+
const b1Txn = startTestTxn(b1, "relationship update delete b1");
|
|
1723
|
+
const b2Txn = startTestTxn(b2, "relationship update delete b2");
|
|
1724
|
+
const e1 = await testIModel.insertElement(b1Txn);
|
|
1725
|
+
const e2 = await testIModel.insertElement(b1Txn);
|
|
1726
|
+
const r1 = b1Txn.insertRelationship(ElementGroupsMembers.create(b1, e1, e2, 10).toJSON());
|
|
1727
|
+
const r2 = b1Txn.insertRelationship(ElementGroupsMembers.create(b1, e1, e2, 20).toJSON());
|
|
1665
1728
|
chai.expect(e1).to.exist;
|
|
1666
1729
|
chai.expect(e2).to.exist;
|
|
1667
1730
|
chai.expect(r1).to.exist;
|
|
1668
1731
|
chai.expect(r2).to.exist;
|
|
1669
|
-
|
|
1732
|
+
b1Txn.saveChanges();
|
|
1670
1733
|
await b1.pushChanges({ description: `inserted elements and relationship` });
|
|
1671
1734
|
await b2.pullChanges();
|
|
1672
1735
|
// intentionally change memberPriority to 10 for which there is another relationship already exists.
|
|
1673
|
-
chai.expect(() =>
|
|
1736
|
+
chai.expect(() => b2Txn.updateRelationship({
|
|
1674
1737
|
id: r1,
|
|
1675
1738
|
classFullName: ElementGroupsMembers.classFullName,
|
|
1676
1739
|
sourceId: e1,
|
|
1677
1740
|
targetId: e2,
|
|
1678
1741
|
memberPriority: 20
|
|
1679
1742
|
})).to.throws("error updating relationship");
|
|
1680
|
-
|
|
1743
|
+
b2Txn.updateRelationship({
|
|
1681
1744
|
id: r1,
|
|
1682
1745
|
classFullName: ElementGroupsMembers.classFullName,
|
|
1683
1746
|
sourceId: e1,
|
|
1684
1747
|
targetId: e2,
|
|
1685
1748
|
memberPriority: 60
|
|
1686
1749
|
});
|
|
1687
|
-
|
|
1750
|
+
b1Txn.deleteRelationship({
|
|
1688
1751
|
id: r1,
|
|
1689
1752
|
classFullName: ElementGroupsMembers.classFullName,
|
|
1690
1753
|
sourceId: e1,
|
|
1691
1754
|
targetId: e2
|
|
1692
1755
|
});
|
|
1693
|
-
|
|
1756
|
+
b1Txn.saveChanges();
|
|
1694
1757
|
await b1.pushChanges({ description: `deleted relationship` });
|
|
1695
|
-
|
|
1758
|
+
b2Txn.saveChanges();
|
|
1696
1759
|
await b2.pushChanges({ description: `updated relationship` });
|
|
1697
1760
|
await b2.pullChanges();
|
|
1698
1761
|
await b1.pullChanges();
|
|
@@ -1702,17 +1765,19 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1702
1765
|
it("aborting rebaser in middle of rebase session where at least one txn is successfully rebased (used to cause crash)", async () => {
|
|
1703
1766
|
const b1 = await testIModel.openBriefcase();
|
|
1704
1767
|
const b2 = await testIModel.openBriefcase();
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1768
|
+
const b1Txn = startTestTxn(b1, "abort rebaser mid session b1");
|
|
1769
|
+
const b2Txn = startTestTxn(b2, "abort rebaser mid session b2");
|
|
1770
|
+
const createTxn = async (txn) => {
|
|
1771
|
+
const id = await testIModel.insertElement(txn);
|
|
1707
1772
|
chai.expect(id).is.exist;
|
|
1708
|
-
|
|
1773
|
+
txn.saveChanges(`created element ${id}`);
|
|
1709
1774
|
return id;
|
|
1710
1775
|
};
|
|
1711
|
-
const e1 = await createTxn(
|
|
1776
|
+
const e1 = await createTxn(b1Txn);
|
|
1712
1777
|
await b1.pushChanges({ description: `${e1} inserted` });
|
|
1713
|
-
const e2 = await createTxn(
|
|
1714
|
-
const e3 = await createTxn(
|
|
1715
|
-
const e4 = await createTxn(
|
|
1778
|
+
const e2 = await createTxn(b2Txn);
|
|
1779
|
+
const e3 = await createTxn(b2Txn);
|
|
1780
|
+
const e4 = await createTxn(b2Txn);
|
|
1716
1781
|
let e5 = "";
|
|
1717
1782
|
b2.txns.rebaser.setCustomHandler({
|
|
1718
1783
|
shouldReinstate: (_txnProps) => {
|
|
@@ -1721,7 +1786,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1721
1786
|
recompute: async (txnProps) => {
|
|
1722
1787
|
chai.expect(BriefcaseManager.containsRestorePoint(b2, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)).is.true;
|
|
1723
1788
|
if (txnProps.id === "0x100000001") {
|
|
1724
|
-
e5 = await testIModel.insertElement(
|
|
1789
|
+
e5 = await testIModel.insertElement(b2Txn);
|
|
1725
1790
|
throw new Error("Rebase failed");
|
|
1726
1791
|
}
|
|
1727
1792
|
},
|
|
@@ -1733,7 +1798,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1733
1798
|
chai.expect(b2.elements.tryGetElementProps(e5)).to.be.undefined;
|
|
1734
1799
|
chai.expect(b2.changeset.index).to.equals(2);
|
|
1735
1800
|
await chai.expect(b2.pullChanges()).to.be.rejectedWith("Rebase failed");
|
|
1736
|
-
await chai.expect(createTxn(
|
|
1801
|
+
await chai.expect(createTxn(b2Txn)).to.be.rejectedWith(`Could not save changes (created element 0x40000000004)`);
|
|
1737
1802
|
chai.expect(b2.changeset.index).to.equals(3);
|
|
1738
1803
|
chai.expect(e3).to.exist;
|
|
1739
1804
|
chai.expect(b2.elements.tryGetElementProps(e1)).to.exist;
|
|
@@ -1743,7 +1808,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1743
1808
|
chai.expect(b2.elements.tryGetElementProps(e5)).to.exist;
|
|
1744
1809
|
chai.expect(BriefcaseManager.containsRestorePoint(b2, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME)).is.true;
|
|
1745
1810
|
// make temp change
|
|
1746
|
-
|
|
1811
|
+
b2Txn.saveFileProperty({ name: "test", namespace: "testNamespace" }, "testValue");
|
|
1747
1812
|
chai.expect(b2.txns.hasUnsavedChanges).is.true;
|
|
1748
1813
|
chai.expect(b2.txns.rebaser.canAbort()).is.true;
|
|
1749
1814
|
// should abort with unsaved local changes
|
|
@@ -1761,8 +1826,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1761
1826
|
},
|
|
1762
1827
|
recompute: async (_txnProps) => { },
|
|
1763
1828
|
});
|
|
1764
|
-
const e6 = await createTxn(
|
|
1765
|
-
|
|
1829
|
+
const e6 = await createTxn(b2Txn);
|
|
1830
|
+
b2Txn.saveChanges(`created element ${e6}`);
|
|
1766
1831
|
chai.expect(b2.txns.getCurrentTxnId()).to.equal("0x100000004");
|
|
1767
1832
|
chai.expect(b2.txns.getLastSavedTxnProps()?.id).to.equal(`0x100000003`);
|
|
1768
1833
|
await b2.pullChanges();
|
|
@@ -1770,8 +1835,8 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1770
1835
|
chai.expect(b2.elements.tryGetElementProps(e2)).to.exist;
|
|
1771
1836
|
chai.expect(b2.elements.tryGetElementProps(e3)).to.exist;
|
|
1772
1837
|
chai.expect(b2.elements.tryGetElementProps(e4)).to.exist;
|
|
1773
|
-
const e7 = await createTxn(
|
|
1774
|
-
|
|
1838
|
+
const e7 = await createTxn(b2Txn);
|
|
1839
|
+
b2Txn.saveChanges(`created element ${e7}`);
|
|
1775
1840
|
chai.expect(b2.txns.getCurrentTxnId()).to.equal("0x100000005");
|
|
1776
1841
|
chai.expect(b2.txns.getLastSavedTxnProps()?.id).to.equal(`0x100000004`);
|
|
1777
1842
|
await b2.pushChanges({ description: "pushed after rebase aborted" });
|
|
@@ -1785,6 +1850,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1785
1850
|
it("changeset DDL error are ignored and ec_* tables are used to reconstruct the sqlite tables", async () => {
|
|
1786
1851
|
const b1 = await testIModel.openBriefcase();
|
|
1787
1852
|
const b2 = await testIModel.openBriefcase();
|
|
1853
|
+
const b1Txn = startTestTxn(b1, "changeset ddl reconstruction b1");
|
|
1788
1854
|
const iModelId = testIModel.iModelId;
|
|
1789
1855
|
const targetDir = path.join(KnownTestLocations.outputDir, iModelId, "changesets");
|
|
1790
1856
|
let ver = 0;
|
|
@@ -1847,7 +1913,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1847
1913
|
chai.expect(getColumnNames(b1, tblGeom2d)).deep.equals(geom2dBaseColumnList);
|
|
1848
1914
|
chai.expect(getColumnNames(b2, tblGeom2d)).deep.equals(geom2dBaseColumnList);
|
|
1849
1915
|
// Import schema that add 5 new properties that should add 3 new shared columns
|
|
1850
|
-
await
|
|
1916
|
+
await importSchemaStrings(b1Txn, [generateSchema(5)]);
|
|
1851
1917
|
await b1.pushChanges({ description: `imported schema version 1.0.${ver - 1}` });
|
|
1852
1918
|
// Verify columns after schema import
|
|
1853
1919
|
chai.expect(getColumnNames(b1, tblGeom2d)).deep.equals([...geom2dBaseColumnList, "js3", "js4", "js5"]);
|
|
@@ -1861,7 +1927,7 @@ for (const enableSemanticRebase of [false, true]) {
|
|
|
1861
1927
|
await b2.pullChanges();
|
|
1862
1928
|
chai.expect(getColumnNames(b2, "bis_GeometricElement2d")).deep.equals([...geom2dBaseColumnList, "js3", "js4", "js5"]);
|
|
1863
1929
|
// Import schema that add 5 new properties that should add 3 new shared columns
|
|
1864
|
-
await
|
|
1930
|
+
await importSchemaStrings(b1Txn, [generateSchema(1)]);
|
|
1865
1931
|
await b1.pushChanges({ description: `imported schema version 1.0.${ver - 1}` });
|
|
1866
1932
|
// Verify columns after schema import
|
|
1867
1933
|
chai.expect(getColumnNames(b1, tblGeom2d)).deep.equals([...geom2dBaseColumnList, "js3", "js4", "js5", "js6"]);
|