core-3nweb-client-lib 0.43.18 → 0.43.20

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.
@@ -1281,9 +1281,7 @@ declare namespace web3n.files {
1281
1281
  * Returns a state of on-disk cache of an item in fs.
1282
1282
  * @param version
1283
1283
  */
1284
- isRemoteVersionOnDisk(
1285
- path: string, version: number
1286
- ): Promise<'partial'|'complete'|'none'>;
1284
+ isRemoteVersionOnDisk(path: string, version: number): Promise<'partial'|'complete'|'none'>;
1287
1285
 
1288
1286
  /**
1289
1287
  * This downloads bytes onto disk, skipping decryption, as item's content isn't read here.
@@ -1301,7 +1299,7 @@ declare namespace web3n.files {
1301
1299
  adoptRemote(path: string, opts?: OptionsToAdopteRemote): Promise<void>;
1302
1300
 
1303
1301
  /**
1304
- * Calculates diff between current local and remote states of folder at given path.
1302
+ * Calculates diff between current and remote states of folder at given path.
1305
1303
  * @param path
1306
1304
  * @param remoteVersion
1307
1305
  */
@@ -1345,32 +1343,83 @@ declare namespace web3n.files {
1345
1343
  }
1346
1344
 
1347
1345
  /**
1348
- *
1346
+ * Difference between two versions of folder node.
1347
+ * Folder items that same in both versions are not included.
1349
1348
  */
1350
1349
  interface FolderDiff {
1350
+ /**
1351
+ * Current version against which this diff is done.
1352
+ */
1351
1353
  currentVersion: number;
1354
+
1355
+ /**
1356
+ * Flag indicating if current version is local, i.e. never uploaded.
1357
+ */
1352
1358
  isCurrentLocal: boolean;
1359
+
1360
+ /**
1361
+ * Remote version against which this diff is done.
1362
+ */
1353
1363
  remoteVersion?: number;
1354
- isRemoteArchived: boolean;
1364
+
1365
+ /**
1366
+ * Flag indicating if remote version is removed, i.e. has no current version.
1367
+ * If remote is removed, it has nothing inside, and with this implicit
1368
+ * understanding there is no need to have other data fields populated here.
1369
+ */
1370
+ isRemoteRemoved: boolean;
1371
+
1372
+ /**
1373
+ * Items present only in current version.
1374
+ */
1355
1375
  inCurrent?: ListingEntry[];
1376
+
1377
+ /**
1378
+ * Items present only in remote version.
1379
+ */
1356
1380
  inRemote?: ListingEntry[];
1357
1381
 
1358
- // XXX add indication for items that have different name
1382
+ /**
1383
+ * Different names are for items that are same nodes but have different names
1384
+ * in local and remote branches.
1385
+ */
1359
1386
  differentNames?: {
1360
1387
  localName: string;
1361
1388
  remoteName: string;
1362
1389
  }[];
1390
+
1391
+ /**
1392
+ * Different keys identifies items that have different encryption keys in
1393
+ * local and remote branches. Keys may be changed, hence, given situation
1394
+ * should be reflected.
1395
+ */
1363
1396
  differentKeys?: string[];
1364
1397
 
1398
+ /**
1399
+ * Name overlaps are items with same name, but different node objects underneath.
1400
+ */
1365
1401
  nameOverlaps?: string[];
1402
+
1403
+ /**
1404
+ * Creation time should always be same.
1405
+ * But there is no way to enforce it, hence, we have this field.
1406
+ */
1366
1407
  ctime: {
1367
1408
  remote?: Date;
1368
1409
  current: Date;
1369
1410
  };
1411
+
1412
+ /**
1413
+ * Modification time most probably be different between versions.
1414
+ */
1370
1415
  mtime: {
1371
1416
  remote?: Date;
1372
1417
  current: Date;
1373
1418
  };
1419
+
1420
+ /**
1421
+ * Difference between xattrs. Same xattrs in both versions are not included.
1422
+ */
1374
1423
  xattrs?: {
1375
1424
  inCurrent?: { name: string; value: any; }[];
1376
1425
  inRemote?: { name: string; value: any; }[];
@@ -199,7 +199,7 @@ function exposeFSService(fs, expServices) {
199
199
  implExp.v.sync.startUpload = vsStartUpload.wrapService(fs.v.sync.startUpload);
200
200
  implExp.v.sync.upload = vsUpload.wrapService(fs.v.sync.upload);
201
201
  implExp.v.sync.adoptRemoteFolderItem = vsAdoptRemoteFolderItem.wrapService(fs.v.sync.adoptRemoteFolderItem);
202
- implExp.v.sync.adoptAllRemoteFolderItems = vsAdoptAllRemoteItems.wrapService(fs.v.sync.adoptAllRemoteItems);
202
+ implExp.v.sync.adoptAllRemoteItems = vsAdoptAllRemoteItems.wrapService(fs.v.sync.adoptAllRemoteItems);
203
203
  }
204
204
  }
205
205
  }
@@ -2012,7 +2012,7 @@ var vsAdoptAllRemoteItems;
2012
2012
  const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'adoptAllRemoteItems');
