core-3nweb-client-lib 0.27.3 → 0.27.4
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 +52 -19
- 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/inbox/index.js +1 -1
- package/build/core/asmail/index.d.ts +1 -1
- package/build/core/asmail/index.js +2 -2
- package/build/core/asmail/keyring/correspondent-keys.d.ts +2 -2
- package/build/core/asmail/keyring/correspondent-keys.js +1 -1
- package/build/core/asmail/keyring/index.d.ts +9 -29
- package/build/core/asmail/keyring/index.js +82 -69
- package/build/core/index.js +1 -2
- package/build/core/sign-in.js +1 -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 +4 -21
- package/build/ipc-via-protobuf/file.d.ts +7 -0
- package/build/ipc-via-protobuf/file.js +60 -27
- package/build/ipc-via-protobuf/fs.js +55 -38
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +5 -10
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +43 -45
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +7 -6
- package/build/lib-client/3nstorage/xsp-fs/file.js +12 -18
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +5 -0
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +7 -1
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +18 -17
- package/build/lib-client/3nstorage/xsp-fs/fs.js +17 -18
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +11 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +56 -5
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- 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 +16 -1
- package/build/lib-common/objs-on-disk/file-layout.js +1 -1
- package/build/protos/asmail.proto.js +5943 -4348
- package/build/protos/file.proto.js +874 -0
- package/build/protos/fs.proto.js +7014 -5419
- package/package.json +1 -1
- package/protos/file.proto +23 -7
- package/protos/fs.proto +27 -13
|
Binary file
|
|
@@ -38,10 +38,13 @@ export declare class ObjOnDisk {
|
|
|
38
38
|
diff: DiffInfo;
|
|
39
39
|
newSegsPackOrder: FiniteChunk[];
|
|
40
40
|
};
|
|
41
|
+
private segsThatNeedDownload;
|
|
42
|
+
doesFileNeedDownload(): boolean;
|
|
43
|
+
downloadMissingSections(): Promise<void>;
|
|
41
44
|
}
|
|
42
45
|
export interface ObjDownloader {
|
|
43
|
-
getLayoutWithHeaderAndFirstSegs(objId: ObjId, version: number)
|
|
44
|
-
getSegs(objId: ObjId, version: number, start: number, end: number)
|
|
46
|
+
getLayoutWithHeaderAndFirstSegs: (objId: ObjId, version: number) => Promise<InitDownloadParts>;
|
|
47
|
+
getSegs: (objId: ObjId, version: number, start: number, end: number) => Promise<Uint8Array>;
|
|
45
48
|
}
|
|
46
49
|
export interface InitDownloadParts {
|
|
47
50
|
layout: Layout;
|
|
@@ -192,6 +192,20 @@ class ObjOnDisk {
|
|
|
192
192
|
diffFromBase() {
|
|
193
193
|
return this.objFile.diffFromBase();
|
|
194
194
|
}
|
|
195
|
+
segsThatNeedDownload() {
|
|
196
|
+
const totalLen = this.objFile.getTotalSegsLen();
|
|
197
|
+
const allSegs = this.objFile.segsLocations(0, totalLen);
|
|
198
|
+
return allSegs.filter(({ type }) => (type === 'new'));
|
|
199
|
+
}
|
|
200
|
+
doesFileNeedDownload() {
|
|
201
|
+
return (this.segsThatNeedDownload().length === 0);
|
|
202
|
+
}
|
|
203
|
+
async downloadMissingSections() {
|
|
204
|
+
const needDownload = this.segsThatNeedDownload();
|
|
205
|
+
for (const chunk of needDownload) {
|
|
206
|
+
await this.downloadAndSaveSegsChunk(chunk);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
195
209
|
}
|
|
196
210
|
exports.ObjOnDisk = ObjOnDisk;
|
|
197
211
|
Object.freeze(ObjOnDisk.prototype);
|
|
@@ -223,7 +237,8 @@ class ByteSourceFromObjOnDisk {
|
|
|
223
237
|
async getSize() {
|
|
224
238
|
const size = this.totalSegsLen();
|
|
225
239
|
return ((typeof size === 'number') ?
|
|
226
|
-
{ size, isEndless: false } :
|
|
240
|
+
{ size, isEndless: false } :
|
|
241
|
+
{ size: 0, isEndless: true });
|
|
227
242
|
}
|
|
228
243
|
async seek(offset) {
|
|
229
244
|
(0, assert_1.assert)(Number.isInteger(offset) && (offset >= 0), 'Illegal offset is given to seek: ' + offset);
|