core-3nweb-client-lib 0.43.16 → 0.43.17
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 +9 -0
- package/build/core/id-manager/index.js +1 -4
- package/build/core-ipc/fs.js +30 -0
- package/build/lib-client/fs-utils/files.js +2 -0
- package/build/lib-client/xsp-fs/folder-node.d.ts +1 -0
- package/build/lib-client/xsp-fs/folder-node.js +6 -0
- package/build/lib-client/xsp-fs/fs.d.ts +2 -0
- package/build/lib-client/xsp-fs/fs.js +16 -4
- package/package.json +1 -1
- package/protos/fs.proto +4 -0
|
@@ -1331,8 +1331,13 @@ declare namespace web3n.files {
|
|
|
1331
1331
|
*/
|
|
1332
1332
|
getRemoteFileItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFile>;
|
|
1333
1333
|
|
|
1334
|
+
getRemoteFolderItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFS>;
|
|
1335
|
+
|
|
1334
1336
|
}
|
|
1335
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
*
|
|
1340
|
+
*/
|
|
1336
1341
|
interface FolderDiff {
|
|
1337
1342
|
currentVersion: number;
|
|
1338
1343
|
isCurrentLocal: boolean;
|
|
@@ -1340,6 +1345,10 @@ declare namespace web3n.files {
|
|
|
1340
1345
|
isRemoteArchived: boolean;
|
|
1341
1346
|
inCurrent?: ListingEntry[];
|
|
1342
1347
|
inRemote?: ListingEntry[];
|
|
1348
|
+
|
|
1349
|
+
// XXX
|
|
1350
|
+
// differentNames?: ;
|
|
1351
|
+
|
|
1343
1352
|
nameOverlaps?: string[];
|
|
1344
1353
|
ctime: {
|
|
1345
1354
|
remote?: Date;
|
|
@@ -66,10 +66,7 @@ class IdManager {
|
|
|
66
66
|
}
|
|
67
67
|
return {
|
|
68
68
|
idManager,
|
|
69
|
-
setupManagerStorage: (fs, keys) => setupManagerStorage(fs, (keys ? {
|
|
70
|
-
address: idManager.address,
|
|
71
|
-
keys
|
|
72
|
-
} : undefined))
|
|
69
|
+
setupManagerStorage: (fs, keys) => setupManagerStorage(fs, (keys ? { address: idManager.address, keys } : undefined))
|
|
73
70
|
};
|
|
74
71
|
};
|
|
75
72
|
}
|
package/build/core-ipc/fs.js
CHANGED
|
@@ -111,6 +111,7 @@ function makeFSCaller(caller, fsMsg) {
|
|
|
111
111
|
statRemoteItem: vsStatRemoteItem.makeCaller(caller, vsPath),
|
|
112
112
|
listRemoteFolderItem: vsListRemoteFolderItem.makeCaller(caller, vsPath),
|
|
113
113
|
getRemoteFileItem: vsGetRemoteFileItem.makeCaller(caller, vsPath),
|
|
114
|
+
getRemoteFolderItem: vsGetRemoteFolderItem.makeCaller(caller, vsPath),
|
|
114
115
|
};
|
|
115
116
|
if (fs.writable) {
|
|
116
117
|
fs.v.sync.startUpload = vsStartUpload.makeCaller(caller, vsPath);
|
|
@@ -192,6 +193,7 @@ function exposeFSService(fs, expServices) {
|
|
|
192
193
|
statRemoteItem: vsStatRemoteItem.wrapService(fs.v.sync.statRemoteItem),
|
|
193
194
|
listRemoteFolderItem: vsListRemoteFolderItem.wrapService(fs.v.sync.listRemoteFolderItem),
|
|
194
195
|
getRemoteFileItem: vsGetRemoteFileItem.wrapService(fs.v.sync.getRemoteFileItem, expServices),
|
|
196
|
+
getRemoteFolderItem: vsGetRemoteFolderItem.wrapService(fs.v.sync.getRemoteFolderItem, expServices),
|
|
195
197
|
diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.wrapService(fs.v.sync.diffCurrentAndRemoteFolderVersions)
|
|
196
198
|
};
|
|
197
199
|
if (fs.writable) {
|
|
@@ -2068,6 +2070,34 @@ var vsGetRemoteFileItem;
|
|
|
2068
2070
|
vsGetRemoteFileItem.makeCaller = makeCaller;
|
|
2069
2071
|
})(vsGetRemoteFileItem || (vsGetRemoteFileItem = {}));
|
|
2070
2072
|
Object.freeze(vsGetRemoteFileItem);
|
|
2073
|
+
var vsGetRemoteFolderItem;
|
|
2074
|
+
(function (vsGetRemoteFolderItem) {
|
|
2075
|
+
function wrapService(fn, expServices) {
|
|
2076
|
+
return buf => {
|
|
2077
|
+
const { path, remoteItemName, remoteVersion } = remoteChildReqType.unpack(buf);
|
|
2078
|
+
const promise = fn(path, remoteItemName, (0, protobuf_msg_1.valOfOptInt)(remoteVersion))
|
|
2079
|
+
.then(fs => {
|
|
2080
|
+
const fsMsg = exposeFSService(fs, expServices);
|
|
2081
|
+
return exports.fsMsgType.pack(fsMsg);
|
|
2082
|
+
});
|
|
2083
|
+
return { promise };
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
vsGetRemoteFolderItem.wrapService = wrapService;
|
|
2087
|
+
function makeCaller(caller, objPath) {
|
|
2088
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'getRemoteFolderItem');
|
|
2089
|
+
return (path, remoteItemName, remoteVersion) => caller
|
|
2090
|
+
.startPromiseCall(ipcPath, remoteChildReqType.pack({
|
|
2091
|
+
path, remoteItemName, remoteVersion: (0, protobuf_msg_1.toOptVal)(remoteVersion)
|
|
2092
|
+
}))
|
|
2093
|
+
.then(buf => {
|
|
2094
|
+
const fsMsg = exports.fsMsgType.unpack(buf);
|
|
2095
|
+
return makeFSCaller(caller, fsMsg);
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
vsGetRemoteFolderItem.makeCaller = makeCaller;
|
|
2099
|
+
})(vsGetRemoteFolderItem || (vsGetRemoteFolderItem = {}));
|
|
2100
|
+
Object.freeze(vsGetRemoteFolderItem);
|
|
2071
2101
|
var vListVersions;
|
|
2072
2102
|
(function (vListVersions) {
|
|
2073
2103
|
function wrapService(fn) {
|
|
@@ -244,6 +244,7 @@ function wrapWritableFSSyncAPI(sImpl) {
|
|
|
244
244
|
statRemoteItem: sImpl.statRemoteItem.bind(sImpl),
|
|
245
245
|
listRemoteFolderItem: sImpl.listRemoteFolderItem.bind(sImpl),
|
|
246
246
|
getRemoteFileItem: sImpl.getRemoteFileItem.bind(sImpl),
|
|
247
|
+
getRemoteFolderItem: sImpl.getRemoteFolderItem.bind(sImpl),
|
|
247
248
|
};
|
|
248
249
|
return Object.freeze(w);
|
|
249
250
|
}
|
|
@@ -305,6 +306,7 @@ function wrapReadonlyFSSyncAPI(sImpl) {
|
|
|
305
306
|
statRemoteItem: sImpl.statRemoteItem.bind(sImpl),
|
|
306
307
|
listRemoteFolderItem: sImpl.listRemoteFolderItem.bind(sImpl),
|
|
307
308
|
getRemoteFileItem: sImpl.getRemoteFileItem.bind(sImpl),
|
|
309
|
+
getRemoteFolderItem: sImpl.getRemoteFolderItem.bind(sImpl),
|
|
308
310
|
diffCurrentAndRemoteFolderVersions: sImpl.diffCurrentAndRemoteFolderVersions.bind(sImpl),
|
|
309
311
|
};
|
|
310
312
|
return Object.freeze(w);
|
|
@@ -165,5 +165,6 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
165
165
|
private diffWithArchivedRemote;
|
|
166
166
|
private diffWithRemote;
|
|
167
167
|
getRemoteItemNode<T extends NodeInFS<any>>(remoteItemName: string, remoteVersion: number | undefined): Promise<T>;
|
|
168
|
+
getStorage(): Storage;
|
|
168
169
|
}
|
|
169
170
|
export {};
|
|
@@ -334,6 +334,9 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
334
334
|
if (exc.objNotFound && fromCurrentNodes) {
|
|
335
335
|
await this.fixMissingChildAndThrow(exc, info);
|
|
336
336
|
}
|
|
337
|
+
else if (exc.failedCipherVerification) {
|
|
338
|
+
exc = (0, file_1.makeFileException)('ioError', `${this.name}/${info.name}`, exc);
|
|
339
|
+
}
|
|
337
340
|
deferred.reject((0, error_1.errWithCause)(exc, `Failed to instantiate fs node '${this.name}/${info.name}'`));
|
|
338
341
|
return nodeSet;
|
|
339
342
|
}
|
|
@@ -1076,6 +1079,9 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
1076
1079
|
const remoteChildNodeInfo = await this.getRemoteChildNodeInfo(remoteItemName, remoteVersion);
|
|
1077
1080
|
return await this.getOrMakeChildNodeForInfo(remoteChildNodeInfo, false);
|
|
1078
1081
|
}
|
|
1082
|
+
getStorage() {
|
|
1083
|
+
return this.storage;
|
|
1084
|
+
}
|
|
1079
1085
|
}
|
|
1080
1086
|
exports.FolderNode = FolderNode;
|
|
1081
1087
|
Object.freeze(FolderNode.prototype);
|
|
@@ -56,6 +56,7 @@ export declare class XspFS implements WritableFS {
|
|
|
56
56
|
*/
|
|
57
57
|
static fromExistingRoot(storage: Storage, key: Uint8Array): Promise<WritableFS>;
|
|
58
58
|
static fromASMailMsgRootFromJSON(storage: Storage, folderJson: FolderInJSON, rootName?: string): ReadonlyFS;
|
|
59
|
+
static fromFolderNode(folderNode: FolderNode): ReadonlyFS;
|
|
59
60
|
/**
|
|
60
61
|
* Note that this method doesn't close storage.
|
|
61
62
|
*/
|
|
@@ -180,5 +181,6 @@ declare class S implements WritableFSSyncAPI {
|
|
|
180
181
|
statRemoteItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<Stats>;
|
|
181
182
|
listRemoteFolderItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ListingEntry[]>;
|
|
182
183
|
getRemoteFileItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFile>;
|
|
184
|
+
getRemoteFolderItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFS>;
|
|
183
185
|
}
|
|
184
186
|
export {};
|
|
@@ -77,8 +77,7 @@ class XspFS {
|
|
|
77
77
|
const pathParts = splitPathIntoParts(path);
|
|
78
78
|
const root = this.v.getRootIfNotClosed(path);
|
|
79
79
|
const folder = await root.getFolderInThisSubTree(pathParts, false).catch(setExcPath(path));
|
|
80
|
-
const folderName = ((pathParts.length === 0) ?
|
|
81
|
-
this.name : pathParts[pathParts.length - 1]);
|
|
80
|
+
const folderName = ((pathParts.length === 0) ? this.name : pathParts[pathParts.length - 1]);
|
|
82
81
|
const fs = new XspFS(this.storage(), false, folder, folderName);
|
|
83
82
|
return (0, files_1.wrapReadonlyFS)(fs);
|
|
84
83
|
}
|
|
@@ -86,8 +85,7 @@ class XspFS {
|
|
|
86
85
|
const pathParts = splitPathIntoParts(path);
|
|
87
86
|
const root = this.v.getRootIfNotClosed(path);
|
|
88
87
|
const folder = await root.getFolderInThisSubTree(pathParts, flags.create, flags.exclusive).catch(setExcPath(path));
|
|
89
|
-
const folderName = ((pathParts.length === 0) ?
|
|
90
|
-
this.name : pathParts[pathParts.length - 1]);
|
|
88
|
+
const folderName = ((pathParts.length === 0) ? this.name : pathParts[pathParts.length - 1]);
|
|
91
89
|
const fs = new XspFS(this.storage(), true, folder, folderName);
|
|
92
90
|
return (0, files_1.wrapWritableFS)(fs);
|
|
93
91
|
}
|
|
@@ -119,6 +117,10 @@ class XspFS {
|
|
|
119
117
|
const fs = new XspFS(storage, false, root, rootName);
|
|
120
118
|
return (0, files_1.wrapIntoVersionlessReadonlyFS)(fs);
|
|
121
119
|
}
|
|
120
|
+
static fromFolderNode(folderNode) {
|
|
121
|
+
const fs = new XspFS(folderNode.getStorage(), false, folderNode, folderNode.name);
|
|
122
|
+
return (0, files_1.wrapIntoVersionlessReadonlyFS)(fs);
|
|
123
|
+
}
|
|
122
124
|
/**
|
|
123
125
|
* Note that this method doesn't close storage.
|
|
124
126
|
*/
|
|
@@ -835,6 +837,16 @@ class S {
|
|
|
835
837
|
throw (0, file_1.makeFileException)('notFile', `${path}/${remoteItemName}`);
|
|
836
838
|
}
|
|
837
839
|
}
|
|
840
|
+
async getRemoteFolderItem(path, remoteItemName, remoteVersion) {
|
|
841
|
+
const folderNode = await this.getFolderNode(path);
|
|
842
|
+
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
843
|
+
if (remoteChild.type === 'folder') {
|
|
844
|
+
return XspFS.fromFolderNode(remoteChild);
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
throw (0, file_1.makeFileException)('notDirectory', `${path}/${remoteItemName}`);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
838
850
|
}
|
|
839
851
|
Object.freeze(S.prototype);
|
|
840
852
|
Object.freeze(S);
|
package/package.json
CHANGED
package/protos/fs.proto
CHANGED
|
@@ -530,6 +530,10 @@ message RemoteChildRequestBody {
|
|
|
530
530
|
// Request body is RemoteChildRequestBody
|
|
531
531
|
// Reply body is file.File
|
|
532
532
|
|
|
533
|
+
// --- ReadonlyFSSyncAPI.getRemoteFolderItem ---
|
|
534
|
+
// Request body is RemoteChildRequestBody
|
|
535
|
+
// Reply body is FS
|
|
536
|
+
|
|
533
537
|
|
|
534
538
|
// ==== WritableFSSyncAPI referable object ====
|
|
535
539
|
|