@itwin/core-backend 5.15.0-dev.9 → 5.16.0-dev.2
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 +11 -1
- package/lib/cjs/BriefcaseManager.d.ts +2 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +39 -9
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/ChangeUnifier.d.ts +82 -0
- package/lib/cjs/ChangeUnifier.d.ts.map +1 -0
- package/lib/cjs/ChangeUnifier.js +163 -0
- package/lib/cjs/ChangeUnifier.js.map +1 -0
- package/lib/cjs/ChangesetReader.d.ts +21 -2
- package/lib/cjs/ChangesetReader.d.ts.map +1 -1
- package/lib/cjs/ChangesetReader.js +37 -1
- package/lib/cjs/ChangesetReader.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +15 -0
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +1 -0
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +4 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/EditTxn.d.ts +5 -0
- package/lib/cjs/EditTxn.d.ts.map +1 -1
- package/lib/cjs/EditTxn.js +30 -10
- package/lib/cjs/EditTxn.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +1 -0
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +12 -8
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +19 -6
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +50 -9
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +5 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +28 -0
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +78 -0
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +1 -0
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +126 -89
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +114 -76
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +62 -19
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/cjs/annotations/LeaderGeometry.js +3 -0
- package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +1 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +1 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/internal/BriefcaseUtils.d.ts +19 -0
- package/lib/cjs/internal/BriefcaseUtils.d.ts.map +1 -0
- package/lib/cjs/internal/BriefcaseUtils.js +65 -0
- package/lib/cjs/internal/BriefcaseUtils.js.map +1 -0
- package/lib/cjs/internal/QueryMetadataCache.d.ts +44 -0
- package/lib/cjs/internal/QueryMetadataCache.d.ts.map +1 -0
- package/lib/cjs/internal/QueryMetadataCache.js +107 -0
- package/lib/cjs/internal/QueryMetadataCache.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +9 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +10 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +20 -6
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +6 -6
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +2 -1
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +40 -10
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/ChangeUnifier.d.ts +82 -0
- package/lib/esm/ChangeUnifier.d.ts.map +1 -0
- package/lib/esm/ChangeUnifier.js +159 -0
- package/lib/esm/ChangeUnifier.js.map +1 -0
- package/lib/esm/ChangesetReader.d.ts +21 -2
- package/lib/esm/ChangesetReader.d.ts.map +1 -1
- package/lib/esm/ChangesetReader.js +38 -2
- package/lib/esm/ChangesetReader.js.map +1 -1
- package/lib/esm/CloudSqlite.d.ts +15 -0
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/ECDb.d.ts +1 -0
- package/lib/esm/ECDb.d.ts.map +1 -1
- package/lib/esm/ECDb.js +4 -1
- package/lib/esm/ECDb.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +5 -0
- package/lib/esm/EditTxn.d.ts.map +1 -1
- package/lib/esm/EditTxn.js +32 -12
- package/lib/esm/EditTxn.js.map +1 -1
- package/lib/esm/GeoCoordConfig.d.ts +1 -0
- package/lib/esm/GeoCoordConfig.d.ts.map +1 -1
- package/lib/esm/GeoCoordConfig.js +12 -8
- package/lib/esm/GeoCoordConfig.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +19 -6
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +52 -11
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/NativeHost.d.ts.map +1 -1
- package/lib/esm/NativeHost.js +5 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/Relationship.d.ts +28 -0
- package/lib/esm/Relationship.d.ts.map +1 -1
- package/lib/esm/Relationship.js +78 -0
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SchemaSync.d.ts.map +1 -1
- package/lib/esm/SchemaSync.js +1 -0
- package/lib/esm/SchemaSync.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +126 -89
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +116 -78
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewStateHydrator.d.ts.map +1 -1
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +62 -19
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
- package/lib/esm/annotations/LeaderGeometry.js +3 -0
- package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
- package/lib/esm/core-backend.d.ts +1 -0
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +1 -0
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/internal/BriefcaseUtils.d.ts +19 -0
- package/lib/esm/internal/BriefcaseUtils.d.ts.map +1 -0
- package/lib/esm/internal/BriefcaseUtils.js +61 -0
- package/lib/esm/internal/BriefcaseUtils.js.map +1 -0
- package/lib/esm/internal/QueryMetadataCache.d.ts +44 -0
- package/lib/esm/internal/QueryMetadataCache.d.ts.map +1 -0
- package/lib/esm/internal/QueryMetadataCache.js +103 -0
- package/lib/esm/internal/QueryMetadataCache.js.map +1 -0
- package/lib/esm/internal/Symbols.d.ts +9 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +9 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js +20 -6
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts +6 -6
- package/lib/esm/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +15 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/ecdb/CTE.test.js +21 -0
- package/lib/esm/test/ecdb/CTE.test.js.map +1 -1
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js +144 -30
- package/lib/esm/test/ecdb/ConcurrentQuery.test.js.map +1 -1
- package/lib/esm/test/ecdb/QueryMetadataCache.test.d.ts +2 -0
- package/lib/esm/test/ecdb/QueryMetadataCache.test.d.ts.map +1 -0
- package/lib/esm/test/ecdb/QueryMetadataCache.test.js +630 -0
- package/lib/esm/test/ecdb/QueryMetadataCache.test.js.map +1 -0
- package/lib/esm/test/element/RelationshipBatchLookup.test.d.ts +2 -0
- package/lib/esm/test/element/RelationshipBatchLookup.test.d.ts.map +1 -0
- package/lib/esm/test/element/RelationshipBatchLookup.test.js +202 -0
- package/lib/esm/test/element/RelationshipBatchLookup.test.js.map +1 -0
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js +187 -1
- package/lib/esm/test/hubaccess/BriefcaseManager.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SchemaImportOrphanColumns.test.d.ts +2 -0
- package/lib/esm/test/hubaccess/SchemaImportOrphanColumns.test.d.ts.map +1 -0
- package/lib/esm/test/hubaccess/SchemaImportOrphanColumns.test.js +142 -0
- package/lib/esm/test/hubaccess/SchemaImportOrphanColumns.test.js.map +1 -0
- package/lib/esm/test/imodel/IModelGeolocation.test.js +8 -6
- package/lib/esm/test/imodel/IModelGeolocation.test.js.map +1 -1
- package/lib/esm/test/imodel/IModelProps.test.d.ts +2 -0
- package/lib/esm/test/imodel/IModelProps.test.d.ts.map +1 -0
- package/lib/esm/test/imodel/IModelProps.test.js +411 -0
- package/lib/esm/test/imodel/IModelProps.test.js.map +1 -0
- package/lib/esm/test/schema/SchemaViewPropertyOverrides.test.d.ts +2 -0
- package/lib/esm/test/schema/SchemaViewPropertyOverrides.test.d.ts.map +1 -0
- package/lib/esm/test/schema/SchemaViewPropertyOverrides.test.js +240 -0
- package/lib/esm/test/schema/SchemaViewPropertyOverrides.test.js.map +1 -0
- package/lib/esm/test/schema/SchemaViewValidation.test.js +2 -8
- package/lib/esm/test/schema/SchemaViewValidation.test.js.map +1 -1
- package/lib/esm/test/standalone/BriefcaseManagerDelete.test.d.ts +2 -0
- package/lib/esm/test/standalone/BriefcaseManagerDelete.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/BriefcaseManagerDelete.test.js +159 -0
- package/lib/esm/test/standalone/BriefcaseManagerDelete.test.js.map +1 -0
- package/lib/esm/test/standalone/ChangeUnifier.test.d.ts +2 -0
- package/lib/esm/test/standalone/ChangeUnifier.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/ChangeUnifier.test.js +732 -0
- package/lib/esm/test/standalone/ChangeUnifier.test.js.map +1 -0
- package/lib/esm/test/standalone/EditTxn.test.js +72 -1
- package/lib/esm/test/standalone/EditTxn.test.js.map +1 -1
- package/lib/esm/test/standalone/GeoCoordConfig.test.d.ts +2 -0
- package/lib/esm/test/standalone/GeoCoordConfig.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/GeoCoordConfig.test.js +158 -0
- package/lib/esm/test/standalone/GeoCoordConfig.test.js.map +1 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.js +53 -0
- package/lib/esm/test/standalone/ViewStoreDb.test.js.map +1 -1
- package/package.json +18 -18
package/lib/esm/TxnManager.js
CHANGED
|
@@ -58,11 +58,11 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
58
58
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
59
59
|
});
|
|
60
60
|
import * as touch from "touch";
|
|
61
|
-
import { assert, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64, IModelStatus, IndexMap, Logger, OrderedId64Array } from "@itwin/core-bentley";
|
|
61
|
+
import { assert, BeAsyncEvent, BeEvent, BentleyError, compareStrings, CompressedId64Set, DbConflictResolution, DbResult, Id64, IModelStatus, IndexMap, Logger, OrderedId64Array } from "@itwin/core-bentley";
|
|
62
62
|
import { BriefcaseIdValue, IModelError } from "@itwin/core-common";
|
|
63
63
|
import { BackendLoggerCategory } from "./BackendLoggerCategory";
|
|
64
64
|
import { IpcHost } from "./IpcHost";
|
|
65
|
-
import { _nativeDb } from "./internal/Symbols";
|
|
65
|
+
import { _nativeDb, _refreshGeographicCoordinateSystem } from "./internal/Symbols";
|
|
66
66
|
import { RebaseChangesetConflictArgs } from "./internal/ChangesetConflictArgs";
|
|
67
67
|
import { BriefcaseManager } from "./BriefcaseManager";
|
|
68
68
|
import { ChangesetReader } from "./ChangesetReader";
|
|
@@ -284,18 +284,18 @@ class ChangedEntitiesProc {
|
|
|
284
284
|
* Manages the process of merging and rebasing local changes (transactions) in a [[BriefcaseDb]].
|
|
285
285
|
*
|
|
286
286
|
* The `RebaseManager` coordinates the rebase of local transactions when pulling and merging changes from other sources,
|
|
287
|
-
* such as remote repositories or other users. It
|
|
288
|
-
*
|
|
289
|
-
* and tracking the current merge/rebase state.
|
|
287
|
+
* such as remote repositories or other users. It manages the rebase workflow, including resuming or aborting rebases,
|
|
288
|
+
* invoking a custom [[RebaseHandler]] for each rebased transaction, and tracking the current merge/rebase state.
|
|
290
289
|
*
|
|
291
290
|
* Key responsibilities:
|
|
292
291
|
* - Orchestrates the rebase of local transactions after a pull/merge operation.
|
|
293
|
-
* - Allows registration and removal of custom conflict handlers to resolve changeset conflicts during rebase.
|
|
294
292
|
* - Provides methods to check the current merge/rebase state.
|
|
295
293
|
* - Raises events before and after each transaction is rebased.
|
|
296
294
|
* - Ensures changes are saved or aborted appropriately based on the outcome of the rebase process.
|
|
297
295
|
*
|
|
298
|
-
*
|
|
296
|
+
* Obtain the instance for a briefcase via [[TxnManager.rebaser]].
|
|
297
|
+
*
|
|
298
|
+
* @beta
|
|
299
299
|
*/
|
|
300
300
|
export class RebaseManager {
|
|
301
301
|
_iModel;
|
|
@@ -304,51 +304,51 @@ export class RebaseManager {
|
|
|
304
304
|
_aborting = false;
|
|
305
305
|
_disposed = false;
|
|
306
306
|
/** Event raised before pull merge process begins.
|
|
307
|
-
* @
|
|
307
|
+
* @beta
|
|
308
308
|
*/
|
|
309
309
|
onPullMergeBegin = new BeEvent();
|
|
310
310
|
/** Event raised before a rebase operation begins.
|
|
311
|
-
* @
|
|
311
|
+
* @beta
|
|
312
312
|
*/
|
|
313
313
|
onRebaseBegin = new BeEvent();
|
|
314
314
|
/** Event raised before a transaction is rebased.
|
|
315
|
-
* @
|
|
315
|
+
* @beta
|
|
316
316
|
*/
|
|
317
317
|
onRebaseTxnBegin = new BeEvent();
|
|
318
318
|
/** Event raised after a transaction is rebased.
|
|
319
|
-
* @
|
|
319
|
+
* @beta
|
|
320
320
|
*/
|
|
321
321
|
onRebaseTxnEnd = new BeEvent();
|
|
322
322
|
/** Event raised after a rebase operation ends.
|
|
323
|
-
* @
|
|
323
|
+
* @beta
|
|
324
324
|
*/
|
|
325
325
|
onRebaseEnd = new BeEvent();
|
|
326
326
|
/** Event raised after pull merge process ends.
|
|
327
|
-
* @
|
|
327
|
+
* @beta
|
|
328
328
|
*/
|
|
329
329
|
onPullMergeEnd = new BeEvent();
|
|
330
330
|
/** Event raised before applying incoming changes.
|
|
331
|
-
* @
|
|
331
|
+
* @beta
|
|
332
332
|
*/
|
|
333
333
|
onApplyIncomingChangesBegin = new BeEvent();
|
|
334
334
|
/** Event raised after applying incoming changes.
|
|
335
|
-
* @
|
|
335
|
+
* @beta
|
|
336
336
|
*/
|
|
337
337
|
onApplyIncomingChangesEnd = new BeEvent();
|
|
338
338
|
/** Event raised before reversing local changes.
|
|
339
|
-
|
|
339
|
+
* @beta
|
|
340
340
|
*/
|
|
341
341
|
onReverseLocalChangesBegin = new BeEvent();
|
|
342
342
|
/** Event raised after reversing local changes.
|
|
343
|
-
* @
|
|
343
|
+
* @beta
|
|
344
344
|
*/
|
|
345
345
|
onReverseLocalChangesEnd = new BeEvent();
|
|
346
346
|
/** Event raised before downloading changesets.
|
|
347
|
-
* @
|
|
347
|
+
* @beta
|
|
348
348
|
*/
|
|
349
349
|
onDownloadChangesetsBegin = new BeEvent();
|
|
350
350
|
/** Event raised after downloading changesets.
|
|
351
|
-
* @
|
|
351
|
+
* @beta
|
|
352
352
|
*/
|
|
353
353
|
onDownloadChangesetsEnd = new BeEvent();
|
|
354
354
|
/** @internal */
|
|
@@ -411,13 +411,14 @@ export class RebaseManager {
|
|
|
411
411
|
this.onRebaseTxnEnd.raiseEvent(txnProps);
|
|
412
412
|
IpcHost.notifyTxns(this._iModel, "notifyRebaseTxnEnd", txnProps);
|
|
413
413
|
}
|
|
414
|
+
/** @alpha */
|
|
414
415
|
constructor(_iModel) {
|
|
415
416
|
this._iModel = _iModel;
|
|
416
417
|
}
|
|
417
418
|
/** Disposes of this RebaseManager, clearing all event listeners.
|
|
418
419
|
* Also calls [[RebaseHandler.dispose]] on the registered custom handler, if any.
|
|
419
420
|
* Subsequent calls are ignored.
|
|
420
|
-
* @
|
|
421
|
+
* @beta
|
|
421
422
|
*/
|
|
422
423
|
dispose() {
|
|
423
424
|
if (this._disposed)
|
|
@@ -442,19 +443,22 @@ export class RebaseManager {
|
|
|
442
443
|
* on top of the latest pulled changes from the remote source.
|
|
443
444
|
*
|
|
444
445
|
* This method performs the following steps:
|
|
445
|
-
* 1. Begins the rebase
|
|
446
|
-
* 2.
|
|
447
|
-
* -
|
|
448
|
-
* -
|
|
449
|
-
* -
|
|
450
|
-
* -
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* 4. Drops any restore point associated with the pull-merge operation.
|
|
446
|
+
* 1. Begins the rebase and raises [[RebaseManager.onRebaseBegin]].
|
|
447
|
+
* 2. For each local transaction that needs to be rebased:
|
|
448
|
+
* - Raises [[RebaseManager.onRebaseTxnBegin]].
|
|
449
|
+
* - Reinstates the transaction's local changes, unless the custom [[RebaseHandler]]'s `shouldReinstate` returns `false`.
|
|
450
|
+
* - Calls [[RebaseHandler.recompute]] if a custom handler was set via [[RebaseManager.setCustomHandler]].
|
|
451
|
+
* - Updates the transaction with the resulting changes and raises [[RebaseManager.onRebaseTxnEnd]].
|
|
452
|
+
* 3. Ends the rebase, raises [[RebaseManager.onRebaseEnd]], and saves changes if the iModel is not read-only.
|
|
453
|
+
* 4. Drops the pull/merge restore point, if any, and raises [[RebaseManager.onPullMergeEnd]].
|
|
454
454
|
*
|
|
455
|
-
* If an error occurs
|
|
455
|
+
* If an error occurs, only the changes of the transaction currently being rebased are abandoned and the error is rethrown.
|
|
456
|
+
* The rebase remains in progress: call `resume` again to retry, or [[RebaseManager.abort]] to roll back the pull/merge.
|
|
457
|
+
* If the pull/merge used semantic rebase (see [[IModelHostOptions.useSemanticRebase]]), retrying with `resume` is not supported;
|
|
458
|
+
* use [[RebaseManager.abort]] if [[RebaseManager.canAbort]] returns `true`.
|
|
456
459
|
*
|
|
457
|
-
* @throws
|
|
460
|
+
* @throws Error if a transaction cannot be found or if any step in the rebase process fails.
|
|
461
|
+
* @beta
|
|
458
462
|
*/
|
|
459
463
|
async resume() {
|
|
460
464
|
const nativeDb = this._iModel[_nativeDb];
|
|
@@ -516,6 +520,7 @@ export class RebaseManager {
|
|
|
516
520
|
* If an error occurs during the process, the rebase is aborted and the error is rethrown.
|
|
517
521
|
*
|
|
518
522
|
* @throws {Error} If a transaction cannot be found or if any step in the rebase process fails.
|
|
523
|
+
* @internal
|
|
519
524
|
*/
|
|
520
525
|
async resumeSemantic() {
|
|
521
526
|
const nativeDb = this._iModel[_nativeDb];
|
|
@@ -565,7 +570,6 @@ export class RebaseManager {
|
|
|
565
570
|
/**
|
|
566
571
|
* Checks if the transaction is a schema change and if it was a noop change during rebase, purges the local folder for that txn
|
|
567
572
|
* @param txnProps
|
|
568
|
-
* @internal
|
|
569
573
|
*/
|
|
570
574
|
purgeSchemaFolderForNoopSchemaChange(txnProps) {
|
|
571
575
|
if (txnProps.type === "ECSchema" || txnProps.type === "Schema") {
|
|
@@ -579,7 +583,6 @@ export class RebaseManager {
|
|
|
579
583
|
* Reinstantes the semantic changeset data for the given txnProps, both schema as well as data changesets
|
|
580
584
|
* @param txnProps
|
|
581
585
|
* @throws IModelError if local folder for transaction does not exist
|
|
582
|
-
* @internal
|
|
583
586
|
*/
|
|
584
587
|
async reinstateSemanticChangeSet(txnProps) {
|
|
585
588
|
if (txnProps.type === "ECSchema" || txnProps.type === "Schema") {
|
|
@@ -619,7 +622,6 @@ export class RebaseManager {
|
|
|
619
622
|
/**
|
|
620
623
|
* Applies instance patch during rebase
|
|
621
624
|
* @param instance
|
|
622
|
-
* @internal
|
|
623
625
|
*/
|
|
624
626
|
applyInstancePatch(instance) {
|
|
625
627
|
const nativeDb = this._iModel[_nativeDb];
|
|
@@ -654,26 +656,27 @@ export class RebaseManager {
|
|
|
654
656
|
}
|
|
655
657
|
}
|
|
656
658
|
/**
|
|
657
|
-
* Determines whether the
|
|
659
|
+
* Determines whether the in-progress pull/merge can be rolled back via [[RebaseManager.abort]].
|
|
658
660
|
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
+
* A pull/merge can be aborted only while it is in progress (see [[RebaseManager.inProgress]]) and a pull/merge restore point exists.
|
|
662
|
+
* The restore point is created at the start of a pull/merge only if the briefcase has pending local transactions, none of which
|
|
663
|
+
* contain schema changes, and [[IModelHostOptions.disableRestorePointOnPullMerge]] is not set.
|
|
661
664
|
*
|
|
662
|
-
* @returns
|
|
665
|
+
* @returns `true` if a pull/merge is in progress and its restore point exists; otherwise, `false`.
|
|
666
|
+
* @beta
|
|
663
667
|
*/
|
|
664
668
|
canAbort() {
|
|
665
669
|
return this.inProgress() && BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);
|
|
666
670
|
}
|
|
667
671
|
/**
|
|
668
|
-
* Aborts the
|
|
669
|
-
*
|
|
672
|
+
* Aborts the in-progress pull/merge, restoring the briefcase to the state it was in before the pull began,
|
|
673
|
+
* including its parent changeset and local transactions. Any unsaved changes are discarded first.
|
|
670
674
|
*
|
|
671
|
-
*
|
|
672
|
-
* to the state saved at the restore point named by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`.
|
|
673
|
-
* If no restore point is available, an error is thrown.
|
|
675
|
+
* [[RebaseManager.isAborting]] is `true` while the restore is running.
|
|
674
676
|
*
|
|
675
677
|
* @returns A promise that resolves when the restore operation is complete.
|
|
676
|
-
* @throws
|
|
678
|
+
* @throws Error if the pull/merge cannot be aborted (see [[RebaseManager.canAbort]]).
|
|
679
|
+
* @beta
|
|
677
680
|
*/
|
|
678
681
|
async abort() {
|
|
679
682
|
if (this.canAbort()) {
|
|
@@ -693,9 +696,13 @@ export class RebaseManager {
|
|
|
693
696
|
}
|
|
694
697
|
}
|
|
695
698
|
/**
|
|
696
|
-
* Sets the
|
|
699
|
+
* Sets the [[RebaseHandler]] invoked for each local transaction while it is rebased during a pull/merge.
|
|
700
|
+
*
|
|
701
|
+
* Only one handler can be set. Setting a new handler replaces the previous one, logs a warning, and does not call
|
|
702
|
+
* [[RebaseHandler.dispose]] on the replaced handler.
|
|
697
703
|
*
|
|
698
|
-
* @param handler - The
|
|
704
|
+
* @param handler - The handler that decides whether to reinstate, and how to recompute, each rebased transaction.
|
|
705
|
+
* @beta
|
|
699
706
|
*/
|
|
700
707
|
setCustomHandler(handler) {
|
|
701
708
|
if (this._customHandler) {
|
|
@@ -704,47 +711,51 @@ export class RebaseManager {
|
|
|
704
711
|
this._customHandler = handler;
|
|
705
712
|
}
|
|
706
713
|
/**
|
|
707
|
-
* Determines whether
|
|
708
|
-
* @returns
|
|
714
|
+
* Determines whether a pull/merge is currently in progress. Same as `this.isRebasing || this.isMerging`.
|
|
715
|
+
* @returns `true` if the briefcase is currently merging or rebasing changes; otherwise, `false`.
|
|
716
|
+
* @beta
|
|
709
717
|
*/
|
|
710
718
|
inProgress() {
|
|
711
719
|
return this._iModel[_nativeDb].pullMergeGetStage() !== "None";
|
|
712
720
|
}
|
|
713
721
|
/**
|
|
714
|
-
* Indicates whether
|
|
722
|
+
* Indicates whether [[RebaseManager.abort]] is currently rolling back a pull/merge.
|
|
715
723
|
*
|
|
716
|
-
* @returns `true`
|
|
724
|
+
* @returns `true` while an abort is in progress; otherwise, `false`.
|
|
725
|
+
* @beta
|
|
717
726
|
*/
|
|
718
727
|
get isAborting() {
|
|
719
728
|
return this._aborting;
|
|
720
729
|
}
|
|
721
730
|
/**
|
|
722
|
-
* Indicates whether the
|
|
731
|
+
* Indicates whether the pull/merge is in the rebasing stage, in which local transactions are being reinstated
|
|
732
|
+
* on top of the incoming changesets.
|
|
723
733
|
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
* @returns `true` if the transaction manager is currently rebasing; otherwise, `false`.
|
|
734
|
+
* @returns `true` if the briefcase is currently rebasing local changes; otherwise, `false`.
|
|
735
|
+
* @beta
|
|
727
736
|
*/
|
|
728
737
|
get isRebasing() {
|
|
729
738
|
return this._iModel[_nativeDb].pullMergeGetStage() === "Rebasing";
|
|
730
739
|
}
|
|
731
740
|
/**
|
|
732
|
-
* Indicates whether the
|
|
741
|
+
* Indicates whether the pull/merge is in the merging stage, in which incoming changesets are being applied.
|
|
733
742
|
*
|
|
734
|
-
* @returns `true` if the
|
|
743
|
+
* @returns `true` if the briefcase is currently merging incoming changes; otherwise, `false`.
|
|
744
|
+
* @beta
|
|
735
745
|
*/
|
|
736
746
|
get isMerging() {
|
|
737
747
|
return this._iModel[_nativeDb].pullMergeGetStage() === "Merging";
|
|
738
748
|
}
|
|
739
749
|
/**
|
|
740
|
-
* Attempts to resolve a changeset conflict by invoking
|
|
750
|
+
* Attempts to resolve a changeset conflict by invoking the handlers registered via [[RebaseManager.addConflictHandler]].
|
|
741
751
|
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
752
|
+
* Called during rebase for conflicts not already resolved by the built-in rules. Handlers are invoked from most recently
|
|
753
|
+
* to least recently added; the first handler that returns a resolution wins. If no handler resolves the conflict,
|
|
754
|
+
* returns `undefined` and the default resolution is applied.
|
|
745
755
|
*
|
|
746
756
|
* @param args - The arguments describing the changeset conflict to resolve.
|
|
747
757
|
* @returns The conflict resolution provided by a handler, or `undefined` if no handler resolves the conflict.
|
|
758
|
+
* @internal
|
|
748
759
|
*/
|
|
749
760
|
onConflict(args) {
|
|
750
761
|
let curr = this._conflictHandlers;
|
|
@@ -769,6 +780,9 @@ export class RebaseManager {
|
|
|
769
780
|
* @remarks
|
|
770
781
|
* Conflict handlers are used during changeset rebase operations to resolve conflicts.
|
|
771
782
|
* Each handler must have a unique `id`. Attempting to register a handler with a duplicate `id` will result in an error.
|
|
783
|
+
* The most recently added handler is invoked first. A handler should return `undefined` to defer to the next handler.
|
|
784
|
+
* A handler must not throw; if it does, the transaction being rebased is aborted.
|
|
785
|
+
* @internal
|
|
772
786
|
*/
|
|
773
787
|
addConflictHandler(args) {
|
|
774
788
|
const idExists = (id) => {
|
|
@@ -785,12 +799,11 @@ export class RebaseManager {
|
|
|
785
799
|
this._conflictHandlers = { ...args, next: this._conflictHandlers };
|
|
786
800
|
}
|
|
787
801
|
/**
|
|
788
|
-
* Removes a conflict handler
|
|
802
|
+
* Removes a conflict handler previously registered via [[RebaseManager.addConflictHandler]].
|
|
803
|
+
* If no handler with the given `id` is registered, the method does nothing.
|
|
789
804
|
*
|
|
790
805
|
* @param id - The unique identifier of the conflict handler to remove.
|
|
791
|
-
*
|
|
792
|
-
* If the handler with the specified `id` exists in the list, it will be removed.
|
|
793
|
-
* If no handler with the given `id` is found, the method does nothing.
|
|
806
|
+
* @internal
|
|
794
807
|
*/
|
|
795
808
|
removeConflictHandler(id) {
|
|
796
809
|
if (!this._conflictHandlers)
|
|
@@ -824,7 +837,9 @@ export class TxnManager {
|
|
|
824
837
|
get isDisposed() {
|
|
825
838
|
return this._isDisposed;
|
|
826
839
|
}
|
|
827
|
-
/**
|
|
840
|
+
/** Manages rebasing local changes onto incoming changesets during pull/merge.
|
|
841
|
+
* @beta
|
|
842
|
+
*/
|
|
828
843
|
rebaser;
|
|
829
844
|
/** @internal */
|
|
830
845
|
constructor(_iModel) {
|
|
@@ -957,6 +972,7 @@ export class TxnManager {
|
|
|
957
972
|
_onChangesApplied() {
|
|
958
973
|
// Should only clear instance caches, not all caches
|
|
959
974
|
this._iModel.clearCaches({ instanceCachesOnly: true });
|
|
975
|
+
this._iModel[_refreshGeographicCoordinateSystem]();
|
|
960
976
|
ChangedEntitiesProc.process(this._iModel, this);
|
|
961
977
|
this.onChangesApplied.raiseEvent();
|
|
962
978
|
IpcHost.notifyTxns(this._iModel, "notifyChangesApplied");
|
|
@@ -1070,20 +1086,20 @@ export class TxnManager {
|
|
|
1070
1086
|
return DbConflictResolution.Replace;
|
|
1071
1087
|
}
|
|
1072
1088
|
/**
|
|
1073
|
-
* @alpha
|
|
1074
1089
|
* Retrieves the txn properties for a given txn ID.
|
|
1075
1090
|
*
|
|
1076
1091
|
* @param id - The unique identifier of the transaction.
|
|
1077
1092
|
* @returns The properties of the transaction if found; otherwise, `undefined`.
|
|
1093
|
+
* @beta
|
|
1078
1094
|
*/
|
|
1079
1095
|
getTxnProps(id) {
|
|
1080
1096
|
return this._iModel[_nativeDb].getTxnProps(id);
|
|
1081
1097
|
}
|
|
1082
1098
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
* Iterates over all transactions in the sequence, yielding each transaction's properties.
|
|
1099
|
+
* Iterates over all transactions, from first to last, yielding each transaction's properties.
|
|
1085
1100
|
*
|
|
1086
|
-
* @
|
|
1101
|
+
* @returns A generator yielding the [[TxnProps]] of each transaction.
|
|
1102
|
+
* @beta
|
|
1087
1103
|
*/
|
|
1088
1104
|
*queryTxns() {
|
|
1089
1105
|
let txn = this.getTxnProps(this.queryFirstTxnId());
|
|
@@ -1093,10 +1109,10 @@ export class TxnManager {
|
|
|
1093
1109
|
}
|
|
1094
1110
|
}
|
|
1095
1111
|
/**
|
|
1096
|
-
*
|
|
1097
|
-
* Retrieves the properties of the last saved txn via `IModelDb.saveChanges()`, if available.
|
|
1112
|
+
* Retrieves the properties of the most recently saved txn (for example via [[EditTxn.saveChanges]]), if any.
|
|
1098
1113
|
*
|
|
1099
1114
|
* @returns The properties of the last saved txn, or `undefined` if none exist.
|
|
1115
|
+
* @beta
|
|
1100
1116
|
*/
|
|
1101
1117
|
getLastSavedTxnProps() {
|
|
1102
1118
|
return this.getTxnProps(this.queryPreviousTxnId(this.getCurrentTxnId()));
|
|
@@ -1170,6 +1186,20 @@ export class TxnManager {
|
|
|
1170
1186
|
* @see [[BriefcaseDb.pullChanges]].
|
|
1171
1187
|
*/
|
|
1172
1188
|
onChangesPulled = new BeEvent();
|
|
1189
|
+
/**
|
|
1190
|
+
* Event raised before pushing changes to iModelHub. This is the final chance to perform any validation or
|
|
1191
|
+
* cancellation before the changes are sent. If a listener throws or returns a promise that rejects, the
|
|
1192
|
+
* push operation will be aborted. Listeners are allowed to make additional changes to the iModel if necessary,
|
|
1193
|
+
* and those changes will be included in the push (if it proceeds).
|
|
1194
|
+
*
|
|
1195
|
+
* If the push is happening as part of [[BriefcaseManager.pullMergePush]], and the listener throws or returns
|
|
1196
|
+
* a promise that rejects with an [[IModelError]] with an `errorNumber` of [[IModelHubStatus.PullIsRequired]],
|
|
1197
|
+
* then another pull will be attempted, following by another pre-push validation attempt. This will continue
|
|
1198
|
+
* as necessary up to the retry limit.
|
|
1199
|
+
* @see [[BriefcaseDb.pushChanges]].
|
|
1200
|
+
* @beta
|
|
1201
|
+
*/
|
|
1202
|
+
onPrePushValidation = new BeAsyncEvent();
|
|
1173
1203
|
/** Event raised after changes are pushed to iModelHub.
|
|
1174
1204
|
* @see [[BriefcaseDb.pushChanges]].
|
|
1175
1205
|
*/
|
|
@@ -1224,8 +1254,10 @@ export class TxnManager {
|
|
|
1224
1254
|
* @note If numOperations is too large only the operations are reversible are reversed.
|
|
1225
1255
|
*/
|
|
1226
1256
|
reverseTxns(numOperations) {
|
|
1227
|
-
if (this._nativeDb.hasUnsavedChanges())
|
|
1257
|
+
if (this._nativeDb.hasUnsavedChanges()) {
|
|
1228
1258
|
this._nativeDb.abandonChanges();
|
|
1259
|
+
this._iModel[_refreshGeographicCoordinateSystem]();
|
|
1260
|
+
}
|
|
1229
1261
|
return this._nativeDb.reverseTxns(numOperations);
|
|
1230
1262
|
}
|
|
1231
1263
|
/** Reverse the most recent operation.
|
|
@@ -1396,6 +1428,7 @@ export class TxnManager {
|
|
|
1396
1428
|
if (this.hasUnsavedChanges) {
|
|
1397
1429
|
this._iModel.clearCaches({ instanceCachesOnly: true });
|
|
1398
1430
|
this._iModel[_nativeDb].abandonChanges();
|
|
1431
|
+
this._iModel[_refreshGeographicCoordinateSystem]();
|
|
1399
1432
|
}
|
|
1400
1433
|
if (!args?.retainLocks) {
|
|
1401
1434
|
await this._iModel.locks.abandonLocksForCurrentUnsavedTxn();
|
|
@@ -1473,17 +1506,19 @@ export class TxnManager {
|
|
|
1473
1506
|
return this._iModel[_nativeDb].getChangeTrackingMemoryUsed();
|
|
1474
1507
|
}
|
|
1475
1508
|
/**
|
|
1476
|
-
* @alpha
|
|
1477
1509
|
* Get the current transaction mode.
|
|
1478
|
-
* @returns The current
|
|
1510
|
+
* @returns The current [[TxnMode]], either `"direct"` or `"indirect"`.
|
|
1511
|
+
* @beta
|
|
1479
1512
|
*/
|
|
1480
1513
|
getMode() {
|
|
1481
1514
|
return this._nativeDb.getTxnMode();
|
|
1482
1515
|
}
|
|
1483
1516
|
/**
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1517
|
+
* Synchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1518
|
+
* Calls may be nested; the mode reverts to `"direct"` when the outermost call returns or throws.
|
|
1519
|
+
* This method does not save changes.
|
|
1486
1520
|
* @param callback The function containing the changes to make.
|
|
1521
|
+
* @beta
|
|
1487
1522
|
*/
|
|
1488
1523
|
withIndirectTxnMode(callback) {
|
|
1489
1524
|
if (this._withIndirectChangeRefCounter === 0) {
|
|
@@ -1501,9 +1536,12 @@ export class TxnManager {
|
|
|
1501
1536
|
}
|
|
1502
1537
|
}
|
|
1503
1538
|
/**
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1539
|
+
* Asynchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1540
|
+
* Calls may be nested with each other and with [[TxnManager.withIndirectTxnMode]]; the mode reverts to `"direct"` when the
|
|
1541
|
+
* outermost call completes or rejects. While the returned promise is pending, all changes to this iModel, including those made by
|
|
1542
|
+
* other concurrent code, are recorded as indirect. This method does not save changes.
|
|
1506
1543
|
* @param callback The function containing the changes to make.
|
|
1544
|
+
* @beta
|
|
1507
1545
|
*/
|
|
1508
1546
|
async withIndirectTxnModeAsync(callback) {
|
|
1509
1547
|
if (this._withIndirectChangeRefCounter === 0) {
|