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.
Files changed (45) hide show
  1. package/build/api-defs/files.d.ts +52 -19
  2. package/build/core/asmail/config/index.d.ts +2 -2
  3. package/build/core/asmail/config/index.js +2 -2
  4. package/build/core/asmail/config/invitations-anon.d.ts +10 -24
  5. package/build/core/asmail/config/invitations-anon.js +43 -31
  6. package/build/core/asmail/config/published-intro-key.d.ts +11 -22
  7. package/build/core/asmail/config/published-intro-key.js +47 -38
  8. package/build/core/asmail/inbox/index.js +1 -1
  9. package/build/core/asmail/index.d.ts +1 -1
  10. package/build/core/asmail/index.js +2 -2
  11. package/build/core/asmail/keyring/correspondent-keys.d.ts +2 -2
  12. package/build/core/asmail/keyring/correspondent-keys.js +1 -1
  13. package/build/core/asmail/keyring/index.d.ts +9 -29
  14. package/build/core/asmail/keyring/index.js +82 -69
  15. package/build/core/index.js +1 -2
  16. package/build/core/sign-in.js +1 -1
  17. package/build/core/storage/synced/obj-files.d.ts +2 -0
  18. package/build/core/storage/synced/obj-files.js +18 -1
  19. package/build/core/storage/synced/obj-status.d.ts +1 -0
  20. package/build/core/storage/synced/obj-status.js +10 -0
  21. package/build/core/storage/synced/storage.js +4 -21
  22. package/build/ipc-via-protobuf/file.d.ts +7 -0
  23. package/build/ipc-via-protobuf/file.js +60 -27
  24. package/build/ipc-via-protobuf/fs.js +55 -38
  25. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +5 -10
  26. package/build/lib-client/3nstorage/xsp-fs/file-node.js +43 -45
  27. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +7 -6
  28. package/build/lib-client/3nstorage/xsp-fs/file.js +12 -18
  29. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +5 -0
  30. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +7 -1
  31. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +18 -17
  32. package/build/lib-client/3nstorage/xsp-fs/fs.js +17 -18
  33. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +11 -2
  34. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +56 -5
  35. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  36. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  37. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +5 -2
  38. package/build/lib-client/objs-on-disk/obj-on-disk.js +16 -1
  39. package/build/lib-common/objs-on-disk/file-layout.js +1 -1
  40. package/build/protos/asmail.proto.js +5943 -4348
  41. package/build/protos/file.proto.js +874 -0
  42. package/build/protos/fs.proto.js +7014 -5419
  43. package/package.json +1 -1
  44. package/protos/file.proto +23 -7
  45. package/protos/fs.proto +27 -13
@@ -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): Promise<InitDownloadParts>;
44
- getSegs(objId: ObjId, version: number, start: number, end: number): Promise<Uint8Array>;
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 } : { size: 0, isEndless: true });
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);
@@ -83,7 +83,7 @@ class ObjVersionBytesLayout {
83
83
  isFileComplete() {
84
84
  for (const chunk of this.segsChunks) {
85
85
  if ((chunk.type === 'new') || (chunk.type === 'new-endless')) {
86
- return true;
86
+ return false;
87
87
  }
88
88
  }
89
89
  return true;