@itwin/core-backend 5.8.0-dev.14 → 5.8.0-dev.16
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.js.map +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +248 -248
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- 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.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.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlRowExecutor.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/ECSqlSyncReader.js.map +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- 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.js +8 -8
- 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.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.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.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.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- 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/StashManager.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.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/FrameGeometry.js.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
- package/lib/cjs/annotations/TextBlockLayout.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.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.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -1
- package/lib/cjs/internal/FontFileImpl.js.map +1 -1
- package/lib/cjs/internal/HubMock.js.map +1 -1
- package/lib/cjs/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.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/OnlineStatus.js.map +1 -1
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/annotations/fields.js.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsDbImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsEditorImpl.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/SettingsSqliteDb.js.map +1 -1
- 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.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/SettingsDb.js.map +1 -1
- package/lib/cjs/workspace/SettingsEditor.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js.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.js.map +1 -1
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangeSummaryManager.js +2 -2
- package/lib/esm/ChangeSummaryManager.js.map +1 -1
- package/lib/esm/ChangedElementsDb.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +248 -248
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChannelControl.js.map +1 -1
- 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.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.js.map +1 -1
- package/lib/esm/ECSchemaXmlContext.js.map +1 -1
- package/lib/esm/ECSqlRowExecutor.js.map +1 -1
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/ECSqlSyncReader.js.map +1 -1
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementGraphics.js.map +1 -1
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- 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.js +8 -8
- 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.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.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.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.js.map +1 -1
- package/lib/esm/RpcBackend.js.map +1 -1
- 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/StashManager.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.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/FrameGeometry.js.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
- package/lib/esm/annotations/TextBlockLayout.js.map +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.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.js.map +1 -1
- package/lib/esm/internal/FontFileImpl.js.map +1 -1
- package/lib/esm/internal/HubMock.js.map +1 -1
- package/lib/esm/internal/IModelDbFontsImpl.js.map +1 -1
- package/lib/esm/internal/IntegrityCheck.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/OnlineStatus.js.map +1 -1
- package/lib/esm/internal/ServerBasedLocks.js.map +1 -1
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/annotations/fields.js.map +1 -1
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsDbImpl.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsEditorImpl.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/SettingsSqliteDb.js.map +1 -1
- 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.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/AnnotationTestUtils.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/ElementDrivesElement.test.js +23 -23
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.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.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.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 +25 -25
- package/lib/esm/test/SchemaUtils.test.js.map +1 -1
- package/lib/esm/test/SequentialLogMatcher.js.map +1 -1
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js +129 -129
- package/lib/esm/test/SquashSchemaAndDataChanges.test.js.map +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/Fields.test.js +53 -53
- 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/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
- 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.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/ConcurrentQuery.test.js +19 -19
- package/lib/esm/test/ecdb/ConcurrentQuery.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 +72 -72
- 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.map +1 -1
- package/lib/esm/test/ecdb/ECSqlAst.test.js +65 -65
- package/lib/esm/test/ecdb/ECSqlAst.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +4 -4
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlStatement.test.js +332 -332
- package/lib/esm/test/ecdb/ECSqlStatement.test.js.map +1 -1
- package/lib/esm/test/ecdb/ECSqlSyncReader.test.js.map +1 -1
- package/lib/esm/test/ecdb/QueryReaders.test.js +27 -27
- package/lib/esm/test/ecdb/QueryReaders.test.js.map +1 -1
- 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 +21 -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.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 +139 -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/ProjectInformationRecord.test.js.map +1 -1
- package/lib/esm/test/element/SheetInformationAspect.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.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +32 -32
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/CheckpointManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +56 -56
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +145 -145
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/imageData.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.js.map +1 -1
- 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 +44 -44
- 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 +13 -13
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/TestContext.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 +99 -99
- 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.map +1 -1
- package/lib/esm/test/schema/IModelSchemaContext.test.js +9 -9
- package/lib/esm/test/schema/IModelSchemaContext.test.js.map +1 -1
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js +19 -19
- package/lib/esm/test/schema/SchemaImportCallbacks.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +135 -135
- 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 +14 -14
- 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.map +1 -1
- package/lib/esm/test/standalone/IModelLimits.test.js.map +1 -1
- package/lib/esm/test/standalone/IModelWrite.test.js +27 -27
- 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/IntegrityCheck.test.js.map +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.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.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.map +1 -1
- package/lib/esm/test/standalone/StandaloneDb.test.js +20 -20
- package/lib/esm/test/standalone/StandaloneDb.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.map +1 -1
- package/lib/esm/test/standalone/iModelDb.test.js.map +1 -1
- package/lib/esm/test/workspace/SettingsDb.test.js.map +1 -1
- package/lib/esm/workspace/Settings.js.map +1 -1
- package/lib/esm/workspace/SettingsDb.js.map +1 -1
- package/lib/esm/workspace/SettingsEditor.js.map +1 -1
- package/lib/esm/workspace/SettingsSchemas.js.map +1 -1
- package/lib/esm/workspace/Workspace.js.map +1 -1
- package/lib/esm/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAC5D,iDAAgD;AAQhD,MAAM,wBAAyB,SAAQ,iCAAuC;IAC3D,UAAU,CAAS;IAC5B,MAAM,CAAC,SAAS,CAA4B;IAE7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAA4B;QACtD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAElD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;QACE,MAAM,OAAO,GAAG,KAAK,EAAE,KAA4B,EAAE,EAAE;YACrD,MAAM,EAAE,GAAG,MAAM,yCAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,WAAW,GAAG,IAAI,mDAAwB,CAAC,EAAE,CAAC,CAAC;YACrD,OAAO,WAAW,CAAC,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC;QAEF,MAAM,SAAS,GAAG,CAAC,KAA4B,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KA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MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAErE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AArSD,8CAqSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\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 RpcInterface\r\n */\r\n\r\nimport {\r\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\r\n} from \"@itwin/core-bentley\";\r\nimport {\r\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\r\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\r\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\r\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\r\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\r\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\r\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\r\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\r\n ViewStoreRpc,\r\n} from \"@itwin/core-common\";\r\nimport { Range3dProps } from \"@itwin/core-geometry\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { SpatialCategory } from \"../Category\";\r\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\r\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\r\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { DictionaryModel } from \"../Model\";\r\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\r\nimport { RpcTrace } from \"../rpc/tracing\";\r\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\r\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\r\nimport { _nativeDb } from \"../internal/Symbols\";\r\n\r\ninterface ViewStateRequestProps {\r\n accessToken: AccessToken;\r\n tokenProps: IModelRpcProps;\r\n options: CustomViewState3dCreatorOptions;\r\n}\r\n\r\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\r\n private readonly _timeoutMs: number;\r\n private static _instance?: ViewStateRequestMemoizer;\r\n\r\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\r\n if (!this._instance)\r\n this._instance = new ViewStateRequestMemoizer();\r\n\r\n return this._instance.perform(props);\r\n }\r\n\r\n private constructor() {\r\n const memoize = async (props: ViewStateRequestProps) => {\r\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\r\n const viewCreator = new CustomViewState3dCreator(db);\r\n return viewCreator.getCustomViewState3dData(props.options);\r\n };\r\n\r\n const stringify = (props: ViewStateRequestProps) => {\r\n const token = props.tokenProps;\r\n const modelIds = props.options.modelIds;\r\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\r\n };\r\n\r\n super(memoize, stringify);\r\n this._timeoutMs = 20 * 1000;\r\n }\r\n\r\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\r\n const memo = this.memoize(props);\r\n\r\n // Rejections must be caught so that the memoization entry is deleted.\r\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\r\n\r\n if (memo.isPending)\r\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\r\n\r\n this.deleteMemoized(props);\r\n\r\n if (memo.isFulfilled) {\r\n assert(undefined !== memo.result);\r\n return memo.result;\r\n }\r\n\r\n assert(memo.isRejected);\r\n throw memo.error;\r\n }\r\n}\r\n\r\nfunction currentActivity() {\r\n return RpcTrace.expectCurrentActivity;\r\n}\r\n\r\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\r\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\r\n}\r\n\r\n/** The backend implementation of IModelReadRpcInterface.\r\n * @internal\r\n */\r\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\r\n\r\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\r\n\r\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\r\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\r\n }\r\n\r\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\r\n const accessToken = currentActivity().accessToken;\r\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\r\n }\r\n\r\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const viewHydrater = new ViewStateHydrator(iModelDb);\r\n return viewHydrater.getHydrateResponseProps(options);\r\n }\r\n\r\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.queryAllUsedSpatialSubCategories();\r\n }\r\n\r\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\r\n return iModelDb.querySubCategories(decompressedIds);\r\n }\r\n\r\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\r\n }\r\n\r\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\r\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\r\n request.usePrimaryConn = false;\r\n }\r\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\r\n }\r\n\r\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\r\n const results = await this.queryModelExtents(tokenProps, modelIds);\r\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\r\n throw new IModelError(results[0].status, \"error querying model range\");\r\n\r\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\r\n }\r\n\r\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\r\n const iModel = await getIModelForRpc(tokenProps);\r\n return iModel.models.queryExtents(modelIds);\r\n }\r\n\r\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\r\n const modelIds = new Set(modelIdsList);\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const modelJsonArray: ModelProps[] = [];\r\n for (const id of modelIds) {\r\n try {\r\n const modelProps = iModelDb.models.getModelProps(id);\r\n modelJsonArray.push(modelProps);\r\n } catch (error) {\r\n if (modelIds.size === 1)\r\n throw error; // if they're asking for more than one model, don't throw on error.\r\n }\r\n }\r\n return modelJsonArray;\r\n }\r\n\r\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n return this.getModelProps(tokenProps, [...ids]);\r\n }\r\n\r\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\r\n const elementIds = new Set(elementIdsList);\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const elementProps: ElementProps[] = [];\r\n for (const id of elementIds) {\r\n try {\r\n elementProps.push(iModelDb.elements.getElementProps({ id }));\r\n } catch (error) {\r\n if (elementIds.size === 1)\r\n throw error; // if they're asking for more than one element, don't throw on error.\r\n }\r\n }\r\n return elementProps;\r\n }\r\n\r\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\r\n const props: ElementLoadProps = options ? { ...options } : {};\r\n if (typeof identifier === \"string\") {\r\n if (Id64.isId64(identifier))\r\n props.id = identifier;\r\n else\r\n props.federationGuid = identifier;\r\n } else {\r\n props.code = Code.fromJSON(identifier);\r\n }\r\n\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.elements.tryGetElementProps(props);\r\n }\r\n\r\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\r\n const iModel = await getIModelForRpc(tokenProps);\r\n return generateGeometrySummaries(request, iModel);\r\n }\r\n\r\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\r\n const ids = await this.queryEntityIds(tokenProps, params);\r\n const res = this.getElementProps(tokenProps, [...ids]);\r\n return res;\r\n }\r\n\r\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const res = iModelDb.queryEntityIds(params);\r\n return [...res];\r\n }\r\n\r\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const classArray: string[] = [];\r\n while (true) {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\r\n classArray.push(classFullName);\r\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\r\n break;\r\n\r\n classFullName = classMetaData.baseClasses[0];\r\n }\r\n return classArray;\r\n }\r\n\r\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\r\n const codeSpecs: any[] = [];\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\r\n for (const row of statement)\r\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\r\n });\r\n return codeSpecs;\r\n }\r\n\r\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\r\n }\r\n\r\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb[_nativeDb].readFontMap();\r\n }\r\n\r\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.requestSnap(sessionId, props);\r\n }\r\n\r\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.cancelSnap(sessionId);\r\n }\r\n\r\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getGeometryContainment(props);\r\n }\r\n\r\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getMassProperties(props);\r\n }\r\n\r\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n\r\n const getSingleCandidateMassProperties = async (candidate: string) => {\r\n try {\r\n const massPropResults: MassPropertiesResponseProps[] = [];\r\n\r\n for (const op of props.operations) {\r\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\r\n massPropResults.push(massProperties);\r\n }\r\n\r\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult.status = BentleyStatus.SUCCESS;\r\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\r\n singleCandidateResult = { ...singleCandidateResult, ...r };\r\n }\r\n }\r\n\r\n return singleCandidateResult;\r\n } catch {\r\n return { status: BentleyStatus.ERROR, candidate };\r\n }\r\n };\r\n\r\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\r\n promises.push(getSingleCandidateMassProperties(candidate));\r\n }\r\n\r\n return Promise.all(promises);\r\n }\r\n\r\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const el = iModelDb.elements.getElement(id);\r\n return (el === undefined) ? [] : el.getToolTipMessage();\r\n }\r\n\r\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\r\n * @deprecated in 3.6.0 - might be removed in next major version. Use queryViewThumbnail instead\r\n */\r\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const thumbnail = iModelDb.views.getThumbnail(viewId);\r\n if (undefined === thumbnail || 0 === thumbnail.image.length)\r\n throw new NoContentError();\r\n\r\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\r\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\r\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\r\n return val;\r\n }\r\n\r\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\r\n const blob = iModelDb.queryFilePropertyBlob(spec);\r\n if (undefined === blob || 8 !== blob.length)\r\n return Id64.invalid;\r\n\r\n const view = new Uint32Array(blob.buffer);\r\n return Id64.fromUint32Pair(view[0], view[1]);\r\n }\r\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\r\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\r\n }\r\n\r\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\r\n }\r\n\r\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\r\n const iModelDb = await getIModelForRpc(tokenProps);\r\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\r\n }\r\n\r\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\r\n const db = await getIModelForRpc(tokenProps);\r\n return db.queryTextureData(textureLoadProps);\r\n }\r\n\r\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\r\n const db = await getIModelForRpc(tokenProps);\r\n return db[_nativeDb].generateElementMeshes(props);\r\n }\r\n\r\n /** @internal */\r\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\r\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\r\n throw new Error(\"ViewStoreRpc version mismatch\");\r\n\r\n const db = await getIModelForRpc(tokenProps);\r\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\r\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\r\n\r\n const func = access[methodName];\r\n if (typeof func !== \"function\")\r\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\r\n\r\n return func.call(access, ...args);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IModelReadRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelReadRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAE6B;AAC7B,oDAU4B;AAE5B,oEAAiE;AACjE,0CAA8C;AAC9C,wDAAqD;AACrD,0EAAuE;AACvE,wDAA+D;AAG/D,wDAAqD;AACrD,4CAA0C;AAC1C,4DAAyD;AACzD,+DAA4D;AAC5D,iDAAgD;AAQhD,MAAM,wBAAyB,SAAQ,iCAAuC;IAC3D,UAAU,CAAS;IAC5B,MAAM,CAAC,SAAS,CAA4B;IAE7C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAA4B;QACtD,IAAI,CAAC,IAAI,CAAC,SAAS;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAElD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;QACE,MAAM,OAAO,GAAG,KAAK,EAAE,KAA4B,EAAE,EAAE;YACrD,MAAM,EAAE,GAAG,MAAM,yCAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YACzF,MAAM,WAAW,GAAG,IAAI,mDAAwB,CAAC,EAAE,CAAC,CAAC;YACrD,OAAO,WAAW,CAAC,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC;Q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CAAC;QAEnD,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAQ,CAAC;QAErE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,UAAU;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,+BAA+B,UAAU,GAAG,CAAC,CAAC;QAErG,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AArSD,8CAqSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n AccessToken, assert, BeDuration, BentleyStatus, CompressedId64Set, GuidString, Id64, Id64String, IModelStatus, Logger,\n} from \"@itwin/core-bentley\";\nimport {\n Code, CodeProps, CustomViewState3dCreatorOptions, CustomViewState3dProps, DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse,\n ElementLoadOptions, ElementLoadProps, ElementMeshRequestProps, ElementProps, EntityMetaData, EntityQueryParams, FontMapProps,\n GeoCoordinatesRequestProps, GeoCoordinatesResponseProps, GeometryContainmentRequestProps, GeometryContainmentResponseProps,\n GeometrySummaryRequestProps, HydrateViewStateRequestProps, HydrateViewStateResponseProps, ImageSourceFormat, IModel, IModelConnectionProps,\n IModelCoordinatesRequestProps, IModelCoordinatesResponseProps, IModelError, IModelReadRpcInterface, IModelRpcOpenProps, IModelRpcProps,\n MassPropertiesPerCandidateRequestProps, MassPropertiesPerCandidateResponseProps, MassPropertiesRequestProps, MassPropertiesResponseProps,\n ModelExtentsProps, ModelProps, NoContentError, RpcInterface, RpcManager, RpcPendingResponse, SnapRequestProps, SnapResponseProps,\n SubCategoryResultRow, SyncMode, TextureData, TextureLoadProps, ViewStateLoadProps, ViewStateProps,\n ViewStoreRpc,\n} from \"@itwin/core-common\";\nimport { Range3dProps } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { SpatialCategory } from \"../Category\";\nimport { ConcurrentQuery } from \"../ConcurrentQuery\";\nimport { CustomViewState3dCreator } from \"../CustomViewState3dCreator\";\nimport { generateGeometrySummaries } from \"../GeometrySummary\";\nimport { IModelDb } from \"../IModelDb\";\nimport { DictionaryModel } from \"../Model\";\nimport { PromiseMemoizer } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { ViewStateHydrator } from \"../ViewStateHydrator\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface ViewStateRequestProps {\n accessToken: AccessToken;\n tokenProps: IModelRpcProps;\n options: CustomViewState3dCreatorOptions;\n}\n\nclass ViewStateRequestMemoizer extends PromiseMemoizer<CustomViewState3dProps> {\n private readonly _timeoutMs: number;\n private static _instance?: ViewStateRequestMemoizer;\n\n public static async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n if (!this._instance)\n this._instance = new ViewStateRequestMemoizer();\n\n return this._instance.perform(props);\n }\n\n private constructor() {\n const memoize = async (props: ViewStateRequestProps) => {\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const viewCreator = new CustomViewState3dCreator(db);\n return viewCreator.getCustomViewState3dData(props.options);\n };\n\n const stringify = (props: ViewStateRequestProps) => {\n const token = props.tokenProps;\n const modelIds = props.options.modelIds;\n return `${token.key}-${token.iTwinId}-${token.iModelId}-${token.changeset?.id}:${modelIds}`;\n };\n\n super(memoize, stringify);\n this._timeoutMs = 20 * 1000;\n }\n\n private async perform(props: ViewStateRequestProps): Promise<CustomViewState3dProps> {\n const memo = this.memoize(props);\n\n // Rejections must be caught so that the memoization entry is deleted.\n await BeDuration.race(this._timeoutMs, memo.promise).catch(() => undefined);\n\n if (memo.isPending)\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n this.deleteMemoized(props);\n\n if (memo.isFulfilled) {\n assert(undefined !== memo.result);\n return memo.result;\n }\n\n assert(memo.isRejected);\n throw memo.error;\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\nasync function getIModelForRpc(tokenProps: IModelRpcProps): Promise<IModelDb> {\n return RpcBriefcaseUtility.findOpenIModel(RpcTrace.expectCurrentActivity.accessToken, tokenProps);\n}\n\n/** The backend implementation of IModelReadRpcInterface.\n * @internal\n */\nexport class IModelReadRpcImpl extends RpcInterface implements IModelReadRpcInterface {\n\n public static register() { RpcManager.registerImpl(IModelReadRpcInterface, IModelReadRpcImpl); }\n\n public async getConnectionProps(tokenProps: IModelRpcOpenProps): Promise<IModelConnectionProps> {\n return RpcBriefcaseUtility.openWithTimeout(currentActivity(), tokenProps, SyncMode.FixedVersion);\n }\n\n public async getCustomViewState3dData(tokenProps: IModelRpcProps, options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n const accessToken = currentActivity().accessToken;\n return ViewStateRequestMemoizer.perform({ accessToken, tokenProps, options });\n }\n\n public async hydrateViewState(tokenProps: IModelRpcProps, options: HydrateViewStateRequestProps): Promise<HydrateViewStateResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const viewHydrater = new ViewStateHydrator(iModelDb);\n return viewHydrater.getHydrateResponseProps(options);\n }\n\n public async queryAllUsedSpatialSubCategories(tokenProps: IModelRpcProps): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.queryAllUsedSpatialSubCategories();\n }\n\n public async querySubCategories(tokenProps: IModelRpcProps, compressedCategoryIds: CompressedId64Set): Promise<SubCategoryResultRow[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const decompressedIds = CompressedId64Set.decompressArray(compressedCategoryIds);\n return iModelDb.querySubCategories(decompressedIds);\n }\n\n public async queryRows(tokenProps: IModelRpcProps, request: DbQueryRequest): Promise<DbQueryResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeQueryRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryBlob(tokenProps: IModelRpcProps, request: DbBlobRequest): Promise<DbBlobResponse> {\n const iModelDb = await getIModelForRpc(tokenProps);\n if (iModelDb.isReadonly && request.usePrimaryConn === true) {\n Logger.logWarning(BackendLoggerCategory.IModelDb, \"usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.\", request);\n request.usePrimaryConn = false;\n }\n return ConcurrentQuery.executeBlobRequest(iModelDb[_nativeDb], request);\n }\n\n public async queryModelRanges(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<Range3dProps[]> {\n const results = await this.queryModelExtents(tokenProps, modelIds);\n if (results.length === 1 && results[0].status !== IModelStatus.Success)\n throw new IModelError(results[0].status, \"error querying model range\");\n\n return results.filter((x) => x.status === IModelStatus.Success).map((x) => x.extents);\n }\n\n public async queryModelExtents(tokenProps: IModelRpcProps, modelIds: Id64String[]): Promise<ModelExtentsProps[]> {\n const iModel = await getIModelForRpc(tokenProps);\n return iModel.models.queryExtents(modelIds);\n }\n\n public async getModelProps(tokenProps: IModelRpcProps, modelIdsList: Id64String[]): Promise<ModelProps[]> {\n const modelIds = new Set(modelIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const modelJsonArray: ModelProps[] = [];\n for (const id of modelIds) {\n try {\n const modelProps = iModelDb.models.getModelProps(id);\n modelJsonArray.push(modelProps);\n } catch (error) {\n if (modelIds.size === 1)\n throw error; // if they're asking for more than one model, don't throw on error.\n }\n }\n return modelJsonArray;\n }\n\n public async queryModelProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ModelProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n return this.getModelProps(tokenProps, [...ids]);\n }\n\n public async getElementProps(tokenProps: IModelRpcProps, elementIdsList: Id64String[]): Promise<ElementProps[]> {\n const elementIds = new Set(elementIdsList);\n const iModelDb = await getIModelForRpc(tokenProps);\n const elementProps: ElementProps[] = [];\n for (const id of elementIds) {\n try {\n elementProps.push(iModelDb.elements.getElementProps({ id }));\n } catch (error) {\n if (elementIds.size === 1)\n throw error; // if they're asking for more than one element, don't throw on error.\n }\n }\n return elementProps;\n }\n\n public async loadElementProps(tokenProps: IModelRpcProps, identifier: Id64String | GuidString | CodeProps, options?: ElementLoadOptions): Promise<ElementProps | undefined> {\n const props: ElementLoadProps = options ? { ...options } : {};\n if (typeof identifier === \"string\") {\n if (Id64.isId64(identifier))\n props.id = identifier;\n else\n props.federationGuid = identifier;\n } else {\n props.code = Code.fromJSON(identifier);\n }\n\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.elements.tryGetElementProps(props);\n }\n\n public async getGeometrySummary(tokenProps: IModelRpcProps, request: GeometrySummaryRequestProps): Promise<string> {\n const iModel = await getIModelForRpc(tokenProps);\n return generateGeometrySummaries(request, iModel);\n }\n\n public async queryElementProps(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<ElementProps[]> {\n const ids = await this.queryEntityIds(tokenProps, params);\n const res = this.getElementProps(tokenProps, [...ids]);\n return res;\n }\n\n public async queryEntityIds(tokenProps: IModelRpcProps, params: EntityQueryParams): Promise<Id64String[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const res = iModelDb.queryEntityIds(params);\n return [...res];\n }\n\n public async getClassHierarchy(tokenProps: IModelRpcProps, classFullName: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const classArray: string[] = [];\n while (true) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const classMetaData: EntityMetaData = iModelDb.getMetaData(classFullName);\n classArray.push(classFullName);\n if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)\n break;\n\n classFullName = classMetaData.baseClasses[0];\n }\n return classArray;\n }\n\n public async getAllCodeSpecs(tokenProps: IModelRpcProps): Promise<any[]> {\n const codeSpecs: any[] = [];\n const iModelDb = await getIModelForRpc(tokenProps);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iModelDb.withPreparedStatement(\"SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec\", (statement) => {\n for (const row of statement)\n codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });\n });\n return codeSpecs;\n }\n\n public async getViewStateData(tokenProps: IModelRpcProps, viewDefinitionId: string, options?: ViewStateLoadProps): Promise<ViewStateProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.views.getViewStateProps(viewDefinitionId, options);\n }\n\n public async readFontJson(tokenProps: IModelRpcProps): Promise<FontMapProps> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb[_nativeDb].readFontMap();\n }\n\n public async requestSnap(tokenProps: IModelRpcProps, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.requestSnap(sessionId, props);\n }\n\n public async cancelSnap(tokenProps: IModelRpcProps, sessionId: string): Promise<void> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.cancelSnap(sessionId);\n }\n\n public async getGeometryContainment(tokenProps: IModelRpcProps, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeometryContainment(props);\n }\n\n public async getMassProperties(tokenProps: IModelRpcProps, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getMassProperties(props);\n }\n\n public async getMassPropertiesPerCandidate(tokenProps: IModelRpcProps, props: MassPropertiesPerCandidateRequestProps): Promise<MassPropertiesPerCandidateResponseProps[]> { // eslint-disable-line @typescript-eslint/no-deprecated\n const iModelDb = await getIModelForRpc(tokenProps);\n\n const getSingleCandidateMassProperties = async (candidate: string) => {\n try {\n const massPropResults: MassPropertiesResponseProps[] = [];\n\n for (const op of props.operations) {\n const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });\n massPropResults.push(massProperties);\n }\n\n let singleCandidateResult: MassPropertiesPerCandidateResponseProps = { status: BentleyStatus.ERROR, candidate }; // eslint-disable-line @typescript-eslint/no-deprecated\n\n if (massPropResults.some((r) => r.status !== BentleyStatus.ERROR)) {\n singleCandidateResult.status = BentleyStatus.SUCCESS;\n for (const r of massPropResults.filter((mpr) => mpr.status !== BentleyStatus.ERROR)) {\n singleCandidateResult = { ...singleCandidateResult, ...r };\n }\n }\n\n return singleCandidateResult;\n } catch {\n return { status: BentleyStatus.ERROR, candidate };\n }\n };\n\n const promises: Promise<MassPropertiesPerCandidateResponseProps>[] = []; // eslint-disable-line @typescript-eslint/no-deprecated\n\n for (const candidate of CompressedId64Set.iterable(props.candidates)) {\n promises.push(getSingleCandidateMassProperties(candidate));\n }\n\n return Promise.all(promises);\n }\n\n public async getToolTipMessage(tokenProps: IModelRpcProps, id: string): Promise<string[]> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const el = iModelDb.elements.getElement(id);\n return (el === undefined) ? [] : el.getToolTipMessage();\n }\n\n /** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.\n * @deprecated in 3.6.0 - might be removed in next major version. Use queryViewThumbnail instead\n */\n public async getViewThumbnail(tokenProps: IModelRpcProps, viewId: string): Promise<Uint8Array> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const thumbnail = iModelDb.views.getThumbnail(viewId);\n if (undefined === thumbnail || 0 === thumbnail.image.length)\n throw new NoContentError();\n\n const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size\n new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === \"jpeg\" ? ImageSourceFormat.Jpeg : ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.\n val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata\n return val;\n }\n\n public async getDefaultViewId(tokenProps: IModelRpcProps): Promise<Id64String> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const spec = { namespace: \"dgn_View\", name: \"DefaultView\" };\n const blob = iModelDb.queryFilePropertyBlob(spec);\n if (undefined === blob || 8 !== blob.length)\n return Id64.invalid;\n\n const view = new Uint32Array(blob.buffer);\n return Id64.fromUint32Pair(view[0], view[1]);\n }\n public async getSpatialCategoryId(tokenProps: IModelRpcProps, categoryName: string): Promise<Id64String | undefined> {\n const iModelDb = await getIModelForRpc(tokenProps);\n const dictionary: DictionaryModel = iModelDb.models.getModel<DictionaryModel>(IModel.dictionaryId);\n return SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);\n }\n\n public async getIModelCoordinatesFromGeoCoordinates(tokenProps: IModelRpcProps, props: IModelCoordinatesRequestProps): Promise<IModelCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);\n }\n\n public async getGeoCoordinatesFromIModelCoordinates(tokenProps: IModelRpcProps, props: GeoCoordinatesRequestProps): Promise<GeoCoordinatesResponseProps> {\n const iModelDb = await getIModelForRpc(tokenProps);\n return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);\n }\n\n public async queryTextureData(tokenProps: IModelRpcProps, textureLoadProps: TextureLoadProps): Promise<TextureData | undefined> {\n const db = await getIModelForRpc(tokenProps);\n return db.queryTextureData(textureLoadProps);\n }\n\n public async generateElementMeshes(tokenProps: IModelRpcProps, props: ElementMeshRequestProps): Promise<Uint8Array> {\n const db = await getIModelForRpc(tokenProps);\n return db[_nativeDb].generateElementMeshes(props);\n }\n\n /** @internal */\n public async callViewStore(tokenProps: IModelRpcProps, version: string, forWrite: boolean, methodName: string, ...args: any[]): Promise<any> {\n if (!RpcInterface.isVersionCompatible(ViewStoreRpc.version, version))\n throw new Error(\"ViewStoreRpc version mismatch\");\n\n const db = await getIModelForRpc(tokenProps);\n const viewStore = await db.views.accessViewStore({ accessLevel: forWrite ? \"write\" : \"read\" });\n const access = viewStore[forWrite ? \"writeLocker\" : \"reader\"] as any;\n\n const func = access[methodName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Illegal ViewStore RPC call \"${methodName}\"`);\n\n return func.call(access, ...args);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelTileRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelTileRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA0OH,8DAaC;AArPD,sDAAyF;AACzF,oDAA2P;AAE3P,oEAAiE;AACjE,0CAAuC;AACvC,8CAA2C;AAC3C,wDAAuE;AACvE,4CAA0C;AAC1C,+DAA4D;AAC5D,+DAA0D;AAC1D,iDAAgD;AAQhD,SAAS,sBAAsB,CAAC,KAAuB;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAC/B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,SAAS,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D,8CA6CC;AAED,gBAAgB;AACT,KAAK,UAAU,yBAAyB,CAAC,UAA0B,EAAE,UAAgC;IAC1G,MAAM,MAAM,GAAG,mBAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,KAAK,GAA4B,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAEjF,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACzC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YAC5B,0BAA0B,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,CAAC,mBAAS,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC","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 RpcInterface\r\n */\r\n\r\nimport { AccessToken, assert, BeDuration, Id64Array, Logger } from \"@itwin/core-bentley\";\r\nimport { ElementGraphicsRequestProps, IModelRpcProps, IModelTileRpcInterface, IModelTileTreeProps, RpcInterface, RpcManager, RpcPendingResponse, TileContentIdentifier, TileContentSource, TileTreeContentIds, TileVersionInfo } from \"@itwin/core-common\";\r\nimport type { Metadata, TransferConfig } from \"@itwin/object-storage-core\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { IModelDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { PromiseMemoizer, QueryablePromise } from \"../PromiseMemoizer\";\r\nimport { RpcTrace } from \"../rpc/tracing\";\r\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\r\nimport { IModelNative } from \"../internal/NativePlatform\";\r\nimport { _nativeDb } from \"../internal/Symbols\";\r\n\r\ninterface TileRequestProps {\r\n accessToken?: AccessToken;\r\n tokenProps: IModelRpcProps;\r\n treeId: string;\r\n}\r\n\r\nfunction generateTileRequestKey(props: TileRequestProps): string {\r\n const token = props.tokenProps;\r\n return `${JSON.stringify({\r\n key: token.key,\r\n iTwinId: token.iTwinId,\r\n iModelId: token.iModelId,\r\n changesetId: token.changeset?.id,\r\n })}:${props.treeId}`;\r\n}\r\n\r\nabstract class TileRequestMemoizer<Result, Props extends TileRequestProps> extends PromiseMemoizer<Result> {\r\n private readonly _loggerCategory = BackendLoggerCategory.IModelTileRequestRpc;\r\n protected abstract get _operationName(): string;\r\n protected abstract addMetadata(metadata: any, props: Props): void;\r\n protected abstract stringify(props: Props): string;\r\n protected abstract get _timeoutMilliseconds(): number;\r\n\r\n private makeMetadata(props: Props): any {\r\n const meta = { ...props.tokenProps };\r\n this.addMetadata(meta, props);\r\n return meta;\r\n }\r\n\r\n protected constructor(memoizeFn: (props: Props) => Promise<Result>, generateKeyFn: (props: Props) => string) {\r\n super(memoizeFn, generateKeyFn);\r\n }\r\n\r\n public override memoize(props: Props): QueryablePromise<Result> {\r\n return super.memoize(props);\r\n }\r\n\r\n public override deleteMemoized(props: Props) {\r\n super.deleteMemoized(props);\r\n }\r\n\r\n private log(status: string, props: Props): void {\r\n const descr = `${this._operationName}(${this.stringify(props)})`;\r\n Logger.logTrace(this._loggerCategory, `Backend ${status} ${descr}`, () => this.makeMetadata(props));\r\n }\r\n\r\n protected async perform(props: Props): Promise<Result> {\r\n this.log(\"received\", props);\r\n\r\n const tileQP = this.memoize(props);\r\n\r\n await BeDuration.race(this._timeoutMilliseconds, tileQP.promise).catch(() => { });\r\n // Note: Rejections must be caught so that the memoization entry can be deleted\r\n\r\n if (tileQP.isPending) {\r\n this.log(\"issuing pending status for\", props);\r\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\r\n }\r\n\r\n this.deleteMemoized(props);\r\n\r\n if (tileQP.isFulfilled) {\r\n this.log(\"completed\", props);\r\n assert(undefined !== tileQP.result);\r\n return tileQP.result;\r\n }\r\n\r\n assert(tileQP.isRejected);\r\n this.log(\"rejected\", props);\r\n throw tileQP.error;\r\n }\r\n}\r\n\r\nasync function getTileTreeProps(props: TileRequestProps): Promise<IModelTileTreeProps> {\r\n assert(undefined !== props.accessToken);\r\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\r\n return db.tiles.requestTileTreeProps(props.treeId);\r\n}\r\n\r\nclass RequestTileTreePropsMemoizer extends TileRequestMemoizer<IModelTileTreeProps, TileRequestProps> {\r\n protected get _timeoutMilliseconds() { return IModelHost.tileTreeRequestTimeout; }\r\n protected get _operationName() { return \"requestTileTreeProps\"; }\r\n protected stringify(props: TileRequestProps): string { return props.treeId; }\r\n protected addMetadata(meta: any, props: TileRequestProps): void {\r\n meta.treeId = props.treeId;\r\n }\r\n\r\n private static _instance?: RequestTileTreePropsMemoizer;\r\n\r\n private constructor() {\r\n super(getTileTreeProps, generateTileRequestKey);\r\n IModelHost.onBeforeShutdown.addOnce(() => {\r\n this[Symbol.dispose]();\r\n RequestTileTreePropsMemoizer._instance = undefined;\r\n });\r\n }\r\n\r\n public static async perform(props: TileRequestProps): Promise<IModelTileTreeProps> {\r\n if (undefined === this._instance)\r\n this._instance = new RequestTileTreePropsMemoizer();\r\n\r\n return this._instance.perform(props);\r\n }\r\n}\r\n\r\ninterface TileContentRequestProps extends TileRequestProps {\r\n contentId: string;\r\n guid?: string;\r\n}\r\n\r\nasync function getTileContent(props: TileContentRequestProps): Promise<TileContentSource> {\r\n assert(undefined !== props.accessToken);\r\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\r\n const tile = await db.tiles.requestTileContent(props.treeId, props.contentId);\r\n\r\n // ###TODO: Verify the guid supplied by the front-end matches the guid stored in the model?\r\n if (IModelHost.usingExternalTileCache) {\r\n const tileMetadata: Metadata = {\r\n backendName: IModelHost.applicationId,\r\n tileGenerationTime: tile.elapsedSeconds.toString(),\r\n tileSize: tile.content.byteLength.toString(),\r\n };\r\n await IModelHost.tileStorage?.uploadTile(props.tokenProps.iModelId ?? db.iModelId, props.tokenProps.changeset?.id ?? db.changeset.id, props.treeId, props.contentId, tile.content, props.guid, tileMetadata);\r\n const { accessToken: _, ...safeProps } = props;\r\n Logger.logInfo(BackendLoggerCategory.IModelTileRequestRpc, \"Generated and uploaded tile\", { tileMetadata, ...safeProps });\r\n\r\n return TileContentSource.ExternalCache;\r\n }\r\n\r\n return TileContentSource.Backend;\r\n}\r\n\r\nfunction generateTileContentKey(props: TileContentRequestProps): string {\r\n return `${generateTileRequestKey(props)}:${props.contentId}`;\r\n}\r\n\r\nclass RequestTileContentMemoizer extends TileRequestMemoizer<TileContentSource, TileContentRequestProps> {\r\n protected get _timeoutMilliseconds() { return IModelHost.tileContentRequestTimeout; }\r\n protected get _operationName() { return \"requestTileContent\"; }\r\n protected stringify(props: TileContentRequestProps): string { return `${props.treeId}:${props.contentId}`; }\r\n protected addMetadata(meta: any, props: TileContentRequestProps): void {\r\n meta.treeId = props.treeId;\r\n meta.contentId = props.contentId;\r\n }\r\n\r\n private static _instance?: RequestTileContentMemoizer;\r\n\r\n private constructor() {\r\n super(getTileContent, generateTileContentKey);\r\n IModelHost.onBeforeShutdown.addOnce(() => {\r\n this[Symbol.dispose]();\r\n RequestTileContentMemoizer._instance = undefined;\r\n });\r\n }\r\n\r\n public static get instance() {\r\n if (undefined === this._instance)\r\n this._instance = new RequestTileContentMemoizer();\r\n\r\n return this._instance;\r\n }\r\n\r\n public static async perform(props: TileContentRequestProps): Promise<TileContentSource> {\r\n return this.instance.perform(props);\r\n }\r\n}\r\n\r\nfunction currentActivity() {\r\n return RpcTrace.expectCurrentActivity;\r\n}\r\n\r\n/** @internal */\r\nexport class IModelTileRpcImpl extends RpcInterface implements IModelTileRpcInterface {\r\n public static register() { RpcManager.registerImpl(IModelTileRpcInterface, IModelTileRpcImpl); }\r\n\r\n public async requestTileTreeProps(tokenProps: IModelRpcProps, treeId: string): Promise<IModelTileTreeProps> {\r\n return RequestTileTreePropsMemoizer.perform({ accessToken: currentActivity().accessToken, tokenProps, treeId });\r\n }\r\n\r\n public async purgeTileTrees(tokenProps: IModelRpcProps, modelIds: Id64Array | undefined): Promise<void> {\r\n // `undefined` gets forwarded as `null`...\r\n if (null === modelIds)\r\n modelIds = undefined;\r\n\r\n const db = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);\r\n if (!db.isOpen) {\r\n return;\r\n }\r\n\r\n return db[_nativeDb].purgeTileTrees(modelIds);\r\n }\r\n\r\n public async generateTileContent(tokenProps: IModelRpcProps, treeId: string, contentId: string, guid: string | undefined): Promise<TileContentSource> {\r\n return RequestTileContentMemoizer.perform({ accessToken: currentActivity().accessToken, tokenProps, treeId, contentId, guid });\r\n }\r\n\r\n public async retrieveTileContent(tokenProps: IModelRpcProps, key: TileContentIdentifier): Promise<Uint8Array> {\r\n const db = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);\r\n return db.tiles.getTileContent(key.treeId, key.contentId);\r\n }\r\n\r\n public async getTileCacheConfig(tokenProps: IModelRpcProps): Promise<TransferConfig | undefined> {\r\n if (IModelHost.tileStorage === undefined)\r\n return undefined;\r\n const iModelId = tokenProps.iModelId ?? (await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps)).iModelId;\r\n return IModelHost.tileStorage.getDownloadConfig(iModelId);\r\n }\r\n\r\n public async queryVersionInfo(): Promise<TileVersionInfo> {\r\n return IModelNative.platform.getTileVersionInfo();\r\n }\r\n\r\n /** @internal */\r\n public async requestElementGraphics(rpcProps: IModelRpcProps, request: ElementGraphicsRequestProps): Promise<Uint8Array | undefined> {\r\n const iModel = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, rpcProps);\r\n return iModel.generateElementGraphics(request);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport async function cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\r\n const iModel = IModelDb.findByKey(tokenProps.key);\r\n const props: TileContentRequestProps = { tokenProps, treeId: \"\", contentId: \"\" };\r\n\r\n for (const entry of contentIds) {\r\n props.treeId = entry.treeId;\r\n for (const contentId of entry.contentIds) {\r\n props.contentId = contentId;\r\n RequestTileContentMemoizer.instance.deleteMemoized(props);\r\n }\r\n\r\n iModel[_nativeDb].cancelTileContentRequests(entry.treeId, entry.contentIds);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IModelTileRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/IModelTileRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA0OH,8DAaC;AArPD,sDAAyF;AACzF,oDAA2P;AAE3P,oEAAiE;AACjE,0CAAuC;AACvC,8CAA2C;AAC3C,wDAAuE;AACvE,4CAA0C;AAC1C,+DAA4D;AAC5D,+DAA0D;AAC1D,iDAAgD;AAQhD,SAAS,sBAAsB,CAAC,KAAuB;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAC/B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,SAAS,EAAE,EAAE;KACjC,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;AACvB,CAAC;AAED,MAAe,mBAA4D,SAAQ,iCAAuB;IACvF,eAAe,GAAG,6CAAqB,CAAC,oBAAoB,CAAC;IAMtE,YAAY,CAAC,KAAY;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4B,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAEjF,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACzC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;YAC5B,0BAA0B,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,CAAC,mBAAS,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, Id64Array, Logger } from \"@itwin/core-bentley\";\nimport { ElementGraphicsRequestProps, IModelRpcProps, IModelTileRpcInterface, IModelTileTreeProps, RpcInterface, RpcManager, RpcPendingResponse, TileContentIdentifier, TileContentSource, TileTreeContentIds, TileVersionInfo } from \"@itwin/core-common\";\nimport type { Metadata, TransferConfig } from \"@itwin/object-storage-core\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { IModelDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { PromiseMemoizer, QueryablePromise } from \"../PromiseMemoizer\";\nimport { RpcTrace } from \"../rpc/tracing\";\nimport { RpcBriefcaseUtility } from \"./RpcBriefcaseUtility\";\nimport { IModelNative } from \"../internal/NativePlatform\";\nimport { _nativeDb } from \"../internal/Symbols\";\n\ninterface TileRequestProps {\n accessToken?: AccessToken;\n tokenProps: IModelRpcProps;\n treeId: string;\n}\n\nfunction generateTileRequestKey(props: TileRequestProps): string {\n const token = props.tokenProps;\n return `${JSON.stringify({\n key: token.key,\n iTwinId: token.iTwinId,\n iModelId: token.iModelId,\n changesetId: token.changeset?.id,\n })}:${props.treeId}`;\n}\n\nabstract class TileRequestMemoizer<Result, Props extends TileRequestProps> extends PromiseMemoizer<Result> {\n private readonly _loggerCategory = BackendLoggerCategory.IModelTileRequestRpc;\n protected abstract get _operationName(): string;\n protected abstract addMetadata(metadata: any, props: Props): void;\n protected abstract stringify(props: Props): string;\n protected abstract get _timeoutMilliseconds(): number;\n\n private makeMetadata(props: Props): any {\n const meta = { ...props.tokenProps };\n this.addMetadata(meta, props);\n return meta;\n }\n\n protected constructor(memoizeFn: (props: Props) => Promise<Result>, generateKeyFn: (props: Props) => string) {\n super(memoizeFn, generateKeyFn);\n }\n\n public override memoize(props: Props): QueryablePromise<Result> {\n return super.memoize(props);\n }\n\n public override deleteMemoized(props: Props) {\n super.deleteMemoized(props);\n }\n\n private log(status: string, props: Props): void {\n const descr = `${this._operationName}(${this.stringify(props)})`;\n Logger.logTrace(this._loggerCategory, `Backend ${status} ${descr}`, () => this.makeMetadata(props));\n }\n\n protected async perform(props: Props): Promise<Result> {\n this.log(\"received\", props);\n\n const tileQP = this.memoize(props);\n\n await BeDuration.race(this._timeoutMilliseconds, tileQP.promise).catch(() => { });\n // Note: Rejections must be caught so that the memoization entry can be deleted\n\n if (tileQP.isPending) {\n this.log(\"issuing pending status for\", props);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n this.deleteMemoized(props);\n\n if (tileQP.isFulfilled) {\n this.log(\"completed\", props);\n assert(undefined !== tileQP.result);\n return tileQP.result;\n }\n\n assert(tileQP.isRejected);\n this.log(\"rejected\", props);\n throw tileQP.error;\n }\n}\n\nasync function getTileTreeProps(props: TileRequestProps): Promise<IModelTileTreeProps> {\n assert(undefined !== props.accessToken);\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n return db.tiles.requestTileTreeProps(props.treeId);\n}\n\nclass RequestTileTreePropsMemoizer extends TileRequestMemoizer<IModelTileTreeProps, TileRequestProps> {\n protected get _timeoutMilliseconds() { return IModelHost.tileTreeRequestTimeout; }\n protected get _operationName() { return \"requestTileTreeProps\"; }\n protected stringify(props: TileRequestProps): string { return props.treeId; }\n protected addMetadata(meta: any, props: TileRequestProps): void {\n meta.treeId = props.treeId;\n }\n\n private static _instance?: RequestTileTreePropsMemoizer;\n\n private constructor() {\n super(getTileTreeProps, generateTileRequestKey);\n IModelHost.onBeforeShutdown.addOnce(() => {\n this[Symbol.dispose]();\n RequestTileTreePropsMemoizer._instance = undefined;\n });\n }\n\n public static async perform(props: TileRequestProps): Promise<IModelTileTreeProps> {\n if (undefined === this._instance)\n this._instance = new RequestTileTreePropsMemoizer();\n\n return this._instance.perform(props);\n }\n}\n\ninterface TileContentRequestProps extends TileRequestProps {\n contentId: string;\n guid?: string;\n}\n\nasync function getTileContent(props: TileContentRequestProps): Promise<TileContentSource> {\n assert(undefined !== props.accessToken);\n const db = await RpcBriefcaseUtility.findOpenIModel(props.accessToken, props.tokenProps);\n const tile = await db.tiles.requestTileContent(props.treeId, props.contentId);\n\n // ###TODO: Verify the guid supplied by the front-end matches the guid stored in the model?\n if (IModelHost.usingExternalTileCache) {\n const tileMetadata: Metadata = {\n backendName: IModelHost.applicationId,\n tileGenerationTime: tile.elapsedSeconds.toString(),\n tileSize: tile.content.byteLength.toString(),\n };\n await IModelHost.tileStorage?.uploadTile(props.tokenProps.iModelId ?? db.iModelId, props.tokenProps.changeset?.id ?? db.changeset.id, props.treeId, props.contentId, tile.content, props.guid, tileMetadata);\n const { accessToken: _, ...safeProps } = props;\n Logger.logInfo(BackendLoggerCategory.IModelTileRequestRpc, \"Generated and uploaded tile\", { tileMetadata, ...safeProps });\n\n return TileContentSource.ExternalCache;\n }\n\n return TileContentSource.Backend;\n}\n\nfunction generateTileContentKey(props: TileContentRequestProps): string {\n return `${generateTileRequestKey(props)}:${props.contentId}`;\n}\n\nclass RequestTileContentMemoizer extends TileRequestMemoizer<TileContentSource, TileContentRequestProps> {\n protected get _timeoutMilliseconds() { return IModelHost.tileContentRequestTimeout; }\n protected get _operationName() { return \"requestTileContent\"; }\n protected stringify(props: TileContentRequestProps): string { return `${props.treeId}:${props.contentId}`; }\n protected addMetadata(meta: any, props: TileContentRequestProps): void {\n meta.treeId = props.treeId;\n meta.contentId = props.contentId;\n }\n\n private static _instance?: RequestTileContentMemoizer;\n\n private constructor() {\n super(getTileContent, generateTileContentKey);\n IModelHost.onBeforeShutdown.addOnce(() => {\n this[Symbol.dispose]();\n RequestTileContentMemoizer._instance = undefined;\n });\n }\n\n public static get instance() {\n if (undefined === this._instance)\n this._instance = new RequestTileContentMemoizer();\n\n return this._instance;\n }\n\n public static async perform(props: TileContentRequestProps): Promise<TileContentSource> {\n return this.instance.perform(props);\n }\n}\n\nfunction currentActivity() {\n return RpcTrace.expectCurrentActivity;\n}\n\n/** @internal */\nexport class IModelTileRpcImpl extends RpcInterface implements IModelTileRpcInterface {\n public static register() { RpcManager.registerImpl(IModelTileRpcInterface, IModelTileRpcImpl); }\n\n public async requestTileTreeProps(tokenProps: IModelRpcProps, treeId: string): Promise<IModelTileTreeProps> {\n return RequestTileTreePropsMemoizer.perform({ accessToken: currentActivity().accessToken, tokenProps, treeId });\n }\n\n public async purgeTileTrees(tokenProps: IModelRpcProps, modelIds: Id64Array | undefined): Promise<void> {\n // `undefined` gets forwarded as `null`...\n if (null === modelIds)\n modelIds = undefined;\n\n const db = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);\n if (!db.isOpen) {\n return;\n }\n\n return db[_nativeDb].purgeTileTrees(modelIds);\n }\n\n public async generateTileContent(tokenProps: IModelRpcProps, treeId: string, contentId: string, guid: string | undefined): Promise<TileContentSource> {\n return RequestTileContentMemoizer.perform({ accessToken: currentActivity().accessToken, tokenProps, treeId, contentId, guid });\n }\n\n public async retrieveTileContent(tokenProps: IModelRpcProps, key: TileContentIdentifier): Promise<Uint8Array> {\n const db = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps);\n return db.tiles.getTileContent(key.treeId, key.contentId);\n }\n\n public async getTileCacheConfig(tokenProps: IModelRpcProps): Promise<TransferConfig | undefined> {\n if (IModelHost.tileStorage === undefined)\n return undefined;\n const iModelId = tokenProps.iModelId ?? (await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, tokenProps)).iModelId;\n return IModelHost.tileStorage.getDownloadConfig(iModelId);\n }\n\n public async queryVersionInfo(): Promise<TileVersionInfo> {\n return IModelNative.platform.getTileVersionInfo();\n }\n\n /** @internal */\n public async requestElementGraphics(rpcProps: IModelRpcProps, request: ElementGraphicsRequestProps): Promise<Uint8Array | undefined> {\n const iModel = await RpcBriefcaseUtility.findOpenIModel(currentActivity().accessToken, rpcProps);\n return iModel.generateElementGraphics(request);\n }\n}\n\n/** @internal */\nexport async function cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n const iModel = IModelDb.findByKey(tokenProps.key);\n const props: TileContentRequestProps = { tokenProps, treeId: \"\", contentId: \"\" };\n\n for (const entry of contentIds) {\n props.treeId = entry.treeId;\n for (const contentId of entry.contentIds) {\n props.contentId = contentId;\n RequestTileContentMemoizer.instance.deleteMemoized(props);\n }\n\n iModel[_nativeDb].cancelTileContentRequests(entry.treeId, entry.contentIds);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA4F;AAC5F,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAAyD;AACzD,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAC3C,iDAAiD;AAEjD,MAAM,c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,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC;QAEF,wBAAwB;QACxB,IAAI,EAAqB,CAAC;QAC1B,mCAAmC;QACnC,EAAE,GAAG,qBAAU,CAAC,YAAY,CAAC,qCAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,EAAE,CAAC;YACP,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,EAAE,UAAU,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAOM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA3JH,kDA6JC","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 RpcInterface\r\n */\r\n\r\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\r\n} from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\r\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\r\nimport { CheckpointManager } from \"../CheckpointManager\";\r\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\r\nimport { IModelHost } from \"../IModelHost\";\r\nimport { IModelJsFs } from \"../IModelJsFs\";\r\nimport { _hubAccess } from \"../internal/Symbols\";\r\n\r\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\r\n\r\n/** @internal */\r\nexport interface DownloadAndOpenArgs {\r\n activity: RpcActivity;\r\n tokenProps: IModelRpcOpenProps;\r\n syncMode: SyncMode;\r\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\r\n timeout?: number;\r\n forceDownload?: boolean;\r\n}\r\n/**\r\n * Utility to open the iModel for RPC interfaces\r\n * @internal\r\n */\r\nexport class RpcBriefcaseUtility {\r\n\r\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n const { activity, tokenProps } = args;\r\n const accessToken = activity.accessToken;\r\n assert(undefined !== tokenProps.iModelId);\r\n\r\n const iModelId = tokenProps.iModelId;\r\n let myBriefcaseIds: number[];\r\n if (args.syncMode === SyncMode.PullOnly) {\r\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\r\n } else {\r\n // check with iModelHub and see if we already have acquired any briefcaseIds\r\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\r\n }\r\n\r\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\r\n\r\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\r\n if (resolvers) {\r\n for (const resolver of resolvers) {\r\n for (const briefcaseId of myBriefcaseIds) {\r\n const fileName = resolver({ briefcaseId, iModelId });\r\n if (IModelJsFs.existsSync(fileName)) {\r\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\r\n if (briefcaseDb !== undefined) {\r\n if (briefcaseDb.isBriefcaseDb()) {\r\n return briefcaseDb;\r\n } else {\r\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\r\n }\r\n }\r\n try {\r\n if (args.forceDownload)\r\n throw new Error(); // causes delete below\r\n const db = await BriefcaseDb.open({ fileName });\r\n if (db.changeset.id !== tokenProps.changeset?.id) {\r\n assert(undefined !== tokenProps.changeset);\r\n const toIndex = tokenProps.changeset?.index ??\r\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\r\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\r\n }\r\n return db;\r\n } catch (error: any) {\r\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\r\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\r\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // no local briefcase available. Download one and open it.\r\n assert(undefined !== tokenProps.iTwinId);\r\n const request: RequestNewBriefcaseArg = {\r\n accessToken,\r\n iTwinId: tokenProps.iTwinId,\r\n iModelId,\r\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\r\n };\r\n\r\n const props = await BriefcaseManager.downloadBriefcase(request);\r\n return BriefcaseDb.open(props);\r\n }\r\n\r\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\r\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\r\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\r\n const cachedPromise = this._briefcasePromises.get(key);\r\n if (cachedPromise)\r\n return cachedPromise;\r\n\r\n try {\r\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\r\n this._briefcasePromises.set(key, briefcasePromise);\r\n return await briefcasePromise;\r\n } finally {\r\n this._briefcasePromises.delete(key); // the download and open is now done\r\n }\r\n }\r\n\r\n /** find a previously opened iModel for RPC.\r\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\r\n * to refresh the daemon, even though it will be used for all authorized users.\r\n * @param the IModelRpcProps to locate the opened iModel.\r\n */\r\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\r\n const iModelDb = IModelDb.findByKey(iModel.key);\r\n\r\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\r\n await iModelDb.refreshContainerForRpc(accessToken);\r\n return iModelDb;\r\n }\r\n\r\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\r\n /**\r\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\r\n */\r\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\r\n /**\r\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\r\n * a RpcPendingResponse exception is thrown\r\n */\r\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\r\n const { activity, tokenProps, syncMode } = args;\r\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\r\n\r\n const timeout = args.timeout ?? 1000;\r\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\r\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\r\n\r\n if (briefcaseDb === undefined) {\r\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\r\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\r\n }\r\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\r\n return briefcaseDb;\r\n }\r\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\r\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\r\n\r\n const checkpoint = {\r\n iModelId: tokenProps.iModelId,\r\n iTwinId: tokenProps.iTwinId,\r\n changeset: tokenProps.changeset,\r\n accessToken: activity.accessToken,\r\n };\r\n\r\n // opening a checkpoint.\r\n let db: SnapshotDb | void;\r\n // first check if it's already open\r\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\r\n if (db) {\r\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\r\n return db;\r\n }\r\n\r\n // now try V2 checkpoint\r\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\r\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\r\n\r\n return db;\r\n }\r\n\r\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\r\n /**\r\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\r\n */\r\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\r\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\r\n if (tokenProps.iModelId)\r\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl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OAAO,IAAI,CAAC,UAAU,CAAC,SAAS;YACtE,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAElE,MAAM,UAAU,GAAG;YACjB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;SAClC,CAAC;QAEF,wBAAwB;QACxB,IAAI,EAAqB,CAAC;QAC1B,mCAAmC;QACnC,EAAE,GAAG,qBAAU,CAAC,YAAY,CAAC,qCAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,EAAE,CAAC;YACP,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,EAAE,UAAU,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,wBAAwB;QACxB,EAAE,GAAG,MAAM,qBAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,EAAE,CAAC;IACZ,CAAC;IAOM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,4DAA4D;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA3JH,kDA6JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport { AccessToken, assert, BeDuration, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\nimport { _hubAccess } from \"../internal/Symbols\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity;\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost[_hubAccess].getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined) {\n if (briefcaseDb.isBriefcaseDb()) {\n return briefcaseDb;\n } else {\n throw new IModelError(IModelStatus.AlreadyOpen, \"iModel is already open as a SnapshotDb\");\n }\n }\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost[_hubAccess].getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - will not be removed until after 2026-06-13. Only `SyncMode.FixedVersion` should be used in RPC backends\n */\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> {\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModelRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAE4B;AAC5B,0CAAyC;AACzC,8CAA2C;AAE3C,qDAAqD;AAErD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,0BAAY;IAC9C,MAAM,CAAC,QAAQ,KAAK,wBAAU,CAAC,YAAY,CAAC,wCAA0B,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAExG,kGAAkG;IAC3F,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,IAA0B;QAChE,IAAI,gBAAgB,GAAuB,QAAQ,CAAC;QACpD,IAAI,uBAAU,CAAC,wBAAwB,EAAE,CAAC;YACxC,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACpF,IAAI,SAAS,KAAK,gBAAgB;gBAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAClG,CAAC;QACD,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC1E,CAAC;IAED,4FAA4F;IACrF,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,IAA0B;QACjE,MAAM,gBAAgB,GAAG,uBAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,SAAS,KAAK,gBAAgB;YAChC,MAAM,IAAI,oCAAsB,EAAE,CAAC,CAAC,0DAA0D;QAEhG,OAAO,qBAAU,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC/F,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,KAAK,CAAC,UAA0B;QAC3C,qBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA5BD,sDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SnapshotIModelRpcImpl.js","sourceRoot":"","sources":["../../../src/rpc-impl/SnapshotIModelRpcImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module RpcInterface\n */\n\nimport {\n IModelConnectionProps, IModelNotFoundResponse, IModelRpcProps, RpcInterface, RpcManager, SnapshotIModelRpcInterface, SnapshotOpenOptions,\n} from \"@itwin/core-common\";\nimport { SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** The backend implementation of SnapshotIModelRpcInterface.\n * @internal\n * @deprecated in 5.0 - will not be removed until after 2026-06-13. Check [[IpcAppFunctions]] for replacements.\n */\nexport class SnapshotIModelRpcImpl extends RpcInterface implements SnapshotIModelRpcInterface {\n public static register() { RpcManager.registerImpl(SnapshotIModelRpcInterface, SnapshotIModelRpcImpl); }\n\n /** Ask the backend to open a snapshot iModel from a file name that is resolved by the backend. */\n public async openFile(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) {\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n\n /** Ask the backend to open a snapshot iModel from a key that is resolved by the backend. */\n public async openRemote(fileKey: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n const resolvedFileName = IModelHost.snapshotFileNameResolver?.resolveKey(fileKey);\n if (undefined === resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n\n return SnapshotDb.openFile(resolvedFileName, { key: fileKey, ...opts }).getConnectionProps();\n }\n\n /** Ask the backend to close a snapshot iModel. */\n public async close(tokenProps: IModelRpcProps): Promise<boolean> {\n SnapshotDb.findByKey(tokenProps.key).close();\n return true;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../../src/workspace/Settings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAKH,iDAAgE;AAQhE,YAAY;AACZ,IAAiB,OAAO,CA+DvB;AA/DD,WAAiB,OAAO;IACtB,2CAA2C;IAC3C,SAAgB,KAAK,CAAoB,OAAU;QACjD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;YACzC,OAAO,OAAO,CAAC;QAEjB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAS,CAAC;QACvD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAE,OAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1F,OAAO,MAAM,CAAC;IAChB,CAAC;IAPe,aAAK,QAOpB,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,QAAQ,CAAC,CAAsB,EAAE,CAAsB;QACrE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACd,CAAC;QAED,qCAAqC;QACrC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAA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AgB,CAahC;AAbD,WAAiB,gBAAgB;IAC/B,yGAAyG;IAC5F,yBAAQ,GAAG,GAAG,CAAC;IAC5B,sDAAsD;IACzC,4BAAW,GAAG,GAAG,CAAC;IAC/B,6DAA6D;IAChD,6BAAY,GAAG,GAAG,CAAC;IAChC,sDAAsD;IACzC,sBAAK,GAAG,GAAG,CAAC;IACzB,wDAAwD;IAC3C,uBAAM,GAAG,GAAG,CAAC;IAC1B,gDAAgD;IACnC,uBAAM,GAAG,GAAG,CAAC;AAC5B,CAAC,EAbgB,gBAAgB,gCAAhB,gBAAgB,QAahC","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 Workspace\r\n */\r\n\r\nimport { BeEvent, JSONSchemaType } from \"@itwin/core-bentley\";\r\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\r\nimport { WorkspaceDb } from \"./Workspace\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\n\r\n/** The value of a single named parameter within a [[Workspace.settings]] that configures some aspect of the applications run-time behavior.\r\n * Settings are stored in a [[SettingsDictionary]]. A setting is described by its [[SettingSchema]].\r\n * @beta\r\n */\r\nexport type Setting = JSONSchemaType;\r\n\r\n/** @beta */\r\nexport namespace Setting { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Create a deep copy of a [[Setting]]. */\r\n export function clone<T extends Setting>(setting: T): T {\r\n if (!setting || typeof setting !== \"object\")\r\n return setting;\r\n\r\n const result = Array.isArray(setting) ? [] : {} as any;\r\n Object.keys(setting).forEach((key: string) => result[key] = clone((setting as any)[key]));\r\n return result;\r\n }\r\n\r\n /** Returns true if `a` and `b` are considered equivalent [[Setting]] values.\r\n * Settings of primitive types like `number` and `string` are compared using `===`.\r\n * Settings of type \"object\" are compared by comparing each property using `areEqual`; the objects are considered\r\n * equal if they have the exact same set of property names with equivalent values.\r\n * Settings of type \"array\" are compared by comparing each element of the arrays use `areEqual`; the arrays are considered\r\n * equal if they have the same number of elements with equivalent values in the same exact order.\r\n */\r\n export function areEqual(a: Setting | undefined, b: Setting | undefined): boolean {\r\n if (a === b) {\r\n return true;\r\n }\r\n\r\n // For primitive types, === suffices.\r\n if (typeof a !== \"object\" || typeof b !== \"object\") {\r\n return false;\r\n }\r\n\r\n if (Array.isArray(a) || Array.isArray(b)) {\r\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < a.length; i++) {\r\n if (!areEqual(a[i], b[i])) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n const aKeys = Object.keys(a);\r\n const bKeys = Object.keys(b);\r\n if (aKeys.length !== bKeys.length) {\r\n return false;\r\n }\r\n\r\n aKeys.sort();\r\n bKeys.sort();\r\n for (let i = 0; i < aKeys.length; i++) {\r\n const key = aKeys[i];\r\n if (key !== bKeys[i]) {\r\n return false;\r\n }\r\n\r\n if (!areEqual((a as SettingsContainer)[key], (b as SettingsContainer)[key])) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n\r\n/**\r\n * The name of a [[Setting]].\r\n * Setting names must be [valid JavaScript property names](https://developer.mozilla.org/en-US/docs/Glossary/property/JavaScript) containing no spaces or periods.\r\n * The name of a setting begins with the schema prefix of the [[SettingGroupSchema]] in which its [[SettingSchema]] is defined.\r\n * A setting name therefore forms a path like file names in a file system.\r\n * For example, the following are setting names defined in the `energyAnalysis`, `iot-scan-visualization`, and `vibration-map` schemas.\r\n *\r\n * ```ts\r\n * \"energyAnalysis/formats/totalWork\"\r\n * \"energyAnalysis/formats/totalHours\"\r\n * \"energyAnalysis/units/power\"\r\n * \"energyAnalysis/units/temperature\"\r\n * \"energyAnalysis/startupMode\"\r\n * \"iot-scan-visualization/ports/cameras\"\r\n * \"vibration-map/filters/scope\"\r\n * \"vibration-map/filters/prefabricated\"\r\n * ```\r\n *\r\n * @beta\r\n */\r\nexport type SettingName = string;\r\n\r\n/** An object that defines the values for any number of [[Setting]]s. Each of its properties' names must conform to the semantics of a [[SettingName]].\r\n * @beta\r\n */\r\nexport interface SettingsContainer {\r\n /** Accesses settings by their names. */\r\n [name: SettingName]: Setting | undefined;\r\n}\r\n\r\n/** Defines the precedence of a [[SettingsDictionary]].\r\n * [[Settings]] may contain multiple dictionaries containing different values for the same [[SettingName]].\r\n * When resolving the value of a [[Setting]], the value from the highest-priority dictionary is used.\r\n * Priorities are grouped into coarse categories like [[SettingsPriority.application]] and [[SettingsPriority.iModel]].\r\n * Settings with priorities less than or equal to [[SettingsPriority.application]] are stored in [[IModelHost.appWorkspace]], while\r\n * those with priorities higher than [[SettingsPriority.application]] are stored inside [[IModelDb.workspace]].\r\n * @beta\r\n */\r\nexport type SettingsPriority = number;\r\n\r\n/** @beta */\r\nexport namespace SettingsPriority { // eslint-disable-line @typescript-eslint/no-redeclare\r\n /** Settings that originate from default setting files loaded automatically at the start of a session. */\r\n export const defaults = 100;\r\n /** Settings supplied by an application at runtime. */\r\n export const application = 200;\r\n /** Settings that apply to all iTwins for an organization. */\r\n export const organization = 300;\r\n /** Settings that apply to all iModels in an iTwin. */\r\n export const iTwin = 400;\r\n /** Settings that apply to all branches of an iModel. */\r\n export const branch = 500;\r\n /** Settings that apply to a specific iModel. */\r\n export const iModel = 600;\r\n}\r\n\r\n/** A named container that supplies values for [[Setting]]s.\r\n * @see [[Settings.addDictionary]] to register a new settings dictionary.\r\n * @beta\r\n */\r\nexport interface SettingsDictionary {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /** Metadata describing the dictionary. */\r\n readonly props: SettingsDictionaryProps;\r\n\r\n /** Obtain a copy of the value of the setting named `settingName` stored in this dictionary, or `undefined` if no such setting exists.\r\n * The returned value is always cloned using [[Setting.clone]].\r\n * @note Generally, applications use methods like [[Settings.getString]] and [[Setting.getArray]] to resolve a setting value from multiple\r\n * dictionaries. Those methods - unlike this one - also validate that `settingName` is of type `T` as defined by its [[SettingSchema]].\r\n */\r\n getSetting<T extends Setting>(settingName: SettingName): T | undefined;\r\n\r\n /** Return a deep copy of all settings in this dictionary as a [[SettingsContainer]].\r\n * This is useful for inspecting the full contents of the dictionary or for building a modified copy\r\n * to pass to [[EditableSettingsDb.updateSettingsDictionary]].\r\n * The returned container is cloned using [[Setting.clone]], so callers may freely mutate it without\r\n * affecting this dictionary's internal state.\r\n * @beta\r\n */\r\n toJSON(): SettingsContainer;\r\n}\r\n\r\n/** Uniquely identifies a [[SettingsDictionary]].\r\n * @beta\r\n */\r\nexport interface SettingsDictionarySource {\r\n /** The name of the dictionary, which must be unique within its [[workspaceDb]], or - if [[workspaceDb]] is undefined - unique among all dictionaries not associated with any [[WorkspaceDb]]. */\r\n readonly name: string;\r\n /** The [[WorkspaceDb]] from which the dictionary originated. */\r\n readonly workspaceDb?: WorkspaceDb;\r\n}\r\n\r\n/** Properties of a [[SettingsDictionary]], defining its name, the [[WorkspaceDb]] (if any) from which it originated, and its [[priority]] relative to other dictionaries.\r\n * @beta\r\n */\r\nexport interface SettingsDictionaryProps extends SettingsDictionarySource {\r\n /** Precedence value determining which setting value to use when multiple dictionaries supply values for the same [[SettingName]]. */\r\n readonly priority: SettingsPriority;\r\n}\r\n\r\n/**\r\n * The collection of [[Setting]]s that supply the run-time configuration of a [[Workspace]].\r\n * The `Settings` object comprises a collection of named [[SettingsDictionary]] objects.\r\n * Methods like [[getSetting]], [[getString]], and [[getArray]] provide access to the value of an individual [[Setting]] by searching\r\n * the [[dictionaries]] in order by their [[SettingsPriority]] to find the highest-priority setting with the requested [[SettingName]].\r\n * Most methods that retrieve [[Setting]] values validate them against their [[SettingSchema]]s to ensure that they are of the correct type.\r\n * A [[SettingsDictionary]] can be added or removed using [[addDictionary]] and [[dropDictionary]].\r\n * Because [[Setting]]s can change at any time during the session, you should avoid caching their values wherever possible.\r\n * If you must cache them (for example, to display in a user interface), you should listen for the [[onSettingsChanged]] event to be\r\n * notified of potential changes.\r\n *\r\n * Settings are accessed via [[Workspace.settings]]. They are defined at the application level by [[IModelHost.appWorkspace]], but individual iModels may supply\r\n * additional iModel-specific settings or overrides for application-level settings. When working in the context of a specific iModel, use [[IModelDb.workspace]]'s `settings`\r\n * property. Any settings not overridden by the iModel will fall back to the settings defined in [[IModelHost.appWorkspace]].\r\n *\r\n * Application settings are loaded into [[IModelHost.appWorkspace]] when the session begins (i.e., when [[IModelHost.startup]] is invoked), and unloaded when it ends (in [[IModelHost.shutdown]]).\r\n * They are read from [JSON5](https://json5.org/) files delivered with the application. The application should register any additional [[SettingsDictionary]]'s '(and their corresponding\r\n * [[SettingGroupSchema]]s) at this time.\r\n *\r\n * iModel-specific settings are stored in the iModel's property table and loaded into [[IModelDb.workspace]] when the iModel is first opened.\r\n * You can add and remove a [[SettingsDictionary]] from the property table using [[IModelDb.saveSettingDictionary]] and [[IModelDb.deleteSettingDictionary]].\r\n *\r\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\r\n *\r\n * @see [[IModelHost.appWorkspace]] application-wide settings, and [[IModelDb.workspace]] for settings specific to a given iModel.\r\n * @beta\r\n */\r\nexport interface Settings {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /** @internal */\r\n close(): void;\r\n\r\n /** The set of settings dictionaries from which [[Setting]] values are obtained, sorted by [[SettingsPriority]].\r\n * The set can contain at most one dictionary for each unique combination of name and [[WorkspaceDb]].\r\n * @see [[addDictionary]], [[addFile]], [[addJson]], and [[addDirectory]] to add a new dictionary.\r\n * @see [[dropDictionary]] to remove a dictionary.\r\n * @see [[getDictionary]] to look up a dictionary.\r\n */\r\n readonly dictionaries: readonly SettingsDictionary[];\r\n\r\n /** Event raised whenever a [[SettingsDictionary]] is added or removed. */\r\n readonly onSettingsChanged: BeEvent<() => void>;\r\n\r\n /** Parses the contents of a local [JSON5](https://json5.org/) file as a [[SettingsContainer]] and invokes [[addDictionary]] to\r\n * add a [[SettingsDictionary]] named `fileName` with the specified priority.\r\n * @param fileName the name of a local settings file containing the dictionary.\r\n * @param priority the priority for the dictionary.\r\n */\r\n addFile(fileName: LocalFileName, priority: SettingsPriority): void;\r\n\r\n /** Invokes [[addFile]] for all files in `directory` with the extension \".json\" or \".json5\". */\r\n addDirectory(directory: LocalDirName, priority: SettingsPriority): void;\r\n\r\n /** Parses `settingsJson` as a [[SettingsContainer]] and invokes [[addDictionary]] to add a [[SettingsDictionary]] with the specified `props`.\r\n * This is typically used when reading dictionaries out of a [[WorkspaceDb]], where they are stored as stringified JSON.\r\n */\r\n addJson(props: SettingsDictionaryProps, settingsJson: string): void;\r\n\r\n /** Find a [[SettingsDictionary]] with the same name and [[WorkspaceDb]] as `source`. */\r\n getDictionary(source: SettingsDictionarySource): SettingsDictionary | undefined;\r\n\r\n /** Add a new [[SettingsDictionary]] with the priority, name, and [[WorkspaceDb]] specified by `props` and setting values supplied by `settings`.\r\n * @note If a dictionary with the same name and [[WorkspaceDb]] already exists, it will be replaced.\r\n * @see [[addFile]], [[addJson]], and [[addDirectory]] for convenient ways to add dictionaries from various sources.\r\n */\r\n addDictionary(props: SettingsDictionaryProps, settings: SettingsContainer): void;\r\n\r\n /** Removes a previously-added [[SettingsDictionary]]. */\r\n dropDictionary(props: SettingsDictionarySource): void;\r\n\r\n /** Looks up the highest priority setting value for a SettingName, falling back to a default value if no value for the setting is found.\r\n * The [[dictionaries]] are searched in order by [[SettingsPriority]]; the first one that provides a value for `settingName` wins.\r\n * @param settingName The name of the setting.\r\n * @param defaultValue value returned if settingName is not present in any [[SettingsDictionary]].\r\n * @note This method is generic on [[Setting]] type, but no type checking is actually performed at run time. So, if you\r\n * use this method to get a setting with an expected type, but its value is a different type, the return type of this method will be wrong.\r\n * You must always type check the result. Use the non-generic \"get\" methods like [[getString]] and [[getArray]] if you only want the value\r\n * if its type is correct.\r\n * @note Unlike [[getArray]], this method does not combine arrays - it ignores [[SettingsSchema.combineArrays]].\r\n */\r\n getSetting<T extends Setting>(settingName: SettingName, defaultValue?: T): T | undefined;\r\n\r\n /** Obtain an iterator over all of the values in the [[dictionaries]] for the [[Setting]] identified by `settingName`, ordered by [[SettingsPriority]]. */\r\n getSettingEntries<T extends Setting>(settingName: SettingName): Iterable<{ value: T, dictionary: SettingsDictionary}>;\r\n\r\n /** Obtain an iterator over all of the values in the [[dictionaries]] for the [[Setting]] identified by `settingName`, ordered by [[SettingsPriority]]. */\r\n getSettingValues<T extends Setting>(settingName: SettingName): Iterable<T>;\r\n\r\n /** Look up the value of a string [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\r\n * @throws Error if the setting exists but is not a string.\r\n */\r\n getString(settingName: SettingName, defaultValue: string): string;\r\n getString(settingName: SettingName, defaultValue?: string): string | undefined;\r\n\r\n /** Look up the value of a boolean [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\r\n * @throws Error if the setting exists but is not a boolean.\r\n */\r\n getBoolean(settingName: SettingName, defaultValue: boolean): boolean;\r\n getBoolean(settingName: SettingName, defaultValue?: boolean): boolean | undefined;\r\n\r\n /** Look up the value of a numeric [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\r\n * @throws Error if the setting exists but is not a number.\r\n */\r\n getNumber(settingName: SettingName, defaultValue: number): number;\r\n getNumber(settingName: SettingName): number | undefined;\r\n\r\n /** Look up the value of an object [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\r\n * @throws Error if the setting exists but is not an object.\r\n */\r\n getObject<T extends object>(settingName: SettingName, defaultValue: T): T;\r\n getObject<T extends object>(settingName: SettingName): T | undefined;\r\n\r\n /** Look up the value of an array [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\r\n * @throws Error if the setting exists but is not an array.\r\n */\r\n getArray<T extends Setting>(settingName: SettingName, defaultValue: Array<T>): Array<T>;\r\n getArray<T extends Setting>(settingName: SettingName): Array<T> | undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3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BAAW,GAAG,GAAG,CAAC;IAC/B,6DAA6D;IAChD,6BAAY,GAAG,GAAG,CAAC;IAChC,sDAAsD;IACzC,sBAAK,GAAG,GAAG,CAAC;IACzB,wDAAwD;IAC3C,uBAAM,GAAG,GAAG,CAAC;IAC1B,gDAAgD;IACnC,uBAAM,GAAG,GAAG,CAAC;AAC5B,CAAC,EAbgB,gBAAgB,gCAAhB,gBAAgB,QAahC","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 Workspace\n */\n\nimport { BeEvent, JSONSchemaType } from \"@itwin/core-bentley\";\nimport { LocalDirName, LocalFileName } from \"@itwin/core-common\";\nimport { WorkspaceDb } from \"./Workspace\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** The value of a single named parameter within a [[Workspace.settings]] that configures some aspect of the applications run-time behavior.\n * Settings are stored in a [[SettingsDictionary]]. A setting is described by its [[SettingSchema]].\n * @beta\n */\nexport type Setting = JSONSchemaType;\n\n/** @beta */\nexport namespace Setting { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Create a deep copy of a [[Setting]]. */\n export function clone<T extends Setting>(setting: T): T {\n if (!setting || typeof setting !== \"object\")\n return setting;\n\n const result = Array.isArray(setting) ? [] : {} as any;\n Object.keys(setting).forEach((key: string) => result[key] = clone((setting as any)[key]));\n return result;\n }\n\n /** Returns true if `a` and `b` are considered equivalent [[Setting]] values.\n * Settings of primitive types like `number` and `string` are compared using `===`.\n * Settings of type \"object\" are compared by comparing each property using `areEqual`; the objects are considered\n * equal if they have the exact same set of property names with equivalent values.\n * Settings of type \"array\" are compared by comparing each element of the arrays use `areEqual`; the arrays are considered\n * equal if they have the same number of elements with equivalent values in the same exact order.\n */\n export function areEqual(a: Setting | undefined, b: Setting | undefined): boolean {\n if (a === b) {\n return true;\n }\n\n // For primitive types, === suffices.\n if (typeof a !== \"object\" || typeof b !== \"object\") {\n return false;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (!areEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n aKeys.sort();\n bKeys.sort();\n for (let i = 0; i < aKeys.length; i++) {\n const key = aKeys[i];\n if (key !== bKeys[i]) {\n return false;\n }\n\n if (!areEqual((a as SettingsContainer)[key], (b as SettingsContainer)[key])) {\n return false;\n }\n }\n\n return true;\n }\n}\n\n/**\n * The name of a [[Setting]].\n * Setting names must be [valid JavaScript property names](https://developer.mozilla.org/en-US/docs/Glossary/property/JavaScript) containing no spaces or periods.\n * The name of a setting begins with the schema prefix of the [[SettingGroupSchema]] in which its [[SettingSchema]] is defined.\n * A setting name therefore forms a path like file names in a file system.\n * For example, the following are setting names defined in the `energyAnalysis`, `iot-scan-visualization`, and `vibration-map` schemas.\n *\n * ```ts\n * \"energyAnalysis/formats/totalWork\"\n * \"energyAnalysis/formats/totalHours\"\n * \"energyAnalysis/units/power\"\n * \"energyAnalysis/units/temperature\"\n * \"energyAnalysis/startupMode\"\n * \"iot-scan-visualization/ports/cameras\"\n * \"vibration-map/filters/scope\"\n * \"vibration-map/filters/prefabricated\"\n * ```\n *\n * @beta\n */\nexport type SettingName = string;\n\n/** An object that defines the values for any number of [[Setting]]s. Each of its properties' names must conform to the semantics of a [[SettingName]].\n * @beta\n */\nexport interface SettingsContainer {\n /** Accesses settings by their names. */\n [name: SettingName]: Setting | undefined;\n}\n\n/** Defines the precedence of a [[SettingsDictionary]].\n * [[Settings]] may contain multiple dictionaries containing different values for the same [[SettingName]].\n * When resolving the value of a [[Setting]], the value from the highest-priority dictionary is used.\n * Priorities are grouped into coarse categories like [[SettingsPriority.application]] and [[SettingsPriority.iModel]].\n * Settings with priorities less than or equal to [[SettingsPriority.application]] are stored in [[IModelHost.appWorkspace]], while\n * those with priorities higher than [[SettingsPriority.application]] are stored inside [[IModelDb.workspace]].\n * @beta\n */\nexport type SettingsPriority = number;\n\n/** @beta */\nexport namespace SettingsPriority { // eslint-disable-line @typescript-eslint/no-redeclare\n /** Settings that originate from default setting files loaded automatically at the start of a session. */\n export const defaults = 100;\n /** Settings supplied by an application at runtime. */\n export const application = 200;\n /** Settings that apply to all iTwins for an organization. */\n export const organization = 300;\n /** Settings that apply to all iModels in an iTwin. */\n export const iTwin = 400;\n /** Settings that apply to all branches of an iModel. */\n export const branch = 500;\n /** Settings that apply to a specific iModel. */\n export const iModel = 600;\n}\n\n/** A named container that supplies values for [[Setting]]s.\n * @see [[Settings.addDictionary]] to register a new settings dictionary.\n * @beta\n */\nexport interface SettingsDictionary {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** Metadata describing the dictionary. */\n readonly props: SettingsDictionaryProps;\n\n /** Obtain a copy of the value of the setting named `settingName` stored in this dictionary, or `undefined` if no such setting exists.\n * The returned value is always cloned using [[Setting.clone]].\n * @note Generally, applications use methods like [[Settings.getString]] and [[Setting.getArray]] to resolve a setting value from multiple\n * dictionaries. Those methods - unlike this one - also validate that `settingName` is of type `T` as defined by its [[SettingSchema]].\n */\n getSetting<T extends Setting>(settingName: SettingName): T | undefined;\n\n /** Return a deep copy of all settings in this dictionary as a [[SettingsContainer]].\n * This is useful for inspecting the full contents of the dictionary or for building a modified copy\n * to pass to [[EditableSettingsDb.updateSettingsDictionary]].\n * The returned container is cloned using [[Setting.clone]], so callers may freely mutate it without\n * affecting this dictionary's internal state.\n * @beta\n */\n toJSON(): SettingsContainer;\n}\n\n/** Uniquely identifies a [[SettingsDictionary]].\n * @beta\n */\nexport interface SettingsDictionarySource {\n /** The name of the dictionary, which must be unique within its [[workspaceDb]], or - if [[workspaceDb]] is undefined - unique among all dictionaries not associated with any [[WorkspaceDb]]. */\n readonly name: string;\n /** The [[WorkspaceDb]] from which the dictionary originated. */\n readonly workspaceDb?: WorkspaceDb;\n}\n\n/** Properties of a [[SettingsDictionary]], defining its name, the [[WorkspaceDb]] (if any) from which it originated, and its [[priority]] relative to other dictionaries.\n * @beta\n */\nexport interface SettingsDictionaryProps extends SettingsDictionarySource {\n /** Precedence value determining which setting value to use when multiple dictionaries supply values for the same [[SettingName]]. */\n readonly priority: SettingsPriority;\n}\n\n/**\n * The collection of [[Setting]]s that supply the run-time configuration of a [[Workspace]].\n * The `Settings` object comprises a collection of named [[SettingsDictionary]] objects.\n * Methods like [[getSetting]], [[getString]], and [[getArray]] provide access to the value of an individual [[Setting]] by searching\n * the [[dictionaries]] in order by their [[SettingsPriority]] to find the highest-priority setting with the requested [[SettingName]].\n * Most methods that retrieve [[Setting]] values validate them against their [[SettingSchema]]s to ensure that they are of the correct type.\n * A [[SettingsDictionary]] can be added or removed using [[addDictionary]] and [[dropDictionary]].\n * Because [[Setting]]s can change at any time during the session, you should avoid caching their values wherever possible.\n * If you must cache them (for example, to display in a user interface), you should listen for the [[onSettingsChanged]] event to be\n * notified of potential changes.\n *\n * Settings are accessed via [[Workspace.settings]]. They are defined at the application level by [[IModelHost.appWorkspace]], but individual iModels may supply\n * additional iModel-specific settings or overrides for application-level settings. When working in the context of a specific iModel, use [[IModelDb.workspace]]'s `settings`\n * property. Any settings not overridden by the iModel will fall back to the settings defined in [[IModelHost.appWorkspace]].\n *\n * Application settings are loaded into [[IModelHost.appWorkspace]] when the session begins (i.e., when [[IModelHost.startup]] is invoked), and unloaded when it ends (in [[IModelHost.shutdown]]).\n * They are read from [JSON5](https://json5.org/) files delivered with the application. The application should register any additional [[SettingsDictionary]]'s '(and their corresponding\n * [[SettingGroupSchema]]s) at this time.\n *\n * iModel-specific settings are stored in the iModel's property table and loaded into [[IModelDb.workspace]] when the iModel is first opened.\n * You can add and remove a [[SettingsDictionary]] from the property table using [[IModelDb.saveSettingDictionary]] and [[IModelDb.deleteSettingDictionary]].\n *\n * See the [learning article]($docs/learning/backend/Workspace) for a detailed overiew and examples.\n *\n * @see [[IModelHost.appWorkspace]] application-wide settings, and [[IModelDb.workspace]] for settings specific to a given iModel.\n * @beta\n */\nexport interface Settings {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /** @internal */\n close(): void;\n\n /** The set of settings dictionaries from which [[Setting]] values are obtained, sorted by [[SettingsPriority]].\n * The set can contain at most one dictionary for each unique combination of name and [[WorkspaceDb]].\n * @see [[addDictionary]], [[addFile]], [[addJson]], and [[addDirectory]] to add a new dictionary.\n * @see [[dropDictionary]] to remove a dictionary.\n * @see [[getDictionary]] to look up a dictionary.\n */\n readonly dictionaries: readonly SettingsDictionary[];\n\n /** Event raised whenever a [[SettingsDictionary]] is added or removed. */\n readonly onSettingsChanged: BeEvent<() => void>;\n\n /** Parses the contents of a local [JSON5](https://json5.org/) file as a [[SettingsContainer]] and invokes [[addDictionary]] to\n * add a [[SettingsDictionary]] named `fileName` with the specified priority.\n * @param fileName the name of a local settings file containing the dictionary.\n * @param priority the priority for the dictionary.\n */\n addFile(fileName: LocalFileName, priority: SettingsPriority): void;\n\n /** Invokes [[addFile]] for all files in `directory` with the extension \".json\" or \".json5\". */\n addDirectory(directory: LocalDirName, priority: SettingsPriority): void;\n\n /** Parses `settingsJson` as a [[SettingsContainer]] and invokes [[addDictionary]] to add a [[SettingsDictionary]] with the specified `props`.\n * This is typically used when reading dictionaries out of a [[WorkspaceDb]], where they are stored as stringified JSON.\n */\n addJson(props: SettingsDictionaryProps, settingsJson: string): void;\n\n /** Find a [[SettingsDictionary]] with the same name and [[WorkspaceDb]] as `source`. */\n getDictionary(source: SettingsDictionarySource): SettingsDictionary | undefined;\n\n /** Add a new [[SettingsDictionary]] with the priority, name, and [[WorkspaceDb]] specified by `props` and setting values supplied by `settings`.\n * @note If a dictionary with the same name and [[WorkspaceDb]] already exists, it will be replaced.\n * @see [[addFile]], [[addJson]], and [[addDirectory]] for convenient ways to add dictionaries from various sources.\n */\n addDictionary(props: SettingsDictionaryProps, settings: SettingsContainer): void;\n\n /** Removes a previously-added [[SettingsDictionary]]. */\n dropDictionary(props: SettingsDictionarySource): void;\n\n /** Looks up the highest priority setting value for a SettingName, falling back to a default value if no value for the setting is found.\n * The [[dictionaries]] are searched in order by [[SettingsPriority]]; the first one that provides a value for `settingName` wins.\n * @param settingName The name of the setting.\n * @param defaultValue value returned if settingName is not present in any [[SettingsDictionary]].\n * @note This method is generic on [[Setting]] type, but no type checking is actually performed at run time. So, if you\n * use this method to get a setting with an expected type, but its value is a different type, the return type of this method will be wrong.\n * You must always type check the result. Use the non-generic \"get\" methods like [[getString]] and [[getArray]] if you only want the value\n * if its type is correct.\n * @note Unlike [[getArray]], this method does not combine arrays - it ignores [[SettingsSchema.combineArrays]].\n */\n getSetting<T extends Setting>(settingName: SettingName, defaultValue?: T): T | undefined;\n\n /** Obtain an iterator over all of the values in the [[dictionaries]] for the [[Setting]] identified by `settingName`, ordered by [[SettingsPriority]]. */\n getSettingEntries<T extends Setting>(settingName: SettingName): Iterable<{ value: T, dictionary: SettingsDictionary}>;\n\n /** Obtain an iterator over all of the values in the [[dictionaries]] for the [[Setting]] identified by `settingName`, ordered by [[SettingsPriority]]. */\n getSettingValues<T extends Setting>(settingName: SettingName): Iterable<T>;\n\n /** Look up the value of a string [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\n * @throws Error if the setting exists but is not a string.\n */\n getString(settingName: SettingName, defaultValue: string): string;\n getString(settingName: SettingName, defaultValue?: string): string | undefined;\n\n /** Look up the value of a boolean [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\n * @throws Error if the setting exists but is not a boolean.\n */\n getBoolean(settingName: SettingName, defaultValue: boolean): boolean;\n getBoolean(settingName: SettingName, defaultValue?: boolean): boolean | undefined;\n\n /** Look up the value of a numeric [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\n * @throws Error if the setting exists but is not a number.\n */\n getNumber(settingName: SettingName, defaultValue: number): number;\n getNumber(settingName: SettingName): number | undefined;\n\n /** Look up the value of an object [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\n * @throws Error if the setting exists but is not an object.\n */\n getObject<T extends object>(settingName: SettingName, defaultValue: T): T;\n getObject<T extends object>(settingName: SettingName): T | undefined;\n\n /** Look up the value of an array [[Setting]] named `settingName`, returning `defaultValue` if no such value is defined.\n * @throws Error if the setting exists but is not an array.\n */\n getArray<T extends Setting>(settingName: SettingName, defaultValue: Array<T>): Array<T>;\n getArray<T extends Setting>(settingName: SettingName): Array<T> | undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsDb.js","sourceRoot":"","sources":["../../../src/workspace/SettingsDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,iDAAgE;AAyGhE;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,UAAU,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SettingsDb.js","sourceRoot":"","sources":["../../../src/workspace/SettingsDb.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH,iDAAgE;AAyGhE;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,UAAU,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/** @packageDocumentation\n * @module Workspace\n */\n\nimport { Setting, SettingName, SettingsContainer, SettingsPriority } from \"./Settings\";\nimport { CloudSqliteContainer, WorkspaceContainerId, WorkspaceDbName } from \"./Workspace\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\n\n/** Metadata stored inside a [[SettingsDb]] describing the database's contents, to help users understand\n * the purpose of the [[SettingsDb]] and who to contact with questions about it.\n * @note Only the `settingsName` field is required, and users may add additional fields for their own purposes.\n * @note Since the information is stored inside the [[SettingsDb]], it is versioned along with the rest of the contents.\n * @beta\n */\nexport interface SettingsDbManifest {\n /** The name of the [[SettingsDb]] to be shown in user interfaces. Organizations should attempt to make this name\n * informative enough so that users may refer to it in conversations.\n */\n readonly settingsName: string;\n /** A description of the contents of this [[SettingsDb]] to help users understand its purpose and appropriate usage. */\n readonly description?: string;\n /** The name of the person to contact with questions about this [[SettingsDb]]. */\n readonly contactName?: string;\n /** The name of the person who last modified this [[SettingsDb]]. */\n readonly lastEditedBy?: string;\n}\n\n/** Properties that specify how to load a [[SettingsDb]] within a [[CloudSqliteContainer]].\n * @beta\n */\nexport interface SettingsDbProps {\n /** The base name of the [[SettingsDb]], without any version information. Default: `\"settings-db\"`. */\n readonly dbName?: WorkspaceDbName;\n /** The [semver](https://github.com/npm/node-semver) version string or range for the desired [[SettingsDb]].\n * If not specified, the latest available version is used.\n */\n readonly version?: string;\n}\n\n/** Arguments for obtaining a [[SettingsDb]] from a previously-loaded container.\n * @beta\n */\nexport interface GetSettingsDbArgs {\n /** The [[WorkspaceContainerId]] of the cloud container that holds the [[SettingsDb]].\n * This is an opaque GUID assigned by the BlobContainer service when the container is created — it is\n * **not** the same as an iTwinId or iModelId.\n */\n readonly containerId: WorkspaceContainerId;\n /** The priority to assign to dictionaries loaded from this [[SettingsDb]]. */\n readonly priority: SettingsPriority;\n /** The name of the [[SettingsDb]] to retrieve. Default: `\"settings-db\"`. */\n readonly dbName?: WorkspaceDbName;\n /** The semantic version string or range for the desired [[SettingsDb]].\n * If not specified, the latest available version is used.\n */\n readonly version?: string;\n}\n\n/** A CloudSQLite database dedicated to storing settings as key-value pairs. Unlike a general-purpose [[WorkspaceDb]],\n * a `SettingsDb` restricts its API surface to settings-only operations, providing a focused interface\n * for reading settings by name.\n *\n * Internally, all settings are stored in a single JSON blob. Each setting is a named entry in a [[SettingsContainer]].\n *\n * A `SettingsDb` resides in a [[CloudSqliteContainer]] and can be published to the cloud. Once published,\n * the `SettingsDb` becomes immutable; however, multiple versions may be created to allow settings to evolve over time.\n * @beta\n */\nexport interface SettingsDb {\n /** @internal */\n [_implementationProhibited]: unknown;\n /** The [[CloudSqliteContainer]] in which this database resides. */\n readonly container: CloudSqliteContainer;\n /** The base name of this SettingsDb, without version. */\n readonly dbName: string;\n /** The resolved [semver](https://github.com/npm/node-semver) version of this SettingsDb.\n * @note For local (non-cloud) containers, this property returns `\"0.0.0\"`.\n */\n readonly version: string;\n /** The priority assigned to dictionaries loaded from this SettingsDb. */\n readonly priority: SettingsPriority;\n /** Whether the underlying database is currently open. */\n readonly isOpen: boolean;\n /** The manifest describing the contents of this SettingsDb. */\n readonly manifest: SettingsDbManifest;\n\n /** Open the underlying database for querying. When performing significant activity against a SettingsDb,\n * open it before the operations and [[close]] it afterwards.\n * @note Explicit open/close is a performance optimization for batches of operations. Individual methods like\n * [[getSetting]] and [[getSettings]] will auto-open and auto-close the database if it is not already open.\n */\n open(): void;\n\n /** Close the underlying database. You should call this after [[open]]ing the database and completing your queries.\n * @note For [[EditableSettingsDb]] instances, if the container's write lock is currently held, closing persists\n * any pending changes and updates the manifest's `lastEditedBy` field with the current write lock holder.\n */\n close(): void;\n\n /** Return a copy of the value of the setting named `settingName`, or `undefined` if not found.\n * The returned value is always cloned using [[Setting.clone]].\n * @param settingName The name of the setting to retrieve.\n */\n getSetting<T extends Setting>(settingName: SettingName): T | undefined;\n\n /** Return a deep copy of all settings stored in this SettingsDb as a [[SettingsContainer]].\n * @note The returned object is a fresh copy — mutating it will not affect the stored settings.\n */\n getSettings(): SettingsContainer;\n}\n\n/** The default resource name used to store settings in a [[SettingsDb]].\n * This is the key under which all settings are stored in the SQLite `strings` table.\n * When loading settings at runtime via [[Workspace.loadSettingsDictionary]], the `resourceName` defaults\n * to this value, ensuring the read and write paths always agree on which key to use.\n * @internal\n */\nexport const settingsResourceName = \"settings\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsEditor.js","sourceRoot":"","sources":["../../../src/workspace/SettingsEditor.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAKH,kEAAwD;AAGxD,6EAA0E;AAC1E,iFAAmF;AACnF,iDAAgE;AAEhE,8CAA2C;AAE3C,YAAY;AACZ,IAAiB,cAAc,CA0C9B;AA1CD,WAAiB,cAAc;IAC7B;;;;OAIG;IACH,SAAgB,SAAS;QACvB,OAAO,IAAA,4CAAuB,GAAE,CAAC;IACnC,CAAC;IAFe,wBAAS,YAExB,CAAA;IAED;;;;OAIG;IACH,SAAgB,aAAa,CAAC,IAAoE;QAChG,mCAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAFe,4BAAa,gBAE5B,CAAA;IAYD;;;;;;;OAOG;IACI,KAAK,UAAU,eAAe,CAAC,IAAiC;QACrE,IAAI,SAAS,KAAK,oCAAa,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAC;QACjK,MAAM,SAAS,GAAG,MAAM,uBAAU,CAAC,cAAc,EAAE,CAAC;QACpD,OAAO,oCAAa,CAAC,OAAO,CAAC,uBAAuB,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1G,CAAC;IAJqB,8BAAe,kBAIpC,CAAA;AACH,CAAC,EA1CgB,cAAc,8BAAd,cAAc,QA0C9B","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 Workspace\r\n */\r\n\r\nimport { LocalFileName } from \"@itwin/core-common\";\r\nimport { GuidString } from \"@itwin/core-bentley\";\r\nimport { Setting, SettingName, SettingsContainer } from \"./Settings\";\r\nimport { BlobContainer } from \"../BlobContainerService\";\r\nimport { CloudSqliteContainer, GetWorkspaceContainerArgs, Workspace, WorkspaceContainerProps, WorkspaceDbName, WorkspaceDbNameAndVersion, WorkspaceDbVersion } from \"./Workspace\";\r\nimport { SettingsDb, SettingsDbManifest, SettingsDbProps } from \"./SettingsDb\";\r\nimport { SettingsSqliteDb } from \"../internal/workspace/SettingsSqliteDb\";\r\nimport { constructSettingsEditor } from \"../internal/workspace/SettingsEditorImpl\";\r\nimport { _implementationProhibited } from \"../internal/Symbols\";\r\nimport { CloudSqlite } from \"../CloudSqlite\";\r\nimport { IModelHost } from \"../IModelHost\";\r\n\r\n/** @beta */\r\nexport namespace SettingsEditor {\r\n /**\r\n * Create a new [[SettingsEditor]] for creating new versions of [[SettingsDb]]s.\r\n * @note The caller becomes the owner of the SettingsEditor and is responsible for calling [[SettingsEditor.close]] on it when finished.\r\n * @note It is illegal to have more than one SettingsEditor active in a single session.\r\n */\r\n export function construct(): SettingsEditor {\r\n return constructSettingsEditor();\r\n }\r\n\r\n /**\r\n * Create a new, empty, [[SettingsDb]] file on the local filesystem for importing settings dictionaries.\r\n * @note Do not pass an untrusted or unintended path in `localFileName`.\r\n * This helper creates or overwrites the file at that location; callers that need fail-if-exists behavior should check first.\r\n */\r\n export function createEmptyDb(args: { localFileName: LocalFileName; manifest: SettingsDbManifest }): void {\r\n SettingsSqliteDb.createNewDb(args.localFileName, args);\r\n }\r\n\r\n /** Arguments for [[SettingsEditor.queryContainers]] and [[SettingsEditor.findContainers]]. */\r\n export interface QuerySettingsContainersArgs {\r\n /** The iTwinId whose settings containers should be queried. */\r\n iTwinId: GuidString;\r\n /** Optional iModelId to further scope the query to containers associated with a specific iModel. */\r\n iModelId?: GuidString;\r\n /** Optional label filter. */\r\n label?: string;\r\n }\r\n\r\n /**\r\n * Query the [[BlobContainer]] service for all settings containers associated with a given iTwin.\r\n * This is a convenience wrapper around `BlobContainer.service.queryContainersMetadata` that\r\n * automatically filters by `containerType: \"settings\"`.\r\n * @param args - The query arguments including the iTwinId.\r\n * @returns A promise that resolves to the matching container metadata entries.\r\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\r\n */\r\n export async function queryContainers(args: QuerySettingsContainersArgs): Promise<BlobContainer.MetadataResponse[]> {\r\n if (undefined === BlobContainer.service) throw new Error(\"BlobContainer.service is not available. Ensure IModelHost is initialized with a valid configuration.\");\r\n const userToken = await IModelHost.getAccessToken();\r\n return BlobContainer.service.queryContainersMetadata(userToken, { ...args, containerType: \"settings\" });\r\n }\r\n}\r\n\r\n/** Arguments supplied to [[SettingsEditor.createNewCloudContainer]] to create a new [[EditableSettingsCloudContainer]].\r\n * The created container will automatically have `containerType: \"settings\"` in its metadata, enabling discovery\r\n * via `BlobContainer.service.queryContainersMetadata({ containerType: \"settings\" })`.\r\n * @beta\r\n */\r\nexport interface CreateNewSettingsContainerArgs {\r\n /**\r\n * The scope of the container. This determines the ownership of the container, how RBAC rights are assigned,\r\n * and the location of the datacenter.\r\n */\r\n scope: BlobContainer.Scope;\r\n /** The manifest to be stored in the default SettingsDb in the new container. */\r\n manifest: SettingsDbManifest;\r\n /** Metadata stored by the BlobContainer service. The `containerType` field is omitted here because it is\r\n * automatically set to `\"settings\"` when the container is created (mirroring the `\"workspace\"` convention for WorkspaceDb containers).\r\n */\r\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\r\n /** The name of the default [[SettingsDb]] created inside the new container.\r\n * Default: \"settings-db\";\r\n */\r\n dbName?: WorkspaceDbName;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsCloudContainer.createNewSettingsDbVersion]].\r\n * @beta\r\n */\r\nexport interface CreateNewSettingsDbVersionArgs {\r\n /**\r\n * The properties that determine the source [[SettingsDb]] to serve as the basis for the new version.\r\n * This is usually the latest version, but it is possible to create patches to older versions.\r\n */\r\n fromProps?: SettingsDbProps;\r\n /** The type of version increment to apply to the source version. */\r\n versionType: CloudSqlite.SemverIncrement;\r\n /** For prerelease versions, a string that becomes part of the version name. */\r\n identifier?: string;\r\n}\r\n\r\n/** The result of creating a new version of a [[SettingsDb]].\r\n * @beta\r\n */\r\nexport interface SettingsDbVersionResult {\r\n /** The name and version of the source SettingsDb. */\r\n oldDb: WorkspaceDbNameAndVersion;\r\n /** The name and version of the newly-created SettingsDb. */\r\n newDb: WorkspaceDbNameAndVersion;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsCloudContainer.createDb]] to create a new [[SettingsDb]] in a container.\r\n * @beta\r\n */\r\nexport interface CreateSettingsDbArgs {\r\n /** The name of the new SettingsDb. Default: `\"settings-db\"`. */\r\n dbName?: WorkspaceDbName;\r\n /** The initial version of the new SettingsDb. Default: `\"0.0.0\"`. */\r\n version?: WorkspaceDbVersion;\r\n /** The manifest for the new SettingsDb. */\r\n manifest: SettingsDbManifest;\r\n}\r\n\r\n/** Arguments supplied to [[EditableSettingsDb.updateSetting]] to add or update a single [[Setting]].\r\n * @beta\r\n */\r\nexport interface UpdateSettingArgs {\r\n /** The [[SettingName]] of the setting to add or update. */\r\n readonly settingName: SettingName;\r\n /** The new value for the setting. */\r\n readonly value: Setting;\r\n}\r\n\r\n/**\r\n * A [[CloudSqliteContainer]] opened for editing settings by a [[SettingsEditor]].\r\n * You can create new [[SettingsDb]]s or new versions of existing [[SettingsDb]]s inside it.\r\n * Before actually making any changes to the container's contents, you must first obtain an exclusive write lock on it via\r\n * [[acquireWriteLock]]. Only one user can hold the write lock at any given time. When you have finished making changes,\r\n * you can use [[releaseWriteLock]] to publish your changes, or [[abandonChanges]] to discard them.\r\n * @note Settings containers are separate from workspace containers, providing independent write locks.\r\n * Editing settings does not block workspace resource editing, and vice versa.\r\n * @beta\r\n */\r\nexport interface EditableSettingsCloudContainer extends CloudSqliteContainer {\r\n /**\r\n * Create a copy of an existing [[SettingsDb]] in this container with a new [[WorkspaceDbVersion]].\r\n * The copy should be modified with new content before the write lock is released,\r\n * and thereafter may never be modified again.\r\n * @param args - The properties that determine the source SettingsDb and the version increment to apply.\r\n * @returns A promise that resolves to an object containing the old and new SettingsDb names and versions.\r\n */\r\n createNewSettingsDbVersion(args: CreateNewSettingsDbVersionArgs): Promise<SettingsDbVersionResult>;\r\n\r\n /**\r\n * Create a new, empty [[SettingsDb]].\r\n * @param args - The arguments for creating the new SettingsDb.\r\n * @returns A promise that resolves to an EditableSettingsDb.\r\n */\r\n createDb(args: CreateSettingsDbArgs): Promise<EditableSettingsDb>;\r\n\r\n /**\r\n * Get the cloud properties of this container.\r\n */\r\n readonly cloudProps: WorkspaceContainerProps | undefined;\r\n\r\n /**\r\n * Get an editable [[SettingsDb]] to add, delete, or update settings *within a newly created version* of a SettingsDb.\r\n * Repeated calls that resolve to the same SettingsDb return the same cached instance.\r\n * @param props - The properties of the SettingsDb.\r\n * @returns An EditableSettingsDb for modifying settings.\r\n * @throws if the targeted SettingsDb has already been published and is immutable. Use [[createNewSettingsDbVersion]] first to create an editable version.\r\n */\r\n getEditableDb(props?: SettingsDbProps): EditableSettingsDb;\r\n\r\n /**\r\n * Acquire the write lock on the container. Use [[releaseWriteLock]] to release the lock after publishing your changes, or\r\n * [[abandonChanges]] to release the lock and discard your changes.\r\n * Only one user can hold the write lock at any given time. However, readers can continue to read the published contents of the container while\r\n * a writer holds the write lock. Readers will only see the writer's changes after they are published by [[releaseWriteLock]].\r\n * @param user - The name of the user acquiring the write lock.\r\n * @throws if the write lock is already held by another user.\r\n */\r\n acquireWriteLock(user: string): void;\r\n\r\n /**\r\n * Release the write lock on the container. This should be called after all changes to the container's contents are complete. It\r\n * publishes and uploads the changes made to any [[SettingsDb]]s while the lock was held, after which those dbs become immutable.\r\n */\r\n releaseWriteLock(): void;\r\n\r\n /**\r\n * Abandon any changes made to the container and release the write lock. Any newly created versions of SettingsDbs are discarded.\r\n */\r\n abandonChanges(): void;\r\n}\r\n\r\n/**\r\n * An editable [[SettingsDb]]. This is used only by tools to allow administrators to create and modify SettingsDbs.\r\n * For cloud-based SettingsDbs, the container's write token must be obtained via [[EditableSettingsCloudContainer.acquireWriteLock]] before the methods in this interface may be used.\r\n * Normally, only admins will have write access.\r\n * Only one admin at a time may be editing a settings container.\r\n * @note Unlike [[EditableWorkspaceDb]], this interface only supports settings operations — no blob, file, or string resource methods.\r\n * @beta\r\n */\r\nexport interface EditableSettingsDb extends SettingsDb {\r\n /** The editable container that owns this SettingsDb. */\r\n readonly container: EditableSettingsCloudContainer;\r\n\r\n /**\r\n * Update the contents of the manifest in this SettingsDb.\r\n * @note This replaces the stored manifest entirely; omitted fields are lost.\r\n * @param manifest - The updated manifest.\r\n */\r\n updateManifest(manifest: SettingsDbManifest): void;\r\n\r\n /**\r\n * Replace all settings in this SettingsDb with the given container.\r\n * @param settings - The settings object to store.\r\n */\r\n updateSettings(settings: SettingsContainer): void;\r\n\r\n /**\r\n * Add or update a single [[Setting]] by name.\r\n * If a setting with the given name already exists, its value is replaced.\r\n * If it does not exist, it is added. Other settings are preserved.\r\n * @param args - The arguments specifying the setting name and value.\r\n */\r\n updateSetting(args: UpdateSettingArgs): void;\r\n\r\n /**\r\n * Remove a single [[Setting]] by name. Other settings are preserved.\r\n * @param settingName - The name of the setting to remove.\r\n */\r\n removeSetting(settingName: SettingName): void;\r\n}\r\n\r\n/** An object that permits administrators to modify the contents of settings containers.\r\n * Use [[SettingsEditor.construct]] to obtain a SettingsEditor, and [[close]] when finished using it.\r\n * Only one SettingsEditor may be in use at any given time.\r\n * Use [[getContainer]] to edit an existing container, or [[createNewCloudContainer]] to create a new container.\r\n * @beta\r\n */\r\nexport interface SettingsEditor {\r\n /** @internal */\r\n [_implementationProhibited]: unknown;\r\n\r\n /**\r\n * The workspace dedicated to this editor.\r\n * @note This workspace is independent from [[IModelHost.appWorkspace]] and all [[IModelDb.workspace]]s.\r\n */\r\n readonly workspace: Workspace;\r\n\r\n /**\r\n * Retrieves a container for the editor with the specified properties and access token.\r\n */\r\n getContainer(args: GetWorkspaceContainerArgs): EditableSettingsCloudContainer;\r\n\r\n /**\r\n * Asynchronously retrieves a container for the editor with the specified properties.\r\n */\r\n getContainerAsync(props: WorkspaceContainerProps): Promise<EditableSettingsCloudContainer>;\r\n\r\n /**\r\n * Creates a new cloud container for holding SettingsDbs, from the [[BlobContainer]] service.\r\n * The container is automatically assigned `containerType: \"settings\"` in its metadata and\r\n * initialized with a default [[SettingsDb]].\r\n * @param args - The arguments for creating the container, including scope, metadata, and manifest.\r\n * @returns A promise that resolves to the new EditableSettingsCloudContainer.\r\n * @note The current user must have administrator rights for the iTwin for the container.\r\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\r\n */\r\n createNewCloudContainer(args: CreateNewSettingsContainerArgs): Promise<EditableSettingsCloudContainer>;\r\n\r\n /**\r\n * Find and open existing settings containers by querying the [[BlobContainer]] service.\r\n * This is a convenience method that queries for all settings containers matching the given iTwinId\r\n * (and optionally iModelId), requests write access tokens, and opens each matching container.\r\n * @param args - The query arguments including iTwinId and optionally iModelId and label.\r\n * @returns A promise that resolves to an array of opened [[EditableSettingsCloudContainer]]s.\r\n * @note Requires [[IModelHost.authorizationClient]] and [[BlobContainer.service]] to be configured.\r\n */\r\n findContainers(args: SettingsEditor.QuerySettingsContainersArgs): Promise<EditableSettingsCloudContainer[]>;\r\n\r\n /**\r\n * Closes this editor. All settings containers are dropped.\r\n */\r\n close(): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SettingsEditor.js","sourceRoot":"","sources":["../../../src/workspace/SettingsEditor.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAKH,kEAAwD;AAGxD,6EAA0E;AAC1E,iFAAmF;AACnF,iDAAgE;AAEhE,8CAA2C;AAE3C,YAAY;AACZ,IAAiB,cAAc,CA0C9B;AA1CD,WAAiB,cAAc;IAC7B;;;;OAIG;IACH,SAAgB,SAAS;QACvB,OAAO,IAAA,4CAAuB,GAAE,CAAC;IACnC,CAAC;IAFe,wBAAS,YAExB,CAAA;IAED;;;;OAIG;IACH,SAAgB,aAAa,CAAC,IAAoE;QAChG,mCAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAFe,4BAAa,gBAE5B,CAAA;IAYD;;;;;;;OAOG;IACI,KAAK,UAAU,eAAe,CAAC,IAAiC;QACrE,IAAI,SAAS,KAAK,oCAAa,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAC;QACjK,MAAM,SAAS,GAAG,MAAM,uBAAU,CAAC,cAAc,EAAE,CAAC;QACpD,OAAO,oCAAa,CAAC,OAAO,CAAC,uBAAuB,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;IAC1G,CAAC;IAJqB,8BAAe,kBAIpC,CAAA;AACH,CAAC,EA1CgB,cAAc,8BAAd,cAAc,QA0C9B","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 Workspace\n */\n\nimport { LocalFileName } from \"@itwin/core-common\";\nimport { GuidString } from \"@itwin/core-bentley\";\nimport { Setting, SettingName, SettingsContainer } from \"./Settings\";\nimport { BlobContainer } from \"../BlobContainerService\";\nimport { CloudSqliteContainer, GetWorkspaceContainerArgs, Workspace, WorkspaceContainerProps, WorkspaceDbName, WorkspaceDbNameAndVersion, WorkspaceDbVersion } from \"./Workspace\";\nimport { SettingsDb, SettingsDbManifest, SettingsDbProps } from \"./SettingsDb\";\nimport { SettingsSqliteDb } from \"../internal/workspace/SettingsSqliteDb\";\nimport { constructSettingsEditor } from \"../internal/workspace/SettingsEditorImpl\";\nimport { _implementationProhibited } from \"../internal/Symbols\";\nimport { CloudSqlite } from \"../CloudSqlite\";\nimport { IModelHost } from \"../IModelHost\";\n\n/** @beta */\nexport namespace SettingsEditor {\n /**\n * Create a new [[SettingsEditor]] for creating new versions of [[SettingsDb]]s.\n * @note The caller becomes the owner of the SettingsEditor and is responsible for calling [[SettingsEditor.close]] on it when finished.\n * @note It is illegal to have more than one SettingsEditor active in a single session.\n */\n export function construct(): SettingsEditor {\n return constructSettingsEditor();\n }\n\n /**\n * Create a new, empty, [[SettingsDb]] file on the local filesystem for importing settings dictionaries.\n * @note Do not pass an untrusted or unintended path in `localFileName`.\n * This helper creates or overwrites the file at that location; callers that need fail-if-exists behavior should check first.\n */\n export function createEmptyDb(args: { localFileName: LocalFileName; manifest: SettingsDbManifest }): void {\n SettingsSqliteDb.createNewDb(args.localFileName, args);\n }\n\n /** Arguments for [[SettingsEditor.queryContainers]] and [[SettingsEditor.findContainers]]. */\n export interface QuerySettingsContainersArgs {\n /** The iTwinId whose settings containers should be queried. */\n iTwinId: GuidString;\n /** Optional iModelId to further scope the query to containers associated with a specific iModel. */\n iModelId?: GuidString;\n /** Optional label filter. */\n label?: string;\n }\n\n /**\n * Query the [[BlobContainer]] service for all settings containers associated with a given iTwin.\n * This is a convenience wrapper around `BlobContainer.service.queryContainersMetadata` that\n * automatically filters by `containerType: \"settings\"`.\n * @param args - The query arguments including the iTwinId.\n * @returns A promise that resolves to the matching container metadata entries.\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\n */\n export async function queryContainers(args: QuerySettingsContainersArgs): Promise<BlobContainer.MetadataResponse[]> {\n if (undefined === BlobContainer.service) throw new Error(\"BlobContainer.service is not available. Ensure IModelHost is initialized with a valid configuration.\");\n const userToken = await IModelHost.getAccessToken();\n return BlobContainer.service.queryContainersMetadata(userToken, { ...args, containerType: \"settings\" });\n }\n}\n\n/** Arguments supplied to [[SettingsEditor.createNewCloudContainer]] to create a new [[EditableSettingsCloudContainer]].\n * The created container will automatically have `containerType: \"settings\"` in its metadata, enabling discovery\n * via `BlobContainer.service.queryContainersMetadata({ containerType: \"settings\" })`.\n * @beta\n */\nexport interface CreateNewSettingsContainerArgs {\n /**\n * The scope of the container. This determines the ownership of the container, how RBAC rights are assigned,\n * and the location of the datacenter.\n */\n scope: BlobContainer.Scope;\n /** The manifest to be stored in the default SettingsDb in the new container. */\n manifest: SettingsDbManifest;\n /** Metadata stored by the BlobContainer service. The `containerType` field is omitted here because it is\n * automatically set to `\"settings\"` when the container is created (mirroring the `\"workspace\"` convention for WorkspaceDb containers).\n */\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\n /** The name of the default [[SettingsDb]] created inside the new container.\n * Default: \"settings-db\";\n */\n dbName?: WorkspaceDbName;\n}\n\n/** Arguments supplied to [[EditableSettingsCloudContainer.createNewSettingsDbVersion]].\n * @beta\n */\nexport interface CreateNewSettingsDbVersionArgs {\n /**\n * The properties that determine the source [[SettingsDb]] to serve as the basis for the new version.\n * This is usually the latest version, but it is possible to create patches to older versions.\n */\n fromProps?: SettingsDbProps;\n /** The type of version increment to apply to the source version. */\n versionType: CloudSqlite.SemverIncrement;\n /** For prerelease versions, a string that becomes part of the version name. */\n identifier?: string;\n}\n\n/** The result of creating a new version of a [[SettingsDb]].\n * @beta\n */\nexport interface SettingsDbVersionResult {\n /** The name and version of the source SettingsDb. */\n oldDb: WorkspaceDbNameAndVersion;\n /** The name and version of the newly-created SettingsDb. */\n newDb: WorkspaceDbNameAndVersion;\n}\n\n/** Arguments supplied to [[EditableSettingsCloudContainer.createDb]] to create a new [[SettingsDb]] in a container.\n * @beta\n */\nexport interface CreateSettingsDbArgs {\n /** The name of the new SettingsDb. Default: `\"settings-db\"`. */\n dbName?: WorkspaceDbName;\n /** The initial version of the new SettingsDb. Default: `\"0.0.0\"`. */\n version?: WorkspaceDbVersion;\n /** The manifest for the new SettingsDb. */\n manifest: SettingsDbManifest;\n}\n\n/** Arguments supplied to [[EditableSettingsDb.updateSetting]] to add or update a single [[Setting]].\n * @beta\n */\nexport interface UpdateSettingArgs {\n /** The [[SettingName]] of the setting to add or update. */\n readonly settingName: SettingName;\n /** The new value for the setting. */\n readonly value: Setting;\n}\n\n/**\n * A [[CloudSqliteContainer]] opened for editing settings by a [[SettingsEditor]].\n * You can create new [[SettingsDb]]s or new versions of existing [[SettingsDb]]s inside it.\n * Before actually making any changes to the container's contents, you must first obtain an exclusive write lock on it via\n * [[acquireWriteLock]]. Only one user can hold the write lock at any given time. When you have finished making changes,\n * you can use [[releaseWriteLock]] to publish your changes, or [[abandonChanges]] to discard them.\n * @note Settings containers are separate from workspace containers, providing independent write locks.\n * Editing settings does not block workspace resource editing, and vice versa.\n * @beta\n */\nexport interface EditableSettingsCloudContainer extends CloudSqliteContainer {\n /**\n * Create a copy of an existing [[SettingsDb]] in this container with a new [[WorkspaceDbVersion]].\n * The copy should be modified with new content before the write lock is released,\n * and thereafter may never be modified again.\n * @param args - The properties that determine the source SettingsDb and the version increment to apply.\n * @returns A promise that resolves to an object containing the old and new SettingsDb names and versions.\n */\n createNewSettingsDbVersion(args: CreateNewSettingsDbVersionArgs): Promise<SettingsDbVersionResult>;\n\n /**\n * Create a new, empty [[SettingsDb]].\n * @param args - The arguments for creating the new SettingsDb.\n * @returns A promise that resolves to an EditableSettingsDb.\n */\n createDb(args: CreateSettingsDbArgs): Promise<EditableSettingsDb>;\n\n /**\n * Get the cloud properties of this container.\n */\n readonly cloudProps: WorkspaceContainerProps | undefined;\n\n /**\n * Get an editable [[SettingsDb]] to add, delete, or update settings *within a newly created version* of a SettingsDb.\n * Repeated calls that resolve to the same SettingsDb return the same cached instance.\n * @param props - The properties of the SettingsDb.\n * @returns An EditableSettingsDb for modifying settings.\n * @throws if the targeted SettingsDb has already been published and is immutable. Use [[createNewSettingsDbVersion]] first to create an editable version.\n */\n getEditableDb(props?: SettingsDbProps): EditableSettingsDb;\n\n /**\n * Acquire the write lock on the container. Use [[releaseWriteLock]] to release the lock after publishing your changes, or\n * [[abandonChanges]] to release the lock and discard your changes.\n * Only one user can hold the write lock at any given time. However, readers can continue to read the published contents of the container while\n * a writer holds the write lock. Readers will only see the writer's changes after they are published by [[releaseWriteLock]].\n * @param user - The name of the user acquiring the write lock.\n * @throws if the write lock is already held by another user.\n */\n acquireWriteLock(user: string): void;\n\n /**\n * Release the write lock on the container. This should be called after all changes to the container's contents are complete. It\n * publishes and uploads the changes made to any [[SettingsDb]]s while the lock was held, after which those dbs become immutable.\n */\n releaseWriteLock(): void;\n\n /**\n * Abandon any changes made to the container and release the write lock. Any newly created versions of SettingsDbs are discarded.\n */\n abandonChanges(): void;\n}\n\n/**\n * An editable [[SettingsDb]]. This is used only by tools to allow administrators to create and modify SettingsDbs.\n * For cloud-based SettingsDbs, the container's write token must be obtained via [[EditableSettingsCloudContainer.acquireWriteLock]] before the methods in this interface may be used.\n * Normally, only admins will have write access.\n * Only one admin at a time may be editing a settings container.\n * @note Unlike [[EditableWorkspaceDb]], this interface only supports settings operations — no blob, file, or string resource methods.\n * @beta\n */\nexport interface EditableSettingsDb extends SettingsDb {\n /** The editable container that owns this SettingsDb. */\n readonly container: EditableSettingsCloudContainer;\n\n /**\n * Update the contents of the manifest in this SettingsDb.\n * @note This replaces the stored manifest entirely; omitted fields are lost.\n * @param manifest - The updated manifest.\n */\n updateManifest(manifest: SettingsDbManifest): void;\n\n /**\n * Replace all settings in this SettingsDb with the given container.\n * @param settings - The settings object to store.\n */\n updateSettings(settings: SettingsContainer): void;\n\n /**\n * Add or update a single [[Setting]] by name.\n * If a setting with the given name already exists, its value is replaced.\n * If it does not exist, it is added. Other settings are preserved.\n * @param args - The arguments specifying the setting name and value.\n */\n updateSetting(args: UpdateSettingArgs): void;\n\n /**\n * Remove a single [[Setting]] by name. Other settings are preserved.\n * @param settingName - The name of the setting to remove.\n */\n removeSetting(settingName: SettingName): void;\n}\n\n/** An object that permits administrators to modify the contents of settings containers.\n * Use [[SettingsEditor.construct]] to obtain a SettingsEditor, and [[close]] when finished using it.\n * Only one SettingsEditor may be in use at any given time.\n * Use [[getContainer]] to edit an existing container, or [[createNewCloudContainer]] to create a new container.\n * @beta\n */\nexport interface SettingsEditor {\n /** @internal */\n [_implementationProhibited]: unknown;\n\n /**\n * The workspace dedicated to this editor.\n * @note This workspace is independent from [[IModelHost.appWorkspace]] and all [[IModelDb.workspace]]s.\n */\n readonly workspace: Workspace;\n\n /**\n * Retrieves a container for the editor with the specified properties and access token.\n */\n getContainer(args: GetWorkspaceContainerArgs): EditableSettingsCloudContainer;\n\n /**\n * Asynchronously retrieves a container for the editor with the specified properties.\n */\n getContainerAsync(props: WorkspaceContainerProps): Promise<EditableSettingsCloudContainer>;\n\n /**\n * Creates a new cloud container for holding SettingsDbs, from the [[BlobContainer]] service.\n * The container is automatically assigned `containerType: \"settings\"` in its metadata and\n * initialized with a default [[SettingsDb]].\n * @param args - The arguments for creating the container, including scope, metadata, and manifest.\n * @returns A promise that resolves to the new EditableSettingsCloudContainer.\n * @note The current user must have administrator rights for the iTwin for the container.\n * @note Requires [[IModelHost.authorizationClient]] to be configured.\n */\n createNewCloudContainer(args: CreateNewSettingsContainerArgs): Promise<EditableSettingsCloudContainer>;\n\n /**\n * Find and open existing settings containers by querying the [[BlobContainer]] service.\n * This is a convenience method that queries for all settings containers matching the given iTwinId\n * (and optionally iModelId), requests write access tokens, and opens each matching container.\n * @param args - The query arguments including iTwinId and optionally iModelId and label.\n * @returns A promise that resolves to an array of opened [[EditableSettingsCloudContainer]]s.\n * @note Requires [[IModelHost.authorizationClient]] and [[BlobContainer.service]] to be configured.\n */\n findContainers(args: SettingsEditor.QuerySettingsContainersArgs): Promise<EditableSettingsCloudContainer[]>;\n\n /**\n * Closes this editor. All settings containers are dropped.\n */\n close(): void;\n}\n"]}
|