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.
Files changed (102) hide show
  1. package/build/api-defs/files.d.ts +92 -29
  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/delivery/per-recipient-wip.js +2 -2
  9. package/build/core/asmail/inbox/inbox-events.js +10 -5
  10. package/build/core/asmail/inbox/index.d.ts +3 -2
  11. package/build/core/asmail/inbox/index.js +15 -11
  12. package/build/core/asmail/inbox/msg-indexing.d.ts +17 -64
  13. package/build/core/asmail/inbox/msg-indexing.js +440 -311
  14. package/build/core/asmail/inbox/msg-on-disk.js +2 -1
  15. package/build/core/asmail/index.d.ts +1 -1
  16. package/build/core/asmail/index.js +5 -4
  17. package/build/core/asmail/keyring/correspondent-keys.d.ts +2 -2
  18. package/build/core/asmail/keyring/correspondent-keys.js +4 -2
  19. package/build/core/asmail/keyring/index.d.ts +10 -33
  20. package/build/core/asmail/keyring/index.js +88 -75
  21. package/build/core/asmail/msg/opener.js +4 -3
  22. package/build/core/asmail/msg/packer.d.ts +1 -0
  23. package/build/core/asmail/msg/packer.js +8 -4
  24. package/build/core/index.js +3 -5
  25. package/build/core/sign-in.js +1 -1
  26. package/build/core/storage/local/obj-files.js +2 -1
  27. package/build/core/storage/synced/obj-files.d.ts +2 -0
  28. package/build/core/storage/synced/obj-files.js +18 -1
  29. package/build/core/storage/synced/obj-status.d.ts +1 -0
  30. package/build/core/storage/synced/obj-status.js +10 -0
  31. package/build/core/storage/synced/storage.js +7 -23
  32. package/build/core/storage/synced/upload-header-file.js +4 -2
  33. package/build/core/storage/synced/upsyncer.js +3 -5
  34. package/build/ipc-via-protobuf/asmail-cap.js +14 -15
  35. package/build/ipc-via-protobuf/bytes.js +42 -18
  36. package/build/ipc-via-protobuf/file.d.ts +7 -0
  37. package/build/ipc-via-protobuf/file.js +103 -66
  38. package/build/ipc-via-protobuf/fs.js +127 -105
  39. package/build/ipc-via-protobuf/mailerid.js +2 -2
  40. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  41. package/build/ipc-via-protobuf/protobuf-msg.js +5 -1
  42. package/build/ipc-via-protobuf/startup-cap.js +8 -8
  43. package/build/ipc-via-protobuf/storage-cap.js +4 -4
  44. package/build/lib-client/3nstorage/xsp-fs/common.js +2 -0
  45. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +5 -10
  46. package/build/lib-client/3nstorage/xsp-fs/file-node.js +26 -45
  47. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +8 -7
  48. package/build/lib-client/3nstorage/xsp-fs/file.js +12 -18
  49. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +6 -1
  50. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +20 -8
  51. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +19 -18
  52. package/build/lib-client/3nstorage/xsp-fs/fs.js +18 -19
  53. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +13 -4
  54. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +63 -8
  55. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -0
  56. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +7 -5
  57. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -4
  58. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +20 -15
  59. package/build/lib-client/cryptor/cryptor-in-worker.js +37 -47
  60. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  61. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  62. package/build/lib-client/cryptor/in-proc-js.js +15 -12
  63. package/build/lib-client/cryptor/in-proc-wasm.js +11 -8
  64. package/build/lib-client/cryptor/serialization-for-wasm.d.ts +36 -0
  65. package/build/lib-client/cryptor/serialization-for-wasm.js +58 -0
  66. package/build/lib-client/cryptor-work-labels.d.ts +26 -0
  67. package/build/lib-client/cryptor-work-labels.js +152 -0
  68. package/build/lib-client/fs-sync-utils.d.ts +7 -1
  69. package/build/lib-client/fs-sync-utils.js +18 -7
  70. package/build/lib-client/local-files/dev-file-src.d.ts +2 -1
  71. package/build/lib-client/local-files/dev-file-src.js +5 -1
  72. package/build/lib-client/local-files/device-fs.js +2 -1
  73. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +5 -2
  74. package/build/lib-client/objs-on-disk/obj-on-disk.js +21 -2
  75. package/build/lib-client/request-utils.js +14 -14
  76. package/build/lib-common/async-cryptor-wrap.d.ts +9 -9
  77. package/build/lib-common/async-cryptor-wrap.js +13 -13
  78. package/build/lib-common/byte-streaming/pipe.d.ts +1 -1
  79. package/build/lib-common/byte-streaming/pipe.js +3 -3
  80. package/build/lib-common/byte-streaming/wrapping.js +4 -2
  81. package/build/lib-common/json-utils.js +0 -3
  82. package/build/lib-common/objs-on-disk/file-layout.js +1 -1
  83. package/build/lib-common/processes/synced.js +0 -184
  84. package/build/lib-sqlite-on-3nstorage/index.d.ts +32 -0
  85. package/build/lib-sqlite-on-3nstorage/index.js +117 -0
  86. package/build/lib-sqlite-on-3nstorage/sqljs.d.ts +279 -0
  87. package/build/lib-sqlite-on-3nstorage/sqljs.js +223 -0
  88. package/build/protos/asmail.proto.js +10145 -5923
  89. package/build/protos/bytes.proto.js +731 -204
  90. package/build/protos/common.proto.js +192 -44
  91. package/build/protos/cryptor.proto.js +184 -61
  92. package/build/protos/file.proto.js +2388 -502
  93. package/build/protos/fs.proto.js +9894 -6046
  94. package/build/protos/ipc.proto.js +244 -61
  95. package/build/protos/logger.proto.js +219 -53
  96. package/build/protos/mailerid.proto.js +230 -50
  97. package/build/protos/startup.proto.js +341 -77
  98. package/build/protos/storage.proto.js +276 -62
  99. package/package.json +8 -7
  100. package/protos/bytes.proto +13 -4
  101. package/protos/file.proto +27 -8
  102. package/protos/fs.proto +31 -14
