core-3nweb-client-lib 0.44.4 → 0.44.5
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 +14 -0
- 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 +1 -2
- package/build/lib-client/xsp-fs/file.d.ts +1 -0
- package/build/lib-client/xsp-fs/file.js +18 -0
- package/build/lib-client/xsp-fs/folder-node.js +1 -1
- package/build/lib-client/xsp-fs/fs.js +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -98,8 +98,7 @@ function wrapWritableFileSyncAPI(sImpl) {
|
|
|
98
98
|
return Object.freeze(w);
|
|
99
99
|
}
|
|
100
100
|
function addParamsAndFreezeFileWrap(w, fImpl) {
|
|
101
|
-
w.getLinkParams =
|
|
102
|
-
fImpl.getLinkParams.bind(fImpl);
|
|
101
|
+
w.getLinkParams = fImpl.getLinkParams.bind(fImpl);
|
|
103
102
|
return Object.freeze(w);
|
|
104
103
|
}
|
|
105
104
|
function wrapReadonlyFile(fImpl) {
|
|
@@ -27,6 +27,7 @@ export declare class FileObject implements WritableFile, Linkable {
|
|
|
27
27
|
static makeExisting(node: FileNode, writable: boolean): WritableFile | ReadonlyFile;
|
|
28
28
|
static makeForNotExisiting(name: string, makeNode: () => Promise<FileNode>, isInSyncedStorage: boolean): WritableFile;
|
|
29
29
|
static makeFileFromLinkParams(storage: Storage, params: LinkParameters<FileLinkParams>): Promise<WritableFile | ReadonlyFile>;
|
|
30
|
+
static makeFromRemoteVersion(remote: FileNode): Promise<ReadonlyFile>;
|
|
30
31
|
getLinkParams(): Promise<LinkParameters<FileLinkParams>>;
|
|
31
32
|
stat(): Promise<Stats>;
|
|
32
33
|
updateXAttrs(changes: XAttrsChanges): Promise<void>;
|
|
@@ -47,6 +47,24 @@ class FileObject {
|
|
|
47
47
|
const node = await file_node_1.FileNode.makeFromLinkParams(storage, params.params);
|
|
48
48
|
return FileObject.makeExisting(node, !params.readonly);
|
|
49
49
|
}
|
|
50
|
+
static async makeFromRemoteVersion(remote) {
|
|
51
|
+
const f = new FileObject(remote.name, false, remote, undefined, false, true);
|
|
52
|
+
const versionFlags = { remoteVersion: remote.version };
|
|
53
|
+
const wrap = {
|
|
54
|
+
writable: false,
|
|
55
|
+
isNew: false,
|
|
56
|
+
name: f.name,
|
|
57
|
+
getByteSource: () => f.v.getByteSource(versionFlags).then(({ src }) => src),
|
|
58
|
+
readJSON: () => f.v.readJSON(versionFlags).then(({ json }) => json),
|
|
59
|
+
readTxt: () => f.v.readTxt(versionFlags).then(({ txt }) => txt),
|
|
60
|
+
readBytes: (start, end) => f.v.readBytes(start, end, versionFlags).then(({ bytes }) => bytes),
|
|
61
|
+
stat: f.stat.bind(f),
|
|
62
|
+
watch: f.watch.bind(f),
|
|
63
|
+
getXAttr: f.getXAttr.bind(f),
|
|
64
|
+
listXAttrs: f.listXAttrs.bind(f),
|
|
65
|
+
};
|
|
66
|
+
return Object.freeze(wrap);
|
|
67
|
+
}
|
|
50
68
|
async getLinkParams() {
|
|
51
69
|
const node = await this.v.getNode();
|
|
52
70
|
const linkParams = node.getParamsForLink();
|
|
@@ -387,7 +387,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
387
387
|
node = await file_node_1.FileNode.readNodeFromObjBytes(storage, undefined, name, objId, src, key);
|
|
388
388
|
}
|
|
389
389
|
else if (info.isFolder) {
|
|
390
|
-
node = await FolderNode.readNodeFromObjBytes(storage,
|
|
390
|
+
node = await FolderNode.readNodeFromObjBytes(storage, name, objId, src, key);
|
|
391
391
|
}
|
|
392
392
|
else if (info.isLink) {
|
|
393
393
|
node = await link_node_1.LinkNode.readNodeFromObjBytes(storage, undefined, name, objId, src, key);
|
|
@@ -846,7 +846,7 @@ class S {
|
|
|
846
846
|
const folderNode = await this.getFolderNode(path);
|
|
847
847
|
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
848
848
|
if (remoteChild.type === 'file') {
|
|
849
|
-
return
|
|
849
|
+
return file_2.FileObject.makeFromRemoteVersion(remoteChild);
|
|
850
850
|
}
|
|
851
851
|
else {
|
|
852
852
|
throw (0, file_1.makeFileException)('notFile', `${path}/${remoteItemName}`);
|