core-3nweb-client-lib 0.43.20 → 0.44.0
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 +233 -160
- package/build/core-ipc/file.d.ts +47 -0
- package/build/core-ipc/file.js +121 -2
- package/build/core-ipc/fs.js +55 -62
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/fs-utils/files.js +5 -1
- package/build/lib-client/xsp-fs/exceptions.js +1 -1
- package/build/lib-client/xsp-fs/file-node.d.ts +3 -0
- package/build/lib-client/xsp-fs/file-node.js +55 -3
- package/build/lib-client/xsp-fs/file.d.ts +3 -0
- package/build/lib-client/xsp-fs/file.js +5 -1
- package/build/lib-client/xsp-fs/folder-node.d.ts +5 -4
- package/build/lib-client/xsp-fs/folder-node.js +257 -368
- package/build/lib-client/xsp-fs/fs.d.ts +6 -2
- package/build/lib-client/xsp-fs/fs.js +33 -2
- package/build/lib-client/xsp-fs/link-node.js +1 -1
- package/build/lib-client/xsp-fs/node-in-fs.d.ts +21 -0
- package/build/lib-client/xsp-fs/node-in-fs.js +172 -3
- package/build/lib-common/exceptions/file.d.ts +1 -1
- package/build/lib-common/exceptions/file.js +3 -2
- package/build/protos/asmail.proto.js +3315 -883
- package/build/protos/file.proto.js +1974 -0
- package/build/protos/fs.proto.js +3301 -869
- package/package.json +1 -1
- package/protos/file.proto +44 -0
- package/protos/fs.proto +42 -27
|
@@ -84,6 +84,8 @@ declare namespace web3n.files {
|
|
|
84
84
|
remoteIsArchived?: true;
|
|
85
85
|
remoteFolderItemNotFound?: true;
|
|
86
86
|
overlapsLocalItem?: true;
|
|
87
|
+
nameOverlaps?: string[];
|
|
88
|
+
noNamePostfixGiven?: true;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
/**
|
|
@@ -648,6 +650,13 @@ declare namespace web3n.files {
|
|
|
648
650
|
*/
|
|
649
651
|
adoptRemote(opts?: OptionsToAdopteRemote): Promise<void>;
|
|
650
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Calculates diff between current and remote states of file at given path.
|
|
655
|
+
* @param path
|
|
656
|
+
* @param opts
|
|
657
|
+
*/
|
|
658
|
+
diffCurrentAndRemoteVersions(opts?: OptionsToDiffFileVersions): Promise<FileDiff|undefined>;
|
|
659
|
+
|
|
651
660
|
}
|
|
652
661
|
|
|
653
662
|
interface OptionsToAdopteRemote {
|
|
@@ -658,6 +667,11 @@ declare namespace web3n.files {
|
|
|
658
667
|
remoteVersion?: number;
|
|
659
668
|
}
|
|
660
669
|
|
|
670
|
+
interface OptionsToDiffFileVersions {
|
|
671
|
+
remoteVersion?: number;
|
|
672
|
+
compareContentIfSameMTime?: boolean;
|
|
673
|
+
}
|
|
674
|
+
|
|
661
675
|
interface WritableFileSyncAPI extends ReadonlyFileSyncAPI {
|
|
662
676
|
|
|
663
677
|
/**
|
|
@@ -1104,6 +1118,127 @@ declare namespace web3n.files {
|
|
|
1104
1118
|
|
|
1105
1119
|
}
|
|
1106
1120
|
|
|
1121
|
+
interface FSEvent {
|
|
1122
|
+
path: string;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
interface FSChangeEvent {
|
|
1126
|
+
path: string;
|
|
1127
|
+
src: 'local'|'sync';
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
interface RemovedEvent extends FSChangeEvent {
|
|
1131
|
+
type: 'removed';
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
interface VersionChangeOnUpload extends FSChangeEvent {
|
|
1135
|
+
type: 'version-change-on-upload';
|
|
1136
|
+
src: 'sync';
|
|
1137
|
+
newVersion: number;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
type FolderEvent = EntryRemovalEvent | EntryAdditionEvent |
|
|
1141
|
+
EntryRenamingEvent | RemovedEvent | VersionChangeOnUpload;
|
|
1142
|
+
|
|
1143
|
+
interface EntryRemovalEvent extends FSChangeEvent {
|
|
1144
|
+
type: 'entry-removal';
|
|
1145
|
+
name: string;
|
|
1146
|
+
moveLabel?: number;
|
|
1147
|
+
newVersion?: number;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
interface EntryAdditionEvent extends FSChangeEvent {
|
|
1151
|
+
type: 'entry-addition';
|
|
1152
|
+
entry: ListingEntry;
|
|
1153
|
+
moveLabel?: number;
|
|
1154
|
+
newVersion?: number;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
interface EntryRenamingEvent extends FSChangeEvent {
|
|
1158
|
+
type: 'entry-renaming';
|
|
1159
|
+
oldName: string;
|
|
1160
|
+
newName: string;
|
|
1161
|
+
newVersion?: number;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
type FileEvent = FileChangeEvent | RemovedEvent | VersionChangeOnUpload;
|
|
1165
|
+
|
|
1166
|
+
interface FileChangeEvent extends FSChangeEvent {
|
|
1167
|
+
type: 'file-change';
|
|
1168
|
+
newVersion?: number;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
type RemoteEvent = RemoteVersionArchivalEvent | RemoteArchVerRemovalEvent |
|
|
1172
|
+
RemoteRemovalEvent | RemoteChangeEvent;
|
|
1173
|
+
|
|
1174
|
+
interface RemoteVersionArchivalEvent extends FSEvent {
|
|
1175
|
+
type: 'remote-version-archival';
|
|
1176
|
+
archivedVersion: number;
|
|
1177
|
+
syncStatus: SyncStatus;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
interface RemoteArchVerRemovalEvent extends FSEvent {
|
|
1181
|
+
type: 'remote-arch-ver-removal';
|
|
1182
|
+
removedArchVer: number;
|
|
1183
|
+
syncStatus: SyncStatus;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
interface RemoteRemovalEvent extends FSEvent {
|
|
1187
|
+
type: 'remote-removal';
|
|
1188
|
+
syncStatus: SyncStatus;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
interface RemoteChangeEvent extends FSEvent {
|
|
1192
|
+
type: 'remote-change';
|
|
1193
|
+
newRemoteVersion: number;
|
|
1194
|
+
syncStatus: SyncStatus;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
type UploadEvent = UploadStartEvent | UploadProgressEvent | UploadDoneEvent;
|
|
1198
|
+
|
|
1199
|
+
interface UploadEventBase extends FSEvent {
|
|
1200
|
+
uploadTaskId: number;
|
|
1201
|
+
localVersion: number;
|
|
1202
|
+
uploadVersion: number;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
interface UploadStartEvent extends UploadEventBase {
|
|
1206
|
+
type: 'upload-started';
|
|
1207
|
+
totalBytesToUpload: number;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
interface UploadProgressEvent extends UploadEventBase {
|
|
1211
|
+
type: 'upload-progress';
|
|
1212
|
+
totalBytesToUpload: number;
|
|
1213
|
+
bytesLeftToUpload: number;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
interface UploadDoneEvent extends UploadEventBase {
|
|
1217
|
+
type: 'upload-done';
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
type DownloadEvent = DownloadStartEvent | DownloadProgressEvent | DownloadDoneEvent;
|
|
1221
|
+
|
|
1222
|
+
interface DownloadEventBase extends FSEvent {
|
|
1223
|
+
downloadTaskId: number;
|
|
1224
|
+
version: number;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
interface DownloadStartEvent extends DownloadEventBase {
|
|
1228
|
+
type: 'download-started';
|
|
1229
|
+
totalBytesToDownload: number;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
interface DownloadDoneEvent extends DownloadEventBase {
|
|
1233
|
+
type: 'download-done';
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
interface DownloadProgressEvent extends DownloadEventBase {
|
|
1237
|
+
type: 'download-progress';
|
|
1238
|
+
totalBytesToDownload: number;
|
|
1239
|
+
bytesLeftToDownload: number;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1107
1242
|
interface VersionedFileWriteFlags extends FileFlags {
|
|
1108
1243
|
|
|
1109
1244
|
/**
|
|
@@ -1305,6 +1440,15 @@ declare namespace web3n.files {
|
|
|
1305
1440
|
*/
|
|
1306
1441
|
diffCurrentAndRemoteFolderVersions(path: string, remoteVersion?: number): Promise<FolderDiff|undefined>;
|
|
1307
1442
|
|
|
1443
|
+
/**
|
|
1444
|
+
* Calculates diff between current and remote states of file at given path.
|
|
1445
|
+
* @param path
|
|
1446
|
+
* @param opts
|
|
1447
|
+
*/
|
|
1448
|
+
diffCurrentAndRemoteFileVersions(
|
|
1449
|
+
path: string, opts?: OptionsToDiffFileVersions
|
|
1450
|
+
): Promise<FileDiff|undefined>;
|
|
1451
|
+
|
|
1308
1452
|
/**
|
|
1309
1453
|
* Returns stats of a child from remote version of a folder.
|
|
1310
1454
|
* @param path of folder
|
|
@@ -1342,11 +1486,7 @@ declare namespace web3n.files {
|
|
|
1342
1486
|
|
|
1343
1487
|
}
|
|
1344
1488
|
|
|
1345
|
-
|
|
1346
|
-
* Difference between two versions of folder node.
|
|
1347
|
-
* Folder items that same in both versions are not included.
|
|
1348
|
-
*/
|
|
1349
|
-
interface FolderDiff {
|
|
1489
|
+
interface CommonDiff {
|
|
1350
1490
|
/**
|
|
1351
1491
|
* Current version against which this diff is done.
|
|
1352
1492
|
*/
|
|
@@ -1370,60 +1510,112 @@ declare namespace web3n.files {
|
|
|
1370
1510
|
isRemoteRemoved: boolean;
|
|
1371
1511
|
|
|
1372
1512
|
/**
|
|
1373
|
-
*
|
|
1513
|
+
* Synced version against which this diff is done.
|
|
1374
1514
|
*/
|
|
1375
|
-
|
|
1515
|
+
syncedVersion?: number;
|
|
1376
1516
|
|
|
1377
1517
|
/**
|
|
1378
|
-
*
|
|
1518
|
+
* Creation time should always be same, but if not, this field will show different values.
|
|
1519
|
+
* If remote is removed, this field will be undefined.
|
|
1379
1520
|
*/
|
|
1380
|
-
|
|
1521
|
+
ctime?: {
|
|
1522
|
+
remote: Date;
|
|
1523
|
+
current: Date;
|
|
1524
|
+
synced: Date;
|
|
1525
|
+
};
|
|
1381
1526
|
|
|
1382
1527
|
/**
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1528
|
+
* This field shows different modification times. If they are same, field will be undefined.
|
|
1529
|
+
* If remote is removed, this field will be undefined.
|
|
1530
|
+
*/
|
|
1531
|
+
mtime?: {
|
|
1532
|
+
remote: Date;
|
|
1533
|
+
current: Date;
|
|
1534
|
+
synced: Date;
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
/**
|
|
1538
|
+
* Difference between xattrs. Same xattrs in both versions are not included.
|
|
1385
1539
|
*/
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1540
|
+
xattrs?: {
|
|
1541
|
+
[name: string]: {
|
|
1542
|
+
addedIn?: 'l'|'r'|'l&r';
|
|
1543
|
+
removedIn?: 'l'|'r';
|
|
1544
|
+
changedIn?: 'l'|'r'|'l&r';
|
|
1545
|
+
};
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
/**
|
|
1550
|
+
* Difference of remote and local folder versions expressed as changes relative to synced version.
|
|
1551
|
+
*
|
|
1552
|
+
* Consider the following example.
|
|
1553
|
+
* There is an item in local version, but not in remote.
|
|
1554
|
+
* Such difference can come about in two ways: addition in local branch, or removal in remote.
|
|
1555
|
+
*
|
|
1556
|
+
* Contexts where versions are compared need information about change actions in folder.
|
|
1557
|
+
* Hence, this diff is a three point comparison, yielding richer info.
|
|
1558
|
+
*/
|
|
1559
|
+
interface FolderDiff extends CommonDiff {
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Items that were removed. Pointing to where removal is done in remote (r), or local (l) branches.
|
|
1563
|
+
*
|
|
1564
|
+
* Consider the following example.
|
|
1565
|
+
* Item that is removed in local version is present in both remote and synced versions.
|
|
1566
|
+
* Hence, difference between local and remote versions is due to removal in local branch.
|
|
1567
|
+
*/
|
|
1568
|
+
removed?: {
|
|
1569
|
+
name: string;
|
|
1570
|
+
removedIn: 'l'|'r';
|
|
1389
1571
|
}[];
|
|
1390
1572
|
|
|
1391
1573
|
/**
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1574
|
+
* Items that were renamed. Pointing to where renaming is done in remote (r), or local (l) branches.
|
|
1575
|
+
*
|
|
1576
|
+
* When item is renamed local branch, then local name was changed from synced value,
|
|
1577
|
+
* while remote name is still equal to synced (older) value.
|
|
1395
1578
|
*/
|
|
1396
|
-
|
|
1579
|
+
renamed?: {
|
|
1580
|
+
local: string;
|
|
1581
|
+
remote: string;
|
|
1582
|
+
renamedIn: 'l'|'r'|'l&r';
|
|
1583
|
+
}[];
|
|
1397
1584
|
|
|
1398
1585
|
/**
|
|
1399
|
-
*
|
|
1586
|
+
* Items that were added. Pointing to where addition is done in remote (r), or local (l) branches.
|
|
1587
|
+
*
|
|
1588
|
+
* When item added in remote branch, then it is present in remote version under the referenced name.
|
|
1589
|
+
* Synced (older) state of folder doesn't have it, and neither does local.
|
|
1400
1590
|
*/
|
|
1401
|
-
|
|
1591
|
+
added?: {
|
|
1592
|
+
name: string;
|
|
1593
|
+
addedIn: 'l'|'r';
|
|
1594
|
+
}[];
|
|
1402
1595
|
|
|
1403
1596
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
* But there is no way to enforce it, hence, we have this field.
|
|
1597
|
+
* Items that reencrypted and now have different keys.
|
|
1406
1598
|
*/
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1599
|
+
rekeyed?: {
|
|
1600
|
+
local: string;
|
|
1601
|
+
remote: string;
|
|
1602
|
+
rekeyedIn: 'l'|'r'|'l&r';
|
|
1603
|
+
}[];
|
|
1411
1604
|
|
|
1412
1605
|
/**
|
|
1413
|
-
*
|
|
1606
|
+
* Name overlaps are items with same name, but different node objects underneath.
|
|
1414
1607
|
*/
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
current: Date;
|
|
1418
|
-
};
|
|
1608
|
+
nameOverlaps?: string[];
|
|
1609
|
+
}
|
|
1419
1610
|
|
|
1611
|
+
interface FileDiff extends CommonDiff {
|
|
1612
|
+
areContentsSame: boolean;
|
|
1420
1613
|
/**
|
|
1421
|
-
*
|
|
1614
|
+
* If sizes are different this field will have respective values.
|
|
1422
1615
|
*/
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
nameOverlaps?: string[];
|
|
1616
|
+
size?: {
|
|
1617
|
+
remote: number;
|
|
1618
|
+
current: number;
|
|
1427
1619
|
};
|
|
1428
1620
|
}
|
|
1429
1621
|
|
|
@@ -1465,12 +1657,14 @@ declare namespace web3n.files {
|
|
|
1465
1657
|
|
|
1466
1658
|
/**
|
|
1467
1659
|
* This method is for resolving conflicts on folders.
|
|
1468
|
-
* It
|
|
1660
|
+
* It merges folder changes from remote version.
|
|
1469
1661
|
* Returns new local version, if there were remote items to adopt and their were added to local state.
|
|
1470
1662
|
* @param path
|
|
1471
1663
|
* @param opts
|
|
1472
1664
|
*/
|
|
1473
|
-
|
|
1665
|
+
mergeFolderCurrentAndRemoteVersions(
|
|
1666
|
+
path: string, opts?: OptionsToMergeFolderVersions
|
|
1667
|
+
): Promise<number|undefined>;
|
|
1474
1668
|
|
|
1475
1669
|
}
|
|
1476
1670
|
|
|
@@ -1494,7 +1688,7 @@ declare namespace web3n.files {
|
|
|
1494
1688
|
newItemName?: string;
|
|
1495
1689
|
}
|
|
1496
1690
|
|
|
1497
|
-
interface
|
|
1691
|
+
interface OptionsToMergeFolderVersions {
|
|
1498
1692
|
/**
|
|
1499
1693
|
* Folder's local version. If not given, current local version is used.
|
|
1500
1694
|
*/
|
|
@@ -1510,125 +1704,4 @@ declare namespace web3n.files {
|
|
|
1510
1704
|
postfixForNameOverlaps?: string;
|
|
1511
1705
|
}
|
|
1512
1706
|
|
|
1513
|
-
interface FSEvent {
|
|
1514
|
-
path: string;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
interface FSChangeEvent {
|
|
1518
|
-
path: string;
|
|
1519
|
-
src: 'local'|'sync';
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
interface RemovedEvent extends FSChangeEvent {
|
|
1523
|
-
type: 'removed';
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
interface VersionChangeOnUpload extends FSChangeEvent {
|
|
1527
|
-
type: 'version-change-on-upload';
|
|
1528
|
-
src: 'sync';
|
|
1529
|
-
newVersion: number;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
type FolderEvent = EntryRemovalEvent | EntryAdditionEvent |
|
|
1533
|
-
EntryRenamingEvent | RemovedEvent | VersionChangeOnUpload;
|
|
1534
|
-
|
|
1535
|
-
interface EntryRemovalEvent extends FSChangeEvent {
|
|
1536
|
-
type: 'entry-removal';
|
|
1537
|
-
name: string;
|
|
1538
|
-
moveLabel?: number;
|
|
1539
|
-
newVersion?: number;
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
interface EntryAdditionEvent extends FSChangeEvent {
|
|
1543
|
-
type: 'entry-addition';
|
|
1544
|
-
entry: ListingEntry;
|
|
1545
|
-
moveLabel?: number;
|
|
1546
|
-
newVersion?: number;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
interface EntryRenamingEvent extends FSChangeEvent {
|
|
1550
|
-
type: 'entry-renaming';
|
|
1551
|
-
oldName: string;
|
|
1552
|
-
newName: string;
|
|
1553
|
-
newVersion?: number;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
type FileEvent = FileChangeEvent | RemovedEvent | VersionChangeOnUpload;
|
|
1557
|
-
|
|
1558
|
-
interface FileChangeEvent extends FSChangeEvent {
|
|
1559
|
-
type: 'file-change';
|
|
1560
|
-
newVersion?: number;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
type RemoteEvent = RemoteVersionArchivalEvent | RemoteArchVerRemovalEvent |
|
|
1564
|
-
RemoteRemovalEvent | RemoteChangeEvent;
|
|
1565
|
-
|
|
1566
|
-
interface RemoteVersionArchivalEvent extends FSEvent {
|
|
1567
|
-
type: 'remote-version-archival';
|
|
1568
|
-
archivedVersion: number;
|
|
1569
|
-
syncStatus: SyncStatus;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
interface RemoteArchVerRemovalEvent extends FSEvent {
|
|
1573
|
-
type: 'remote-arch-ver-removal';
|
|
1574
|
-
removedArchVer: number;
|
|
1575
|
-
syncStatus: SyncStatus;
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
interface RemoteRemovalEvent extends FSEvent {
|
|
1579
|
-
type: 'remote-removal';
|
|
1580
|
-
syncStatus: SyncStatus;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
interface RemoteChangeEvent extends FSEvent {
|
|
1584
|
-
type: 'remote-change';
|
|
1585
|
-
newRemoteVersion: number;
|
|
1586
|
-
syncStatus: SyncStatus;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
type UploadEvent = UploadStartEvent | UploadProgressEvent | UploadDoneEvent;
|
|
1590
|
-
|
|
1591
|
-
interface UploadEventBase extends FSEvent {
|
|
1592
|
-
uploadTaskId: number;
|
|
1593
|
-
localVersion: number;
|
|
1594
|
-
uploadVersion: number;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
interface UploadStartEvent extends UploadEventBase {
|
|
1598
|
-
type: 'upload-started';
|
|
1599
|
-
totalBytesToUpload: number;
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
interface UploadProgressEvent extends UploadEventBase {
|
|
1603
|
-
type: 'upload-progress';
|
|
1604
|
-
totalBytesToUpload: number;
|
|
1605
|
-
bytesLeftToUpload: number;
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
interface UploadDoneEvent extends UploadEventBase {
|
|
1609
|
-
type: 'upload-done';
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
type DownloadEvent = DownloadStartEvent | DownloadProgressEvent | DownloadDoneEvent;
|
|
1613
|
-
|
|
1614
|
-
interface DownloadEventBase extends FSEvent {
|
|
1615
|
-
downloadTaskId: number;
|
|
1616
|
-
version: number;
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
interface DownloadStartEvent extends DownloadEventBase {
|
|
1620
|
-
type: 'download-started';
|
|
1621
|
-
totalBytesToDownload: number;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
interface DownloadDoneEvent extends DownloadEventBase {
|
|
1625
|
-
type: 'download-done';
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
interface DownloadProgressEvent extends DownloadEventBase {
|
|
1629
|
-
type: 'download-progress';
|
|
1630
|
-
totalBytesToDownload: number;
|
|
1631
|
-
bytesLeftToDownload: number;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
1707
|
}
|
package/build/core-ipc/file.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
|
14
14
|
type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
|
|
15
15
|
type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
|
|
16
16
|
type VersionedReadFlags = web3n.files.VersionedReadFlags;
|
|
17
|
+
type FileDiff = web3n.files.FileDiff;
|
|
18
|
+
type CommonDiff = web3n.files.CommonDiff;
|
|
19
|
+
type OptionsToDiffFileVersions = web3n.files.OptionsToDiffFileVersions;
|
|
17
20
|
export declare function makeFileCaller(caller: Caller, fileMsg: FileMsg): File;
|
|
18
21
|
export declare function exposeFileService(file: File, expServices: CoreSideServices): FileMsg;
|
|
19
22
|
export interface FileMsg {
|
|
@@ -201,4 +204,48 @@ export declare namespace vListVersions {
|
|
|
201
204
|
function wrapService(fn: ReadonlyFileVersionedAPI['listVersions']): ExposedFn;
|
|
202
205
|
function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileVersionedAPI['listVersions'];
|
|
203
206
|
}
|
|
207
|
+
export interface CommonDiffMsg {
|
|
208
|
+
remoteVersion?: Value<number>;
|
|
209
|
+
currentVersion: number;
|
|
210
|
+
syncedVersion?: Value<number>;
|
|
211
|
+
isCurrentLocal: boolean;
|
|
212
|
+
isRemoteRemoved: boolean;
|
|
213
|
+
ctime?: DiffTimeStampsMsg;
|
|
214
|
+
mtime?: DiffTimeStampsMsg;
|
|
215
|
+
xattrs?: {
|
|
216
|
+
name: string;
|
|
217
|
+
addedIn?: Value<'l' | 'r' | 'l&r'>;
|
|
218
|
+
removedIn?: Value<'l' | 'r'>;
|
|
219
|
+
changedIn?: Value<'l' | 'r' | 'l&r'>;
|
|
220
|
+
}[];
|
|
221
|
+
}
|
|
222
|
+
export interface DiffTimeStampsMsg {
|
|
223
|
+
remote: number;
|
|
224
|
+
current: number;
|
|
225
|
+
synced: number;
|
|
226
|
+
}
|
|
227
|
+
export interface FileDiffMsg extends CommonDiffMsg {
|
|
228
|
+
areContentsSame: boolean;
|
|
229
|
+
size?: {
|
|
230
|
+
remote: number;
|
|
231
|
+
current: number;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
export declare function commonDiffToMsg(diff: CommonDiff): CommonDiffMsg;
|
|
235
|
+
export declare function commonDiffFromMsg(msg: CommonDiffMsg): CommonDiff;
|
|
236
|
+
export declare function fileDiffToMsg(diff: FileDiff | undefined): FileDiffMsg | undefined;
|
|
237
|
+
export declare function fileDiffFromMsg(msg: FileDiffMsg | undefined): FileDiff | undefined;
|
|
238
|
+
export declare namespace vsDiffCurrentAndRemoteVersions {
|
|
239
|
+
interface OptionsMsg {
|
|
240
|
+
remoteVersion?: Value<number>;
|
|
241
|
+
compareContentIfSameMTime?: Value<boolean>;
|
|
242
|
+
}
|
|
243
|
+
function optsFromMsg(opts: OptionsMsg | undefined): OptionsToDiffFileVersions | undefined;
|
|
244
|
+
function optsToMsg(opts: OptionsToDiffFileVersions | undefined): OptionsMsg | undefined;
|
|
245
|
+
const replyType: ProtoType<{
|
|
246
|
+
diff?: FileDiffMsg;
|
|
247
|
+
}>;
|
|
248
|
+
function wrapService(fn: ReadonlyFileSyncAPI['diffCurrentAndRemoteVersions']): ExposedFn;
|
|
249
|
+
function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileSyncAPI['diffCurrentAndRemoteVersions'];
|
|
250
|
+
}
|
|
204
251
|
export {};
|
package/build/core-ipc/file.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020, 2022, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2020, 2022, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.vListVersions = exports.vsUpload = exports.vsStartUpload = exports.vsStartDownload = exports.vGetByteSink = exports.updateXAttrs = exports.vGetByteSource = exports.vReadJSON = exports.vReadTxt = exports.vReadBytes = exports.vListXAttrs = exports.vGetXAttr = exports.vStat = exports.readBytes = exports.fileMsgType = void 0;
|
|
19
|
+
exports.vsDiffCurrentAndRemoteVersions = exports.vListVersions = exports.vsUpload = exports.vsStartUpload = exports.vsStartDownload = exports.vGetByteSink = exports.updateXAttrs = exports.vGetByteSource = exports.vReadJSON = exports.vReadTxt = exports.vReadBytes = exports.vListXAttrs = exports.vGetXAttr = exports.vStat = exports.readBytes = exports.fileMsgType = void 0;
|
|
20
20
|
exports.makeFileCaller = makeFileCaller;
|
|
21
21
|
exports.exposeFileService = exposeFileService;
|
|
22
22
|
exports.packStats = packStats;
|
|
@@ -37,6 +37,10 @@ exports.optionsToUploadLocalToMsg = optionsToUploadLocalToMsg;
|
|
|
37
37
|
exports.optionsToUploadLocalFromMsg = optionsToUploadLocalFromMsg;
|
|
38
38
|
exports.remoteAdoptionOptsToMsg = remoteAdoptionOptsToMsg;
|
|
39
39
|
exports.remoteAdoptionOptsFromMsg = remoteAdoptionOptsFromMsg;
|
|
40
|
+
exports.commonDiffToMsg = commonDiffToMsg;
|
|
41
|
+
exports.commonDiffFromMsg = commonDiffFromMsg;
|
|
42
|
+
exports.fileDiffToMsg = fileDiffToMsg;
|
|
43
|
+
exports.fileDiffFromMsg = fileDiffFromMsg;
|
|
40
44
|
const protobuf_msg_1 = require("../ipc-via-protobuf/protobuf-msg");
|
|
41
45
|
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
42
46
|
const file_proto_1 = require("../protos/file.proto");
|
|
@@ -100,6 +104,7 @@ function makeFileCaller(caller, fileMsg) {
|
|
|
100
104
|
isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.makeCaller(caller, vsPath),
|
|
101
105
|
startDownload: vsStartDownload.makeCaller(caller, vsPath),
|
|
102
106
|
adoptRemote: vsAdoptRemote.makeCaller(caller, vsPath),
|
|
107
|
+
diffCurrentAndRemoteVersions: vsDiffCurrentAndRemoteVersions.makeCaller(caller, vsPath)
|
|
103
108
|
};
|
|
104
109
|
if (file.writable) {
|
|
105
110
|
file.v.sync.startUpload = vsStartUpload.makeCaller(caller, vsPath);
|
|
@@ -155,6 +160,7 @@ function exposeFileService(file, expServices) {
|
|
|
155
160
|
isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.wrapService(file.v.sync.isRemoteVersionOnDisk),
|
|
156
161
|
startDownload: vsStartDownload.wrapService(file.v.sync.startDownload),
|
|
157
162
|
adoptRemote: vsAdoptRemote.wrapService(file.v.sync.adoptRemote),
|
|
163
|
+
diffCurrentAndRemoteVersions: vsDiffCurrentAndRemoteVersions.wrapService(file.v.sync.diffCurrentAndRemoteVersions),
|
|
158
164
|
};
|
|
159
165
|
if (file.writable) {
|
|
160
166
|
implExp.v.sync.startedUpload = vsStartUpload.wrapService(file.v.sync.startUpload);
|
|
@@ -1320,4 +1326,117 @@ var vArchiveCurrent;
|
|
|
1320
1326
|
vArchiveCurrent.makeCaller = makeCaller;
|
|
1321
1327
|
})(vArchiveCurrent || (vArchiveCurrent = {}));
|
|
1322
1328
|
Object.freeze(vArchiveCurrent);
|
|
1329
|
+
function diffTStoMsg(diffTS) {
|
|
1330
|
+
return (diffTS ? {
|
|
1331
|
+
current: diffTS.current.valueOf(),
|
|
1332
|
+
remote: diffTS.remote.valueOf(),
|
|
1333
|
+
synced: diffTS.synced.valueOf(),
|
|
1334
|
+
} : undefined);
|
|
1335
|
+
}
|
|
1336
|
+
function diffTSfromMsg(msg) {
|
|
1337
|
+
return (msg ? {
|
|
1338
|
+
current: new Date((0, protobuf_msg_1.fixInt)(msg.current)),
|
|
1339
|
+
remote: new Date((0, protobuf_msg_1.fixInt)(msg.remote)),
|
|
1340
|
+
synced: new Date((0, protobuf_msg_1.fixInt)(msg.synced)),
|
|
1341
|
+
} : undefined);
|
|
1342
|
+
}
|
|
1343
|
+
function commonDiffToMsg(diff) {
|
|
1344
|
+
return {
|
|
1345
|
+
remoteVersion: (0, protobuf_msg_1.toOptVal)(diff.remoteVersion),
|
|
1346
|
+
currentVersion: diff.currentVersion,
|
|
1347
|
+
syncedVersion: (0, protobuf_msg_1.toOptVal)(diff.syncedVersion),
|
|
1348
|
+
isCurrentLocal: diff.isCurrentLocal,
|
|
1349
|
+
isRemoteRemoved: diff.isRemoteRemoved,
|
|
1350
|
+
ctime: diffTStoMsg((diff.ctime)),
|
|
1351
|
+
mtime: diffTStoMsg(diff.mtime),
|
|
1352
|
+
xattrs: (diff.xattrs ? Object.entries(diff.xattrs).map(([name, { addedIn, changedIn, removedIn }]) => ({
|
|
1353
|
+
name,
|
|
1354
|
+
addedIn: (0, protobuf_msg_1.toOptVal)(addedIn),
|
|
1355
|
+
changedIn: (0, protobuf_msg_1.toOptVal)(changedIn),
|
|
1356
|
+
removedIn: (0, protobuf_msg_1.toOptVal)(removedIn)
|
|
1357
|
+
})) : undefined)
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
function commonDiffFromMsg(msg) {
|
|
1361
|
+
let xattrs = undefined;
|
|
1362
|
+
if (msg.xattrs && (msg.xattrs.length > 0)) {
|
|
1363
|
+
xattrs = {};
|
|
1364
|
+
for (const { name, addedIn, changedIn, removedIn } of msg.xattrs) {
|
|
1365
|
+
xattrs[name] = {
|
|
1366
|
+
addedIn: (0, protobuf_msg_1.valOfOpt)(addedIn),
|
|
1367
|
+
changedIn: (0, protobuf_msg_1.valOfOpt)(changedIn),
|
|
1368
|
+
removedIn: (0, protobuf_msg_1.valOfOpt)(removedIn),
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
return {
|
|
1373
|
+
remoteVersion: (0, protobuf_msg_1.valOfOptInt)(msg.remoteVersion),
|
|
1374
|
+
currentVersion: (0, protobuf_msg_1.fixInt)(msg.currentVersion),
|
|
1375
|
+
syncedVersion: (0, protobuf_msg_1.valOfOptInt)(msg.syncedVersion),
|
|
1376
|
+
isCurrentLocal: msg.isCurrentLocal,
|
|
1377
|
+
isRemoteRemoved: msg.isRemoteRemoved,
|
|
1378
|
+
ctime: diffTSfromMsg(msg.ctime),
|
|
1379
|
+
mtime: diffTSfromMsg(msg.mtime),
|
|
1380
|
+
xattrs
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
function fileDiffToMsg(diff) {
|
|
1384
|
+
if (!diff) {
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
return {
|
|
1388
|
+
...commonDiffToMsg(diff),
|
|
1389
|
+
areContentsSame: diff.areContentsSame,
|
|
1390
|
+
size: diff.size
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function fileDiffFromMsg(msg) {
|
|
1394
|
+
if (!msg) {
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
return {
|
|
1398
|
+
...commonDiffFromMsg(msg),
|
|
1399
|
+
areContentsSame: msg.areContentsSame,
|
|
1400
|
+
size: (msg.size ? {
|
|
1401
|
+
current: (0, protobuf_msg_1.fixInt)(msg.size.current),
|
|
1402
|
+
remote: (0, protobuf_msg_1.fixInt)(msg.size.remote)
|
|
1403
|
+
} : undefined)
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
var vsDiffCurrentAndRemoteVersions;
|
|
1407
|
+
(function (vsDiffCurrentAndRemoteVersions) {
|
|
1408
|
+
function optsFromMsg(opts) {
|
|
1409
|
+
return (opts ? {
|
|
1410
|
+
remoteVersion: (0, protobuf_msg_1.valOfOptInt)(opts.remoteVersion),
|
|
1411
|
+
compareContentIfSameMTime: (0, protobuf_msg_1.valOfOpt)(opts.compareContentIfSameMTime)
|
|
1412
|
+
} : undefined);
|
|
1413
|
+
}
|
|
1414
|
+
vsDiffCurrentAndRemoteVersions.optsFromMsg = optsFromMsg;
|
|
1415
|
+
function optsToMsg(opts) {
|
|
1416
|
+
return (opts ? {
|
|
1417
|
+
remoteVersion: (0, protobuf_msg_1.toOptVal)(opts.remoteVersion),
|
|
1418
|
+
compareContentIfSameMTime: (0, protobuf_msg_1.toOptVal)(opts.compareContentIfSameMTime)
|
|
1419
|
+
} : undefined);
|
|
1420
|
+
}
|
|
1421
|
+
vsDiffCurrentAndRemoteVersions.optsToMsg = optsToMsg;
|
|
1422
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.DiffCurrentAndRemoteRequestBody);
|
|
1423
|
+
vsDiffCurrentAndRemoteVersions.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.DiffCurrentAndRemoteReplyBody);
|
|
1424
|
+
function wrapService(fn) {
|
|
1425
|
+
return buf => {
|
|
1426
|
+
const { opts } = requestType.unpack(buf);
|
|
1427
|
+
const promise = fn(optsFromMsg(opts))
|
|
1428
|
+
.then(diff => vsDiffCurrentAndRemoteVersions.replyType.pack({ diff: fileDiffToMsg(diff) }));
|
|
1429
|
+
return { promise };
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
vsDiffCurrentAndRemoteVersions.wrapService = wrapService;
|
|
1433
|
+
function makeCaller(caller, objPath) {
|
|
1434
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'diffCurrentAndRemoteVersions');
|
|
1435
|
+
return opts => caller
|
|
1436
|
+
.startPromiseCall(ipcPath, requestType.pack({ opts: optsToMsg(opts) }))
|
|
1437
|
+
.then(buf => fileDiffFromMsg(vsDiffCurrentAndRemoteVersions.replyType.unpack(buf).diff));
|
|
1438
|
+
}
|
|
1439
|
+
vsDiffCurrentAndRemoteVersions.makeCaller = makeCaller;
|
|
1440
|
+
})(vsDiffCurrentAndRemoteVersions || (exports.vsDiffCurrentAndRemoteVersions = vsDiffCurrentAndRemoteVersions = {}));
|
|
1441
|
+
Object.freeze(vsDiffCurrentAndRemoteVersions);
|
|
1323
1442
|
Object.freeze(exports);
|