@itwin/core-backend 5.4.0-dev.7 → 5.5.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 +30 -1
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +12 -9
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +11 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +6 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.d.ts +1 -0
- package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +7 -0
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +8 -0
- package/lib/cjs/NavigationRelationship.d.ts.map +1 -1
- package/lib/cjs/NavigationRelationship.js +12 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +16 -4
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +25 -3
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js +9 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/OnlineStatus.d.ts +15 -0
- package/lib/cjs/internal/OnlineStatus.d.ts.map +1 -0
- package/lib/cjs/internal/OnlineStatus.js +28 -0
- package/lib/cjs/internal/OnlineStatus.js.map +1 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +12 -0
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +12 -9
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +11 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +6 -0
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/LocalhostIpcHost.d.ts +1 -0
- package/lib/esm/LocalhostIpcHost.d.ts.map +1 -1
- package/lib/esm/LocalhostIpcHost.js +1 -1
- package/lib/esm/LocalhostIpcHost.js.map +1 -1
- package/lib/esm/NativeHost.d.ts.map +1 -1
- package/lib/esm/NativeHost.js +8 -1
- package/lib/esm/NativeHost.js.map +1 -1
- package/lib/esm/NavigationRelationship.d.ts +8 -0
- package/lib/esm/NavigationRelationship.d.ts.map +1 -1
- package/lib/esm/NavigationRelationship.js +10 -0
- package/lib/esm/NavigationRelationship.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +16 -4
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +25 -3
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js +9 -1
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/OnlineStatus.d.ts +15 -0
- package/lib/esm/internal/OnlineStatus.d.ts.map +1 -0
- package/lib/esm/internal/OnlineStatus.js +24 -0
- package/lib/esm/internal/OnlineStatus.js.map +1 -0
- package/lib/esm/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js +13 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/test/element/ElementAspect.test.js +27 -0
- package/lib/esm/test/element/ElementAspect.test.js.map +1 -1
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js +100 -2
- package/lib/esm/test/hubaccess/ApplyChangeset.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +157 -1
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/imodel/Code.test.js +369 -248
- package/lib/esm/test/imodel/Code.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +3 -0
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +27 -8
- package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts +4 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.d.ts.map +1 -1
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js +14 -4
- package/lib/esm/test/incrementalSchemaLocater/utils/IncrementalTestHelper.js.map +1 -1
- package/lib/esm/test/standalone/ChangeMerge.test.js +24 -0
- package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
- package/package.json +15 -15
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Guid } from "@itwin/core-bentley";
|
|
5
|
+
import { DbResult, Guid } from "@itwin/core-bentley";
|
|
6
6
|
import { Code, IModel, QueryBinder, SubCategoryAppearance } from "@itwin/core-common";
|
|
7
7
|
import * as chai from "chai";
|
|
8
8
|
import * as chaiAsPromised from "chai-as-promised";
|
|
@@ -987,5 +987,161 @@ describe("rebase changes & stashing api", function () {
|
|
|
987
987
|
chai.expect(events.rebaseHandler.shouldReinstate.map((txn) => txn.id)).to.deep.equal(["0x100000000", "0x100000001", "0x100000002", "0x100000003"]);
|
|
988
988
|
chai.expect(events.rebaseHandler.recompute.map((txn) => txn.id)).to.deep.equal(["0x100000000", "0x100000001", "0x100000002", "0x100000003"]);
|
|
989
989
|
});
|
|
990
|
+
it("rebase multi txn", async () => {
|
|
991
|
+
const b1 = await testIModel.openBriefcase();
|
|
992
|
+
const b2 = await testIModel.openBriefcase();
|
|
993
|
+
const e1 = await testIModel.insertElement(b1);
|
|
994
|
+
const e2 = await testIModel.insertElement(b1, true);
|
|
995
|
+
b1.saveChanges();
|
|
996
|
+
await b1.pushChanges({ description: "insert element 1 direct and 1 indirect" });
|
|
997
|
+
await b2.pullChanges();
|
|
998
|
+
chai.expect(b2.txns.beginMultiTxnOperation()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
999
|
+
let elId = await testIModel.insertElement(b2);
|
|
1000
|
+
b2.saveChanges(`insert element ${elId}`);
|
|
1001
|
+
elId = await testIModel.insertElement(b2);
|
|
1002
|
+
b2.saveChanges(`insert element ${elId}`);
|
|
1003
|
+
elId = await testIModel.insertElement(b2);
|
|
1004
|
+
b2.saveChanges(`insert element ${elId}`);
|
|
1005
|
+
chai.expect(b2.txns.endMultiTxnOperation()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1006
|
+
b2.saveChanges();
|
|
1007
|
+
elId = await testIModel.insertElement(b2);
|
|
1008
|
+
b2.saveChanges(`insert element ${elId}`);
|
|
1009
|
+
let txns = Array.from(b2.txns.queryTxns());
|
|
1010
|
+
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1011
|
+
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
1012
|
+
chai.expect(txns[0].sessionId).to.be.equals(1);
|
|
1013
|
+
chai.expect(txns[0].grouped).to.be.equals(false);
|
|
1014
|
+
chai.expect(txns[0].reversed).to.be.equals(false);
|
|
1015
|
+
chai.expect(txns[1].id).to.be.equals("0x100000001"); // 2nd after beginMultiTxnOperation()
|
|
1016
|
+
chai.expect(txns[1].props.description).to.be.equals("insert element 0x40000000002");
|
|
1017
|
+
chai.expect(txns[1].sessionId).to.be.equals(1);
|
|
1018
|
+
chai.expect(txns[1].grouped).to.be.equals(true);
|
|
1019
|
+
chai.expect(txns[1].reversed).to.be.equals(false);
|
|
1020
|
+
chai.expect(txns[2].id).to.be.equals("0x100000002"); // 3rd after beginMultiTxnOperation() & before endMultiTxnOperation()
|
|
1021
|
+
chai.expect(txns[2].props.description).to.be.equals("insert element 0x40000000003");
|
|
1022
|
+
chai.expect(txns[2].sessionId).to.be.equals(1);
|
|
1023
|
+
chai.expect(txns[2].grouped).to.be.equals(true);
|
|
1024
|
+
chai.expect(txns[2].reversed).to.be.equals(false);
|
|
1025
|
+
chai.expect(txns[3].id).to.be.equals("0x100000003"); // 4th after endMultiTxnOperation()
|
|
1026
|
+
chai.expect(txns[3].props.description).to.be.equals("insert element 0x40000000004");
|
|
1027
|
+
chai.expect(txns[3].type).to.be.equals("Data");
|
|
1028
|
+
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1029
|
+
chai.expect(txns[3].reversed).to.be.equals(false);
|
|
1030
|
+
// reverse single txn 0x100000003
|
|
1031
|
+
chai.expect(b2.txns.reverseSingleTxn()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1032
|
+
txns = Array.from(b2.txns.queryTxns());
|
|
1033
|
+
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1034
|
+
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
1035
|
+
chai.expect(txns[0].sessionId).to.be.equals(1);
|
|
1036
|
+
chai.expect(txns[0].grouped).to.be.equals(false);
|
|
1037
|
+
chai.expect(txns[0].reversed).to.be.equals(false);
|
|
1038
|
+
chai.expect(txns[1].id).to.be.equals("0x100000001"); // 2nd after beginMultiTxnOperation()
|
|
1039
|
+
chai.expect(txns[1].props.description).to.be.equals("insert element 0x40000000002");
|
|
1040
|
+
chai.expect(txns[1].sessionId).to.be.equals(1);
|
|
1041
|
+
chai.expect(txns[1].grouped).to.be.equals(true);
|
|
1042
|
+
chai.expect(txns[1].reversed).to.be.equals(false);
|
|
1043
|
+
chai.expect(txns[2].id).to.be.equals("0x100000002"); // 3rd after beginMultiTxnOperation() & before endMultiTxnOperation()
|
|
1044
|
+
chai.expect(txns[2].props.description).to.be.equals("insert element 0x40000000003");
|
|
1045
|
+
chai.expect(txns[2].sessionId).to.be.equals(1);
|
|
1046
|
+
chai.expect(txns[2].grouped).to.be.equals(true);
|
|
1047
|
+
chai.expect(txns[2].reversed).to.be.equals(false);
|
|
1048
|
+
chai.expect(txns[3].id).to.be.equals("0x100000003"); // 4th after endMultiTxnOperation()
|
|
1049
|
+
chai.expect(txns[3].props.description).to.be.equals("insert element 0x40000000004");
|
|
1050
|
+
chai.expect(txns[3].type).to.be.equals("Data");
|
|
1051
|
+
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1052
|
+
chai.expect(txns[3].reversed).to.be.equals(true);
|
|
1053
|
+
// reverse multi txn. should reverse 0x100000000, 0x100000001 & 0x100000002
|
|
1054
|
+
chai.expect(b2.txns.reverseSingleTxn()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1055
|
+
txns = Array.from(b2.txns.queryTxns());
|
|
1056
|
+
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1057
|
+
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
1058
|
+
chai.expect(txns[0].sessionId).to.be.equals(1);
|
|
1059
|
+
chai.expect(txns[0].grouped).to.be.equals(false);
|
|
1060
|
+
chai.expect(txns[0].reversed).to.be.equals(true);
|
|
1061
|
+
chai.expect(txns[1].id).to.be.equals("0x100000001"); // 2nd after beginMultiTxnOperation()
|
|
1062
|
+
chai.expect(txns[1].props.description).to.be.equals("insert element 0x40000000002");
|
|
1063
|
+
chai.expect(txns[1].sessionId).to.be.equals(1);
|
|
1064
|
+
chai.expect(txns[1].grouped).to.be.equals(true);
|
|
1065
|
+
chai.expect(txns[1].reversed).to.be.equals(true);
|
|
1066
|
+
chai.expect(txns[2].id).to.be.equals("0x100000002"); // 3rd after beginMultiTxnOperation() & before endMultiTxnOperation()
|
|
1067
|
+
chai.expect(txns[2].props.description).to.be.equals("insert element 0x40000000003");
|
|
1068
|
+
chai.expect(txns[2].sessionId).to.be.equals(1);
|
|
1069
|
+
chai.expect(txns[2].grouped).to.be.equals(true);
|
|
1070
|
+
chai.expect(txns[2].reversed).to.be.equals(true);
|
|
1071
|
+
chai.expect(txns[3].id).to.be.equals("0x100000003"); // 4th after endMultiTxnOperation()
|
|
1072
|
+
chai.expect(txns[3].props.description).to.be.equals("insert element 0x40000000004");
|
|
1073
|
+
chai.expect(txns[3].type).to.be.equals("Data");
|
|
1074
|
+
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1075
|
+
chai.expect(txns[3].reversed).to.be.equals(true);
|
|
1076
|
+
// reinstate the transaction
|
|
1077
|
+
chai.expect(b2.txns.isRedoPossible).to.be.equals(true);
|
|
1078
|
+
chai.expect(b2.txns.reinstateTxn()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1079
|
+
txns = Array.from(b2.txns.queryTxns());
|
|
1080
|
+
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1081
|
+
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
1082
|
+
chai.expect(txns[0].sessionId).to.be.equals(1);
|
|
1083
|
+
chai.expect(txns[0].grouped).to.be.equals(false);
|
|
1084
|
+
chai.expect(txns[0].reversed).to.be.equals(false);
|
|
1085
|
+
chai.expect(txns[1].id).to.be.equals("0x100000001"); // 2nd after beginMultiTxnOperation()
|
|
1086
|
+
chai.expect(txns[1].props.description).to.be.equals("insert element 0x40000000002");
|
|
1087
|
+
chai.expect(txns[1].sessionId).to.be.equals(1);
|
|
1088
|
+
chai.expect(txns[1].grouped).to.be.equals(true);
|
|
1089
|
+
chai.expect(txns[1].reversed).to.be.equals(false);
|
|
1090
|
+
chai.expect(txns[2].id).to.be.equals("0x100000002"); // 3rd after beginMultiTxnOperation() & before endMultiTxnOperation()
|
|
1091
|
+
chai.expect(txns[2].props.description).to.be.equals("insert element 0x40000000003");
|
|
1092
|
+
chai.expect(txns[2].sessionId).to.be.equals(1);
|
|
1093
|
+
chai.expect(txns[2].grouped).to.be.equals(true);
|
|
1094
|
+
chai.expect(txns[2].reversed).to.be.equals(false);
|
|
1095
|
+
chai.expect(txns[3].id).to.be.equals("0x100000003"); // 4th after endMultiTxnOperation()
|
|
1096
|
+
chai.expect(txns[3].props.description).to.be.equals("insert element 0x40000000004");
|
|
1097
|
+
chai.expect(txns[3].type).to.be.equals("Data");
|
|
1098
|
+
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1099
|
+
chai.expect(txns[3].reversed).to.be.equals(true);
|
|
1100
|
+
// reinstate the transaction
|
|
1101
|
+
chai.expect(b2.txns.isRedoPossible).to.be.equals(true);
|
|
1102
|
+
chai.expect(b2.txns.reinstateTxn()).to.be.equals(DbResult.BE_SQLITE_OK);
|
|
1103
|
+
txns = Array.from(b2.txns.queryTxns());
|
|
1104
|
+
chai.expect(txns[0].id).to.be.equals("0x100000000"); // 1st after beginMultiTxnOperation()
|
|
1105
|
+
chai.expect(txns[0].props.description).to.be.equals("insert element 0x40000000001");
|
|
1106
|
+
chai.expect(txns[0].sessionId).to.be.equals(1);
|
|
1107
|
+
chai.expect(txns[0].grouped).to.be.equals(false);
|
|
1108
|
+
chai.expect(txns[0].reversed).to.be.equals(false);
|
|
1109
|
+
chai.expect(txns[1].id).to.be.equals("0x100000001"); // 2nd after beginMultiTxnOperation()
|
|
1110
|
+
chai.expect(txns[1].props.description).to.be.equals("insert element 0x40000000002");
|
|
1111
|
+
chai.expect(txns[1].sessionId).to.be.equals(1);
|
|
1112
|
+
chai.expect(txns[1].grouped).to.be.equals(true);
|
|
1113
|
+
chai.expect(txns[1].reversed).to.be.equals(false);
|
|
1114
|
+
chai.expect(txns[2].id).to.be.equals("0x100000002"); // 3rd after beginMultiTxnOperation() & before endMultiTxnOperation()
|
|
1115
|
+
chai.expect(txns[2].props.description).to.be.equals("insert element 0x40000000003");
|
|
1116
|
+
chai.expect(txns[2].sessionId).to.be.equals(1);
|
|
1117
|
+
chai.expect(txns[2].grouped).to.be.equals(true);
|
|
1118
|
+
chai.expect(txns[2].reversed).to.be.equals(false);
|
|
1119
|
+
chai.expect(txns[3].id).to.be.equals("0x100000003"); // 4th after endMultiTxnOperation()
|
|
1120
|
+
chai.expect(txns[3].props.description).to.be.equals("insert element 0x40000000004");
|
|
1121
|
+
chai.expect(txns[3].type).to.be.equals("Data");
|
|
1122
|
+
chai.expect(txns[3].grouped).to.be.equals(false);
|
|
1123
|
+
chai.expect(txns[3].reversed).to.be.equals(false);
|
|
1124
|
+
chai.expect(b2.txns.isRedoPossible).to.be.equals(false);
|
|
1125
|
+
await testIModel.updateElement(b1, e1);
|
|
1126
|
+
await testIModel.updateElement(b1, e2, true);
|
|
1127
|
+
b1.saveChanges();
|
|
1128
|
+
await b1.pushChanges({ description: "update element 1 direct and 1 indirect" });
|
|
1129
|
+
const recomputeTxnIds = [];
|
|
1130
|
+
b2.txns.rebaser.setCustomHandler({
|
|
1131
|
+
shouldReinstate: (_txn) => {
|
|
1132
|
+
return true;
|
|
1133
|
+
},
|
|
1134
|
+
recompute: async (txn) => {
|
|
1135
|
+
recomputeTxnIds.push(txn.id);
|
|
1136
|
+
},
|
|
1137
|
+
});
|
|
1138
|
+
await b2.pullChanges();
|
|
1139
|
+
chai.expect(recomputeTxnIds).to.deep.equals([
|
|
1140
|
+
"0x100000000",
|
|
1141
|
+
"0x100000001",
|
|
1142
|
+
"0x100000002",
|
|
1143
|
+
"0x100000003",
|
|
1144
|
+
]);
|
|
1145
|
+
});
|
|
990
1146
|
});
|
|
991
1147
|
//# sourceMappingURL=Rebase.test.js.map
|