core-3nweb-client-lib 0.26.1 → 0.27.3

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 (211) hide show
  1. package/build/api-defs/asmail.d.ts +1 -1
  2. package/build/api-defs/files.d.ts +281 -75
  3. package/build/core/app-files.js +7 -7
  4. package/build/core/asmail/config/common.js +2 -2
  5. package/build/core/asmail/config/index.js +2 -2
  6. package/build/core/asmail/config/published-intro-key.js +1 -1
  7. package/build/core/asmail/delivery/common.js +7 -7
  8. package/build/core/asmail/delivery/index.js +5 -5
  9. package/build/core/asmail/delivery/msg.js +4 -4
  10. package/build/core/asmail/delivery/per-recipient-wip.js +1 -1
  11. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
  12. package/build/core/asmail/inbox/attachments/fs.js +9 -4
  13. package/build/core/asmail/inbox/cached-msgs.js +1 -1
  14. package/build/core/asmail/inbox/inbox-events.js +4 -4
  15. package/build/core/asmail/inbox/index.js +10 -10
  16. package/build/core/asmail/inbox/msg-downloader.js +1 -1
  17. package/build/core/asmail/inbox/msg-indexing.js +1 -1
  18. package/build/core/asmail/inbox/msg-on-disk.js +5 -5
  19. package/build/core/asmail/index.d.ts +3 -3
  20. package/build/core/asmail/index.js +13 -8
  21. package/build/core/asmail/key-verification.js +5 -5
  22. package/build/core/asmail/keyring/common.js +7 -6
  23. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  24. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  25. package/build/core/asmail/keyring/index.d.ts +7 -8
  26. package/build/core/asmail/keyring/index.js +15 -14
  27. package/build/core/asmail/keyring/keyring-storage.js +2 -1
  28. package/build/core/asmail/msg/opener.js +3 -3
  29. package/build/core/asmail/msg/packer.js +13 -13
  30. package/build/core/asmail/sending-params/own-params.js +2 -2
  31. package/build/core/asmail/sending-params/params-from-others.js +1 -1
  32. package/build/core/id-manager/index.d.ts +43 -0
  33. package/build/core/{id-manager.js → id-manager/index.js} +36 -114
  34. package/build/core/id-manager/key-storage.d.ts +21 -0
  35. package/build/core/id-manager/key-storage.js +96 -0
  36. package/build/core/index.d.ts +2 -1
  37. package/build/core/index.js +31 -33
  38. package/build/core/sign-in.d.ts +1 -2
  39. package/build/core/sign-in.js +8 -17
  40. package/build/core/sign-up.d.ts +2 -0
  41. package/build/core/sign-up.js +11 -10
  42. package/build/core/storage/common/json-saving.js +2 -2
  43. package/build/core/storage/common/obj-info-file.d.ts +12 -4
  44. package/build/core/storage/common/obj-info-file.js +66 -34
  45. package/build/core/storage/common/utils.d.ts +2 -0
  46. package/build/core/storage/common/utils.js +32 -0
  47. package/build/core/storage/index.d.ts +5 -17
  48. package/build/core/storage/index.js +78 -119
  49. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  50. package/build/core/storage/local/obj-files-gc.js +49 -37
  51. package/build/core/storage/local/obj-files.d.ts +4 -7
  52. package/build/core/storage/local/obj-files.js +7 -10
  53. package/build/core/storage/local/obj-status.d.ts +12 -6
  54. package/build/core/storage/local/obj-status.js +24 -9
  55. package/build/core/storage/local/storage.d.ts +10 -7
  56. package/build/core/storage/local/storage.js +29 -18
  57. package/build/core/storage/synced/downloader.js +1 -1
  58. package/build/core/storage/synced/obj-files-gc.d.ts +1 -0
  59. package/build/core/storage/synced/obj-files-gc.js +76 -39
  60. package/build/core/storage/synced/obj-files.d.ts +50 -36
  61. package/build/core/storage/synced/obj-files.js +201 -162
  62. package/build/core/storage/synced/obj-status.d.ts +99 -86
  63. package/build/core/storage/synced/obj-status.js +520 -251
  64. package/build/core/storage/synced/remote-events.d.ts +11 -12
  65. package/build/core/storage/synced/remote-events.js +73 -56
  66. package/build/core/storage/synced/storage.d.ts +24 -10
  67. package/build/core/storage/synced/storage.js +147 -47
  68. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  69. package/build/core/storage/synced/upload-header-file.js +64 -0
  70. package/build/core/storage/synced/upsyncer.d.ts +12 -7
  71. package/build/core/storage/synced/upsyncer.js +210 -280
  72. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  73. package/build/core/storage/system-folders/apps-data.js +110 -0
  74. package/build/core/storage/system-folders/index.d.ts +18 -0
  75. package/build/core/storage/system-folders/index.js +77 -0
  76. package/build/core-ipc/common-caps.js +3 -3
  77. package/build/core-ipc/generic.js +8 -8
  78. package/build/core-ipc/startup-caps.js +2 -2
  79. package/build/cryptors.js +6 -2
  80. package/build/ipc-via-protobuf/asmail-cap.js +58 -57
  81. package/build/ipc-via-protobuf/bytes.js +16 -17
  82. package/build/ipc-via-protobuf/connector-clients-side.d.ts +1 -0
  83. package/build/ipc-via-protobuf/connector-clients-side.js +14 -15
  84. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  85. package/build/ipc-via-protobuf/connector.js +4 -4
  86. package/build/ipc-via-protobuf/file.d.ts +48 -12
  87. package/build/ipc-via-protobuf/file.js +474 -126
  88. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  89. package/build/ipc-via-protobuf/fs.js +577 -142
  90. package/build/ipc-via-protobuf/log-cap.js +2 -2
  91. package/build/ipc-via-protobuf/mailerid.js +3 -3
  92. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  93. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  94. package/build/ipc-via-protobuf/startup-cap.js +21 -21
  95. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  96. package/build/ipc.js +7 -2
  97. package/build/lib-client/3nstorage/exceptions.d.ts +16 -1
  98. package/build/lib-client/3nstorage/exceptions.js +21 -3
  99. package/build/lib-client/3nstorage/service.d.ts +21 -3
  100. package/build/lib-client/3nstorage/service.js +128 -46
  101. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  102. package/build/lib-client/3nstorage/util/file-based-json.js +3 -2
  103. package/build/lib-client/3nstorage/util/for-arrays.d.ts +1 -0
  104. package/build/lib-client/3nstorage/util/for-arrays.js +32 -0
  105. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  106. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +44 -19
  107. package/build/lib-client/3nstorage/xsp-fs/common.js +30 -19
  108. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  109. package/build/lib-client/3nstorage/xsp-fs/file-node.js +17 -13
  110. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  111. package/build/lib-client/3nstorage/xsp-fs/file.js +73 -25
  112. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  113. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +32 -13
  114. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +752 -192
  115. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
  116. package/build/lib-client/3nstorage/xsp-fs/fs.js +236 -119
  117. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  118. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  119. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -29
  120. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +232 -127
  121. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  122. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +17 -18
  123. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -3
  124. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +53 -53
  125. package/build/lib-client/3nweb-signup.js +4 -4
  126. package/build/lib-client/asmail/recipient.js +15 -15
  127. package/build/lib-client/asmail/sender.js +22 -22
  128. package/build/lib-client/asmail/service-config.js +3 -3
  129. package/build/lib-client/cryptor/cryptor-in-worker.js +18 -16
  130. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  131. package/build/lib-client/cryptor/cryptor.js +4 -2
  132. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  133. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  134. package/build/lib-client/cryptor/in-proc-wasm.js +6 -6
  135. package/build/lib-client/cryptor/worker-js.js +2 -2
  136. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  137. package/build/lib-client/files-select.js +1 -1
  138. package/build/lib-client/files.d.ts +1 -1
  139. package/build/lib-client/files.js +71 -6
  140. package/build/lib-client/fs-collection.js +1 -1
  141. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  142. package/build/lib-client/fs-sync-utils.js +61 -0
  143. package/build/lib-client/fs-view.d.ts +14 -0
  144. package/build/lib-client/fs-view.js +33 -0
  145. package/build/lib-client/key-derivation.js +1 -1
  146. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  147. package/build/lib-client/local-files/dev-file-src.js +2 -2
  148. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  149. package/build/lib-client/local-files/device-fs.js +56 -54
  150. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  151. package/build/lib-client/logging/log-to-file.js +7 -7
  152. package/build/lib-client/mailer-id/login.js +7 -7
  153. package/build/lib-client/mailer-id/provisioner.js +12 -12
  154. package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -3
  155. package/build/lib-client/objs-on-disk/obj-folders.js +31 -31
  156. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  157. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  158. package/build/lib-client/request-utils.d.ts +1 -0
  159. package/build/lib-client/request-utils.js +13 -13
  160. package/build/lib-client/server-events.d.ts +3 -3
  161. package/build/lib-client/server-events.js +9 -8
  162. package/build/lib-client/service-locator.js +10 -10
  163. package/build/lib-client/user-with-mid-session.d.ts +2 -1
  164. package/build/lib-client/user-with-mid-session.js +14 -8
  165. package/build/lib-client/user-with-pkl-session.js +25 -25
  166. package/build/lib-client/ws-utils.js +2 -2
  167. package/build/lib-common/async-cryptor-wrap.js +4 -4
  168. package/build/lib-common/async-fs-node.d.ts +5 -3
  169. package/build/lib-common/async-fs-node.js +17 -17
  170. package/build/lib-common/byte-streaming/pipe.js +1 -1
  171. package/build/lib-common/byte-streaming/wrapping.js +13 -13
  172. package/build/lib-common/canonical-address.js +1 -1
  173. package/build/lib-common/exceptions/error.d.ts +1 -0
  174. package/build/lib-common/exceptions/error.js +7 -6
  175. package/build/lib-common/exceptions/file.d.ts +4 -2
  176. package/build/lib-common/exceptions/file.js +24 -54
  177. package/build/lib-common/ipc/generic-ipc.js +5 -4
  178. package/build/lib-common/ipc/ws-ipc.js +2 -2
  179. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  180. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  181. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  182. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  183. package/build/lib-common/objs-on-disk/obj-file.js +96 -35
  184. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  185. package/build/lib-common/objs-on-disk/utils.js +3 -3
  186. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  187. package/build/lib-common/processes/labelled-exec-pools.d.ts +1 -1
  188. package/build/lib-common/processes/labelled-exec-pools.js +1 -1
  189. package/build/lib-common/processes/pressure.js +2 -2
  190. package/build/lib-common/processes/synced.js +1 -1
  191. package/build/lib-common/processes/timeout.js +2 -2
  192. package/build/lib-common/random-node.js +7 -7
  193. package/build/lib-common/service-api/3nstorage/owner.d.ts +101 -42
  194. package/build/lib-common/service-api/3nstorage/owner.js +83 -40
  195. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  196. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  197. package/build/lib-common/timed-cache.d.ts +1 -0
  198. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  199. package/build/lib-common/timed-non-weak-cache.js +11 -0
  200. package/build/lib-common/utils-for-observables.js +4 -4
  201. package/build/lib-common/weak-cache.d.ts +1 -0
  202. package/build/lib-common/weak-cache.js +12 -1
  203. package/build/lib-index.d.ts +2 -1
  204. package/build/lib-index.js +10 -7
  205. package/build/protos/asmail.proto.js +12955 -7496
  206. package/build/protos/file.proto.js +4867 -2744
  207. package/build/protos/fs.proto.js +9227 -3768
  208. package/package.json +7 -5
  209. package/protos/file.proto +91 -19
  210. package/protos/fs.proto +107 -8
  211. package/build/core/id-manager.d.ts +0 -46
