@itwin/core-backend 5.15.0-dev.7 → 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 +18 -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/cjs/TxnManager.js
CHANGED
|
@@ -288,18 +288,18 @@ class ChangedEntitiesProc {
|
|
|
288
288
|
* Manages the process of merging and rebasing local changes (transactions) in a [[BriefcaseDb]].
|
|
289
289
|
*
|
|
290
290
|
* The `RebaseManager` coordinates the rebase of local transactions when pulling and merging changes from other sources,
|
|
291
|
-
* such as remote repositories or other users. It
|
|
292
|
-
*
|
|
293
|
-
* and tracking the current merge/rebase state.
|
|
291
|
+
* such as remote repositories or other users. It manages the rebase workflow, including resuming or aborting rebases,
|
|
292
|
+
* invoking a custom [[RebaseHandler]] for each rebased transaction, and tracking the current merge/rebase state.
|
|
294
293
|
*
|
|
295
294
|
* Key responsibilities:
|
|
296
295
|
* - Orchestrates the rebase of local transactions after a pull/merge operation.
|
|
297
|
-
* - Allows registration and removal of custom conflict handlers to resolve changeset conflicts during rebase.
|
|
298
296
|
* - Provides methods to check the current merge/rebase state.
|
|
299
297
|
* - Raises events before and after each transaction is rebased.
|
|
300
298
|
* - Ensures changes are saved or aborted appropriately based on the outcome of the rebase process.
|
|
301
299
|
*
|
|
302
|
-
*
|
|
300
|
+
* Obtain the instance for a briefcase via [[TxnManager.rebaser]].
|
|
301
|
+
*
|
|
302
|
+
* @beta
|
|
303
303
|
*/
|
|
304
304
|
class RebaseManager {
|
|
305
305
|
_iModel;
|
|
@@ -308,51 +308,51 @@ class RebaseManager {
|
|
|
308
308
|
_aborting = false;
|
|
309
309
|
_disposed = false;
|
|
310
310
|
/** Event raised before pull merge process begins.
|
|
311
|
-
* @
|
|
311
|
+
* @beta
|
|
312
312
|
*/
|
|
313
313
|
onPullMergeBegin = new core_bentley_1.BeEvent();
|
|
314
314
|
/** Event raised before a rebase operation begins.
|
|
315
|
-
* @
|
|
315
|
+
* @beta
|
|
316
316
|
*/
|
|
317
317
|
onRebaseBegin = new core_bentley_1.BeEvent();
|
|
318
318
|
/** Event raised before a transaction is rebased.
|
|
319
|
-
* @
|
|
319
|
+
* @beta
|
|
320
320
|
*/
|
|
321
321
|
onRebaseTxnBegin = new core_bentley_1.BeEvent();
|
|
322
322
|
/** Event raised after a transaction is rebased.
|
|
323
|
-
* @
|
|
323
|
+
* @beta
|
|
324
324
|
*/
|
|
325
325
|
onRebaseTxnEnd = new core_bentley_1.BeEvent();
|
|
326
326
|
/** Event raised after a rebase operation ends.
|
|
327
|
-
* @
|
|
327
|
+
* @beta
|
|
328
328
|
*/
|
|
329
329
|
onRebaseEnd = new core_bentley_1.BeEvent();
|
|
330
330
|
/** Event raised after pull merge process ends.
|
|
331
|
-
* @
|
|
331
|
+
* @beta
|
|
332
332
|
*/
|
|
333
333
|
onPullMergeEnd = new core_bentley_1.BeEvent();
|
|
334
334
|
/** Event raised before applying incoming changes.
|
|
335
|
-
* @
|
|
335
|
+
* @beta
|
|
336
336
|
*/
|
|
337
337
|
onApplyIncomingChangesBegin = new core_bentley_1.BeEvent();
|
|
338
338
|
/** Event raised after applying incoming changes.
|
|
339
|
-
* @
|
|
339
|
+
* @beta
|
|
340
340
|
*/
|
|
341
341
|
onApplyIncomingChangesEnd = new core_bentley_1.BeEvent();
|
|
342
342
|
/** Event raised before reversing local changes.
|
|
343
|
-
|
|
343
|
+
* @beta
|
|
344
344
|
*/
|
|
345
345
|
onReverseLocalChangesBegin = new core_bentley_1.BeEvent();
|
|
346
346
|
/** Event raised after reversing local changes.
|
|
347
|
-
* @
|
|
347
|
+
* @beta
|
|
348
348
|
*/
|
|
349
349
|
onReverseLocalChangesEnd = new core_bentley_1.BeEvent();
|
|
350
350
|
/** Event raised before downloading changesets.
|
|
351
|
-
* @
|
|
351
|
+
* @beta
|
|
352
352
|
*/
|
|
353
353
|
onDownloadChangesetsBegin = new core_bentley_1.BeEvent();
|
|
354
354
|
/** Event raised after downloading changesets.
|
|
355
|
-
* @
|
|
355
|
+
* @beta
|
|
356
356
|
*/
|
|
357
357
|
onDownloadChangesetsEnd = new core_bentley_1.BeEvent();
|
|
358
358
|
/** @internal */
|
|
@@ -415,13 +415,14 @@ class RebaseManager {
|
|
|
415
415
|
this.onRebaseTxnEnd.raiseEvent(txnProps);
|
|
416
416
|
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyRebaseTxnEnd", txnProps);
|
|
417
417
|
}
|
|
418
|
+
/** @alpha */
|
|
418
419
|
constructor(_iModel) {
|
|
419
420
|
this._iModel = _iModel;
|
|
420
421
|
}
|
|
421
422
|
/** Disposes of this RebaseManager, clearing all event listeners.
|
|
422
423
|
* Also calls [[RebaseHandler.dispose]] on the registered custom handler, if any.
|
|
423
424
|
* Subsequent calls are ignored.
|
|
424
|
-
* @
|
|
425
|
+
* @beta
|
|
425
426
|
*/
|
|
426
427
|
dispose() {
|
|
427
428
|
if (this._disposed)
|
|
@@ -446,19 +447,22 @@ class RebaseManager {
|
|
|
446
447
|
* on top of the latest pulled changes from the remote source.
|
|
447
448
|
*
|
|
448
449
|
* This method performs the following steps:
|
|
449
|
-
* 1. Begins the rebase
|
|
450
|
-
* 2.
|
|
451
|
-
* -
|
|
452
|
-
* -
|
|
453
|
-
* -
|
|
454
|
-
* -
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* 4. Drops any restore point associated with the pull-merge operation.
|
|
450
|
+
* 1. Begins the rebase and raises [[RebaseManager.onRebaseBegin]].
|
|
451
|
+
* 2. For each local transaction that needs to be rebased:
|
|
452
|
+
* - Raises [[RebaseManager.onRebaseTxnBegin]].
|
|
453
|
+
* - Reinstates the transaction's local changes, unless the custom [[RebaseHandler]]'s `shouldReinstate` returns `false`.
|
|
454
|
+
* - Calls [[RebaseHandler.recompute]] if a custom handler was set via [[RebaseManager.setCustomHandler]].
|
|
455
|
+
* - Updates the transaction with the resulting changes and raises [[RebaseManager.onRebaseTxnEnd]].
|
|
456
|
+
* 3. Ends the rebase, raises [[RebaseManager.onRebaseEnd]], and saves changes if the iModel is not read-only.
|
|
457
|
+
* 4. Drops the pull/merge restore point, if any, and raises [[RebaseManager.onPullMergeEnd]].
|
|
458
458
|
*
|
|
459
|
-
* If an error occurs
|
|
459
|
+
* If an error occurs, only the changes of the transaction currently being rebased are abandoned and the error is rethrown.
|
|
460
|
+
* The rebase remains in progress: call `resume` again to retry, or [[RebaseManager.abort]] to roll back the pull/merge.
|
|
461
|
+
* If the pull/merge used semantic rebase (see [[IModelHostOptions.useSemanticRebase]]), retrying with `resume` is not supported;
|
|
462
|
+
* use [[RebaseManager.abort]] if [[RebaseManager.canAbort]] returns `true`.
|
|
460
463
|
*
|
|
461
|
-
* @throws
|
|
464
|
+
* @throws Error if a transaction cannot be found or if any step in the rebase process fails.
|
|
465
|
+
* @beta
|
|
462
466
|
*/
|
|
463
467
|
async resume() {
|
|
464
468
|
const nativeDb = this._iModel[Symbols_1._nativeDb];
|
|
@@ -520,6 +524,7 @@ class RebaseManager {
|
|
|
520
524
|
* If an error occurs during the process, the rebase is aborted and the error is rethrown.
|
|
521
525
|
*
|
|
522
526
|
* @throws {Error} If a transaction cannot be found or if any step in the rebase process fails.
|
|
527
|
+
* @internal
|
|
523
528
|
*/
|
|
524
529
|
async resumeSemantic() {
|
|
525
530
|
const nativeDb = this._iModel[Symbols_1._nativeDb];
|
|
@@ -569,7 +574,6 @@ class RebaseManager {
|
|
|
569
574
|
/**
|
|
570
575
|
* Checks if the transaction is a schema change and if it was a noop change during rebase, purges the local folder for that txn
|
|
571
576
|
* @param txnProps
|
|
572
|
-
* @internal
|
|
573
577
|
*/
|
|
574
578
|
purgeSchemaFolderForNoopSchemaChange(txnProps) {
|
|
575
579
|
if (txnProps.type === "ECSchema" || txnProps.type === "Schema") {
|
|
@@ -583,7 +587,6 @@ class RebaseManager {
|
|
|
583
587
|
* Reinstantes the semantic changeset data for the given txnProps, both schema as well as data changesets
|
|
584
588
|
* @param txnProps
|
|
585
589
|
* @throws IModelError if local folder for transaction does not exist
|
|
586
|
-
* @internal
|
|
587
590
|
*/
|
|
588
591
|
async reinstateSemanticChangeSet(txnProps) {
|
|
589
592
|
if (txnProps.type === "ECSchema" || txnProps.type === "Schema") {
|
|
@@ -623,7 +626,6 @@ class RebaseManager {
|
|
|
623
626
|
/**
|
|
624
627
|
* Applies instance patch during rebase
|
|
625
628
|
* @param instance
|
|
626
|
-
* @internal
|
|
627
629
|
*/
|
|
628
630
|
applyInstancePatch(instance) {
|
|
629
631
|
const nativeDb = this._iModel[Symbols_1._nativeDb];
|
|
@@ -658,26 +660,27 @@ class RebaseManager {
|
|
|
658
660
|
}
|
|
659
661
|
}
|
|
660
662
|
/**
|
|
661
|
-
* Determines whether the
|
|
663
|
+
* Determines whether the in-progress pull/merge can be rolled back via [[RebaseManager.abort]].
|
|
662
664
|
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
+
* A pull/merge can be aborted only while it is in progress (see [[RebaseManager.inProgress]]) and a pull/merge restore point exists.
|
|
666
|
+
* The restore point is created at the start of a pull/merge only if the briefcase has pending local transactions, none of which
|
|
667
|
+
* contain schema changes, and [[IModelHostOptions.disableRestorePointOnPullMerge]] is not set.
|
|
665
668
|
*
|
|
666
|
-
* @returns
|
|
669
|
+
* @returns `true` if a pull/merge is in progress and its restore point exists; otherwise, `false`.
|
|
670
|
+
* @beta
|
|
667
671
|
*/
|
|
668
672
|
canAbort() {
|
|
669
673
|
return this.inProgress() && BriefcaseManager_1.BriefcaseManager.containsRestorePoint(this._iModel, BriefcaseManager_1.BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME);
|
|
670
674
|
}
|
|
671
675
|
/**
|
|
672
|
-
* Aborts the
|
|
673
|
-
*
|
|
676
|
+
* Aborts the in-progress pull/merge, restoring the briefcase to the state it was in before the pull began,
|
|
677
|
+
* including its parent changeset and local transactions. Any unsaved changes are discarded first.
|
|
674
678
|
*
|
|
675
|
-
*
|
|
676
|
-
* to the state saved at the restore point named by `BriefcaseManager.PULL_MERGE_RESTORE_POINT_NAME`.
|
|
677
|
-
* If no restore point is available, an error is thrown.
|
|
679
|
+
* [[RebaseManager.isAborting]] is `true` while the restore is running.
|
|
678
680
|
*
|
|
679
681
|
* @returns A promise that resolves when the restore operation is complete.
|
|
680
|
-
* @throws
|
|
682
|
+
* @throws Error if the pull/merge cannot be aborted (see [[RebaseManager.canAbort]]).
|
|
683
|
+
* @beta
|
|
681
684
|
*/
|
|
682
685
|
async abort() {
|
|
683
686
|
if (this.canAbort()) {
|
|
@@ -697,9 +700,13 @@ class RebaseManager {
|
|
|
697
700
|
}
|
|
698
701
|
}
|
|
699
702
|
/**
|
|
700
|
-
* Sets the
|
|
703
|
+
* Sets the [[RebaseHandler]] invoked for each local transaction while it is rebased during a pull/merge.
|
|
704
|
+
*
|
|
705
|
+
* Only one handler can be set. Setting a new handler replaces the previous one, logs a warning, and does not call
|
|
706
|
+
* [[RebaseHandler.dispose]] on the replaced handler.
|
|
701
707
|
*
|
|
702
|
-
* @param handler - The
|
|
708
|
+
* @param handler - The handler that decides whether to reinstate, and how to recompute, each rebased transaction.
|
|
709
|
+
* @beta
|
|
703
710
|
*/
|
|
704
711
|
setCustomHandler(handler) {
|
|
705
712
|
if (this._customHandler) {
|
|
@@ -708,47 +715,51 @@ class RebaseManager {
|
|
|
708
715
|
this._customHandler = handler;
|
|
709
716
|
}
|
|
710
717
|
/**
|
|
711
|
-
* Determines whether
|
|
712
|
-
* @returns
|
|
718
|
+
* Determines whether a pull/merge is currently in progress. Same as `this.isRebasing || this.isMerging`.
|
|
719
|
+
* @returns `true` if the briefcase is currently merging or rebasing changes; otherwise, `false`.
|
|
720
|
+
* @beta
|
|
713
721
|
*/
|
|
714
722
|
inProgress() {
|
|
715
723
|
return this._iModel[Symbols_1._nativeDb].pullMergeGetStage() !== "None";
|
|
716
724
|
}
|
|
717
725
|
/**
|
|
718
|
-
* Indicates whether
|
|
726
|
+
* Indicates whether [[RebaseManager.abort]] is currently rolling back a pull/merge.
|
|
719
727
|
*
|
|
720
|
-
* @returns `true`
|
|
728
|
+
* @returns `true` while an abort is in progress; otherwise, `false`.
|
|
729
|
+
* @beta
|
|
721
730
|
*/
|
|
722
731
|
get isAborting() {
|
|
723
732
|
return this._aborting;
|
|
724
733
|
}
|
|
725
734
|
/**
|
|
726
|
-
* Indicates whether the
|
|
735
|
+
* Indicates whether the pull/merge is in the rebasing stage, in which local transactions are being reinstated
|
|
736
|
+
* on top of the incoming changesets.
|
|
727
737
|
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
* @returns `true` if the transaction manager is currently rebasing; otherwise, `false`.
|
|
738
|
+
* @returns `true` if the briefcase is currently rebasing local changes; otherwise, `false`.
|
|
739
|
+
* @beta
|
|
731
740
|
*/
|
|
732
741
|
get isRebasing() {
|
|
733
742
|
return this._iModel[Symbols_1._nativeDb].pullMergeGetStage() === "Rebasing";
|
|
734
743
|
}
|
|
735
744
|
/**
|
|
736
|
-
* Indicates whether the
|
|
745
|
+
* Indicates whether the pull/merge is in the merging stage, in which incoming changesets are being applied.
|
|
737
746
|
*
|
|
738
|
-
* @returns `true` if the
|
|
747
|
+
* @returns `true` if the briefcase is currently merging incoming changes; otherwise, `false`.
|
|
748
|
+
* @beta
|
|
739
749
|
*/
|
|
740
750
|
get isMerging() {
|
|
741
751
|
return this._iModel[Symbols_1._nativeDb].pullMergeGetStage() === "Merging";
|
|
742
752
|
}
|
|
743
753
|
/**
|
|
744
|
-
* Attempts to resolve a changeset conflict by invoking
|
|
754
|
+
* Attempts to resolve a changeset conflict by invoking the handlers registered via [[RebaseManager.addConflictHandler]].
|
|
745
755
|
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
756
|
+
* Called during rebase for conflicts not already resolved by the built-in rules. Handlers are invoked from most recently
|
|
757
|
+
* to least recently added; the first handler that returns a resolution wins. If no handler resolves the conflict,
|
|
758
|
+
* returns `undefined` and the default resolution is applied.
|
|
749
759
|
*
|
|
750
760
|
* @param args - The arguments describing the changeset conflict to resolve.
|
|
751
761
|
* @returns The conflict resolution provided by a handler, or `undefined` if no handler resolves the conflict.
|
|
762
|
+
* @internal
|
|
752
763
|
*/
|
|
753
764
|
onConflict(args) {
|
|
754
765
|
let curr = this._conflictHandlers;
|
|
@@ -773,6 +784,9 @@ class RebaseManager {
|
|
|
773
784
|
* @remarks
|
|
774
785
|
* Conflict handlers are used during changeset rebase operations to resolve conflicts.
|
|
775
786
|
* Each handler must have a unique `id`. Attempting to register a handler with a duplicate `id` will result in an error.
|
|
787
|
+
* The most recently added handler is invoked first. A handler should return `undefined` to defer to the next handler.
|
|
788
|
+
* A handler must not throw; if it does, the transaction being rebased is aborted.
|
|
789
|
+
* @internal
|
|
776
790
|
*/
|
|
777
791
|
addConflictHandler(args) {
|
|
778
792
|
const idExists = (id) => {
|
|
@@ -789,12 +803,11 @@ class RebaseManager {
|
|
|
789
803
|
this._conflictHandlers = { ...args, next: this._conflictHandlers };
|
|
790
804
|
}
|
|
791
805
|
/**
|
|
792
|
-
* Removes a conflict handler
|
|
806
|
+
* Removes a conflict handler previously registered via [[RebaseManager.addConflictHandler]].
|
|
807
|
+
* If no handler with the given `id` is registered, the method does nothing.
|
|
793
808
|
*
|
|
794
809
|
* @param id - The unique identifier of the conflict handler to remove.
|
|
795
|
-
*
|
|
796
|
-
* If the handler with the specified `id` exists in the list, it will be removed.
|
|
797
|
-
* If no handler with the given `id` is found, the method does nothing.
|
|
810
|
+
* @internal
|
|
798
811
|
*/
|
|
799
812
|
removeConflictHandler(id) {
|
|
800
813
|
if (!this._conflictHandlers)
|
|
@@ -829,7 +842,9 @@ class TxnManager {
|
|
|
829
842
|
get isDisposed() {
|
|
830
843
|
return this._isDisposed;
|
|
831
844
|
}
|
|
832
|
-
/**
|
|
845
|
+
/** Manages rebasing local changes onto incoming changesets during pull/merge.
|
|
846
|
+
* @beta
|
|
847
|
+
*/
|
|
833
848
|
rebaser;
|
|
834
849
|
/** @internal */
|
|
835
850
|
constructor(_iModel) {
|
|
@@ -962,6 +977,7 @@ class TxnManager {
|
|
|
962
977
|
_onChangesApplied() {
|
|
963
978
|
// Should only clear instance caches, not all caches
|
|
964
979
|
this._iModel.clearCaches({ instanceCachesOnly: true });
|
|
980
|
+
this._iModel[Symbols_1._refreshGeographicCoordinateSystem]();
|
|
965
981
|
ChangedEntitiesProc.process(this._iModel, this);
|
|
966
982
|
this.onChangesApplied.raiseEvent();
|
|
967
983
|
IpcHost_1.IpcHost.notifyTxns(this._iModel, "notifyChangesApplied");
|
|
@@ -1075,20 +1091,20 @@ class TxnManager {
|
|
|
1075
1091
|
return core_bentley_1.DbConflictResolution.Replace;
|
|
1076
1092
|
}
|
|
1077
1093
|
/**
|
|
1078
|
-
* @alpha
|
|
1079
1094
|
* Retrieves the txn properties for a given txn ID.
|
|
1080
1095
|
*
|
|
1081
1096
|
* @param id - The unique identifier of the transaction.
|
|
1082
1097
|
* @returns The properties of the transaction if found; otherwise, `undefined`.
|
|
1098
|
+
* @beta
|
|
1083
1099
|
*/
|
|
1084
1100
|
getTxnProps(id) {
|
|
1085
1101
|
return this._iModel[Symbols_1._nativeDb].getTxnProps(id);
|
|
1086
1102
|
}
|
|
1087
1103
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
* Iterates over all transactions in the sequence, yielding each transaction's properties.
|
|
1104
|
+
* Iterates over all transactions, from first to last, yielding each transaction's properties.
|
|
1090
1105
|
*
|
|
1091
|
-
* @
|
|
1106
|
+
* @returns A generator yielding the [[TxnProps]] of each transaction.
|
|
1107
|
+
* @beta
|
|
1092
1108
|
*/
|
|
1093
1109
|
*queryTxns() {
|
|
1094
1110
|
let txn = this.getTxnProps(this.queryFirstTxnId());
|
|
@@ -1098,10 +1114,10 @@ class TxnManager {
|
|
|
1098
1114
|
}
|
|
1099
1115
|
}
|
|
1100
1116
|
/**
|
|
1101
|
-
*
|
|
1102
|
-
* Retrieves the properties of the last saved txn via `IModelDb.saveChanges()`, if available.
|
|
1117
|
+
* Retrieves the properties of the most recently saved txn (for example via [[EditTxn.saveChanges]]), if any.
|
|
1103
1118
|
*
|
|
1104
1119
|
* @returns The properties of the last saved txn, or `undefined` if none exist.
|
|
1120
|
+
* @beta
|
|
1105
1121
|
*/
|
|
1106
1122
|
getLastSavedTxnProps() {
|
|
1107
1123
|
return this.getTxnProps(this.queryPreviousTxnId(this.getCurrentTxnId()));
|
|
@@ -1175,6 +1191,20 @@ class TxnManager {
|
|
|
1175
1191
|
* @see [[BriefcaseDb.pullChanges]].
|
|
1176
1192
|
*/
|
|
1177
1193
|
onChangesPulled = new core_bentley_1.BeEvent();
|
|
1194
|
+
/**
|
|
1195
|
+
* Event raised before pushing changes to iModelHub. This is the final chance to perform any validation or
|
|
1196
|
+
* cancellation before the changes are sent. If a listener throws or returns a promise that rejects, the
|
|
1197
|
+
* push operation will be aborted. Listeners are allowed to make additional changes to the iModel if necessary,
|
|
1198
|
+
* and those changes will be included in the push (if it proceeds).
|
|
1199
|
+
*
|
|
1200
|
+
* If the push is happening as part of [[BriefcaseManager.pullMergePush]], and the listener throws or returns
|
|
1201
|
+
* a promise that rejects with an [[IModelError]] with an `errorNumber` of [[IModelHubStatus.PullIsRequired]],
|
|
1202
|
+
* then another pull will be attempted, following by another pre-push validation attempt. This will continue
|
|
1203
|
+
* as necessary up to the retry limit.
|
|
1204
|
+
* @see [[BriefcaseDb.pushChanges]].
|
|
1205
|
+
* @beta
|
|
1206
|
+
*/
|
|
1207
|
+
onPrePushValidation = new core_bentley_1.BeAsyncEvent();
|
|
1178
1208
|
/** Event raised after changes are pushed to iModelHub.
|
|
1179
1209
|
* @see [[BriefcaseDb.pushChanges]].
|
|
1180
1210
|
*/
|
|
@@ -1229,8 +1259,10 @@ class TxnManager {
|
|
|
1229
1259
|
* @note If numOperations is too large only the operations are reversible are reversed.
|
|
1230
1260
|
*/
|
|
1231
1261
|
reverseTxns(numOperations) {
|
|
1232
|
-
if (this._nativeDb.hasUnsavedChanges())
|
|
1262
|
+
if (this._nativeDb.hasUnsavedChanges()) {
|
|
1233
1263
|
this._nativeDb.abandonChanges();
|
|
1264
|
+
this._iModel[Symbols_1._refreshGeographicCoordinateSystem]();
|
|
1265
|
+
}
|
|
1234
1266
|
return this._nativeDb.reverseTxns(numOperations);
|
|
1235
1267
|
}
|
|
1236
1268
|
/** Reverse the most recent operation.
|
|
@@ -1401,6 +1433,7 @@ class TxnManager {
|
|
|
1401
1433
|
if (this.hasUnsavedChanges) {
|
|
1402
1434
|
this._iModel.clearCaches({ instanceCachesOnly: true });
|
|
1403
1435
|
this._iModel[Symbols_1._nativeDb].abandonChanges();
|
|
1436
|
+
this._iModel[Symbols_1._refreshGeographicCoordinateSystem]();
|
|
1404
1437
|
}
|
|
1405
1438
|
if (!args?.retainLocks) {
|
|
1406
1439
|
await this._iModel.locks.abandonLocksForCurrentUnsavedTxn();
|
|
@@ -1478,17 +1511,19 @@ class TxnManager {
|
|
|
1478
1511
|
return this._iModel[Symbols_1._nativeDb].getChangeTrackingMemoryUsed();
|
|
1479
1512
|
}
|
|
1480
1513
|
/**
|
|
1481
|
-
* @alpha
|
|
1482
1514
|
* Get the current transaction mode.
|
|
1483
|
-
* @returns The current
|
|
1515
|
+
* @returns The current [[TxnMode]], either `"direct"` or `"indirect"`.
|
|
1516
|
+
* @beta
|
|
1484
1517
|
*/
|
|
1485
1518
|
getMode() {
|
|
1486
1519
|
return this._nativeDb.getTxnMode();
|
|
1487
1520
|
}
|
|
1488
1521
|
/**
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1522
|
+
* Synchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1523
|
+
* Calls may be nested; the mode reverts to `"direct"` when the outermost call returns or throws.
|
|
1524
|
+
* This method does not save changes.
|
|
1491
1525
|
* @param callback The function containing the changes to make.
|
|
1526
|
+
* @beta
|
|
1492
1527
|
*/
|
|
1493
1528
|
withIndirectTxnMode(callback) {
|
|
1494
1529
|
if (this._withIndirectChangeRefCounter === 0) {
|
|
@@ -1506,9 +1541,12 @@ class TxnManager {
|
|
|
1506
1541
|
}
|
|
1507
1542
|
}
|
|
1508
1543
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1544
|
+
* Asynchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1545
|
+
* Calls may be nested with each other and with [[TxnManager.withIndirectTxnMode]]; the mode reverts to `"direct"` when the
|
|
1546
|
+
* outermost call completes or rejects. While the returned promise is pending, all changes to this iModel, including those made by
|
|
1547
|
+
* other concurrent code, are recorded as indirect. This method does not save changes.
|
|
1511
1548
|
* @param callback The function containing the changes to make.
|
|
1549
|
+
* @beta
|
|
1512
1550
|
*/
|
|
1513
1551
|
async withIndirectTxnModeAsync(callback) {
|
|
1514
1552
|
if (this._withIndirectChangeRefCounter === 0) {
|