core-3nweb-client-lib 0.43.13 → 0.43.14
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 +21 -3
- package/build/core-ipc/fs.js +92 -4
- package/build/lib-client/fs-utils/files.js +6 -0
- package/build/lib-client/xsp-fs/folder-node.d.ts +3 -1
- package/build/lib-client/xsp-fs/folder-node.js +47 -37
- package/build/lib-client/xsp-fs/fs.d.ts +3 -0
- package/build/lib-client/xsp-fs/fs.js +26 -1
- package/build/protos/asmail.proto.js +257 -0
- package/build/protos/fs.proto.js +257 -0
- package/package.json +1 -1
- package/protos/fs.proto +18 -0
|
@@ -1311,11 +1311,29 @@ declare namespace web3n.files {
|
|
|
1311
1311
|
// XXX (Christmas methods)
|
|
1312
1312
|
// add following methods to read remote item, facilitating decisions in conflict situations.
|
|
1313
1313
|
|
|
1314
|
-
|
|
1314
|
+
/**
|
|
1315
|
+
* Returns stats of a child from remote version of a folder.
|
|
1316
|
+
* @param path of folder
|
|
1317
|
+
* @param remoteItemName
|
|
1318
|
+
* @param remoteVersion of folder. Default is current remote.
|
|
1319
|
+
*/
|
|
1320
|
+
statRemoteItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<Stats>;
|
|
1315
1321
|
|
|
1316
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* Lists child folder from remote version of a folder.
|
|
1324
|
+
* @param path of folder
|
|
1325
|
+
* @param remoteItemName
|
|
1326
|
+
* @param remoteVersion of folder. Default is current remote.
|
|
1327
|
+
*/
|
|
1328
|
+
listRemoteFolderItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ListingEntry[]>;
|
|
1317
1329
|
|
|
1318
|
-
|
|
1330
|
+
/**
|
|
1331
|
+
* Returns child file from remote version of a folder.
|
|
1332
|
+
* @param path of folder
|
|
1333
|
+
* @param remoteItemName
|
|
1334
|
+
* @param remoteVersion of folder. Default is current remote.
|
|
1335
|
+
*/
|
|
1336
|
+
getRemoteFileItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFile>;
|
|
1319
1337
|
|
|
1320
1338
|
}
|
|
1321
1339
|
|
package/build/core-ipc/fs.js
CHANGED
|
@@ -107,7 +107,10 @@ function makeFSCaller(caller, fsMsg) {
|
|
|
107
107
|
isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.makeCaller(caller, vsPath),
|
|
108
108
|
startDownload: vsDownload.makeCaller(caller, vsPath),
|
|
109
109
|
adoptRemote: vsAdoptRemote.makeCaller(caller, vsPath),
|
|
110
|
-
diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.makeCaller(caller, vsPath)
|
|
110
|
+
diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.makeCaller(caller, vsPath),
|
|
111
|
+
statRemoteItem: vsStatRemoteItem.makeCaller(caller, vsPath),
|
|
112
|
+
listRemoteFolderItem: vsListRemoteFolderItem.makeCaller(caller, vsPath),
|
|
113
|
+
getRemoteFileItem: vsGetRemoteFileItem.makeCaller(caller, vsPath),
|
|
111
114
|
};
|
|
112
115
|
if (fs.writable) {
|
|
113
116
|
fs.v.sync.startUpload = vsStartUpload.makeCaller(caller, vsPath);
|
|
@@ -186,6 +189,9 @@ function exposeFSService(fs, expServices) {
|
|
|
186
189
|
isRemoteVersionOnDisk: vsIsRemoteVersionOnDisk.wrapService(fs.v.sync.isRemoteVersionOnDisk),
|
|
187
190
|
startDownload: vsDownload.wrapService(fs.v.sync.startDownload),
|
|
188
191
|
adoptRemote: vsAdoptRemote.wrapService(fs.v.sync.adoptRemote),
|
|
192
|
+
statRemoteItem: vsStatRemoteItem.wrapService(fs.v.sync.statRemoteItem),
|
|
193
|
+
listRemoteFolderItem: vsListRemoteFolderItem.wrapService(fs.v.sync.listRemoteFolderItem),
|
|
194
|
+
getRemoteFileItem: vsGetRemoteFileItem.wrapService(fs.v.sync.getRemoteFileItem, expServices),
|
|
189
195
|
diffCurrentAndRemoteFolderVersions: vsDiffCurrentAndRemoteFolderVersions.wrapService(fs.v.sync.diffCurrentAndRemoteFolderVersions)
|
|
190
196
|
};
|
|
191
197
|
if (fs.writable) {
|
|
@@ -515,12 +521,20 @@ var readonlySubRoot;
|
|
|
515
521
|
Object.freeze(readonlySubRoot);
|
|
516
522
|
var listFolder;
|
|
517
523
|
(function (listFolder) {
|
|
518
|
-
const
|
|
524
|
+
const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.ListFolderReplyBody);
|
|
525
|
+
function packFolderListing(lst) {
|
|
526
|
+
return replyType.pack({ entries: lst.map(lsEntryToMsg) });
|
|
527
|
+
}
|
|
528
|
+
listFolder.packFolderListing = packFolderListing;
|
|
529
|
+
function unpackFolderListing(buf) {
|
|
530
|
+
return (0, protobuf_msg_1.fixArray)(replyType.unpack(buf).entries).map(lsEntryFromMsg);
|
|
531
|
+
}
|
|
532
|
+
listFolder.unpackFolderListing = unpackFolderListing;
|
|
519
533
|
function wrapService(fn) {
|
|
520
534
|
return buf => {
|
|
521
535
|
const { path } = reqWithPathType.unpack(buf);
|
|
522
536
|
const promise = fn(path)
|
|
523
|
-
.then(
|
|
537
|
+
.then(packFolderListing);
|
|
524
538
|
return { promise };
|
|
525
539
|
};
|
|
526
540
|
}
|
|
@@ -529,7 +543,7 @@ var listFolder;
|
|
|
529
543
|
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'listFolder');
|
|
530
544
|
return path => caller
|
|
531
545
|
.startPromiseCall(ipcPath, reqWithPathType.pack({ path }))
|
|
532
|
-
.then(
|
|
546
|
+
.then(unpackFolderListing);
|
|
533
547
|
}
|
|
534
548
|
listFolder.makeCaller = makeCaller;
|
|
535
549
|
})(listFolder || (listFolder = {}));
|
|
@@ -1980,6 +1994,80 @@ var vsAdoptRemote;
|
|
|
1980
1994
|
vsAdoptRemote.makeCaller = makeCaller;
|
|
1981
1995
|
})(vsAdoptRemote || (vsAdoptRemote = {}));
|
|
1982
1996
|
Object.freeze(vsAdoptRemote);
|
|
1997
|
+
const remoteChildReqType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.RemoteChildRequestBody);
|
|
1998
|
+
;
|
|
1999
|
+
var vsStatRemoteItem;
|
|
2000
|
+
(function (vsStatRemoteItem) {
|
|
2001
|
+
function wrapService(fn) {
|
|
2002
|
+
return buf => {
|
|
2003
|
+
const { path, remoteItemName, remoteVersion } = remoteChildReqType.unpack(buf);
|
|
2004
|
+
const promise = fn(path, remoteItemName, (0, protobuf_msg_1.valOfOpt)(remoteVersion))
|
|
2005
|
+
.then(file.packStats);
|
|
2006
|
+
return { promise };
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
vsStatRemoteItem.wrapService = wrapService;
|
|
2010
|
+
function makeCaller(caller, objPath) {
|
|
2011
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'statRemoteItem');
|
|
2012
|
+
return (path, remoteItemName, remoteVersion) => caller
|
|
2013
|
+
.startPromiseCall(ipcPath, remoteChildReqType.pack({
|
|
2014
|
+
path, remoteItemName, remoteVersion: (0, protobuf_msg_1.toOptVal)(remoteVersion)
|
|
2015
|
+
}))
|
|
2016
|
+
.then(file.unpackStats);
|
|
2017
|
+
}
|
|
2018
|
+
vsStatRemoteItem.makeCaller = makeCaller;
|
|
2019
|
+
})(vsStatRemoteItem || (vsStatRemoteItem = {}));
|
|
2020
|
+
Object.freeze(vsStatRemoteItem);
|
|
2021
|
+
var vsListRemoteFolderItem;
|
|
2022
|
+
(function (vsListRemoteFolderItem) {
|
|
2023
|
+
function wrapService(fn) {
|
|
2024
|
+
return buf => {
|
|
2025
|
+
const { path, remoteItemName, remoteVersion } = remoteChildReqType.unpack(buf);
|
|
2026
|
+
const promise = fn(path, remoteItemName, (0, protobuf_msg_1.valOfOpt)(remoteVersion))
|
|
2027
|
+
.then(listFolder.packFolderListing);
|
|
2028
|
+
return { promise };
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
vsListRemoteFolderItem.wrapService = wrapService;
|
|
2032
|
+
function makeCaller(caller, objPath) {
|
|
2033
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'listRemoteFolderItem');
|
|
2034
|
+
return (path, remoteItemName, remoteVersion) => caller
|
|
2035
|
+
.startPromiseCall(ipcPath, remoteChildReqType.pack({
|
|
2036
|
+
path, remoteItemName, remoteVersion: (0, protobuf_msg_1.toOptVal)(remoteVersion)
|
|
2037
|
+
}))
|
|
2038
|
+
.then(listFolder.unpackFolderListing);
|
|
2039
|
+
}
|
|
2040
|
+
vsListRemoteFolderItem.makeCaller = makeCaller;
|
|
2041
|
+
})(vsListRemoteFolderItem || (vsListRemoteFolderItem = {}));
|
|
2042
|
+
Object.freeze(vsListRemoteFolderItem);
|
|
2043
|
+
var vsGetRemoteFileItem;
|
|
2044
|
+
(function (vsGetRemoteFileItem) {
|
|
2045
|
+
function wrapService(fn, expServices) {
|
|
2046
|
+
return buf => {
|
|
2047
|
+
const { path, remoteItemName, remoteVersion } = remoteChildReqType.unpack(buf);
|
|
2048
|
+
const promise = fn(path, remoteItemName, (0, protobuf_msg_1.valOfOpt)(remoteVersion))
|
|
2049
|
+
.then(file => {
|
|
2050
|
+
const fileMsg = (0, file_1.exposeFileService)(file, expServices);
|
|
2051
|
+
return file_1.fileMsgType.pack(fileMsg);
|
|
2052
|
+
});
|
|
2053
|
+
return { promise };
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
vsGetRemoteFileItem.wrapService = wrapService;
|
|
2057
|
+
function makeCaller(caller, objPath) {
|
|
2058
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'getRemoteFileItem');
|
|
2059
|
+
return (path, remoteItemName, remoteVersion) => caller
|
|
2060
|
+
.startPromiseCall(ipcPath, remoteChildReqType.pack({
|
|
2061
|
+
path, remoteItemName, remoteVersion: (0, protobuf_msg_1.toOptVal)(remoteVersion)
|
|
2062
|
+
}))
|
|
2063
|
+
.then(buf => {
|
|
2064
|
+
const fileMsg = file_1.fileMsgType.unpack(buf);
|
|
2065
|
+
return (0, file_1.makeFileCaller)(caller, fileMsg);
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
vsGetRemoteFileItem.makeCaller = makeCaller;
|
|
2069
|
+
})(vsGetRemoteFileItem || (vsGetRemoteFileItem = {}));
|
|
2070
|
+
Object.freeze(vsGetRemoteFileItem);
|
|
1983
2071
|
var vListVersions;
|
|
1984
2072
|
(function (vListVersions) {
|
|
1985
2073
|
function wrapService(fn) {
|
|
@@ -241,6 +241,9 @@ function wrapWritableFSSyncAPI(sImpl) {
|
|
|
241
241
|
startUpload: sImpl.startUpload.bind(sImpl),
|
|
242
242
|
upload: sImpl.upload.bind(sImpl),
|
|
243
243
|
adoptRemoteFolderItem: sImpl.adoptRemoteFolderItem.bind(sImpl),
|
|
244
|
+
statRemoteItem: sImpl.statRemoteItem.bind(sImpl),
|
|
245
|
+
listRemoteFolderItem: sImpl.listRemoteFolderItem.bind(sImpl),
|
|
246
|
+
getRemoteFileItem: sImpl.getRemoteFileItem.bind(sImpl),
|
|
244
247
|
};
|
|
245
248
|
return Object.freeze(w);
|
|
246
249
|
}
|
|
@@ -299,6 +302,9 @@ function wrapReadonlyFSSyncAPI(sImpl) {
|
|
|
299
302
|
startDownload: sImpl.startDownload.bind(sImpl),
|
|
300
303
|
isRemoteVersionOnDisk: sImpl.isRemoteVersionOnDisk.bind(sImpl),
|
|
301
304
|
adoptRemote: sImpl.adoptRemote.bind(sImpl),
|
|
305
|
+
statRemoteItem: sImpl.statRemoteItem.bind(sImpl),
|
|
306
|
+
listRemoteFolderItem: sImpl.listRemoteFolderItem.bind(sImpl),
|
|
307
|
+
getRemoteFileItem: sImpl.getRemoteFileItem.bind(sImpl),
|
|
302
308
|
diffCurrentAndRemoteFolderVersions: sImpl.diffCurrentAndRemoteFolderVersions.bind(sImpl),
|
|
303
309
|
};
|
|
304
310
|
return Object.freeze(w);
|
|
@@ -88,7 +88,7 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
88
88
|
version: number;
|
|
89
89
|
}>;
|
|
90
90
|
childExistsInSyncedVersion(childObjId: string): Promise<boolean>;
|
|
91
|
-
|
|
91
|
+
getCurrentNodeInfo(name: string, undefOnMissing?: boolean): NodeInfo | undefined;
|
|
92
92
|
hasChild(childName: string, throwIfMissing?: boolean): boolean;
|
|
93
93
|
getNode<T extends NodeInFS<any>>(type: NodeType | undefined, name: string, undefOnMissing?: boolean): Promise<T | undefined>;
|
|
94
94
|
private getOrMakeChildNodeForInfo;
|
|
@@ -158,10 +158,12 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
158
158
|
} | undefined>;
|
|
159
159
|
private getNodesRemovedBetweenVersions;
|
|
160
160
|
adoptRemoteFolderItem(remoteItemName: string, opts: OptionsToAdoptRemoteItem | undefined): Promise<number>;
|
|
161
|
+
private getRemoteChildNodeInfo;
|
|
161
162
|
private addRemoteChild;
|
|
162
163
|
private replaceLocalChildWithRemote;
|
|
163
164
|
diffCurrentAndRemote(remoteVersion: number | undefined): Promise<FolderDiff | undefined>;
|
|
164
165
|
private diffWithArchivedRemote;
|
|
165
166
|
private diffWithRemote;
|
|
167
|
+
getRemoteItemNode<T extends NodeInFS<any>>(remoteItemName: string, remoteVersion: number | undefined): Promise<T>;
|
|
166
168
|
}
|
|
167
169
|
export {};
|
|
@@ -269,7 +269,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
269
269
|
return false;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
getCurrentNodeInfo(name, undefOnMissing = false) {
|
|
273
273
|
const fj = this.currentState.nodes[name];
|
|
274
274
|
if (fj) {
|
|
275
275
|
return fj;
|
|
@@ -282,10 +282,10 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
hasChild(childName, throwIfMissing = false) {
|
|
285
|
-
return !!this.
|
|
285
|
+
return !!this.getCurrentNodeInfo(childName, !throwIfMissing);
|
|
286
286
|
}
|
|
287
287
|
async getNode(type, name, undefOnMissing = false) {
|
|
288
|
-
const childInfo = this.
|
|
288
|
+
const childInfo = this.getCurrentNodeInfo(name, undefOnMissing);
|
|
289
289
|
if (!childInfo) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
@@ -302,7 +302,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
302
302
|
}
|
|
303
303
|
return this.getOrMakeChildNodeForInfo(childInfo);
|
|
304
304
|
}
|
|
305
|
-
async getOrMakeChildNodeForInfo(info) {
|
|
305
|
+
async getOrMakeChildNodeForInfo(info, fromCurrentNodes = true) {
|
|
306
306
|
const { node, nodePromise } = this.storage.nodes.getNodeOrPromise(info.objId);
|
|
307
307
|
if (node) {
|
|
308
308
|
return node;
|
|
@@ -331,7 +331,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
331
331
|
return nodeSet;
|
|
332
332
|
}
|
|
333
333
|
catch (exc) {
|
|
334
|
-
if (exc.objNotFound) {
|
|
334
|
+
if (exc.objNotFound && fromCurrentNodes) {
|
|
335
335
|
await this.fixMissingChildAndThrow(exc, info);
|
|
336
336
|
}
|
|
337
337
|
deferred.reject((0, error_1.errWithCause)(exc, `Failed to instantiate fs node '${this.name}/${info.name}'`));
|
|
@@ -471,7 +471,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
471
471
|
}
|
|
472
472
|
return this.doChange(true, async () => {
|
|
473
473
|
// do check for concurrent creation of a node
|
|
474
|
-
if (this.
|
|
474
|
+
if (this.getCurrentNodeInfo(name, true)) {
|
|
475
475
|
if (exclusive) {
|
|
476
476
|
throw (0, file_1.makeFileException)('alreadyExists', name);
|
|
477
477
|
}
|
|
@@ -578,7 +578,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
578
578
|
await this.changeChildName(childName, nameInDst);
|
|
579
579
|
}
|
|
580
580
|
else {
|
|
581
|
-
const childJSON = this.
|
|
581
|
+
const childJSON = this.getCurrentNodeInfo(childName);
|
|
582
582
|
// we have two transitions here, in this and in dst.
|
|
583
583
|
const moveLabel = getMoveLabel();
|
|
584
584
|
await dst.moveChildIn(nameInDst, childJSON, moveLabel);
|
|
@@ -899,6 +899,34 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
899
899
|
});
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
|
+
const remoteChildNode = await this.getRemoteChildNodeInfo(remoteItemName, opts === null || opts === void 0 ? void 0 : opts.remoteVersion);
|
|
903
|
+
let dstItemName = remoteItemName;
|
|
904
|
+
if (typeof (opts === null || opts === void 0 ? void 0 : opts.newItemName) === 'string') {
|
|
905
|
+
const newItemName = opts.newItemName.trim();
|
|
906
|
+
if (newItemName.length > 0) {
|
|
907
|
+
dstItemName = newItemName;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const localNodeWithSameName = this.getCurrentNodeInfo(dstItemName, true);
|
|
911
|
+
if (!localNodeWithSameName) {
|
|
912
|
+
return await this.addRemoteChild(remoteChildNode, dstItemName);
|
|
913
|
+
}
|
|
914
|
+
else if (localNodeWithSameName.objId === remoteChildNode.objId) {
|
|
915
|
+
(0, assert_1.assert)(typeOfNode(localNodeWithSameName) === typeOfNode(remoteChildNode));
|
|
916
|
+
// XXX
|
|
917
|
+
throw new Error(`Adaptation of changing keys needs implementation`);
|
|
918
|
+
}
|
|
919
|
+
else if (opts === null || opts === void 0 ? void 0 : opts.replaceLocalItem) {
|
|
920
|
+
return await this.replaceLocalChildWithRemote(remoteChildNode);
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
throw (0, exceptions_1.makeFSSyncException)(this.name, {
|
|
924
|
+
overlapsLocalItem: true,
|
|
925
|
+
message: `Local item exists under name '${dstItemName}' and option flag is not forcing replacement`
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
async getRemoteChildNodeInfo(remoteChildName, remoteVersion) {
|
|
902
930
|
const { remote } = await this.syncStatus();
|
|
903
931
|
if (!remote) {
|
|
904
932
|
throw (0, exceptions_1.makeFSSyncException)(this.name, {
|
|
@@ -906,11 +934,11 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
906
934
|
message: `No remote versions`
|
|
907
935
|
});
|
|
908
936
|
}
|
|
909
|
-
if (
|
|
910
|
-
if (
|
|
937
|
+
if (remoteVersion) {
|
|
938
|
+
if (remoteVersion !== remote.latest) {
|
|
911
939
|
throw (0, exceptions_1.makeFSSyncException)(this.name, {
|
|
912
940
|
versionMismatch: true,
|
|
913
|
-
message: `Unknown remote version ${
|
|
941
|
+
message: `Unknown remote version ${remoteVersion}`
|
|
914
942
|
});
|
|
915
943
|
}
|
|
916
944
|
}
|
|
@@ -922,36 +950,14 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
922
950
|
const storage = this.syncedStorage();
|
|
923
951
|
const srcOfRemote = await storage.getObjSrcOfRemoteVersion(this.objId, remote.latest);
|
|
924
952
|
const { folderInfo: { nodes: remoteNodes } } = await this.crypto.read(srcOfRemote);
|
|
925
|
-
const remoteChildNode = remoteNodes[
|
|
926
|
-
if (
|
|
927
|
-
|
|
928
|
-
remoteFolderItemNotFound: true,
|
|
929
|
-
message: `Item '${remoteItemName}' is not found in remote version`
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
let dstItemName = remoteItemName;
|
|
933
|
-
if (typeof (opts === null || opts === void 0 ? void 0 : opts.newItemName) === 'string') {
|
|
934
|
-
const newItemName = opts.newItemName.trim();
|
|
935
|
-
if (newItemName.length > 0) {
|
|
936
|
-
dstItemName = newItemName;
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
const localNodeWithSameName = this.getNodeInfo(dstItemName, true);
|
|
940
|
-
if (!localNodeWithSameName) {
|
|
941
|
-
return await this.addRemoteChild(remoteChildNode, dstItemName);
|
|
942
|
-
}
|
|
943
|
-
else if (localNodeWithSameName.objId === remoteChildNode.objId) {
|
|
944
|
-
(0, assert_1.assert)(typeOfNode(localNodeWithSameName) === typeOfNode(remoteChildNode));
|
|
945
|
-
// XXX
|
|
946
|
-
throw new Error(`Adaptation of changing keys needs implementation`);
|
|
947
|
-
}
|
|
948
|
-
else if (opts === null || opts === void 0 ? void 0 : opts.replaceLocalItem) {
|
|
949
|
-
return await this.replaceLocalChildWithRemote(remoteChildNode);
|
|
953
|
+
const remoteChildNode = remoteNodes[remoteChildName];
|
|
954
|
+
if (remoteChildNode) {
|
|
955
|
+
return remoteChildNode;
|
|
950
956
|
}
|
|
951
957
|
else {
|
|
952
958
|
throw (0, exceptions_1.makeFSSyncException)(this.name, {
|
|
953
|
-
|
|
954
|
-
message: `
|
|
959
|
+
remoteFolderItemNotFound: true,
|
|
960
|
+
message: `Item '${remoteChildName}' is not found in remote version`
|
|
955
961
|
});
|
|
956
962
|
}
|
|
957
963
|
}
|
|
@@ -1066,6 +1072,10 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
1066
1072
|
xattrs: diffXAttrs(this.xattrs, xattrs)
|
|
1067
1073
|
};
|
|
1068
1074
|
}
|
|
1075
|
+
async getRemoteItemNode(remoteItemName, remoteVersion) {
|
|
1076
|
+
const remoteChildNodeInfo = await this.getRemoteChildNodeInfo(remoteItemName, remoteVersion);
|
|
1077
|
+
return await this.getOrMakeChildNodeForInfo(remoteChildNodeInfo, false);
|
|
1078
|
+
}
|
|
1069
1079
|
}
|
|
1070
1080
|
exports.FolderNode = FolderNode;
|
|
1071
1081
|
Object.freeze(FolderNode.prototype);
|
|
@@ -177,5 +177,8 @@ declare class S implements WritableFSSyncAPI {
|
|
|
177
177
|
private getFolderNode;
|
|
178
178
|
diffCurrentAndRemoteFolderVersions(path: string, remoteVersion?: number): Promise<FolderDiff | undefined>;
|
|
179
179
|
adoptRemoteFolderItem(path: string, itemName: string, opts?: OptionsToAdoptRemoteItem): Promise<number>;
|
|
180
|
+
statRemoteItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<Stats>;
|
|
181
|
+
listRemoteFolderItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ListingEntry[]>;
|
|
182
|
+
getRemoteFileItem(path: string, remoteItemName: string, remoteVersion?: number): Promise<ReadonlyFile>;
|
|
180
183
|
}
|
|
181
184
|
export {};
|
|
@@ -682,7 +682,7 @@ async function recursiveIdAndPathList(folder, path, maxDepth, depth = 0) {
|
|
|
682
682
|
for (const item of lst) {
|
|
683
683
|
const childPath = `${path}/${item.name}`;
|
|
684
684
|
if (item.isFile || item.isLink) {
|
|
685
|
-
const { objId } = folder.
|
|
685
|
+
const { objId } = folder.getCurrentNodeInfo(item.name);
|
|
686
686
|
idAndPaths.push([objId, childPath, depth + 1]);
|
|
687
687
|
}
|
|
688
688
|
else if (item.isFolder) {
|
|
@@ -810,6 +810,31 @@ class S {
|
|
|
810
810
|
throw (0, common_1.setPathInExc)(exc, path);
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
+
async statRemoteItem(path, remoteItemName, remoteVersion) {
|
|
814
|
+
const folderNode = await this.getFolderNode(path);
|
|
815
|
+
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
816
|
+
return await remoteChild.getStats();
|
|
817
|
+
}
|
|
818
|
+
async listRemoteFolderItem(path, remoteItemName, remoteVersion) {
|
|
819
|
+
const folderNode = await this.getFolderNode(path);
|
|
820
|
+
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
821
|
+
if (remoteChild.type === 'folder') {
|
|
822
|
+
return remoteChild.list().lst;
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
throw (0, file_1.makeFileException)('notDirectory', `${path}/${remoteItemName}`);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
async getRemoteFileItem(path, remoteItemName, remoteVersion) {
|
|
829
|
+
const folderNode = await this.getFolderNode(path);
|
|
830
|
+
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
831
|
+
if (remoteChild.type === 'file') {
|
|
832
|
+
return (0, files_1.wrapReadonlyFile)(file_2.FileObject.makeExisting(remoteChild, false));
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
throw (0, file_1.makeFileException)('notFile', `${path}/${remoteItemName}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
813
838
|
}
|
|
814
839
|
Object.freeze(S.prototype);
|
|
815
840
|
Object.freeze(S);
|
|
@@ -33087,6 +33087,263 @@ $root.fs = (function() {
|
|
|
33087
33087
|
return FolderDiff;
|
|
33088
33088
|
})();
|
|
33089
33089
|
|
|
33090
|
+
fs.RemoteChildRequestBody = (function() {
|
|
33091
|
+
|
|
33092
|
+
/**
|
|
33093
|
+
* Properties of a RemoteChildRequestBody.
|
|
33094
|
+
* @memberof fs
|
|
33095
|
+
* @interface IRemoteChildRequestBody
|
|
33096
|
+
* @property {string|null} [path] RemoteChildRequestBody path
|
|
33097
|
+
* @property {string|null} [remoteItemName] RemoteChildRequestBody remoteItemName
|
|
33098
|
+
* @property {common.IUInt64Value|null} [remoteVersion] RemoteChildRequestBody remoteVersion
|
|
33099
|
+
*/
|
|
33100
|
+
|
|
33101
|
+
/**
|
|
33102
|
+
* Constructs a new RemoteChildRequestBody.
|
|
33103
|
+
* @memberof fs
|
|
33104
|
+
* @classdesc Represents a RemoteChildRequestBody.
|
|
33105
|
+
* @implements IRemoteChildRequestBody
|
|
33106
|
+
* @constructor
|
|
33107
|
+
* @param {fs.IRemoteChildRequestBody=} [properties] Properties to set
|
|
33108
|
+
*/
|
|
33109
|
+
function RemoteChildRequestBody(properties) {
|
|
33110
|
+
if (properties)
|
|
33111
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
33112
|
+
if (properties[keys[i]] != null)
|
|
33113
|
+
this[keys[i]] = properties[keys[i]];
|
|
33114
|
+
}
|
|
33115
|
+
|
|
33116
|
+
/**
|
|
33117
|
+
* RemoteChildRequestBody path.
|
|
33118
|
+
* @member {string} path
|
|
33119
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33120
|
+
* @instance
|
|
33121
|
+
*/
|
|
33122
|
+
RemoteChildRequestBody.prototype.path = "";
|
|
33123
|
+
|
|
33124
|
+
/**
|
|
33125
|
+
* RemoteChildRequestBody remoteItemName.
|
|
33126
|
+
* @member {string} remoteItemName
|
|
33127
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33128
|
+
* @instance
|
|
33129
|
+
*/
|
|
33130
|
+
RemoteChildRequestBody.prototype.remoteItemName = "";
|
|
33131
|
+
|
|
33132
|
+
/**
|
|
33133
|
+
* RemoteChildRequestBody remoteVersion.
|
|
33134
|
+
* @member {common.IUInt64Value|null|undefined} remoteVersion
|
|
33135
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33136
|
+
* @instance
|
|
33137
|
+
*/
|
|
33138
|
+
RemoteChildRequestBody.prototype.remoteVersion = null;
|
|
33139
|
+
|
|
33140
|
+
/**
|
|
33141
|
+
* Creates a new RemoteChildRequestBody instance using the specified properties.
|
|
33142
|
+
* @function create
|
|
33143
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33144
|
+
* @static
|
|
33145
|
+
* @param {fs.IRemoteChildRequestBody=} [properties] Properties to set
|
|
33146
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody instance
|
|
33147
|
+
*/
|
|
33148
|
+
RemoteChildRequestBody.create = function create(properties) {
|
|
33149
|
+
return new RemoteChildRequestBody(properties);
|
|
33150
|
+
};
|
|
33151
|
+
|
|
33152
|
+
/**
|
|
33153
|
+
* Encodes the specified RemoteChildRequestBody message. Does not implicitly {@link fs.RemoteChildRequestBody.verify|verify} messages.
|
|
33154
|
+
* @function encode
|
|
33155
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33156
|
+
* @static
|
|
33157
|
+
* @param {fs.IRemoteChildRequestBody} message RemoteChildRequestBody message or plain object to encode
|
|
33158
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
33159
|
+
* @returns {$protobuf.Writer} Writer
|
|
33160
|
+
*/
|
|
33161
|
+
RemoteChildRequestBody.encode = function encode(message, writer) {
|
|
33162
|
+
if (!writer)
|
|
33163
|
+
writer = $Writer.create();
|
|
33164
|
+
if (message.path != null && Object.hasOwnProperty.call(message, "path"))
|
|
33165
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.path);
|
|
33166
|
+
if (message.remoteItemName != null && Object.hasOwnProperty.call(message, "remoteItemName"))
|
|
33167
|
+
writer.uint32(/* id 2, wireType 2 =*/18).string(message.remoteItemName);
|
|
33168
|
+
if (message.remoteVersion != null && Object.hasOwnProperty.call(message, "remoteVersion"))
|
|
33169
|
+
$root.common.UInt64Value.encode(message.remoteVersion, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
33170
|
+
return writer;
|
|
33171
|
+
};
|
|
33172
|
+
|
|
33173
|
+
/**
|
|
33174
|
+
* Encodes the specified RemoteChildRequestBody message, length delimited. Does not implicitly {@link fs.RemoteChildRequestBody.verify|verify} messages.
|
|
33175
|
+
* @function encodeDelimited
|
|
33176
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33177
|
+
* @static
|
|
33178
|
+
* @param {fs.IRemoteChildRequestBody} message RemoteChildRequestBody message or plain object to encode
|
|
33179
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
33180
|
+
* @returns {$protobuf.Writer} Writer
|
|
33181
|
+
*/
|
|
33182
|
+
RemoteChildRequestBody.encodeDelimited = function encodeDelimited(message, writer) {
|
|
33183
|
+
return this.encode(message, writer).ldelim();
|
|
33184
|
+
};
|
|
33185
|
+
|
|
33186
|
+
/**
|
|
33187
|
+
* Decodes a RemoteChildRequestBody message from the specified reader or buffer.
|
|
33188
|
+
* @function decode
|
|
33189
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33190
|
+
* @static
|
|
33191
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
33192
|
+
* @param {number} [length] Message length if known beforehand
|
|
33193
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
33194
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
33195
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
33196
|
+
*/
|
|
33197
|
+
RemoteChildRequestBody.decode = function decode(reader, length, error) {
|
|
33198
|
+
if (!(reader instanceof $Reader))
|
|
33199
|
+
reader = $Reader.create(reader);
|
|
33200
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.fs.RemoteChildRequestBody();
|
|
33201
|
+
while (reader.pos < end) {
|
|
33202
|
+
var tag = reader.uint32();
|
|
33203
|
+
if (tag === error)
|
|
33204
|
+
break;
|
|
33205
|
+
switch (tag >>> 3) {
|
|
33206
|
+
case 1: {
|
|
33207
|
+
message.path = reader.string();
|
|
33208
|
+
break;
|
|
33209
|
+
}
|
|
33210
|
+
case 2: {
|
|
33211
|
+
message.remoteItemName = reader.string();
|
|
33212
|
+
break;
|
|
33213
|
+
}
|
|
33214
|
+
case 3: {
|
|
33215
|
+
message.remoteVersion = $root.common.UInt64Value.decode(reader, reader.uint32());
|
|
33216
|
+
break;
|
|
33217
|
+
}
|
|
33218
|
+
default:
|
|
33219
|
+
reader.skipType(tag & 7);
|
|
33220
|
+
break;
|
|
33221
|
+
}
|
|
33222
|
+
}
|
|
33223
|
+
return message;
|
|
33224
|
+
};
|
|
33225
|
+
|
|
33226
|
+
/**
|
|
33227
|
+
* Decodes a RemoteChildRequestBody message from the specified reader or buffer, length delimited.
|
|
33228
|
+
* @function decodeDelimited
|
|
33229
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33230
|
+
* @static
|
|
33231
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
33232
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
33233
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
33234
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
33235
|
+
*/
|
|
33236
|
+
RemoteChildRequestBody.decodeDelimited = function decodeDelimited(reader) {
|
|
33237
|
+
if (!(reader instanceof $Reader))
|
|
33238
|
+
reader = new $Reader(reader);
|
|
33239
|
+
return this.decode(reader, reader.uint32());
|
|
33240
|
+
};
|
|
33241
|
+
|
|
33242
|
+
/**
|
|
33243
|
+
* Verifies a RemoteChildRequestBody message.
|
|
33244
|
+
* @function verify
|
|
33245
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33246
|
+
* @static
|
|
33247
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
33248
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
33249
|
+
*/
|
|
33250
|
+
RemoteChildRequestBody.verify = function verify(message) {
|
|
33251
|
+
if (typeof message !== "object" || message === null)
|
|
33252
|
+
return "object expected";
|
|
33253
|
+
if (message.path != null && message.hasOwnProperty("path"))
|
|
33254
|
+
if (!$util.isString(message.path))
|
|
33255
|
+
return "path: string expected";
|
|
33256
|
+
if (message.remoteItemName != null && message.hasOwnProperty("remoteItemName"))
|
|
33257
|
+
if (!$util.isString(message.remoteItemName))
|
|
33258
|
+
return "remoteItemName: string expected";
|
|
33259
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion")) {
|
|
33260
|
+
var error = $root.common.UInt64Value.verify(message.remoteVersion);
|
|
33261
|
+
if (error)
|
|
33262
|
+
return "remoteVersion." + error;
|
|
33263
|
+
}
|
|
33264
|
+
return null;
|
|
33265
|
+
};
|
|
33266
|
+
|
|
33267
|
+
/**
|
|
33268
|
+
* Creates a RemoteChildRequestBody message from a plain object. Also converts values to their respective internal types.
|
|
33269
|
+
* @function fromObject
|
|
33270
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33271
|
+
* @static
|
|
33272
|
+
* @param {Object.<string,*>} object Plain object
|
|
33273
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
33274
|
+
*/
|
|
33275
|
+
RemoteChildRequestBody.fromObject = function fromObject(object) {
|
|
33276
|
+
if (object instanceof $root.fs.RemoteChildRequestBody)
|
|
33277
|
+
return object;
|
|
33278
|
+
var message = new $root.fs.RemoteChildRequestBody();
|
|
33279
|
+
if (object.path != null)
|
|
33280
|
+
message.path = String(object.path);
|
|
33281
|
+
if (object.remoteItemName != null)
|
|
33282
|
+
message.remoteItemName = String(object.remoteItemName);
|
|
33283
|
+
if (object.remoteVersion != null) {
|
|
33284
|
+
if (typeof object.remoteVersion !== "object")
|
|
33285
|
+
throw TypeError(".fs.RemoteChildRequestBody.remoteVersion: object expected");
|
|
33286
|
+
message.remoteVersion = $root.common.UInt64Value.fromObject(object.remoteVersion);
|
|
33287
|
+
}
|
|
33288
|
+
return message;
|
|
33289
|
+
};
|
|
33290
|
+
|
|
33291
|
+
/**
|
|
33292
|
+
* Creates a plain object from a RemoteChildRequestBody message. Also converts values to other types if specified.
|
|
33293
|
+
* @function toObject
|
|
33294
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33295
|
+
* @static
|
|
33296
|
+
* @param {fs.RemoteChildRequestBody} message RemoteChildRequestBody
|
|
33297
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
33298
|
+
* @returns {Object.<string,*>} Plain object
|
|
33299
|
+
*/
|
|
33300
|
+
RemoteChildRequestBody.toObject = function toObject(message, options) {
|
|
33301
|
+
if (!options)
|
|
33302
|
+
options = {};
|
|
33303
|
+
var object = {};
|
|
33304
|
+
if (options.defaults) {
|
|
33305
|
+
object.path = "";
|
|
33306
|
+
object.remoteItemName = "";
|
|
33307
|
+
object.remoteVersion = null;
|
|
33308
|
+
}
|
|
33309
|
+
if (message.path != null && message.hasOwnProperty("path"))
|
|
33310
|
+
object.path = message.path;
|
|
33311
|
+
if (message.remoteItemName != null && message.hasOwnProperty("remoteItemName"))
|
|
33312
|
+
object.remoteItemName = message.remoteItemName;
|
|
33313
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion"))
|
|
33314
|
+
object.remoteVersion = $root.common.UInt64Value.toObject(message.remoteVersion, options);
|
|
33315
|
+
return object;
|
|
33316
|
+
};
|
|
33317
|
+
|
|
33318
|
+
/**
|
|
33319
|
+
* Converts this RemoteChildRequestBody to JSON.
|
|
33320
|
+
* @function toJSON
|
|
33321
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33322
|
+
* @instance
|
|
33323
|
+
* @returns {Object.<string,*>} JSON object
|
|
33324
|
+
*/
|
|
33325
|
+
RemoteChildRequestBody.prototype.toJSON = function toJSON() {
|
|
33326
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
33327
|
+
};
|
|
33328
|
+
|
|
33329
|
+
/**
|
|
33330
|
+
* Gets the default type url for RemoteChildRequestBody
|
|
33331
|
+
* @function getTypeUrl
|
|
33332
|
+
* @memberof fs.RemoteChildRequestBody
|
|
33333
|
+
* @static
|
|
33334
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
33335
|
+
* @returns {string} The default type url
|
|
33336
|
+
*/
|
|
33337
|
+
RemoteChildRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
33338
|
+
if (typeUrlPrefix === undefined) {
|
|
33339
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
33340
|
+
}
|
|
33341
|
+
return typeUrlPrefix + "/fs.RemoteChildRequestBody";
|
|
33342
|
+
};
|
|
33343
|
+
|
|
33344
|
+
return RemoteChildRequestBody;
|
|
33345
|
+
})();
|
|
33346
|
+
|
|
33090
33347
|
fs.FSSyncUploadRequestBody = (function() {
|
|
33091
33348
|
|
|
33092
33349
|
/**
|
package/build/protos/fs.proto.js
CHANGED
|
@@ -14108,6 +14108,263 @@ $root.fs = (function() {
|
|
|
14108
14108
|
return FolderDiff;
|
|
14109
14109
|
})();
|
|
14110
14110
|
|
|
14111
|
+
fs.RemoteChildRequestBody = (function() {
|
|
14112
|
+
|
|
14113
|
+
/**
|
|
14114
|
+
* Properties of a RemoteChildRequestBody.
|
|
14115
|
+
* @memberof fs
|
|
14116
|
+
* @interface IRemoteChildRequestBody
|
|
14117
|
+
* @property {string|null} [path] RemoteChildRequestBody path
|
|
14118
|
+
* @property {string|null} [remoteItemName] RemoteChildRequestBody remoteItemName
|
|
14119
|
+
* @property {common.IUInt64Value|null} [remoteVersion] RemoteChildRequestBody remoteVersion
|
|
14120
|
+
*/
|
|
14121
|
+
|
|
14122
|
+
/**
|
|
14123
|
+
* Constructs a new RemoteChildRequestBody.
|
|
14124
|
+
* @memberof fs
|
|
14125
|
+
* @classdesc Represents a RemoteChildRequestBody.
|
|
14126
|
+
* @implements IRemoteChildRequestBody
|
|
14127
|
+
* @constructor
|
|
14128
|
+
* @param {fs.IRemoteChildRequestBody=} [properties] Properties to set
|
|
14129
|
+
*/
|
|
14130
|
+
function RemoteChildRequestBody(properties) {
|
|
14131
|
+
if (properties)
|
|
14132
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
14133
|
+
if (properties[keys[i]] != null)
|
|
14134
|
+
this[keys[i]] = properties[keys[i]];
|
|
14135
|
+
}
|
|
14136
|
+
|
|
14137
|
+
/**
|
|
14138
|
+
* RemoteChildRequestBody path.
|
|
14139
|
+
* @member {string} path
|
|
14140
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14141
|
+
* @instance
|
|
14142
|
+
*/
|
|
14143
|
+
RemoteChildRequestBody.prototype.path = "";
|
|
14144
|
+
|
|
14145
|
+
/**
|
|
14146
|
+
* RemoteChildRequestBody remoteItemName.
|
|
14147
|
+
* @member {string} remoteItemName
|
|
14148
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14149
|
+
* @instance
|
|
14150
|
+
*/
|
|
14151
|
+
RemoteChildRequestBody.prototype.remoteItemName = "";
|
|
14152
|
+
|
|
14153
|
+
/**
|
|
14154
|
+
* RemoteChildRequestBody remoteVersion.
|
|
14155
|
+
* @member {common.IUInt64Value|null|undefined} remoteVersion
|
|
14156
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14157
|
+
* @instance
|
|
14158
|
+
*/
|
|
14159
|
+
RemoteChildRequestBody.prototype.remoteVersion = null;
|
|
14160
|
+
|
|
14161
|
+
/**
|
|
14162
|
+
* Creates a new RemoteChildRequestBody instance using the specified properties.
|
|
14163
|
+
* @function create
|
|
14164
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14165
|
+
* @static
|
|
14166
|
+
* @param {fs.IRemoteChildRequestBody=} [properties] Properties to set
|
|
14167
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody instance
|
|
14168
|
+
*/
|
|
14169
|
+
RemoteChildRequestBody.create = function create(properties) {
|
|
14170
|
+
return new RemoteChildRequestBody(properties);
|
|
14171
|
+
};
|
|
14172
|
+
|
|
14173
|
+
/**
|
|
14174
|
+
* Encodes the specified RemoteChildRequestBody message. Does not implicitly {@link fs.RemoteChildRequestBody.verify|verify} messages.
|
|
14175
|
+
* @function encode
|
|
14176
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14177
|
+
* @static
|
|
14178
|
+
* @param {fs.IRemoteChildRequestBody} message RemoteChildRequestBody message or plain object to encode
|
|
14179
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
14180
|
+
* @returns {$protobuf.Writer} Writer
|
|
14181
|
+
*/
|
|
14182
|
+
RemoteChildRequestBody.encode = function encode(message, writer) {
|
|
14183
|
+
if (!writer)
|
|
14184
|
+
writer = $Writer.create();
|
|
14185
|
+
if (message.path != null && Object.hasOwnProperty.call(message, "path"))
|
|
14186
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.path);
|
|
14187
|
+
if (message.remoteItemName != null && Object.hasOwnProperty.call(message, "remoteItemName"))
|
|
14188
|
+
writer.uint32(/* id 2, wireType 2 =*/18).string(message.remoteItemName);
|
|
14189
|
+
if (message.remoteVersion != null && Object.hasOwnProperty.call(message, "remoteVersion"))
|
|
14190
|
+
$root.common.UInt64Value.encode(message.remoteVersion, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
14191
|
+
return writer;
|
|
14192
|
+
};
|
|
14193
|
+
|
|
14194
|
+
/**
|
|
14195
|
+
* Encodes the specified RemoteChildRequestBody message, length delimited. Does not implicitly {@link fs.RemoteChildRequestBody.verify|verify} messages.
|
|
14196
|
+
* @function encodeDelimited
|
|
14197
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14198
|
+
* @static
|
|
14199
|
+
* @param {fs.IRemoteChildRequestBody} message RemoteChildRequestBody message or plain object to encode
|
|
14200
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
14201
|
+
* @returns {$protobuf.Writer} Writer
|
|
14202
|
+
*/
|
|
14203
|
+
RemoteChildRequestBody.encodeDelimited = function encodeDelimited(message, writer) {
|
|
14204
|
+
return this.encode(message, writer).ldelim();
|
|
14205
|
+
};
|
|
14206
|
+
|
|
14207
|
+
/**
|
|
14208
|
+
* Decodes a RemoteChildRequestBody message from the specified reader or buffer.
|
|
14209
|
+
* @function decode
|
|
14210
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14211
|
+
* @static
|
|
14212
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
14213
|
+
* @param {number} [length] Message length if known beforehand
|
|
14214
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
14215
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
14216
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
14217
|
+
*/
|
|
14218
|
+
RemoteChildRequestBody.decode = function decode(reader, length, error) {
|
|
14219
|
+
if (!(reader instanceof $Reader))
|
|
14220
|
+
reader = $Reader.create(reader);
|
|
14221
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.fs.RemoteChildRequestBody();
|
|
14222
|
+
while (reader.pos < end) {
|
|
14223
|
+
var tag = reader.uint32();
|
|
14224
|
+
if (tag === error)
|
|
14225
|
+
break;
|
|
14226
|
+
switch (tag >>> 3) {
|
|
14227
|
+
case 1: {
|
|
14228
|
+
message.path = reader.string();
|
|
14229
|
+
break;
|
|
14230
|
+
}
|
|
14231
|
+
case 2: {
|
|
14232
|
+
message.remoteItemName = reader.string();
|
|
14233
|
+
break;
|
|
14234
|
+
}
|
|
14235
|
+
case 3: {
|
|
14236
|
+
message.remoteVersion = $root.common.UInt64Value.decode(reader, reader.uint32());
|
|
14237
|
+
break;
|
|
14238
|
+
}
|
|
14239
|
+
default:
|
|
14240
|
+
reader.skipType(tag & 7);
|
|
14241
|
+
break;
|
|
14242
|
+
}
|
|
14243
|
+
}
|
|
14244
|
+
return message;
|
|
14245
|
+
};
|
|
14246
|
+
|
|
14247
|
+
/**
|
|
14248
|
+
* Decodes a RemoteChildRequestBody message from the specified reader or buffer, length delimited.
|
|
14249
|
+
* @function decodeDelimited
|
|
14250
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14251
|
+
* @static
|
|
14252
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
14253
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
14254
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
14255
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
14256
|
+
*/
|
|
14257
|
+
RemoteChildRequestBody.decodeDelimited = function decodeDelimited(reader) {
|
|
14258
|
+
if (!(reader instanceof $Reader))
|
|
14259
|
+
reader = new $Reader(reader);
|
|
14260
|
+
return this.decode(reader, reader.uint32());
|
|
14261
|
+
};
|
|
14262
|
+
|
|
14263
|
+
/**
|
|
14264
|
+
* Verifies a RemoteChildRequestBody message.
|
|
14265
|
+
* @function verify
|
|
14266
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14267
|
+
* @static
|
|
14268
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
14269
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
14270
|
+
*/
|
|
14271
|
+
RemoteChildRequestBody.verify = function verify(message) {
|
|
14272
|
+
if (typeof message !== "object" || message === null)
|
|
14273
|
+
return "object expected";
|
|
14274
|
+
if (message.path != null && message.hasOwnProperty("path"))
|
|
14275
|
+
if (!$util.isString(message.path))
|
|
14276
|
+
return "path: string expected";
|
|
14277
|
+
if (message.remoteItemName != null && message.hasOwnProperty("remoteItemName"))
|
|
14278
|
+
if (!$util.isString(message.remoteItemName))
|
|
14279
|
+
return "remoteItemName: string expected";
|
|
14280
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion")) {
|
|
14281
|
+
var error = $root.common.UInt64Value.verify(message.remoteVersion);
|
|
14282
|
+
if (error)
|
|
14283
|
+
return "remoteVersion." + error;
|
|
14284
|
+
}
|
|
14285
|
+
return null;
|
|
14286
|
+
};
|
|
14287
|
+
|
|
14288
|
+
/**
|
|
14289
|
+
* Creates a RemoteChildRequestBody message from a plain object. Also converts values to their respective internal types.
|
|
14290
|
+
* @function fromObject
|
|
14291
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14292
|
+
* @static
|
|
14293
|
+
* @param {Object.<string,*>} object Plain object
|
|
14294
|
+
* @returns {fs.RemoteChildRequestBody} RemoteChildRequestBody
|
|
14295
|
+
*/
|
|
14296
|
+
RemoteChildRequestBody.fromObject = function fromObject(object) {
|
|
14297
|
+
if (object instanceof $root.fs.RemoteChildRequestBody)
|
|
14298
|
+
return object;
|
|
14299
|
+
var message = new $root.fs.RemoteChildRequestBody();
|
|
14300
|
+
if (object.path != null)
|
|
14301
|
+
message.path = String(object.path);
|
|
14302
|
+
if (object.remoteItemName != null)
|
|
14303
|
+
message.remoteItemName = String(object.remoteItemName);
|
|
14304
|
+
if (object.remoteVersion != null) {
|
|
14305
|
+
if (typeof object.remoteVersion !== "object")
|
|
14306
|
+
throw TypeError(".fs.RemoteChildRequestBody.remoteVersion: object expected");
|
|
14307
|
+
message.remoteVersion = $root.common.UInt64Value.fromObject(object.remoteVersion);
|
|
14308
|
+
}
|
|
14309
|
+
return message;
|
|
14310
|
+
};
|
|
14311
|
+
|
|
14312
|
+
/**
|
|
14313
|
+
* Creates a plain object from a RemoteChildRequestBody message. Also converts values to other types if specified.
|
|
14314
|
+
* @function toObject
|
|
14315
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14316
|
+
* @static
|
|
14317
|
+
* @param {fs.RemoteChildRequestBody} message RemoteChildRequestBody
|
|
14318
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
14319
|
+
* @returns {Object.<string,*>} Plain object
|
|
14320
|
+
*/
|
|
14321
|
+
RemoteChildRequestBody.toObject = function toObject(message, options) {
|
|
14322
|
+
if (!options)
|
|
14323
|
+
options = {};
|
|
14324
|
+
var object = {};
|
|
14325
|
+
if (options.defaults) {
|
|
14326
|
+
object.path = "";
|
|
14327
|
+
object.remoteItemName = "";
|
|
14328
|
+
object.remoteVersion = null;
|
|
14329
|
+
}
|
|
14330
|
+
if (message.path != null && message.hasOwnProperty("path"))
|
|
14331
|
+
object.path = message.path;
|
|
14332
|
+
if (message.remoteItemName != null && message.hasOwnProperty("remoteItemName"))
|
|
14333
|
+
object.remoteItemName = message.remoteItemName;
|
|
14334
|
+
if (message.remoteVersion != null && message.hasOwnProperty("remoteVersion"))
|
|
14335
|
+
object.remoteVersion = $root.common.UInt64Value.toObject(message.remoteVersion, options);
|
|
14336
|
+
return object;
|
|
14337
|
+
};
|
|
14338
|
+
|
|
14339
|
+
/**
|
|
14340
|
+
* Converts this RemoteChildRequestBody to JSON.
|
|
14341
|
+
* @function toJSON
|
|
14342
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14343
|
+
* @instance
|
|
14344
|
+
* @returns {Object.<string,*>} JSON object
|
|
14345
|
+
*/
|
|
14346
|
+
RemoteChildRequestBody.prototype.toJSON = function toJSON() {
|
|
14347
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
14348
|
+
};
|
|
14349
|
+
|
|
14350
|
+
/**
|
|
14351
|
+
* Gets the default type url for RemoteChildRequestBody
|
|
14352
|
+
* @function getTypeUrl
|
|
14353
|
+
* @memberof fs.RemoteChildRequestBody
|
|
14354
|
+
* @static
|
|
14355
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
14356
|
+
* @returns {string} The default type url
|
|
14357
|
+
*/
|
|
14358
|
+
RemoteChildRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
14359
|
+
if (typeUrlPrefix === undefined) {
|
|
14360
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
14361
|
+
}
|
|
14362
|
+
return typeUrlPrefix + "/fs.RemoteChildRequestBody";
|
|
14363
|
+
};
|
|
14364
|
+
|
|
14365
|
+
return RemoteChildRequestBody;
|
|
14366
|
+
})();
|
|
14367
|
+
|
|
14111
14368
|
fs.FSSyncUploadRequestBody = (function() {
|
|
14112
14369
|
|
|
14113
14370
|
/**
|
package/package.json
CHANGED
package/protos/fs.proto
CHANGED
|
@@ -512,6 +512,24 @@ message FolderDiff {
|
|
|
512
512
|
XAttrs xattrs = 8;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
+
message RemoteChildRequestBody {
|
|
516
|
+
string path = 1;
|
|
517
|
+
string remote_item_name = 2;
|
|
518
|
+
common.UInt64Value remote_version = 3;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// --- ReadonlyFSSyncAPI.statRemoteItem ---
|
|
522
|
+
// Request body is RemoteChildRequestBody
|
|
523
|
+
// Reply body is file.StatsMsg
|
|
524
|
+
|
|
525
|
+
// --- ReadonlyFSSyncAPI.listRemoteFolderItem ---
|
|
526
|
+
// Request body is RemoteChildRequestBody
|
|
527
|
+
// Reply body is ListFolderReplyBody
|
|
528
|
+
|
|
529
|
+
// --- ReadonlyFSSyncAPI.getRemoteFileItem ---
|
|
530
|
+
// Request body is RemoteChildRequestBody
|
|
531
|
+
// Reply body is file.File
|
|
532
|
+
|
|
515
533
|
|
|
516
534
|
// ==== WritableFSSyncAPI referable object ====
|
|
517
535
|
|