2013
2013
  return (path, opts) => caller
2014
2014
  .startPromiseCall(ipcPath, requestType.pack({ path, opts: optionsToMsg(opts) }))
2015
- .then(buf => (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).newVersion));
2015
+ .then(buf => (0, protobuf_msg_1.valOfOptInt)(replyType.unpack(buf).newVersion));
2016
2016
  }
2017
2017
  vsAdoptAllRemoteItems.makeCaller = makeCaller;
2018
2018
  })(vsAdoptAllRemoteItems || (vsAdoptAllRemoteItems = {}));
@@ -2190,10 +2190,12 @@ function folderDiffToMsg(diff) {
2190
2190
  remoteVersion: (0, protobuf_msg_1.toOptVal)(diff.remoteVersion),
2191
2191
  currentVersion: diff.currentVersion,
2192
2192
  isCurrentLocal: diff.isCurrentLocal,
2193
- isRemoteArchived: diff.isRemoteArchived,
2193
+ isRemoteRemoved: diff.isRemoteRemoved,
2194
2194
  inCurrent: (_a = diff.inCurrent) === null || _a === void 0 ? void 0 : _a.map(lsEntryToMsg),
2195
2195
  inRemote: (_b = diff.inRemote) === null || _b === void 0 ? void 0 : _b.map(lsEntryToMsg),
2196
2196
  nameOverlaps: diff.nameOverlaps,
2197
+ differentKeys: diff.differentKeys,
2198
+ differentNames: diff.differentNames,
2197
2199
  ctime: diffTStoMsg(diff.ctime),
2198
2200
  mtime: diffTStoMsg(diff.mtime),
2199
2201
  xattrs: (diff.xattrs ? {
@@ -2218,21 +2220,20 @@ function folderDiffFromMsg(msg) {
2218
2220
  remoteVersion: (0, protobuf_msg_1.valOfOptInt)(msg.remoteVersion),
2219
2221
  currentVersion: (0, protobuf_msg_1.fixInt)(msg.currentVersion),
2220
2222
  isCurrentLocal: msg.isCurrentLocal,
2221
- isRemoteArchived: msg.isRemoteArchived,
2222
- inCurrent: ((msg.inCurrent.length > 0) ?
2223
- msg.inCurrent.map(lsEntryFromMsg) : undefined),
2224
- inRemote: ((msg.inRemote.length > 0) ?
2225
- msg.inRemote.map(lsEntryFromMsg) : undefined),
2226
- nameOverlaps: ((msg.nameOverlaps.length > 0) ?
2227
- msg.nameOverlaps : undefined),
2223
+ isRemoteRemoved: msg.isRemoteRemoved,
2224
+ inCurrent: ((msg.inCurrent && (msg.inCurrent.length > 0)) ? msg.inCurrent.map(lsEntryFromMsg) : undefined),
2225
+ inRemote: ((msg.inRemote && (msg.inRemote.length > 0)) ? msg.inRemote.map(lsEntryFromMsg) : undefined),
2226
+ nameOverlaps: ((msg.nameOverlaps && (msg.nameOverlaps.length > 0)) ? msg.nameOverlaps : undefined),
2227
+ differentKeys: ((msg.differentKeys && (msg.differentKeys.length > 0)) ? msg.differentKeys : undefined),
2228
+ differentNames: ((msg.differentNames && (msg.differentNames.length > 0)) ? msg.differentNames : undefined),
2228
2229
  ctime: diffTSfromMsg(msg.ctime),
2229
2230
  mtime: diffTSfromMsg(msg.mtime),
2230
2231
  xattrs: (msg.xattrs ? {
2231
- inCurrent: ((msg.xattrs.inCurrent.length > 0) ?
2232
+ inCurrent: ((msg.xattrs.inCurrent && (msg.xattrs.inCurrent.length > 0)) ?
2232
2233
  msg.xattrs.inCurrent.map(file.xattrFromMsg) : undefined),
2233
- inRemote: ((msg.xattrs.inRemote.length > 0) ?
2234
+ inRemote: ((msg.xattrs.inRemote && (msg.xattrs.inRemote.length > 0)) ?
2234
2235
  msg.xattrs.inRemote.map(file.xattrFromMsg) : undefined),
2235
- nameOverlaps: ((msg.xattrs.nameOverlaps.length > 0) ?
2236
+ nameOverlaps: ((msg.xattrs.nameOverlaps && (msg.xattrs.nameOverlaps.length > 0)) ?
2236
2237
  msg.xattrs.nameOverlaps : undefined)
2237
2238
  } : undefined)
2238
2239
  };