@itwin/core-backend 5.0.0-dev.98 → 5.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/CatalogDb.d.ts +103 -0
- package/lib/cjs/CatalogDb.d.ts.map +1 -0
- package/lib/cjs/CatalogDb.js +271 -0
- package/lib/cjs/CatalogDb.js.map +1 -0
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +14 -7
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +243 -242
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +12 -10
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +17 -41
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +5 -5
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +104 -20
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +157 -46
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +37 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +81 -0
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +181 -2
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +224 -5
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +1 -0
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +4 -0
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +8 -4
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +3 -3
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/FontFile.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +10 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +51 -16
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +1 -1
- package/lib/cjs/IModelHost.js +1 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/ImageSourceConversion.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +4 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +2 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +5 -4
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +29 -28
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
- package/lib/cjs/core-backend.d.ts +1 -1
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -1
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +6 -4
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/FontFileImpl.js.map +1 -1
- package/lib/cjs/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
- package/lib/cjs/internal/HubMock.d.ts.map +1 -0
- package/lib/cjs/{HubMock.js → internal/HubMock.js} +22 -11
- package/lib/cjs/internal/HubMock.js.map +1 -0
- package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/cjs/internal/NativePlatform.js.map +1 -1
- package/lib/cjs/internal/NoLocks.js.map +1 -1
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/internal/Symbols.d.ts +1 -2
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -3
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +2 -16
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +35 -104
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +6 -13
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +2 -7
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/lib/esm/BackendHubAccess.js.map +1 -1
- package/lib/esm/BackendLoggerCategory.js.map +1 -1
- package/lib/esm/BisCoreSchema.js.map +1 -1
- package/lib/esm/BlobContainerService.js.map +1 -1
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/CatalogDb.d.ts +103 -0
- package/lib/esm/CatalogDb.d.ts.map +1 -0
- package/lib/esm/CatalogDb.js +267 -0
- package/lib/esm/CatalogDb.js.map +1 -0
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/esm/ChangeSummaryManager.js +14 -7
- package/lib/esm/ChangeSummaryManager.js.map +1 -1
- package/lib/esm/ChangedElementsDb.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +243 -242
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChannelControl.js.map +1 -1
- package/lib/esm/CheckpointManager.d.ts +12 -10
- package/lib/esm/CheckpointManager.d.ts.map +1 -1
- package/lib/esm/CheckpointManager.js +18 -42
- package/lib/esm/CheckpointManager.js.map +1 -1
- package/lib/esm/ClassRegistry.js +5 -5
- package/lib/esm/ClassRegistry.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +104 -20
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js +157 -46
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeService.js.map +1 -1
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/CustomViewState3dCreator.js.map +1 -1
- package/lib/esm/DevTools.js.map +1 -1
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECDb.d.ts +37 -1
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +82 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/ECSchemaXmlContext.d.ts +1 -1
- package/lib/esm/ECSchemaXmlContext.js +1 -1
- package/lib/esm/ECSchemaXmlContext.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts +181 -2
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js +222 -4
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts.map +1 -1
- package/lib/esm/ElementAspect.js +1 -0
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementGraphics.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts.map +1 -1
- package/lib/esm/ElementTreeWalker.js +4 -0
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/Entity.d.ts +8 -4
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +3 -3
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/EntityReferences.js.map +1 -1
- package/lib/esm/ExportGraphics.js.map +1 -1
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/FontFile.js.map +1 -1
- package/lib/esm/GeoCoordConfig.js.map +1 -1
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/GeometrySummary.js +47 -47
- package/lib/esm/GeometrySummary.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +10 -1
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +51 -16
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelDbFonts.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +1 -1
- package/lib/esm/IModelHost.js +1 -1
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/IModelJsFs.js.map +1 -1
- package/lib/esm/ImageSourceConversion.js.map +1 -1
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/LocalHub.js +1 -1
- package/lib/esm/LocalHub.js.map +1 -1
- package/lib/esm/LocalhostIpcHost.js.map +1 -1
- package/lib/esm/LockControl.js.map +1 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/NativeAppStorage.js.map +1 -1
- package/lib/esm/NativeHost.d.ts.map +1 -1
- package/lib/esm/NativeHost.js +4 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/NavigationRelationship.js.map +1 -1
- package/lib/esm/PromiseMemoizer.js.map +1 -1
- package/lib/esm/PropertyStore.js.map +1 -1
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +2 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/RpcBackend.js.map +1 -1
- package/lib/esm/SQLiteDb.d.ts.map +1 -1
- package/lib/esm/SQLiteDb.js +5 -4
- package/lib/esm/SQLiteDb.js.map +1 -1
- package/lib/esm/Schema.js.map +1 -1
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/SchemaUtils.js.map +1 -1
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/SqliteStatement.js.map +1 -1
- package/lib/esm/TextAnnotationElement.js.map +1 -1
- package/lib/esm/TextAnnotationGeometry.js.map +1 -1
- package/lib/esm/TextAnnotationLayout.js.map +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TileStorage.js.map +1 -1
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +30 -29
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/core-backend.d.ts +1 -1
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +1 -1
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/FunctionalSchema.js.map +1 -1
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/domains/GenericSchema.js.map +1 -1
- package/lib/esm/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +7 -5
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/FontFileImpl.js.map +1 -1
- package/lib/esm/{HubMock.d.ts → internal/HubMock.d.ts} +4 -5
- package/lib/esm/internal/HubMock.d.ts.map +1 -0
- package/lib/esm/{HubMock.js → internal/HubMock.js} +22 -11
- package/lib/esm/internal/HubMock.js.map +1 -0
- package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/esm/internal/NativePlatform.js.map +1 -1
- package/lib/esm/internal/NoLocks.js.map +1 -1
- package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
- package/lib/esm/internal/Symbols.d.ts +1 -2
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -2
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts +2 -16
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js +36 -100
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/esm/rpc/multipart.js.map +1 -1
- package/lib/esm/rpc/tracing.js.map +1 -1
- package/lib/esm/rpc/web/logging.js.map +1 -1
- package/lib/esm/rpc/web/request.js.map +1 -1
- package/lib/esm/rpc/web/response.js.map +1 -1
- package/lib/esm/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +1 -0
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/esm/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/esm/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/esm/test/AdvancedEqual.js.map +1 -1
- package/lib/esm/test/AttachDb.test.js +11 -11
- package/lib/esm/test/AttachDb.test.js.map +1 -1
- package/lib/esm/test/GeometryTestUtil.js.map +1 -1
- package/lib/esm/test/IModelHost.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +6 -2
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +37 -6
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/ImageSourceConversion.test.js.map +1 -1
- package/lib/esm/test/IpcHost.test.js.map +1 -1
- package/lib/esm/test/KnownTestLocations.js.map +1 -1
- package/lib/esm/test/PrintElementTree.js +1 -0
- package/lib/esm/test/PrintElementTree.js.map +1 -1
- package/lib/esm/test/PropertyDb.test.js.map +1 -1
- package/lib/esm/test/RevisionUtility.js.map +1 -1
- package/lib/esm/test/SchemaUtils.test.js +27 -25
- package/lib/esm/test/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
- package/lib/esm/test/TestChangeSetUtility.js +1 -1
- package/lib/esm/test/TestChangeSetUtility.js.map +1 -1
- package/lib/esm/test/TestUtils.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- package/lib/esm/test/categories/Category.test.js.map +1 -1
- package/lib/esm/test/codespec/CodeSpec.test.js.map +1 -1
- package/lib/esm/test/ecdb/CTE.test.js +88 -88
- package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js +15 -15
- package/lib/esm/test/ecdb/ConcurrentQueryLoad.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDb.test.js +69 -58
- package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECDbTestHelper.js.map +1 -1
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js +4 -4
- package/lib/esm/test/ecdb/ECSchemaXmlContext.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +66 -65
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +13 -7
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js +17 -17
- package/lib/esm/test/ecdb/ECSqlReader.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +533 -443
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/SqliteStatement.test.js +2 -0
- package/lib/esm/test/ecdb/SqliteStatement.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestGenerator.js +22 -21
- 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 +5 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementAspect.test.js +22 -22
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
- package/lib/esm/test/element/ElementDependencyGraph.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +149 -139
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/ExcludedElements.test.js.map +1 -1
- package/lib/esm/test/element/ExternalSource.test.js.map +1 -1
- package/lib/esm/test/element/NullStructArray.test.js +13 -13
- package/lib/esm/test/element/NullStructArray.test.js.map +1 -1
- package/lib/esm/test/element/UrlLink.test.js.map +1 -1
- package/lib/esm/test/font/FontFile.test.js.map +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js +1 -1
- package/lib/esm/test/font/IModelDbFonts.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js +4 -3
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/imageData.js.map +1 -1
- package/lib/esm/test/imodel/ElementTreeWalker.test.js +1 -0
- package/lib/esm/test/imodel/ElementTreeWalker.test.js.map +1 -1
- package/lib/esm/test/imodel/GetTextureImage.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +15 -1
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/ProjectExtents.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/index.js.map +1 -1
- package/lib/esm/test/misc/DevTools.test.js.map +1 -1
- package/lib/esm/test/misc/EntitySubClasses.test.js.map +1 -1
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/misc/PromiseMemoizer.test.js.map +1 -1
- package/lib/esm/test/native/DgnDbWorker.test.js.map +1 -1
- package/lib/esm/test/rpc/response.test.js.map +1 -1
- package/lib/esm/test/schema/ClassRegistry.test.js +71 -71
- package/lib/esm/test/schema/ClassRegistry.test.js.map +1 -1
- package/lib/esm/test/schema/FunctionalDomain.test.js.map +1 -1
- package/lib/esm/test/schema/GenericDomain.test.js +1 -0
- package/lib/esm/test/schema/GenericDomain.test.js.map +1 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +30 -29
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/CustomViewState3dCreator.test.js.map +1 -1
- package/lib/esm/test/standalone/DisplayStyle.test.js.map +1 -1
- package/lib/esm/test/standalone/Drawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/ElementMesh.test.js.map +1 -1
- package/lib/esm/test/standalone/ExportGraphics.test.js +19 -54
- package/lib/esm/test/standalone/ExportGraphics.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryChangeEvents.test.js.map +1 -1
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/HubMock.test.js +1 -1
- package/lib/esm/test/standalone/HubMock.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js +35 -28
- package/lib/esm/test/standalone/IModelWrite.test.js.map +1 -1
- package/lib/esm/test/standalone/InlineGeometryPartReferences.test.js.map +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js +1 -1
- package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
- package/lib/esm/test/standalone/NativeAppStorage.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderMaterialElement.test.js +1 -0
- package/lib/esm/test/standalone/RenderMaterialElement.test.js.map +1 -1
- package/lib/esm/test/standalone/RenderTimeline.test.js.map +1 -1
- package/lib/esm/test/standalone/SQLiteDb.test.js.map +1 -1
- package/lib/esm/test/standalone/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/standalone/SectionDrawing.test.js.map +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js +1 -1
- package/lib/esm/test/standalone/ServerBasedLocks.test.js.map +1 -1
- package/lib/esm/test/standalone/Setting.test.js.map +1 -1
- package/lib/esm/test/standalone/Settings.test.js.map +1 -1
- package/lib/esm/test/standalone/SettingsSchemas.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +5 -4
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Texture.test.js.map +1 -1
- package/lib/esm/test/standalone/TileCache.test.js.map +1 -1
- package/lib/esm/test/standalone/TileTree.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js +4 -3
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/lib/esm/workspace/Settings.js.map +1 -1
- package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
- package/lib/esm/workspace/Workspace.d.ts +6 -13
- package/lib/esm/workspace/Workspace.d.ts.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.d.ts +2 -7
- package/lib/esm/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +13 -13
- package/lib/cjs/HubMock.d.ts.map +0 -1
- package/lib/cjs/HubMock.js.map +0 -1
- package/lib/esm/HubMock.d.ts.map +0 -1
- package/lib/esm/HubMock.js.map +0 -1
- package/lib/esm/test/CloudSqliteMock.d.ts +0 -37
- package/lib/esm/test/CloudSqliteMock.d.ts.map +0 -1
- package/lib/esm/test/CloudSqliteMock.js +0 -117
- package/lib/esm/test/CloudSqliteMock.js.map +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module iModels
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CatalogIModelHandler = exports.CatalogDb = void 0;
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const CloudSqlite_1 = require("./CloudSqlite");
|
|
14
|
+
const IModelHost_1 = require("./IModelHost");
|
|
15
|
+
const core_common_1 = require("@itwin/core-common");
|
|
16
|
+
const IpcHost_1 = require("./IpcHost");
|
|
17
|
+
const IModelDb_1 = require("./IModelDb");
|
|
18
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
19
|
+
const Symbols_1 = require("./internal/Symbols");
|
|
20
|
+
const NativePlatform_1 = require("./internal/NativePlatform");
|
|
21
|
+
let readonlyCloudCache;
|
|
22
|
+
let writeableCloudCache;
|
|
23
|
+
const catalogManifestName = "CatalogManifest";
|
|
24
|
+
// we make a readonly CloudCache and a writeable CloudCache. That way the access token authorizations are distinct.
|
|
25
|
+
function makeCloudCache(arg, writeable) {
|
|
26
|
+
const cache = CloudSqlite_1.CloudSqlite.CloudCaches.getCache(arg);
|
|
27
|
+
// if the cache was just created, add the "catalog" members as hidden
|
|
28
|
+
if (undefined === cache.catalogContainers) {
|
|
29
|
+
CloudSqlite_1.CloudSqlite.addHiddenProperty(cache, "catalogContainers", new Map());
|
|
30
|
+
CloudSqlite_1.CloudSqlite.addHiddenProperty(cache, "writeable", writeable);
|
|
31
|
+
}
|
|
32
|
+
return cache;
|
|
33
|
+
}
|
|
34
|
+
// find an existing CloudContainer for accessing a CatalogIModel, or make a new one and connect it
|
|
35
|
+
async function getCatalogContainerObj(cache, containerId) {
|
|
36
|
+
const cloudContainer = cache.catalogContainers.get(containerId);
|
|
37
|
+
if (undefined !== cloudContainer)
|
|
38
|
+
return cloudContainer;
|
|
39
|
+
const accessLevel = cache.writeable ? "write" : "read";
|
|
40
|
+
const tokenProps = await CloudSqlite_1.CloudSqlite.getBlobService().requestToken({ containerId, accessLevel, userToken: await IModelHost_1.IModelHost.getAccessToken() });
|
|
41
|
+
const container = CloudSqlite_1.CloudSqlite.createCloudContainer({
|
|
42
|
+
accessLevel,
|
|
43
|
+
baseUri: tokenProps.baseUri,
|
|
44
|
+
containerId,
|
|
45
|
+
storageType: tokenProps.provider,
|
|
46
|
+
writeable: cache.writeable,
|
|
47
|
+
accessToken: tokenProps.token
|
|
48
|
+
});
|
|
49
|
+
cache.catalogContainers.set(containerId, container); // save the container in the map of ContainerIds so we can reuse them
|
|
50
|
+
container.connect(cache);
|
|
51
|
+
return container;
|
|
52
|
+
}
|
|
53
|
+
function getReadonlyCloudCache() { return readonlyCloudCache ??= makeCloudCache({ cacheName: "catalogs", cacheSize: "10G" }, false); }
|
|
54
|
+
;
|
|
55
|
+
function getWritableCloudCache() { return writeableCloudCache ??= makeCloudCache({ cacheName: "writeableCatalogs", cacheSize: "10G" }, true); }
|
|
56
|
+
;
|
|
57
|
+
async function getReadonlyContainer(containerId) { return getCatalogContainerObj(getReadonlyCloudCache(), containerId); }
|
|
58
|
+
;
|
|
59
|
+
async function getWriteableContainer(containerId) { return getCatalogContainerObj(getWritableCloudCache(), containerId); }
|
|
60
|
+
;
|
|
61
|
+
/** Throw an error if the write lock is not held for the supplied container */
|
|
62
|
+
function ensureLocked(container, reason) {
|
|
63
|
+
if (!container.hasWriteLock)
|
|
64
|
+
core_common_1.CloudSqliteError.throwError("write-lock-not-held", { message: `Write lock must be held to ${reason}` });
|
|
65
|
+
}
|
|
66
|
+
/** update the manifest in a CatalogIModel (calls `saveChanges`) */
|
|
67
|
+
function updateManifest(nativeDb, manifest) {
|
|
68
|
+
nativeDb.saveLocalValue(catalogManifestName, JSON.stringify(manifest));
|
|
69
|
+
nativeDb.saveChanges("update manifest");
|
|
70
|
+
}
|
|
71
|
+
function catalogDbNameWithDefault(dbName) {
|
|
72
|
+
return dbName ?? "catalog-db";
|
|
73
|
+
}
|
|
74
|
+
/** A StandaloneDb that holds a CatalogIModel */
|
|
75
|
+
class CatalogDbImpl extends IModelDb_1.StandaloneDb {
|
|
76
|
+
isEditable() {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
getManifest() {
|
|
80
|
+
const manifestString = this[Symbols_1._nativeDb].queryLocalValue(catalogManifestName);
|
|
81
|
+
if (undefined === manifestString)
|
|
82
|
+
return undefined;
|
|
83
|
+
return JSON.parse(manifestString);
|
|
84
|
+
}
|
|
85
|
+
getVersion() {
|
|
86
|
+
return CloudSqlite_1.CloudSqlite.parseDbFileName(this[Symbols_1._nativeDb].getFilePath()).version;
|
|
87
|
+
}
|
|
88
|
+
getInfo() {
|
|
89
|
+
return { manifest: this.getManifest(), version: this.getVersion() };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A CatalogDb that permits editing.
|
|
94
|
+
* This class ensures that CatalogIModels never have a Txn table when they are published.
|
|
95
|
+
* It also automatically updates the `lastEditedBy` field in the CatalogManifest.
|
|
96
|
+
*/
|
|
97
|
+
class EditableCatalogDbImpl extends CatalogDbImpl {
|
|
98
|
+
isEditable() {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
updateCatalogManifest(manifest) {
|
|
102
|
+
updateManifest(this[Symbols_1._nativeDb], manifest);
|
|
103
|
+
}
|
|
104
|
+
// Make sure the txn table is deleted and update the manifest every time we close.
|
|
105
|
+
beforeClose() {
|
|
106
|
+
try {
|
|
107
|
+
const manifest = this.getManifest();
|
|
108
|
+
const container = this.cloudContainer;
|
|
109
|
+
if (container && manifest) {
|
|
110
|
+
manifest.lastEditedBy = CloudSqlite_1.CloudSqlite.getWriteLockHeldBy(container);
|
|
111
|
+
this.updateCatalogManifest(manifest);
|
|
112
|
+
}
|
|
113
|
+
// when saved, CatalogIModels should never have any Txns. If we wanted to create a changeset, we'd have to do it here.
|
|
114
|
+
this[Symbols_1._nativeDb].deleteAllTxns();
|
|
115
|
+
}
|
|
116
|
+
catch { } // ignore errors attempting to update
|
|
117
|
+
// might also want to vacuum here?
|
|
118
|
+
super.beforeClose();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function findCatalogByKey(key) {
|
|
122
|
+
return CatalogDbImpl.findByKey(key);
|
|
123
|
+
}
|
|
124
|
+
/** @beta */
|
|
125
|
+
var CatalogDb;
|
|
126
|
+
(function (CatalogDb) {
|
|
127
|
+
/** Create a new [[BlobContainer]] to hold versions of a [[CatalogDb]].
|
|
128
|
+
* @returns The properties of the newly created container.
|
|
129
|
+
* @note creating new containers requires "admin" authorization.
|
|
130
|
+
*/
|
|
131
|
+
async function createNewContainer(args) {
|
|
132
|
+
const dbName = catalogDbNameWithDefault(args.dbName);
|
|
133
|
+
CloudSqlite_1.CloudSqlite.validateDbName(dbName);
|
|
134
|
+
CloudSqlite_1.CloudSqlite.validateDbVersion(args.version);
|
|
135
|
+
const tmpName = (0, path_1.join)(IModelHost_1.KnownLocations.tmpdir, `temp-${dbName}`);
|
|
136
|
+
try {
|
|
137
|
+
// make a copy of the file they supplied so we can modify its contents safely
|
|
138
|
+
fs.copyFileSync(args.localCatalogFile, tmpName);
|
|
139
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
140
|
+
nativeDb.openIModel(tmpName, core_bentley_1.OpenMode.ReadWrite);
|
|
141
|
+
nativeDb.setITwinId(core_bentley_1.Guid.empty); // catalogs must be a StandaloneDb
|
|
142
|
+
nativeDb.setIModelId(core_bentley_1.Guid.createValue()); // make sure its iModelId is unique
|
|
143
|
+
updateManifest(nativeDb, args.manifest); // store the manifest inside the Catalog
|
|
144
|
+
nativeDb.deleteAllTxns(); // Catalogs should never have Txns (and, this must be empty before resetting BriefcaseId)
|
|
145
|
+
nativeDb.resetBriefcaseId(core_common_1.BriefcaseIdValue.Unassigned); // catalogs should always be unassigned
|
|
146
|
+
nativeDb.saveChanges(); // save change to briefcaseId
|
|
147
|
+
nativeDb.vacuum();
|
|
148
|
+
nativeDb.closeFile();
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
core_common_1.CatalogError.throwError("invalid-seed-catalog", { message: "Illegal seed catalog", ...args, cause: e });
|
|
152
|
+
}
|
|
153
|
+
const userToken = await IModelHost_1.IModelHost.getAccessToken();
|
|
154
|
+
// create tne new container from the blob service, requires "admin" authorization
|
|
155
|
+
const cloudContainerProps = await CloudSqlite_1.CloudSqlite.getBlobService().create({ scope: { iTwinId: args.iTwinId }, metadata: { ...args.metadata, containerType: "CatalogIModel" }, userToken });
|
|
156
|
+
// now create a CloudSqlite container object to access it
|
|
157
|
+
const container = CloudSqlite_1.CloudSqlite.createCloudContainer({
|
|
158
|
+
accessToken: await CloudSqlite_1.CloudSqlite.requestToken(cloudContainerProps),
|
|
159
|
+
accessLevel: "admin",
|
|
160
|
+
writeable: true,
|
|
161
|
+
baseUri: cloudContainerProps.baseUri,
|
|
162
|
+
containerId: cloudContainerProps.containerId,
|
|
163
|
+
storageType: cloudContainerProps.provider,
|
|
164
|
+
});
|
|
165
|
+
// initialize the container for use by CloudSqlite
|
|
166
|
+
container.initializeContainer({ blockSize: 4 * 1024 * 1024 });
|
|
167
|
+
container.connect(getWritableCloudCache());
|
|
168
|
+
// upload the initial version of the Catalog
|
|
169
|
+
await CloudSqlite_1.CloudSqlite.withWriteLock({ user: "initialize", container }, async () => {
|
|
170
|
+
await CloudSqlite_1.CloudSqlite.uploadDb(container, { dbName: CloudSqlite_1.CloudSqlite.makeSemverName(dbName, args.version), localFileName: tmpName });
|
|
171
|
+
fs.unlinkSync(tmpName); // delete temporary copy of catalog
|
|
172
|
+
});
|
|
173
|
+
container.disconnect();
|
|
174
|
+
return cloudContainerProps;
|
|
175
|
+
}
|
|
176
|
+
CatalogDb.createNewContainer = createNewContainer;
|
|
177
|
+
/** Acquire the write lock for a [CatalogIModel]($common) container. Only one person may obtain the write lock at a time.
|
|
178
|
+
* You must obtain the lock before attempting to write to the container via functions like [[CatalogDb.openEditable]] and [[CatalogDb.createNewVersion]].
|
|
179
|
+
* @note This requires "write" authorization to the container
|
|
180
|
+
*/
|
|
181
|
+
async function acquireWriteLock(args) {
|
|
182
|
+
const container = await getWriteableContainer(args.containerId);
|
|
183
|
+
return CloudSqlite_1.CloudSqlite.acquireWriteLock({ container, user: args.username });
|
|
184
|
+
}
|
|
185
|
+
CatalogDb.acquireWriteLock = acquireWriteLock;
|
|
186
|
+
/** Release the write lock on a [CatalogIModel]($common) container. This uploads all changes made while the lock is held, so they become visible to other users. */
|
|
187
|
+
async function releaseWriteLock(args) {
|
|
188
|
+
const container = await getWriteableContainer(args.containerId);
|
|
189
|
+
if (args.abandon)
|
|
190
|
+
container.abandonChanges();
|
|
191
|
+
CloudSqlite_1.CloudSqlite.releaseWriteLock(container);
|
|
192
|
+
}
|
|
193
|
+
CatalogDb.releaseWriteLock = releaseWriteLock;
|
|
194
|
+
/** Open an [[EditableCatalogDb]] for write access.
|
|
195
|
+
* @note Once a version of a catalog iModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.
|
|
196
|
+
* @note The write lock must be held for this operation to succeed
|
|
197
|
+
*/
|
|
198
|
+
async function openEditable(args) {
|
|
199
|
+
const dbName = catalogDbNameWithDefault(args.dbName);
|
|
200
|
+
if (undefined === args.containerId) // local file?
|
|
201
|
+
return EditableCatalogDbImpl.openFile(dbName, core_bentley_1.OpenMode.ReadWrite, args);
|
|
202
|
+
const container = await getWriteableContainer(args.containerId);
|
|
203
|
+
ensureLocked(container, "open a Catalog for editing"); // editing Catalogs requires the write lock
|
|
204
|
+
// look up the full name with version
|
|
205
|
+
const dbFullName = CloudSqlite_1.CloudSqlite.querySemverMatch({ container, dbName, version: args.version ?? "*" });
|
|
206
|
+
if (!CloudSqlite_1.CloudSqlite.isSemverEditable(dbFullName, container))
|
|
207
|
+
core_common_1.CloudSqliteError.throwError("already-published", { message: "Catalog has already been published and is not editable. Make a new version first.", ...args });
|
|
208
|
+
if (args.prefetch)
|
|
209
|
+
CloudSqlite_1.CloudSqlite.startCloudPrefetch(container, dbFullName);
|
|
210
|
+
return EditableCatalogDbImpl.openFile(dbFullName, core_bentley_1.OpenMode.ReadWrite, { container, ...args });
|
|
211
|
+
}
|
|
212
|
+
CatalogDb.openEditable = openEditable;
|
|
213
|
+
/** Open a [[CatalogDb]] for read-only access. */
|
|
214
|
+
async function openReadonly(args) {
|
|
215
|
+
const dbName = catalogDbNameWithDefault(args.dbName);
|
|
216
|
+
if (undefined === args.containerId) // local file?
|
|
217
|
+
return CatalogDbImpl.openFile(dbName, core_bentley_1.OpenMode.Readonly, args);
|
|
218
|
+
const container = await getReadonlyContainer(args.containerId);
|
|
219
|
+
if (args.syncWithCloud)
|
|
220
|
+
container.checkForChanges();
|
|
221
|
+
const dbFullName = CloudSqlite_1.CloudSqlite.querySemverMatch({ container, ...args, dbName });
|
|
222
|
+
if (args.prefetch)
|
|
223
|
+
CloudSqlite_1.CloudSqlite.startCloudPrefetch(container, dbFullName);
|
|
224
|
+
return CatalogDbImpl.openFile(dbFullName, core_bentley_1.OpenMode.Readonly, { container, ...args });
|
|
225
|
+
}
|
|
226
|
+
CatalogDb.openReadonly = openReadonly;
|
|
227
|
+
/**
|
|
228
|
+
* Create a new version of a [CatalogIModel]($common) as a copy of an existing version. Immediately after this operation, the new version will be an exact copy
|
|
229
|
+
* of the source CatalogIModel. Then, use [[CatalogDb.openEditable]] to modify the new version with new content.
|
|
230
|
+
* @note The write lock must be held for this operation to succeed
|
|
231
|
+
*/
|
|
232
|
+
async function createNewVersion(args) {
|
|
233
|
+
const container = await getWriteableContainer(args.containerId);
|
|
234
|
+
ensureLocked(container, "create a new version");
|
|
235
|
+
return CloudSqlite_1.CloudSqlite.createNewDbVersion(container, { ...args, fromDb: { ...args.fromDb, dbName: catalogDbNameWithDefault(args.fromDb.dbName) } });
|
|
236
|
+
}
|
|
237
|
+
CatalogDb.createNewVersion = createNewVersion;
|
|
238
|
+
})(CatalogDb || (exports.CatalogDb = CatalogDb = {}));
|
|
239
|
+
/**
|
|
240
|
+
* Handler for Ipc access to CatalogIModels. Registered by NativeHost.
|
|
241
|
+
* @internal
|
|
242
|
+
*/
|
|
243
|
+
class CatalogIModelHandler extends IpcHost_1.IpcHandler {
|
|
244
|
+
get channelName() { return "catalogIModel/ipc"; }
|
|
245
|
+
async createNewContainer(args) {
|
|
246
|
+
return CatalogDb.createNewContainer(args);
|
|
247
|
+
}
|
|
248
|
+
async acquireWriteLock(args) {
|
|
249
|
+
return CatalogDb.acquireWriteLock(args);
|
|
250
|
+
}
|
|
251
|
+
async releaseWriteLock(args) {
|
|
252
|
+
return CatalogDb.releaseWriteLock(args);
|
|
253
|
+
}
|
|
254
|
+
async openReadonly(args) {
|
|
255
|
+
return ((await CatalogDb.openReadonly(args)).getConnectionProps());
|
|
256
|
+
}
|
|
257
|
+
async openEditable(args) {
|
|
258
|
+
return (await CatalogDb.openEditable(args)).getConnectionProps();
|
|
259
|
+
}
|
|
260
|
+
async createNewVersion(args) {
|
|
261
|
+
return CatalogDb.createNewVersion(args);
|
|
262
|
+
}
|
|
263
|
+
async getInfo(key) {
|
|
264
|
+
return findCatalogByKey(key).getInfo();
|
|
265
|
+
}
|
|
266
|
+
async updateCatalogManifest(key, manifest) {
|
|
267
|
+
findCatalogByKey(key).updateCatalogManifest(manifest);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.CatalogIModelHandler = CatalogIModelHandler;
|
|
271
|
+
//# sourceMappingURL=CatalogDb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogDb.js","sourceRoot":"","sources":["../../src/CatalogDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yBAAyB;AACzB,+BAA4B;AAC5B,+CAA4C;AAC5C,6CAA0D;AAC1D,oDAAiI;AACjI,uCAAuC;AACvC,yCAA0C;AAC1C,sDAAqD;AACrD,gDAA+C;AAC/C,8DAAyD;AA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A4B;QACpD,OAAO,CAAC,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrE,CAAC;IACM,KAAK,CAAC,YAAY,CAAC,IAA4B;QACpD,OAAO,CAAC,MAAM,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACnE,CAAC;IACM,KAAK,CAAC,gBAAgB,CAAC,IAAwC;QACpE,OAAO,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IACM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC9B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;IACM,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,QAAgC;QAC9E,gBAAgB,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA3BD,oDA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport * as fs from \"fs\";\r\nimport { join } from \"path\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { IModelHost, KnownLocations } from \"./IModelHost\";\r\nimport { BriefcaseIdValue, CatalogError, type CatalogIModel, CloudSqliteError, IModelConnectionProps } from \"@itwin/core-common\";\r\nimport { IpcHandler } from \"./IpcHost\";\r\nimport { StandaloneDb } from \"./IModelDb\";\r\nimport { Guid, OpenMode } from \"@itwin/core-bentley\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\n\r\ninterface CatalogCloudCache extends CloudSqlite.CloudCache {\r\n writeable: boolean;\r\n catalogContainers: Map<string, CloudSqlite.CloudContainer>;\r\n}\r\n\r\nlet readonlyCloudCache: CatalogCloudCache | undefined;\r\nlet writeableCloudCache: CatalogCloudCache | undefined;\r\nconst catalogManifestName = \"CatalogManifest\";\r\n\r\n// we make a readonly CloudCache and a writeable CloudCache. That way the access token authorizations are distinct.\r\nfunction makeCloudCache(arg: CloudSqlite.CreateCloudCacheArg, writeable: boolean) {\r\n const cache = CloudSqlite.CloudCaches.getCache(arg) as CatalogCloudCache;\r\n // if the cache was just created, add the \"catalog\" members as hidden\r\n if (undefined === cache.catalogContainers) {\r\n CloudSqlite.addHiddenProperty(cache, \"catalogContainers\", new Map<string, CloudSqlite.CloudContainer>());\r\n CloudSqlite.addHiddenProperty(cache, \"writeable\", writeable);\r\n }\r\n return cache;\r\n}\r\n\r\n// find an existing CloudContainer for accessing a CatalogIModel, or make a new one and connect it\r\nasync function getCatalogContainerObj(cache: CatalogCloudCache, containerId: string): Promise<CloudSqlite.CloudContainer> {\r\n const cloudContainer = cache.catalogContainers.get(containerId);\r\n if (undefined !== cloudContainer)\r\n return cloudContainer;\r\n\r\n const accessLevel = cache.writeable ? \"write\" : \"read\";\r\n const tokenProps = await CloudSqlite.getBlobService().requestToken({ containerId, accessLevel, userToken: await IModelHost.getAccessToken() });\r\n const container = CloudSqlite.createCloudContainer({\r\n accessLevel,\r\n baseUri: tokenProps.baseUri,\r\n containerId,\r\n storageType: tokenProps.provider,\r\n writeable: cache.writeable,\r\n accessToken: tokenProps.token\r\n });\r\n cache.catalogContainers.set(containerId, container); // save the container in the map of ContainerIds so we can reuse them\r\n container.connect(cache);\r\n return container;\r\n}\r\n\r\nfunction getReadonlyCloudCache() { return readonlyCloudCache ??= makeCloudCache({ cacheName: \"catalogs\", cacheSize: \"10G\" }, false) };\r\nfunction getWritableCloudCache() { return writeableCloudCache ??= makeCloudCache({ cacheName: \"writeableCatalogs\", cacheSize: \"10G\" }, true) };\r\nasync function getReadonlyContainer(containerId: string) { return getCatalogContainerObj(getReadonlyCloudCache(), containerId) };\r\nasync function getWriteableContainer(containerId: string) { return getCatalogContainerObj(getWritableCloudCache(), containerId) };\r\n\r\n/** Throw an error if the write lock is not held for the supplied container */\r\nfunction ensureLocked(container: CloudSqlite.CloudContainer, reason: string) {\r\n if (!container.hasWriteLock)\r\n CloudSqliteError.throwError(\"write-lock-not-held\", { message: `Write lock must be held to ${reason}` });\r\n}\r\n/** update the manifest in a CatalogIModel (calls `saveChanges`) */\r\nfunction updateManifest(nativeDb: IModelJsNative.DgnDb, manifest: CatalogIModel.Manifest) {\r\n nativeDb.saveLocalValue(catalogManifestName, JSON.stringify(manifest));\r\n nativeDb.saveChanges(\"update manifest\");\r\n}\r\nfunction catalogDbNameWithDefault(dbName?: string): string {\r\n return dbName ?? \"catalog-db\";\r\n}\r\n\r\n/** A [[StandaloneDb]] that provides read-only access to the contents of a [CatalogIModel]($common).\r\n * @see [[CatalogDb.openReadonly]] to instantiate this type.\r\n * @beta\r\n */\r\nexport interface CatalogDb extends StandaloneDb {\r\n /** Get the catalog's manifest. */\r\n getManifest(): CatalogIModel.Manifest | undefined;\r\n /** Get the catalog's version information. */\r\n getVersion(): string;\r\n /** Get the catalog's manifest and version. */\r\n getInfo(): { manifest?: CatalogIModel.Manifest, version: string };\r\n /** Returns true if the catalog was opened in read-write mode. */\r\n isEditable(): this is EditableCatalogDb;\r\n}\r\n\r\n/** A writable [[CatalogDb]].\r\n * @see [[CatalogDb.openEditable]] to instantiate this type.\r\n * @beta\r\n */\r\nexport interface EditableCatalogDb extends CatalogDb {\r\n /** Update the contents of the catalog manifest. */\r\n updateCatalogManifest(manifest: CatalogIModel.Manifest): void;\r\n}\r\n\r\n/** A StandaloneDb that holds a CatalogIModel */\r\nclass CatalogDbImpl extends StandaloneDb implements CatalogDb {\r\n public isEditable(): this is EditableCatalogDb {\r\n return false;\r\n }\r\n\r\n public getManifest(): CatalogIModel.Manifest | undefined {\r\n const manifestString = this[_nativeDb].queryLocalValue(catalogManifestName);\r\n if (undefined === manifestString)\r\n return undefined;\r\n return JSON.parse(manifestString) as CatalogIModel.Manifest;\r\n }\r\n\r\n public getVersion(): string {\r\n return CloudSqlite.parseDbFileName(this[_nativeDb].getFilePath()).version;\r\n }\r\n\r\n public getInfo() {\r\n return { manifest: this.getManifest(), version: this.getVersion() };\r\n }\r\n}\r\n\r\n/**\r\n * A CatalogDb that permits editing.\r\n * This class ensures that CatalogIModels never have a Txn table when they are published.\r\n * It also automatically updates the `lastEditedBy` field in the CatalogManifest.\r\n */\r\nclass EditableCatalogDbImpl extends CatalogDbImpl implements EditableCatalogDb {\r\n public override isEditable(): this is EditableCatalogDb {\r\n return true;\r\n }\r\n\r\n public updateCatalogManifest(manifest: CatalogIModel.Manifest): void {\r\n updateManifest(this[_nativeDb], manifest);\r\n }\r\n\r\n // Make sure the txn table is deleted and update the manifest every time we close.\r\n public override beforeClose(): void {\r\n try {\r\n const manifest = this.getManifest();\r\n const container = this.cloudContainer;\r\n if (container && manifest) {\r\n manifest.lastEditedBy = CloudSqlite.getWriteLockHeldBy(container);\r\n this.updateCatalogManifest(manifest);\r\n }\r\n\r\n // when saved, CatalogIModels should never have any Txns. If we wanted to create a changeset, we'd have to do it here.\r\n this[_nativeDb].deleteAllTxns();\r\n } catch { } // ignore errors attempting to update\r\n\r\n // might also want to vacuum here?\r\n super.beforeClose();\r\n }\r\n}\r\n\r\nfunction findCatalogByKey(key: string): CatalogDbImpl & EditableCatalogDb {\r\n return CatalogDbImpl.findByKey(key) as CatalogDbImpl & EditableCatalogDb;\r\n}\r\n\r\n/** @beta */\r\nexport namespace CatalogDb {\r\n /** Create a new [[BlobContainer]] to hold versions of a [[CatalogDb]].\r\n * @returns The properties of the newly created container.\r\n * @note creating new containers requires \"admin\" authorization.\r\n */\r\n export async function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n CloudSqlite.validateDbName(dbName);\r\n CloudSqlite.validateDbVersion(args.version);\r\n\r\n const tmpName = join(KnownLocations.tmpdir, `temp-${dbName}`);\r\n try {\r\n // make a copy of the file they supplied so we can modify its contents safely\r\n fs.copyFileSync(args.localCatalogFile, tmpName);\r\n const nativeDb = new IModelNative.platform.DgnDb();\r\n nativeDb.openIModel(tmpName, OpenMode.ReadWrite);\r\n nativeDb.setITwinId(Guid.empty); // catalogs must be a StandaloneDb\r\n nativeDb.setIModelId(Guid.createValue()); // make sure its iModelId is unique\r\n updateManifest(nativeDb, args.manifest); // store the manifest inside the Catalog\r\n nativeDb.deleteAllTxns(); // Catalogs should never have Txns (and, this must be empty before resetting BriefcaseId)\r\n nativeDb.resetBriefcaseId(BriefcaseIdValue.Unassigned); // catalogs should always be unassigned\r\n nativeDb.saveChanges(); // save change to briefcaseId\r\n nativeDb.vacuum();\r\n nativeDb.closeFile();\r\n } catch (e: unknown) {\r\n CatalogError.throwError(\"invalid-seed-catalog\", { message: \"Illegal seed catalog\", ...args, cause: e });\r\n }\r\n\r\n const userToken = await IModelHost.getAccessToken();\r\n // create tne new container from the blob service, requires \"admin\" authorization\r\n const cloudContainerProps = await CloudSqlite.getBlobService().create({ scope: { iTwinId: args.iTwinId }, metadata: { ...args.metadata, containerType: \"CatalogIModel\" }, userToken });\r\n\r\n // now create a CloudSqlite container object to access it\r\n const container = CloudSqlite.createCloudContainer({\r\n accessToken: await CloudSqlite.requestToken(cloudContainerProps),\r\n accessLevel: \"admin\",\r\n writeable: true,\r\n baseUri: cloudContainerProps.baseUri,\r\n containerId: cloudContainerProps.containerId,\r\n storageType: cloudContainerProps.provider,\r\n });\r\n\r\n // initialize the container for use by CloudSqlite\r\n container.initializeContainer({ blockSize: 4 * 1024 * 1024 });\r\n container.connect(getWritableCloudCache());\r\n\r\n // upload the initial version of the Catalog\r\n await CloudSqlite.withWriteLock({ user: \"initialize\", container }, async () => {\r\n await CloudSqlite.uploadDb(container, { dbName: CloudSqlite.makeSemverName(dbName, args.version), localFileName: tmpName });\r\n fs.unlinkSync(tmpName); // delete temporary copy of catalog\r\n });\r\n container.disconnect();\r\n return cloudContainerProps;\r\n }\r\n\r\n /** Acquire the write lock for a [CatalogIModel]($common) container. Only one person may obtain the write lock at a time.\r\n * You must obtain the lock before attempting to write to the container via functions like [[CatalogDb.openEditable]] and [[CatalogDb.createNewVersion]].\r\n * @note This requires \"write\" authorization to the container\r\n */\r\n export async function acquireWriteLock(args: {\r\n /** The id of the container */\r\n containerId: string,\r\n /**\r\n * The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.\r\n * It is also stored in the \"lastEditedBy\" field of the manifest of any new version edited while the lock is held.\r\n */\r\n username: string;\r\n }): Promise<void> {\r\n const container = await getWriteableContainer(args.containerId);\r\n return CloudSqlite.acquireWriteLock({ container, user: args.username });\r\n }\r\n\r\n /** Release the write lock on a [CatalogIModel]($common) container. This uploads all changes made while the lock is held, so they become visible to other users. */\r\n export async function releaseWriteLock(args: {\r\n /** The id of the container */\r\n containerId: string,\r\n /** If true, abandon all local changes before releasing the lock */\r\n abandon?: true\r\n }): Promise<void> {\r\n const container = await getWriteableContainer(args.containerId);\r\n if (args.abandon)\r\n container.abandonChanges();\r\n CloudSqlite.releaseWriteLock(container);\r\n }\r\n\r\n /** Open an [[EditableCatalogDb]] for write access.\r\n * @note Once a version of a catalog iModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.\r\n * @note The write lock must be held for this operation to succeed\r\n */\r\n export async function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogDb> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n if (undefined === args.containerId) // local file?\r\n return EditableCatalogDbImpl.openFile(dbName, OpenMode.ReadWrite, args) as EditableCatalogDbImpl;\r\n\r\n const container = await getWriteableContainer(args.containerId);\r\n ensureLocked(container, \"open a Catalog for editing\"); // editing Catalogs requires the write lock\r\n\r\n // look up the full name with version\r\n const dbFullName = CloudSqlite.querySemverMatch({ container, dbName, version: args.version ?? \"*\" });\r\n if (!CloudSqlite.isSemverEditable(dbFullName, container))\r\n CloudSqliteError.throwError(\"already-published\", { message: \"Catalog has already been published and is not editable. Make a new version first.\", ...args })\r\n\r\n if (args.prefetch)\r\n CloudSqlite.startCloudPrefetch(container, dbFullName);\r\n\r\n return EditableCatalogDbImpl.openFile(dbFullName, OpenMode.ReadWrite, { container, ...args }) as EditableCatalogDbImpl;\r\n }\r\n\r\n /** Open a [[CatalogDb]] for read-only access. */\r\n export async function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogDb> {\r\n const dbName = catalogDbNameWithDefault(args.dbName);\r\n if (undefined === args.containerId) // local file?\r\n return CatalogDbImpl.openFile(dbName, OpenMode.Readonly, args) as CatalogDbImpl;\r\n\r\n const container = await getReadonlyContainer(args.containerId);\r\n if (args.syncWithCloud)\r\n container.checkForChanges();\r\n\r\n const dbFullName = CloudSqlite.querySemverMatch({ container, ...args, dbName });\r\n if (args.prefetch)\r\n CloudSqlite.startCloudPrefetch(container, dbFullName);\r\n\r\n return CatalogDbImpl.openFile(dbFullName, OpenMode.Readonly, { container, ...args }) as CatalogDbImpl;\r\n }\r\n\r\n /**\r\n * Create a new version of a [CatalogIModel]($common) as a copy of an existing version. Immediately after this operation, the new version will be an exact copy\r\n * of the source CatalogIModel. Then, use [[CatalogDb.openEditable]] to modify the new version with new content.\r\n * @note The write lock must be held for this operation to succeed\r\n */\r\n export async function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\r\n const container = await getWriteableContainer(args.containerId);\r\n ensureLocked(container, \"create a new version\");\r\n return CloudSqlite.createNewDbVersion(container, { ...args, fromDb: { ...args.fromDb, dbName: catalogDbNameWithDefault(args.fromDb.dbName) } });\r\n }\r\n}\r\n\r\n/**\r\n * Handler for Ipc access to CatalogIModels. Registered by NativeHost.\r\n * @internal\r\n */\r\nexport class CatalogIModelHandler extends IpcHandler implements CatalogIModel.IpcMethods {\r\n public get channelName(): CatalogIModel.IpcChannel { return \"catalogIModel/ipc\"; }\r\n\r\n public async createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\r\n return CatalogDb.createNewContainer(args);\r\n }\r\n public async acquireWriteLock(args: { containerId: string, username: string; }): Promise<void> {\r\n return CatalogDb.acquireWriteLock(args);\r\n }\r\n public async releaseWriteLock(args: { containerId: string, abandon?: true; }): Promise<void> {\r\n return CatalogDb.releaseWriteLock(args);\r\n }\r\n public async openReadonly(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\r\n return ((await CatalogDb.openReadonly(args)).getConnectionProps());\r\n }\r\n public async openEditable(args: CatalogIModel.OpenArgs): Promise<IModelConnectionProps> {\r\n return (await CatalogDb.openEditable(args)).getConnectionProps();\r\n }\r\n public async createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\r\n return CatalogDb.createNewVersion(args);\r\n }\r\n public async getInfo(key: string): Promise<{ manifest?: CatalogIModel.Manifest, version: string }> {\r\n return findCatalogByKey(key).getInfo();\r\n }\r\n public async updateCatalogManifest(key: string, manifest: CatalogIModel.Manifest): Promise<void> {\r\n findCatalogByKey(key).updateCatalogManifest(manifest);\r\n }\r\n}\r\n"]}
|
package/lib/cjs/Category.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAErE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;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CAAC,CAAC;IAChF,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY;QAClF,MAAM,aAAa,GAAkB;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QAC1J,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\n\n/** Defines the appearance for graphics in Geometric elements\n * @public\n */\nexport class SubCategory extends DefinitionElement {\n public static override get className(): string { return \"SubCategory\"; }\n /** The Appearance parameters for this SubCategory */\n public appearance: SubCategoryAppearance;\n /** Optional description of this SubCategory. */\n public description?: string;\n\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.appearance = new SubCategoryAppearance(props.appearance);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): SubCategoryProps {\n const val = super.toJSON() as SubCategoryProps;\n val.appearance = this.appearance.toJSON();\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the SubCategory's name (its Code value). */\n public getSubCategoryName(): string { return this.code.value; }\n /** Get the Id of the SubCategory. */\n public getSubCategoryId(): Id64String { return this.id; }\n /** Get the Id of this SubCategory's parent Category. */\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\n /** Check if this is the default SubCategory of its parent Category. */\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\n\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\n * @param iModel The IModel\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\n * @param codeValue The name of the SubCategory\n */\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\n }\n\n /** Create a new SubCategory\n * @param iModelDb The iModel\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The newly constructed SubCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\n if (appearance instanceof SubCategoryAppearance)\n appearance = appearance.toJSON();\n\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\n const subCategoryProps: SubCategoryProps = {\n classFullName: this.classFullName,\n model: parentCategory.model,\n parent: new CategoryOwnsSubCategories(parentCategoryId),\n code: this.createCode(iModelDb, parentCategoryId, name),\n appearance,\n };\n return new SubCategory(subCategoryProps, iModelDb);\n }\n\n /** Insert a new SubCategory\n * @param iModelDb Insert into this iModel\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The Id of the newly inserted SubCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\n return iModelDb.elements.insertElement(subCategory.toJSON());\n }\n}\n\n/** A Category element is the target of the `category` member of [[GeometricElement]].\n * @public\n */\nexport class Category extends DefinitionElement {\n public static override get className(): string { return \"Category\"; }\n public rank: Rank = Rank.User;\n public description?: string;\n\n protected constructor(props: CategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.rank = JsonUtils.asInt(props.rank);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): CategoryProps {\n const val = super.toJSON() as CategoryProps;\n val.rank = this.rank;\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the Id of the default SubCategory for this Category. */\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\n\n /** Set the appearance of the default SubCategory for this Category */\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\n if (props instanceof SubCategoryAppearance)\n props = props.toJSON();\n\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\n subCat.appearance = new SubCategoryAppearance(props);\n this.iModel.elements.updateElement(subCat.toJSON());\n }\n}\n\n/** Categorizes 2d GeometricElements.\n * @public\n */\nexport class DrawingCategory extends Category {\n public static override get className(): string { return \"DrawingCategory\"; }\n\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\n\n /** Looks up the CategoryId of a DrawingCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A drawing category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new DrawingCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @returns The newly constructed DrawingCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new DrawingCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new DrawingCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\n * @returns The Id of the newly inserted DrawingCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n const elements = iModelDb.elements;\n category.id = elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\n * @public\n */\nexport class SpatialCategory extends Category {\n public static override get className(): string { return \"SpatialCategory\"; }\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\n\n /** Looks up the CategoryId of a SpatialCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A spatial category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new SpatialCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the SpatialCategory\n * @returns The newly constructed SpatialCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new SpatialCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new SpatialCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\n * @param name The name of the SpatialCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\n * @returns The Id of the newly inserted SpatialCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n category.id = iModelDb.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAErE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC9C,UAAU,CAAwB;IACzC,gDAAgD;IACzC,WAAW,CAAU;IAE5B,YAAsB,KAAuB,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,mCAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAsB,CAAC;QAC/C,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,WAAW,IAAI,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GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionElement } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\r\n\r\n/** Defines the appearance for graphics in Geometric elements\r\n * @public\r\n */\r\nexport class SubCategory extends DefinitionElement {\r\n public static override get className(): string { return \"SubCategory\"; }\r\n /** The Appearance parameters for this SubCategory */\r\n public appearance: SubCategoryAppearance;\r\n /** Optional description of this SubCategory. */\r\n public description?: string;\r\n\r\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.appearance = new SubCategoryAppearance(props.appearance);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n public override toJSON(): SubCategoryProps {\r\n const val = super.toJSON() as SubCategoryProps;\r\n val.appearance = this.appearance.toJSON();\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the SubCategory's name (its Code value). */\r\n public getSubCategoryName(): string { return this.code.value; }\r\n /** Get the Id of the SubCategory. */\r\n public getSubCategoryId(): Id64String { return this.id; }\r\n /** Get the Id of this SubCategory's parent Category. */\r\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\r\n /** Check if this is the default SubCategory of its parent Category. */\r\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\r\n\r\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\r\n * @param iModel The IModel\r\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\r\n * @param codeValue The name of the SubCategory\r\n */\r\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\r\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\r\n }\r\n\r\n /** Create a new SubCategory\r\n * @param iModelDb The iModel\r\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The newly constructed SubCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\r\n if (appearance instanceof SubCategoryAppearance)\r\n appearance = appearance.toJSON();\r\n\r\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\r\n const subCategoryProps: SubCategoryProps = {\r\n classFullName: this.classFullName,\r\n model: parentCategory.model,\r\n parent: new CategoryOwnsSubCategories(parentCategoryId),\r\n code: this.createCode(iModelDb, parentCategoryId, name),\r\n appearance,\r\n };\r\n return new SubCategory(subCategoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new SubCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\r\n * @param name The name of the SubCategory\r\n * @param appearance The appearance settings to use for this SubCategory\r\n * @returns The Id of the newly inserted SubCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\r\n return iModelDb.elements.insertElement(subCategory.toJSON());\r\n }\r\n}\r\n\r\n/** A Category element is the target of the `category` member of [[GeometricElement]].\r\n * @public\r\n */\r\nexport class Category extends DefinitionElement {\r\n public static override get className(): string { return \"Category\"; }\r\n public rank: Rank = Rank.User;\r\n public description?: string;\r\n\r\n protected constructor(props: CategoryProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.rank = JsonUtils.asInt(props.rank);\r\n this.description = JsonUtils.asString(props.description);\r\n }\r\n\r\n public override toJSON(): CategoryProps {\r\n const val = super.toJSON() as CategoryProps;\r\n val.rank = this.rank;\r\n if (this.description && this.description.length > 0)\r\n val.description = this.description;\r\n return val;\r\n }\r\n\r\n /** Get the Id of the default SubCategory for this Category. */\r\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\r\n\r\n /** Set the appearance of the default SubCategory for this Category */\r\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\r\n if (props instanceof SubCategoryAppearance)\r\n props = props.toJSON();\r\n\r\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\r\n subCat.appearance = new SubCategoryAppearance(props);\r\n this.iModel.elements.updateElement(subCat.toJSON());\r\n }\r\n}\r\n\r\n/** Categorizes 2d GeometricElements.\r\n * @public\r\n */\r\nexport class DrawingCategory extends Category {\r\n public static override get className(): string { return \"DrawingCategory\"; }\r\n\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\r\n\r\n /** Looks up the CategoryId of a DrawingCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A drawing category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new DrawingCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @returns The newly constructed DrawingCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new DrawingCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new DrawingCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\r\n * @param name The name of the DrawingCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\r\n * @returns The Id of the newly inserted DrawingCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const category = this.create(iModelDb, definitionModelId, name);\r\n const elements = iModelDb.elements;\r\n category.id = elements.insertElement(category.toJSON());\r\n category.setDefaultAppearance(defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n\r\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\r\n * @public\r\n */\r\nexport class SpatialCategory extends Category {\r\n public static override get className(): string { return \"SpatialCategory\"; }\r\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\r\n\r\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\r\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\r\n\r\n /** Looks up the CategoryId of a SpatialCategory by model and name */\r\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\r\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\r\n return iModel.elements.queryElementIdByCode(code);\r\n }\r\n\r\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\r\n * @param iModel The IModel\r\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\r\n * @param codeValue The name of the category\r\n * @return A spatial category Code\r\n */\r\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\r\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\r\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\r\n }\r\n\r\n /** Create a new SpatialCategory\r\n * @param iModelDb The iModel\r\n * @param definitionModelId The [[DefinitionModel]]\r\n * @param name The name/CodeValue of the SpatialCategory\r\n * @returns The newly constructed SpatialCategory element.\r\n * @throws [[IModelError]] if unable to create the element.\r\n */\r\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\r\n const categoryProps: CategoryProps = {\r\n classFullName: this.classFullName,\r\n model: definitionModelId,\r\n code: this.createCode(iModelDb, definitionModelId, name),\r\n isPrivate: false,\r\n };\r\n return new SpatialCategory(categoryProps, iModelDb);\r\n }\r\n\r\n /** Insert a new SpatialCategory\r\n * @param iModelDb Insert into this iModel\r\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\r\n * @param name The name of the SpatialCategory\r\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\r\n * @returns The Id of the newly inserted SpatialCategory element.\r\n * @throws [[IModelError]] if unable to insert the element.\r\n */\r\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\r\n const category = this.create(iModelDb, definitionModelId, name);\r\n category.id = iModelDb.elements.insertElement(category.toJSON());\r\n category.setDefaultAppearance(defaultAppearance);\r\n return category.id;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeSummaryManager.d.ts","sourceRoot":"","sources":["../../src/ChangeSummaryManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAoB,UAAU,EAAE,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAA8B,MAAM,oBAAoB,CAAC;AAMjH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO7D;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,UAAU,CAAC;IACf,SAAS,EAAE;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,UAAU,CAAA;KAAE,CAAC;CAC3H;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,UA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acheFilePath, ECDb_1.ECDbOpenMode.FileUpgrade);
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
165
166
|
const actualSchemaVersion = changesFile.withPreparedStatement("SELECT VersionMajor read,VersionWrite write,VersionMinor minor FROM meta.ECSchemaDef WHERE Name='IModelChange'", (stmt) => {
|
|
166
167
|
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
167
168
|
throw new core_common_1.IModelError(core_bentley_1.DbResult.BE_SQLITE_ERROR, "File is not a valid Change Cache file.");
|
|
@@ -175,6 +176,7 @@ class ChangeSummaryManager {
|
|
|
175
176
|
}
|
|
176
177
|
static getExtendedSchemaPath() { return path.join(IModelHost_1.KnownLocations.packageAssetsDir, "IModelChange.02.00.00.ecschema.xml"); }
|
|
177
178
|
static isSummaryAlreadyExtracted(changesFile, changeSetId) {
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
178
180
|
return changesFile.withPreparedStatement("SELECT Summary.Id summaryid FROM imodelchange.ChangeSet WHERE WsgId=?", (stmt) => {
|
|
179
181
|
stmt.bindString(1, changeSetId);
|
|
180
182
|
if (core_bentley_1.DbResult.BE_SQLITE_ROW === stmt.step())
|
|
@@ -183,7 +185,7 @@ class ChangeSummaryManager {
|
|
|
183
185
|
});
|
|
184
186
|
}
|
|
185
187
|
static addExtendedInfos(changesFile, changeSummaryId, changesetWsgId, changesetParentWsgId, description, changesetPushDate, changeSetUserCreated) {
|
|
186
|
-
changesFile.
|
|
188
|
+
changesFile.withCachedWriteStatement("INSERT INTO imodelchange.ChangeSet(Summary.Id,WsgId,ParentWsgId,Description,PushDate,UserCreated) VALUES(?,?,?,?,?,?)", (stmt) => {
|
|
187
189
|
stmt.bindId(1, changeSummaryId);
|
|
188
190
|
stmt.bindString(2, changesetWsgId);
|
|
189
191
|
if (changesetParentWsgId)
|
|
@@ -194,9 +196,9 @@ class ChangeSummaryManager {
|
|
|
194
196
|
stmt.bindDateTime(5, changesetPushDate);
|
|
195
197
|
if (changeSetUserCreated)
|
|
196
198
|
stmt.bindString(6, changeSetUserCreated);
|
|
197
|
-
const r = stmt.
|
|
198
|
-
if (r !== core_bentley_1.DbResult.BE_SQLITE_DONE)
|
|
199
|
-
throw new core_common_1.IModelError(r, `Failed to add changeset information to extracted change summary ${changeSummaryId}`);
|
|
199
|
+
const r = stmt.stepForInsert();
|
|
200
|
+
if (r.status !== core_bentley_1.DbResult.BE_SQLITE_DONE)
|
|
201
|
+
throw new core_common_1.IModelError(r.status, `Failed to add changeset information to extracted change summary ${changeSummaryId}`);
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
/** Queries the ChangeSummary for the specified change summary id
|
|
@@ -213,6 +215,7 @@ class ChangeSummaryManager {
|
|
|
213
215
|
static queryChangeSummary(iModel, changeSummaryId) {
|
|
214
216
|
if (!ChangeSummaryManager.isChangeCacheAttached(iModel))
|
|
215
217
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "Change Cache file must be attached to iModel.");
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
216
219
|
return iModel.withPreparedStatement("SELECT WsgId,ParentWsgId,Description,PushDate,UserCreated FROM ecchange.imodelchange.ChangeSet WHERE Summary.Id=?", (stmt) => {
|
|
217
220
|
stmt.bindId(1, changeSummaryId);
|
|
218
221
|
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
@@ -236,9 +239,12 @@ class ChangeSummaryManager {
|
|
|
236
239
|
if (!ChangeSummaryManager.isChangeCacheAttached(iModel))
|
|
237
240
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "Change Cache file must be attached to iModel.");
|
|
238
241
|
// query instance changes
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
JOIN main.meta.
|
|
242
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
243
|
+
const instanceChange = iModel.withPreparedStatement(`SELECT ic.Summary.Id summaryId, s.Name changedInstanceSchemaName, c.Name changedInstanceClassName, ic.ChangedInstance.Id changedInstanceId,
|
|
244
|
+
ic.OpCode, ic.IsIndirect FROM ecchange.change.InstanceChange ic JOIN main.meta.ECClassDef c ON c.ECInstanceId = ic.ChangedInstance.ClassId
|
|
245
|
+
JOIN main.meta.ECSchemaDef s ON c.Schema.Id = s.ECInstanceId WHERE ic.ECInstanceId =? `,
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
247
|
+
(stmt) => {
|
|
242
248
|
stmt.bindId(1, instanceChangeId);
|
|
243
249
|
if (stmt.step() !== core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
244
250
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, `No InstanceChange found for id ${instanceChangeId}.`);
|
|
@@ -262,6 +268,7 @@ class ChangeSummaryManager {
|
|
|
262
268
|
* @throws [IModelError]($common) if the change cache file hasn't been attached, or in case of other errors.
|
|
263
269
|
*/
|
|
264
270
|
static getChangedPropertyValueNames(iModel, instanceChangeId) {
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
265
272
|
return iModel.withPreparedStatement("SELECT AccessString FROM ecchange.change.PropertyValueChange WHERE InstanceChange.Id=?", (stmt) => {
|
|
266
273
|
stmt.bindId(1, instanceChangeId);
|
|
267
274
|
const selectClauseItems = [];
|