@itwin/core-backend 4.8.0-dev.2 → 4.8.0-dev.21
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 +31 -1
- package/lib/cjs/BackendHubAccess.d.ts +18 -16
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js +16 -15
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +3 -1
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +2 -0
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.d.ts +3 -3
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +4 -2
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +0 -6
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +0 -6
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +6 -5
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +1 -0
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
- package/lib/cjs/ChangedElementsDb.js +3 -2
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +237 -237
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +4 -26
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js +2 -101
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +2 -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.d.ts +49 -24
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +66 -7
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +4 -4
- package/lib/cjs/CodeService.d.ts.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.d.ts.map +1 -1
- package/lib/cjs/DevTools.js +2 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +0 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +0 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js +2 -2
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +2 -2
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +6 -3
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +3 -3
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +3 -60
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +8 -64
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +0 -5
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +4 -8
- 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/GeoCoordConfig.d.ts +10 -0
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +22 -24
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +2 -2
- 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/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +27 -97
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +139 -63
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +2 -2
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +13 -4
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +39 -32
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +2 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +2 -2
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +18 -18
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.d.ts +66 -0
- package/lib/cjs/LockControl.d.ts.map +1 -0
- package/lib/cjs/LockControl.js +11 -0
- package/lib/cjs/LockControl.js.map +1 -0
- package/lib/cjs/Material.d.ts +2 -5
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +6 -4
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +0 -22
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +4 -25
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +17 -7
- package/lib/cjs/PropertyStore.d.ts.map +1 -1
- package/lib/cjs/PropertyStore.js +11 -5
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +0 -12
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +0 -12
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +2 -3
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +5 -6
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +1 -1
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +2 -2
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js +3 -3
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +2 -2
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js +2 -2
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts +5 -1
- package/lib/cjs/TextAnnotationGeometry.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js +11 -8
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.d.ts +21 -13
- package/lib/cjs/TextAnnotationLayout.d.ts.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js +134 -92
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +2 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +2 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -18
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +1 -18
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts +16 -2
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +14 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +33 -0
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -132
- package/lib/cjs/core-backend.d.ts +3 -2
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +4 -6
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +0 -10
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +0 -18
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +0 -18
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.js +117 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
- package/lib/cjs/internal/NativePlatform.d.ts +15 -0
- package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
- package/lib/cjs/internal/NativePlatform.js +49 -0
- package/lib/cjs/internal/NativePlatform.js.map +1 -0
- package/lib/cjs/internal/NoLocks.d.ts +6 -0
- package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
- package/lib/cjs/internal/NoLocks.js +30 -0
- package/lib/cjs/internal/NoLocks.js.map +1 -0
- package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -17
- package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
- package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +22 -17
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +9 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -0
- package/lib/cjs/internal/Symbols.js +19 -0
- package/lib/cjs/internal/Symbols.js.map +1 -0
- package/lib/cjs/internal/cross-package.d.ts +3 -0
- package/lib/cjs/internal/cross-package.d.ts.map +1 -0
- package/lib/cjs/internal/cross-package.js +14 -0
- package/lib/cjs/internal/cross-package.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts +43 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js +161 -0
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts +6 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +276 -0
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts +41 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +696 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts +10 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +41 -0
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -0
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +5 -2
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +2 -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/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +167 -138
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +68 -138
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +112 -48
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +1 -172
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +411 -277
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +76 -457
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +245 -0
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -0
- package/lib/cjs/workspace/WorkspaceEditor.js +34 -0
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -0
- package/package.json +16 -15
- package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
- package/lib/cjs/ServerBasedLocks.js.map +0 -1
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +0 -45
package/lib/cjs/IModelDb.js
CHANGED
|
@@ -17,6 +17,7 @@ const core_geometry_1 = require("@itwin/core-geometry");
|
|
|
17
17
|
const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
|
|
18
18
|
const BriefcaseManager_1 = require("./BriefcaseManager");
|
|
19
19
|
const ChannelControl_1 = require("./ChannelControl");
|
|
20
|
+
const ChannelAdmin_1 = require("./internal/ChannelAdmin");
|
|
20
21
|
const CheckpointManager_1 = require("./CheckpointManager");
|
|
21
22
|
const ClassRegistry_1 = require("./ClassRegistry");
|
|
22
23
|
const CloudSqlite_1 = require("./CloudSqlite");
|
|
@@ -34,28 +35,20 @@ const IpcHost_1 = require("./IpcHost");
|
|
|
34
35
|
const Model_1 = require("./Model");
|
|
35
36
|
const Relationship_1 = require("./Relationship");
|
|
36
37
|
const SchemaSync_1 = require("./SchemaSync");
|
|
37
|
-
const ServerBasedLocks_1 = require("./ServerBasedLocks");
|
|
38
|
+
const ServerBasedLocks_1 = require("./internal/ServerBasedLocks");
|
|
38
39
|
const SqliteStatement_1 = require("./SqliteStatement");
|
|
39
40
|
const TxnManager_1 = require("./TxnManager");
|
|
40
41
|
const ViewDefinition_1 = require("./ViewDefinition");
|
|
41
42
|
const ViewStore_1 = require("./ViewStore");
|
|
42
43
|
const Settings_1 = require("./workspace/Settings");
|
|
43
44
|
const Workspace_1 = require("./workspace/Workspace");
|
|
45
|
+
const WorkspaceImpl_1 = require("./internal/workspace/WorkspaceImpl");
|
|
46
|
+
const SettingsImpl_1 = require("./internal/workspace/SettingsImpl");
|
|
47
|
+
const NativePlatform_1 = require("./internal/NativePlatform");
|
|
48
|
+
const NoLocks_1 = require("./internal/NoLocks");
|
|
49
|
+
const Symbols_1 = require("./internal/Symbols");
|
|
44
50
|
// spell:ignore fontid fontmap
|
|
45
51
|
const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.IModelDb;
|
|
46
|
-
/** A null-implementation of LockControl that does not attempt to limit access between briefcases. This relies on change-merging to resolve conflicts. */
|
|
47
|
-
class NoLocks {
|
|
48
|
-
get isServerBased() { return false; }
|
|
49
|
-
close() { }
|
|
50
|
-
clearAllLocks() { }
|
|
51
|
-
holdsExclusiveLock() { return false; }
|
|
52
|
-
holdsSharedLock() { return false; }
|
|
53
|
-
checkExclusiveLock() { }
|
|
54
|
-
checkSharedLock() { }
|
|
55
|
-
elementWasCreated() { }
|
|
56
|
-
async acquireLocks() { }
|
|
57
|
-
async releaseAllLocks() { }
|
|
58
|
-
}
|
|
59
52
|
/** @internal */
|
|
60
53
|
var BriefcaseLocalValue;
|
|
61
54
|
(function (BriefcaseLocalValue) {
|
|
@@ -74,16 +67,16 @@ const withBriefcaseDb = async (briefcase, fn) => {
|
|
|
74
67
|
};
|
|
75
68
|
/**
|
|
76
69
|
* Settings for an individual iModel. May only include settings priority for iModel, iTwin and organization.
|
|
77
|
-
* @note if there is more than one iModel for an iTwin or organization, they will *each* hold
|
|
70
|
+
* @note if there is more than one iModel for an iTwin or organization, they will *each* hold an independent copy of the settings for those priorities.
|
|
78
71
|
*/
|
|
79
|
-
class IModelSettings extends
|
|
72
|
+
class IModelSettings extends SettingsImpl_1.SettingsImpl {
|
|
80
73
|
verifyPriority(priority) {
|
|
81
74
|
if (priority <= Settings_1.SettingsPriority.application)
|
|
82
|
-
throw new Error("Use IModelHost.appSettings");
|
|
75
|
+
throw new Error("Use IModelHost.appSettings to access settings of priority 'application' or lower");
|
|
83
76
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
*getSettingEntries(name) {
|
|
78
|
+
yield* super.getSettingEntries(name);
|
|
79
|
+
yield* IModelHost_1.IModelHost.appWorkspace.settings.getSettingEntries(name);
|
|
87
80
|
}
|
|
88
81
|
}
|
|
89
82
|
/** An iModel database file. The database file can either be a briefcase or a snapshot.
|
|
@@ -94,10 +87,7 @@ class IModelSettings extends Settings_1.BaseSettings {
|
|
|
94
87
|
class IModelDb extends core_common_1.IModel {
|
|
95
88
|
/** @alpha */
|
|
96
89
|
get codeService() { return this._codeService; }
|
|
97
|
-
/**
|
|
98
|
-
* Get the [[LockControl]] for this iModel.
|
|
99
|
-
* @beta
|
|
100
|
-
*/
|
|
90
|
+
/** The [[LockControl]] that orchestrates [concurrent editing]($docs/learning/backend/ConcurrencyControl.md) of this iModel. */
|
|
101
91
|
get locks() { return this._locks; } // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
102
92
|
/**
|
|
103
93
|
* Get the [[Workspace]] for this iModel.
|
|
@@ -105,11 +95,11 @@ class IModelDb extends core_common_1.IModel {
|
|
|
105
95
|
*/
|
|
106
96
|
get workspace() {
|
|
107
97
|
if (undefined === this._workspace)
|
|
108
|
-
this._workspace =
|
|
98
|
+
this._workspace = (0, WorkspaceImpl_1.constructWorkspace)(new IModelSettings());
|
|
109
99
|
return this._workspace;
|
|
110
100
|
}
|
|
111
101
|
/** Acquire the exclusive schema lock on this iModel.
|
|
112
|
-
*
|
|
102
|
+
* @note: To acquire the schema lock, all other briefcases must first release *all* their locks. No other briefcases
|
|
113
103
|
* will be able to acquire *any* locks while the schema lock is held.
|
|
114
104
|
*/
|
|
115
105
|
async acquireSchemaLock() {
|
|
@@ -176,12 +166,12 @@ class IModelDb extends core_common_1.IModel {
|
|
|
176
166
|
this.views = new IModelDb.Views(this);
|
|
177
167
|
this.tiles = new IModelDb.Tiles(this);
|
|
178
168
|
/** @beta */
|
|
179
|
-
this.channels =
|
|
169
|
+
this.channels = (0, ChannelAdmin_1.createChannelControl)(this);
|
|
180
170
|
this._statementCache = new SqliteStatement_1.StatementCache();
|
|
181
171
|
this._sqliteStatementCache = new SqliteStatement_1.StatementCache();
|
|
182
172
|
this._snaps = new Map();
|
|
183
173
|
/** @internal */
|
|
184
|
-
this._locks =
|
|
174
|
+
this._locks = (0, NoLocks_1.createNoOpLockControl)();
|
|
185
175
|
/** Event called after a changeset is applied to this IModelDb. */
|
|
186
176
|
this.onChangesetApplied = new core_bentley_1.BeEvent();
|
|
187
177
|
/** Event called when the iModel is about to be closed. */
|
|
@@ -199,7 +189,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
199
189
|
this.nativeDb.closeFile();
|
|
200
190
|
};
|
|
201
191
|
this.nativeDb.setIModelDb(this);
|
|
202
|
-
this.
|
|
192
|
+
this.loadIModelSettings();
|
|
203
193
|
GeoCoordConfig_1.GeoCoordConfig.loadForImodel(this.workspace.settings); // load gcs data specified by iModel's settings dictionaries, must be done before calling initializeIModelDb
|
|
204
194
|
this.initializeIModelDb();
|
|
205
195
|
IModelDb._openDbs.set(this._fileKey, this);
|
|
@@ -222,7 +212,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
222
212
|
this.beforeClose();
|
|
223
213
|
IModelDb._openDbs.delete(this._fileKey);
|
|
224
214
|
this._workspace?.close();
|
|
225
|
-
this.locks.
|
|
215
|
+
this.locks[Symbols_1._close]();
|
|
226
216
|
this._locks = undefined;
|
|
227
217
|
this._codeService?.close();
|
|
228
218
|
this._codeService = undefined;
|
|
@@ -498,7 +488,32 @@ class IModelDb extends core_common_1.IModel {
|
|
|
498
488
|
return stmt;
|
|
499
489
|
}
|
|
500
490
|
/**
|
|
501
|
-
* queries the BisCore.SubCategory table for
|
|
491
|
+
* queries the BisCore.SubCategory table for entries that are children of used spatial categories and 3D elements.
|
|
492
|
+
* @returns array of SubCategoryResultRow
|
|
493
|
+
* @internal
|
|
494
|
+
*/
|
|
495
|
+
async queryAllUsedSpatialSubCategories() {
|
|
496
|
+
const result = [];
|
|
497
|
+
const parentCategoriesQuery = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
|
|
498
|
+
const parentCategories = [];
|
|
499
|
+
for await (const row of this.createQueryReader(parentCategoriesQuery)) {
|
|
500
|
+
parentCategories.push(row.id);
|
|
501
|
+
}
|
|
502
|
+
;
|
|
503
|
+
const where = [...parentCategories].join(",");
|
|
504
|
+
const query = `SELECT ECInstanceId as id, Parent.Id as parentId, Properties as appearance FROM BisCore.SubCategory WHERE Parent.Id IN (${where})`;
|
|
505
|
+
try {
|
|
506
|
+
for await (const row of this.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames })) {
|
|
507
|
+
result.push(row.toRow());
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
catch {
|
|
511
|
+
// We can ignore the error here, and just return whatever we were able to query.
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* queries the BisCore.SubCategory table for the entries that are children of the passed categoryIds.
|
|
502
517
|
* @param categoryIds categoryIds to query
|
|
503
518
|
* @returns array of SubCategoryResultRow
|
|
504
519
|
* @internal
|
|
@@ -627,7 +642,9 @@ class IModelDb extends core_common_1.IModel {
|
|
|
627
642
|
this.nativeDb.performCheckpoint();
|
|
628
643
|
}
|
|
629
644
|
}
|
|
630
|
-
/** @internal
|
|
645
|
+
/** @internal
|
|
646
|
+
* @deprecated in 4.8. Use `txns.reverseTxns`.
|
|
647
|
+
*/
|
|
631
648
|
reverseTxns(numOperations) {
|
|
632
649
|
return this.nativeDb.reverseTxns(numOperations);
|
|
633
650
|
}
|
|
@@ -780,7 +797,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
780
797
|
if (isUpgradeRequested && openMode !== core_bentley_1.OpenMode.ReadWrite)
|
|
781
798
|
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.UpgradeFailed, "Cannot upgrade a Readonly Db");
|
|
782
799
|
try {
|
|
783
|
-
const nativeDb = new
|
|
800
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
784
801
|
const container = props?.container;
|
|
785
802
|
if (container) {
|
|
786
803
|
// temp files for cloud-based Dbs should be in the profileDir in a subdirectory named for their container
|
|
@@ -1045,7 +1062,7 @@ class IModelDb extends core_common_1.IModel {
|
|
|
1045
1062
|
async requestSnap(sessionId, props) {
|
|
1046
1063
|
let request = this._snaps.get(sessionId);
|
|
1047
1064
|
if (undefined === request) {
|
|
1048
|
-
request = new
|
|
1065
|
+
request = new NativePlatform_1.IModelNative.platform.SnapRequest();
|
|
1049
1066
|
this._snaps.set(sessionId, request);
|
|
1050
1067
|
}
|
|
1051
1068
|
else
|
|
@@ -1182,24 +1199,54 @@ class IModelDb extends core_common_1.IModel {
|
|
|
1182
1199
|
this.saveChanges("delete settings");
|
|
1183
1200
|
}
|
|
1184
1201
|
/** Load all setting dictionaries in this iModel into `this.workspace.settings` */
|
|
1185
|
-
|
|
1202
|
+
loadIModelSettings() {
|
|
1186
1203
|
if (!this.nativeDb.isOpen())
|
|
1187
1204
|
return;
|
|
1188
1205
|
this.withSqliteStatement("SELECT Name,StrData FROM be_Prop WHERE Namespace=?", (stmt) => {
|
|
1189
1206
|
stmt.bindString(1, IModelDb._settingPropNamespace);
|
|
1190
1207
|
while (stmt.nextRow()) {
|
|
1191
1208
|
try {
|
|
1192
|
-
const
|
|
1193
|
-
this.workspace.settings.addDictionary(stmt.getValueString(0), Settings_1.SettingsPriority.iModel,
|
|
1209
|
+
const settings = JSON.parse(stmt.getValueString(1));
|
|
1210
|
+
this.workspace.settings.addDictionary({ name: stmt.getValueString(0), priority: Settings_1.SettingsPriority.iModel }, settings);
|
|
1194
1211
|
}
|
|
1195
1212
|
catch (e) {
|
|
1196
|
-
|
|
1213
|
+
Workspace_1.Workspace.exceptionDiagnosticFn(e);
|
|
1197
1214
|
}
|
|
1198
1215
|
}
|
|
1199
1216
|
});
|
|
1200
1217
|
}
|
|
1218
|
+
/** @internal */
|
|
1219
|
+
async loadWorkspaceSettings() {
|
|
1220
|
+
try {
|
|
1221
|
+
const problems = [];
|
|
1222
|
+
const settingProps = [];
|
|
1223
|
+
// Note: we can't use `getArray` here because we only look at dictionaries in the iModel's workspace, not appWorkspace.
|
|
1224
|
+
// Also, we must concatenate all entries in all of the dictionaries stored in the iModel into a single array *before*
|
|
1225
|
+
// calling `loadSettingsDictionary` since that function will add new dictionaries to the workspace.
|
|
1226
|
+
for (const dict of this.workspace.settings.dictionaries) {
|
|
1227
|
+
try {
|
|
1228
|
+
const props = dict.getSetting(Workspace_1.WorkspaceSettingNames.settingsWorkspaces);
|
|
1229
|
+
if (props)
|
|
1230
|
+
settingProps.push(...IModelHost_1.IModelHost.settingsSchemas.validateSetting(props, Workspace_1.WorkspaceSettingNames.settingsWorkspaces));
|
|
1231
|
+
}
|
|
1232
|
+
catch (e) {
|
|
1233
|
+
problems.push(e); // something wrong with the setting stored in the iModel
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
if (settingProps.length > 0)
|
|
1237
|
+
await this.workspace.loadSettingsDictionary(settingProps, problems);
|
|
1238
|
+
if (problems.length > 0)
|
|
1239
|
+
(0, WorkspaceImpl_1.throwWorkspaceDbLoadErrors)(`attempting to load workspace settings for iModel '${this.name}':`, problems);
|
|
1240
|
+
}
|
|
1241
|
+
catch (e) {
|
|
1242
|
+
// we don't want to throw exceptions when attempting to load Dictionaries. Call the diagnostics function instead.
|
|
1243
|
+
Workspace_1.Workspace.exceptionDiagnosticFn(e);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1201
1246
|
/**
|
|
1202
|
-
* Controls how [Code]($common)s are copied from this iModel into another iModel, to work around problems with iModels
|
|
1247
|
+
* Controls how [Code]($common)s are copied from this iModel into another iModel, to work around problems with iModels
|
|
1248
|
+
* created by older connectors. The [imodel-transformer](https://github.com/iTwin/imodel-transformer) sets this appropriately
|
|
1249
|
+
* on your behalf - you should never need to set or interrogate this property yourself.
|
|
1203
1250
|
* @public
|
|
1204
1251
|
*/
|
|
1205
1252
|
get codeValueBehavior() {
|
|
@@ -1854,9 +1901,9 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1854
1901
|
*/
|
|
1855
1902
|
getAspects(elementId, aspectClassFullName, excludedClassFullNames) {
|
|
1856
1903
|
if (aspectClassFullName === undefined) {
|
|
1857
|
-
const allAspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1858
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
|
|
1859
|
-
UNION ALL
|
|
1904
|
+
const allAspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1905
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId
|
|
1906
|
+
UNION ALL
|
|
1860
1907
|
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
|
|
1861
1908
|
if (allAspects.length === 0)
|
|
1862
1909
|
core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
|
|
@@ -1874,7 +1921,7 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1874
1921
|
let classIdList = IModelDb.Elements.classMap.get(aspectClassFullName);
|
|
1875
1922
|
if (classIdList === undefined) {
|
|
1876
1923
|
const classIds = [];
|
|
1877
|
-
this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
|
|
1924
|
+
this._iModel.withPreparedStatement(`select SourceECInstanceId from meta.ClassHasAllBaseClasses where TargetECInstanceId = (select ECInstanceId from meta.ECClassDef where Name='${fullClassName[1]}'
|
|
1878
1925
|
and Schema.Id = (select ECInstanceId from meta.ECSchemaDef where Name='${fullClassName[0]}')) and SourceECInstanceId != TargetECInstanceId`, (statement) => {
|
|
1879
1926
|
while (statement.step() === core_bentley_1.DbResult.BE_SQLITE_ROW)
|
|
1880
1927
|
classIds.push(statement.getValue(0).getId());
|
|
@@ -1889,10 +1936,10 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1889
1936
|
return [];
|
|
1890
1937
|
}
|
|
1891
1938
|
// Execute an instance query to retrieve all aspects from all the derived classes
|
|
1892
|
-
const aspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1893
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1894
|
-
UNION ALL
|
|
1895
|
-
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1939
|
+
const aspects = this.runInstanceQuery(`SELECT $ FROM (
|
|
1940
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementMultiAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1941
|
+
UNION ALL
|
|
1942
|
+
SELECT ECInstanceId, ECClassId FROM Bis.ElementUniqueAspect WHERE Element.Id = :elementId AND ECClassId IN (${classIdList})
|
|
1896
1943
|
) OPTIONS USE_JS_PROP_NAMES DO_NOT_TRUNCATE_BLOB`, elementId, excludedClassFullNames);
|
|
1897
1944
|
if (aspects.length === 0)
|
|
1898
1945
|
core_bentley_1.Logger.logInfo(BackendLoggerCategory_1.BackendLoggerCategory.ECDb, `No aspects found for class ${aspectClassFullName} and element ${elementId}`);
|
|
@@ -1972,7 +2019,6 @@ IModelDb._settingPropNamespace = "settings";
|
|
|
1972
2019
|
}
|
|
1973
2020
|
const accessToken = await CloudSqlite_1.CloudSqlite.requestToken({
|
|
1974
2021
|
...props,
|
|
1975
|
-
userToken: args.userToken,
|
|
1976
2022
|
accessLevel: args.accessLevel,
|
|
1977
2023
|
});
|
|
1978
2024
|
if (!this._viewStore)
|
|
@@ -2256,7 +2302,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2256
2302
|
// if the iModel uses a lock server, create a ServerBasedLocks LockControl for this BriefcaseDb.
|
|
2257
2303
|
makeLockControl() {
|
|
2258
2304
|
if (this.useLockServer)
|
|
2259
|
-
this._locks =
|
|
2305
|
+
this._locks = (0, ServerBasedLocks_1.createServerBasedLocks)(this);
|
|
2260
2306
|
}
|
|
2261
2307
|
constructor(args) {
|
|
2262
2308
|
super({ ...args, changeset: args.nativeDb.getCurrentChangeset() });
|
|
@@ -2327,7 +2373,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2327
2373
|
await this.doUpgrade(briefcase, { domain: core_common_1.DomainOptions.Upgrade, schemaLockHeld: true }, "Upgraded domain schemas");
|
|
2328
2374
|
}
|
|
2329
2375
|
finally {
|
|
2330
|
-
await withBriefcaseDb(briefcase, async (db) => db.locks.
|
|
2376
|
+
await withBriefcaseDb(briefcase, async (db) => db.locks[Symbols_1._releaseAllLocks]());
|
|
2331
2377
|
}
|
|
2332
2378
|
return;
|
|
2333
2379
|
}
|
|
@@ -2344,7 +2390,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2344
2390
|
await this.doUpgrade(briefcase, { domain: core_common_1.DomainOptions.Upgrade, schemaLockHeld: true }, "Upgraded domain schemas");
|
|
2345
2391
|
}
|
|
2346
2392
|
finally {
|
|
2347
|
-
await withBriefcaseDb(briefcase, async (db) => db.locks.
|
|
2393
|
+
await withBriefcaseDb(briefcase, async (db) => db.locks[Symbols_1._releaseAllLocks]());
|
|
2348
2394
|
}
|
|
2349
2395
|
}
|
|
2350
2396
|
throw error;
|
|
@@ -2368,26 +2414,44 @@ class BriefcaseDb extends IModelDb {
|
|
|
2368
2414
|
// Restart default txn to trigger events when watch file is changed by some other process.
|
|
2369
2415
|
const watcher = fs.watch(briefcaseDb.watchFilePathName, { persistent: false }, () => {
|
|
2370
2416
|
nativeDb.restartDefaultTxn();
|
|
2417
|
+
briefcaseDb.changeset = briefcaseDb.nativeDb.getCurrentChangeset();
|
|
2371
2418
|
});
|
|
2372
2419
|
// Stop the watcher when we close this connection.
|
|
2373
2420
|
briefcaseDb.onBeforeClose.addOnce(() => {
|
|
2374
2421
|
watcher.close();
|
|
2375
2422
|
});
|
|
2376
2423
|
}
|
|
2424
|
+
// load all of the settings from workspaces
|
|
2425
|
+
await briefcaseDb.loadWorkspaceSettings();
|
|
2377
2426
|
if (openMode === core_bentley_1.OpenMode.ReadWrite && CodeService_1.CodeService.createForIModel) {
|
|
2378
2427
|
try {
|
|
2379
2428
|
briefcaseDb._codeService = await CodeService_1.CodeService.createForIModel(briefcaseDb);
|
|
2380
2429
|
this.onCodeServiceCreated.raiseEvent(briefcaseDb);
|
|
2381
2430
|
}
|
|
2382
2431
|
catch (e) {
|
|
2383
|
-
if (e.errorId !== "NoCodeIndex") // no code index means iModel isn't enforcing codes.
|
|
2384
|
-
|
|
2432
|
+
if (e.errorId !== "NoCodeIndex") { // no code index means iModel isn't enforcing codes.
|
|
2433
|
+
core_bentley_1.Logger.logWarning(loggerCategory, `The CodeService is not available for this briefcase: errorId: ${e.errorId}, errorMessage; ${e.message}. Proceeding with BriefcaseDb.open(), but all operations involving codes will fail.`);
|
|
2434
|
+
briefcaseDb._codeService = {
|
|
2435
|
+
verifyCode: (props) => {
|
|
2436
|
+
if (!core_common_1.Code.isEmpty(props.props.code)) {
|
|
2437
|
+
e.message = `The CodeService is not available for this briefcase: errorId: ${e.errorId}, errorMessage; ${e.message}.`;
|
|
2438
|
+
throw e;
|
|
2439
|
+
}
|
|
2440
|
+
},
|
|
2441
|
+
appParams: {
|
|
2442
|
+
author: { name: "unknown" },
|
|
2443
|
+
origin: { name: "unknown" },
|
|
2444
|
+
},
|
|
2445
|
+
close: () => { },
|
|
2446
|
+
initialize: async () => { },
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2385
2449
|
}
|
|
2386
2450
|
}
|
|
2387
2451
|
this.onOpened.raiseEvent(briefcaseDb, args);
|
|
2388
2452
|
return briefcaseDb;
|
|
2389
2453
|
}
|
|
2390
|
-
|
|
2454
|
+
/** This is called by native code when applying a changeset */
|
|
2391
2455
|
onChangesetConflict(args) {
|
|
2392
2456
|
// returning undefined will result in native handler to resolve conflict
|
|
2393
2457
|
const category = "DgnCore";
|
|
@@ -2518,7 +2582,6 @@ class BriefcaseDb extends IModelDb {
|
|
|
2518
2582
|
* + Also see comments in TxnManager::MergeDataChanges()
|
|
2519
2583
|
*/
|
|
2520
2584
|
if (core_bentley_1.Logger.isEnabled(category, core_bentley_1.LogLevel.Info)) {
|
|
2521
|
-
core_bentley_1.Logger.logInfo(category, "------------------------------------------------------------------");
|
|
2522
2585
|
core_bentley_1.Logger.logInfo(category, `Conflict detected - Cause: ${interpretConflictCause(args.cause)}`);
|
|
2523
2586
|
args.dump();
|
|
2524
2587
|
core_bentley_1.Logger.logInfo(category, "Conflicting resolved by replacing the existing entry with the change");
|
|
@@ -2529,7 +2592,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2529
2592
|
* Execute the supplied function.
|
|
2530
2593
|
* If the briefcase was read-only, reopen the native briefcase as read-only.
|
|
2531
2594
|
* @note this._openMode is not changed from its initial value.
|
|
2532
|
-
* @internal Exported strictly for tests
|
|
2595
|
+
* @internal Exported strictly for tests
|
|
2533
2596
|
*/
|
|
2534
2597
|
async executeWritable(func) {
|
|
2535
2598
|
const fileName = this.pathName;
|
|
@@ -2546,7 +2609,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2546
2609
|
finally {
|
|
2547
2610
|
if (isReadonly) {
|
|
2548
2611
|
if (locks !== this._locks) { // did we have to create a ServerBasedLocks?
|
|
2549
|
-
this.locks.
|
|
2612
|
+
this.locks[Symbols_1._close](); // yes, close it and reset back to previous
|
|
2550
2613
|
this._locks = locks;
|
|
2551
2614
|
}
|
|
2552
2615
|
this.closeAndReopen(core_bentley_1.OpenMode.Readonly, fileName);
|
|
@@ -2561,6 +2624,11 @@ class BriefcaseDb extends IModelDb {
|
|
|
2561
2624
|
this.nativeDb.openIModel(fileName, openMode);
|
|
2562
2625
|
// Restore the native db's pointer to this JavaScript object.
|
|
2563
2626
|
this.nativeDb.setIModelDb(this);
|
|
2627
|
+
// refresh cached properties that could have been changed by another process writing to the same briefcase
|
|
2628
|
+
this.changeset = this.nativeDb.getCurrentChangeset();
|
|
2629
|
+
// assert what should never change
|
|
2630
|
+
if (this.iModelId !== this.nativeDb.getIModelId() || this.iTwinId !== this.nativeDb.getITwinId())
|
|
2631
|
+
throw new Error("closeAndReopen detected change in iModelId and/or iTwinId");
|
|
2564
2632
|
}
|
|
2565
2633
|
/** Pull and apply changesets from iModelHub */
|
|
2566
2634
|
async pullChanges(arg) {
|
|
@@ -2570,6 +2638,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2570
2638
|
this.initializeIModelDb();
|
|
2571
2639
|
});
|
|
2572
2640
|
IpcHost_1.IpcHost.notifyTxns(this, "notifyPulledChanges", this.changeset);
|
|
2641
|
+
this.txns.touchWatchFile();
|
|
2573
2642
|
}
|
|
2574
2643
|
/** Push changes to iModelHub. */
|
|
2575
2644
|
async pushChanges(arg) {
|
|
@@ -2586,6 +2655,7 @@ class BriefcaseDb extends IModelDb {
|
|
|
2586
2655
|
});
|
|
2587
2656
|
const changeset = this.changeset;
|
|
2588
2657
|
IpcHost_1.IpcHost.notifyTxns(this, "notifyPushedChanges", changeset);
|
|
2658
|
+
this.txns.touchWatchFile();
|
|
2589
2659
|
}
|
|
2590
2660
|
close() {
|
|
2591
2661
|
super.close();
|
|
@@ -2680,14 +2750,14 @@ class SnapshotDb extends IModelDb {
|
|
|
2680
2750
|
}
|
|
2681
2751
|
/** Create an *empty* local [Snapshot]($docs/learning/backend/AccessingIModels.md#snapshot-imodels) iModel file.
|
|
2682
2752
|
* Snapshots are not synchronized with iModelHub, so do not have a change timeline.
|
|
2683
|
-
*
|
|
2753
|
+
* @note: A *snapshot* cannot be modified after [[close]] is called.
|
|
2684
2754
|
* @param filePath The file that will contain the new iModel *snapshot*
|
|
2685
2755
|
* @param options The parameters that define the new iModel *snapshot*
|
|
2686
2756
|
* @returns A writeable SnapshotDb
|
|
2687
2757
|
* @see [Snapshot iModels]($docs/learning/backend/AccessingIModels.md#snapshot-imodels)
|
|
2688
2758
|
*/
|
|
2689
2759
|
static createEmpty(filePath, options) {
|
|
2690
|
-
const nativeDb = new
|
|
2760
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
2691
2761
|
nativeDb.createIModel(filePath, options);
|
|
2692
2762
|
nativeDb.resetBriefcaseId(core_common_1.BriefcaseIdValue.Unassigned);
|
|
2693
2763
|
const snapshotDb = new SnapshotDb(nativeDb, core_bentley_1.Guid.createValue());
|
|
@@ -2698,7 +2768,7 @@ class SnapshotDb extends IModelDb {
|
|
|
2698
2768
|
}
|
|
2699
2769
|
/** Create a local [Snapshot]($docs/learning/backend/AccessingIModels.md#snapshot-imodels) iModel file, using this iModel as a *seed* or starting point.
|
|
2700
2770
|
* Snapshots are not synchronized with iModelHub, so do not have a change timeline.
|
|
2701
|
-
*
|
|
2771
|
+
* @note: A *snapshot* cannot be modified after [[close]] is called.
|
|
2702
2772
|
* @param iModelDb The snapshot will be initialized from the current contents of this iModelDb
|
|
2703
2773
|
* @param snapshotFile The file that will contain the new iModel *snapshot*
|
|
2704
2774
|
* @param options Optional properties that determine how the snapshot iModel is created.
|
|
@@ -2708,7 +2778,7 @@ class SnapshotDb extends IModelDb {
|
|
|
2708
2778
|
static createFrom(iModelDb, snapshotFile, options) {
|
|
2709
2779
|
iModelDb.performCheckpoint();
|
|
2710
2780
|
IModelJsFs_1.IModelJsFs.copySync(iModelDb.pathName, snapshotFile);
|
|
2711
|
-
const nativeDb = new
|
|
2781
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
2712
2782
|
nativeDb.openIModel(snapshotFile, core_bentley_1.OpenMode.ReadWrite, undefined, options);
|
|
2713
2783
|
nativeDb.vacuum();
|
|
2714
2784
|
// Replace iModelId if seedFile is a snapshot, preserve iModelId if seedFile is an iModelHub-managed briefcase
|
|
@@ -2741,7 +2811,11 @@ class SnapshotDb extends IModelDb {
|
|
|
2741
2811
|
static openFile(path, opts) {
|
|
2742
2812
|
this.onOpen.raiseEvent(path, opts);
|
|
2743
2813
|
const file = { path, key: opts?.key };
|
|
2814
|
+
const wasKeyUndefined = opts?.key === undefined;
|
|
2744
2815
|
const nativeDb = this.openDgnDb(file, core_bentley_1.OpenMode.Readonly, undefined, opts);
|
|
2816
|
+
if (wasKeyUndefined) {
|
|
2817
|
+
file.key = `${nativeDb.getIModelId()}:${nativeDb.getCurrentChangeset().id}`;
|
|
2818
|
+
}
|
|
2745
2819
|
(0, core_bentley_1.assert)(undefined !== file.key);
|
|
2746
2820
|
const db = new SnapshotDb(nativeDb, file.key);
|
|
2747
2821
|
this.onOpened.raiseEvent(db);
|
|
@@ -2750,7 +2824,9 @@ class SnapshotDb extends IModelDb {
|
|
|
2750
2824
|
static async attachAndOpenCheckpoint(checkpoint) {
|
|
2751
2825
|
const { dbName, container } = await CheckpointManager_1.V2CheckpointManager.attach(checkpoint);
|
|
2752
2826
|
const key = CheckpointManager_1.CheckpointManager.getKey(checkpoint);
|
|
2753
|
-
|
|
2827
|
+
const db = SnapshotDb.openFile(dbName, { key, container });
|
|
2828
|
+
await db.loadWorkspaceSettings();
|
|
2829
|
+
return db;
|
|
2754
2830
|
}
|
|
2755
2831
|
/** @internal */
|
|
2756
2832
|
static async openCheckpointFromRpc(checkpoint) {
|
|
@@ -2836,7 +2912,7 @@ class StandaloneDb extends BriefcaseDb {
|
|
|
2836
2912
|
* @param args The parameters that define the new iModel
|
|
2837
2913
|
*/
|
|
2838
2914
|
static createEmpty(filePath, args) {
|
|
2839
|
-
const nativeDb = new
|
|
2915
|
+
const nativeDb = new NativePlatform_1.IModelNative.platform.DgnDb();
|
|
2840
2916
|
nativeDb.createIModel(filePath, args);
|
|
2841
2917
|
nativeDb.saveLocalValue(BriefcaseLocalValue.StandaloneEdit, args.allowEdit);
|
|
2842
2918
|
nativeDb.setITwinId(core_bentley_1.Guid.empty);
|