core-3nweb-client-lib 0.44.4 → 0.44.6
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 +19 -1
- package/build/core/asmail/inbox/inbox-events.d.ts +2 -0
- package/build/core/asmail/inbox/inbox-events.js +15 -2
- package/build/core/asmail/inbox/index.js +4 -3
- package/build/core/asmail/inbox/msg-downloader.d.ts +2 -1
- package/build/core/asmail/inbox/msg-downloader.js +4 -2
- package/build/core/storage/synced/downloader.d.ts +2 -1
- package/build/core/storage/synced/downloader.js +2 -1
- package/build/core/storage/synced/obj-files.d.ts +1 -1
- package/build/core/storage/synced/obj-files.js +5 -5
- package/build/core/storage/synced/remote-events.d.ts +1 -2
- package/build/core/storage/synced/remote-events.js +7 -16
- package/build/core/storage/synced/storage.js +3 -3
- package/build/core/storage/synced/upsyncer.d.ts +2 -6
- package/build/core/storage/synced/upsyncer.js +31 -28
- 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/objs-on-disk/obj-on-disk.d.ts +1 -0
- package/build/lib-client/objs-on-disk/obj-on-disk.js +7 -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 +14 -1
- package/build/lib-common/async-iter.js +2 -1
- package/build/lib-common/awaitable-state.d.ts +7 -0
- package/build/lib-common/awaitable-state.js +43 -0
- 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) {
|
|
@@ -73,6 +73,7 @@ export interface ObjDownloader {
|
|
|
73
73
|
getSegs: (objId: ObjId, version: number, start: number, end: number) => Promise<Uint8Array>;
|
|
74
74
|
splitSegsDownloads: (start: number, end: number) => Section[];
|
|
75
75
|
schedule: (download: Download) => void;
|
|
76
|
+
whenConnected: () => Promise<void>;
|
|
76
77
|
}
|
|
77
78
|
export interface InitDownloadParts {
|
|
78
79
|
layout: Layout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2018 - 2020, 2022, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2018 - 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
|
|
@@ -423,7 +423,12 @@ class Download {
|
|
|
423
423
|
this.inBkgrnd.runData.currentDownload.deferred.resolve(bytes);
|
|
424
424
|
}
|
|
425
425
|
catch (exc) {
|
|
426
|
-
|
|
426
|
+
if (exc.type === 'connect') {
|
|
427
|
+
await this.downloader.whenConnected();
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
this.inBkgrnd.runData.currentDownload.deferred.reject(exc);
|
|
431
|
+
}
|
|
427
432
|
}
|
|
428
433
|
finally {
|
|
429
434
|
this.inBkgrnd.runData.currentDownload = undefined;
|
|
@@ -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);
|
|
@@ -818,6 +818,19 @@ class S {
|
|
|
818
818
|
throw (0, common_1.setPathInExc)(exc, path);
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
+
// XXX WIP
|
|
822
|
+
// async compareLocalAndRemoteFileItems(
|
|
823
|
+
// path: string, itemName: string, remoteVersion?: number
|
|
824
|
+
// ): Promise<FileDiff> {
|
|
825
|
+
// const folderNode = await this.getFolderNode(path);
|
|
826
|
+
// const localChild = (await folderNode.getFile(itemName))!;
|
|
827
|
+
// const remoteChild = await folderNode.getRemoteItemNode(itemName, remoteVersion);
|
|
828
|
+
// if (remoteChild.type === 'file') {
|
|
829
|
+
// return await localChild.compareWithRemote(remoteChild);
|
|
830
|
+
// } else {
|
|
831
|
+
// throw makeFileException('notFile', `${path}/${itemName}`);
|
|
832
|
+
// }
|
|
833
|
+
// }
|
|
821
834
|
async adoptRemoteFolderItem(path, itemName, opts) {
|
|
822
835
|
const node = await this.getFolderNode(path);
|
|
823
836
|
try {
|
|
@@ -846,7 +859,7 @@ class S {
|
|
|
846
859
|
const folderNode = await this.getFolderNode(path);
|
|
847
860
|
const remoteChild = await folderNode.getRemoteItemNode(remoteItemName, remoteVersion);
|
|
848
861
|
if (remoteChild.type === 'file') {
|
|
849
|
-
return
|
|
862
|
+
return file_2.FileObject.makeFromRemoteVersion(remoteChild);
|
|
850
863
|
}
|
|
851
864
|
else {
|
|
852
865
|
throw (0, file_1.makeFileException)('notFile', `${path}/${remoteItemName}`);
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
See the GNU General Public License for more details.
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
|
-
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.asyncIteration = asyncIteration;
|
|
19
20
|
exports.asyncFind = asyncFind;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2017 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.AwaitableState = void 0;
|
|
20
|
+
const deferred_1 = require("./processes/deferred");
|
|
21
|
+
class AwaitableState {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.deferredStateSetPoint = (0, deferred_1.defer)();
|
|
24
|
+
Object.seal(this);
|
|
25
|
+
}
|
|
26
|
+
setState() {
|
|
27
|
+
if (this.deferredStateSetPoint) {
|
|
28
|
+
this.deferredStateSetPoint.resolve();
|
|
29
|
+
this.deferredStateSetPoint = undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
clearState() {
|
|
33
|
+
if (!this.deferredStateSetPoint) {
|
|
34
|
+
this.deferredStateSetPoint = (0, deferred_1.defer)();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async whenStateIsSet() {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = this.deferredStateSetPoint) === null || _a === void 0 ? void 0 : _a.promise;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AwaitableState = AwaitableState;
|
|
43
|
+
Object.freeze(exports);
|