@itwin/core-backend 5.4.0-dev.7 → 5.5.0-dev.1
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 +30 -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/ECSqlStatement.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.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +20 -17
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelDbFonts.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +11 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +6 -0
- 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.d.ts +1 -0
- package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +7 -0
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +8 -0
- package/lib/cjs/NavigationRelationship.d.ts.map +1 -1
- package/lib/cjs/NavigationRelationship.js +12 -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.d.ts +16 -4
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +25 -3
- 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.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +9 -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/NativePlatform.js.map +1 -1
- package/lib/cjs/internal/NoLocks.js.map +1 -1
- package/lib/cjs/internal/OnlineStatus.d.ts +15 -0
- package/lib/cjs/internal/OnlineStatus.d.ts.map +1 -0
- package/lib/cjs/internal/OnlineStatus.js +28 -0
- package/lib/cjs/internal/OnlineStatus.js.map +1 -0
- 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/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +12 -0
- 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/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/ECSqlStatement.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.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +20 -17
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelDbFonts.js.map +1 -1
- package/lib/esm/IModelElementCloneContext.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +11 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +6 -0
- 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.d.ts +1 -0
- package/lib/esm/LocalhostIpcHost.d.ts.map +1 -1
- package/lib/esm/LocalhostIpcHost.js +1 -1
- package/lib/esm/LocalhostIpcHost.js.map +1 -1
- package/lib/esm/LockControl.js.map +1 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/NativeAppStorage.js.map +1 -1
- package/lib/esm/NativeHost.d.ts.map +1 -1
- package/lib/esm/NativeHost.js +8 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/NavigationRelationship.d.ts +8 -0
- package/lib/esm/NavigationRelationship.d.ts.map +1 -1
- package/lib/esm/NavigationRelationship.js +10 -0
- 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.d.ts +16 -4
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +25 -3
- 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.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +9 -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/NativePlatform.js.map +1 -1
- package/lib/esm/internal/NoLocks.js.map +1 -1
- package/lib/esm/internal/OnlineStatus.d.ts +15 -0
- package/lib/esm/internal/OnlineStatus.d.ts.map +1 -0
- package/lib/esm/internal/OnlineStatus.js +24 -0
- package/lib/esm/internal/OnlineStatus.js.map +1 -0
- 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/SettingsImpl.js.map +1 -1
- package/lib/esm/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js +13 -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/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 +15 -15
- 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.map +1 -1
- package/lib/esm/test/ecdb/ECSqlReader.test.js +16 -16
- package/lib/esm/test/ecdb/ECSqlReader.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/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 +49 -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 +132 -34
- 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 +197 -41
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imageData.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.js +369 -248
- 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 +47 -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.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +27 -8
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IModelSchemaLocater.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +4 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +14 -4
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.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.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +24 -0
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +124 -124
- 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/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/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/workspace/Settings.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 +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationRelationship.d.ts","sourceRoot":"","sources":["../../src/NavigationRelationship.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,cAAc;IAC1D,OAAc,aAAa,SAAsC;gBAC9C,QAAQ,EAAE,UAAU,EAAE,YAAY,GAAE,MAA+C;C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
}
|
|
257
|
+
/** Relates an [[Element]] to the [[ChannelRootAspect]] that identifies it as a channel root.
|
|
258
|
+
* @see [[ChannelControl.makeChannelRoot]] to create an instance of this relationship.
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
261
|
+
export class ElementOwnsChannelRootAspect extends ElementOwnsUniqueAspect {
|
|
262
|
+
static classFullName = "BisCore:ElementOwnsChannelRootAspect";
|
|
263
|
+
constructor(elementId, relClassName = ElementOwnsChannelRootAspect.classFullName) {
|
|
264
|
+
super(elementId, relClassName);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
257
267
|
//# sourceMappingURL=NavigationRelationship.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationRelationship.js","sourceRoot":"","sources":["../../src/NavigationRelationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAMH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IACnD,MAAM,CAAC,aAAa,GAAG,kCAAkC,CAAC;IACjE,YAAmB,QAAoB,EAAE,eAAuB,wBAAwB,CAAC,aAAa;QACpG,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,wBAAwB;IACxD,MAAM,CAAU,aAAa,GAAG,6BAA6B,CAAC;IACrE,YAAmB,QAAoB,EAAE,eAAuB,mBAAmB,CAAC,aAAa;QAC/F,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,wBAAwB;IACjE,MAAM,CAAU,aAAa,GAAG,sCAAsC,CAAC;IAC9E,YAAmB,QAAoB,EAAE,eAAuB,4BAA4B,CAAC,aAAa;QACxG,KAAK,CAAC,QA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wBAAwB;IACxE,MAAM,CAAU,aAAa,GAAG,6CAA6C,CAAC;IACrF,YAAmB,QAAoB,EAAE,YAAY,GAAG,mCAAmC,CAAC,aAAa;QACvG,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,uBAAuB;IACnE,MAAM,CAAU,aAAa,GAAG,yCAAyC,CAAC;IAEjF,YAAmB,OAAmB,EAAE,YAAY,GAAG,+BAA+B,CAAC,aAAa;QAClG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/B,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 Relationships\n */\n\n// NOTE: A NavigationRelationship is not an Entity, so is not registered in the ClassRegistry.\n// NOTE: It does, however, have a classFullName property for consistency with Entity subclasses.\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { RelatedElement, TypeDefinition } from \"@itwin/core-common\";\n\n/** Relates a parent Element to child Elements which represent parts of the Entity modeled by the parent Element.\n * @public\n */\nexport class ElementOwnsChildElements extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsChildElements\";\n public constructor(parentId: Id64String, relClassName: string = ElementOwnsChildElements.classFullName) {\n super({ id: parentId, relClassName });\n }\n}\n\n/** Relates a parent [[Subject]] to [[Subject]] child elements.\n * @public\n */\nexport class SubjectOwnsSubjects extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsSubjects\";\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsSubjects.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[Subject]] to [[InformationPartitionElement]] child elements.\n * @public\n */\nexport class SubjectOwnsPartitionElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsPartitionElements\";\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsPartitionElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[Category]] to [[SubCategory]] child elements.\n * @public\n */\nexport class CategoryOwnsSubCategories extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:CategoryOwnsSubCategories\";\n public constructor(parentId: Id64String, relClassName: string = CategoryOwnsSubCategories.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[RenderMaterial]] to [[RenderMaterial]] child elements.\n * @public\n */\nexport class RenderMaterialOwnsRenderMaterials extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:RenderMaterialOwnsRenderMaterials\";\n public constructor(parentId: Id64String, relClassName: string = RenderMaterialOwnsRenderMaterials.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent Element to child Elements which represent **hidden** parts of the Entity.\n * @public\n */\nexport class ElementEncapsulatesElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:ElementEncapsulatesElements\";\n public constructor(parentId: Id64String, relClassName: string = ElementEncapsulatesElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[PhysicalElement]] to [[PhysicalElement]] children that it assembles.\n * @public\n */\nexport class PhysicalElementAssemblesElements extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:PhysicalElementAssemblesElements\";\n public constructor(parentId: Id64String, relClassName: string = PhysicalElementAssemblesElements.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[ExternalSource]] to its [[ExternalSourceAttachment]] children.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceOwnsAttachments extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:ExternalSourceOwnsAttachments\";\n public constructor(parentId: Id64String, relClassName: string = ExternalSourceOwnsAttachments.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a parent [[FolderLink]] to its [[RepositoryLink]] children.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class FolderContainsRepositories extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:FolderContainsRepositories\";\n public constructor(parentId: Id64String, relClassName: string = FolderContainsRepositories.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[SheetIndexFolder]] to the [[SheetIndexEntry]]'s that it contains.\n * @beta\n */\nexport class SheetIndexFolderOwnsEntries extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SheetIndexFolderOwnsEntries\";\n public constructor(parentId: Id64String, relClassName: string = SheetIndexFolderOwnsEntries.classFullName) {\n super(parentId, relClassName );\n }\n}\n\n/** Relates a [[SheetIndex]] to the [SheetIndexEntry]]'s that it contains.\n * @beta\n */\nexport class SheetIndexOwnsEntries extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SheetIndexOwnsEntries\";\n public constructor(parentId: Id64String, relClassName: string = SheetIndexOwnsEntries.classFullName) {\n super(parentId, relClassName );\n }\n}\n\n/** Relates a [[GeometricElement2d]] to its [[TypeDefinitionElement]]\n * @public\n */\nexport class GeometricElement2dHasTypeDefinition extends TypeDefinition {\n public static classFullName = \"BisCore:GeometricElement2dHasTypeDefinition\";\n public constructor(id: Id64String, relClassName: string = GeometricElement2dHasTypeDefinition.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[GraphicalElement2d]] to its [[GraphicalType2d]]\n * @public\n */\nexport class GraphicalElement2dIsOfType extends GeometricElement2dHasTypeDefinition {\n public static override classFullName = \"BisCore:GraphicalElement2dIsOfType\";\n public constructor(id: Id64String, relClassName: string = GraphicalElement2dIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[GeometricElement3d]] to its [[TypeDefinitionElement]]\n * @public\n */\nexport class GeometricElement3dHasTypeDefinition extends TypeDefinition {\n public static classFullName = \"BisCore:GeometricElement3dHasTypeDefinition\";\n public constructor(id: Id64String, relClassName: string = GeometricElement3dHasTypeDefinition.classFullName) {\n super({ id, relClassName });\n }\n}\n\n/** Relates a [[SpatialLocationElement]] to its [[SpatialLocationType]]\n * @public\n */\nexport class SpatialLocationIsOfType extends GeometricElement3dHasTypeDefinition {\n public static override classFullName = \"BisCore:SpatialLocationIsOfType\";\n public constructor(id: Id64String, relClassName: string = SpatialLocationIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[PhysicalElement]] to its [[PhysicalType]]\n * @public\n */\nexport class PhysicalElementIsOfType extends GeometricElement3dHasTypeDefinition {\n public static override classFullName = \"BisCore:PhysicalElementIsOfType\";\n public constructor(id: Id64String, relClassName: string = PhysicalElementIsOfType.classFullName) {\n super(id, relClassName);\n }\n}\n\n/** Relates a [[PhysicalElement]] to its [[PhysicalMaterial]]\n * @public\n */\nexport class PhysicalElementIsOfPhysicalMaterial extends RelatedElement {\n public static classFullName = \"BisCore:PhysicalElementIsOfPhysicalMaterial\";\n public constructor(id: Id64String) {\n super({ id });\n }\n}\n\n/** Relates a [[PhysicalType]] to its [[PhysicalMaterial]]\n * @public\n */\nexport class PhysicalTypeIsOfPhysicalMaterial extends RelatedElement {\n public static classFullName = \"BisCore:PhysicalTypeIsOfPhysicalMaterial\";\n public constructor(id: Id64String) {\n super({ id });\n }\n}\n\n/** Relates an [[Element]] and an [[ElementUniqueAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsUniqueAspect extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsUniqueAspect\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsUniqueAspect.classFullName) {\n super({ id: elementId, relClassName });\n }\n}\n\n/** Relates an [[Element]] and an [[ElementMultiAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsMultiAspects extends RelatedElement {\n public static classFullName = \"BisCore:ElementOwnsMultiAspects\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsMultiAspects.classFullName) {\n super({ id: elementId, relClassName });\n }\n}\n\n/** Relates an [[Element]] and an [[ExternalSourceAspect]] that it owns.\n * @public\n */\nexport class ElementOwnsExternalSourceAspects extends ElementOwnsMultiAspects {\n public static override classFullName = \"BisCore:ElementOwnsExternalSourceAspects\";\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsExternalSourceAspects.classFullName) {\n super(elementId, relClassName);\n }\n}\n\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceIsInRepository extends RelatedElement {\n public static classFullName = \"BisCore:ExternalSourceIsInRepository\";\n public constructor(repositoryId: Id64String, relClassName: string = ExternalSourceIsInRepository.classFullName) {\n super({ id: repositoryId, relClassName });\n }\n}\n\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceAttachmentAttachesSource extends RelatedElement {\n public static classFullName = \"BisCore:ExternalSourceAttachmentAttachesSource\";\n public constructor(externalSourceId: Id64String, relClassName: string = ExternalSourceAttachmentAttachesSource.classFullName) {\n super({ id: externalSourceId, relClassName });\n }\n}\n\n/** Relates a [[SheetReference]] and [[Sheet]] that it refers.\n * @beta\n */\nexport class SheetReferenceRefersToSheet extends RelatedElement {\n public static classFullName = \"BisCore:SheetReferenceRefersToSheet\";\n public constructor(sheetId: Id64String, relClassName: string = SheetReferenceRefersToSheet.classFullName) {\n super({ id: sheetId, relClassName });\n }\n}\n\n/** Relates a [[SheetIndexReference]] to a [[SheetIndex]] it refers.\n * @beta\n */\nexport class SheetIndexReferenceRefersToSheetIndex extends RelatedElement {\n public static classFullName = \"BisCore:SheetIndexReferenceRefersToSheetIndex\";\n public constructor(sheetIndexId: Id64String, relClassName: string = SheetIndexReferenceRefersToSheetIndex.classFullName) {\n super({ id: sheetIndexId, relClassName });\n }\n}\n\n/** Relates a [[Subject]] to the [[ProjectInformationRecord]] that describes its project-level properties.\n * @beta\n */\nexport class SubjectOwnsProjectInformationRecord extends ElementOwnsChildElements {\n public static override classFullName = \"BisCore:SubjectOwnsProjectInformationRecord\";\n public constructor(parentId: Id64String, relClassName = SubjectOwnsProjectInformationRecord.classFullName) {\n super(parentId, relClassName);\n }\n}\n\n/** Relates a [[Sheet]] to the [[SheetInformationAspect]] that hosts its basic [SheetInformation]($common).\n * @see [[SheetInformationAspect.setSheetInformation]] to create an instance of this relationship.\n * @beta\n */\nexport class SheetOwnsSheetInformationAspect extends ElementOwnsUniqueAspect {\n public static override classFullName = \"BisCore:SheetOwnsSheetInformationAspect\";\n\n public constructor(sheetId: Id64String, relClassName = SheetOwnsSheetInformationAspect.classFullName) {\n super(sheetId, relClassName);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationRelationship.js","sourceRoot":"","sources":["../../src/NavigationRelationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAMH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IACnD,MAAM,CAAC,aAAa,GAAG,kCAAkC,CAAC;IACjE,YAAmB,QAAoB,EAAE,eAAuB,wBAAwB,CAAC,aAAa;QACpG,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,wBAAwB;IACxD,MAAM,CAAU,aAAa,GAAG,6BAA6B,CAAC;IACrE,YAAmB,QAAoB,EAAE,eAAuB,mBAAmB,CAAC,aAAa;QAC/F,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,wBAAwB;IACjE,MAAM,CAAU,aAAa,GAAG,sCAAsC,CAAC;IAC9E,YAAmB,QAAoB,EAAE,eAAuB,4BAA4B,CAAC,aAAa;QACxG,KAAK,CAAC,QAAQ,EAA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IACxE,MAAM,CAAU,aAAa,GAAG,6CAA6C,CAAC;IACrF,YAAmB,QAAoB,EAAE,YAAY,GAAG,mCAAmC,CAAC,aAAa;QACvG,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAChC,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,uBAAuB;IACnE,MAAM,CAAU,aAAa,GAAG,yCAAyC,CAAC;IAEjF,YAAmB,OAAmB,EAAE,YAAY,GAAG,+BAA+B,CAAC,aAAa;QAClG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/B,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAChE,MAAM,CAAU,aAAa,GAAG,sCAAsC,CAAC;IAE9E,YAAmB,SAAqB,EAAE,YAAY,GAAG,4BAA4B,CAAC,aAAa;QACjG,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjC,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 Relationships\r\n */\r\n\r\n// NOTE: A NavigationRelationship is not an Entity, so is not registered in the ClassRegistry.\r\n// NOTE: It does, however, have a classFullName property for consistency with Entity subclasses.\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { RelatedElement, TypeDefinition } from \"@itwin/core-common\";\r\n\r\n/** Relates a parent Element to child Elements which represent parts of the Entity modeled by the parent Element.\r\n * @public\r\n */\r\nexport class ElementOwnsChildElements extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsChildElements\";\r\n public constructor(parentId: Id64String, relClassName: string = ElementOwnsChildElements.classFullName) {\r\n super({ id: parentId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a parent [[Subject]] to [[Subject]] child elements.\r\n * @public\r\n */\r\nexport class SubjectOwnsSubjects extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsSubjects\";\r\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsSubjects.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[Subject]] to [[InformationPartitionElement]] child elements.\r\n * @public\r\n */\r\nexport class SubjectOwnsPartitionElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsPartitionElements\";\r\n public constructor(parentId: Id64String, relClassName: string = SubjectOwnsPartitionElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[Category]] to [[SubCategory]] child elements.\r\n * @public\r\n */\r\nexport class CategoryOwnsSubCategories extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:CategoryOwnsSubCategories\";\r\n public constructor(parentId: Id64String, relClassName: string = CategoryOwnsSubCategories.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[RenderMaterial]] to [[RenderMaterial]] child elements.\r\n * @public\r\n */\r\nexport class RenderMaterialOwnsRenderMaterials extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:RenderMaterialOwnsRenderMaterials\";\r\n public constructor(parentId: Id64String, relClassName: string = RenderMaterialOwnsRenderMaterials.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent Element to child Elements which represent **hidden** parts of the Entity.\r\n * @public\r\n */\r\nexport class ElementEncapsulatesElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:ElementEncapsulatesElements\";\r\n public constructor(parentId: Id64String, relClassName: string = ElementEncapsulatesElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[PhysicalElement]] to [[PhysicalElement]] children that it assembles.\r\n * @public\r\n */\r\nexport class PhysicalElementAssemblesElements extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:PhysicalElementAssemblesElements\";\r\n public constructor(parentId: Id64String, relClassName: string = PhysicalElementAssemblesElements.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[ExternalSource]] to its [[ExternalSourceAttachment]] children.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceOwnsAttachments extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:ExternalSourceOwnsAttachments\";\r\n public constructor(parentId: Id64String, relClassName: string = ExternalSourceOwnsAttachments.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a parent [[FolderLink]] to its [[RepositoryLink]] children.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class FolderContainsRepositories extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:FolderContainsRepositories\";\r\n public constructor(parentId: Id64String, relClassName: string = FolderContainsRepositories.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndexFolder]] to the [[SheetIndexEntry]]'s that it contains.\r\n * @beta\r\n */\r\nexport class SheetIndexFolderOwnsEntries extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SheetIndexFolderOwnsEntries\";\r\n public constructor(parentId: Id64String, relClassName: string = SheetIndexFolderOwnsEntries.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndex]] to the [SheetIndexEntry]]'s that it contains.\r\n * @beta\r\n */\r\nexport class SheetIndexOwnsEntries extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SheetIndexOwnsEntries\";\r\n public constructor(parentId: Id64String, relClassName: string = SheetIndexOwnsEntries.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[GeometricElement2d]] to its [[TypeDefinitionElement]]\r\n * @public\r\n */\r\nexport class GeometricElement2dHasTypeDefinition extends TypeDefinition {\r\n public static classFullName = \"BisCore:GeometricElement2dHasTypeDefinition\";\r\n public constructor(id: Id64String, relClassName: string = GeometricElement2dHasTypeDefinition.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[GraphicalElement2d]] to its [[GraphicalType2d]]\r\n * @public\r\n */\r\nexport class GraphicalElement2dIsOfType extends GeometricElement2dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:GraphicalElement2dIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = GraphicalElement2dIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[GeometricElement3d]] to its [[TypeDefinitionElement]]\r\n * @public\r\n */\r\nexport class GeometricElement3dHasTypeDefinition extends TypeDefinition {\r\n public static classFullName = \"BisCore:GeometricElement3dHasTypeDefinition\";\r\n public constructor(id: Id64String, relClassName: string = GeometricElement3dHasTypeDefinition.classFullName) {\r\n super({ id, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SpatialLocationElement]] to its [[SpatialLocationType]]\r\n * @public\r\n */\r\nexport class SpatialLocationIsOfType extends GeometricElement3dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:SpatialLocationIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = SpatialLocationIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to its [[PhysicalType]]\r\n * @public\r\n */\r\nexport class PhysicalElementIsOfType extends GeometricElement3dHasTypeDefinition {\r\n public static override classFullName = \"BisCore:PhysicalElementIsOfType\";\r\n public constructor(id: Id64String, relClassName: string = PhysicalElementIsOfType.classFullName) {\r\n super(id, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalElement]] to its [[PhysicalMaterial]]\r\n * @public\r\n */\r\nexport class PhysicalElementIsOfPhysicalMaterial extends RelatedElement {\r\n public static classFullName = \"BisCore:PhysicalElementIsOfPhysicalMaterial\";\r\n public constructor(id: Id64String) {\r\n super({ id });\r\n }\r\n}\r\n\r\n/** Relates a [[PhysicalType]] to its [[PhysicalMaterial]]\r\n * @public\r\n */\r\nexport class PhysicalTypeIsOfPhysicalMaterial extends RelatedElement {\r\n public static classFullName = \"BisCore:PhysicalTypeIsOfPhysicalMaterial\";\r\n public constructor(id: Id64String) {\r\n super({ id });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ElementUniqueAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsUniqueAspect extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsUniqueAspect\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsUniqueAspect.classFullName) {\r\n super({ id: elementId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ElementMultiAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsMultiAspects extends RelatedElement {\r\n public static classFullName = \"BisCore:ElementOwnsMultiAspects\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsMultiAspects.classFullName) {\r\n super({ id: elementId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] and an [[ExternalSourceAspect]] that it owns.\r\n * @public\r\n */\r\nexport class ElementOwnsExternalSourceAspects extends ElementOwnsMultiAspects {\r\n public static override classFullName = \"BisCore:ElementOwnsExternalSourceAspects\";\r\n public constructor(elementId: Id64String, relClassName: string = ElementOwnsExternalSourceAspects.classFullName) {\r\n super(elementId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceIsInRepository extends RelatedElement {\r\n public static classFullName = \"BisCore:ExternalSourceIsInRepository\";\r\n public constructor(repositoryId: Id64String, relClassName: string = ExternalSourceIsInRepository.classFullName) {\r\n super({ id: repositoryId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates an [[ExternalSource]] to the [[RepositoryLink]] that it is persisted in.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceAttachmentAttachesSource extends RelatedElement {\r\n public static classFullName = \"BisCore:ExternalSourceAttachmentAttachesSource\";\r\n public constructor(externalSourceId: Id64String, relClassName: string = ExternalSourceAttachmentAttachesSource.classFullName) {\r\n super({ id: externalSourceId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SheetReference]] and [[Sheet]] that it refers.\r\n * @beta\r\n */\r\nexport class SheetReferenceRefersToSheet extends RelatedElement {\r\n public static classFullName = \"BisCore:SheetReferenceRefersToSheet\";\r\n public constructor(sheetId: Id64String, relClassName: string = SheetReferenceRefersToSheet.classFullName) {\r\n super({ id: sheetId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[SheetIndexReference]] to a [[SheetIndex]] it refers.\r\n * @beta\r\n */\r\nexport class SheetIndexReferenceRefersToSheetIndex extends RelatedElement {\r\n public static classFullName = \"BisCore:SheetIndexReferenceRefersToSheetIndex\";\r\n public constructor(sheetIndexId: Id64String, relClassName: string = SheetIndexReferenceRefersToSheetIndex.classFullName) {\r\n super({ id: sheetIndexId, relClassName });\r\n }\r\n}\r\n\r\n/** Relates a [[Subject]] to the [[ProjectInformationRecord]] that describes its project-level properties.\r\n * @beta\r\n */\r\nexport class SubjectOwnsProjectInformationRecord extends ElementOwnsChildElements {\r\n public static override classFullName = \"BisCore:SubjectOwnsProjectInformationRecord\";\r\n public constructor(parentId: Id64String, relClassName = SubjectOwnsProjectInformationRecord.classFullName) {\r\n super(parentId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates a [[Sheet]] to the [[SheetInformationAspect]] that hosts its basic [SheetInformation]($common).\r\n * @see [[SheetInformationAspect.setSheetInformation]] to create an instance of this relationship.\r\n * @beta\r\n */\r\nexport class SheetOwnsSheetInformationAspect extends ElementOwnsUniqueAspect {\r\n public static override classFullName = \"BisCore:SheetOwnsSheetInformationAspect\";\r\n\r\n public constructor(sheetId: Id64String, relClassName = SheetOwnsSheetInformationAspect.classFullName) {\r\n super(sheetId, relClassName);\r\n }\r\n}\r\n\r\n/** Relates an [[Element]] to the [[ChannelRootAspect]] that identifies it as a channel root.\r\n * @see [[ChannelControl.makeChannelRoot]] to create an instance of this relationship.\r\n * @public\r\n */\r\nexport class ElementOwnsChannelRootAspect extends ElementOwnsUniqueAspect {\r\n public static override classFullName = \"BisCore:ElementOwnsChannelRootAspect\";\r\n\r\n public constructor(elementId: Id64String, relClassName = ElementOwnsChannelRootAspect.classFullName) {\r\n super(elementId, relClassName);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAUQ;IAT5B,MAAM,CAAK;IACX,KAAK,CAAO;IAEX,UAAU,GAAY,KAAK,CAAC;IAC5B,SAAS,GAAY,KAAK,CAAC;IAEnC,IAAW,SAAS,KAAc,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACjF,IAAW,WAAW,KAAc,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7D,IAAW,UAAU,KAAc,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3D,YAAmC,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QACpD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAM,EAAE,EAAE;YAC3B,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC,CAAC,CAAC,KAAK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AAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\n\n/** Wrapper around a promise that allows synchronous queries of it's state\n * @internal\n */\nexport class QueryablePromise<T> {\n public result?: T;\n public error?: any;\n\n private _fulfilled: boolean = false;\n private _rejected: boolean = false;\n\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\n public get isFulfilled(): boolean { return this._fulfilled; }\n public get isRejected(): boolean { return this._rejected; }\n public constructor(public readonly promise: Promise<T>) {\n this.promise.then((res: T) => {\n this.result = res;\n this._fulfilled = true;\n }).catch((err: any) => {\n this.error = err;\n this._rejected = true;\n });\n }\n}\n\n/** @internal */\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\n/** @internal */\nexport type GenerateKeyFnType = (...args: any[]) => string;\n\n/** Utility to cache and retrieve results of long running asynchronous functions.\n * The cache is keyed on the input arguments passed to these functions\n * @internal\n */\nexport class PromiseMemoizer<T> implements Disposable {\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\n private readonly _timers: Map<string, NodeJS.Timeout> = new Map<string, NodeJS.Timeout>();\n private readonly _memoizeFn: MemoizeFnType<T>;\n private readonly _generateKeyFn: GenerateKeyFnType;\n private readonly _maxCacheSize: number;\n private readonly _cacheTimeout: number;\n\n /**\n * Constructor\n * @param memoizeFn Function to memoize\n * @param generateKeyFn Function to generate the key for the memoized function\n * @param maxCacheSize Maximum size of the memoizer cache.\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\n * threshold, the entire cache is then cleared.\n */\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\n this._memoizeFn = memoizeFn;\n this._generateKeyFn = generateKeyFn;\n this._maxCacheSize = maxCacheSize;\n this._cacheTimeout = cacheTimeout;\n }\n\n /** Call the memoized function */\n public memoize(...args: any[]): QueryablePromise<T> {\n const key: string = this._generateKeyFn(...args);\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\n if (qp)\n return qp;\n\n if (this._cachedPromises.size >= this._maxCacheSize) {\n if (this._maxCacheSize > 1)\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\n this.clearCache();\n }\n\n const removeCachedPromise = (v: T) => {\n const cleanUp = () => {\n this._cachedPromises.delete(key);\n this._timers.delete(key);\n };\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\n return v;\n };\n\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {\n throw removeCachedPromise(e); // eslint-disable-line @typescript-eslint/only-throw-error\n });\n\n qp = new QueryablePromise<T>(p);\n this._cachedPromises.set(key, qp);\n return qp;\n }\n\n /** Delete the memoized function */\n public deleteMemoized(...args: any[]) {\n const key: string = this._generateKeyFn(...args);\n this._cachedPromises.delete(key);\n const timer = this._timers.get(key);\n if (timer)\n clearTimeout(timer);\n }\n\n /** Clear all entries in the memoizer cache */\n public clearCache() {\n this._cachedPromises.clear();\n }\n\n public [Symbol.dispose]() {\n for (const timer of this._timers.values())\n clearTimeout(timer);\n\n this._timers.clear();\n this.clearCache();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PromiseMemoizer.js","sourceRoot":"","sources":["../../src/PromiseMemoizer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAU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5B,cAAc,CAAC,GAAG,IAAW;QAClC,MAAM,GAAG,GAAW,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,KAAK;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,8CAA8C;IACvC,UAAU;QACf,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACvC,YAAY,CAAC,KAAK,CAAC,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF","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\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\n\r\n/** Wrapper around a promise that allows synchronous queries of it's state\r\n * @internal\r\n */\r\nexport class QueryablePromise<T> {\r\n public result?: T;\r\n public error?: any;\r\n\r\n private _fulfilled: boolean = false;\r\n private _rejected: boolean = false;\r\n\r\n public get isPending(): boolean { return !this.isFulfilled && !this.isRejected; }\r\n public get isFulfilled(): boolean { return this._fulfilled; }\r\n public get isRejected(): boolean { return this._rejected; }\r\n public constructor(public readonly promise: Promise<T>) {\r\n this.promise.then((res: T) => {\r\n this.result = res;\r\n this._fulfilled = true;\r\n }).catch((err: any) => {\r\n this.error = err;\r\n this._rejected = true;\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type MemoizeFnType<T> = (...args: any[]) => Promise<T>;\r\n/** @internal */\r\nexport type GenerateKeyFnType = (...args: any[]) => string;\r\n\r\n/** Utility to cache and retrieve results of long running asynchronous functions.\r\n * The cache is keyed on the input arguments passed to these functions\r\n * @internal\r\n */\r\nexport class PromiseMemoizer<T> implements Disposable {\r\n private readonly _cachedPromises: Map<string, QueryablePromise<T>> = new Map<string, QueryablePromise<T>>();\r\n private readonly _timers: Map<string, NodeJS.Timeout> = new Map<string, NodeJS.Timeout>();\r\n private readonly _memoizeFn: MemoizeFnType<T>;\r\n private readonly _generateKeyFn: GenerateKeyFnType;\r\n private readonly _maxCacheSize: number;\r\n private readonly _cacheTimeout: number;\r\n\r\n /**\r\n * Constructor\r\n * @param memoizeFn Function to memoize\r\n * @param generateKeyFn Function to generate the key for the memoized function\r\n * @param maxCacheSize Maximum size of the memoizer cache.\r\n * If the maximum cache size is exceeded, fulfilled/rejected entries are first discarded - these\r\n * may have been unclaimed/orphaned promises. If the cache size is still above the maxCacheSize\r\n * threshold, the entire cache is then cleared.\r\n */\r\n public constructor(memoizeFn: MemoizeFnType<T>, generateKeyFn: GenerateKeyFnType, maxCacheSize: number = 500, cacheTimeout: number = 30000) {\r\n this._memoizeFn = memoizeFn;\r\n this._generateKeyFn = generateKeyFn;\r\n this._maxCacheSize = maxCacheSize;\r\n this._cacheTimeout = cacheTimeout;\r\n }\r\n\r\n /** Call the memoized function */\r\n public memoize(...args: any[]): QueryablePromise<T> {\r\n const key: string = this._generateKeyFn(...args);\r\n let qp: QueryablePromise<T> | undefined = this._cachedPromises.get(key);\r\n if (qp)\r\n return qp;\r\n\r\n if (this._cachedPromises.size >= this._maxCacheSize) {\r\n if (this._maxCacheSize > 1)\r\n Logger.logError(BackendLoggerCategory.PromiseMemoizer, \"Cleared too many unresolved entries in memoizer cache\");\r\n this.clearCache();\r\n }\r\n\r\n const removeCachedPromise = (v: T) => {\r\n const cleanUp = () => {\r\n this._cachedPromises.delete(key);\r\n this._timers.delete(key);\r\n };\r\n this._timers.set(key, setTimeout(cleanUp, this._cacheTimeout));\r\n return v;\r\n };\r\n\r\n const p = this._memoizeFn(...args).then(removeCachedPromise, (e) => {\r\n throw removeCachedPromise(e); // eslint-disable-line @typescript-eslint/only-throw-error\r\n });\r\n\r\n qp = new QueryablePromise<T>(p);\r\n this._cachedPromises.set(key, qp);\r\n return qp;\r\n }\r\n\r\n /** Delete the memoized function */\r\n public deleteMemoized(...args: any[]) {\r\n const key: string = this._generateKeyFn(...args);\r\n this._cachedPromises.delete(key);\r\n const timer = this._timers.get(key);\r\n if (timer)\r\n clearTimeout(timer);\r\n }\r\n\r\n /** Clear all entries in the memoizer cache */\r\n public clearCache() {\r\n this._cachedPromises.clear();\r\n }\r\n\r\n public [Symbol.dispose]() {\r\n for (const timer of this._timers.values())\r\n clearTimeout(timer);\r\n\r\n this._timers.clear();\r\n this.clearCache();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyStore.js","sourceRoot":"","sources":["../../src/PropertyStore.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,YAAY;AACZ,MAAM,KAAW,aAAa,CAuP7B;AAvPD,WAAiB,aAAa;IAyB5B;;OAEG;IACH,MAAa,UAAW,SAAQ,iBAAiB;QACtB,SAAS,GAAG,OAAO,CAAC;QAE1B,SAAS;YAC1B,IAAI,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,2CAA2C,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1H,CAAC;QAED;;WAEG;QACI,WAAW,CAAC,IAAkB;YACnC,OAAO,IAAI,CAAC,2BAA2B,CAAC,gDAAgD,EAAE,CAAC,IAAI,EAAE,EAAE;gBACj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;;;;;WAKG;QACI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAA2C;YAC1E,OAAO,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACrF,CAAC;QAED;;WAEG;QACI,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAA6B;YAClE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACrI,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;KACF;IAvBY,yBAAW,cAuBvB,CAAA;AACH,CAAC,EAvPgB,aAAa,KAAb,aAAa,QAuP7B","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\n/** @packageDocumentation\n * @module SQLiteDb\n */\n\nimport { BlobContainer } from \"./BlobContainerService\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { VersionedSqliteDb } from \"./SQLiteDb\";\nimport { SettingsContainer } from \"./workspace/Settings\";\n\n/** @beta */\nexport namespace PropertyStore {\n\n /** The set of valid types for properties in a PropertyStore. */\n export type PropertyType = string | number | boolean | Uint8Array | SettingsContainer;\n /** The case-sensitive name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\n export type PropertyName = string;\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\n export type IterationReturn = void | \"stop\";\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\n export type PropertyIteration = (name: string) => IterationReturn;\n\n /** A filter used to limit and/or sort the values returned by an iteration. */\n export interface PropertyFilter {\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\n readonly value?: string;\n /** The comparison operator for `value`. Default is `=` */\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"!=\" | \"<\" | \">\";\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\n readonly orderBy?: \"ASC\" | \"DESC\";\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\n readonly sqlExpression?: string;\n }\n\n /**\n * A SQLite database for storing PropertyName/PropertyValue pairs.\n */\n export class PropertyDb extends VersionedSqliteDb {\n public override readonly myVersion = \"3.0.0\";\n\n protected override createDDL() {\n this.createTable({ tableName: \"properties\", columns: \"name TEXT NOT NULL PRIMARY KEY,type,value\", addTimestamp: true });\n }\n\n /** get the value of a Property by name.\n * @returns the property's value if it exists, `undefined` otherwise.\n */\n public getProperty(name: PropertyName): PropertyType | undefined {\n return this.withPreparedSqliteStatement(\"SELECT type,value from properties WHERE name=?\", (stmt) => {\n stmt.bindString(1, name);\n if (!stmt.nextRow())\n return undefined;\n switch (stmt.getValueString(0)) {\n case \"string\":\n return stmt.getValueString(1);\n case \"boolean\":\n return stmt.getValueInteger(1) !== 0;\n case \"blob\":\n return stmt.getValueBlob(1);\n case \"number\":\n return stmt.getValueDouble(1);\n case \"object\":\n return JSON.parse(stmt.getValueString(1)) as SettingsContainer;\n }\n return undefined;\n });\n }\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\n */\n public getString(name: PropertyName, defaultValue: string): string;\n /** Get the value of a string property by name.\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\n */\n public getString(name: PropertyName): string | undefined;\n public getString(name: PropertyName, defaultValue?: string): string | undefined {\n const out = this.getProperty(name);\n return typeof out === \"string\" ? out : defaultValue;\n }\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\n */\n public getBoolean(name: PropertyName): boolean | undefined;\n /** Get the value of a boolean property by name.\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\n */\n public getBoolean(name: PropertyName, defaultValue: boolean): boolean;\n public getBoolean(name: PropertyName, defaultValue?: boolean): boolean | undefined {\n const out = this.getProperty(name);\n return typeof out === \"boolean\" ? out : defaultValue;\n }\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\n */\n public getNumber(name: PropertyName): number | undefined;\n /** Get the value of a number property by name.\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\n */\n public getNumber(name: PropertyName, defaultValue: number): number;\n public getNumber(name: PropertyName, defaultValue?: number): number | undefined {\n const out = this.getProperty(name);\n return typeof out === \"number\" ? out : defaultValue;\n }\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\n */\n public getBlob(name: PropertyName): Uint8Array | undefined;\n /** Get the value of a blob property by name.\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\n */\n public getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\n public getBlob(name: PropertyName, defaultValue?: Uint8Array): Uint8Array | undefined {\n const out = this.getProperty(name);\n return out instanceof Uint8Array ? out : defaultValue;\n }\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\n */\n public getObject(name: PropertyName): SettingsContainer | undefined;\n /** Get the value of an object property by name.\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\n */\n public getObject(name: PropertyName, defaultValue: SettingsContainer): SettingsContainer;\n public getObject(name: PropertyName, defaultValue?: SettingsContainer): SettingsContainer | undefined {\n const out = this.getProperty(name);\n return typeof out === \"object\" ? out as SettingsContainer : defaultValue;\n }\n\n /** call an iteration function for each property, optionally applying a filter */\n public forAllProperties(iter: PropertyIteration, filter?: PropertyFilter) {\n let sql = \"SELECT name FROM properties WHERE name IS NOT NULL\";\n if (filter?.sqlExpression)\n sql += ` AND ${filter.sqlExpression} `;\n if (filter?.value)\n sql += ` AND name ${filter.valueCompare ?? \"=\"} @val`;\n if (filter?.orderBy)\n sql += ` ORDER BY name ${filter.orderBy} `;\n\n this.withSqliteStatement(sql, (stmt) => {\n if (filter?.value)\n stmt.bindString(\"@val\", filter.value);\n\n while (stmt.nextRow()) {\n if (iter(stmt.getValueString(0)) === \"stop\")\n return;\n }\n });\n }\n\n /** Delete a single property from this PropertyDb. If the value does not exist, this method does nothing.\n * @note the database must be opened for write\n */\n public async deleteProperty(propName: PropertyName) {\n this.withSqliteStatement(\"DELETE from properties WHERE name=?\", (stmt) => {\n stmt.bindString(1, propName);\n stmt.stepForWrite();\n });\n }\n /** Delete an array of properties from this PropertyDb. Any value that does not exist is ignored.\n * @note the database must be opened for write\n */\n public async deleteProperties(propNames: PropertyName[]) {\n propNames.forEach(async (name) => this.deleteProperty(name));\n }\n\n private validateName(name: PropertyName) {\n if (typeof name !== \"string\" || name.trim() !== name || name.length > 2 * 1024 || name.length < 2)\n throw new Error(`illegal property name[${name}]`);\n }\n\n /** Save a single property in this PropertyDb. If the property already exists, its value is overwritten.\n * @note the database must be opened for write\n */\n public async saveProperty(name: PropertyName, value: PropertyType) {\n this.validateName(name);\n this.withSqliteStatement(\"INSERT OR REPLACE INTO properties(name,type,value) VALUES (?,?,?)\", (stmt) => {\n stmt.bindString(1, name);\n switch (typeof value) {\n case \"string\":\n stmt.bindString(2, \"string\");\n stmt.bindString(3, value);\n break;\n case \"boolean\":\n stmt.bindString(2, \"boolean\");\n stmt.bindInteger(3, value ? 1 : 0);\n break;\n case \"number\":\n stmt.bindString(2, \"number\");\n stmt.bindDouble(3, value);\n break;\n case \"object\":\n if (value instanceof Uint8Array) {\n stmt.bindString(2, \"blob\");\n stmt.bindBlob(3, value);\n } else {\n stmt.bindString(2, \"object\");\n stmt.bindString(3, JSON.stringify(value));\n }\n break;\n default:\n throw new Error(\"illegal property value type\");\n }\n\n stmt.stepForWrite();\n });\n }\n\n /** Save an array of properties in this PropertyDb. If a property already exists, its value is overwritten.\n * @note the database must be opened for write\n */\n public async saveProperties(props: PropertyArray) {\n for (const prop of props)\n await this.saveProperty(prop.name, prop.value);\n }\n }\n\n const defaultDbName = \"PropertyDb\";\n\n export interface CreateNewContainerProps {\n scope: BlobContainer.Scope;\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\n }\n\n /**\n * Provides access to a cloud-based `PropertyDb` to hold a set of values of type `PropertyType`, each with a unique `PropertyName`.\n * `PropertyStore.PropertyDb`s that are stored in cloud containers require an access token that grants permission to read and/or write them.\n * All write operations will fail without an access token that grants write permission.\n *\n * The database is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\n */\n export class CloudAccess extends CloudSqlite.DbAccess<PropertyDb> {\n public constructor(props: CloudSqlite.ContainerAccessProps) {\n super({ dbType: PropertyDb, props, dbName: defaultDbName });\n }\n\n /**\n * Initialize a cloud container for use as a PropertyStore. This method is called by [[createNewContainer]].\n * It is only necessary to convert an existing container to a PropertyStore container.\n * @note this deletes any existing content in the container.\n * @internal\n */\n public static async initializeDb(args: { props: CloudSqlite.ContainerProps }) {\n return super._initializeDb({ ...args, dbType: PropertyDb, dbName: defaultDbName });\n }\n\n /** Create and initialize a new BlobContainer to hold a PropertyStore\n * @note the current user must have administrator rights to create containers.\n */\n public static async createNewContainer(args: CreateNewContainerProps): Promise<CloudSqlite.ContainerProps> {\n const props = await this.createBlobContainer({ scope: args.scope, metadata: { ...args.metadata, containerType: \"property-store\" } });\n await this.initializeDb({ props });\n return props;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyStore.js","sourceRoot":"","sources":["../../src/PropertyStore.ts"],"names":[],"mappings":"AAAA;;;+FAG+F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AAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QAED;;WAEG;QACI,KAAK,CAAC,cAAc,CAAC,KAAoB;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK;gBACtB,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACnD,CAAC;KACF;IAjLY,wBAAU,aAiLtB,CAAA;IAED,MAAM,aAAa,GAAG,YAAY,CAAC;IAOnC;;;;;;;;OAQG;IACH,MAAa,WAAY,SAAQ,WAAW,CAAC,QAAoB;QAC/D,YAAmB,KAAuC;YACxD,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED;;;;;WAKG;QACI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAA2C;YAC1E,OAAO,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACrF,CAAC;QAED;;WAEG;QACI,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAA6B;YAClE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACrI,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;KACF;IAvBY,yBAAW,cAuBvB,CAAA;AACH,CAAC,EAvPgB,aAAa,KAAb,aAAa,QAuP7B","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\r\n/** @packageDocumentation\r\n * @module SQLiteDb\r\n */\r\n\r\nimport { BlobContainer } from \"./BlobContainerService\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { VersionedSqliteDb } from \"./SQLiteDb\";\r\nimport { SettingsContainer } from \"./workspace/Settings\";\r\n\r\n/** @beta */\r\nexport namespace PropertyStore {\r\n\r\n /** The set of valid types for properties in a PropertyStore. */\r\n export type PropertyType = string | number | boolean | Uint8Array | SettingsContainer;\r\n /** The case-sensitive name of a Property. May not have leading or trailing spaces, and must be between 3 and 2048 characters long. */\r\n export type PropertyName = string;\r\n /** An array of PropertyName/PropertyType pairs to be stored in a PropertyStore. */\r\n export type PropertyArray = { name: PropertyName, value: PropertyType }[];\r\n /** The return status of an iteration function. The value \"stop\" causes the iteration to terminate. */\r\n export type IterationReturn = void | \"stop\";\r\n /** An iteration function over Properties in a PropertyStore. It is called with the name of a each Property. */\r\n export type PropertyIteration = (name: string) => IterationReturn;\r\n\r\n /** A filter used to limit and/or sort the values returned by an iteration. */\r\n export interface PropertyFilter {\r\n /** A value filter. May include wild cards when used with `GLOB` or `LIKE` */\r\n readonly value?: string;\r\n /** The comparison operator for `value`. Default is `=` */\r\n readonly valueCompare?: \"GLOB\" | \"LIKE\" | \"NOT GLOB\" | \"NOT LIKE\" | \"=\" | \"!=\" | \"<\" | \">\";\r\n /** Order results ascending or descending. If not supplied, the results are unordered (random). */\r\n readonly orderBy?: \"ASC\" | \"DESC\";\r\n /** An SQL expression to further filter results. This string is appended to the `WHERE` clause with an `AND` (that should not be part of the sqlExpression) */\r\n readonly sqlExpression?: string;\r\n }\r\n\r\n /**\r\n * A SQLite database for storing PropertyName/PropertyValue pairs.\r\n */\r\n export class PropertyDb extends VersionedSqliteDb {\r\n public override readonly myVersion = \"3.0.0\";\r\n\r\n protected override createDDL() {\r\n this.createTable({ tableName: \"properties\", columns: \"name TEXT NOT NULL PRIMARY KEY,type,value\", addTimestamp: true });\r\n }\r\n\r\n /** get the value of a Property by name.\r\n * @returns the property's value if it exists, `undefined` otherwise.\r\n */\r\n public getProperty(name: PropertyName): PropertyType | undefined {\r\n return this.withPreparedSqliteStatement(\"SELECT type,value from properties WHERE name=?\", (stmt) => {\r\n stmt.bindString(1, name);\r\n if (!stmt.nextRow())\r\n return undefined;\r\n switch (stmt.getValueString(0)) {\r\n case \"string\":\r\n return stmt.getValueString(1);\r\n case \"boolean\":\r\n return stmt.getValueInteger(1) !== 0;\r\n case \"blob\":\r\n return stmt.getValueBlob(1);\r\n case \"number\":\r\n return stmt.getValueDouble(1);\r\n case \"object\":\r\n return JSON.parse(stmt.getValueString(1)) as SettingsContainer;\r\n }\r\n return undefined;\r\n });\r\n }\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, `undefined` otherwise.\r\n */\r\n public getString(name: PropertyName, defaultValue: string): string;\r\n /** Get the value of a string property by name.\r\n * @returns the property's value if it exists and is a string, otherwise the supplied default value.\r\n */\r\n public getString(name: PropertyName): string | undefined;\r\n public getString(name: PropertyName, defaultValue?: string): string | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"string\" ? out : defaultValue;\r\n }\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, `undefined` otherwise.\r\n */\r\n public getBoolean(name: PropertyName): boolean | undefined;\r\n /** Get the value of a boolean property by name.\r\n * @returns the property's value if it exists and is a boolean, otherwise the supplied default value.\r\n */\r\n public getBoolean(name: PropertyName, defaultValue: boolean): boolean;\r\n public getBoolean(name: PropertyName, defaultValue?: boolean): boolean | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"boolean\" ? out : defaultValue;\r\n }\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, `undefined` otherwise.\r\n */\r\n public getNumber(name: PropertyName): number | undefined;\r\n /** Get the value of a number property by name.\r\n * @returns the property's value if it exists and is a number, otherwise the supplied default value.\r\n */\r\n public getNumber(name: PropertyName, defaultValue: number): number;\r\n public getNumber(name: PropertyName, defaultValue?: number): number | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"number\" ? out : defaultValue;\r\n }\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, `undefined` otherwise.\r\n */\r\n public getBlob(name: PropertyName): Uint8Array | undefined;\r\n /** Get the value of a blob property by name.\r\n * @returns the property's value if it exists and is a blob, otherwise the supplied default value.\r\n */\r\n public getBlob(name: PropertyName, defaultValue: Uint8Array): Uint8Array;\r\n public getBlob(name: PropertyName, defaultValue?: Uint8Array): Uint8Array | undefined {\r\n const out = this.getProperty(name);\r\n return out instanceof Uint8Array ? out : defaultValue;\r\n }\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, `undefined` otherwise.\r\n */\r\n public getObject(name: PropertyName): SettingsContainer | undefined;\r\n /** Get the value of an object property by name.\r\n * @returns the property's value if it exists and is an object, otherwise the supplied default value.\r\n */\r\n public getObject(name: PropertyName, defaultValue: SettingsContainer): SettingsContainer;\r\n public getObject(name: PropertyName, defaultValue?: SettingsContainer): SettingsContainer | undefined {\r\n const out = this.getProperty(name);\r\n return typeof out === \"object\" ? out as SettingsContainer : defaultValue;\r\n }\r\n\r\n /** call an iteration function for each property, optionally applying a filter */\r\n public forAllProperties(iter: PropertyIteration, filter?: PropertyFilter) {\r\n let sql = \"SELECT name FROM properties WHERE name IS NOT NULL\";\r\n if (filter?.sqlExpression)\r\n sql += ` AND ${filter.sqlExpression} `;\r\n if (filter?.value)\r\n sql += ` AND name ${filter.valueCompare ?? \"=\"} @val`;\r\n if (filter?.orderBy)\r\n sql += ` ORDER BY name ${filter.orderBy} `;\r\n\r\n this.withSqliteStatement(sql, (stmt) => {\r\n if (filter?.value)\r\n stmt.bindString(\"@val\", filter.value);\r\n\r\n while (stmt.nextRow()) {\r\n if (iter(stmt.getValueString(0)) === \"stop\")\r\n return;\r\n }\r\n });\r\n }\r\n\r\n /** Delete a single property from this PropertyDb. If the value does not exist, this method does nothing.\r\n * @note the database must be opened for write\r\n */\r\n public async deleteProperty(propName: PropertyName) {\r\n this.withSqliteStatement(\"DELETE from properties WHERE name=?\", (stmt) => {\r\n stmt.bindString(1, propName);\r\n stmt.stepForWrite();\r\n });\r\n }\r\n /** Delete an array of properties from this PropertyDb. Any value that does not exist is ignored.\r\n * @note the database must be opened for write\r\n */\r\n public async deleteProperties(propNames: PropertyName[]) {\r\n propNames.forEach(async (name) => this.deleteProperty(name));\r\n }\r\n\r\n private validateName(name: PropertyName) {\r\n if (typeof name !== \"string\" || name.trim() !== name || name.length > 2 * 1024 || name.length < 2)\r\n throw new Error(`illegal property name[${name}]`);\r\n }\r\n\r\n /** Save a single property in this PropertyDb. If the property already exists, its value is overwritten.\r\n * @note the database must be opened for write\r\n */\r\n public async saveProperty(name: PropertyName, value: PropertyType) {\r\n this.validateName(name);\r\n this.withSqliteStatement(\"INSERT OR REPLACE INTO properties(name,type,value) VALUES (?,?,?)\", (stmt) => {\r\n stmt.bindString(1, name);\r\n switch (typeof value) {\r\n case \"string\":\r\n stmt.bindString(2, \"string\");\r\n stmt.bindString(3, value);\r\n break;\r\n case \"boolean\":\r\n stmt.bindString(2, \"boolean\");\r\n stmt.bindInteger(3, value ? 1 : 0);\r\n break;\r\n case \"number\":\r\n stmt.bindString(2, \"number\");\r\n stmt.bindDouble(3, value);\r\n break;\r\n case \"object\":\r\n if (value instanceof Uint8Array) {\r\n stmt.bindString(2, \"blob\");\r\n stmt.bindBlob(3, value);\r\n } else {\r\n stmt.bindString(2, \"object\");\r\n stmt.bindString(3, JSON.stringify(value));\r\n }\r\n break;\r\n default:\r\n throw new Error(\"illegal property value type\");\r\n }\r\n\r\n stmt.stepForWrite();\r\n });\r\n }\r\n\r\n /** Save an array of properties in this PropertyDb. If a property already exists, its value is overwritten.\r\n * @note the database must be opened for write\r\n */\r\n public async saveProperties(props: PropertyArray) {\r\n for (const prop of props)\r\n await this.saveProperty(prop.name, prop.value);\r\n }\r\n }\r\n\r\n const defaultDbName = \"PropertyDb\";\r\n\r\n export interface CreateNewContainerProps {\r\n scope: BlobContainer.Scope;\r\n metadata: Omit<BlobContainer.Metadata, \"containerType\">;\r\n }\r\n\r\n /**\r\n * Provides access to a cloud-based `PropertyDb` to hold a set of values of type `PropertyType`, each with a unique `PropertyName`.\r\n * `PropertyStore.PropertyDb`s that are stored in cloud containers require an access token that grants permission to read and/or write them.\r\n * All write operations will fail without an access token that grants write permission.\r\n *\r\n * The database is cached on a local drive so reads are fast and inexpensive, and may even be done offline after a prefetch.\r\n * However, that means that callers are responsible for synchronizing the local cache to ensure it includes changes\r\n * made by others, as appropriate (see [[synchronizeWithCloud]]).\r\n */\r\n export class CloudAccess extends CloudSqlite.DbAccess<PropertyDb> {\r\n public constructor(props: CloudSqlite.ContainerAccessProps) {\r\n super({ dbType: PropertyDb, props, dbName: defaultDbName });\r\n }\r\n\r\n /**\r\n * Initialize a cloud container for use as a PropertyStore. This method is called by [[createNewContainer]].\r\n * It is only necessary to convert an existing container to a PropertyStore container.\r\n * @note this deletes any existing content in the container.\r\n * @internal\r\n */\r\n public static async initializeDb(args: { props: CloudSqlite.ContainerProps }) {\r\n return super._initializeDb({ ...args, dbType: PropertyDb, dbName: defaultDbName });\r\n }\r\n\r\n /** Create and initialize a new BlobContainer to hold a PropertyStore\r\n * @note the current user must have administrator rights to create containers.\r\n */\r\n public static async createNewContainer(args: CreateNewContainerProps): Promise<CloudSqlite.ContainerProps> {\r\n const props = await this.createBlobContainer({ scope: args.scope, metadata: { ...args.metadata, containerType: \"property-store\" } });\r\n await this.initializeDb({ props });\r\n return props;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,YAAY,EA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,KAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF","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 Relationships\n */\n\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { EntityReferenceSet, IModelError, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\nimport { RelationshipClass } from \"@itwin/ecschema-metadata\";\n\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\n\n/** Base class for all link table ECRelationships\n * @public\n */\nexport class Relationship extends Entity {\n public static override get className(): string { return \"Relationship\"; }\n public readonly sourceId: Id64String;\n public readonly targetId: Id64String;\n\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\n super(props, iModel);\n this.sourceId = Id64.fromJSON(props.sourceId);\n this.targetId = Id64.fromJSON(props.targetId);\n }\n\n public override toJSON(): RelationshipProps {\n const val = super.toJSON() as RelationshipProps;\n val.sourceId = this.sourceId;\n val.targetId = this.targetId;\n return val;\n }\n\n /** Query metadata for this relationship class from the iModel's schema. Returns cached metadata if available.*/\n public override async getMetaData(): Promise<RelationshipClass> {\n if (this._metadata && RelationshipClass.isRelationshipClass(this._metadata)) {\n return this._metadata;\n }\n\n const relationship = await this.iModel.schemaContext.getSchemaItem(this.schemaItemKey, RelationshipClass);\n if (relationship !== undefined) {\n this._metadata = relationship;\n return this._metadata;\n } else {\n throw new Error(`Cannot get metadata for ${this.classFullName}`);\n }\n }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\n * This callback is invoked after the input element has been processed by upstream relationships.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\n * @param _props The ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /**\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\n * @param _props The deleted ElementDrivesElement relationship instance.\n * @param _iModel The iModel\n */\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\n\n /** Insert this Relationship into the iModel. */\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\n /** Update this Relationship in the iModel. */\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\n /** Delete this Relationship from the iModel. */\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\n\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\n}\n\n/** A Relationship where one Element refers to another Element\n * @public\n */\nexport class ElementRefersToElements extends Relationship {\n public static override get className(): string { return \"ElementRefersToElements\"; }\n /** Create an instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return an instance of the specified class.\n */\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\n }\n /** Insert a new instance of the Relationship.\n * @param iModel The iModel that will contain the relationship\n * @param sourceId The sourceId of the relationship, that is, the driver element\n * @param targetId The targetId of the relationship, that is, the driven element\n * @return The Id of the inserted Relationship.\n */\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\n const relationship: T = this.create(iModel, sourceId, targetId);\n return iModel.relationships.insertInstance(relationship.toJSON());\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\n * @public\n */\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\n}\n\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\n * @public\n */\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\n * Each relationship instance represents an external source processed by the synchronization configuration.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\n}\n\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\n}\n\n/** Properties that are common to all types of link table ECRelationships\n * @public\n */\nexport interface ElementGroupsMembersProps extends RelationshipProps {\n memberPriority: number;\n}\n\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\n * @public\n */\nexport class ElementGroupsMembers extends ElementRefersToElements {\n public static override get className(): string { return \"ElementGroupsMembers\"; }\n public memberPriority: number;\n\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\n super(props, iModel);\n this.memberPriority = props.memberPriority;\n }\n\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n}\n\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\n * @public\n */\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\n}\n\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\n * Implies that properties of the group should be considered as properties of its members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\n * @public\n */\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\n}\n\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\n}\n\n/** Properties that are common to all types of ElementDrivesElements\n * @beta\n */\nexport interface ElementDrivesElementProps extends RelationshipProps {\n status: number;\n priority: number;\n}\n\n/** A Relationship indicating that one Element *drives* another Element.\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\n *\n * # Defining dependencies\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\n * ```ts\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\n * ede.insert();\n * ```\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\n *\n * # Defining dependency graphs\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\n *\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * ede12.insert();\n * ede23.insert();\n * ```\n * Those two relationships create this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * Where the \"-->\" is meant to represent a driving relationship.\n *\n * The order in which you create the relationships does not matter.\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\n *\n * An ElementDrivesElement relationship is between one source element and one target element.\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\n * Thus, you can define many:many relationships.\n * For example:\n * ```ts\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\n * ede12.insert();\n * ede112.insert();\n * ede23.insert();\n * ede231.insert();\n * ```\n * Creates this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\n *\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\n *\n * # Subgraph Processing\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\n * suppose we have this graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\n *\n * If only e2 changes, then the subgraph to be processed is just:\n * ```\n * e2 --> e3\n * ```\n * If only e3 changes, then the subgraph consists of e3 by itself.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed, the affected subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * If e2 is changed, the affected subgraph is:\n * ```\n * e3\n * /\n * e2\n * \\\n * e31\n * ```\n * # Callbacks\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\n *\n * ## ElementDrivesElement Callbacks\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\n * * onRootChanged\n * * onDeletedDependency\n *\n * Note that these are static methods. Their default implementations do nothing.\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\n * The subclass should then implement the callbacks that it would like to act on.\n *\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\n *\n * ## Element Callbacks\n * The following callbacks are invoked on Element classes (nodes):\n * * Element.onBeforeOutputsHandled\n * * Element.onAllInputsHandled\n *\n * ## Order\n * Callbacks are invoked by BriefcaseDb.saveChanges.\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\n *\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\n * invoked only once.\n *\n * For example, suppose we have a graph:\n * ```\n * e1 --> e2 --> e3\n * ```\n *\n * Suppose that e1 is directly modified. No callbacks are made at that time.\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n *\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\n *\n * Returning to the second example above, suppose we have this graph:\n * ```\n * e1 e3\n * \\ /\n * e2\n * / \\\n * e11 e31\n * ```\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\n * ```\n * e1 e3\n * \\ /\n * e2\n * \\\n * e31\n * ```\n * The callbacks are:\n * 1. Element.onBeforeOutputsHandled e1\n * 1. ElementDrivesElement.onRootChanged e1->e2\n * 1. Element.onAllInputsHandled e2\n * 1. ElementDrivesElement.onRootChanged e2->e3\n * 1. Element.onAllInputsHandled e3\n * 1. ElementDrivesElement.onRootChanged e2->e31\n * 1. Element.onAllInputsHandled e31\n *\n * (The ElementDrivesElement.)\n *\n * #Errors\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\n * involved in a cycle will have their status set to 1, indicating a failure.\n *\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\n *\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\n *\n * @beta\n */\nexport class ElementDrivesElement extends Relationship {\n public static override get className(): string { return \"ElementDrivesElement\"; }\n /** Relationship status\n * * 0 indicates no errors. Set after a successful evaluation.\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\n */\n public status: number;\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\n public priority: number;\n\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\n super(props, iModel);\n this.status = props.status;\n this.priority = props.priority;\n }\n\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\n return iModel.relationships.createInstance(props) as T;\n }\n\n public override toJSON(): ElementDrivesElementProps {\n const props = super.toJSON() as ElementDrivesElementProps;\n props.status = this.status;\n props.priority = this.priority;\n return props;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addElement(this.targetId);\n }\n}\n\n/** The third (and last) possible link-table relationship base class in an iModel.\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\n * coupling this package with ecschema-metadata which we do not want to do.\n * @internal\n */\nexport class ModelSelectorRefersToModels extends Relationship {\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n referenceIds.addElement(this.sourceId);\n referenceIds.addModel(this.targetId);\n }\n}\n\n/** Manages [[Relationship]]s.\n * @public\n */\nexport class Relationships {\n private _iModel: IModelDb;\n\n /** @internal */\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\n\n /** Create a new instance of a Relationship.\n * @param props The properties of the new Relationship.\n * @throws [[IModelError]] if there is a problem creating the Relationship.\n */\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\n\n /** Check classFullName to ensure it is a link table relationship class. */\n private checkRelationshipClass(classFullName: string) {\n if (!this._iModel[_nativeDb].isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\n }\n }\n\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\n * @param props The properties of the new relationship.\n * @returns The Id of the newly inserted relationship.\n * @note The id property of the props object is set as a side effect of this function.\n */\n public insertInstance(props: RelationshipProps): Id64String {\n this.checkRelationshipClass(props.classFullName);\n return props.id = this._iModel[_nativeDb].insertLinkTableRelationship(props);\n }\n\n /** Update the properties of an existing relationship instance in the iModel.\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\n */\n public updateInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].updateLinkTableRelationship(props);\n }\n\n /** Delete an Relationship instance from this iModel. */\n public deleteInstance(props: RelationshipProps): void {\n this._iModel[_nativeDb].deleteLinkTableRelationship(props);\n }\n\n /** Delete multiple Relationship instances from this iModel.\n * @param props The properties of the relationship instances to delete.\n * @remarks This method handles bulk deletion of relationships and supports mixed collections containing instances from different relationship classes.\n */\n public deleteInstances(props: ReadonlyArray<RelationshipProps>): void {\n this._iModel[_nativeDb].deleteLinkTableRelationships(props);\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstanceProps\n */\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\n if (undefined === relationshipProps) {\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\n }\n return relationshipProps;\n }\n\n /** Get the props of a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstanceProps\n */\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n let props: T | undefined;\n if (typeof criteria === \"string\") {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n } else {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\n stmt.bindId(1, criteria.sourceId);\n stmt.bindId(2, criteria.targetId);\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\n });\n }\n if (undefined !== props) {\n props.classFullName = (props as any).className.replace(\".\", \":\");\n }\n return props;\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\n * @see tryGetInstance\n */\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\n }\n\n /** Get a Relationship instance\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\n * @param criteria Either the relationship instanceId or the source and target Ids\n * @returns The relationship or `undefined` if the relationship is not found.\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\n * @see getInstance\n */\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\n return undefined !== relationshipProps ? this._iModel.constructEntity<T>(relationshipProps) : undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/Relationship.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAsB,WAAW,EAAsC,MAAM,oBAAoB,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAC/B,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAa;IACrB,QAAQ,CAAa;IAErC,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAuB,CAAC;QAChD,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gHAAgH;IAChG,KAAK,CAAC,WAAW;QAC/B,IAAI,IAAI,CAAC,SAAS,IAAI,iBAAiB,CAAC,mBAAmB,CAAC,IAAI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CAAC,CAAC;gBAClC,OAAO,QAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAO,CAAC,CAAC,CAAC,SAAS,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;YACxB,KAAK,CAAC,aAAa,GAAI,KAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAyB,eAAuB,EAAE,QAAsC;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAyB,gBAAwB,EAAE,QAAsC;QAC5G,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAoB,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAClG,OAAO,SAAS,KAAK,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1G,CAAC;CACF","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 Relationships\r\n */\r\n\r\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { EntityReferenceSet, IModelError, RelationshipProps, SourceAndTarget } from \"@itwin/core-common\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\nimport { RelationshipClass } from \"@itwin/ecschema-metadata\";\r\n\r\nexport type { SourceAndTarget, RelationshipProps } from \"@itwin/core-common\"; // for backwards compatibility\r\n\r\n/** Base class for all link table ECRelationships\r\n * @public\r\n */\r\nexport class Relationship extends Entity {\r\n public static override get className(): string { return \"Relationship\"; }\r\n public readonly sourceId: Id64String;\r\n public readonly targetId: Id64String;\r\n\r\n protected constructor(props: RelationshipProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.sourceId = Id64.fromJSON(props.sourceId);\r\n this.targetId = Id64.fromJSON(props.targetId);\r\n }\r\n\r\n public override toJSON(): RelationshipProps {\r\n const val = super.toJSON() as RelationshipProps;\r\n val.sourceId = this.sourceId;\r\n val.targetId = this.targetId;\r\n return val;\r\n }\r\n\r\n /** Query metadata for this relationship class from the iModel's schema. Returns cached metadata if available.*/\r\n public override async getMetaData(): Promise<RelationshipClass> {\r\n if (this._metadata && RelationshipClass.isRelationshipClass(this._metadata)) {\r\n return this._metadata;\r\n }\r\n\r\n const relationship = await this.iModel.schemaContext.getSchemaItem(this.schemaItemKey, RelationshipClass);\r\n if (relationship !== undefined) {\r\n this._metadata = relationship;\r\n return this._metadata;\r\n } else {\r\n throw new Error(`Cannot get metadata for ${this.classFullName}`);\r\n }\r\n }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when its input has changed or is the output of some upstream relationship whose input has changed.\r\n * This callback is invoked after the input element has been processed by upstream relationships.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action. onRootChanged may modify the output element only.\r\n * @param _props The ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onRootChanged(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /**\r\n * Callback invoked by saveChanges on an ElementDrivesElement relationship when the relationship instance has been deleted.\r\n * A subclass of ElementDrivesElement can re-implement this static method to take some action.\r\n * @param _props The deleted ElementDrivesElement relationship instance.\r\n * @param _iModel The iModel\r\n */\r\n public static onDeletedDependency(_props: RelationshipProps, _iModel: IModelDb): void { }\r\n\r\n /** Insert this Relationship into the iModel. */\r\n public insert(): Id64String { return this.id = this.iModel.relationships.insertInstance(this.toJSON()); }\r\n /** Update this Relationship in the iModel. */\r\n public update() { this.iModel.relationships.updateInstance(this.toJSON()); }\r\n /** Delete this Relationship from the iModel. */\r\n public delete() { this.iModel.relationships.deleteInstance(this.toJSON()); }\r\n\r\n public static getInstance<T extends Relationship>(iModel: IModelDb, criteria: Id64String | SourceAndTarget): T { return iModel.relationships.getInstance(this.classFullName, criteria); }\r\n}\r\n\r\n/** A Relationship where one Element refers to another Element\r\n * @public\r\n */\r\nexport class ElementRefersToElements extends Relationship {\r\n public static override get className(): string { return \"ElementRefersToElements\"; }\r\n /** Create an instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return an instance of the specified class.\r\n */\r\n public static create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): T {\r\n return iModel.relationships.createInstance({ sourceId, targetId, classFullName: this.classFullName }) as T;\r\n }\r\n /** Insert a new instance of the Relationship.\r\n * @param iModel The iModel that will contain the relationship\r\n * @param sourceId The sourceId of the relationship, that is, the driver element\r\n * @param targetId The targetId of the relationship, that is, the driven element\r\n * @return The Id of the inserted Relationship.\r\n */\r\n public static insert<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String): Id64String {\r\n const relationship: T = this.create(iModel, sourceId, targetId);\r\n return iModel.relationships.insertInstance(relationship.toJSON());\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** Relates a [[DrawingGraphic]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class DrawingGraphicRepresentsElement extends ElementRefersToElements {\r\n public static override get className(): string { return \"DrawingGraphicRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[GraphicalElement3d]] to the [[Element]] that it represents\r\n * @public\r\n */\r\nexport class GraphicalElement3dRepresentsElement extends ElementRefersToElements {\r\n public static override get className(): string { return \"GraphicalElement3dRepresentsElement\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to N [[ExternalSource]] instances.\r\n * Each relationship instance represents an external source processed by the synchronization configuration.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigProcessesSources extends ElementRefersToElements {\r\n public static override get className(): string { return \"SynchronizationConfigProcessesSources\"; }\r\n}\r\n\r\n/** Relates a [[SynchronizationConfigLink]] to *root* [[ExternalSource]] instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigSpecifiesRootSources extends SynchronizationConfigProcessesSources {\r\n public static override get className(): string { return \"SynchronizationConfigSpecifiesRootSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of link table ECRelationships\r\n * @public\r\n */\r\nexport interface ElementGroupsMembersProps extends RelationshipProps {\r\n memberPriority: number;\r\n}\r\n\r\n/** An ElementRefersToElements relationship where one Element *groups* a set of other Elements.\r\n * @public\r\n */\r\nexport class ElementGroupsMembers extends ElementRefersToElements {\r\n public static override get className(): string { return \"ElementGroupsMembers\"; }\r\n public memberPriority: number;\r\n\r\n constructor(props: ElementGroupsMembersProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.memberPriority = props.memberPriority;\r\n }\r\n\r\n public static override create<T extends ElementRefersToElements>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, memberPriority: number = 0): T {\r\n const props: ElementGroupsMembersProps = { sourceId, targetId, memberPriority, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n}\r\n\r\n/** Relates a [[DefinitionGroup]] to its [[DefinitionElement]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class DefinitionGroupGroupsDefinitions extends ElementGroupsMembers {\r\n public static override get className(): string { return \"DefinitionGroupGroupsDefinitions\"; }\r\n}\r\n\r\n/** Represents group membership where the group Element (and its properties) impart information about the member Elements above mere membership.\r\n * Implies that properties of the group should be considered as properties of its members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.11\r\n * @public\r\n */\r\nexport class GroupImpartsToMembers extends ElementGroupsMembers {\r\n public static override get className(): string { return \"GroupImpartsToMembers\"; }\r\n}\r\n\r\n/** Relates an [[ExternalSourceGroup]] to its [[ExternalSource]] members.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroupGroupsSources extends ElementGroupsMembers {\r\n public static override get className(): string { return \"ExternalSourceGroupGroupsSources\"; }\r\n}\r\n\r\n/** Properties that are common to all types of ElementDrivesElements\r\n * @beta\r\n */\r\nexport interface ElementDrivesElementProps extends RelationshipProps {\r\n status: number;\r\n priority: number;\r\n}\r\n\r\n/** A Relationship indicating that one Element *drives* another Element.\r\n * An ElementDrivesElement relationship defines a one-way \"driving\" relationship from the source to the target.\r\n * When the source of an ElementDrivesElement relationship changes, the ElementDrivesElement itself can get a callback, and both the source and target elements can get callbacks.\r\n * By inserting ElementDrivesElement relationships, an app can create and store an acyclic directed graph of dependencies between elements.\r\n *\r\n * # Defining dependencies\r\n * Create an ElementDrivesElement relationship to specify that the source element drives the target element.\r\n * For example, to specify that element e1 drives element e2, create a relationship between them like this:\r\n * ```ts\r\n * const ede = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * ede.insert();\r\n * ```\r\n * This creates a persistent relationship. The fact that e1 drives e2 is persisted in the iModel.\r\n *\r\n * # Defining dependency graphs\r\n * When you create multiple ElementDrivesElement relationships, you create a network of dependencies. The target of one may be the source of another.\r\n * A change in the content of an DgnElement can therefore trigger changes to many downstream elements.\r\n *\r\n * For example, to make element e1 drive element e2 and e2 drive another element, e3, create two relationships like this:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * ede12.insert();\r\n * ede23.insert();\r\n * ```\r\n * Those two relationships create this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * Where the \"-->\" is meant to represent a driving relationship.\r\n *\r\n * The order in which you create the relationships does not matter.\r\n * The graph indicates that e3 depends on e2 and e2 depends on e1.\r\n *\r\n * An ElementDrivesElement relationship is between one source element and one target element.\r\n * Many ElementDrivesElement relationships can point to a given element, and many can point out of it.\r\n * Thus, you can define many:many relationships.\r\n * For example:\r\n * ```ts\r\n * const ede12 = ElementDrivesElement.create(iModel, e1id, e2id);\r\n * const ede112 = ElementDrivesElement.create(iModel, e11id, e2id);\r\n * const ede23 = ElementDrivesElement.create(iModel, e2id, e3id);\r\n * const ede231 = ElementDrivesElement.create(iModel, e2id, e31id);\r\n * ede12.insert();\r\n * ede112.insert();\r\n * ede23.insert();\r\n * ede231.insert();\r\n * ```\r\n * Creates this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * e2 depends on both e1 and e11. e2 then drives e3 and e31.\r\n *\r\n * In an ElementDrivesElement dependency graph, the relationships are the \"edges\" and the Elements are the \"nodes\".\r\n * The following terms are used when referring to the elements (nodes) in a dependency graph:\r\n * * Inputs - The sources of all edges that point to the element. This includes all upstream elements that flow into the element.\r\n * * Outputs - The targets of all edges that point out of the element. This includes all downstream elements.\r\n *\r\n * # Subgraph Processing\r\n * When changes are made, only the part of the overall graph that is affected will be processed. So, for example,\r\n * suppose we have this graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n * If e1 changes, then the subgraph to be processed is equal to the full graph, as shown.\r\n *\r\n * If only e2 changes, then the subgraph to be processed is just:\r\n * ```\r\n * e2 --> e3\r\n * ```\r\n * If only e3 changes, then the subgraph consists of e3 by itself.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed, the affected subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * If e2 is changed, the affected subgraph is:\r\n * ```\r\n * e3\r\n * /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * # Callbacks\r\n * Once the affected subgraph to process is found, it propagates changes through it by making callbacks.\r\n * Classes for both elements (nodes) and ElementDrivesElements relationships (edges) can receive callbacks.\r\n *\r\n * ## ElementDrivesElement Callbacks\r\n * The following callbacks are invoked on ElementDrivesElement relationship classes (edges):\r\n * * onRootChanged\r\n * * onDeletedDependency\r\n *\r\n * Note that these are static methods. Their default implementations do nothing.\r\n * To receive and act on these callbacks, a domain should define a subclass of ElementDrivesElement and use that to create relationships.\r\n * The subclass should then implement the callbacks that it would like to act on.\r\n *\r\n * A ElementDrivesElement subclass callback is expected to make changes to the output element only!\r\n *\r\n * ## Element Callbacks\r\n * The following callbacks are invoked on Element classes (nodes):\r\n * * Element.onBeforeOutputsHandled\r\n * * Element.onAllInputsHandled\r\n *\r\n * ## Order\r\n * Callbacks are invoked by BriefcaseDb.saveChanges.\r\n * They are invoked in dependency (topological) order: driving elements first, then driven elements.\r\n *\r\n * Each callback is invoked only once. No matter how many times a given element was changed during the transaction,\r\n * a callback such as ElementDrivesElement.onRootChanged will be invoked only once.\r\n * In the same way, no matter how many of its inputs were changed, a callback such as Element.onAllInputsHandled will be\r\n * invoked only once.\r\n *\r\n * For example, suppose we have a graph:\r\n * ```\r\n * e1 --> e2 --> e3\r\n * ```\r\n *\r\n * Suppose that e1 is directly modified. No callbacks are made at that time.\r\n * Later, when BriefcaseDb.saveChanges is called, the following callbacks are made, in order:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n *\r\n * Suppose that e3 is modified directly and BriefcaseDb.saveChanges is called.\r\n * Since no input to a relationship was changed, the sub-graph will be empty, and no callbacks will be made.\r\n *\r\n * Returning to the second example above, suppose we have this graph:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * / \\\r\n * e11 e31\r\n * ```\r\n * If e1 is changed and BriefcaseDb.saveChanges is called, the subgraph is:\r\n * ```\r\n * e1 e3\r\n * \\ /\r\n * e2\r\n * \\\r\n * e31\r\n * ```\r\n * The callbacks are:\r\n * 1. Element.onBeforeOutputsHandled e1\r\n * 1. ElementDrivesElement.onRootChanged e1->e2\r\n * 1. Element.onAllInputsHandled e2\r\n * 1. ElementDrivesElement.onRootChanged e2->e3\r\n * 1. Element.onAllInputsHandled e3\r\n * 1. ElementDrivesElement.onRootChanged e2->e31\r\n * 1. Element.onAllInputsHandled e31\r\n *\r\n * (The ElementDrivesElement.)\r\n *\r\n * #Errors\r\n * Circular dependencies are not permitted. If a cycle is detected, that is treated as a fatal error. All ElementDrivesElement relationships\r\n * involved in a cycle will have their status set to 1, indicating a failure.\r\n *\r\n * A callback may call txnManager.reportError to reject an invalid change. It can classify the error as fatal or just a warning.\r\n * A callback make set the status value of an ElementDrivesElement instance to 1 to indicate a processing failure in that edge.\r\n *\r\n * After BriefcaseDb.saveChanges is called, an app should check db.txns.validationErrors and db.txns.hasFatalError to find out if graph-evaluation failed.\r\n *\r\n * @beta\r\n */\r\nexport class ElementDrivesElement extends Relationship {\r\n public static override get className(): string { return \"ElementDrivesElement\"; }\r\n /** Relationship status\r\n * * 0 indicates no errors. Set after a successful evaluation.\r\n * * 1 indicates that this driving relationship could not be evaluated. The callback itself can set this to indicate that it failed to process the input changes. Also, it is set if the relationship is part of a circular dependency.\r\n * * 0x80 The app or callback can set this to indicate to not propagate changes through this relationship.\r\n */\r\n public status: number;\r\n /** Affects the order in which relationships are processed in the case where two relationships have the same output. */\r\n public priority: number;\r\n\r\n protected constructor(props: ElementDrivesElementProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.status = props.status;\r\n this.priority = props.priority;\r\n }\r\n\r\n public static create<T extends ElementDrivesElement>(iModel: IModelDb, sourceId: Id64String, targetId: Id64String, priority: number = 0): T {\r\n const props: ElementDrivesElementProps = { sourceId, targetId, priority, status: 0, classFullName: this.classFullName };\r\n return iModel.relationships.createInstance(props) as T;\r\n }\r\n\r\n public override toJSON(): ElementDrivesElementProps {\r\n const props = super.toJSON() as ElementDrivesElementProps;\r\n props.status = this.status;\r\n props.priority = this.priority;\r\n return props;\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addElement(this.targetId);\r\n }\r\n}\r\n\r\n/** The third (and last) possible link-table relationship base class in an iModel.\r\n * Has no external use, but is included for completeness of the [Entity.collectReferenceIds]($backend)\r\n * implementations for link-table relationships. Generating the types of the source and target automatically would require\r\n * coupling this package with ecschema-metadata which we do not want to do.\r\n * @internal\r\n */\r\nexport class ModelSelectorRefersToModels extends Relationship {\r\n public static override get className(): string { return \"ModelSelectorRefersToModels\"; }\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n referenceIds.addElement(this.sourceId);\r\n referenceIds.addModel(this.targetId);\r\n }\r\n}\r\n\r\n/** Manages [[Relationship]]s.\r\n * @public\r\n */\r\nexport class Relationships {\r\n private _iModel: IModelDb;\r\n\r\n /** @internal */\r\n public constructor(iModel: IModelDb) { this._iModel = iModel; }\r\n\r\n /** Create a new instance of a Relationship.\r\n * @param props The properties of the new Relationship.\r\n * @throws [[IModelError]] if there is a problem creating the Relationship.\r\n */\r\n public createInstance(props: RelationshipProps): Relationship { return this._iModel.constructEntity<Relationship>(props); }\r\n\r\n /** Check classFullName to ensure it is a link table relationship class. */\r\n private checkRelationshipClass(classFullName: string) {\r\n if (!this._iModel[_nativeDb].isLinkTableRelationship(classFullName.replace(\".\", \":\"))) {\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Class '${classFullName}' must be a relationship class and it should be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.`);\r\n }\r\n }\r\n\r\n /** Insert a new relationship instance into the iModel. The relationship provided must be subclass of BisCore:ElementRefersToElements or BisCore:ElementDrivesElement.\r\n * @param props The properties of the new relationship.\r\n * @returns The Id of the newly inserted relationship.\r\n * @note The id property of the props object is set as a side effect of this function.\r\n */\r\n public insertInstance(props: RelationshipProps): Id64String {\r\n this.checkRelationshipClass(props.classFullName);\r\n return props.id = this._iModel[_nativeDb].insertLinkTableRelationship(props);\r\n }\r\n\r\n /** Update the properties of an existing relationship instance in the iModel.\r\n * @param props the properties of the relationship instance to update. Any properties that are not present will be left unchanged.\r\n */\r\n public updateInstance(props: RelationshipProps): void {\r\n this._iModel[_nativeDb].updateLinkTableRelationship(props);\r\n }\r\n\r\n /** Delete an Relationship instance from this iModel. */\r\n public deleteInstance(props: RelationshipProps): void {\r\n this._iModel[_nativeDb].deleteLinkTableRelationship(props);\r\n }\r\n\r\n /** Delete multiple Relationship instances from this iModel.\r\n * @param props The properties of the relationship instances to delete.\r\n * @remarks This method handles bulk deletion of relationships and supports mixed collections containing instances from different relationship classes.\r\n */\r\n public deleteInstances(props: ReadonlyArray<RelationshipProps>): void {\r\n this._iModel[_nativeDb].deleteLinkTableRelationships(props);\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstanceProps\r\n */\r\n public getInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T {\r\n const relationshipProps = this.tryGetInstanceProps<T>(relClassFullName, criteria);\r\n if (undefined === relationshipProps) {\r\n throw new IModelError(IModelStatus.NotFound, \"Relationship not found\");\r\n }\r\n return relationshipProps;\r\n }\r\n\r\n /** Get the props of a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The RelationshipProps or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstanceProps\r\n */\r\n public tryGetInstanceProps<T extends RelationshipProps>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n let props: T | undefined;\r\n if (typeof criteria === \"string\") {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE ecinstanceid=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n props = this._iModel.withPreparedStatement(`SELECT * FROM ${relClassFullName} WHERE SourceECInstanceId=? AND TargetECInstanceId=?`, (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, criteria.sourceId);\r\n stmt.bindId(2, criteria.targetId);\r\n return DbResult.BE_SQLITE_ROW === stmt.step() ? stmt.getRow() as T : undefined;\r\n });\r\n }\r\n if (undefined !== props) {\r\n props.classFullName = (props as any).className.replace(\".\", \":\");\r\n }\r\n return props;\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @throws [IModelError]($common) if the relationship is not found or cannot be loaded.\r\n * @see tryGetInstance\r\n */\r\n public getInstance<T extends Relationship>(relClassSqlName: string, criteria: Id64String | SourceAndTarget): T {\r\n return this._iModel.constructEntity<T>(this.getInstanceProps(relClassSqlName, criteria));\r\n }\r\n\r\n /** Get a Relationship instance\r\n * @param relClassFullName The full class name of the relationship in the form of \"schema:class\"\r\n * @param criteria Either the relationship instanceId or the source and target Ids\r\n * @returns The relationship or `undefined` if the relationship is not found.\r\n * @note Useful for cases when a relationship may or may not exist and throwing an `Error` would be overkill.\r\n * @see getInstance\r\n */\r\n public tryGetInstance<T extends Relationship>(relClassFullName: string, criteria: Id64String | SourceAndTarget): T | undefined {\r\n const relationshipProps = this.tryGetInstanceProps<RelationshipProps>(relClassFullName, criteria);\r\n return undefined !== relationshipProps ? this._iModel.constructEntity<T>(relationshipProps) : undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBackend.js","sourceRoot":"","sources":["../../src/RpcBackend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,sBAA+B,KAAK;IACvE,IAAI,WAAW;QACb,OAAO;IAET,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAEvC,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAC3D,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAC3D,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAE3D,gBAAgB,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IACrD,gBAAgB,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IAErD,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;IAElE,WAAW,GAAG,IAAI,CAAC;AACrB,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 { RpcMultipart, WebAppRpcLogging, WebAppRpcRequest } from \"@itwin/core-common\";\nimport { appendToMultipartForm, createMultipartStream, parseMultipartRequest } from \"./rpc/multipart\";\nimport { initializeTracing } from \"./rpc/tracing\";\nimport { WebAppRpcLoggingBackend } from \"./rpc/web/logging\";\nimport { parseRequest } from \"./rpc/web/request\";\nimport { sendResponse } from \"./rpc/web/response\";\n\nlet initialized = false;\n/** @internal */\nexport function initializeRpcBackend(enableOpenTelemetry: boolean = false) {\n if (initialized)\n return;\n\n initializeTracing(enableOpenTelemetry);\n\n RpcMultipart.platform.createStream = createMultipartStream;\n RpcMultipart.platform.parseRequest = parseMultipartRequest;\n RpcMultipart.platform.appendToForm = appendToMultipartForm;\n\n WebAppRpcRequest.backend.sendResponse = sendResponse;\n WebAppRpcRequest.backend.parseRequest = parseRequest;\n\n WebAppRpcLogging.initializeBackend(new WebAppRpcLoggingBackend());\n\n initialized = true;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcBackend.js","sourceRoot":"","sources":["../../src/RpcBackend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,sBAA+B,KAAK;IACvE,IAAI,WAAW;QACb,OAAO;IAET,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAEvC,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAC3D,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAC3D,YAAY,CAAC,QAAQ,CAAC,YAAY,GAAG,qBAAqB,CAAC;IAE3D,gBAAgB,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IACrD,gBAAgB,CAAC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IAErD,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;IAElE,WAAW,GAAG,IAAI,CAAC;AACrB,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 { RpcMultipart, WebAppRpcLogging, WebAppRpcRequest } from \"@itwin/core-common\";\r\nimport { appendToMultipartForm, createMultipartStream, parseMultipartRequest } from \"./rpc/multipart\";\r\nimport { initializeTracing } from \"./rpc/tracing\";\r\nimport { WebAppRpcLoggingBackend } from \"./rpc/web/logging\";\r\nimport { parseRequest } from \"./rpc/web/request\";\r\nimport { sendResponse } from \"./rpc/web/response\";\r\n\r\nlet initialized = false;\r\n/** @internal */\r\nexport function initializeRpcBackend(enableOpenTelemetry: boolean = false) {\r\n if (initialized)\r\n return;\r\n\r\n initializeTracing(enableOpenTelemetry);\r\n\r\n RpcMultipart.platform.createStream = createMultipartStream;\r\n RpcMultipart.platform.parseRequest = parseMultipartRequest;\r\n RpcMultipart.platform.appendToForm = appendToMultipartForm;\r\n\r\n WebAppRpcRequest.backend.sendResponse = sendResponse;\r\n WebAppRpcRequest.backend.parseRequest = parseRequest;\r\n\r\n WebAppRpcLogging.initializeBackend(new WebAppRpcLoggingBackend());\r\n\r\n initialized = true;\r\n}\r\n"]}
|
package/lib/esm/SQLiteDb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLiteDb.js","sourceRoot":"","sources":["../../src/SQLiteDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAY,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,0CAA0C;AAE1C,0DAA0D;AAG1D;;;GAGG;AACH,MAAM,OA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AAc;AACd,WAAiB,QAAQ;IAqEvB;;OAEG;IACH,IAAY,cASX;IATD,WAAY,cAAc;QACxB,4GAA4G;QAC5G,mDAAQ,CAAA;QACR,4FAA4F;QAC5F,2DAAY,CAAA;QACZ,yEAAyE;QACzE,6DAAa,CAAA;QACb,yEAAyE;QACzE,6DAAa,CAAA;IACf,CAAC,EATW,cAAc,GAAd,uBAAc,KAAd,uBAAc,QASzB;AAgDH,CAAC,EAjIgB,QAAQ,KAAR,QAAQ,QAiIxB","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 SQLiteDb\n */\n\nimport * as fs from \"fs\";\nimport { dirname } from \"path\";\nimport * as semver from \"semver\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { DbResult, OpenMode } from \"@itwin/core-bentley\";\nimport { LocalFileName, SqliteError } from \"@itwin/core-common\";\nimport { CloudSqlite } from \"./CloudSqlite\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n// cspell:ignore savepoint julianday rowid\n\n/* eslint-disable @typescript-eslint/unified-signatures */\n\n\n/**\n * A \"generic\" SQLiteDb. This class may be used to access local files or databases in a cloud container.\n * @public\n */\nexport class SQLiteDb {\n /** @internal */\n public readonly [_nativeDb] = new IModelNative.platform.SQLiteDb();\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\n\n /** @internal */\n public static createBlobIO(): SQLiteDb.BlobIO {\n return new IModelNative.platform.BlobIO();\n }\n\n /** alias for closeDb.\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[closeDb]]\n */\n public dispose(): void {\n this.closeDb();\n }\n\n /** Create a SQLiteDb\n * @param dbName The path to the SQLiteDb file to create.\n */\n public createDb(dbName: string): void;\n /** @beta */\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void;\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void {\n this[_nativeDb].createDb(dbName, container, params);\n }\n\n /** Open a SQLiteDb.\n * @param dbName The path to the SQLiteDb file to open\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams): void;\n /**\n * @param container optional CloudContainer holding database\n * @beta\n */\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void;\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void {\n this[_nativeDb].openDb(dbName, openMode, container);\n }\n\n /** Close SQLiteDb.\n * @param saveChanges if true, call `saveChanges` before closing db. Otherwise unsaved changes are abandoned.\n */\n public closeDb(saveChanges?: boolean): void {\n if (saveChanges && this.isOpen)\n this.saveChanges();\n this._sqliteStatementCache.clear();\n this[_nativeDb].closeDb();\n }\n\n /** Returns true if this SQLiteDb is open */\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\n\n /** Returns true if this SQLiteDb is open readonly */\n public get isReadonly(): boolean { return this[_nativeDb].isReadonly(); }\n\n /** Create a new table in this database. */\n protected createTable(args: {\n /** The name of the table to create. */\n tableName: string;\n /** all of the columns in the table. */\n columns: string;\n /** any unique or foreign key constraints */\n constraints?: string;\n /** if true, add a \"lastMod\" timestamp column and triggers to automatically update it. */\n addTimestamp?: boolean;\n }) {\n const timestampCol = args.addTimestamp ? \",lastMod TIMESTAMP NOT NULL DEFAULT(julianday('now'))\" : \"\";\n const constraints = args.constraints ? `,${args.constraints}` : \"\";\n this.executeSQL(`CREATE TABLE ${args.tableName}(${args.columns}${timestampCol}${constraints})`);\n if (args.addTimestamp)\n this.executeSQL(`CREATE TRIGGER ${args.tableName}_timestamp AFTER UPDATE ON ${args.tableName} WHEN old.lastMod=new.lastMod AND old.lastMod != julianday('now') BEGIN UPDATE ${args.tableName} SET lastMod=julianday('now') WHERE rowid=new.rowid; END`);\n }\n\n /**\n * Get the last modified date for a row in a table of this database.\n * @note the table must have been created with `addTimestamp: true`\n */\n public readLastModTime(tableName: string, rowId: number): Date {\n return this.withSqliteStatement(`SELECT lastMod from ${tableName} WHERE rowid=?`, (stmt) => {\n stmt.bindInteger(1, rowId);\n return stmt.getValueDate(0);\n });\n }\n\n /**\n * Open a database, perform an operation, then close the database.\n *\n * Details:\n * - if database is open, throw an error\n * - open a database\n * - call a function with the database opened. If it is async, await its return.\n * - if function throws, abandon all changes, close database, and rethrow\n * - save all changes\n * - close the database\n * @return value from operation\n */\n public withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T {\n if (this.isOpen)\n SqliteError.throwError(\"already-open\", \"database is already open\", args.dbName);\n\n const save = () => this.closeDb(true), abandon = () => this.closeDb(false);\n this.openDb(args.dbName, args.openMode ?? OpenMode.Readonly, args.container);\n try {\n const result = operation();\n result instanceof Promise ? result.then(save, abandon) : save();\n return result;\n } catch (e) {\n abandon();\n throw e;\n }\n }\n\n /** The cloud container backing this SQLite database, if any.\n * @beta\n */\n public get cloudContainer(): CloudSqlite.CloudContainer | undefined {\n return this[_nativeDb].cloudContainer;\n }\n\n /** Returns the Id of the most-recently-inserted row in this database, per [sqlite3_last_insert_rowid](https://www.sqlite.org/c3ref/last_insert_rowid.html). */\n public getLastInsertRowId(): number {\n return this[_nativeDb].getLastInsertRowId();\n }\n\n /**\n * Perform an operation on a database in a CloudContainer with the write lock held.\n *\n * Details:\n * - acquire the write lock on a CloudContainer\n * - call `withOpenDb` with openMode `ReadWrite`\n * - upload changes\n * - release the write lock\n * @param args arguments to lock the container and open the database\n * @param operation an operation performed on the database with the write lock held.\n * @return value from operation\n * @internal\n */\n public async withLockedContainer<T>(args: CloudSqlite.LockAndOpenArgs, operation: () => Promise<T>) {\n return CloudSqlite.withWriteLock(args, async () => this.withOpenDb({ ...args, openMode: args.openMode ?? OpenMode.ReadWrite }, operation));\n }\n\n /** vacuum this database\n * @see https://www.sqlite.org/lang_vacuum.html\n */\n public vacuum(args?: SQLiteDb.VacuumDbArgs) {\n this[_nativeDb].vacuum(args);\n }\n\n /** Commit the outermost transaction, writing changes to the file. Then, restart the default transaction. */\n public saveChanges(): void {\n this[_nativeDb].saveChanges();\n }\n\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the default transaction. */\n public abandonChanges(): void {\n this[_nativeDb].abandonChanges();\n }\n\n /**\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql);\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Prepare and execute a callback on a SQL statement. After the callback completes the statement is disposed.\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\n * @param sql The SQLite SQL statement to execute\n * @param callback the callback to invoke on the prepared statement\n * @returns the value returned by `callback`.\n */\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\n const stmt = this.prepareSqliteStatement(sql);\n const release = () => stmt[Symbol.dispose]();\n try {\n const val = callback(stmt);\n val instanceof Promise ? val.then(release, release) : release();\n return val;\n } catch (err) {\n release();\n throw err;\n }\n }\n\n /**\n * Perform an operation on this database within a [savepoint](https://www.sqlite.org/lang_savepoint.html). If the operation completes successfully, the\n * changes remain in the current transaction. If the operation throws an exception, the savepoint is rolled back\n * and all changes to the database from this method are reversed, leaving the transaction exactly as it was before this method.\n */\n public withSavePoint(savePointName: string, operation: () => void) {\n if (this.isReadonly)\n SqliteError.throwError(\"readonly\", \"database is readonly\", this[_nativeDb].getFilePath());\n\n this.executeSQL(`SAVEPOINT ${savePointName}`);\n try {\n operation();\n this.executeSQL(`RELEASE ${savePointName}`);\n } catch (e) {\n this.executeSQL(`ROLLBACK TO ${savePointName}`);\n throw e;\n }\n }\n\n /** Prepare an SQL statement.\n * @param sql The SQLite SQL statement to prepare\n * @param logErrors Determine if errors are logged or not\n * @internal\n */\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\n const stmt = new SqliteStatement(sql);\n stmt.prepare(this[_nativeDb], logErrors);\n return stmt;\n }\n\n /** execute an SQL statement */\n public executeSQL(sql: string): DbResult {\n using stmt = this.prepareSqliteStatement(sql);\n return stmt.step();\n }\n}\n\n/**\n * Abstract base class for a SQLite database that has [[SQLiteDb.RequiredVersionRanges]] stored in it.\n * This class provides version checking when the database is opened, to guarantee that a valid version of software is\n * always used for access.\n *\n * Notes:\n * - This class may be used either to access a local file, or one stored in a cloud container.\n * - Subclasses must provide a `myVersion` member indicating the version of its software, and implement the `createDDL` member to create its\n * tables.\n * @beta\n */\nexport abstract class VersionedSqliteDb extends SQLiteDb {\n protected static _versionProps = { namespace: \"SQLiteDb\", name: \"versions\" } as const;\n\n /** The current semver \"persistence version\" of this class.\n * @note This value should only be changed when logic in its code is modified in a way that affects the operation of extant copies.\n * If this value is outside of the range of accepted versions of a to-be-opened VersionedSqliteDb, the operation will fail. In this manner, if\n * changes are made to the format of a VersionedSqliteDb, or if bug fixes are necessary, the `requiredVersions` property in a VersionedSqliteDb may be updated\n * and immediately old versions of the package will refuse to open the VersionedSqliteDb, with a message to the user that they need to upgrade their\n * software. Likewise, if a new version of the package is asked to open an older VersionedSqliteDb that has not been upgraded to the lowest version\n * supported by it, the user will be informed that they need to upgrade their software.\n * @note this identifier is independent of versions in `package.json` files.\n */\n public abstract myVersion: string;\n\n /**\n * Change the \"versions required to open this database\" property stored in this database. After this call,\n * versions of software that don't meet the supplied ranges will fail.\n * @param versions the new versions required for reading and writing this database.\n * @note the database must be opened for write access.\n */\n public setRequiredVersions(versions: SQLiteDb.RequiredVersionRanges) {\n // NOTE: It might look tempting to just stringify the supplied `versions` object, but we only include required members - there may be others.\n this[_nativeDb].saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));\n }\n\n /** Get the required version ranges necessary to open this VersionedSqliteDb. */\n public getRequiredVersions() {\n const checkIsString = (value: any) => {\n if (typeof value !== \"string\")\n SqliteError.throwError(\"invalid-versions-property\", `CloudDb has invalid \"versions\" property`, this[_nativeDb].getFilePath());\n return value;\n };\n const versionJson = checkIsString(this[_nativeDb].queryFileProperty(VersionedSqliteDb._versionProps, true));\n const versionRanges = JSON.parse(versionJson) as SQLiteDb.RequiredVersionRanges;\n checkIsString(versionRanges.readVersion);\n checkIsString(versionRanges.writeVersion);\n return versionRanges;\n }\n\n /**\n * Implement this method to create all tables for this subclass of `VersionedSqliteDb` when a new database file is created. Called from [[createNewDb]].\n */\n protected abstract createDDL(args: any): void;\n\n /**\n * Create a new database file for the subclass of VersionedSqliteDb.\n * @note The required versions are saved as [[myVersion]] or newer for both read and write.\n */\n public static createNewDb(fileName: LocalFileName, setupArgs?: any) {\n const db = new (this as any)() as VersionedSqliteDb; // \"as any\" necessary because VersionedSqliteDb is abstract\n IModelJsFs.recursiveMkDirSync(dirname(fileName));\n if (fs.existsSync(fileName))\n fs.unlinkSync(fileName);\n\n db.createDb(fileName);\n db.createDDL(setupArgs);\n const minVer = `^${db.myVersion}`;\n db.setRequiredVersions({ readVersion: minVer, writeVersion: minVer });\n db.closeDb(true);\n }\n\n /**\n * Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n */\n protected verifyVersions() {\n const versions = this.getRequiredVersions();\n const isReadonly = this.isReadonly; // so we can tell read/write after the file is closed.\n const range = isReadonly ? versions.readVersion : versions.writeVersion;\n if (semver.satisfies(this.myVersion, range))\n return;\n\n this.closeDb();\n const tooNew = semver.gtr(this.myVersion, range);\n SqliteError.throwError(\"incompatible-version\", `requires ${tooNew ? \"older\" : \"newer\"} version of ${this.constructor.name} for ${isReadonly ? \"read\" : \"write\"}`, this[_nativeDb].getFilePath());\n\n }\n\n /**\n * Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\n * Throws otherwise.\n * @see [[SqliteDb.openDb]] for argument types\n */\n public override openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer) {\n super.openDb(dbName, openMode, container);\n this.verifyVersions();\n }\n\n public async upgradeSchema(arg: { dbName: string, lockContainer?: { container: CloudSqlite.CloudContainer, user: string }, upgradeFn: () => void }) {\n // can't use \"this\" because it checks for version, which we don't want here\n return (arg.lockContainer) ?\n super.withLockedContainer({ dbName: arg.dbName, ...arg.lockContainer }, async () => arg.upgradeFn) :\n super.withOpenDb({ ...arg, openMode: OpenMode.ReadWrite }, arg.upgradeFn);\n }\n}\n\n/** @public */\nexport namespace SQLiteDb {\n /** A semver version range.\n * @see https://docs.npmjs.com/cli/v6/using-npm/semver\n */\n export type VersionRange = string;\n\n /**\n * A pair of semver [[SQLiteDb.VersionRange]]s, one for read and one for write, required to access a [[VersionedSqliteDb]].\n * If the version of the software attempting to read or write the database does not satisfy the range, access is denied.\n */\n export interface RequiredVersionRanges {\n /** a range of acceptable persistence versions for reading from a VersionedSqliteDb. */\n readonly readVersion: VersionRange;\n /** a range of acceptable persistence versions for writing to a VersionedSqliteDb. */\n readonly writeVersion: VersionRange;\n }\n\n /** interface for reading and writing to a blob in a SQLiteDb\n * @internal\n */\n export interface BlobIO {\n /** Close this BlobIO if it is opened.\n * @note this BlobIO *may* be reused after this call by calling `open` again.\n */\n close(): void;\n /** get the total number of bytes in the blob */\n getNumBytes(): number;\n /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */\n isValid(): boolean;\n /** Open this BlobIO against a table/row/column in a Db */\n open(\n /** The database for the blob */\n db: IModelJsNative.AnyDb,\n args: {\n /** the name of the table for the blob*/\n tableName: string;\n /** the name of the column for the blob */\n columnName: string;\n /** The rowId of the blob */\n row: number;\n /** If true, open this BlobIO for write access */\n writeable?: boolean;\n }): void;\n /** Read from a blob\n * @returns the contents of the requested byte range\n */\n read(args: {\n /** The number of bytes to read */\n numBytes: number;\n /** starting offset within the blob to read */\n offset: number;\n /** If present and of sufficient size, use this ArrayBuffer for the value. */\n blob?: ArrayBuffer;\n }): Uint8Array;\n /** Reposition this BlobIO to a new rowId\n * @note this BlobIO must be valid when this methods is called.\n */\n changeRow(row: number): void;\n /** Write to a blob */\n write(args: {\n /** The number of bytes to write */\n numBytes: number;\n /** starting offset within the blob to write */\n offset: number;\n /** the value to write */\n blob: ArrayBuffer;\n }): void;\n }\n\n /** Default transaction mode for SQLiteDbs.\n * @see https://www.sqlite.org/lang_transaction.html\n */\n export enum DefaultTxnMode {\n /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */\n None = 0,\n /** A deferred transaction is started when the file is first opened. This is the default. */\n Deferred = 1,\n /** An immediate transaction is started when the file is first opened. */\n Immediate = 2,\n /** An exclusive transaction is started when the file is first opened. */\n Exclusive = 3\n }\n\n /** parameters common to opening or creating a new SQLiteDb */\n export interface OpenOrCreateParams {\n /** If true, do not require that the `be_Prop` table exist */\n rawSQLite?: boolean;\n /** @see immutable option at https://www.sqlite.org/c3ref/open.html */\n immutable?: boolean;\n /** Do not attempt to verify that the file is a valid sQLite file before opening. */\n skipFileCheck?: boolean;\n /** the default transaction mode\n * @see [[SQLiteDb.DefaultTxnMode]]\n */\n defaultTxn?: 0 | 1 | 2 | 3;\n /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */\n queryParam?: string;\n }\n\n /** Parameters for opening an existing SQLiteDb */\n export interface OpenParams extends OpenOrCreateParams {\n /** use OpenMode.ReadWrite to open the file with write access */\n openMode: OpenMode;\n }\n\n /** Size of a SQLiteDb page in bytes */\n export interface PageSize {\n /** see https://www.sqlite.org/pragma.html#pragma_page_size */\n pageSize?: number;\n }\n\n /** Parameters for creating a new SQLiteDb */\n export type CreateParams = OpenOrCreateParams & PageSize;\n\n /** Arguments for `SqliteDb.withOpenDb` */\n export interface WithOpenDbArgs {\n /** The name of the database to open */\n dbName: string;\n /** either an object with the open parameters or just OpenMode value. */\n openMode?: OpenMode | SQLiteDb.OpenParams;\n /** @internal */\n container?: CloudSqlite.CloudContainer;\n }\n\n /** Arguments for `SQLiteDb.vacuum` */\n export interface VacuumDbArgs extends PageSize {\n /** if present, name of new file to [vacuum into](https://www.sqlite.org/lang_vacuum.html) */\n into?: LocalFileName;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SQLiteDb.js","sourceRoot":"","sources":["../../src/SQLiteDb.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAY,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAiB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EA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G,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9E,CAAC;;AAGH,cAAc;AACd,WAAiB,QAAQ;IAqEvB;;OAEG;IACH,IAAY,cASX;IATD,WAAY,cAAc;QACxB,4GAA4G;QAC5G,mDAAQ,CAAA;QACR,4FAA4F;QAC5F,2DAAY,CAAA;QACZ,yEAAyE;QACzE,6DAAa,CAAA;QACb,yEAAyE;QACzE,6DAAa,CAAA;IACf,CAAC,EATW,cAAc,GAAd,uBAAc,KAAd,uBAAc,QASzB;AAgDH,CAAC,EAjIgB,QAAQ,KAAR,QAAQ,QAiIxB","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 SQLiteDb\r\n */\r\n\r\nimport * as fs from \"fs\";\r\nimport { dirname } from \"path\";\r\nimport * as semver from \"semver\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { DbResult, OpenMode } from \"@itwin/core-bentley\";\r\nimport { LocalFileName, SqliteError } from \"@itwin/core-common\";\r\nimport { CloudSqlite } from \"./CloudSqlite\";\r\nimport { IModelNative } from \"./internal/NativePlatform\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { SqliteStatement, StatementCache } from \"./SqliteStatement\";\r\nimport { _nativeDb } from \"./internal/Symbols\";\r\n\r\n// cspell:ignore savepoint julianday rowid\r\n\r\n/* eslint-disable @typescript-eslint/unified-signatures */\r\n\r\n\r\n/**\r\n * A \"generic\" SQLiteDb. This class may be used to access local files or databases in a cloud container.\r\n * @public\r\n */\r\nexport class SQLiteDb {\r\n /** @internal */\r\n public readonly [_nativeDb] = new IModelNative.platform.SQLiteDb();\r\n private _sqliteStatementCache = new StatementCache<SqliteStatement>();\r\n\r\n /** @internal */\r\n public static createBlobIO(): SQLiteDb.BlobIO {\r\n return new IModelNative.platform.BlobIO();\r\n }\r\n\r\n /** alias for closeDb.\r\n * @deprecated in 4.0 - will not be removed until after 2026-06-13. Use [[closeDb]]\r\n */\r\n public dispose(): void {\r\n this.closeDb();\r\n }\r\n\r\n /** Create a SQLiteDb\r\n * @param dbName The path to the SQLiteDb file to create.\r\n */\r\n public createDb(dbName: string): void;\r\n /** @beta */\r\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void;\r\n public createDb(dbName: string, container?: CloudSqlite.CloudContainer, params?: SQLiteDb.CreateParams): void {\r\n this[_nativeDb].createDb(dbName, container, params);\r\n }\r\n\r\n /** Open a SQLiteDb.\r\n * @param dbName The path to the SQLiteDb file to open\r\n */\r\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams): void;\r\n /**\r\n * @param container optional CloudContainer holding database\r\n * @beta\r\n */\r\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void;\r\n public openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer): void {\r\n this[_nativeDb].openDb(dbName, openMode, container);\r\n }\r\n\r\n /** Close SQLiteDb.\r\n * @param saveChanges if true, call `saveChanges` before closing db. Otherwise unsaved changes are abandoned.\r\n */\r\n public closeDb(saveChanges?: boolean): void {\r\n if (saveChanges && this.isOpen)\r\n this.saveChanges();\r\n this._sqliteStatementCache.clear();\r\n this[_nativeDb].closeDb();\r\n }\r\n\r\n /** Returns true if this SQLiteDb is open */\r\n public get isOpen(): boolean { return this[_nativeDb].isOpen(); }\r\n\r\n /** Returns true if this SQLiteDb is open readonly */\r\n public get isReadonly(): boolean { return this[_nativeDb].isReadonly(); }\r\n\r\n /** Create a new table in this database. */\r\n protected createTable(args: {\r\n /** The name of the table to create. */\r\n tableName: string;\r\n /** all of the columns in the table. */\r\n columns: string;\r\n /** any unique or foreign key constraints */\r\n constraints?: string;\r\n /** if true, add a \"lastMod\" timestamp column and triggers to automatically update it. */\r\n addTimestamp?: boolean;\r\n }) {\r\n const timestampCol = args.addTimestamp ? \",lastMod TIMESTAMP NOT NULL DEFAULT(julianday('now'))\" : \"\";\r\n const constraints = args.constraints ? `,${args.constraints}` : \"\";\r\n this.executeSQL(`CREATE TABLE ${args.tableName}(${args.columns}${timestampCol}${constraints})`);\r\n if (args.addTimestamp)\r\n this.executeSQL(`CREATE TRIGGER ${args.tableName}_timestamp AFTER UPDATE ON ${args.tableName} WHEN old.lastMod=new.lastMod AND old.lastMod != julianday('now') BEGIN UPDATE ${args.tableName} SET lastMod=julianday('now') WHERE rowid=new.rowid; END`);\r\n }\r\n\r\n /**\r\n * Get the last modified date for a row in a table of this database.\r\n * @note the table must have been created with `addTimestamp: true`\r\n */\r\n public readLastModTime(tableName: string, rowId: number): Date {\r\n return this.withSqliteStatement(`SELECT lastMod from ${tableName} WHERE rowid=?`, (stmt) => {\r\n stmt.bindInteger(1, rowId);\r\n return stmt.getValueDate(0);\r\n });\r\n }\r\n\r\n /**\r\n * Open a database, perform an operation, then close the database.\r\n *\r\n * Details:\r\n * - if database is open, throw an error\r\n * - open a database\r\n * - call a function with the database opened. If it is async, await its return.\r\n * - if function throws, abandon all changes, close database, and rethrow\r\n * - save all changes\r\n * - close the database\r\n * @return value from operation\r\n */\r\n public withOpenDb<T>(args: SQLiteDb.WithOpenDbArgs, operation: () => T): T {\r\n if (this.isOpen)\r\n SqliteError.throwError(\"already-open\", \"database is already open\", args.dbName);\r\n\r\n const save = () => this.closeDb(true), abandon = () => this.closeDb(false);\r\n this.openDb(args.dbName, args.openMode ?? OpenMode.Readonly, args.container);\r\n try {\r\n const result = operation();\r\n result instanceof Promise ? result.then(save, abandon) : save();\r\n return result;\r\n } catch (e) {\r\n abandon();\r\n throw e;\r\n }\r\n }\r\n\r\n /** The cloud container backing this SQLite database, if any.\r\n * @beta\r\n */\r\n public get cloudContainer(): CloudSqlite.CloudContainer | undefined {\r\n return this[_nativeDb].cloudContainer;\r\n }\r\n\r\n /** Returns the Id of the most-recently-inserted row in this database, per [sqlite3_last_insert_rowid](https://www.sqlite.org/c3ref/last_insert_rowid.html). */\r\n public getLastInsertRowId(): number {\r\n return this[_nativeDb].getLastInsertRowId();\r\n }\r\n\r\n /**\r\n * Perform an operation on a database in a CloudContainer with the write lock held.\r\n *\r\n * Details:\r\n * - acquire the write lock on a CloudContainer\r\n * - call `withOpenDb` with openMode `ReadWrite`\r\n * - upload changes\r\n * - release the write lock\r\n * @param args arguments to lock the container and open the database\r\n * @param operation an operation performed on the database with the write lock held.\r\n * @return value from operation\r\n * @internal\r\n */\r\n public async withLockedContainer<T>(args: CloudSqlite.LockAndOpenArgs, operation: () => Promise<T>) {\r\n return CloudSqlite.withWriteLock(args, async () => this.withOpenDb({ ...args, openMode: args.openMode ?? OpenMode.ReadWrite }, operation));\r\n }\r\n\r\n /** vacuum this database\r\n * @see https://www.sqlite.org/lang_vacuum.html\r\n */\r\n public vacuum(args?: SQLiteDb.VacuumDbArgs) {\r\n this[_nativeDb].vacuum(args);\r\n }\r\n\r\n /** Commit the outermost transaction, writing changes to the file. Then, restart the default transaction. */\r\n public saveChanges(): void {\r\n this[_nativeDb].saveChanges();\r\n }\r\n\r\n /** Abandon (cancel) the outermost transaction, discarding all changes since last save. Then, restart the default transaction. */\r\n public abandonChanges(): void {\r\n this[_nativeDb].abandonChanges();\r\n }\r\n\r\n /**\r\n * Use a prepared SQL statement, potentially from the statement cache. If the requested statement doesn't exist\r\n * in the statement cache, a new statement is prepared. After the callback completes, the statement is reset and saved\r\n * in the statement cache so it can be reused in the future. Use this method for SQL statements that will be\r\n * reused often and are expensive to prepare. The statement cache holds the most recently used statements, discarding\r\n * the oldest statements as it fills. For statements you don't intend to reuse, instead use [[withSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @returns the value returned by `callback`.\r\n */\r\n public withPreparedSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\r\n const stmt = this._sqliteStatementCache.findAndRemove(sql) ?? this.prepareSqliteStatement(sql);\r\n const release = () => this._sqliteStatementCache.addOrDispose(stmt);\r\n try {\r\n const val = callback(stmt);\r\n val instanceof Promise ? val.then(release, release) : release();\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Prepare and execute a callback on a SQL statement. After the callback completes the statement is disposed.\r\n * Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare.\r\n * For statements that will be reused often, instead use [[withPreparedSqliteStatement]].\r\n * @param sql The SQLite SQL statement to execute\r\n * @param callback the callback to invoke on the prepared statement\r\n * @returns the value returned by `callback`.\r\n */\r\n public withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T): T {\r\n const stmt = this.prepareSqliteStatement(sql);\r\n const release = () => stmt[Symbol.dispose]();\r\n try {\r\n const val = callback(stmt);\r\n val instanceof Promise ? val.then(release, release) : release();\r\n return val;\r\n } catch (err) {\r\n release();\r\n throw err;\r\n }\r\n }\r\n\r\n /**\r\n * Perform an operation on this database within a [savepoint](https://www.sqlite.org/lang_savepoint.html). If the operation completes successfully, the\r\n * changes remain in the current transaction. If the operation throws an exception, the savepoint is rolled back\r\n * and all changes to the database from this method are reversed, leaving the transaction exactly as it was before this method.\r\n */\r\n public withSavePoint(savePointName: string, operation: () => void) {\r\n if (this.isReadonly)\r\n SqliteError.throwError(\"readonly\", \"database is readonly\", this[_nativeDb].getFilePath());\r\n\r\n this.executeSQL(`SAVEPOINT ${savePointName}`);\r\n try {\r\n operation();\r\n this.executeSQL(`RELEASE ${savePointName}`);\r\n } catch (e) {\r\n this.executeSQL(`ROLLBACK TO ${savePointName}`);\r\n throw e;\r\n }\r\n }\r\n\r\n /** Prepare an SQL statement.\r\n * @param sql The SQLite SQL statement to prepare\r\n * @param logErrors Determine if errors are logged or not\r\n * @internal\r\n */\r\n public prepareSqliteStatement(sql: string, logErrors = true): SqliteStatement {\r\n const stmt = new SqliteStatement(sql);\r\n stmt.prepare(this[_nativeDb], logErrors);\r\n return stmt;\r\n }\r\n\r\n /** execute an SQL statement */\r\n public executeSQL(sql: string): DbResult {\r\n using stmt = this.prepareSqliteStatement(sql);\r\n return stmt.step();\r\n }\r\n}\r\n\r\n/**\r\n * Abstract base class for a SQLite database that has [[SQLiteDb.RequiredVersionRanges]] stored in it.\r\n * This class provides version checking when the database is opened, to guarantee that a valid version of software is\r\n * always used for access.\r\n *\r\n * Notes:\r\n * - This class may be used either to access a local file, or one stored in a cloud container.\r\n * - Subclasses must provide a `myVersion` member indicating the version of its software, and implement the `createDDL` member to create its\r\n * tables.\r\n * @beta\r\n */\r\nexport abstract class VersionedSqliteDb extends SQLiteDb {\r\n protected static _versionProps = { namespace: \"SQLiteDb\", name: \"versions\" } as const;\r\n\r\n /** The current semver \"persistence version\" of this class.\r\n * @note This value should only be changed when logic in its code is modified in a way that affects the operation of extant copies.\r\n * If this value is outside of the range of accepted versions of a to-be-opened VersionedSqliteDb, the operation will fail. In this manner, if\r\n * changes are made to the format of a VersionedSqliteDb, or if bug fixes are necessary, the `requiredVersions` property in a VersionedSqliteDb may be updated\r\n * and immediately old versions of the package will refuse to open the VersionedSqliteDb, with a message to the user that they need to upgrade their\r\n * software. Likewise, if a new version of the package is asked to open an older VersionedSqliteDb that has not been upgraded to the lowest version\r\n * supported by it, the user will be informed that they need to upgrade their software.\r\n * @note this identifier is independent of versions in `package.json` files.\r\n */\r\n public abstract myVersion: string;\r\n\r\n /**\r\n * Change the \"versions required to open this database\" property stored in this database. After this call,\r\n * versions of software that don't meet the supplied ranges will fail.\r\n * @param versions the new versions required for reading and writing this database.\r\n * @note the database must be opened for write access.\r\n */\r\n public setRequiredVersions(versions: SQLiteDb.RequiredVersionRanges) {\r\n // NOTE: It might look tempting to just stringify the supplied `versions` object, but we only include required members - there may be others.\r\n this[_nativeDb].saveFileProperty(VersionedSqliteDb._versionProps, JSON.stringify({ readVersion: versions.readVersion, writeVersion: versions.writeVersion }));\r\n }\r\n\r\n /** Get the required version ranges necessary to open this VersionedSqliteDb. */\r\n public getRequiredVersions() {\r\n const checkIsString = (value: any) => {\r\n if (typeof value !== \"string\")\r\n SqliteError.throwError(\"invalid-versions-property\", `CloudDb has invalid \"versions\" property`, this[_nativeDb].getFilePath());\r\n return value;\r\n };\r\n const versionJson = checkIsString(this[_nativeDb].queryFileProperty(VersionedSqliteDb._versionProps, true));\r\n const versionRanges = JSON.parse(versionJson) as SQLiteDb.RequiredVersionRanges;\r\n checkIsString(versionRanges.readVersion);\r\n checkIsString(versionRanges.writeVersion);\r\n return versionRanges;\r\n }\r\n\r\n /**\r\n * Implement this method to create all tables for this subclass of `VersionedSqliteDb` when a new database file is created. Called from [[createNewDb]].\r\n */\r\n protected abstract createDDL(args: any): void;\r\n\r\n /**\r\n * Create a new database file for the subclass of VersionedSqliteDb.\r\n * @note The required versions are saved as [[myVersion]] or newer for both read and write.\r\n */\r\n public static createNewDb(fileName: LocalFileName, setupArgs?: any) {\r\n const db = new (this as any)() as VersionedSqliteDb; // \"as any\" necessary because VersionedSqliteDb is abstract\r\n IModelJsFs.recursiveMkDirSync(dirname(fileName));\r\n if (fs.existsSync(fileName))\r\n fs.unlinkSync(fileName);\r\n\r\n db.createDb(fileName);\r\n db.createDDL(setupArgs);\r\n const minVer = `^${db.myVersion}`;\r\n db.setRequiredVersions({ readVersion: minVer, writeVersion: minVer });\r\n db.closeDb(true);\r\n }\r\n\r\n /**\r\n * Verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\r\n * Throws otherwise.\r\n */\r\n protected verifyVersions() {\r\n const versions = this.getRequiredVersions();\r\n const isReadonly = this.isReadonly; // so we can tell read/write after the file is closed.\r\n const range = isReadonly ? versions.readVersion : versions.writeVersion;\r\n if (semver.satisfies(this.myVersion, range))\r\n return;\r\n\r\n this.closeDb();\r\n const tooNew = semver.gtr(this.myVersion, range);\r\n SqliteError.throwError(\"incompatible-version\", `requires ${tooNew ? \"older\" : \"newer\"} version of ${this.constructor.name} for ${isReadonly ? \"read\" : \"write\"}`, this[_nativeDb].getFilePath());\r\n\r\n }\r\n\r\n /**\r\n * Open this database and verify that this version of the software meets the required version range (as appropriate, read or write) stored in the database.\r\n * Throws otherwise.\r\n * @see [[SqliteDb.openDb]] for argument types\r\n */\r\n public override openDb(dbName: string, openMode: OpenMode | SQLiteDb.OpenParams, container?: CloudSqlite.CloudContainer) {\r\n super.openDb(dbName, openMode, container);\r\n this.verifyVersions();\r\n }\r\n\r\n public async upgradeSchema(arg: { dbName: string, lockContainer?: { container: CloudSqlite.CloudContainer, user: string }, upgradeFn: () => void }) {\r\n // can't use \"this\" because it checks for version, which we don't want here\r\n return (arg.lockContainer) ?\r\n super.withLockedContainer({ dbName: arg.dbName, ...arg.lockContainer }, async () => arg.upgradeFn) :\r\n super.withOpenDb({ ...arg, openMode: OpenMode.ReadWrite }, arg.upgradeFn);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace SQLiteDb {\r\n /** A semver version range.\r\n * @see https://docs.npmjs.com/cli/v6/using-npm/semver\r\n */\r\n export type VersionRange = string;\r\n\r\n /**\r\n * A pair of semver [[SQLiteDb.VersionRange]]s, one for read and one for write, required to access a [[VersionedSqliteDb]].\r\n * If the version of the software attempting to read or write the database does not satisfy the range, access is denied.\r\n */\r\n export interface RequiredVersionRanges {\r\n /** a range of acceptable persistence versions for reading from a VersionedSqliteDb. */\r\n readonly readVersion: VersionRange;\r\n /** a range of acceptable persistence versions for writing to a VersionedSqliteDb. */\r\n readonly writeVersion: VersionRange;\r\n }\r\n\r\n /** interface for reading and writing to a blob in a SQLiteDb\r\n * @internal\r\n */\r\n export interface BlobIO {\r\n /** Close this BlobIO if it is opened.\r\n * @note this BlobIO *may* be reused after this call by calling `open` again.\r\n */\r\n close(): void;\r\n /** get the total number of bytes in the blob */\r\n getNumBytes(): number;\r\n /** @return true if this BlobIO was successfully opened and may be use to read or write the blob */\r\n isValid(): boolean;\r\n /** Open this BlobIO against a table/row/column in a Db */\r\n open(\r\n /** The database for the blob */\r\n db: IModelJsNative.AnyDb,\r\n args: {\r\n /** the name of the table for the blob*/\r\n tableName: string;\r\n /** the name of the column for the blob */\r\n columnName: string;\r\n /** The rowId of the blob */\r\n row: number;\r\n /** If true, open this BlobIO for write access */\r\n writeable?: boolean;\r\n }): void;\r\n /** Read from a blob\r\n * @returns the contents of the requested byte range\r\n */\r\n read(args: {\r\n /** The number of bytes to read */\r\n numBytes: number;\r\n /** starting offset within the blob to read */\r\n offset: number;\r\n /** If present and of sufficient size, use this ArrayBuffer for the value. */\r\n blob?: ArrayBuffer;\r\n }): Uint8Array;\r\n /** Reposition this BlobIO to a new rowId\r\n * @note this BlobIO must be valid when this methods is called.\r\n */\r\n changeRow(row: number): void;\r\n /** Write to a blob */\r\n write(args: {\r\n /** The number of bytes to write */\r\n numBytes: number;\r\n /** starting offset within the blob to write */\r\n offset: number;\r\n /** the value to write */\r\n blob: ArrayBuffer;\r\n }): void;\r\n }\r\n\r\n /** Default transaction mode for SQLiteDbs.\r\n * @see https://www.sqlite.org/lang_transaction.html\r\n */\r\n export enum DefaultTxnMode {\r\n /** no default transaction is started. You must use BEGIN/COMMIT or SQLite will use implicit transactions */\r\n None = 0,\r\n /** A deferred transaction is started when the file is first opened. This is the default. */\r\n Deferred = 1,\r\n /** An immediate transaction is started when the file is first opened. */\r\n Immediate = 2,\r\n /** An exclusive transaction is started when the file is first opened. */\r\n Exclusive = 3\r\n }\r\n\r\n /** parameters common to opening or creating a new SQLiteDb */\r\n export interface OpenOrCreateParams {\r\n /** If true, do not require that the `be_Prop` table exist */\r\n rawSQLite?: boolean;\r\n /** @see immutable option at https://www.sqlite.org/c3ref/open.html */\r\n immutable?: boolean;\r\n /** Do not attempt to verify that the file is a valid sQLite file before opening. */\r\n skipFileCheck?: boolean;\r\n /** the default transaction mode\r\n * @see [[SQLiteDb.DefaultTxnMode]]\r\n */\r\n defaultTxn?: 0 | 1 | 2 | 3;\r\n /** see query parameters from 'URI Filenames' in https://www.sqlite.org/c3ref/open.html */\r\n queryParam?: string;\r\n }\r\n\r\n /** Parameters for opening an existing SQLiteDb */\r\n export interface OpenParams extends OpenOrCreateParams {\r\n /** use OpenMode.ReadWrite to open the file with write access */\r\n openMode: OpenMode;\r\n }\r\n\r\n /** Size of a SQLiteDb page in bytes */\r\n export interface PageSize {\r\n /** see https://www.sqlite.org/pragma.html#pragma_page_size */\r\n pageSize?: number;\r\n }\r\n\r\n /** Parameters for creating a new SQLiteDb */\r\n export type CreateParams = OpenOrCreateParams & PageSize;\r\n\r\n /** Arguments for `SqliteDb.withOpenDb` */\r\n export interface WithOpenDbArgs {\r\n /** The name of the database to open */\r\n dbName: string;\r\n /** either an object with the open parameters or just OpenMode value. */\r\n openMode?: OpenMode | SQLiteDb.OpenParams;\r\n /** @internal */\r\n container?: CloudSqlite.CloudContainer;\r\n }\r\n\r\n /** Arguments for `SQLiteDb.vacuum` */\r\n export interface VacuumDbArgs extends PageSize {\r\n /** if present, name of new file to [vacuum into](https://www.sqlite.org/lang_vacuum.html) */\r\n into?: LocalFileName;\r\n }\r\n}\r\n"]}
|