@itwin/core-backend 3.6.0-dev.35 → 3.6.0-dev.36
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/LICENSE.md +1 -1
- package/lib/cjs/AliCloudStorageService.d.ts +23 -23
- package/lib/cjs/AliCloudStorageService.js +71 -71
- package/lib/cjs/AliCloudStorageService.js.map +1 -1
- package/lib/cjs/BackendHubAccess.d.ts +224 -224
- package/lib/cjs/BackendHubAccess.js +41 -41
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
- package/lib/cjs/BackendLoggerCategory.js +99 -99
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts +21 -21
- package/lib/cjs/BisCoreSchema.js +60 -60
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +170 -170
- package/lib/cjs/BriefcaseManager.js +413 -413
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +153 -153
- package/lib/cjs/Category.js +243 -243
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
- package/lib/cjs/ChangeSummaryManager.js +447 -447
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +99 -99
- package/lib/cjs/ChangedElementsDb.js +165 -165
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.d.ts +39 -39
- package/lib/cjs/ChangedElementsManager.js +88 -88
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +122 -122
- package/lib/cjs/CheckpointManager.js +343 -343
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +79 -79
- package/lib/cjs/ClassRegistry.js +249 -249
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +350 -350
- package/lib/cjs/CloudSqlite.js +153 -153
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CloudStorageBackend.d.ts +58 -58
- package/lib/cjs/CloudStorageBackend.js +173 -173
- package/lib/cjs/CloudStorageBackend.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +396 -396
- package/lib/cjs/CodeService.js +63 -63
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +50 -50
- package/lib/cjs/CodeSpecs.js +112 -112
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +13 -13
- package/lib/cjs/ConcurrentQuery.js +36 -36
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
- package/lib/cjs/CustomViewState3dCreator.js +81 -81
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts +71 -71
- package/lib/cjs/DevTools.js +154 -154
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +106 -106
- package/lib/cjs/DisplayStyle.js +256 -256
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +191 -191
- package/lib/cjs/ECDb.js +350 -350
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
- package/lib/cjs/ECSchemaXmlContext.js +41 -41
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +473 -466
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +791 -791
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +1102 -1102
- package/lib/cjs/Element.js +1416 -1416
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +176 -176
- package/lib/cjs/ElementAspect.js +211 -211
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +9 -9
- package/lib/cjs/ElementGraphics.js +41 -41
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +162 -162
- package/lib/cjs/ElementTreeWalker.js +409 -409
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +106 -106
- package/lib/cjs/Entity.js +134 -134
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.d.ts +49 -49
- package/lib/cjs/EntityReferences.js +95 -95
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +317 -317
- package/lib/cjs/ExportGraphics.js +208 -208
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +96 -96
- package/lib/cjs/ExternalSource.js +131 -131
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +19 -19
- package/lib/cjs/GeoCoordConfig.js +85 -85
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts +4 -4
- package/lib/cjs/GeometrySummary.js +380 -380
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.d.ts +94 -94
- package/lib/cjs/HubMock.js +222 -222
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +8 -8
- package/lib/cjs/IModelCloneContext.js +15 -15
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +1183 -1183
- package/lib/cjs/IModelDb.js +2374 -2374
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
- package/lib/cjs/IModelElementCloneContext.js +159 -159
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +370 -370
- package/lib/cjs/IModelHost.js +496 -496
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +62 -62
- package/lib/cjs/IModelJsFs.js +140 -140
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts +104 -104
- package/lib/cjs/IpcHost.js +278 -278
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +311 -311
- package/lib/cjs/LineStyle.js +295 -295
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +162 -162
- package/lib/cjs/LocalHub.js +587 -587
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
- package/lib/cjs/LocalhostIpcHost.js +81 -81
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +103 -103
- package/lib/cjs/Material.js +147 -147
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +392 -392
- package/lib/cjs/Model.js +485 -485
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.d.ts +51 -51
- package/lib/cjs/NativeAppStorage.js +202 -202
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts +52 -52
- package/lib/cjs/NativeHost.js +163 -163
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +156 -156
- package/lib/cjs/NavigationRelationship.js +225 -225
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +51 -51
- package/lib/cjs/PromiseMemoizer.js +101 -101
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +132 -132
- package/lib/cjs/PropertyStore.js +11 -11
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +416 -416
- package/lib/cjs/Relationship.js +494 -494
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.d.ts +5 -5
- package/lib/cjs/RpcBackend.js +31 -31
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +219 -219
- package/lib/cjs/SQLiteDb.js +214 -214
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +55 -55
- package/lib/cjs/Schema.js +83 -83
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.d.ts +57 -57
- package/lib/cjs/ServerBasedLocks.js +168 -168
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +360 -360
- package/lib/cjs/SqliteStatement.js +586 -586
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +58 -58
- package/lib/cjs/Texture.js +82 -82
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +18 -18
- package/lib/cjs/TileStorage.js +90 -90
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +202 -202
- package/lib/cjs/TxnManager.js +356 -356
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +439 -439
- package/lib/cjs/ViewDefinition.js +646 -646
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +13 -13
- package/lib/cjs/ViewStateHydrator.js +103 -103
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
- package/lib/cjs/core-backend.d.ts +184 -184
- package/lib/cjs/core-backend.js +204 -204
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
- package/lib/cjs/domains/FunctionalElements.js +145 -145
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
- package/lib/cjs/domains/FunctionalSchema.js +40 -40
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +177 -177
- package/lib/cjs/domains/GenericElements.js +263 -263
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.d.ts +10 -10
- package/lib/cjs/domains/GenericSchema.js +28 -28
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc/multipart.d.ts +11 -11
- package/lib/cjs/rpc/multipart.js +70 -70
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.d.ts +28 -28
- package/lib/cjs/rpc/tracing.js +73 -73
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.d.ts +9 -9
- package/lib/cjs/rpc/web/logging.js +42 -42
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.d.ts +6 -6
- package/lib/cjs/rpc/web/request.js +73 -73
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.d.ts +6 -6
- package/lib/cjs/rpc/web/response.js +105 -105
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +291 -291
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +186 -186
- package/lib/cjs/workspace/Settings.js +155 -155
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
- package/lib/cjs/workspace/SettingsSchemas.js +191 -191
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +414 -414
- package/lib/cjs/workspace/Workspace.js +543 -543
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChangedElementsManager = void 0;
|
|
4
|
-
const BriefcaseManager_1 = require("./BriefcaseManager");
|
|
5
|
-
const ChangedElementsDb_1 = require("./ChangedElementsDb");
|
|
6
|
-
const IModelJsFs_1 = require("./IModelJsFs");
|
|
7
|
-
/** Utilities for querying changed elements caches */
|
|
8
|
-
/** @internal */
|
|
9
|
-
class ChangedElementsManager {
|
|
10
|
-
static getChangedElementsPathName(iModelId) { return BriefcaseManager_1.BriefcaseManager.getChangedElementsPathName(iModelId); }
|
|
11
|
-
/** Get changed elements Db */
|
|
12
|
-
static getChangedElementsDb(iModelId) {
|
|
13
|
-
if (this._entry && this._entry.iModelId === iModelId)
|
|
14
|
-
return this._entry.db;
|
|
15
|
-
if (this._entry && this._entry.iModelId !== iModelId) {
|
|
16
|
-
this._entry.db.closeDb();
|
|
17
|
-
this._entry.db.cleanCaches();
|
|
18
|
-
this._entry = undefined;
|
|
19
|
-
}
|
|
20
|
-
if (!this._entry) {
|
|
21
|
-
const path = ChangedElementsManager.getChangedElementsPathName(iModelId);
|
|
22
|
-
if (!IModelJsFs_1.IModelJsFs.existsSync(path))
|
|
23
|
-
return undefined;
|
|
24
|
-
const db = ChangedElementsDb_1.ChangedElementsDb.openDb(path);
|
|
25
|
-
this._entry = {
|
|
26
|
-
iModelId,
|
|
27
|
-
db,
|
|
28
|
-
};
|
|
29
|
-
return db;
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
static cleanUp() {
|
|
34
|
-
if (this._entry) {
|
|
35
|
-
this._entry.db.closeDb();
|
|
36
|
-
this._entry.db.cleanCaches();
|
|
37
|
-
this._entry = undefined;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** Gets the changed elements from the cache if found
|
|
41
|
-
* @param iModelId Id of the iModel
|
|
42
|
-
* @param startChangesetId Start changeset Id
|
|
43
|
-
* @param endChangesetId End changeset Id
|
|
44
|
-
* @returns Changed elements if found
|
|
45
|
-
*/
|
|
46
|
-
static getChangedElements(iModelId, startChangesetId, endChangesetId) {
|
|
47
|
-
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
48
|
-
if (!db)
|
|
49
|
-
return undefined;
|
|
50
|
-
return db.getChangedElements(startChangesetId, endChangesetId);
|
|
51
|
-
}
|
|
52
|
-
/** Gets the changed models from the cache if found
|
|
53
|
-
* @param iModelId Id of the iModel
|
|
54
|
-
* @param startChangesetId Start changeset Id
|
|
55
|
-
* @param endChangesetId End changeset Id
|
|
56
|
-
* @returns Changed models if found
|
|
57
|
-
*/
|
|
58
|
-
static getChangedModels(iModelId, startChangesetId, endChangesetId) {
|
|
59
|
-
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
60
|
-
if (!db)
|
|
61
|
-
return undefined;
|
|
62
|
-
return db.getChangedModels(startChangesetId, endChangesetId);
|
|
63
|
-
}
|
|
64
|
-
/** Gets the change data (models and elements) from the cache if found
|
|
65
|
-
* @param iModelId Id of the iModel
|
|
66
|
-
* @param startChangesetId Start changeset Id
|
|
67
|
-
* @param endChangesetId End changeset Id
|
|
68
|
-
* @returns Changed models if found
|
|
69
|
-
*/
|
|
70
|
-
static getChangeData(iModelId, startChangesetId, endChangesetId) {
|
|
71
|
-
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
72
|
-
if (!db)
|
|
73
|
-
return undefined;
|
|
74
|
-
return db.getChangeData(startChangesetId, endChangesetId);
|
|
75
|
-
}
|
|
76
|
-
/** Checks if the cache contains information about the changeset
|
|
77
|
-
* @param iModelId Id of the iModel
|
|
78
|
-
* @param changesetId Changeset to check for
|
|
79
|
-
* @returns true if the changeset has been processed and exists in the cache
|
|
80
|
-
*/
|
|
81
|
-
static isProcessed(iModelId, changesetId) {
|
|
82
|
-
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
83
|
-
if (!db)
|
|
84
|
-
return false;
|
|
85
|
-
return db.isProcessed(changesetId);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.ChangedElementsManager = ChangedElementsManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChangedElementsManager = void 0;
|
|
4
|
+
const BriefcaseManager_1 = require("./BriefcaseManager");
|
|
5
|
+
const ChangedElementsDb_1 = require("./ChangedElementsDb");
|
|
6
|
+
const IModelJsFs_1 = require("./IModelJsFs");
|
|
7
|
+
/** Utilities for querying changed elements caches */
|
|
8
|
+
/** @internal */
|
|
9
|
+
class ChangedElementsManager {
|
|
10
|
+
static getChangedElementsPathName(iModelId) { return BriefcaseManager_1.BriefcaseManager.getChangedElementsPathName(iModelId); }
|
|
11
|
+
/** Get changed elements Db */
|
|
12
|
+
static getChangedElementsDb(iModelId) {
|
|
13
|
+
if (this._entry && this._entry.iModelId === iModelId)
|
|
14
|
+
return this._entry.db;
|
|
15
|
+
if (this._entry && this._entry.iModelId !== iModelId) {
|
|
16
|
+
this._entry.db.closeDb();
|
|
17
|
+
this._entry.db.cleanCaches();
|
|
18
|
+
this._entry = undefined;
|
|
19
|
+
}
|
|
20
|
+
if (!this._entry) {
|
|
21
|
+
const path = ChangedElementsManager.getChangedElementsPathName(iModelId);
|
|
22
|
+
if (!IModelJsFs_1.IModelJsFs.existsSync(path))
|
|
23
|
+
return undefined;
|
|
24
|
+
const db = ChangedElementsDb_1.ChangedElementsDb.openDb(path);
|
|
25
|
+
this._entry = {
|
|
26
|
+
iModelId,
|
|
27
|
+
db,
|
|
28
|
+
};
|
|
29
|
+
return db;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
static cleanUp() {
|
|
34
|
+
if (this._entry) {
|
|
35
|
+
this._entry.db.closeDb();
|
|
36
|
+
this._entry.db.cleanCaches();
|
|
37
|
+
this._entry = undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Gets the changed elements from the cache if found
|
|
41
|
+
* @param iModelId Id of the iModel
|
|
42
|
+
* @param startChangesetId Start changeset Id
|
|
43
|
+
* @param endChangesetId End changeset Id
|
|
44
|
+
* @returns Changed elements if found
|
|
45
|
+
*/
|
|
46
|
+
static getChangedElements(iModelId, startChangesetId, endChangesetId) {
|
|
47
|
+
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
48
|
+
if (!db)
|
|
49
|
+
return undefined;
|
|
50
|
+
return db.getChangedElements(startChangesetId, endChangesetId);
|
|
51
|
+
}
|
|
52
|
+
/** Gets the changed models from the cache if found
|
|
53
|
+
* @param iModelId Id of the iModel
|
|
54
|
+
* @param startChangesetId Start changeset Id
|
|
55
|
+
* @param endChangesetId End changeset Id
|
|
56
|
+
* @returns Changed models if found
|
|
57
|
+
*/
|
|
58
|
+
static getChangedModels(iModelId, startChangesetId, endChangesetId) {
|
|
59
|
+
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
60
|
+
if (!db)
|
|
61
|
+
return undefined;
|
|
62
|
+
return db.getChangedModels(startChangesetId, endChangesetId);
|
|
63
|
+
}
|
|
64
|
+
/** Gets the change data (models and elements) from the cache if found
|
|
65
|
+
* @param iModelId Id of the iModel
|
|
66
|
+
* @param startChangesetId Start changeset Id
|
|
67
|
+
* @param endChangesetId End changeset Id
|
|
68
|
+
* @returns Changed models if found
|
|
69
|
+
*/
|
|
70
|
+
static getChangeData(iModelId, startChangesetId, endChangesetId) {
|
|
71
|
+
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
72
|
+
if (!db)
|
|
73
|
+
return undefined;
|
|
74
|
+
return db.getChangeData(startChangesetId, endChangesetId);
|
|
75
|
+
}
|
|
76
|
+
/** Checks if the cache contains information about the changeset
|
|
77
|
+
* @param iModelId Id of the iModel
|
|
78
|
+
* @param changesetId Changeset to check for
|
|
79
|
+
* @returns true if the changeset has been processed and exists in the cache
|
|
80
|
+
*/
|
|
81
|
+
static isProcessed(iModelId, changesetId) {
|
|
82
|
+
const db = ChangedElementsManager.getChangedElementsDb(iModelId);
|
|
83
|
+
if (!db)
|
|
84
|
+
return false;
|
|
85
|
+
return db.isProcessed(changesetId);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.ChangedElementsManager = ChangedElementsManager;
|
|
89
89
|
//# sourceMappingURL=ChangedElementsManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangedElementsManager.js","sourceRoot":"","sources":["../../src/ChangedElementsManager.ts"],"names":[],"mappings":";;;AAMA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,CAAC,MAAM,GAAG,SAAS,CAAC;SACzB;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,kBAAkB,CAAC,QAAoB,EAAE,gBAAwB,EAAE,cAAsB;QACrG,MAAM,EAAE,GAAkC,sBAAsB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAChG,IAAI,CAAC,EAAE;YACL,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,gBAAgB,CAAC,QAAoB,EAAE,gBAAwB,EAAE,cAAsB;QACnG,MAAM,EAAE,GAAkC,sBAAsB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAChG,IAAI,CAAC,EAAE;YACL,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,QAAoB,EAAE,gBAAwB,EAAE,cAAsB;QAChG,MAAM,EAAE,GAAkC,sBAAsB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAChG,IAAI,CAAC,EAAE;YACL,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,WAAW,CAAC,QAAoB,EAAE,WAAmB;QACjE,MAAM,EAAE,GAAkC,sBAAsB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAChG,IAAI,CAAC,EAAE;YACL,OAAO,KAAK,CAAC;QAEf,OAAO,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACrC,CAAC;CACF;AA9FD,wDA8FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":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;AA9FD,wDA8FC","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 { GuidString } from \"@itwin/core-bentley\";\nimport { ChangeData, ChangedElements, ChangedModels } from \"@itwin/core-common\";\nimport { BriefcaseManager } from \"./BriefcaseManager\";\nimport { ChangedElementsDb } from \"./ChangedElementsDb\";\nimport { IModelJsFs } from \"./IModelJsFs\";\n\n/** @internal */\ninterface ChangedElementsDbCacheEntry {\n iModelId: GuidString;\n db: ChangedElementsDb;\n}\n\n/** Utilities for querying changed elements caches */\n/** @internal */\nexport class ChangedElementsManager {\n /** Maintains a single entry since we will only have a cache per iModel, which means a ChangedElementsDb per backend instance */\n private static _entry: ChangedElementsDbCacheEntry | undefined;\n\n public static getChangedElementsPathName(iModelId: GuidString): string { return BriefcaseManager.getChangedElementsPathName(iModelId); }\n\n /** Get changed elements Db */\n private static getChangedElementsDb(iModelId: GuidString): ChangedElementsDb | undefined {\n if (this._entry && this._entry.iModelId === iModelId)\n return this._entry.db;\n if (this._entry && this._entry.iModelId !== iModelId) {\n this._entry.db.closeDb();\n this._entry.db.cleanCaches();\n this._entry = undefined;\n }\n if (!this._entry) {\n const path = ChangedElementsManager.getChangedElementsPathName(iModelId);\n if (!IModelJsFs.existsSync(path))\n return undefined;\n\n const db: ChangedElementsDb = ChangedElementsDb.openDb(path);\n this._entry = {\n iModelId,\n db,\n };\n\n return db;\n }\n\n return undefined;\n }\n\n public static cleanUp() {\n if (this._entry) {\n this._entry.db.closeDb();\n this._entry.db.cleanCaches();\n this._entry = undefined;\n }\n }\n\n /** Gets the changed elements from the cache if found\n * @param iModelId Id of the iModel\n * @param startChangesetId Start changeset Id\n * @param endChangesetId End changeset Id\n * @returns Changed elements if found\n */\n public static getChangedElements(iModelId: GuidString, startChangesetId: string, endChangesetId: string): ChangedElements | undefined {\n const db: ChangedElementsDb | undefined = ChangedElementsManager.getChangedElementsDb(iModelId);\n if (!db)\n return undefined;\n\n return db.getChangedElements(startChangesetId, endChangesetId);\n }\n\n /** Gets the changed models from the cache if found\n * @param iModelId Id of the iModel\n * @param startChangesetId Start changeset Id\n * @param endChangesetId End changeset Id\n * @returns Changed models if found\n */\n public static getChangedModels(iModelId: GuidString, startChangesetId: string, endChangesetId: string): ChangedModels | undefined {\n const db: ChangedElementsDb | undefined = ChangedElementsManager.getChangedElementsDb(iModelId);\n if (!db)\n return undefined;\n\n return db.getChangedModels(startChangesetId, endChangesetId);\n }\n\n /** Gets the change data (models and elements) from the cache if found\n * @param iModelId Id of the iModel\n * @param startChangesetId Start changeset Id\n * @param endChangesetId End changeset Id\n * @returns Changed models if found\n */\n public static getChangeData(iModelId: GuidString, startChangesetId: string, endChangesetId: string): ChangeData | undefined {\n const db: ChangedElementsDb | undefined = ChangedElementsManager.getChangedElementsDb(iModelId);\n if (!db)\n return undefined;\n\n return db.getChangeData(startChangesetId, endChangesetId);\n }\n\n /** Checks if the cache contains information about the changeset\n * @param iModelId Id of the iModel\n * @param changesetId Changeset to check for\n * @returns true if the changeset has been processed and exists in the cache\n */\n public static isProcessed(iModelId: GuidString, changesetId: string): boolean {\n const db: ChangedElementsDb | undefined = ChangedElementsManager.getChangedElementsDb(iModelId);\n if (!db)\n return false;\n\n return db.isProcessed(changesetId);\n }\n}\n"]}
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module iModels
|
|
3
|
-
*/
|
|
4
|
-
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
5
|
-
import { BeEvent, GuidString } from "@itwin/core-bentley";
|
|
6
|
-
import { ChangesetId, ChangesetIdWithIndex, LocalDirName, LocalFileName } from "@itwin/core-common";
|
|
7
|
-
import { CloudSqlite } from "./CloudSqlite";
|
|
8
|
-
import { SnapshotDb, TokenArg } from "./IModelDb";
|
|
9
|
-
/**
|
|
10
|
-
* Properties of a checkpoint
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface CheckpointProps extends TokenArg {
|
|
14
|
-
readonly expectV2?: boolean;
|
|
15
|
-
/** iTwin that the iModel belongs to */
|
|
16
|
-
readonly iTwinId: GuidString;
|
|
17
|
-
/** Id of the iModel */
|
|
18
|
-
readonly iModelId: GuidString;
|
|
19
|
-
/** changeset for the checkpoint */
|
|
20
|
-
readonly changeset: ChangesetIdWithIndex;
|
|
21
|
-
/** If true, then the latest successful v2 checkpoint at or before the provided changeset will be returned when calling queryV2Checkpoint. */
|
|
22
|
-
readonly allowPreceding?: boolean;
|
|
23
|
-
/** The number of seconds before the current token expires to attempt to reacquire a new token. Default is 1 hour. */
|
|
24
|
-
readonly reattachSafetySeconds?: number;
|
|
25
|
-
}
|
|
26
|
-
/** Return value from [[ProgressFunction]].
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export declare enum ProgressStatus {
|
|
30
|
-
/** Continue download. */
|
|
31
|
-
Continue = 0,
|
|
32
|
-
/** Abort download. */
|
|
33
|
-
Abort = 1
|
|
34
|
-
}
|
|
35
|
-
/** Called to show progress during a download. If this function returns non-zero, the download is aborted.
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
export declare type ProgressFunction = (loaded: number, total: number) => ProgressStatus;
|
|
39
|
-
/** The parameters that specify a request to download a checkpoint file from iModelHub.
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
export interface DownloadRequest {
|
|
43
|
-
/** name of local file to hold the downloaded data. */
|
|
44
|
-
localFile: LocalFileName;
|
|
45
|
-
/** A list of full fileName paths to test before downloading. If a valid file exists by one of these names,
|
|
46
|
-
* no download is performed and `localFile` is updated to reflect the fact that the file exists with that name.
|
|
47
|
-
* This can be used, for example, to look for checkpoints from previous versions if the naming strategy changes.
|
|
48
|
-
*/
|
|
49
|
-
readonly aliasFiles?: ReadonlyArray<string>;
|
|
50
|
-
/** Properties of the checkpoint to be downloaded */
|
|
51
|
-
readonly checkpoint: CheckpointProps;
|
|
52
|
-
/** If present, this function will be called to indicate progress as the briefcase is downloaded. If this
|
|
53
|
-
* function returns a non-zero value, the download is aborted.
|
|
54
|
-
*/
|
|
55
|
-
readonly onProgress?: ProgressFunction;
|
|
56
|
-
}
|
|
57
|
-
/** @internal */
|
|
58
|
-
export interface DownloadJob {
|
|
59
|
-
request: DownloadRequest;
|
|
60
|
-
promise?: Promise<any>;
|
|
61
|
-
}
|
|
62
|
-
/** @internal */
|
|
63
|
-
export declare class Downloads {
|
|
64
|
-
private static _active;
|
|
65
|
-
private static process;
|
|
66
|
-
static isInProgress(pathName: LocalFileName): DownloadJob | undefined;
|
|
67
|
-
static download<T>(request: DownloadRequest, downloadFn: (job: DownloadJob) => Promise<T>): Promise<any>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Utility class for opening V2 checkpoints from cloud containers, and also for downloading them.
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
export declare class V2CheckpointManager {
|
|
74
|
-
static readonly cloudCacheName = "v2Checkpoints";
|
|
75
|
-
private static _cloudCache?;
|
|
76
|
-
private static containers;
|
|
77
|
-
static getFolder(): LocalDirName;
|
|
78
|
-
static cleanup(): void;
|
|
79
|
-
static getFileName(checkpoint: CheckpointProps): LocalFileName;
|
|
80
|
-
private static get cloudCache();
|
|
81
|
-
/** Member names differ slightly between the V2Checkpoint api and the CloudSqlite api. Add aliases `accessName` for `accountName` and `accessToken` for `sasToken` */
|
|
82
|
-
private static toCloudContainerProps;
|
|
83
|
-
private static getContainer;
|
|
84
|
-
static attach(checkpoint: CheckpointProps): Promise<{
|
|
85
|
-
dbName: string;
|
|
86
|
-
container: CloudSqlite.CloudContainer;
|
|
87
|
-
}>;
|
|
88
|
-
private static performDownload;
|
|
89
|
-
/** Fully download a V2 checkpoint to a local file that can be used to create a briefcase or to work offline.
|
|
90
|
-
* @returns a Promise that is resolved when the download completes with the changesetId of the downloaded checkpoint (which will
|
|
91
|
-
* be the same as the requested changesetId or the most recent checkpoint before it.)
|
|
92
|
-
*/
|
|
93
|
-
static downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId>;
|
|
94
|
-
}
|
|
95
|
-
/** Utility class to deal with downloading V1 checkpoints from iModelHub.
|
|
96
|
-
* @internal
|
|
97
|
-
*/
|
|
98
|
-
export declare class V1CheckpointManager {
|
|
99
|
-
static getFolder(iModelId: GuidString): LocalDirName;
|
|
100
|
-
static getFileName(checkpoint: CheckpointProps): LocalFileName;
|
|
101
|
-
static getCheckpointDb(request: DownloadRequest): Promise<SnapshotDb>;
|
|
102
|
-
/** Download a V1 checkpoint */
|
|
103
|
-
static downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId>;
|
|
104
|
-
private static downloadAndOpen;
|
|
105
|
-
private static performDownload;
|
|
106
|
-
}
|
|
107
|
-
/** @internal */
|
|
108
|
-
export declare class CheckpointManager {
|
|
109
|
-
static readonly onDownloadV1: BeEvent<(job: DownloadJob) => void>;
|
|
110
|
-
static readonly onDownloadV2: BeEvent<(job: DownloadJob) => void>;
|
|
111
|
-
static getKey(checkpoint: CheckpointProps): string;
|
|
112
|
-
private static doDownload;
|
|
113
|
-
static updateToRequestedVersion(request: DownloadRequest): Promise<void>;
|
|
114
|
-
/** Download a checkpoint file from iModelHub into a local file specified in the request parameters. */
|
|
115
|
-
static downloadCheckpoint(request: DownloadRequest): Promise<void>;
|
|
116
|
-
/** checks a file's dbGuid & iTwinId for consistency, and updates the dbGuid when possible */
|
|
117
|
-
static validateCheckpointGuids(checkpoint: CheckpointProps, nativeDb: IModelJsNative.DgnDb): void;
|
|
118
|
-
/** @returns true if the file is the checkpoint requested */
|
|
119
|
-
static verifyCheckpoint(checkpoint: CheckpointProps, fileName: LocalFileName): boolean;
|
|
120
|
-
/** try to open an existing local file to satisfy a download request */
|
|
121
|
-
static tryOpenLocalFile(request: DownloadRequest): SnapshotDb | undefined;
|
|
122
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
4
|
+
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
5
|
+
import { BeEvent, GuidString } from "@itwin/core-bentley";
|
|
6
|
+
import { ChangesetId, ChangesetIdWithIndex, LocalDirName, LocalFileName } from "@itwin/core-common";
|
|
7
|
+
import { CloudSqlite } from "./CloudSqlite";
|
|
8
|
+
import { SnapshotDb, TokenArg } from "./IModelDb";
|
|
9
|
+
/**
|
|
10
|
+
* Properties of a checkpoint
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export interface CheckpointProps extends TokenArg {
|
|
14
|
+
readonly expectV2?: boolean;
|
|
15
|
+
/** iTwin that the iModel belongs to */
|
|
16
|
+
readonly iTwinId: GuidString;
|
|
17
|
+
/** Id of the iModel */
|
|
18
|
+
readonly iModelId: GuidString;
|
|
19
|
+
/** changeset for the checkpoint */
|
|
20
|
+
readonly changeset: ChangesetIdWithIndex;
|
|
21
|
+
/** If true, then the latest successful v2 checkpoint at or before the provided changeset will be returned when calling queryV2Checkpoint. */
|
|
22
|
+
readonly allowPreceding?: boolean;
|
|
23
|
+
/** The number of seconds before the current token expires to attempt to reacquire a new token. Default is 1 hour. */
|
|
24
|
+
readonly reattachSafetySeconds?: number;
|
|
25
|
+
}
|
|
26
|
+
/** Return value from [[ProgressFunction]].
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare enum ProgressStatus {
|
|
30
|
+
/** Continue download. */
|
|
31
|
+
Continue = 0,
|
|
32
|
+
/** Abort download. */
|
|
33
|
+
Abort = 1
|
|
34
|
+
}
|
|
35
|
+
/** Called to show progress during a download. If this function returns non-zero, the download is aborted.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export declare type ProgressFunction = (loaded: number, total: number) => ProgressStatus;
|
|
39
|
+
/** The parameters that specify a request to download a checkpoint file from iModelHub.
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export interface DownloadRequest {
|
|
43
|
+
/** name of local file to hold the downloaded data. */
|
|
44
|
+
localFile: LocalFileName;
|
|
45
|
+
/** A list of full fileName paths to test before downloading. If a valid file exists by one of these names,
|
|
46
|
+
* no download is performed and `localFile` is updated to reflect the fact that the file exists with that name.
|
|
47
|
+
* This can be used, for example, to look for checkpoints from previous versions if the naming strategy changes.
|
|
48
|
+
*/
|
|
49
|
+
readonly aliasFiles?: ReadonlyArray<string>;
|
|
50
|
+
/** Properties of the checkpoint to be downloaded */
|
|
51
|
+
readonly checkpoint: CheckpointProps;
|
|
52
|
+
/** If present, this function will be called to indicate progress as the briefcase is downloaded. If this
|
|
53
|
+
* function returns a non-zero value, the download is aborted.
|
|
54
|
+
*/
|
|
55
|
+
readonly onProgress?: ProgressFunction;
|
|
56
|
+
}
|
|
57
|
+
/** @internal */
|
|
58
|
+
export interface DownloadJob {
|
|
59
|
+
request: DownloadRequest;
|
|
60
|
+
promise?: Promise<any>;
|
|
61
|
+
}
|
|
62
|
+
/** @internal */
|
|
63
|
+
export declare class Downloads {
|
|
64
|
+
private static _active;
|
|
65
|
+
private static process;
|
|
66
|
+
static isInProgress(pathName: LocalFileName): DownloadJob | undefined;
|
|
67
|
+
static download<T>(request: DownloadRequest, downloadFn: (job: DownloadJob) => Promise<T>): Promise<any>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Utility class for opening V2 checkpoints from cloud containers, and also for downloading them.
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare class V2CheckpointManager {
|
|
74
|
+
static readonly cloudCacheName = "v2Checkpoints";
|
|
75
|
+
private static _cloudCache?;
|
|
76
|
+
private static containers;
|
|
77
|
+
static getFolder(): LocalDirName;
|
|
78
|
+
static cleanup(): void;
|
|
79
|
+
static getFileName(checkpoint: CheckpointProps): LocalFileName;
|
|
80
|
+
private static get cloudCache();
|
|
81
|
+
/** Member names differ slightly between the V2Checkpoint api and the CloudSqlite api. Add aliases `accessName` for `accountName` and `accessToken` for `sasToken` */
|
|
82
|
+
private static toCloudContainerProps;
|
|
83
|
+
private static getContainer;
|
|
84
|
+
static attach(checkpoint: CheckpointProps): Promise<{
|
|
85
|
+
dbName: string;
|
|
86
|
+
container: CloudSqlite.CloudContainer;
|
|
87
|
+
}>;
|
|
88
|
+
private static performDownload;
|
|
89
|
+
/** Fully download a V2 checkpoint to a local file that can be used to create a briefcase or to work offline.
|
|
90
|
+
* @returns a Promise that is resolved when the download completes with the changesetId of the downloaded checkpoint (which will
|
|
91
|
+
* be the same as the requested changesetId or the most recent checkpoint before it.)
|
|
92
|
+
*/
|
|
93
|
+
static downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId>;
|
|
94
|
+
}
|
|
95
|
+
/** Utility class to deal with downloading V1 checkpoints from iModelHub.
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
export declare class V1CheckpointManager {
|
|
99
|
+
static getFolder(iModelId: GuidString): LocalDirName;
|
|
100
|
+
static getFileName(checkpoint: CheckpointProps): LocalFileName;
|
|
101
|
+
static getCheckpointDb(request: DownloadRequest): Promise<SnapshotDb>;
|
|
102
|
+
/** Download a V1 checkpoint */
|
|
103
|
+
static downloadCheckpoint(request: DownloadRequest): Promise<ChangesetId>;
|
|
104
|
+
private static downloadAndOpen;
|
|
105
|
+
private static performDownload;
|
|
106
|
+
}
|
|
107
|
+
/** @internal */
|
|
108
|
+
export declare class CheckpointManager {
|
|
109
|
+
static readonly onDownloadV1: BeEvent<(job: DownloadJob) => void>;
|
|
110
|
+
static readonly onDownloadV2: BeEvent<(job: DownloadJob) => void>;
|
|
111
|
+
static getKey(checkpoint: CheckpointProps): string;
|
|
112
|
+
private static doDownload;
|
|
113
|
+
static updateToRequestedVersion(request: DownloadRequest): Promise<void>;
|
|
114
|
+
/** Download a checkpoint file from iModelHub into a local file specified in the request parameters. */
|
|
115
|
+
static downloadCheckpoint(request: DownloadRequest): Promise<void>;
|
|
116
|
+
/** checks a file's dbGuid & iTwinId for consistency, and updates the dbGuid when possible */
|
|
117
|
+
static validateCheckpointGuids(checkpoint: CheckpointProps, nativeDb: IModelJsNative.DgnDb): void;
|
|
118
|
+
/** @returns true if the file is the checkpoint requested */
|
|
119
|
+
static verifyCheckpoint(checkpoint: CheckpointProps, fileName: LocalFileName): boolean;
|
|
120
|
+
/** try to open an existing local file to satisfy a download request */
|
|
121
|
+
static tryOpenLocalFile(request: DownloadRequest): SnapshotDb | undefined;
|
|
122
|
+
}
|
|
123
123
|
//# sourceMappingURL=CheckpointManager.d.ts.map
|