@@ -26,6 +26,7 @@ const buffer_utils_1 = require("../../../lib-common/buffer-utils");
26
26
  const xsp_files_1 = require("xsp-files");
27
27
  const remote_events_1 = require("./remote-events");
28
28
  const upsyncer_1 = require("./upsyncer");
29
+ const rxjs_1 = require("rxjs");
29
30
  const utils_for_observables_1 = require("../../../lib-common/utils-for-observables");
30
31
  class SyncedStore {
31
32
  constructor(files, remoteStorage, getStorages, cryptor, logError) {
@@ -47,8 +48,6 @@ class SyncedStore {
47
48
  const objFiles = await obj_files_1.ObjFiles.makeFor(path, remote, logError);
48
49
  const s = new SyncedStore(objFiles, remote, getStorages, cryptor, logError);
49
50
  s.uploader.start();
50
- // XXX ??
51
- // s.remoteEvents.startAbsorbingRemoteEvents();
52
51
  return {
53
52
  syncedStore: (0, common_1.wrapSyncStorageImplementation)(s),
54
53
  startObjProcs: () => {
@@ -60,8 +59,6 @@ class SyncedStore {
60
59
  const { remote, setMid } = service_1.StorageOwner.makeBeforeMidSetup(user, remoteServiceUrl, net);
61
60
  const objFiles = await obj_files_1.ObjFiles.makeFor(path, remote, logError);
62
61
  const s = new SyncedStore(objFiles, remote, getStorages, cryptor, logError);
63
- // XXX ??
64
- // s.remoteEvents.startAbsorbingRemoteEvents();
65
62
  return {
66
63
  syncedStore: (0, common_1.wrapSyncStorageImplementation)(s),
67
64
  setupRemoteAndStartObjProcs: getSigner => {
@@ -126,25 +123,12 @@ class SyncedStore {
126
123
  return !!obj;
127
124
  }
128
125
  async isRemoteVersionOnDisk(objId, version) {
129
- var _a;
130
126
  const obj = await this.getObjOrThrow(objId, true);
131
- const status = obj.statusObj();
132
- const { remote } = status.syncStatus();
133
- if (((remote === null || remote === void 0 ? void 0 : remote.latest) !== version)
134
- || !((_a = remote.archived) === null || _a === void 0 ? void 0 : _a.includes(version))) {
135
- throw (0, exceptions_1.makeObjVersionNotFoundExc)(objId, version);
136
- }
137
- // XXX
138
- // - get state of file
139
- throw new Error('SyncedStore.isRemoteVersionOnDisk() not implemented.');
127
+ return obj.isRemoteVersionOnDisk(version);
140
128
  }
141
- download(objId, version) {
142
- // XXX
143
- // - check if on disk
144
- // - download header
145
- // - want result of DC-296, calculation of diff to download, relative to
146
- // latest version on the disk, using headers of both versions.
147
- throw new Error('SyncedStore.download() not implemented.');
129
+ async download(objId, version) {
130
+ const obj = await this.getObjOrThrow(objId, true);
131
+ return obj.downloadRemoteVersion(version);
148
132
  }
149
133
  async upload(objId, localVersion, uploadVersion, uploadHeader, createOnRemote) {
150
134
  const obj = await this.getObjOrThrow(objId, true);
@@ -233,12 +217,12 @@ class SyncedStore {
233
217
  throw (0, exceptions_1.makeObjExistsExc)(objId);
234
218
  }
235
219
  const { fileWrite$ } = await this.files.saveFirstVersion(objId, encSub);
236
- await fileWrite$.toPromise();
220
+ await (0, rxjs_1.lastValueFrom)(fileWrite$);
237
221
  }
238
222
  else {
239
223
  const obj = await this.getObjOrThrow(objId);
240
224
  const { fileWrite$ } = await obj.saveNewVersion(version, encSub);
241
- await fileWrite$.toPromise();
225
+ await (0, rxjs_1.lastValueFrom)(fileWrite$);
242
226
  }
243
227
  }
244
228
  async removeObj(objId) {
@@ -25,12 +25,14 @@ const assert_1 = require("../../../lib-common/assert");
25
25
  exports.UPLOAD_HEADER_FILE_NAME_EXT = 'upload';
26
26
  async function saveUploadHeaderFile(objFolder, headers) {
27
27
  const bytes = packUploadHeaderChange(headers);
28
- await (0, async_fs_node_1.writeFile)(uploadHeaderFilePath(objFolder, headers.uploadVersion), bytes);
28
+ const upFile = uploadHeaderFilePath(objFolder, headers.uploadVersion);
29
+ await (0, async_fs_node_1.writeFile)(upFile, bytes);
29
30
  }
30
31
  exports.saveUploadHeaderFile = saveUploadHeaderFile;
31
32
  async function readUploadHeaderFromFile(objFolder, uploadVersion) {
32
33
  try {
33
- const bytes = await (0, async_fs_node_1.readFile)(uploadHeaderFilePath(objFolder, uploadVersion));
34
+ const upFile = uploadHeaderFilePath(objFolder, uploadVersion);
35
+ const bytes = await (0, async_fs_node_1.readFile)(upFile);
34
36
  return unpackUploadHeaderChange(bytes);
35
37
  }
36
38
  catch (exc) {
@@ -161,8 +161,7 @@ class UploadTask {
161
161
  const header = await this.headerToUpload();
162
162
  let segs = undefined;
163
163
  if (segsToUpload > 0) {
164
- await this.src.segSrc.seek(upload.segsOfs);
165
- segs = await this.src.segSrc.read(segsToUpload);
164
+ segs = await this.src.segSrc.readAt(upload.segsOfs, segsToUpload);
166
165
  }
167
166
  (0, assert_1.assert)(!!segs && (segs.length === segsToUpload));
168
167
  const ver = this.info.uploadVersion;
@@ -210,8 +209,7 @@ class UploadTask {
210
209
  }
211
210
  async continueOrderedUpload(upload) {
212
211
  const segsToUpload = Math.min(upload.segsLeft, this.maxUploadChunk());
213
- await this.src.segSrc.seek(upload.segsOfs);
214
- const segs = await this.src.segSrc.read(segsToUpload);
212
+ const segs = await this.src.segSrc.readAt(upload.segsOfs, segsToUpload);
215
213
  (0, assert_1.assert)(!!segs && (segs.length === segsToUpload));
216
214
  const ofs = upload.segsOfs;
217
215
  const trans = upload.transactionId;
@@ -230,7 +228,7 @@ class UploadTask {
230
228
  const segInfo = upload.newSegsLeft[0];
231
229
  (0, assert_1.assert)(!!segInfo);
232
230
  const len = Math.min(maxSegs, segInfo.len);
233
- const segs = await this.src.segSrc.read(len);
231
+ const segs = await this.src.segSrc.readAt(segInfo.thisVerOfs, len);
234
232
  (0, assert_1.assert)(!!segs && (segs.length === len));
235
233
  if (segInfo.len > len) {
236
234
  upload.newSegsLeft.splice(1, 0, {
@@ -49,9 +49,8 @@ function exposeASMailCAP(cap, expServices) {
49
49
  }
50
50
  exports.exposeASMailCAP = exposeASMailCAP;
51
51
  function makeASMailCaller(caller, objPath) {
52
- const delivPath = objPath.concat('delivery');
53
- const inboxPath = objPath.concat('inbox');
54
- const connectPath = objPath.concat('connect');
52
+ const delivPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'delivery');
53
+ const inboxPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'inbox');
55
54
  return {
56
55
  getUserId: getUserId.makeCaller(caller, objPath),
57
56
  delivery: {
@@ -83,7 +82,7 @@ var getUserId;
83
82
  }
84
83
  getUserId.wrapService = wrapService;
85
84
  function makeCaller(caller, objPath) {
86
- const path = objPath.concat('getUserId');
85
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getUserId');
87
86
  return () => caller.startPromiseCall(path, undefined)
88
87
  .then(buf => {
89
88
  if (!buf) {
@@ -116,7 +115,7 @@ var inboxListMsgs;
116
115
  }
117
116
  inboxListMsgs.wrapService = wrapService;
118
117
  function makeCaller(caller, objPath) {
119
- const path = objPath.concat('listMsgs');
118
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'listMsgs');
120
119
  return fromTS => {
121
120
  const req = (fromTS ? { fromTS: (0, protobuf_msg_1.toVal)(fromTS) } : {});
122
121
  return caller
@@ -139,7 +138,7 @@ var removeMsg;
139
138
  }
140
139
  removeMsg.wrapService = wrapService;
141
140
  function makeCaller(caller, objPath) {
142
- const path = objPath.concat('removeMsg');
141
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'removeMsg');
143
142
  return async (msgId) => {
144
143
  await caller.startPromiseCall(path, requestType.pack({ msgId }));
145
144
  };
@@ -160,7 +159,7 @@ var getMsg;
160
159
  }
161
160
  getMsg.wrapService = wrapService;
162
161
  function makeCaller(caller, objPath) {
163
- const path = objPath.concat('getMsg');
162
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getMsg');
164
163
  return msgId => caller
165
164
  .startPromiseCall(path, requestType.pack({ msgId }))
166
165
  .then(buf => unpackIncomingMessage(buf, caller));
@@ -220,7 +219,7 @@ var inboxSubscribe;
220
219
  }
221
220
  inboxSubscribe.wrapService = wrapService;
222
221
  function makeCaller(caller, objPath) {
223
- const path = objPath.concat('subscribe');
222
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'subscribe');
224
223
  return (event, obs) => {
225
224
  const s = new rxjs_1.Subject();
226
225
  const unsub = caller.startObservableCall(path, requestType.pack({ event }), s);
@@ -246,7 +245,7 @@ var preFlight;
246
245
  }
247
246
  preFlight.wrapService = wrapService;
248
247
  function makeCaller(caller, objPath) {
249
- const path = objPath.concat('preFlight');
248
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'preFlight');
250
249
  return toAddress => caller
251
250
  .startPromiseCall(path, requestType.pack({ toAddress }))
252
251
  .then(protobuf_msg_1.unpackInt);
@@ -341,7 +340,7 @@ var addMsg;
341
340
  }
342
341
  addMsg.wrapService = wrapService;
343
342
  function makeCaller(caller, objPath) {
344
- const path = objPath.concat('addMsg');
343
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'addMsg');
345
344
  return async (recipients, msg, id, opts) => {
346
345
  const req = { id, msg: packMsg(msg, caller), recipients };
347
346
  if (opts) {
@@ -369,7 +368,7 @@ var delivListMsgs;
369
368
  }
370
369
  delivListMsgs.wrapService = wrapService;
371
370
  function makeCaller(caller, objPath) {
372
- const path = objPath.concat('listMsgs');
371
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'listMsgs');
373
372
  return () => caller
374
373
  .startPromiseCall(path, undefined)
375
374
  .then(buf => {
@@ -438,7 +437,7 @@ var currentState;
438
437
  }
439
438
  currentState.wrapService = wrapService;
440
439
  function makeCaller(caller, objPath) {
441
- const path = objPath.concat('currentState');
440
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'currentState');
442
441
  return id => caller
443
442
  .startPromiseCall(path, requestType.pack({ id }))
444
443
  .then(buf => {
@@ -463,7 +462,7 @@ var rmMsg;
463
462
  }
464
463
  rmMsg.wrapService = wrapService;
465
464
  function makeCaller(caller, objPath) {
466
- const path = objPath.concat('rmMsg');
465
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'rmMsg');
467
466
  return (id, cancelSending) => caller
468
467
  .startPromiseCall(path, requestType.pack({
469
468
  id, cancelSending: (0, protobuf_msg_1.toOptVal)(cancelSending)
@@ -488,7 +487,7 @@ var observeAllDeliveries;
488
487
  }
489
488
  observeAllDeliveries.wrapService = wrapService;
490
489
  function makeCaller(caller, objPath) {
491
- const path = objPath.concat('observeAllDeliveries');
490
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'observeAllDeliveries');
492
491
  return obs => {
493
492
  const s = new rxjs_1.Subject();
494
493
  const unsub = caller.startObservableCall(path, undefined, s);
@@ -520,7 +519,7 @@ var observeDelivery;
520
519
  }
521
520
  observeDelivery.wrapService = wrapService;
522
521
  function makeCaller(caller, objPath) {
523
- const path = objPath.concat('observeDelivery');
522
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'observeDelivery');
524
523
  return (id, obs) => {
525
524
  const s = new rxjs_1.Subject();
526
525
  const unsub = caller.startObservableCall(path, requestType.pack({ id }), s);
@@ -53,7 +53,8 @@ function makeSrcCaller(caller, ref) {
53
53
  const src = {
54
54
  getPosition: srcGetPosition.makeCaller(caller, objPath),
55
55
  getSize: srcGetSize.makeCaller(caller, objPath),
56
- read: srcRead.makeCaller(caller, objPath),
56
+ readNext: srcReadNext.makeCaller(caller, objPath),
57
+ readAt: srcReadAt.makeCaller(caller, objPath),
57
58
  seek: srcSeek.makeCaller(caller, objPath)
58
59
  };
59
60
  caller.registerClientDrop(src, ref);
@@ -64,7 +65,8 @@ function exposeSrcService(src, expServices) {
64
65
  const wrap = {
65
66
  getPosition: srcGetPosition.wrapService(src.getPosition),
66
67
  getSize: srcGetSize.wrapService(src.getSize),
67
- read: srcRead.wrapService(src.read),
68
+ readNext: srcReadNext.wrapService(src.readNext),
69
+ readAt: srcReadAt.wrapService(src.readAt),
68
70
  seek: srcSeek.wrapService(src.seek)
69
71
  };
70
72
  const ref = expServices.exposeDroppableService('FileByteSource', wrap, src);
@@ -82,7 +84,7 @@ var sinkGetSize;
82
84
  }
83
85
  sinkGetSize.wrapService = wrapService;
84
86
  function makeCaller(caller, objPath) {
85
- const path = objPath.concat('getSize');
87
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getSize');
86
88
  return () => caller
87
89
  .startPromiseCall(path, undefined)
88
90
  .then(protobuf_msg_1.unpackInt);
@@ -102,7 +104,7 @@ var sinkSplice;
102
104
  }
103
105
  sinkSplice.wrapService = wrapService;
104
106
  function makeCaller(caller, objPath) {
105
- const path = objPath.concat('splice');
107
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'splice');
106
108
  return async (pos, del, bytes) => {
107
109
  await caller
108
110
  .startPromiseCall(path, requestType.pack({
@@ -125,7 +127,7 @@ var sinkTruncate;
125
127
  }
126
128
  sinkTruncate.wrapService = wrapService;
127
129
  function makeCaller(caller, objPath) {
128
- const path = objPath.concat('truncate');
130
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'truncate');
129
131
  return async (size) => {
130
132
  await caller
131
133
  .startPromiseCall(path, requestType.pack({ size }));
@@ -160,7 +162,7 @@ var sinkShowLayout;
160
162
  }
161
163
  sinkShowLayout.wrapService = wrapService;
162
164
  function makeCaller(caller, objPath) {
163
- const path = objPath.concat('showLayout');
165
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'showLayout');
164
166
  return () => caller
165
167
  .startPromiseCall(path, undefined)
166
168
  .then(buf => unpackLayout(replyType.unpack(buf)));
@@ -180,7 +182,7 @@ var sinkDone;
180
182
  }
181
183
  sinkDone.wrapService = wrapService;
182
184
  function makeCaller(caller, objPath) {
183
- const path = objPath.concat('done');
185
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'done');
184
186
  return async (err) => {
185
187
  const req = (err ? { err: (0, protobuf_msg_1.errToMsg)(err) } : {});
186
188
  await caller
@@ -201,7 +203,7 @@ var srcGetSize;
201
203
  }
202
204
  srcGetSize.wrapService = wrapService;
203
205
  function makeCaller(caller, objPath) {
204
- const path = objPath.concat('getSize');
206
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getSize');
205
207
  return () => caller
206
208
  .startPromiseCall(path, undefined)
207
209
  .then(protobuf_msg_1.unpackInt);
@@ -220,7 +222,7 @@ var srcGetPosition;
220
222
  }
221
223
  srcGetPosition.wrapService = wrapService;
222
224
  function makeCaller(caller, objPath) {
223
- const path = objPath.concat('getPosition');
225
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'getPosition');
224
226
  return () => caller
225
227
  .startPromiseCall(path, undefined)
226
228
  .then(protobuf_msg_1.unpackInt);
@@ -228,9 +230,9 @@ var srcGetPosition;
228
230
  srcGetPosition.makeCaller = makeCaller;
229
231
  })(srcGetPosition || (srcGetPosition = {}));
230
232
  Object.freeze(srcGetPosition);
231
- var srcRead;
232
- (function (srcRead) {
233
- const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadRequestBody);
233
+ var srcReadNext;
234
+ (function (srcReadNext) {
235
+ const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadNextRequestBody);
234
236
  const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadReplyBody);
235
237
  function wrapService(fn) {
236
238
  return buf => {
@@ -240,16 +242,38 @@ var srcRead;
240
242
  return { promise };
241
243
  };
242
244
  }
243
- srcRead.wrapService = wrapService;
245
+ srcReadNext.wrapService = wrapService;
244
246
  function makeCaller(caller, objPath) {
245
- const path = objPath.concat('read');
247
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'readNext');
246
248
  return len => caller
247
249
  .startPromiseCall(path, requestType.pack({ len: (0, protobuf_msg_1.toOptVal)(len) }))
248
250
  .then(buf => (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).bytes));
249
251
  }
250
- srcRead.makeCaller = makeCaller;
251
- })(srcRead || (srcRead = {}));
252
- Object.freeze(srcRead);
252
+ srcReadNext.makeCaller = makeCaller;
253
+ })(srcReadNext || (srcReadNext = {}));
254
+ Object.freeze(srcReadNext);
255
+ var srcReadAt;
256
+ (function (srcReadAt) {
257
+ const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadAtRequestBody);
258
+ const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadReplyBody);
259
+ function wrapService(fn) {
260
+ return buf => {
261
+ const { pos, len } = requestType.unpack(buf);
262
+ const promise = fn((0, protobuf_msg_1.fixInt)(pos), (0, protobuf_msg_1.valOfOptInt)(len))
263
+ .then(bytes => replyType.pack({ bytes: (0, protobuf_msg_1.toOptVal)(bytes) }));
264
+ return { promise };
265
+ };
266
+ }
267
+ srcReadAt.wrapService = wrapService;
268
+ function makeCaller(caller, objPath) {
269
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'readAt');
270
+ return (pos, len) => caller
271
+ .startPromiseCall(path, requestType.pack({ pos, len: (0, protobuf_msg_1.toOptVal)(len) }))
272
+ .then(buf => (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).bytes));
273
+ }
274
+ srcReadAt.makeCaller = makeCaller;
275
+ })(srcReadAt || (srcReadAt = {}));
276
+ Object.freeze(srcReadAt);
253
277
  var srcSeek;
254
278
  (function (srcSeek) {
255
279
  const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.SeekRequestBody);
@@ -262,7 +286,7 @@ var srcSeek;
262
286
  }
263
287
  srcSeek.wrapService = wrapService;
264
288
  function makeCaller(caller, objPath) {
265
- const path = objPath.concat('seek');
289
+ const path = (0, protobuf_msg_1.methodPathFor)(objPath, 'seek');
266
290
  return async (offset) => {
267
291
  await caller
268
292
  .startPromiseCall(path, requestType.pack({ offset }));
@@ -14,6 +14,7 @@ declare type FileEvent = web3n.files.FileEvent;
14
14
  declare type RemoteEvent = web3n.files.RemoteEvent;
15
15
  declare type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
16
16
  declare type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
17
+ declare type VersionedReadFlags = web3n.files.VersionedReadFlags;
17
18
  export declare function makeFileCaller(caller: Caller, fileMsg: FileMsg): File;
18
19
  export declare function exposeFileService(file: File, expServices: ExposedServices): FileMsg;
19
20
  export interface FileMsg {
@@ -41,6 +42,12 @@ export declare function packJSON(json: any): EnvelopeBody;
41
42
  export declare function unpackJSON(buf: EnvelopeBody): any;
42
43
  export declare function packFileEvent(e: FileEvent | RemoteEvent): Buffer;
43
44
  export declare function unpackFileEvent(buf: EnvelopeBody): FileEvent | RemoteEvent;
45
+ export interface VersionedReadFlagsMsg {
46
+ archivedVersion?: Value<number>;
47
+ remoteVersion?: Value<number>;
48
+ }
49
+ export declare function versionedReadFlagsFromMsg(msg: VersionedReadFlagsMsg | undefined): VersionedReadFlags | undefined;
50
+ export declare function versionedReadFlagsToMsg(flags: VersionedReadFlags | undefined): VersionedReadFlagsMsg | undefined;
44
51
  export declare namespace vGetXAttr {
45
52
  interface Reply {
46
53
  version: number;