@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
|
@@ -7,6 +7,7 @@ import { CompressedId64Set, Guid } from "@itwin/core-bentley";
|
|
|
7
7
|
import { IModel, SkyBoxImageType } from "@itwin/core-common";
|
|
8
8
|
import { DisplayStyle3d, IModelElementCloneContext, SnapshotDb, SpatialCategory, StandaloneDb, SubCategory } from "../../core-backend";
|
|
9
9
|
import { IModelTestUtils } from "../IModelTestUtils";
|
|
10
|
+
import { withEditTxn } from "../../EditTxn";
|
|
10
11
|
describe("DisplayStyle", () => {
|
|
11
12
|
it("preserves skybox", () => {
|
|
12
13
|
const localDb = SnapshotDb.createEmpty(IModelTestUtils.prepareOutputFile("DisplayStyle", "DisplayStyleSkybox.bim"), {
|
|
@@ -16,35 +17,37 @@ describe("DisplayStyle", () => {
|
|
|
16
17
|
projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },
|
|
17
18
|
guid: Guid.createValue(),
|
|
18
19
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
20
|
+
withEditTxn(localDb, (txn) => {
|
|
21
|
+
function roundTrip(sky) {
|
|
22
|
+
const props = { environment: { sky } };
|
|
23
|
+
const name = Guid.createValue();
|
|
24
|
+
const id = DisplayStyle3d.insert(txn, IModel.dictionaryId, name, props);
|
|
25
|
+
expect(id).not.to.equal("0");
|
|
26
|
+
const style = localDb.elements.getElement(id);
|
|
27
|
+
const sky2 = style.jsonProperties.styles.environment.sky;
|
|
28
|
+
expect(sky2).not.to.be.undefined;
|
|
29
|
+
for (const key of Object.keys(sky)) {
|
|
30
|
+
const propName = key;
|
|
31
|
+
expect(sky2[propName]).to.deep.equal(sky[propName]);
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
roundTrip({ display: true });
|
|
35
|
+
roundTrip({ display: false });
|
|
36
|
+
roundTrip({ twoColor: true });
|
|
37
|
+
roundTrip({ twoColor: false });
|
|
38
|
+
roundTrip({ skyColor: 0x123456 });
|
|
39
|
+
roundTrip({ groundColor: 42 });
|
|
40
|
+
roundTrip({ zenithColor: 0x43 });
|
|
41
|
+
roundTrip({ nadirColor: 0 });
|
|
42
|
+
roundTrip({ skyExponent: 0.2 });
|
|
43
|
+
roundTrip({ groundExponent: -2.2 });
|
|
44
|
+
roundTrip({ image: { type: SkyBoxImageType.None } });
|
|
45
|
+
roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: "0x123" } });
|
|
46
|
+
roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: "images/sky.jpg" } });
|
|
47
|
+
roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: "0x1", back: "0x2", left: "0x3", right: "0x4", top: "0x5", bottom: "0x6" } } });
|
|
48
|
+
roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: "front.jpg", back: "back.png", left: "left.jpeg", right: "right.jpg", top: "top.png", bottom: "bottom.png" } } });
|
|
49
|
+
txn.abandonChanges();
|
|
50
|
+
});
|
|
48
51
|
localDb.close();
|
|
49
52
|
});
|
|
50
53
|
describe("onClone", () => {
|
|
@@ -67,8 +70,6 @@ describe("DisplayStyle", () => {
|
|
|
67
70
|
});
|
|
68
71
|
});
|
|
69
72
|
afterEach(() => {
|
|
70
|
-
db.abandonChanges();
|
|
71
|
-
db2.abandonChanges();
|
|
72
73
|
});
|
|
73
74
|
after(() => {
|
|
74
75
|
db.close();
|
|
@@ -85,7 +86,7 @@ describe("DisplayStyle", () => {
|
|
|
85
86
|
],
|
|
86
87
|
},
|
|
87
88
|
};
|
|
88
|
-
const displayStyleId = DisplayStyle3d.insert(
|
|
89
|
+
const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));
|
|
89
90
|
cloneContext.remapElement("0x1", "0xa");
|
|
90
91
|
cloneContext.remapElement("0x3", "0xc");
|
|
91
92
|
const displayStyle = db.elements.getElement(displayStyleId);
|
|
@@ -97,7 +98,7 @@ describe("DisplayStyle", () => {
|
|
|
97
98
|
it("remaps excludedElements when cloning", async () => {
|
|
98
99
|
const cloneContext = new IModelElementCloneContext(db, db2);
|
|
99
100
|
const displayStyleJsonProps = { excludedElements: ["0x1", "0x2", "0x3", "0x4"] };
|
|
100
|
-
const displayStyleId = DisplayStyle3d.insert(
|
|
101
|
+
const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));
|
|
101
102
|
cloneContext.remapElement("0x1", "0xa");
|
|
102
103
|
cloneContext.remapElement("0x3", "0xc");
|
|
103
104
|
const displayStyle = db.elements.getElement(displayStyleId);
|
|
@@ -108,18 +109,20 @@ describe("DisplayStyle", () => {
|
|
|
108
109
|
});
|
|
109
110
|
it("remaps subCategory overrides when cloning", async () => {
|
|
110
111
|
const cloneContext = new IModelElementCloneContext(db, db2);
|
|
111
|
-
const categoryId = SpatialCategory.insert(
|
|
112
|
-
const subCategoryId1 = SubCategory.insert(
|
|
113
|
-
const subCategoryId2 = SubCategory.insert(
|
|
114
|
-
const subCategoryId3 = SubCategory.insert(
|
|
115
|
-
const subCategoryId4 = SubCategory.insert(
|
|
116
|
-
const displayStyleJsonProps = {
|
|
112
|
+
const categoryId = withEditTxn(db, (txn) => SpatialCategory.insert(txn, IModel.dictionaryId, "testCat", {}));
|
|
113
|
+
const subCategoryId1 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, "subC1", {}));
|
|
114
|
+
const subCategoryId2 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, "subC2", {}));
|
|
115
|
+
const subCategoryId3 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, "subC3", {}));
|
|
116
|
+
const subCategoryId4 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, "subC4", {}));
|
|
117
|
+
const displayStyleJsonProps = {
|
|
118
|
+
subCategoryOvr: [
|
|
117
119
|
{ subCategory: subCategoryId1, weight: 5 },
|
|
118
120
|
{ subCategory: subCategoryId2, weight: 3 },
|
|
119
121
|
{ subCategory: subCategoryId3, invisible: false },
|
|
120
122
|
{ subCategory: subCategoryId4, invisible: true },
|
|
121
|
-
]
|
|
122
|
-
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));
|
|
123
126
|
cloneContext.remapElement(subCategoryId1, "0xa");
|
|
124
127
|
cloneContext.remapElement(subCategoryId4, "0xd");
|
|
125
128
|
const displayStyle = db.elements.getElement(displayStyleId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayStyle.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/DisplayStyle.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAA0D,MAAM,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAAE,cAAc,EAAE,yBAA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KAAK,EAAE,SAAS,EAAE,IAAI,EAAC;aACtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { expect } from \"chai\";\nimport { CompressedId64Set, Guid } from \"@itwin/core-bentley\";\nimport { DisplayStyle3dSettingsProps, DisplayStyleSettingsProps, IModel, SkyBoxImageType, SkyBoxProps } from \"@itwin/core-common\";\nimport { DisplayStyle3d, IModelElementCloneContext, SnapshotDb, SpatialCategory, StandaloneDb, SubCategory } from \"../../core-backend\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\n\ndescribe(\"DisplayStyle\", () => {\n it(\"preserves skybox\", () => {\n const localDb = SnapshotDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle\", \"DisplayStyleSkybox.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n\n function roundTrip(sky: SkyBoxProps): void {\n const props = { environment: { sky } };\n const name = Guid.createValue();\n const id = DisplayStyle3d.insert(localDb, IModel.dictionaryId, name, props);\n expect(id).not.to.equal(\"0\");\n\n const style = localDb.elements.getElement<DisplayStyle3d>(id);\n const sky2 = style.jsonProperties.styles.environment.sky!;\n expect(sky2).not.to.be.undefined;\n for (const key of Object.keys(sky)) {\n const propName = key as keyof SkyBoxProps;\n expect(sky2[propName]).to.deep.equal(sky[propName]);\n }\n }\n\n roundTrip({ display: true });\n roundTrip({ display: false });\n\n roundTrip({ twoColor: true });\n roundTrip({ twoColor: false });\n\n roundTrip({ skyColor: 0x123456 });\n roundTrip({ groundColor: 42 });\n roundTrip({ zenithColor: 0x43 });\n roundTrip({ nadirColor: 0 });\n\n roundTrip({ skyExponent: 0.2 });\n roundTrip({ groundExponent: -2.2 });\n\n roundTrip({ image: { type: SkyBoxImageType.None } });\n\n roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: \"0x123\" } });\n roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: \"images/sky.jpg\" } });\n\n roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: \"0x1\", back: \"0x2\", left: \"0x3\", right: \"0x4\", top: \"0x5\", bottom: \"0x6\" } } });\n roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: \"front.jpg\", back: \"back.png\", left: \"left.jpeg\", right: \"right.jpg\", top: \"top.png\", bottom: \"bottom.png\" } } });\n\n localDb.abandonChanges();\n localDb.close();\n });\n\n describe(\"onClone\", () => {\n let db: StandaloneDb;\n let db2: StandaloneDb;\n\n before(() => {\n db = StandaloneDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle\", \"DisplayStyle.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n\n db2 = StandaloneDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle2\", \"DisplayStyle2.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n });\n\n afterEach(() => {\n db.abandonChanges();\n db2.abandonChanges();\n });\n\n after(() => {\n db.close();\n db2.close();\n });\n\n it(\"remaps contour display subCategories when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const displayStyleJsonProps: DisplayStyle3dSettingsProps = {\n contours: {\n groups: [\n {\n subCategories: CompressedId64Set.sortAndCompress([\"0x1\", \"0x2\", \"0x3\", \"0x4\"]),\n },\n ],\n },\n };\n const displayStyleId = DisplayStyle3d.insert(db, IModel.dictionaryId, \"TestStyle\", displayStyleJsonProps);\n\n cloneContext.remapElement(\"0x1\", \"0xa\");\n cloneContext.remapElement(\"0x3\", \"0xc\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const contourSubCatsClone = CompressedId64Set.decompressArray(displayStyleClone.jsonProperties.styles.contours.groups[0].subCategories);\n expect(contourSubCatsClone.length).to.equal(2);\n expect(contourSubCatsClone).to.contain.members([\"0xa\", \"0xc\"]);\n });\n\n it(\"remaps excludedElements when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const displayStyleJsonProps: DisplayStyleSettingsProps = {excludedElements: [\"0x1\", \"0x2\", \"0x3\", \"0x4\"]};\n const displayStyleId = DisplayStyle3d.insert(db, IModel.dictionaryId, \"TestStyle\", displayStyleJsonProps);\n\n cloneContext.remapElement(\"0x1\", \"0xa\");\n cloneContext.remapElement(\"0x3\", \"0xc\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const excludedElementsClone = CompressedId64Set.decompressArray(displayStyleClone.jsonProperties.styles.excludedElements);\n expect(excludedElementsClone.length).to.equal(2);\n expect(excludedElementsClone).to.contain.members([\"0xa\", \"0xc\"]);\n });\n\n it(\"remaps subCategory overrides when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const categoryId = SpatialCategory.insert(db, IModel.dictionaryId, \"testCat\", {});\n const subCategoryId1 = SubCategory.insert(db, categoryId, \"subC1\", {});\n const subCategoryId2 = SubCategory.insert(db, categoryId, \"subC2\", {});\n const subCategoryId3 = SubCategory.insert(db, categoryId, \"subC3\", {});\n const subCategoryId4 = SubCategory.insert(db, categoryId, \"subC4\", {});\n const displayStyleJsonProps: DisplayStyleSettingsProps = {subCategoryOvr: [\n {subCategory: subCategoryId1, weight: 5},\n {subCategory: subCategoryId2, weight: 3},\n {subCategory: subCategoryId3, invisible: false},\n {subCategory: subCategoryId4, invisible: true},\n ]};\n const displayStyleId = DisplayStyle3d.insert(db, IModel.dictionaryId, \"TestStyle\", displayStyleJsonProps);\n\n cloneContext.remapElement(subCategoryId1, \"0xa\");\n cloneContext.remapElement(subCategoryId4, \"0xd\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const subCategoryOvrClone = displayStyleClone.jsonProperties.styles.subCategoryOvr;\n expect(subCategoryOvrClone.length).to.equal(2);\n expect(subCategoryOvrClone).to.deep.contain.members([\n {subCategory: \"0xa\", weight: 5},\n {subCategory: \"0xd\", invisible: true},\n ]);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"DisplayStyle.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/DisplayStyle.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAA0D,MAAM,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvI,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,MAAM,OAA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AAiB,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC;YACnF,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBAClD,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;gBACjC,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE;aACxC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { expect } from \"chai\";\nimport { CompressedId64Set, Guid } from \"@itwin/core-bentley\";\nimport { DisplayStyle3dSettingsProps, DisplayStyleSettingsProps, IModel, SkyBoxImageType, SkyBoxProps } from \"@itwin/core-common\";\nimport { DisplayStyle3d, IModelElementCloneContext, SnapshotDb, SpatialCategory, StandaloneDb, SubCategory } from \"../../core-backend\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\nimport { withEditTxn } from \"../../EditTxn\";\n\ndescribe(\"DisplayStyle\", () => {\n it(\"preserves skybox\", () => {\n const localDb = SnapshotDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle\", \"DisplayStyleSkybox.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n\n withEditTxn(localDb, (txn) => {\n function roundTrip(sky: SkyBoxProps): void {\n const props = { environment: { sky } };\n const name = Guid.createValue();\n const id = DisplayStyle3d.insert(txn, IModel.dictionaryId, name, props);\n expect(id).not.to.equal(\"0\");\n\n const style = localDb.elements.getElement<DisplayStyle3d>(id);\n const sky2 = style.jsonProperties.styles.environment.sky!;\n expect(sky2).not.to.be.undefined;\n for (const key of Object.keys(sky)) {\n const propName = key as keyof SkyBoxProps;\n expect(sky2[propName]).to.deep.equal(sky[propName]);\n }\n }\n\n roundTrip({ display: true });\n roundTrip({ display: false });\n\n roundTrip({ twoColor: true });\n roundTrip({ twoColor: false });\n\n roundTrip({ skyColor: 0x123456 });\n roundTrip({ groundColor: 42 });\n roundTrip({ zenithColor: 0x43 });\n roundTrip({ nadirColor: 0 });\n\n roundTrip({ skyExponent: 0.2 });\n roundTrip({ groundExponent: -2.2 });\n\n roundTrip({ image: { type: SkyBoxImageType.None } });\n\n roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: \"0x123\" } });\n roundTrip({ image: { type: SkyBoxImageType.Spherical, texture: \"images/sky.jpg\" } });\n\n roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: \"0x1\", back: \"0x2\", left: \"0x3\", right: \"0x4\", top: \"0x5\", bottom: \"0x6\" } } });\n roundTrip({ image: { type: SkyBoxImageType.Cube, textures: { front: \"front.jpg\", back: \"back.png\", left: \"left.jpeg\", right: \"right.jpg\", top: \"top.png\", bottom: \"bottom.png\" } } });\n txn.abandonChanges();\n });\n\n localDb.close();\n });\n\n describe(\"onClone\", () => {\n let db: StandaloneDb;\n let db2: StandaloneDb;\n\n before(() => {\n db = StandaloneDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle\", \"DisplayStyle.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n\n db2 = StandaloneDb.createEmpty(IModelTestUtils.prepareOutputFile(\"DisplayStyle2\", \"DisplayStyle2.bim\"), {\n rootSubject: { name: \"DisplayStyle tests\", description: \"DisplayStyle tests\" },\n client: \"DisplayStyle\",\n globalOrigin: { x: 0, y: 0 },\n projectExtents: { low: { x: -500, y: -500, z: -50 }, high: { x: 500, y: 500, z: 50 } },\n guid: Guid.createValue(),\n });\n });\n\n afterEach(() => {\n });\n\n after(() => {\n db.close();\n db2.close();\n });\n\n it(\"remaps contour display subCategories when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const displayStyleJsonProps: DisplayStyle3dSettingsProps = {\n contours: {\n groups: [\n {\n subCategories: CompressedId64Set.sortAndCompress([\"0x1\", \"0x2\", \"0x3\", \"0x4\"]),\n },\n ],\n },\n };\n const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));\n\n cloneContext.remapElement(\"0x1\", \"0xa\");\n cloneContext.remapElement(\"0x3\", \"0xc\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const contourSubCatsClone = CompressedId64Set.decompressArray(displayStyleClone.jsonProperties.styles.contours.groups[0].subCategories);\n expect(contourSubCatsClone.length).to.equal(2);\n expect(contourSubCatsClone).to.contain.members([\"0xa\", \"0xc\"]);\n });\n\n it(\"remaps excludedElements when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const displayStyleJsonProps: DisplayStyleSettingsProps = { excludedElements: [\"0x1\", \"0x2\", \"0x3\", \"0x4\"] };\n const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));\n\n cloneContext.remapElement(\"0x1\", \"0xa\");\n cloneContext.remapElement(\"0x3\", \"0xc\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const excludedElementsClone = CompressedId64Set.decompressArray(displayStyleClone.jsonProperties.styles.excludedElements);\n expect(excludedElementsClone.length).to.equal(2);\n expect(excludedElementsClone).to.contain.members([\"0xa\", \"0xc\"]);\n });\n\n it(\"remaps subCategory overrides when cloning\", async () => {\n const cloneContext = new IModelElementCloneContext(db, db2);\n const categoryId = withEditTxn(db, (txn) => SpatialCategory.insert(txn, IModel.dictionaryId, \"testCat\", {}));\n const subCategoryId1 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, \"subC1\", {}));\n const subCategoryId2 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, \"subC2\", {}));\n const subCategoryId3 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, \"subC3\", {}));\n const subCategoryId4 = withEditTxn(db, (txn) => SubCategory.insert(txn, categoryId, \"subC4\", {}));\n const displayStyleJsonProps: DisplayStyleSettingsProps = {\n subCategoryOvr: [\n { subCategory: subCategoryId1, weight: 5 },\n { subCategory: subCategoryId2, weight: 3 },\n { subCategory: subCategoryId3, invisible: false },\n { subCategory: subCategoryId4, invisible: true },\n ]\n };\n const displayStyleId = withEditTxn(db, (txn) => DisplayStyle3d.insert(txn, IModel.dictionaryId, Guid.createValue(), displayStyleJsonProps));\n\n cloneContext.remapElement(subCategoryId1, \"0xa\");\n cloneContext.remapElement(subCategoryId4, \"0xd\");\n const displayStyle = db.elements.getElement<DisplayStyle3d>(displayStyleId);\n const displayStyleClone = await cloneContext.cloneElement(displayStyle);\n\n const subCategoryOvrClone = displayStyleClone.jsonProperties.styles.subCategoryOvr;\n expect(subCategoryOvrClone.length).to.equal(2);\n expect(subCategoryOvrClone).to.deep.contain.members([\n { subCategory: \"0xa\", weight: 5 },\n { subCategory: \"0xd\", invisible: true },\n ]);\n });\n });\n});\n"]}
|
|
@@ -8,13 +8,14 @@ import { Drawing } from "../../Element";
|
|
|
8
8
|
import { DocumentListModel } from "../../Model";
|
|
9
9
|
import { SnapshotDb } from "../../IModelDb";
|
|
10
10
|
import { IModelTestUtils } from "../IModelTestUtils";
|
|
11
|
+
import { withEditTxn } from "../../EditTxn";
|
|
11
12
|
describe("Drawing", () => {
|
|
12
13
|
let imodel;
|
|
13
14
|
let documentListModelId;
|
|
14
15
|
before(() => {
|
|
15
16
|
const iModelPath = IModelTestUtils.prepareOutputFile("Drawing", "Drawing.bim");
|
|
16
17
|
imodel = SnapshotDb.createEmpty(iModelPath, { rootSubject: { name: "DrawingTest" } });
|
|
17
|
-
documentListModelId = DocumentListModel.insert(
|
|
18
|
+
documentListModelId = withEditTxn(imodel, (txn) => DocumentListModel.insert(txn, SnapshotDb.rootSubjectId, "DocumentList"));
|
|
18
19
|
});
|
|
19
20
|
after(() => {
|
|
20
21
|
imodel.close();
|
|
@@ -85,7 +86,7 @@ describe("Drawing", () => {
|
|
|
85
86
|
function test(scaleFactor) {
|
|
86
87
|
const insertProps = makeDrawingProps(scaleFactor);
|
|
87
88
|
expect(insertProps.scaleFactor).to.equal(scaleFactor);
|
|
88
|
-
const elemId = imodel.
|
|
89
|
+
const elemId = withEditTxn(imodel, (txn) => txn.insertElement(insertProps));
|
|
89
90
|
const readProps = imodel.elements.getElementProps(elemId);
|
|
90
91
|
expect(readProps.scaleFactor).to.equal(scaleFactor);
|
|
91
92
|
}
|
|
@@ -100,7 +101,7 @@ describe("Drawing", () => {
|
|
|
100
101
|
});
|
|
101
102
|
describe("insert", () => {
|
|
102
103
|
function insertDrawing(scaleFactor) {
|
|
103
|
-
const drawingId = Drawing.insert(
|
|
104
|
+
const drawingId = withEditTxn(imodel, (txn) => Drawing.insert(txn, documentListModelId, Guid.createValue(), scaleFactor));
|
|
104
105
|
return imodel.elements.getElement(drawingId);
|
|
105
106
|
}
|
|
106
107
|
it("throws if scaleFactor is not positive", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawing.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/Drawing.test.ts"],"names":[],"mappings":"AAAA;;;+FAG+F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C;QAED,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACzF,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrD,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { expect } from \"chai\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { DrawingProps } from \"@itwin/core-common\";\nimport { Drawing } from \"../../Element\";\nimport { DocumentListModel } from \"../../Model\";\nimport { SnapshotDb } from \"../../IModelDb\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\n\ndescribe(\"Drawing\", () => {\n let imodel: SnapshotDb;\n let documentListModelId: string;\n\n before(() => {\n const iModelPath = IModelTestUtils.prepareOutputFile(\"Drawing\", \"Drawing.bim\");\n imodel = SnapshotDb.createEmpty(iModelPath, { rootSubject: { name: \"DrawingTest\" } });\n documentListModelId = DocumentListModel.insert(imodel, SnapshotDb.rootSubjectId, \"DocumentList\");\n });\n\n after(() => {\n imodel.close();\n });\n \n class TestDrawing extends Drawing {\n public constructor(props: DrawingProps) {\n super(props, imodel);\n }\n }\n\n describe(\"scaleFactor\", () => {\n function makeDrawingProps(scaleFactor: any): DrawingProps {\n const props: DrawingProps = {\n classFullName: Drawing.classFullName,\n model: documentListModelId,\n code: Drawing.createCode(imodel, documentListModelId, Guid.createValue()),\n };\n\n if (undefined !== scaleFactor) {\n props.scaleFactor = scaleFactor;\n }\n \n return props;\n }\n\n function makeDrawing(scaleFactor: any): Drawing {\n return new TestDrawing(makeDrawingProps(scaleFactor));\n }\n\n function expectScaleFactor(scaleFactor: any, expected: number): void {\n const drawing = makeDrawing(scaleFactor);\n expect(drawing.scaleFactor).to.equal(expected);\n }\n\n it(\"defaults to 1\", () => {\n expectScaleFactor(undefined, 1);\n expectScaleFactor(null, 1);\n expectScaleFactor(0, 1);\n expectScaleFactor(-123, 1);\n expectScaleFactor(false, 1);\n expectScaleFactor(true, 1);\n expectScaleFactor(\"\", 1);\n expectScaleFactor(\"abcdef\", 1);\n });\n\n it(\"throws when attempting to set to zero or negative value\", () => {\n const drawing = makeDrawing(undefined);\n expect(drawing.scaleFactor).to.equal(1);\n expect(() => drawing.scaleFactor = 0).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(drawing.scaleFactor).to.equal(1);\n expect(() => drawing.scaleFactor = -123).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(drawing.scaleFactor).to.equal(1);\n });\n\n it(\"is included in JSON IFF not equal to 1\", () => {\n function expectFactor(scaleFactor: any, expected: number | undefined): void {\n const drawing = makeDrawing(scaleFactor);\n expect(drawing.scaleFactor === 1).to.equal(expected === undefined);\n const props = drawing.toJSON();\n expect(props.scaleFactor).to.equal(expected);\n }\n\n expectFactor(undefined, undefined);\n expectFactor(null, undefined);\n expectFactor(0, undefined);\n expectFactor(1, undefined);\n expectFactor(-123, undefined);\n expectFactor(false, undefined);\n expectFactor(true, undefined);\n expectFactor(\"\", undefined);\n expectFactor(\"abcdef\", undefined);\n\n expectFactor(2, 2);\n expectFactor(123, 123);\n expectFactor(0.05, 0.05);\n });\n\n it(\"is preserved when round-tripped through persistence layer\", () => {\n function test(scaleFactor: number | undefined): void {\n const insertProps = makeDrawingProps(scaleFactor);\n expect(insertProps.scaleFactor).to.equal(scaleFactor);\n const elemId = imodel.elements.insertElement(insertProps);\n const readProps = imodel.elements.getElementProps<DrawingProps>(elemId);\n expect(readProps.scaleFactor).to.equal(scaleFactor);\n }\n\n test(undefined);\n test(1);\n test(2);\n test(123);\n test(0.05);\n test(0);\n test(-123);\n });\n });\n\n describe(\"insert\", () => {\n function insertDrawing(scaleFactor: number | undefined): Drawing {\n const drawingId = Drawing.insert(imodel, documentListModelId, Guid.createValue(), scaleFactor);\n return imodel.elements.getElement<Drawing>(drawingId);\n }\n\n it(\"throws if scaleFactor is not positive\", () => {\n expect(() => insertDrawing(0)).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(() => insertDrawing(-123)).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n });\n\n it(\"defaults scaleFactor to 1\", () => {\n expect(insertDrawing(undefined).scaleFactor).to.equal(1);\n });\n\n it(\"preserves scaleFactor\", () => {\n expect(insertDrawing(2).scaleFactor).to.equal(2);\n expect(insertDrawing(123).scaleFactor).to.equal(123);\n expect(insertDrawing(0.05).scaleFactor).to.equal(0.05);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Drawing.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/Drawing.test.ts"],"names":[],"mappings":"AAAA;;;+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AAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;YAC1H,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAU,SAAS,CAAC,CAAC;QACxD,CAAC;QAED,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACzF,MAAM,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACrD,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { expect } from \"chai\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { DrawingProps } from \"@itwin/core-common\";\nimport { Drawing } from \"../../Element\";\nimport { DocumentListModel } from \"../../Model\";\nimport { SnapshotDb } from \"../../IModelDb\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\nimport { withEditTxn } from \"../../EditTxn\";\n\ndescribe(\"Drawing\", () => {\n let imodel: SnapshotDb;\n let documentListModelId: string;\n\n before(() => {\n const iModelPath = IModelTestUtils.prepareOutputFile(\"Drawing\", \"Drawing.bim\");\n imodel = SnapshotDb.createEmpty(iModelPath, { rootSubject: { name: \"DrawingTest\" } });\n documentListModelId = withEditTxn(imodel, (txn) => DocumentListModel.insert(txn, SnapshotDb.rootSubjectId, \"DocumentList\"));\n });\n\n after(() => {\n imodel.close();\n });\n\n class TestDrawing extends Drawing {\n public constructor(props: DrawingProps) {\n super(props, imodel);\n }\n }\n\n describe(\"scaleFactor\", () => {\n function makeDrawingProps(scaleFactor: any): DrawingProps {\n const props: DrawingProps = {\n classFullName: Drawing.classFullName,\n model: documentListModelId,\n code: Drawing.createCode(imodel, documentListModelId, Guid.createValue()),\n };\n\n if (undefined !== scaleFactor) {\n props.scaleFactor = scaleFactor;\n }\n\n return props;\n }\n\n function makeDrawing(scaleFactor: any): Drawing {\n return new TestDrawing(makeDrawingProps(scaleFactor));\n }\n\n function expectScaleFactor(scaleFactor: any, expected: number): void {\n const drawing = makeDrawing(scaleFactor);\n expect(drawing.scaleFactor).to.equal(expected);\n }\n\n it(\"defaults to 1\", () => {\n expectScaleFactor(undefined, 1);\n expectScaleFactor(null, 1);\n expectScaleFactor(0, 1);\n expectScaleFactor(-123, 1);\n expectScaleFactor(false, 1);\n expectScaleFactor(true, 1);\n expectScaleFactor(\"\", 1);\n expectScaleFactor(\"abcdef\", 1);\n });\n\n it(\"throws when attempting to set to zero or negative value\", () => {\n const drawing = makeDrawing(undefined);\n expect(drawing.scaleFactor).to.equal(1);\n expect(() => drawing.scaleFactor = 0).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(drawing.scaleFactor).to.equal(1);\n expect(() => drawing.scaleFactor = -123).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(drawing.scaleFactor).to.equal(1);\n });\n\n it(\"is included in JSON IFF not equal to 1\", () => {\n function expectFactor(scaleFactor: any, expected: number | undefined): void {\n const drawing = makeDrawing(scaleFactor);\n expect(drawing.scaleFactor === 1).to.equal(expected === undefined);\n const props = drawing.toJSON();\n expect(props.scaleFactor).to.equal(expected);\n }\n\n expectFactor(undefined, undefined);\n expectFactor(null, undefined);\n expectFactor(0, undefined);\n expectFactor(1, undefined);\n expectFactor(-123, undefined);\n expectFactor(false, undefined);\n expectFactor(true, undefined);\n expectFactor(\"\", undefined);\n expectFactor(\"abcdef\", undefined);\n\n expectFactor(2, 2);\n expectFactor(123, 123);\n expectFactor(0.05, 0.05);\n });\n\n it(\"is preserved when round-tripped through persistence layer\", () => {\n function test(scaleFactor: number | undefined): void {\n const insertProps = makeDrawingProps(scaleFactor);\n expect(insertProps.scaleFactor).to.equal(scaleFactor);\n const elemId = withEditTxn(imodel, (txn) => txn.insertElement(insertProps));\n const readProps = imodel.elements.getElementProps<DrawingProps>(elemId);\n expect(readProps.scaleFactor).to.equal(scaleFactor);\n }\n\n test(undefined);\n test(1);\n test(2);\n test(123);\n test(0.05);\n test(0);\n test(-123);\n });\n });\n\n describe(\"insert\", () => {\n function insertDrawing(scaleFactor: number | undefined): Drawing {\n const drawingId = withEditTxn(imodel, (txn) => Drawing.insert(txn, documentListModelId, Guid.createValue(), scaleFactor));\n return imodel.elements.getElement<Drawing>(drawingId);\n }\n\n it(\"throws if scaleFactor is not positive\", () => {\n expect(() => insertDrawing(0)).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n expect(() => insertDrawing(-123)).to.throw(\"Drawing.scaleFactor must be greater than zero\");\n });\n\n it(\"defaults scaleFactor to 1\", () => {\n expect(insertDrawing(undefined).scaleFactor).to.equal(1);\n });\n\n it(\"preserves scaleFactor\", () => {\n expect(insertDrawing(2).scaleFactor).to.equal(2);\n expect(insertDrawing(123).scaleFactor).to.equal(123);\n expect(insertDrawing(0.05).scaleFactor).to.equal(0.05);\n });\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditTxn.test.d.ts","sourceRoot":"","sources":["../../../../src/test/standalone/EditTxn.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Logger, OpenMode } from "@itwin/core-bentley";
|
|
6
|
+
import { expect } from "chai";
|
|
7
|
+
import * as sinon from "sinon";
|
|
8
|
+
import { EditTxnError } from "@itwin/core-common";
|
|
9
|
+
import { EditTxn, IModelJsFs, StandaloneDb } from "../../core-backend";
|
|
10
|
+
import { IModelTestUtils } from "../IModelTestUtils";
|
|
11
|
+
class TestEditTxn extends EditTxn {
|
|
12
|
+
constructor(iModel) {
|
|
13
|
+
super(iModel, "test");
|
|
14
|
+
}
|
|
15
|
+
writeFileProperty(name, value) {
|
|
16
|
+
super.saveFileProperty({ name, namespace: "EditTxnTest" }, value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class AbandonOnCloseEditTxn extends TestEditTxn {
|
|
20
|
+
onClose() {
|
|
21
|
+
if (this.isActive)
|
|
22
|
+
this.abandonChanges();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function expectEditTxnError(fn, key) {
|
|
26
|
+
expect(fn).to.throw().that.satisfies((error) => EditTxnError.isError(error, key));
|
|
27
|
+
}
|
|
28
|
+
function legacyWriteFileProperty(iModel, name, value) {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
30
|
+
iModel.saveFileProperty({ name, namespace: "EditTxnTest" }, value);
|
|
31
|
+
}
|
|
32
|
+
describe("EditTxn", () => {
|
|
33
|
+
let iModel;
|
|
34
|
+
let fileName;
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
EditTxn.implicitWriteEnforcement = "allow";
|
|
37
|
+
fileName = IModelTestUtils.prepareOutputFile("EditTxn", "EditTxn.bim");
|
|
38
|
+
iModel = StandaloneDb.createEmpty(fileName, {
|
|
39
|
+
rootSubject: { name: "EditTxn" },
|
|
40
|
+
enableTransactions: true,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
EditTxn.implicitWriteEnforcement = "allow";
|
|
45
|
+
sinon.restore();
|
|
46
|
+
if (iModel.isOpen)
|
|
47
|
+
iModel.close();
|
|
48
|
+
IModelJsFs.removeSync(fileName);
|
|
49
|
+
});
|
|
50
|
+
it("allows implicit writes before and after explicit txn scopes", () => {
|
|
51
|
+
// Implicit IModelDb mutators should work before any explicit EditTxn starts.
|
|
52
|
+
legacyWriteFileProperty(iModel, "legacy-before-start", "value");
|
|
53
|
+
expect(iModel.queryFilePropertyString({ name: "legacy-before-start", namespace: "EditTxnTest" })).to.equal("value");
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
55
|
+
iModel.abandonChanges();
|
|
56
|
+
const txn = new TestEditTxn(iModel);
|
|
57
|
+
txn.start();
|
|
58
|
+
expect(txn.isActive).to.be.true;
|
|
59
|
+
txn.writeFileProperty("cancelled", "value");
|
|
60
|
+
txn.end("abandon");
|
|
61
|
+
// After canceling, implicit writes should still work.
|
|
62
|
+
expect(txn.isActive).to.be.false;
|
|
63
|
+
legacyWriteFileProperty(iModel, "legacy-after-cancel", "value");
|
|
64
|
+
expect(iModel.queryFilePropertyString({ name: "legacy-after-cancel", namespace: "EditTxnTest" })).to.equal("value");
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
66
|
+
iModel.abandonChanges();
|
|
67
|
+
expect(iModel.queryFilePropertyString({ name: "cancelled", namespace: "EditTxnTest" })).to.be.undefined;
|
|
68
|
+
txn.start();
|
|
69
|
+
txn.writeFileProperty("saved", "value");
|
|
70
|
+
txn.end();
|
|
71
|
+
// Committing also leaves the iModel ready for later implicit writes.
|
|
72
|
+
expect(txn.isActive).to.be.false;
|
|
73
|
+
expect(iModel.queryFilePropertyString({ name: "saved", namespace: "EditTxnTest" })).to.equal("value");
|
|
74
|
+
legacyWriteFileProperty(iModel, "legacy-after-end", "value");
|
|
75
|
+
expect(iModel.queryFilePropertyString({ name: "legacy-after-end", namespace: "EditTxnTest" })).to.equal("value");
|
|
76
|
+
});
|
|
77
|
+
it("enforces identical explicit transaction behavior across allow, log, and throw settings", () => {
|
|
78
|
+
const settings = ["allow", "log", "throw"];
|
|
79
|
+
for (const setting of settings) {
|
|
80
|
+
EditTxn.implicitWriteEnforcement = setting;
|
|
81
|
+
const txn = new TestEditTxn(iModel);
|
|
82
|
+
const inactiveName = `inactive-${setting}`;
|
|
83
|
+
const savedName = `saved-${setting}`;
|
|
84
|
+
const inactiveAgainName = `inactive-again-${setting}`;
|
|
85
|
+
// Inactive explicit txn writes must always fail, regardless of enforcement.
|
|
86
|
+
expectEditTxnError(() => txn.writeFileProperty(inactiveName, "value"), "not-active");
|
|
87
|
+
expectEditTxnError(() => txn.saveChanges(`save ${inactiveName}`), "not-active");
|
|
88
|
+
expect(iModel.queryFilePropertyString({ name: inactiveName, namespace: "EditTxnTest" })).to.be.undefined;
|
|
89
|
+
expectEditTxnError(() => txn.end("abandon"), "not-active");
|
|
90
|
+
txn.start();
|
|
91
|
+
txn.writeFileProperty(savedName, "value");
|
|
92
|
+
txn.saveChanges(`save ${savedName}`);
|
|
93
|
+
expect(txn.isActive).to.be.true;
|
|
94
|
+
txn.end();
|
|
95
|
+
expect(iModel.queryFilePropertyString({ name: savedName, namespace: "EditTxnTest" })).to.equal("value");
|
|
96
|
+
expectEditTxnError(() => txn.writeFileProperty(inactiveAgainName, "value"), "not-active");
|
|
97
|
+
expectEditTxnError(() => txn.saveChanges(`save ${inactiveAgainName}`), "not-active");
|
|
98
|
+
expect(iModel.queryFilePropertyString({ name: inactiveAgainName, namespace: "EditTxnTest" })).to.be.undefined;
|
|
99
|
+
expectEditTxnError(() => txn.end("abandon"), "not-active");
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
it("logs implicit writes in log mode but still rejects inactive explicit writes", () => {
|
|
103
|
+
EditTxn.implicitWriteEnforcement = "log";
|
|
104
|
+
const logError = sinon.spy(Logger, "logError");
|
|
105
|
+
const txn = new TestEditTxn(iModel);
|
|
106
|
+
legacyWriteFileProperty(iModel, "implicit-log", "value");
|
|
107
|
+
expect(iModel.queryFilePropertyString({ name: "implicit-log", namespace: "EditTxnTest" })).to.equal("value");
|
|
108
|
+
expect(logError.called).to.be.true;
|
|
109
|
+
expect(logError.firstCall.args[0]).to.equal("core-backend.IModelDb");
|
|
110
|
+
expect(EditTxnError.isError(logError.firstCall.args[1], "implicit-txn-write-disallowed")).to.be.true;
|
|
111
|
+
const callCount = logError.callCount;
|
|
112
|
+
expectEditTxnError(() => txn.writeFileProperty("inactive-log", "value"), "not-active");
|
|
113
|
+
expectEditTxnError(() => txn.saveChanges("save inactive log"), "not-active");
|
|
114
|
+
expect(logError.callCount).to.equal(callCount);
|
|
115
|
+
expectEditTxnError(() => txn.end("abandon"), "not-active");
|
|
116
|
+
});
|
|
117
|
+
it("rejects implicit writes in throw mode and still allows active explicit writes", () => {
|
|
118
|
+
EditTxn.implicitWriteEnforcement = "throw";
|
|
119
|
+
expectEditTxnError(() => legacyWriteFileProperty(iModel, "implicit-throw", "value"), "implicit-txn-write-disallowed");
|
|
120
|
+
expect(iModel.queryFilePropertyString({ name: "implicit-throw", namespace: "EditTxnTest" })).to.be.undefined;
|
|
121
|
+
const txn = new TestEditTxn(iModel);
|
|
122
|
+
txn.start();
|
|
123
|
+
txn.writeFileProperty("explicit-enforce", "value");
|
|
124
|
+
txn.end();
|
|
125
|
+
expect(iModel.queryFilePropertyString({ name: "explicit-enforce", namespace: "EditTxnTest" })).to.equal("value");
|
|
126
|
+
});
|
|
127
|
+
it("throws when started with unsaved changes", () => {
|
|
128
|
+
// Unsaved changes made through the implicit surface block a new explicit EditTxn.
|
|
129
|
+
legacyWriteFileProperty(iModel, "unsaved", "value");
|
|
130
|
+
const txn = new TestEditTxn(iModel);
|
|
131
|
+
expectEditTxnError(() => txn.start(), "unsaved-changes");
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
133
|
+
iModel.abandonChanges();
|
|
134
|
+
legacyWriteFileProperty(iModel, "legacy-after-abandon", "value");
|
|
135
|
+
expect(iModel.queryFilePropertyString({ name: "legacy-after-abandon", namespace: "EditTxnTest" })).to.equal("value");
|
|
136
|
+
});
|
|
137
|
+
it("rejects starting an explicit txn while another explicit txn is active", () => {
|
|
138
|
+
const first = new TestEditTxn(iModel);
|
|
139
|
+
const second = new TestEditTxn(iModel);
|
|
140
|
+
first.start();
|
|
141
|
+
expect(first.isActive).to.be.true;
|
|
142
|
+
// EditTxn.start() now requires the implicit txn to be active, so a second explicit txn cannot start yet.
|
|
143
|
+
expectEditTxnError(() => second.start(), "already-active");
|
|
144
|
+
expect(first.isActive).to.be.true;
|
|
145
|
+
expect(second.isActive).to.be.false;
|
|
146
|
+
first.end("abandon");
|
|
147
|
+
expect(first.isActive).to.be.false;
|
|
148
|
+
});
|
|
149
|
+
it("allows deprecated mutating APIs while an explicit txn is active when enforcement is none", () => {
|
|
150
|
+
const txn = new TestEditTxn(iModel);
|
|
151
|
+
txn.start();
|
|
152
|
+
// Deprecated IModelDb mutators route through the implicit txn and are allowed in compatibility mode.
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
154
|
+
iModel.saveFileProperty({ name: "legacy", namespace: "EditTxnTest" }, "value");
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
156
|
+
iModel.saveChanges("legacy save");
|
|
157
|
+
expect(iModel.queryFilePropertyString({ name: "legacy", namespace: "EditTxnTest" })).to.equal("value");
|
|
158
|
+
txn.writeFileProperty("explicit", "value");
|
|
159
|
+
txn.saveChanges("explicit save");
|
|
160
|
+
expect(iModel.queryFilePropertyString({ name: "explicit", namespace: "EditTxnTest" })).to.equal("value");
|
|
161
|
+
txn.end("abandon");
|
|
162
|
+
expect(txn.isActive).to.be.false;
|
|
163
|
+
});
|
|
164
|
+
it("allows starting a new explicit txn when only pending changes exist", () => {
|
|
165
|
+
const first = new TestEditTxn(iModel);
|
|
166
|
+
const second = new TestEditTxn(iModel);
|
|
167
|
+
first.start();
|
|
168
|
+
first.writeFileProperty("pending", "value");
|
|
169
|
+
first.saveChanges("save pending");
|
|
170
|
+
// Saved-but-unpushed changes are allowed; only unsaved local changes block start().
|
|
171
|
+
expect(iModel.txns.hasPendingTxns).to.be.true;
|
|
172
|
+
expect(iModel.txns.hasUnsavedChanges).to.be.false;
|
|
173
|
+
first.end("abandon");
|
|
174
|
+
expect(() => second.start()).to.not.throw();
|
|
175
|
+
expect(first.isActive).to.be.false;
|
|
176
|
+
expect(second.isActive).to.be.true;
|
|
177
|
+
second.end("abandon");
|
|
178
|
+
expect(second.isActive).to.be.false;
|
|
179
|
+
});
|
|
180
|
+
it("uses the default description unless save is given an override", () => {
|
|
181
|
+
const txn = new EditTxn(iModel, "default description");
|
|
182
|
+
txn.start();
|
|
183
|
+
txn.saveFileProperty({ name: "default-description", namespace: "EditTxnTest" }, "value");
|
|
184
|
+
txn.saveChanges();
|
|
185
|
+
expect(iModel.txns.getLastSavedTxnProps()?.props.description).to.equal("default description");
|
|
186
|
+
txn.saveFileProperty({ name: "override-description", namespace: "EditTxnTest" }, "value");
|
|
187
|
+
txn.end("save", "override description");
|
|
188
|
+
expect(iModel.txns.getLastSavedTxnProps()?.props.description).to.equal("override description");
|
|
189
|
+
});
|
|
190
|
+
it("reverseTxns abandons unsaved changes from the active explicit txn", () => {
|
|
191
|
+
const txn = new TestEditTxn(iModel);
|
|
192
|
+
txn.start();
|
|
193
|
+
txn.writeFileProperty("reverse", "value");
|
|
194
|
+
// Reversing txns abandons the active explicit txn's local changes, but the explicit txn remains active.
|
|
195
|
+
iModel.txns.reverseTxns(1);
|
|
196
|
+
expect(txn.isActive).to.be.true;
|
|
197
|
+
expect(iModel.txns.hasUnsavedChanges).to.be.false;
|
|
198
|
+
expect(iModel.queryFilePropertyString({ name: "reverse", namespace: "EditTxnTest" })).to.be.undefined;
|
|
199
|
+
txn.end("abandon");
|
|
200
|
+
expect(txn.isActive).to.be.false;
|
|
201
|
+
});
|
|
202
|
+
it("saves unsaved changes from the active explicit txn when the iModel closes", () => {
|
|
203
|
+
const txn = new TestEditTxn(iModel);
|
|
204
|
+
txn.start();
|
|
205
|
+
txn.writeFileProperty("unsaved-on-close", "value");
|
|
206
|
+
iModel.close();
|
|
207
|
+
iModel = StandaloneDb.openFile(fileName, OpenMode.Readonly);
|
|
208
|
+
expect(iModel.queryFilePropertyString({ name: "unsaved-on-close", namespace: "EditTxnTest" })).to.equal("value");
|
|
209
|
+
});
|
|
210
|
+
it("allows subclasses to abandon unsaved changes when the iModel closes", () => {
|
|
211
|
+
const txn = new AbandonOnCloseEditTxn(iModel);
|
|
212
|
+
txn.start();
|
|
213
|
+
txn.writeFileProperty("saved-on-close", "value");
|
|
214
|
+
iModel.close();
|
|
215
|
+
iModel = StandaloneDb.openFile(fileName, OpenMode.Readonly);
|
|
216
|
+
expect(iModel.queryFilePropertyString({ name: "saved-on-close", namespace: "EditTxnTest" })).to.be.undefined;
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
//# sourceMappingURL=EditTxn.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditTxn.test.js","sourceRoot":"","sources":["../../../../src/test/standalone/EditTxn.test.ts"],"names":[],"mappings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QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2EAA2E,EAAE,GAAG,EAAE;QACnF,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,GAAG,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAEnD,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,KAAK,EAAE,CAAC;QACZ,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAEjD,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IAC/G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { Logger, OpenMode } from \"@itwin/core-bentley\";\nimport { expect } from \"chai\";\nimport * as sinon from \"sinon\";\nimport { EditTxnError } from \"@itwin/core-common\";\nimport { EditTxn, type IModelDb, IModelJsFs, StandaloneDb } from \"../../core-backend\";\nimport { IModelTestUtils } from \"../IModelTestUtils\";\n\nclass TestEditTxn extends EditTxn {\n public constructor(iModel: IModelDb) {\n super(iModel, \"test\");\n }\n\n public writeFileProperty(name: string, value: string | undefined): void {\n super.saveFileProperty({ name, namespace: \"EditTxnTest\" }, value);\n }\n}\n\nclass AbandonOnCloseEditTxn extends TestEditTxn {\n public override onClose(): void {\n if (this.isActive)\n this.abandonChanges();\n }\n}\n\nfunction expectEditTxnError(fn: () => void, key: EditTxnError.Key): void {\n expect(fn).to.throw().that.satisfies((error: unknown) => EditTxnError.isError(error, key));\n}\n\nfunction legacyWriteFileProperty(iModel: StandaloneDb, name: string, value: string): void {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.saveFileProperty({ name, namespace: \"EditTxnTest\" }, value);\n}\n\ndescribe(\"EditTxn\", () => {\n let iModel: StandaloneDb;\n let fileName: string;\n\n beforeEach(() => {\n EditTxn.implicitWriteEnforcement = \"allow\";\n fileName = IModelTestUtils.prepareOutputFile(\"EditTxn\", \"EditTxn.bim\");\n iModel = StandaloneDb.createEmpty(fileName, {\n rootSubject: { name: \"EditTxn\" },\n enableTransactions: true,\n });\n });\n\n afterEach(() => {\n EditTxn.implicitWriteEnforcement = \"allow\";\n sinon.restore();\n\n if (iModel.isOpen)\n iModel.close();\n\n IModelJsFs.removeSync(fileName);\n });\n\n it(\"allows implicit writes before and after explicit txn scopes\", () => {\n // Implicit IModelDb mutators should work before any explicit EditTxn starts.\n legacyWriteFileProperty(iModel, \"legacy-before-start\", \"value\");\n expect(iModel.queryFilePropertyString({ name: \"legacy-before-start\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.abandonChanges();\n\n const txn = new TestEditTxn(iModel);\n txn.start();\n expect(txn.isActive).to.be.true;\n\n txn.writeFileProperty(\"cancelled\", \"value\");\n txn.end(\"abandon\");\n // After canceling, implicit writes should still work.\n expect(txn.isActive).to.be.false;\n legacyWriteFileProperty(iModel, \"legacy-after-cancel\", \"value\");\n expect(iModel.queryFilePropertyString({ name: \"legacy-after-cancel\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.abandonChanges();\n expect(iModel.queryFilePropertyString({ name: \"cancelled\", namespace: \"EditTxnTest\" })).to.be.undefined;\n\n txn.start();\n txn.writeFileProperty(\"saved\", \"value\");\n txn.end();\n // Committing also leaves the iModel ready for later implicit writes.\n expect(txn.isActive).to.be.false;\n expect(iModel.queryFilePropertyString({ name: \"saved\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n legacyWriteFileProperty(iModel, \"legacy-after-end\", \"value\");\n expect(iModel.queryFilePropertyString({ name: \"legacy-after-end\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n });\n\n it(\"enforces identical explicit transaction behavior across allow, log, and throw settings\", () => {\n const settings: Array<\"allow\" | \"log\" | \"throw\"> = [\"allow\", \"log\", \"throw\"];\n\n for (const setting of settings) {\n EditTxn.implicitWriteEnforcement = setting;\n const txn = new TestEditTxn(iModel);\n const inactiveName = `inactive-${setting}`;\n const savedName = `saved-${setting}`;\n const inactiveAgainName = `inactive-again-${setting}`;\n\n // Inactive explicit txn writes must always fail, regardless of enforcement.\n expectEditTxnError(() => txn.writeFileProperty(inactiveName, \"value\"), \"not-active\");\n expectEditTxnError(() => txn.saveChanges(`save ${inactiveName}`), \"not-active\");\n expect(iModel.queryFilePropertyString({ name: inactiveName, namespace: \"EditTxnTest\" })).to.be.undefined;\n expectEditTxnError(() => txn.end(\"abandon\"), \"not-active\");\n\n txn.start();\n txn.writeFileProperty(savedName, \"value\");\n txn.saveChanges(`save ${savedName}`);\n expect(txn.isActive).to.be.true;\n\n txn.end();\n expect(iModel.queryFilePropertyString({ name: savedName, namespace: \"EditTxnTest\" })).to.equal(\"value\");\n\n expectEditTxnError(() => txn.writeFileProperty(inactiveAgainName, \"value\"), \"not-active\");\n expectEditTxnError(() => txn.saveChanges(`save ${inactiveAgainName}`), \"not-active\");\n expect(iModel.queryFilePropertyString({ name: inactiveAgainName, namespace: \"EditTxnTest\" })).to.be.undefined;\n expectEditTxnError(() => txn.end(\"abandon\"), \"not-active\");\n }\n });\n\n it(\"logs implicit writes in log mode but still rejects inactive explicit writes\", () => {\n EditTxn.implicitWriteEnforcement = \"log\";\n const logError = sinon.spy(Logger, \"logError\");\n const txn = new TestEditTxn(iModel);\n\n legacyWriteFileProperty(iModel, \"implicit-log\", \"value\");\n expect(iModel.queryFilePropertyString({ name: \"implicit-log\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n expect(logError.called).to.be.true;\n expect(logError.firstCall.args[0]).to.equal(\"core-backend.IModelDb\");\n expect(EditTxnError.isError(logError.firstCall.args[1], \"implicit-txn-write-disallowed\")).to.be.true;\n\n const callCount = logError.callCount;\n expectEditTxnError(() => txn.writeFileProperty(\"inactive-log\", \"value\"), \"not-active\");\n expectEditTxnError(() => txn.saveChanges(\"save inactive log\"), \"not-active\");\n expect(logError.callCount).to.equal(callCount);\n expectEditTxnError(() => txn.end(\"abandon\"), \"not-active\");\n });\n\n it(\"rejects implicit writes in throw mode and still allows active explicit writes\", () => {\n EditTxn.implicitWriteEnforcement = \"throw\";\n\n expectEditTxnError(() => legacyWriteFileProperty(iModel, \"implicit-throw\", \"value\"), \"implicit-txn-write-disallowed\");\n expect(iModel.queryFilePropertyString({ name: \"implicit-throw\", namespace: \"EditTxnTest\" })).to.be.undefined;\n\n const txn = new TestEditTxn(iModel);\n txn.start();\n txn.writeFileProperty(\"explicit-enforce\", \"value\");\n txn.end();\n\n expect(iModel.queryFilePropertyString({ name: \"explicit-enforce\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n });\n\n it(\"throws when started with unsaved changes\", () => {\n // Unsaved changes made through the implicit surface block a new explicit EditTxn.\n legacyWriteFileProperty(iModel, \"unsaved\", \"value\");\n\n const txn = new TestEditTxn(iModel);\n expectEditTxnError(() => txn.start(), \"unsaved-changes\");\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.abandonChanges();\n legacyWriteFileProperty(iModel, \"legacy-after-abandon\", \"value\");\n expect(iModel.queryFilePropertyString({ name: \"legacy-after-abandon\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n });\n\n it(\"rejects starting an explicit txn while another explicit txn is active\", () => {\n const first = new TestEditTxn(iModel);\n const second = new TestEditTxn(iModel);\n\n first.start();\n expect(first.isActive).to.be.true;\n\n // EditTxn.start() now requires the implicit txn to be active, so a second explicit txn cannot start yet.\n expectEditTxnError(() => second.start(), \"already-active\");\n expect(first.isActive).to.be.true;\n expect(second.isActive).to.be.false;\n\n first.end(\"abandon\");\n expect(first.isActive).to.be.false;\n });\n\n it(\"allows deprecated mutating APIs while an explicit txn is active when enforcement is none\", () => {\n const txn = new TestEditTxn(iModel);\n txn.start();\n\n // Deprecated IModelDb mutators route through the implicit txn and are allowed in compatibility mode.\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.saveFileProperty({ name: \"legacy\", namespace: \"EditTxnTest\" }, \"value\");\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModel.saveChanges(\"legacy save\");\n expect(iModel.queryFilePropertyString({ name: \"legacy\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n\n txn.writeFileProperty(\"explicit\", \"value\");\n txn.saveChanges(\"explicit save\");\n expect(iModel.queryFilePropertyString({ name: \"explicit\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n\n txn.end(\"abandon\");\n expect(txn.isActive).to.be.false;\n });\n\n it(\"allows starting a new explicit txn when only pending changes exist\", () => {\n const first = new TestEditTxn(iModel);\n const second = new TestEditTxn(iModel);\n\n first.start();\n first.writeFileProperty(\"pending\", \"value\");\n first.saveChanges(\"save pending\");\n\n // Saved-but-unpushed changes are allowed; only unsaved local changes block start().\n expect(iModel.txns.hasPendingTxns).to.be.true;\n expect(iModel.txns.hasUnsavedChanges).to.be.false;\n\n first.end(\"abandon\");\n expect(() => second.start()).to.not.throw();\n expect(first.isActive).to.be.false;\n expect(second.isActive).to.be.true;\n\n second.end(\"abandon\");\n expect(second.isActive).to.be.false;\n });\n\n it(\"uses the default description unless save is given an override\", () => {\n const txn = new EditTxn(iModel, \"default description\");\n\n txn.start();\n txn.saveFileProperty({ name: \"default-description\", namespace: \"EditTxnTest\" }, \"value\");\n txn.saveChanges();\n expect(iModel.txns.getLastSavedTxnProps()?.props.description).to.equal(\"default description\");\n\n txn.saveFileProperty({ name: \"override-description\", namespace: \"EditTxnTest\" }, \"value\");\n txn.end(\"save\", \"override description\");\n expect(iModel.txns.getLastSavedTxnProps()?.props.description).to.equal(\"override description\");\n });\n\n it(\"reverseTxns abandons unsaved changes from the active explicit txn\", () => {\n const txn = new TestEditTxn(iModel);\n txn.start();\n txn.writeFileProperty(\"reverse\", \"value\");\n\n // Reversing txns abandons the active explicit txn's local changes, but the explicit txn remains active.\n iModel.txns.reverseTxns(1);\n\n expect(txn.isActive).to.be.true;\n expect(iModel.txns.hasUnsavedChanges).to.be.false;\n expect(iModel.queryFilePropertyString({ name: \"reverse\", namespace: \"EditTxnTest\" })).to.be.undefined;\n\n txn.end(\"abandon\");\n expect(txn.isActive).to.be.false;\n });\n\n it(\"saves unsaved changes from the active explicit txn when the iModel closes\", () => {\n const txn = new TestEditTxn(iModel);\n txn.start();\n txn.writeFileProperty(\"unsaved-on-close\", \"value\");\n\n iModel.close();\n iModel = StandaloneDb.openFile(fileName, OpenMode.Readonly);\n\n expect(iModel.queryFilePropertyString({ name: \"unsaved-on-close\", namespace: \"EditTxnTest\" })).to.equal(\"value\");\n });\n\n it(\"allows subclasses to abandon unsaved changes when the iModel closes\", () => {\n const txn = new AbandonOnCloseEditTxn(iModel);\n txn.start();\n txn.writeFileProperty(\"saved-on-close\", \"value\");\n\n iModel.close();\n iModel = StandaloneDb.openFile(fileName, OpenMode.Readonly);\n\n expect(iModel.queryFilePropertyString({ name: \"saved-on-close\", namespace: \"EditTxnTest\" })).to.be.undefined;\n });\n});\n\n"]}
|