core-3nweb-client-lib 0.27.3 → 0.27.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 +92 -29
- package/build/core/asmail/config/index.d.ts +2 -2
- package/build/core/asmail/config/index.js +2 -2
- package/build/core/asmail/config/invitations-anon.d.ts +10 -24
- package/build/core/asmail/config/invitations-anon.js +43 -31
- package/build/core/asmail/config/published-intro-key.d.ts +11 -22
- package/build/core/asmail/config/published-intro-key.js +47 -38
- package/build/core/asmail/delivery/per-recipient-wip.js +2 -2
- package/build/core/asmail/inbox/inbox-events.js +10 -5
- package/build/core/asmail/inbox/index.d.ts +3 -2
- package/build/core/asmail/inbox/index.js +15 -11
- package/build/core/asmail/inbox/msg-indexing.d.ts +17 -64
- package/build/core/asmail/inbox/msg-indexing.js +440 -311
- package/build/core/asmail/inbox/msg-on-disk.js +2 -1
- package/build/core/asmail/index.d.ts +1 -1
- package/build/core/asmail/index.js +5 -4
- package/build/core/asmail/keyring/correspondent-keys.d.ts +2 -2
- package/build/core/asmail/keyring/correspondent-keys.js +4 -2
- package/build/core/asmail/keyring/index.d.ts +10 -33
- package/build/core/asmail/keyring/index.js +88 -75
- package/build/core/asmail/msg/opener.js +4 -3
- package/build/core/asmail/msg/packer.d.ts +1 -0
- package/build/core/asmail/msg/packer.js +8 -4
- package/build/core/index.js +3 -5
- package/build/core/sign-in.js +1 -1
- package/build/core/storage/local/obj-files.js +2 -1
- package/build/core/storage/synced/obj-files.d.ts +2 -0
- package/build/core/storage/synced/obj-files.js +18 -1
- package/build/core/storage/synced/obj-status.d.ts +1 -0
- package/build/core/storage/synced/obj-status.js +10 -0
- package/build/core/storage/synced/storage.js +7 -23
- package/build/core/storage/synced/upload-header-file.js +4 -2
- package/build/core/storage/synced/upsyncer.js +3 -5
- package/build/ipc-via-protobuf/asmail-cap.js +14 -15
- package/build/ipc-via-protobuf/bytes.js +42 -18
- package/build/ipc-via-protobuf/file.d.ts +7 -0
- package/build/ipc-via-protobuf/file.js +103 -66
- package/build/ipc-via-protobuf/fs.js +127 -105
- package/build/ipc-via-protobuf/mailerid.js +2 -2
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +5 -1
- package/build/ipc-via-protobuf/startup-cap.js +8 -8
- package/build/ipc-via-protobuf/storage-cap.js +4 -4
- package/build/lib-client/3nstorage/xsp-fs/common.js +2 -0
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +5 -10
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +26 -45
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +8 -7
- package/build/lib-client/3nstorage/xsp-fs/file.js +12 -18
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +6 -1
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +20 -8
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +19 -18
- package/build/lib-client/3nstorage/xsp-fs/fs.js +18 -19
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +13 -4
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +63 -8
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +7 -5
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -4
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +20 -15
- package/build/lib-client/cryptor/cryptor-in-worker.js +37 -47
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +15 -12
- package/build/lib-client/cryptor/in-proc-wasm.js +11 -8
- package/build/lib-client/cryptor/serialization-for-wasm.d.ts +36 -0
- package/build/lib-client/cryptor/serialization-for-wasm.js +58 -0
- package/build/lib-client/cryptor-work-labels.d.ts +26 -0
- package/build/lib-client/cryptor-work-labels.js +152 -0
- package/build/lib-client/fs-sync-utils.d.ts +7 -1
- package/build/lib-client/fs-sync-utils.js +18 -7
- package/build/lib-client/local-files/dev-file-src.d.ts +2 -1
- package/build/lib-client/local-files/dev-file-src.js +5 -1
- package/build/lib-client/local-files/device-fs.js +2 -1
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +5 -2
- package/build/lib-client/objs-on-disk/obj-on-disk.js +21 -2
- package/build/lib-client/request-utils.js +14 -14
- package/build/lib-common/async-cryptor-wrap.d.ts +9 -9
- package/build/lib-common/async-cryptor-wrap.js +13 -13
- package/build/lib-common/byte-streaming/pipe.d.ts +1 -1
- package/build/lib-common/byte-streaming/pipe.js +3 -3
- package/build/lib-common/byte-streaming/wrapping.js +4 -2
- package/build/lib-common/json-utils.js +0 -3
- package/build/lib-common/objs-on-disk/file-layout.js +1 -1
- package/build/lib-common/processes/synced.js +0 -184
- package/build/lib-sqlite-on-3nstorage/index.d.ts +32 -0
- package/build/lib-sqlite-on-3nstorage/index.js +117 -0
- package/build/lib-sqlite-on-3nstorage/sqljs.d.ts +279 -0
- package/build/lib-sqlite-on-3nstorage/sqljs.js +223 -0
- package/build/protos/asmail.proto.js +10145 -5923
- package/build/protos/bytes.proto.js +731 -204
- package/build/protos/common.proto.js +192 -44
- package/build/protos/cryptor.proto.js +184 -61
- package/build/protos/file.proto.js +2388 -502
- package/build/protos/fs.proto.js +9894 -6046
- package/build/protos/ipc.proto.js +244 -61
- package/build/protos/logger.proto.js +219 -53
- package/build/protos/mailerid.proto.js +230 -50
- package/build/protos/startup.proto.js +341 -77
- package/build/protos/storage.proto.js +276 -62
- package/package.json +8 -7
- package/protos/bytes.proto +13 -4
- package/protos/file.proto +27 -8
- package/protos/fs.proto +31 -14
|
@@ -46,7 +46,7 @@ var getUserId;
|
|
|
46
46
|
}
|
|
47
47
|
getUserId.wrapService = wrapService;
|
|
48
48
|
function makeCaller(caller, objPath) {
|
|
49
|
-
const path =
|
|
49
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getUserId');
|
|
50
50
|
return () => caller.startPromiseCall(path, undefined)
|
|
51
51
|
.then(buf => {
|
|
52
52
|
if (!buf) {
|
|
@@ -72,7 +72,7 @@ var login;
|
|
|
72
72
|
}
|
|
73
73
|
login.wrapService = wrapService;
|
|
74
74
|
function makeCaller(caller, objPath) {
|
|
75
|
-
const path =
|
|
75
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'login');
|
|
76
76
|
return async (serviceUrl) => {
|
|
77
77
|
const req = requestType.pack({ serviceUrl });
|
|
78
78
|
const buf = await caller.startPromiseCall(path, req);
|
|
@@ -45,4 +45,5 @@ export declare function toOptAny(value: any | undefined): AnyValue | undefined;
|
|
|
45
45
|
export declare function valOfOptAny(valObj: AnyValue | undefined): any | undefined;
|
|
46
46
|
export declare function encodeToUtf8(str: string): Uint8Array;
|
|
47
47
|
export declare function decodeFromUtf8(bytes: Uint8Array): string;
|
|
48
|
+
export declare function methodPathFor<T>(objPath: string[], method: keyof T): string[];
|
|
48
49
|
export {};
|
|
@@ -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.decodeFromUtf8 = exports.encodeToUtf8 = exports.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.intValOf = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = void 0;
|
|
19
|
+
exports.methodPathFor = exports.decodeFromUtf8 = exports.encodeToUtf8 = exports.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.intValOf = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = void 0;
|
|
20
20
|
const connector_1 = require("./connector");
|
|
21
21
|
const error_1 = require("../lib-common/exceptions/error");
|
|
22
22
|
const buffer_utils_1 = require("../lib-common/buffer-utils");
|
|
@@ -166,4 +166,8 @@ function decodeFromUtf8(bytes) {
|
|
|
166
166
|
return dec.decode(bytes);
|
|
167
167
|
}
|
|
168
168
|
exports.decodeFromUtf8 = decodeFromUtf8;
|
|
169
|
+
function methodPathFor(objPath, method) {
|
|
170
|
+
return objPath.concat(method);
|
|
171
|
+
}
|
|
172
|
+
exports.methodPathFor = methodPathFor;
|
|
169
173
|
Object.freeze(exports);
|
|
@@ -72,7 +72,7 @@ var getAvailableAddresses;
|
|
|
72
72
|
}
|
|
73
73
|
getAvailableAddresses.wrapService = wrapService;
|
|
74
74
|
function makeCaller(caller, objPath) {
|
|
75
|
-
const path =
|
|
75
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getAvailableAddresses');
|
|
76
76
|
return (name, token) => caller
|
|
77
77
|
.startPromiseCall(path, requestType.pack({ name, token: (0, protobuf_msg_1.toOptVal)(token) }))
|
|
78
78
|
.then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
@@ -93,7 +93,7 @@ var addUser;
|
|
|
93
93
|
}
|
|
94
94
|
addUser.wrapService = wrapService;
|
|
95
95
|
function makeCaller(caller, objPath) {
|
|
96
|
-
const path =
|
|
96
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'addUser');
|
|
97
97
|
return (userId, token) => caller
|
|
98
98
|
.startPromiseCall(path, requestType.pack({ userId, token: (0, protobuf_msg_1.toOptVal)(token) }))
|
|
99
99
|
.then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
|
|
@@ -114,7 +114,7 @@ var isActivated;
|
|
|
114
114
|
}
|
|
115
115
|
isActivated_1.wrapService = wrapService;
|
|
116
116
|
function makeCaller(caller, objPath) {
|
|
117
|
-
const path =
|
|
117
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'isActivated');
|
|
118
118
|
return userId => caller
|
|
119
119
|
.startPromiseCall(path, requestType.pack({ userId }))
|
|
120
120
|
.then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
|
|
@@ -137,7 +137,7 @@ var createUserParams;
|
|
|
137
137
|
}
|
|
138
138
|
createUserParams.wrapService = wrapService;
|
|
139
139
|
function makeCaller(caller, objPath) {
|
|
140
|
-
const path =
|
|
140
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'createUserParams');
|
|
141
141
|
return (pass, progressCB) => {
|
|
142
142
|
const s = new rxjs_1.Subject();
|
|
143
143
|
const completion = (0, deferred_1.defer)();
|
|
@@ -167,7 +167,7 @@ var getUsersOnDisk;
|
|
|
167
167
|
}
|
|
168
168
|
getUsersOnDisk.wrapService = wrapService;
|
|
169
169
|
function makeCaller(caller, objPath) {
|
|
170
|
-
const path =
|
|
170
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getUsersOnDisk');
|
|
171
171
|
return () => caller
|
|
172
172
|
.startPromiseCall(path, undefined)
|
|
173
173
|
.then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
@@ -188,7 +188,7 @@ var startLoginToRemoteStorage;
|
|
|
188
188
|
}
|
|
189
189
|
startLoginToRemoteStorage.wrapService = wrapService;
|
|
190
190
|
function makeCaller(caller, objPath) {
|
|
191
|
-
const path =
|
|
191
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'startLoginToRemoteStorage');
|
|
192
192
|
return address => caller
|
|
193
193
|
.startPromiseCall(path, requestType.pack({ address }))
|
|
194
194
|
.then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
|
|
@@ -214,7 +214,7 @@ var completeLoginAndLocalSetup;
|
|
|
214
214
|
}
|
|
215
215
|
completeLoginAndLocalSetup.wrapService = wrapService;
|
|
216
216
|
function makeCaller(caller, objPath) {
|
|
217
|
-
const path =
|
|
217
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'completeLoginAndLocalSetup');
|
|
218
218
|
return (pass, progressCB) => {
|
|
219
219
|
const s = new rxjs_1.Subject();
|
|
220
220
|
const completion = (0, deferred_1.defer)();
|
|
@@ -256,7 +256,7 @@ var useExistingStorage;
|
|
|
256
256
|
}
|
|
257
257
|
useExistingStorage.wrapService = wrapService;
|
|
258
258
|
function makeCaller(caller, objPath) {
|
|
259
|
-
const path =
|
|
259
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'useExistingStorage');
|
|
260
260
|
return (address, pass, progressCB) => {
|
|
261
261
|
const s = new rxjs_1.Subject();
|
|
262
262
|
const completion = (0, deferred_1.defer)();
|
|
@@ -76,7 +76,7 @@ var getAppLocalFS;
|
|
|
76
76
|
}
|
|
77
77
|
getAppLocalFS.wrapService = wrapService;
|
|
78
78
|
function makeCaller(caller, objPath) {
|
|
79
|
-
const path =
|
|
79
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getAppLocalFS');
|
|
80
80
|
return appName => caller
|
|
81
81
|
.startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
|
|
82
82
|
.then(buf => {
|
|
@@ -103,7 +103,7 @@ var getAppSyncedFS;
|
|
|
103
103
|
}
|
|
104
104
|
getAppSyncedFS.wrapService = wrapService;
|
|
105
105
|
function makeCaller(caller, objPath) {
|
|
106
|
-
const path =
|
|
106
|
+
const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getAppSyncedFS');
|
|
107
107
|
return appName => caller
|
|
108
108
|
.startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
|
|
109
109
|
.then(buf => {
|
|
@@ -130,7 +130,7 @@ var getSysFS;
|
|
|
130
130
|
}
|
|
131
131
|
getSysFS.wrapService = wrapService;
|
|
132
132
|
function makeCaller(caller, objPath) {
|
|
133
|
-
const ipcPath =
|
|
133
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'getSysFS');
|
|
134
134
|
return (type, path) => caller
|
|
135
135
|
.startPromiseCall(ipcPath, requestType.pack({
|
|
136
136
|
type, path: (0, protobuf_msg_1.toOptVal)(path)
|
|
@@ -159,7 +159,7 @@ var getUserFS;
|
|
|
159
159
|
}
|
|
160
160
|
getUserFS.wrapService = wrapService;
|
|
161
161
|
function makeCaller(caller, objPath) {
|
|
162
|
-
const ipcPath =
|
|
162
|
+
const ipcPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'getUserFS');
|
|
163
163
|
return (type, path) => caller
|
|
164
164
|
.startPromiseCall(ipcPath, requestType.pack({
|
|
165
165
|
type, path: (0, protobuf_msg_1.toOptVal)(path)
|
|
@@ -71,6 +71,7 @@ class NodesContainer {
|
|
|
71
71
|
}
|
|
72
72
|
})();
|
|
73
73
|
this.promises.set(objId, envelopedPromise);
|
|
74
|
+
envelopedPromise.catch(noop);
|
|
74
75
|
}
|
|
75
76
|
delete(node) {
|
|
76
77
|
const existing = this.get(node.objId);
|
|
@@ -93,6 +94,7 @@ class NodesContainer {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
exports.NodesContainer = NodesContainer;
|
|
97
|
+
function noop() { }
|
|
96
98
|
function wrapStorageImplementation(impl) {
|
|
97
99
|
const wrap = {
|
|
98
100
|
type: impl.type,
|
|
@@ -11,6 +11,7 @@ import { NodePersistance } from './node-persistence';
|
|
|
11
11
|
declare type FileByteSource = web3n.files.FileByteSource;
|
|
12
12
|
declare type FileByteSink = web3n.files.FileByteSink;
|
|
13
13
|
declare type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
14
|
+
declare type VersionedReadFlags = web3n.files.VersionedReadFlags;
|
|
14
15
|
interface FileAttrs {
|
|
15
16
|
attrs: CommonAttrs;
|
|
16
17
|
size: number;
|
|
@@ -19,14 +20,8 @@ interface FileAttrs {
|
|
|
19
20
|
declare class FilePersistance extends NodePersistance {
|
|
20
21
|
constructor(zNonce: Uint8Array, key: Uint8Array, cryptor: AsyncSBoxCryptor);
|
|
21
22
|
getAttrs(objSrc: ObjSource): Promise<FileAttrs>;
|
|
22
|
-
getFileSource(objSrc: ObjSource
|
|
23
|
-
|
|
24
|
-
fileAttrs?: FileAttrs;
|
|
25
|
-
}>;
|
|
26
|
-
readBytes(objSrc: ObjSource, start: number | undefined, end: number | undefined, getAttrs?: boolean): Promise<{
|
|
27
|
-
bytes?: Uint8Array;
|
|
28
|
-
fileAttrs?: FileAttrs;
|
|
29
|
-
}>;
|
|
23
|
+
getFileSource(objSrc: ObjSource): Promise<FileByteSource>;
|
|
24
|
+
readBytes(objSrc: ObjSource, start: number | undefined, end: number | undefined): Promise<Uint8Array | undefined>;
|
|
30
25
|
saveBytes(bytes: Uint8Array | Uint8Array[], version: number, attrs: CommonAttrs, xattrs: XAttrs | undefined): Promise<Subscribe>;
|
|
31
26
|
getFileSink(version: number, attrs: CommonAttrs, xattrs: XAttrs | undefined, base: ObjSource | undefined): Promise<{
|
|
32
27
|
sinkPromise: Promise<FileByteSink>;
|
|
@@ -48,11 +43,11 @@ export declare class FileNode extends NodeInFS<FilePersistance> {
|
|
|
48
43
|
protected setCurrentStateFrom(src: ObjSource): Promise<void>;
|
|
49
44
|
private setUpdatedState;
|
|
50
45
|
get size(): number;
|
|
51
|
-
readSrc(): Promise<{
|
|
46
|
+
readSrc(flags: VersionedReadFlags | undefined): Promise<{
|
|
52
47
|
src: FileByteSource;
|
|
53
48
|
version: number;
|
|
54
49
|
}>;
|
|
55
|
-
readBytes(start: number | undefined, end: number | undefined): Promise<{
|
|
50
|
+
readBytes(start: number | undefined, end: number | undefined, flags: VersionedReadFlags | undefined): Promise<{
|
|
56
51
|
bytes: Uint8Array | undefined;
|
|
57
52
|
version: number;
|
|
58
53
|
}>;
|
|
@@ -43,14 +43,11 @@ class FilePersistance extends node_persistence_1.NodePersistance {
|
|
|
43
43
|
const payload = await super.readonlyPayload(objSrc);
|
|
44
44
|
return await fileAttrsFrom(payload);
|
|
45
45
|
}
|
|
46
|
-
async getFileSource(objSrc
|
|
46
|
+
async getFileSource(objSrc) {
|
|
47
47
|
const payload = await this.readonlyPayload(objSrc);
|
|
48
|
-
|
|
49
|
-
return (getAttrs ?
|
|
50
|
-
{ src, fileAttrs: await fileAttrsFrom(payload) } :
|
|
51
|
-
{ src });
|
|
48
|
+
return payload.makeFileByteSource();
|
|
52
49
|
}
|
|
53
|
-
async readBytes(objSrc, start, end
|
|
50
|
+
async readBytes(objSrc, start, end) {
|
|
54
51
|
if ((typeof start === 'number') && (start < 0)) {
|
|
55
52
|
throw new Error(`Parameter start has bad value: ${start}`);
|
|
56
53
|
}
|
|
@@ -64,22 +61,18 @@ class FilePersistance extends node_persistence_1.NodePersistance {
|
|
|
64
61
|
end = size;
|
|
65
62
|
}
|
|
66
63
|
else if (start >= size) {
|
|
67
|
-
return
|
|
64
|
+
return;
|
|
68
65
|
}
|
|
69
66
|
if (typeof end === 'number') {
|
|
70
67
|
end = Math.min(size, end);
|
|
71
68
|
if (end <= start) {
|
|
72
|
-
return
|
|
73
|
-
{ fileAttrs: await fileAttrsFrom(payload) } : {});
|
|
69
|
+
return;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
else {
|
|
77
73
|
end = size;
|
|
78
74
|
}
|
|
79
|
-
|
|
80
|
-
return (getAttrs ?
|
|
81
|
-
{ bytes, fileAttrs: await fileAttrsFrom(payload) } :
|
|
82
|
-
{ bytes });
|
|
75
|
+
return await payload.readSomeContentBytes(start, end);
|
|
83
76
|
}
|
|
84
77
|
async saveBytes(bytes, version, attrs, xattrs) {
|
|
85
78
|
return super.writeWhole(bytes, version, attrs, xattrs);
|
|
@@ -139,45 +132,33 @@ class FileNode extends node_in_fs_1.NodeInFS {
|
|
|
139
132
|
get size() {
|
|
140
133
|
return this.fileSize;
|
|
141
134
|
}
|
|
142
|
-
async readSrc() {
|
|
143
|
-
const objSrc = await this.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return { src, version };
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
const { src } = await this.crypto.getFileSource(objSrc);
|
|
153
|
-
return { src, version };
|
|
154
|
-
}
|
|
135
|
+
async readSrc(flags) {
|
|
136
|
+
const objSrc = await this.getObjSrcOfVersion(flags);
|
|
137
|
+
let version;
|
|
138
|
+
if ((this.storage.type === 'synced')
|
|
139
|
+
|| (this.storage.type === 'local')
|
|
140
|
+
|| (this.storage.type === 'share')) {
|
|
141
|
+
version = objSrc.version;
|
|
155
142
|
}
|
|
156
143
|
else {
|
|
157
|
-
|
|
158
|
-
// unversioned storage passes undefined version
|
|
159
|
-
return { src, version: undefined };
|
|
144
|
+
version = undefined;
|
|
160
145
|
}
|
|
146
|
+
const src = await this.crypto.getFileSource(objSrc);
|
|
147
|
+
return { src, version };
|
|
161
148
|
}
|
|
162
|
-
async readBytes(start, end) {
|
|
163
|
-
const objSrc = await this.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return { bytes, version };
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
const { bytes } = await this.crypto.readBytes(objSrc, start, end);
|
|
173
|
-
return { bytes, version };
|
|
174
|
-
}
|
|
149
|
+
async readBytes(start, end, flags) {
|
|
150
|
+
const objSrc = await this.getObjSrcOfVersion(flags);
|
|
151
|
+
let version;
|
|
152
|
+
if ((this.storage.type === 'synced')
|
|
153
|
+
|| (this.storage.type === 'local')
|
|
154
|
+
|| (this.storage.type === 'share')) {
|
|
155
|
+
version = objSrc.version;
|
|
175
156
|
}
|
|
176
157
|
else {
|
|
177
|
-
|
|
178
|
-
// unversioned storage passes undefined version
|
|
179
|
-
return { bytes, version: undefined };
|
|
158
|
+
version = undefined;
|
|
180
159
|
}
|
|
160
|
+
const bytes = await this.crypto.readBytes(objSrc, start, end);
|
|
161
|
+
return { bytes, version };
|
|
181
162
|
}
|
|
182
163
|
async writeSink(truncate, currentVersion, changes) {
|
|
183
164
|
const deferredSink = (0, deferred_1.defer)();
|
|
@@ -15,6 +15,7 @@ declare type SyncStatus = web3n.files.SyncStatus;
|
|
|
15
15
|
declare type WritableFileVersionedAPI = web3n.files.WritableFileVersionedAPI;
|
|
16
16
|
declare type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
|
|
17
17
|
declare type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
|
|
18
|
+
declare type VersionedReadFlags = web3n.files.VersionedReadFlags;
|
|
18
19
|
export declare class FileObject implements WritableFile, Linkable {
|
|
19
20
|
name: string;
|
|
20
21
|
isNew: boolean;
|
|
@@ -54,11 +55,11 @@ declare class V implements WritableFileVersionedAPI, N {
|
|
|
54
55
|
getNode(): Promise<FileNode>;
|
|
55
56
|
ensureIsWritable(): void;
|
|
56
57
|
updateXAttrs(changes: XAttrsChanges): Promise<number>;
|
|
57
|
-
getXAttr(xaName: string): Promise<{
|
|
58
|
+
getXAttr(xaName: string, flags?: VersionedReadFlags): Promise<{
|
|
58
59
|
attr: any;
|
|
59
60
|
version: number;
|
|
60
61
|
}>;
|
|
61
|
-
listXAttrs(): Promise<{
|
|
62
|
+
listXAttrs(flags?: VersionedReadFlags): Promise<{
|
|
62
63
|
lst: string[];
|
|
63
64
|
version: number;
|
|
64
65
|
}>;
|
|
@@ -67,23 +68,23 @@ declare class V implements WritableFileVersionedAPI, N {
|
|
|
67
68
|
sink: FileByteSink;
|
|
68
69
|
version: number;
|
|
69
70
|
}>;
|
|
70
|
-
getByteSource(): Promise<{
|
|
71
|
+
getByteSource(flags?: VersionedReadFlags): Promise<{
|
|
71
72
|
src: FileByteSource;
|
|
72
73
|
version: number;
|
|
73
74
|
}>;
|
|
74
75
|
writeBytes(bytes: Uint8Array): Promise<number>;
|
|
75
76
|
writeTxt(txt: string): Promise<number>;
|
|
76
77
|
writeJSON(json: any): Promise<number>;
|
|
77
|
-
readBytes(start?: number, end?: number): Promise<{
|
|
78
|
+
readBytes(start?: number, end?: number, flags?: VersionedReadFlags): Promise<{
|
|
78
79
|
bytes: Uint8Array | undefined;
|
|
79
80
|
version: number;
|
|
80
81
|
}>;
|
|
81
|
-
readTxt(): Promise<{
|
|
82
|
+
readTxt(flags?: VersionedReadFlags): Promise<{
|
|
82
83
|
txt: string;
|
|
83
84
|
version: number;
|
|
84
85
|
}>;
|
|
85
86
|
copy(file: File): Promise<number>;
|
|
86
|
-
readJSON<T>(): Promise<{
|
|
87
|
+
readJSON<T>(flags?: VersionedReadFlags): Promise<{
|
|
87
88
|
json: T;
|
|
88
89
|
version: number;
|
|
89
90
|
}>;
|
|
@@ -96,7 +97,7 @@ declare class V implements WritableFileVersionedAPI, N {
|
|
|
96
97
|
declare class S implements WritableFileSyncAPI {
|
|
97
98
|
private readonly n;
|
|
98
99
|
constructor(n: N);
|
|
99
|
-
upload(opts?: OptionsToUploadLocal): Promise<
|
|
100
|
+
upload(opts?: OptionsToUploadLocal): Promise<number | undefined>;
|
|
100
101
|
status(): Promise<SyncStatus>;
|
|
101
102
|
updateStatusInfo(): Promise<SyncStatus>;
|
|
102
103
|
isRemoteVersionOnDisk(version: number): Promise<'complete' | 'partial' | 'none'>;
|
|
@@ -148,19 +148,13 @@ class V {
|
|
|
148
148
|
const node = await this.getNode();
|
|
149
149
|
return node.updateXAttrs(changes);
|
|
150
150
|
}
|
|
151
|
-
async getXAttr(xaName) {
|
|
151
|
+
async getXAttr(xaName, flags) {
|
|
152
152
|
const node = await this.getNode();
|
|
153
|
-
return
|
|
154
|
-
attr: node.getXAttr(xaName),
|
|
155
|
-
version: node.version
|
|
156
|
-
};
|
|
153
|
+
return await node.getXAttr(xaName, flags);
|
|
157
154
|
}
|
|
158
|
-
async listXAttrs() {
|
|
155
|
+
async listXAttrs(flags) {
|
|
159
156
|
const node = await this.getNode();
|
|
160
|
-
return
|
|
161
|
-
lst: node.listXAttrs(),
|
|
162
|
-
version: node.version
|
|
163
|
-
};
|
|
157
|
+
return await node.listXAttrs(flags);
|
|
164
158
|
}
|
|
165
159
|
async getLinkParams() {
|
|
166
160
|
if (!this.node) {
|
|
@@ -176,11 +170,11 @@ class V {
|
|
|
176
170
|
const node = await this.getNode();
|
|
177
171
|
return node.writeSink(truncate, currentVersion);
|
|
178
172
|
}
|
|
179
|
-
async getByteSource() {
|
|
173
|
+
async getByteSource(flags) {
|
|
180
174
|
if (!this.node) {
|
|
181
175
|
throw (0, file_1.makeFileException)('notFound', this.name);
|
|
182
176
|
}
|
|
183
|
-
return this.node.readSrc();
|
|
177
|
+
return this.node.readSrc(flags);
|
|
184
178
|
}
|
|
185
179
|
async writeBytes(bytes) {
|
|
186
180
|
this.ensureIsWritable();
|
|
@@ -194,14 +188,14 @@ class V {
|
|
|
194
188
|
writeJSON(json) {
|
|
195
189
|
return this.writeTxt(JSON.stringify(json));
|
|
196
190
|
}
|
|
197
|
-
async readBytes(start, end) {
|
|
191
|
+
async readBytes(start, end, flags) {
|
|
198
192
|
if (!this.node) {
|
|
199
193
|
throw (0, file_1.makeFileException)('notFound', this.name);
|
|
200
194
|
}
|
|
201
|
-
return await this.node.readBytes(start, end);
|
|
195
|
+
return await this.node.readBytes(start, end, flags);
|
|
202
196
|
}
|
|
203
|
-
async readTxt() {
|
|
204
|
-
const { bytes, version } = await this.readBytes();
|
|
197
|
+
async readTxt(flags) {
|
|
198
|
+
const { bytes, version } = await this.readBytes(undefined, undefined, flags);
|
|
205
199
|
const txt = (bytes ? buffer_utils_1.utf8.open(bytes) : '');
|
|
206
200
|
return { txt, version };
|
|
207
201
|
}
|
|
@@ -212,8 +206,8 @@ class V {
|
|
|
212
206
|
await (0, pipe_1.pipe)(src, sink);
|
|
213
207
|
return version;
|
|
214
208
|
}
|
|
215
|
-
async readJSON() {
|
|
216
|
-
const { txt, version } = await this.readTxt();
|
|
209
|
+
async readJSON(flags) {
|
|
210
|
+
const { txt, version } = await this.readTxt(flags);
|
|
217
211
|
const json = JSON.parse(txt);
|
|
218
212
|
return { json, version };
|
|
219
213
|
}
|
|
@@ -12,6 +12,7 @@ declare type FolderDiff = web3n.files.FolderDiff;
|
|
|
12
12
|
declare type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
|
|
13
13
|
declare type OptionsToAdoptRemoteItem = web3n.files.OptionsToAdoptRemoteItem;
|
|
14
14
|
declare type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
|
|
15
|
+
declare type VersionedReadFlags = web3n.files.VersionedReadFlags;
|
|
15
16
|
export interface NodeInfo {
|
|
16
17
|
/**
|
|
17
18
|
* This is a usual file name.
|
|
@@ -80,6 +81,10 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
80
81
|
lst: ListingEntry[];
|
|
81
82
|
version: number;
|
|
82
83
|
};
|
|
84
|
+
listNonCurrent(flags: VersionedReadFlags): Promise<{
|
|
85
|
+
lst: ListingEntry[];
|
|
86
|
+
version: number;
|
|
87
|
+
}>;
|
|
83
88
|
childExistsInSyncedVersion(childObjId: string): Promise<boolean>;
|
|
84
89
|
getNodeInfo(name: string, undefOnMissing?: boolean): NodeInfo | undefined;
|
|
85
90
|
hasChild(childName: string, throwIfMissing?: boolean): boolean;
|
|
@@ -137,7 +142,7 @@ export declare class FolderNode extends NodeInFS<FolderPersistance> {
|
|
|
137
142
|
private removeChildrenObjsInSyncedStorage;
|
|
138
143
|
private uploadRemovalOfObjs;
|
|
139
144
|
getParamsForLink(): LinkParameters<FolderLinkParams>;
|
|
140
|
-
upload(opts: OptionsToUploadLocal | undefined): Promise<
|
|
145
|
+
upload(opts: OptionsToUploadLocal | undefined): Promise<number | undefined>;
|
|
141
146
|
private uploadRemovalOf;
|
|
142
147
|
private listRemovedInTreeToUploadRm;
|
|
143
148
|
protected needUpload(localVersion: number | undefined): Promise<{
|
|
@@ -224,6 +224,13 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
224
224
|
.map(nodeInfoToListingEntry);
|
|
225
225
|
return { lst, version: this.version };
|
|
226
226
|
}
|
|
227
|
+
async listNonCurrent(flags) {
|
|
228
|
+
const src = await this.getObjSrcOfVersion(flags);
|
|
229
|
+
const { folderInfo } = await this.crypto.read(src);
|
|
230
|
+
const lst = Object.values(folderInfo)
|
|
231
|
+
.map(nodeInfoToListingEntry);
|
|
232
|
+
return { lst, version: src.version };
|
|
233
|
+
}
|
|
227
234
|
async childExistsInSyncedVersion(childObjId) {
|
|
228
235
|
const { state, synced } = await this.syncStatus();
|
|
229
236
|
if (state === 'synced') {
|
|
@@ -304,14 +311,14 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
304
311
|
throw new Error(`Unknown type of fs node`);
|
|
305
312
|
}
|
|
306
313
|
deferred.resolve(node);
|
|
307
|
-
return
|
|
314
|
+
return deferred.promise;
|
|
308
315
|
}
|
|
309
316
|
catch (exc) {
|
|
310
|
-
deferred.reject(exc);
|
|
311
317
|
if (exc.objNotFound) {
|
|
312
318
|
await this.fixMissingChildAndThrow(exc, info);
|
|
313
319
|
}
|
|
314
|
-
|
|
320
|
+
deferred.reject((0, error_1.errWithCause)(exc, `Failed to instantiate fs node '${this.name}/${info.name}'`));
|
|
321
|
+
return deferred.promise;
|
|
315
322
|
}
|
|
316
323
|
}
|
|
317
324
|
getFolder(name, undefOnMissing = false) {
|
|
@@ -658,11 +665,14 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
658
665
|
}
|
|
659
666
|
async removeFolderObj(src, passIdsForRmUpload = false) {
|
|
660
667
|
const childrenNodes = await this.doChange(true, async () => {
|
|
668
|
+
if (this.version < 0) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
661
671
|
const childrenNodes = await this.getAllNodes();
|
|
662
|
-
await this.
|
|
672
|
+
await this.removeThisFromStorageNodes(src);
|
|
663
673
|
return childrenNodes;
|
|
664
674
|
});
|
|
665
|
-
if (childrenNodes.length === 0) {
|
|
675
|
+
if (!childrenNodes || (childrenNodes.length === 0)) {
|
|
666
676
|
return;
|
|
667
677
|
}
|
|
668
678
|
if (this.isInSyncedStorage) {
|
|
@@ -683,6 +693,9 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
683
693
|
}
|
|
684
694
|
}
|
|
685
695
|
async removeChildrenObjsInSyncedStorage(childrenNodes, src, passIdsForRmUpload) {
|
|
696
|
+
if (this.version < 0) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
686
699
|
let uploadRmsHere;
|
|
687
700
|
let collectedIds;
|
|
688
701
|
if (passIdsForRmUpload) {
|
|
@@ -764,8 +777,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
764
777
|
return;
|
|
765
778
|
}
|
|
766
779
|
if (toUpload.createOnRemote) {
|
|
767
|
-
await super.upload(opts);
|
|
768
|
-
return;
|
|
780
|
+
return await super.upload(opts);
|
|
769
781
|
}
|
|
770
782
|
const storage = this.syncedStorage();
|
|
771
783
|
const { localVersion, uploadVersion } = toUpload;
|
|
@@ -777,13 +789,13 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
777
789
|
// we also don't await for chidren removal
|
|
778
790
|
this.uploadRemovalOf(removedNodes);
|
|
779
791
|
}
|
|
792
|
+
return uploadVersion;
|
|
780
793
|
}
|
|
781
794
|
catch (exc) {
|
|
782
795
|
throw (0, common_1.setPathInExc)(exc, this.name);
|
|
783
796
|
}
|
|
784
797
|
}
|
|
785
798
|
async uploadRemovalOf(removedNodes) {
|
|
786
|
-
const storage = this.syncedStorage();
|
|
787
799
|
const rmObjs = [];
|
|
788
800
|
for (const node of removedNodes) {
|
|
789
801
|
(0, for_arrays_1.appendArray)(rmObjs, await this.listRemovedInTreeToUploadRm(node));
|
|
@@ -21,6 +21,7 @@ declare type FSCollection = web3n.files.FSCollection;
|
|
|
21
21
|
declare type FileFlags = web3n.files.FileFlags;
|
|
22
22
|
declare type FileByteSource = web3n.files.FileByteSource;
|
|
23
23
|
declare type FileByteSink = web3n.files.FileByteSink;
|
|
24
|
+
declare type VersionedReadFlags = web3n.files.VersionedReadFlags;
|
|
24
25
|
declare type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
25
26
|
declare type WritableFSSyncAPI = web3n.files.WritableFSSyncAPI;
|
|
26
27
|
declare type SyncStatus = web3n.files.SyncStatus;
|
|
@@ -39,7 +40,7 @@ export declare class XspFS implements WritableFS {
|
|
|
39
40
|
private constructor();
|
|
40
41
|
private storage;
|
|
41
42
|
readonlySubRoot(path: string): Promise<ReadonlyFS>;
|
|
42
|
-
writableSubRoot(path: string, flags?: web3n.files.
|
|
43
|
+
writableSubRoot(path: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<WritableFS>;
|
|
43
44
|
/**
|
|
44
45
|
* This creates in a root object in a given storage, returning fs object
|
|
45
46
|
* representing created root.
|
|
@@ -88,7 +89,7 @@ export declare class XspFS implements WritableFS {
|
|
|
88
89
|
watchFile(path: string, observer: Observer<FileEvent>): () => void;
|
|
89
90
|
watchTree(path: string, depth: number | undefined, observer: Observer<FolderEvent | FileEvent>): () => void;
|
|
90
91
|
readonlyFile(path: string): Promise<ReadonlyFile>;
|
|
91
|
-
writableFile(path: string, flags?: web3n.files.
|
|
92
|
+
writableFile(path: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<WritableFile>;
|
|
92
93
|
copyFile(src: string, dst: string, overwrite?: boolean): Promise<void>;
|
|
93
94
|
saveFile(file: File, dst: string, overwrite?: boolean): Promise<void>;
|
|
94
95
|
listFolder(folder: string): Promise<ListingEntry[]>;
|
|
@@ -96,10 +97,10 @@ export declare class XspFS implements WritableFS {
|
|
|
96
97
|
readTxtFile(path: string): Promise<string>;
|
|
97
98
|
readBytes(path: string, start?: number, end?: number): Promise<Uint8Array | undefined>;
|
|
98
99
|
getByteSource(path: string): Promise<FileByteSource>;
|
|
99
|
-
writeJSONFile(path: string, json: any, flags?: web3n.files.
|
|
100
|
-
writeTxtFile(path: string, txt: string, flags?: web3n.files.
|
|
101
|
-
writeBytes(path: string, bytes: Uint8Array, flags?: web3n.files.
|
|
102
|
-
getByteSink(path: string, flags?: web3n.files.
|
|
100
|
+
writeJSONFile(path: string, json: any, flags?: web3n.files.VersionedFileWriteFlags): Promise<void>;
|
|
101
|
+
writeTxtFile(path: string, txt: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<void>;
|
|
102
|
+
writeBytes(path: string, bytes: Uint8Array, flags?: web3n.files.VersionedFileWriteFlags): Promise<void>;
|
|
103
|
+
getByteSink(path: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<FileByteSink>;
|
|
103
104
|
}
|
|
104
105
|
interface N {
|
|
105
106
|
get(path: string): Promise<NodeInFS<any>>;
|
|
@@ -121,38 +122,38 @@ declare class V implements WritableFSVersionedAPI, N {
|
|
|
121
122
|
get(path: string): Promise<NodeInFS<any>>;
|
|
122
123
|
ensureIsWritable(): void;
|
|
123
124
|
updateXAttrs(path: string, changes: XAttrsChanges): Promise<number>;
|
|
124
|
-
getXAttr(path: string, xaName: string): Promise<{
|
|
125
|
+
getXAttr(path: string, xaName: string, flags?: VersionedReadFlags): Promise<{
|
|
125
126
|
attr: any;
|
|
126
127
|
version: number;
|
|
127
128
|
}>;
|
|
128
|
-
listXAttrs(path: string): Promise<{
|
|
129
|
+
listXAttrs(path: string, flags?: VersionedReadFlags): Promise<{
|
|
129
130
|
lst: string[];
|
|
130
131
|
version: number;
|
|
131
132
|
}>;
|
|
132
|
-
listFolder(path: string): Promise<{
|
|
133
|
+
listFolder(path: string, flags?: VersionedReadFlags): Promise<{
|
|
133
134
|
lst: ListingEntry[];
|
|
134
135
|
version: number;
|
|
135
136
|
}>;
|
|
136
|
-
writeBytes(path: string, bytes: Uint8Array, flags?: web3n.files.
|
|
137
|
-
readBytes(path: string, start?: number, end?: number): Promise<{
|
|
137
|
+
writeBytes(path: string, bytes: Uint8Array, flags?: web3n.files.VersionedFileWriteFlags): Promise<number>;
|
|
138
|
+
readBytes(path: string, start?: number, end?: number, flags?: VersionedReadFlags): Promise<{
|
|
138
139
|
bytes: Uint8Array | undefined;
|
|
139
140
|
version: number;
|
|
140
141
|
}>;
|
|
141
|
-
writeTxtFile(path: string, txt: string, flags?: web3n.files.
|
|
142
|
-
readTxtFile(path: string): Promise<{
|
|
142
|
+
writeTxtFile(path: string, txt: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<number>;
|
|
143
|
+
readTxtFile(path: string, flags?: VersionedReadFlags): Promise<{
|
|
143
144
|
txt: string;
|
|
144
145
|
version: number;
|
|
145
146
|
}>;
|
|
146
|
-
writeJSONFile(path: string, json: any, flags?: web3n.files.
|
|
147
|
-
readJSONFile<T>(path: string): Promise<{
|
|
147
|
+
writeJSONFile(path: string, json: any, flags?: web3n.files.VersionedFileWriteFlags): Promise<number>;
|
|
148
|
+
readJSONFile<T>(path: string, flags?: VersionedReadFlags): Promise<{
|
|
148
149
|
json: T;
|
|
149
150
|
version: number;
|
|
150
151
|
}>;
|
|
151
|
-
getByteSink(path: string, flags?: web3n.files.
|
|
152
|
+
getByteSink(path: string, flags?: web3n.files.VersionedFileWriteFlags): Promise<{
|
|
152
153
|
sink: FileByteSink;
|
|
153
154
|
version: number;
|
|
154
155
|
}>;
|
|
155
|
-
getByteSource(path: string): Promise<{
|
|
156
|
+
getByteSource(path: string, flags?: VersionedReadFlags): Promise<{
|
|
156
157
|
src: FileByteSource;
|
|
157
158
|
version: number;
|
|
158
159
|
}>;
|
|
@@ -160,7 +161,7 @@ declare class V implements WritableFSVersionedAPI, N {
|
|
|
160
161
|
declare class S implements WritableFSSyncAPI {
|
|
161
162
|
private readonly n;
|
|
162
163
|
constructor(n: N);
|
|
163
|
-
upload(path: string, opts?: OptionsToUploadLocal): Promise<
|
|
164
|
+
upload(path: string, opts?: OptionsToUploadLocal): Promise<number | undefined>;
|
|
164
165
|
status(path: string): Promise<SyncStatus>;
|
|
165
166
|
updateStatusInfo(path: string): Promise<SyncStatus>;
|
|
166
167
|
isRemoteVersionOnDisk(path: string, version: number): Promise<'complete' | 'partial' | 'none'>;
|