@itwin/core-backend 5.15.0-dev.14 → 5.15.0-dev.16
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/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +4 -0
- package/lib/cjs/BriefcaseManager.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/IModelDb.d.ts +6 -5
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +11 -7
- package/lib/cjs/IModelDb.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 +111 -88
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +95 -75
- 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/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/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.map +1 -1
- package/lib/esm/BriefcaseManager.js +4 -0
- package/lib/esm/BriefcaseManager.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/IModelDb.d.ts +6 -5
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +11 -7
- package/lib/esm/IModelDb.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 +111 -88
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +95 -75
- 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/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/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/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/package.json +17 -17
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.
|
|
701
704
|
*
|
|
702
|
-
*
|
|
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.
|
|
707
|
+
*
|
|
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
|
|
727
|
-
*
|
|
728
|
-
* This property checks the internal native database's merge stage to determine if a rebase operation is in progress.
|
|
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.
|
|
729
737
|
*
|
|
730
|
-
* @returns `true` if the
|
|
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) {
|
|
@@ -1075,20 +1090,20 @@ class TxnManager {
|
|
|
1075
1090
|
return core_bentley_1.DbConflictResolution.Replace;
|
|
1076
1091
|
}
|
|
1077
1092
|
/**
|
|
1078
|
-
* @alpha
|
|
1079
1093
|
* Retrieves the txn properties for a given txn ID.
|
|
1080
1094
|
*
|
|
1081
1095
|
* @param id - The unique identifier of the transaction.
|
|
1082
1096
|
* @returns The properties of the transaction if found; otherwise, `undefined`.
|
|
1097
|
+
* @beta
|
|
1083
1098
|
*/
|
|
1084
1099
|
getTxnProps(id) {
|
|
1085
1100
|
return this._iModel[Symbols_1._nativeDb].getTxnProps(id);
|
|
1086
1101
|
}
|
|
1087
1102
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
* Iterates over all transactions in the sequence, yielding each transaction's properties.
|
|
1103
|
+
* Iterates over all transactions, from first to last, yielding each transaction's properties.
|
|
1090
1104
|
*
|
|
1091
|
-
* @
|
|
1105
|
+
* @returns A generator yielding the [[TxnProps]] of each transaction.
|
|
1106
|
+
* @beta
|
|
1092
1107
|
*/
|
|
1093
1108
|
*queryTxns() {
|
|
1094
1109
|
let txn = this.getTxnProps(this.queryFirstTxnId());
|
|
@@ -1098,10 +1113,10 @@ class TxnManager {
|
|
|
1098
1113
|
}
|
|
1099
1114
|
}
|
|
1100
1115
|
/**
|
|
1101
|
-
*
|
|
1102
|
-
* Retrieves the properties of the last saved txn via `IModelDb.saveChanges()`, if available.
|
|
1116
|
+
* Retrieves the properties of the most recently saved txn (for example via [[EditTxn.saveChanges]]), if any.
|
|
1103
1117
|
*
|
|
1104
1118
|
* @returns The properties of the last saved txn, or `undefined` if none exist.
|
|
1119
|
+
* @beta
|
|
1105
1120
|
*/
|
|
1106
1121
|
getLastSavedTxnProps() {
|
|
1107
1122
|
return this.getTxnProps(this.queryPreviousTxnId(this.getCurrentTxnId()));
|
|
@@ -1492,17 +1507,19 @@ class TxnManager {
|
|
|
1492
1507
|
return this._iModel[Symbols_1._nativeDb].getChangeTrackingMemoryUsed();
|
|
1493
1508
|
}
|
|
1494
1509
|
/**
|
|
1495
|
-
* @alpha
|
|
1496
1510
|
* Get the current transaction mode.
|
|
1497
|
-
* @returns The current
|
|
1511
|
+
* @returns The current [[TxnMode]], either `"direct"` or `"indirect"`.
|
|
1512
|
+
* @beta
|
|
1498
1513
|
*/
|
|
1499
1514
|
getMode() {
|
|
1500
1515
|
return this._nativeDb.getTxnMode();
|
|
1501
1516
|
}
|
|
1502
1517
|
/**
|
|
1503
|
-
*
|
|
1504
|
-
*
|
|
1518
|
+
* Synchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1519
|
+
* Calls may be nested; the mode reverts to `"direct"` when the outermost call returns or throws.
|
|
1520
|
+
* This method does not save changes.
|
|
1505
1521
|
* @param callback The function containing the changes to make.
|
|
1522
|
+
* @beta
|
|
1506
1523
|
*/
|
|
1507
1524
|
withIndirectTxnMode(callback) {
|
|
1508
1525
|
if (this._withIndirectChangeRefCounter === 0) {
|
|
@@ -1520,9 +1537,12 @@ class TxnManager {
|
|
|
1520
1537
|
}
|
|
1521
1538
|
}
|
|
1522
1539
|
/**
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1540
|
+
* Asynchronously execute a series of changes with the [[TxnMode]] set to `"indirect"`, so they are recorded as indirect changes.
|
|
1541
|
+
* Calls may be nested with each other and with [[TxnManager.withIndirectTxnMode]]; the mode reverts to `"direct"` when the
|
|
1542
|
+
* outermost call completes or rejects. While the returned promise is pending, all changes to this iModel, including those made by
|
|
1543
|
+
* other concurrent code, are recorded as indirect. This method does not save changes.
|
|
1525
1544
|
* @param callback The function containing the changes to make.
|
|
1545
|
+
* @beta
|
|
1526
1546
|
*/
|
|
1527
1547
|
async withIndirectTxnModeAsync(callback) {
|
|
1528
1548
|
if (this._withIndirectChangeRefCounter === 0) {
|