core-3nweb-client-lib 0.44.1 → 0.44.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/build/api-defs/files.d.ts +8 -8
- package/build/core-ipc/fs.js +31 -9
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/xsp-fs/folder-node.js +39 -25
- package/build/lib-client/xsp-fs/fs.js +1 -16
- package/build/protos/asmail.proto.js +149 -378
- package/build/protos/fs.proto.js +149 -378
- package/package.json +1 -1
- package/protos/fs.proto +5 -9
|
Binary file
|
|
@@ -1096,13 +1096,11 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
1096
1096
|
const nodes = state.nodes;
|
|
1097
1097
|
const remoteNodes = remote.folderInfo.nodes;
|
|
1098
1098
|
const events = [];
|
|
1099
|
-
if (removed) {
|
|
1100
|
-
for (const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
events.push(this.makeEntryRemovalEvent(newVersion, 'sync', node));
|
|
1105
|
-
}
|
|
1099
|
+
if (removed === null || removed === void 0 ? void 0 : removed.inRemote) {
|
|
1100
|
+
for (const name of removed.inRemote) {
|
|
1101
|
+
const node = nodes[name];
|
|
1102
|
+
delete nodes[name];
|
|
1103
|
+
events.push(this.makeEntryRemovalEvent(newVersion, 'sync', node));
|
|
1106
1104
|
}
|
|
1107
1105
|
}
|
|
1108
1106
|
if (renamed) {
|
|
@@ -1122,19 +1120,17 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
1122
1120
|
}
|
|
1123
1121
|
}
|
|
1124
1122
|
}
|
|
1125
|
-
if (added) {
|
|
1126
|
-
for (const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
node.name = `${node.name}${opts === null || opts === void 0 ? void 0 : opts.postfixForNameOverlaps}`;
|
|
1133
|
-
}
|
|
1123
|
+
if (added === null || added === void 0 ? void 0 : added.inRemote) {
|
|
1124
|
+
for (const name of added.inRemote) {
|
|
1125
|
+
const node = remoteNodes[name];
|
|
1126
|
+
(0, assert_1.assert)(!!node);
|
|
1127
|
+
if (nameOverlaps === null || nameOverlaps === void 0 ? void 0 : nameOverlaps.includes(name)) {
|
|
1128
|
+
while (nodes[node.name]) {
|
|
1129
|
+
node.name = `${node.name}${opts === null || opts === void 0 ? void 0 : opts.postfixForNameOverlaps}`;
|
|
1134
1130
|
}
|
|
1135
|
-
nodes[node.name] = node;
|
|
1136
|
-
events.push(this.makeEntryAdditionEvent(newVersion, 'sync', node));
|
|
1137
1131
|
}
|
|
1132
|
+
nodes[node.name] = node;
|
|
1133
|
+
events.push(this.makeEntryAdditionEvent(newVersion, 'sync', node));
|
|
1138
1134
|
}
|
|
1139
1135
|
}
|
|
1140
1136
|
return events;
|
|
@@ -1188,9 +1184,9 @@ function addToTransitionState(state, f, key) {
|
|
|
1188
1184
|
function diffNodes(current, remote, synced) {
|
|
1189
1185
|
const currentNodesById = orderByIds(current.nodes);
|
|
1190
1186
|
const syncedNodesById = orderByIds(synced.nodes);
|
|
1191
|
-
const removed = [];
|
|
1187
|
+
const removed = { inLocal: [], inRemote: [] };
|
|
1192
1188
|
const renamed = [];
|
|
1193
|
-
const added = [];
|
|
1189
|
+
const added = { inLocal: [], inRemote: [] };
|
|
1194
1190
|
const rekeyed = [];
|
|
1195
1191
|
const nameOverlaps = [];
|
|
1196
1192
|
for (const remoteNode of Object.values(remote.nodes)) {
|
|
@@ -1229,10 +1225,10 @@ function diffNodes(current, remote, synced) {
|
|
|
1229
1225
|
else {
|
|
1230
1226
|
const syncedNode = syncedNodesById.get(remoteNode.objId);
|
|
1231
1227
|
if (syncedNode) {
|
|
1232
|
-
removed.push(
|
|
1228
|
+
removed.inLocal.push(remoteNode.name);
|
|
1233
1229
|
}
|
|
1234
1230
|
else {
|
|
1235
|
-
added.push(
|
|
1231
|
+
added.inRemote.push(remoteNode.name);
|
|
1236
1232
|
}
|
|
1237
1233
|
if (current.nodes[remoteNode.name]) {
|
|
1238
1234
|
nameOverlaps.push(remoteNode.name);
|
|
@@ -1242,13 +1238,13 @@ function diffNodes(current, remote, synced) {
|
|
|
1242
1238
|
for (const localNode of currentNodesById.values()) {
|
|
1243
1239
|
const syncedNode = syncedNodesById.get(localNode.objId);
|
|
1244
1240
|
if (!syncedNode) {
|
|
1245
|
-
added.push(
|
|
1241
|
+
added.inLocal.push(localNode.name);
|
|
1246
1242
|
}
|
|
1247
1243
|
}
|
|
1248
1244
|
return {
|
|
1249
|
-
removed: (
|
|
1245
|
+
removed: reduceEmptyIn(removed),
|
|
1250
1246
|
renamed: ((renamed.length > 0) ? renamed : undefined),
|
|
1251
|
-
added: (
|
|
1247
|
+
added: reduceEmptyIn(added),
|
|
1252
1248
|
rekeyed: ((rekeyed.length > 0) ? rekeyed : undefined),
|
|
1253
1249
|
nameOverlaps: ((nameOverlaps.length > 0) ? nameOverlaps : undefined),
|
|
1254
1250
|
};
|
|
@@ -1291,4 +1287,22 @@ function identifyChanges(originalNodes, newNodes) {
|
|
|
1291
1287
|
}
|
|
1292
1288
|
return { addedNodes, removedNodes, renamedNodes };
|
|
1293
1289
|
}
|
|
1290
|
+
function reduceEmptyIn(c) {
|
|
1291
|
+
if (c.inLocal.length > 0) {
|
|
1292
|
+
if (c.inRemote.length > 0) {
|
|
1293
|
+
return c;
|
|
1294
|
+
}
|
|
1295
|
+
else {
|
|
1296
|
+
return { inLocal: c.inLocal };
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
if (c.inRemote.length > 0) {
|
|
1301
|
+
return { inRemote: c.inRemote };
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1294
1308
|
Object.freeze(exports);
|
|
@@ -859,24 +859,9 @@ class S {
|
|
|
859
859
|
throw (0, file_1.makeFileException)('notDirectory', `${path}/${remoteItemName}`);
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
// async adoptAllRemoteItems(
|
|
863
|
-
// path: string, opts?: OptionsToAdoptAllRemoteItems
|
|
864
|
-
// ): Promise<number|undefined> {
|
|
865
|
-
// const folderNode = await this.getFolderNode(path);
|
|
866
|
-
// return await folderNode.adoptItemsFromRemoteVersion(opts);
|
|
867
|
-
// }
|
|
868
862
|
async mergeFolderCurrentAndRemoteVersions(path, opts) {
|
|
869
863
|
const folderNode = await this.getFolderNode(path);
|
|
870
|
-
|
|
871
|
-
if (newLocalVersion && (newLocalVersion < 0)) {
|
|
872
|
-
const { folderPath } = split(path);
|
|
873
|
-
if (folderPath.length > 0) {
|
|
874
|
-
const parent = await this.n.get(folderPath.join('/'));
|
|
875
|
-
// XXX removing folder in parent -- what happens with children?
|
|
876
|
-
await parent.removeChild(folderNode);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
return newLocalVersion;
|
|
864
|
+
return await folderNode.mergeCurrentAndRemoteVersions(opts);
|
|
880
865
|
}
|
|
881
866
|
}
|
|
882
867
|
Object.freeze(S.prototype);
|