@@ -22,7 +22,7 @@ const protobuf_type_1 = require("../lib-client/protobuf-type");
22
22
  const bytes_proto_1 = require("../protos/bytes.proto");
23
23
  const connector_1 = require("./connector");
24
24
  function makeSinkCaller(caller, ref) {
25
- connector_1.checkRefObjTypeIs('FileByteSink', ref);
25
+ (0, connector_1.checkRefObjTypeIs)('FileByteSink', ref);
26
26
  const objPath = ref.path;
27
27
  const sink = {
28
28
  done: sinkDone.makeCaller(caller, objPath),
@@ -48,7 +48,7 @@ function exposeSinkService(sink, expServices) {
48
48
  }
49
49
  exports.exposeSinkService = exposeSinkService;
50
50
  function makeSrcCaller(caller, ref) {
51
- connector_1.checkRefObjTypeIs('FileByteSource', ref);
51
+ (0, connector_1.checkRefObjTypeIs)('FileByteSource', ref);
52
52
  const objPath = ref.path;
53
53
  const src = {
54
54
  getPosition: srcGetPosition.makeCaller(caller, objPath),
@@ -96,7 +96,7 @@ var sinkSplice;
96
96
  function wrapService(fn) {
97
97
  return buf => {
98
98
  const { pos, del, bytes } = requestType.unpack(buf);
99
- const promise = fn(protobuf_msg_1.fixInt(pos), protobuf_msg_1.fixInt(del), protobuf_msg_1.valOfOpt(bytes));
99
+ const promise = fn((0, protobuf_msg_1.fixInt)(pos), (0, protobuf_msg_1.fixInt)(del), (0, protobuf_msg_1.valOfOpt)(bytes));
100
100
  return { promise };
101
101
  };
102
102
  }
@@ -106,8 +106,7 @@ var sinkSplice;
106
106
  return async (pos, del, bytes) => {
107
107
  await caller
108
108
  .startPromiseCall(path, requestType.pack({
109
- pos, del,
110
- bytes: protobuf_msg_1.toOptVal(bytes)
109
+ pos, del, bytes: (0, protobuf_msg_1.toOptVal)(bytes)
111
110
  }));
112
111
  };
113
112
  }
@@ -120,7 +119,7 @@ var sinkTruncate;
120
119
  function wrapService(fn) {
121
120
  return buf => {
122
121
  const { size } = requestType.unpack(buf);
123
- const promise = fn(protobuf_msg_1.fixInt(size));
122
+ const promise = fn((0, protobuf_msg_1.fixInt)(size));
124
123
  return { promise };
125
124
  };
126
125
  }
@@ -140,15 +139,15 @@ var sinkShowLayout;
140
139
  const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.FileLayoutMsg);
141
140
  function packLayout(l) {
142
141
  return {
143
- base: protobuf_msg_1.toOptVal(l.base),
142
+ base: (0, protobuf_msg_1.toOptVal)(l.base),
144
143
  sections: l.sections
145
144
  };
146
145
  }
147
146
  function unpackLayout(msg) {
148
147
  return {
149
- base: protobuf_msg_1.valOfOptInt(msg.base),
150
- sections: protobuf_msg_1.fixArray(msg.sections).map(({ src, ofs, len }) => ({
151
- src, ofs: protobuf_msg_1.fixInt(ofs), len: protobuf_msg_1.fixInt(len)
148
+ base: (0, protobuf_msg_1.valOfOptInt)(msg.base),
149
+ sections: (0, protobuf_msg_1.fixArray)(msg.sections).map(({ src, ofs, len }) => ({
150
+ src, ofs: (0, protobuf_msg_1.fixInt)(ofs), len: (0, protobuf_msg_1.fixInt)(len)
152
151
  }))
153
152
  };
154
153
  }
@@ -175,7 +174,7 @@ var sinkDone;
175
174
  function wrapService(fn) {
176
175
  return buf => {
177
176
  const { err } = requestType.unpack(buf);
178
- const promise = (err ? fn(protobuf_msg_1.errFromMsg(err)) : fn());
177
+ const promise = (err ? fn((0, protobuf_msg_1.errFromMsg)(err)) : fn());
179
178
  return { promise };
180
179
  };
181
180
  }
@@ -183,7 +182,7 @@ var sinkDone;
183
182
  function makeCaller(caller, objPath) {
184
183
  const path = objPath.concat('done');
185
184
  return async (err) => {
186
- const req = (err ? { err: protobuf_msg_1.errToMsg(err) } : {});
185
+ const req = (err ? { err: (0, protobuf_msg_1.errToMsg)(err) } : {});
187
186
  await caller
188
187
  .startPromiseCall(path, requestType.pack(req));
189
188
  };
@@ -236,8 +235,8 @@ var srcRead;
236
235
  function wrapService(fn) {
237
236
  return buf => {
238
237
  const { len } = requestType.unpack(buf);
239
- const promise = fn(protobuf_msg_1.valOfOptInt(len))
240
- .then(bytes => replyType.pack({ bytes: protobuf_msg_1.toOptVal(bytes) }));
238
+ const promise = fn((0, protobuf_msg_1.valOfOptInt)(len))
239
+ .then(bytes => replyType.pack({ bytes: (0, protobuf_msg_1.toOptVal)(bytes) }));
241
240
  return { promise };
242
241
  };
243
242
  }
@@ -245,8 +244,8 @@ var srcRead;
245
244
  function makeCaller(caller, objPath) {
246
245
  const path = objPath.concat('read');
247
246
  return len => caller
248
- .startPromiseCall(path, requestType.pack({ len: protobuf_msg_1.toOptVal(len) }))
249
- .then(buf => protobuf_msg_1.valOfOpt(replyType.unpack(buf).bytes));
247
+ .startPromiseCall(path, requestType.pack({ len: (0, protobuf_msg_1.toOptVal)(len) }))
248
+ .then(buf => (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).bytes));
250
249
  }
251
250
  srcRead.makeCaller = makeCaller;
252
251
  })(srcRead || (srcRead = {}));
@@ -257,7 +256,7 @@ var srcSeek;
257
256
  function wrapService(fn) {
258
257
  return buf => {
259
258
  const { offset } = requestType.unpack(buf);
260
- const promise = fn(protobuf_msg_1.fixInt(offset));
259
+ const promise = fn((0, protobuf_msg_1.fixInt)(offset));
261
260
  return { promise };
262
261
  };
263
262
  }
@@ -19,6 +19,7 @@ export declare class ClientsSideImpl implements ClientsSide {
19
19
  private retryWithOtherCallNum;
20
20
  private nextFnCallNum;
21
21
  caller(): Caller;
22
+ private throwIfStopped;
22
23
  private startCall;
23
24
  private setupFnCall;
24
25
  startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
@@ -61,7 +61,7 @@ class ClientsSideImpl {
61
61
  }
62
62
  sendCallCancellation(fnCallNum) {
63
63
  this.sendMsg({
64
- headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'cancel' }
64
+ headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'cancel' }
65
65
  });
66
66
  }
67
67
  processInterimCallReply(fnCallNum, body) {
@@ -106,7 +106,7 @@ class ClientsSideImpl {
106
106
  return;
107
107
  }
108
108
  this.fnCalls.delete(fnCallNum);
109
- const err = (body ? protobuf_msg_1.errFromMsg(protobuf_msg_1.errBodyType.unpack(body)) : undefined);
109
+ const err = (body ? (0, protobuf_msg_1.errFromMsg)(protobuf_msg_1.errBodyType.unpack(body)) : undefined);
110
110
  if (err && (err.type === 'ipc')
111
111
  && err.duplicateFnCallNum) {
112
112
  this.retryWithOtherCallNum(call);
@@ -173,23 +173,26 @@ class ClientsSideImpl {
173
173
  };
174
174
  return callerWrap;
175
175
  }
176
- startCall(reqEnv) {
176
+ throwIfStopped() {
177
177
  if (this.isStopped) {
178
- throw connector_1.makeIPCException({ 'ipcNotConnected': true });
178
+ throw (0, connector_1.makeIPCException)({ ipcNotConnected: true });
179
179
  }
180
+ }
181
+ startCall(reqEnv) {
182
+ this.throwIfStopped();
180
183
  this.sendMsg(reqEnv);
181
184
  }
182
185
  setupFnCall(path, body, deferred, obs) {
183
186
  const fnCallNum = this.nextFnCallNum();
184
187
  const reqEnv = {
185
- headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'start', path },
186
- body: protobuf_msg_1.toOptVal(body)
188
+ headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'start', path },
189
+ body: (0, protobuf_msg_1.toOptVal)(body)
187
190
  };
188
191
  this.fnCalls.set(fnCallNum, { deferred, obs, reqEnv });
189
192
  return reqEnv;
190
193
  }
191
194
  startPromiseCall(path, req) {
192
- const deferred = deferred_1.defer();
195
+ const deferred = (0, deferred_1.defer)();
193
196
  const reqEnv = this.setupFnCall(path, req, deferred, undefined);
194
197
  const fnCallNum = reqEnv.headers.fnCallNum.value;
195
198
  try {
@@ -214,7 +217,7 @@ class ClientsSideImpl {
214
217
  }
215
218
  }
216
219
  registerClientDrop(o, srvRef) {
217
- const clientRef = weakref_1.makeWeakRefFor(o);
220
+ const clientRef = (0, weakref_1.makeWeakRefFor)(o);
218
221
  this.weakRefs.add(clientRef);
219
222
  clientRef.addCallback(this.makeClientDropCB(clientRef, srvRef));
220
223
  this.srvRefs.set(o, srvRef);
@@ -237,19 +240,15 @@ class ClientsSideImpl {
237
240
  return srvRef;
238
241
  }
239
242
  else {
240
- throw connector_1.makeIPCException({ 'objectNotFound': true });
243
+ throw (0, connector_1.makeIPCException)({ 'objectNotFound': true });
241
244
  }
242
245
  }
243
246
  listObj(path) {
244
- if (this.isStopped) {
245
- throw connector_1.makeIPCException({ 'ipcNotConnected': true });
246
- }
247
+ this.throwIfStopped();
247
248
  return this.syncReqToListObj(path);
248
249
  }
249
250
  listObjAsync(path) {
250
- if (this.isStopped) {
251
- throw connector_1.makeIPCException({ 'ipcNotConnected': true });
252
- }
251
+ this.throwIfStopped();
253
252
  return this.asyncReqToListObj(path);
254
253
  }
255
254
  }
@@ -41,22 +41,22 @@ class ServicesSideImpl {
41
41
  }
42
42
  sendCallError(fnCallNum, err) {
43
43
  this.sendMsg({
44
- headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'error' },
45
- body: protobuf_msg_1.toVal(protobuf_msg_1.errBodyType.pack(protobuf_msg_1.errToMsg(err)))
44
+ headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'error' },
45
+ body: (0, protobuf_msg_1.toVal)(protobuf_msg_1.errBodyType.pack((0, protobuf_msg_1.errToMsg)(err)))
46
46
  });
47
47
  }
48
48
  sendCallReply(fnCallNum, last, body) {
49
49
  this.sendMsg({
50
50
  headers: {
51
- fnCallNum: protobuf_msg_1.toVal(fnCallNum),
51
+ fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum),
52
52
  msgType: (last ? 'end' : 'interim')
53
53
  },
54
- body: protobuf_msg_1.toOptVal(body)
54
+ body: (0, protobuf_msg_1.toOptVal)(body)
55
55
  });
56
56
  }
57
57
  processCallStart(fnCallNum, path, body) {
58
58
  if (this.fnCallProcs.has(fnCallNum)) {
59
- this.sendCallError(fnCallNum, connector_1.makeIPCException({ duplicateFnCallNum: true }));
59
+ this.sendCallError(fnCallNum, (0, connector_1.makeIPCException)({ duplicateFnCallNum: true }));
60
60
  return;
61
61
  }
62
62
  try {
@@ -113,7 +113,7 @@ class ServicesSideImpl {
113
113
  this.exposedObjs.drop(path[0]);
114
114
  }
115
115
  else {
116
- throw connector_1.makeIPCException({ invalidPath: true, path });
116
+ throw (0, connector_1.makeIPCException)({ invalidPath: true, path });
117
117
  }
118
118
  }
119
119
  processListObj(fnCallNum, path) {
@@ -124,7 +124,7 @@ class ServicesSideImpl {
124
124
  this.sendCallReply(fnCallNum, true, buf);
125
125
  }
126
126
  else {
127
- const exc = connector_1.makeIPCException({ 'objectNotFound': true });
127
+ const exc = (0, connector_1.makeIPCException)({ 'objectNotFound': true });
128
128
  this.sendCallError(fnCallNum, exc);
129
129
  }
130
130
  }
@@ -151,7 +151,7 @@ class ExposedObjs {
151
151
  exposeDroppableService(objType, exp, original) {
152
152
  let id;
153
153
  do {
154
- id = random_node_1.stringOfB64CharsSync(20);
154
+ id = (0, random_node_1.stringOfB64CharsSync)(20);
155
155
  } while (this.objs.has(id));
156
156
  this.objs.set(id, { exp, original });
157
157
  return { objType, path: [id] };
@@ -162,7 +162,7 @@ class ExposedObjs {
162
162
  return o.original;
163
163
  }
164
164
  else {
165
- throw connector_1.makeIPCException({ 'objectNotFound': true });
165
+ throw (0, connector_1.makeIPCException)({ 'objectNotFound': true });
166
166
  }
167
167
  }
168
168
  exposeW3NService(exp) {
@@ -199,7 +199,7 @@ class ExposedObjs {
199
199
  return fn;
200
200
  }
201
201
  else {
202
- throw connector_1.makeIPCException({ callFnNotFound: true, path });
202
+ throw (0, connector_1.makeIPCException)({ callFnNotFound: true, path });
203
203
  }
204
204
  }
205
205
  dropAll() {
@@ -104,8 +104,8 @@ class ObjectsConnector {
104
104
  processIncomingMsg(msg) {
105
105
  var _a, _b, _c, _d, _e, _f, _g;
106
106
  const { msgType, path, fnCallNum: cNum } = msg.headers;
107
- const fnCallNum = protobuf_msg_1.valOfOptInt(cNum);
108
- const body = protobuf_msg_1.valOfOpt(msg.body);
107
+ const fnCallNum = (0, protobuf_msg_1.valOfOptInt)(cNum);
108
+ const body = (0, protobuf_msg_1.valOfOpt)(msg.body);
109
109
  try {
110
110
  if (typeof fnCallNum === 'number') {
111
111
  if (msgType === 'start') {
@@ -149,8 +149,8 @@ class ObjectsConnector {
149
149
  return;
150
150
  }
151
151
  const msg = {
152
- headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'error' },
153
- body: protobuf_msg_1.toVal(protobuf_msg_1.errBodyType.pack(protobuf_msg_1.errToMsg(err)))
152
+ headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'error' },
153
+ body: (0, protobuf_msg_1.toVal)(protobuf_msg_1.errBodyType.pack((0, protobuf_msg_1.errToMsg)(err)))
154
154
  };
155
155
  this.msgSink.next(msg);
156
156
  }
@@ -8,20 +8,27 @@ declare type WritableFile = web3n.files.WritableFile;
8
8
  declare type WritableFileVersionedAPI = web3n.files.WritableFileVersionedAPI;
9
9
  declare type File = web3n.files.File;
10
10
  declare type Stats = web3n.files.Stats;
11
+ declare type SyncStatus = web3n.files.SyncStatus;
11
12
  declare type XAttrsChanges = web3n.files.XAttrsChanges;
12
13
  declare type FileEvent = web3n.files.FileEvent;
14
+ declare type RemoteEvent = web3n.files.RemoteEvent;
15
+ declare type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
16
+ declare type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
13
17
  export declare function makeFileCaller(caller: Caller, fileMsg: FileMsg): File;
14
18
  export declare function exposeFileService(file: File, expServices: ExposedServices): FileMsg;
15
- export declare const fileMsgType: ProtoType<FileMsg>;
16
- export declare function packStats(s: Stats): Buffer;
17
- export declare function unpackStats(buf: Buffer | void): Stats;
18
19
  export interface FileMsg {
19
20
  writable: boolean;
20
21
  isVersioned: boolean;
22
+ isSynced: boolean;
21
23
  name: string;
22
24
  isNew: boolean;
23
25
  impl: ObjectReference<'FileImpl'>;
24
26
  }
27
+ export declare const fileMsgType: ProtoType<FileMsg>;
28
+ export declare function packStats(s: Stats): Buffer;
29
+ export declare function unpackStats(buf: Buffer | void): Stats;
30
+ export declare function packSyncStatus(s: SyncStatus): Buffer;
31
+ export declare function unpackSyncStatus(buf: Buffer | void): SyncStatus;
25
32
  export declare function packXAttrValue(val: any): EnvelopeBody;
26
33
  export declare function unpackXAttrValue(buf: EnvelopeBody): any;
27
34
  export declare namespace readBytes {
@@ -32,8 +39,8 @@ export declare namespace readBytes {
32
39
  }
33
40
  export declare function packJSON(json: any): EnvelopeBody;
34
41
  export declare function unpackJSON(buf: EnvelopeBody): any;
35
- export declare function packFileEvent(e: FileEvent): Buffer;
36
- export declare function unpackFileEvent(buf: EnvelopeBody): FileEvent;
42
+ export declare function packFileEvent(e: FileEvent | RemoteEvent): Buffer;
43
+ export declare function unpackFileEvent(buf: EnvelopeBody): FileEvent | RemoteEvent;
37
44
  export declare namespace vGetXAttr {
38
45
  interface Reply {
39
46
  version: number;
@@ -97,16 +104,21 @@ export declare namespace vGetByteSource {
97
104
  function wrapService(fn: ReadonlyFileVersionedAPI['getByteSource'], expServices: ExposedServices): ExposedFn;
98
105
  function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileVersionedAPI['getByteSource'];
99
106
  }
107
+ export interface XAttrMsg {
108
+ xaName: string;
109
+ str?: Value<string>;
110
+ json?: Value<string>;
111
+ bytes?: Value<Buffer>;
112
+ }
113
+ export declare function xattrToMsg(xaName: string, val: any): XAttrMsg;
114
+ export declare function xattrFromMsg(msg: XAttrMsg): {
115
+ name: string;
116
+ value: any;
117
+ };
100
118
  export declare namespace updateXAttrs {
101
- interface Attr {
102
- xaName: string;
103
- str?: Value<string>;
104
- json?: Value<string>;
105
- bytes?: Value<Buffer>;
106
- }
107
119
  interface Request {
108
120
  changes: {
109
- set: Attr[];
121
+ set: XAttrMsg[];
110
122
  remove: string[];
111
123
  };
112
124
  }
@@ -126,4 +138,28 @@ export declare namespace vGetByteSink {
126
138
  function wrapService(fn: WritableFileVersionedAPI['getByteSink'], expServices: ExposedServices): ExposedFn;
127
139
  function makeCaller(caller: Caller, objPath: string[]): WritableFileVersionedAPI['getByteSink'];
128
140
  }
141
+ export interface OptionsToUploadLocalMsg {
142
+ localVersion?: Value<number>;
143
+ uploadVersion?: Value<number>;
144
+ }
145
+ export declare function optionsToUploadLocalToMsg(opts?: OptionsToUploadLocal): OptionsToUploadLocalMsg | undefined;
146
+ export declare function optionsToUploadLocalFromMsg(opts?: OptionsToUploadLocalMsg): OptionsToUploadLocal | undefined;
147
+ export interface OptionsToAdopteRemoteMsg {
148
+ dropLocalVer?: Value<boolean>;
149
+ remoteVersion?: Value<number>;
150
+ }
151
+ export declare function remoteAdoptionOptsToMsg(opts: OptionsToAdopteRemote | undefined): OptionsToAdopteRemoteMsg | undefined;
152
+ export declare function remoteAdoptionOptsFromMsg(msg: OptionsToAdopteRemoteMsg | undefined): OptionsToAdopteRemote | undefined;
153
+ export declare namespace vListVersions {
154
+ function packReply(v: {
155
+ current?: number;
156
+ archived?: number[];
157
+ }): Buffer;
158
+ function unpackReply(b: Buffer): {
159
+ current?: number;
160
+ archived?: number[];
161
+ };
162
+ function wrapService(fn: ReadonlyFileVersionedAPI['listVersions']): ExposedFn;
163
+ function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileVersionedAPI['listVersions'];
164
+ }
129
165
  export {};