core-3nweb-client-lib 0.25.6 → 0.27.0

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 (215) hide show
  1. package/README.md +2 -2
  2. package/build/api-defs/asmail.d.ts +1 -1
  3. package/build/api-defs/files.d.ts +282 -70
  4. package/build/core/app-files.js +7 -7
  5. package/build/core/asmail/config/common.js +4 -4
  6. package/build/core/asmail/config/index.js +2 -2
  7. package/build/core/asmail/config/published-intro-key.js +1 -1
  8. package/build/core/asmail/delivery/common.js +7 -7
  9. package/build/core/asmail/delivery/index.js +7 -6
  10. package/build/core/asmail/delivery/msg.js +8 -7
  11. package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
  12. package/build/core/asmail/inbox/attachments/fs.js +11 -1
  13. package/build/core/asmail/inbox/cached-msgs.js +3 -3
  14. package/build/core/asmail/inbox/inbox-events.js +5 -4
  15. package/build/core/asmail/inbox/index.js +12 -12
  16. package/build/core/asmail/inbox/msg-downloader.js +3 -3
  17. package/build/core/asmail/inbox/msg-indexing.js +4 -4
  18. package/build/core/asmail/inbox/msg-on-disk.js +7 -7
  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 +4 -3
  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 +4 -4
  31. package/build/core/asmail/sending-params/params-from-others.js +3 -3
  32. package/build/core/id-manager.js +8 -5
  33. package/build/core/index.d.ts +2 -1
  34. package/build/core/index.js +14 -14
  35. package/build/core/sign-in.d.ts +5 -4
  36. package/build/core/sign-in.js +12 -14
  37. package/build/core/sign-up.d.ts +1 -0
  38. package/build/core/sign-up.js +15 -11
  39. package/build/core/storage/common/json-saving.d.ts +21 -0
  40. package/build/core/storage/common/json-saving.js +82 -0
  41. package/build/core/storage/common/obj-info-file.d.ts +51 -0
  42. package/build/core/storage/common/obj-info-file.js +153 -5
  43. package/build/core/storage/common/utils.d.ts +2 -0
  44. package/build/core/storage/common/utils.js +32 -0
  45. package/build/core/storage/index.d.ts +3 -17
  46. package/build/core/storage/index.js +57 -77
  47. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  48. package/build/core/storage/local/obj-files-gc.js +53 -39
  49. package/build/core/storage/local/obj-files.d.ts +6 -9
  50. package/build/core/storage/local/obj-files.js +16 -19
  51. package/build/core/storage/local/obj-status.d.ts +20 -30
  52. package/build/core/storage/local/obj-status.js +46 -113
  53. package/build/core/storage/local/storage.d.ts +15 -5
  54. package/build/core/storage/local/storage.js +37 -18
  55. package/build/core/storage/synced/downloader.js +7 -6
  56. package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
  57. package/build/core/storage/synced/obj-files-gc.js +106 -13
  58. package/build/core/storage/synced/obj-files.d.ts +46 -47
  59. package/build/core/storage/synced/obj-files.js +207 -154
  60. package/build/core/storage/synced/obj-status.d.ts +103 -42
  61. package/build/core/storage/synced/obj-status.js +525 -137
  62. package/build/core/storage/synced/remote-events.d.ts +11 -12
  63. package/build/core/storage/synced/remote-events.js +80 -57
  64. package/build/core/storage/synced/storage.d.ts +24 -5
  65. package/build/core/storage/synced/storage.js +123 -38
  66. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  67. package/build/core/storage/synced/upload-header-file.js +64 -0
  68. package/build/core/storage/synced/upsyncer.d.ts +15 -9
  69. package/build/core/storage/synced/upsyncer.js +219 -246
  70. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  71. package/build/core/storage/system-folders/apps-data.js +110 -0
  72. package/build/core/storage/system-folders/index.d.ts +18 -0
  73. package/build/core/storage/system-folders/index.js +77 -0
  74. package/build/core-ipc/common-caps.js +3 -3
  75. package/build/core-ipc/generic.js +8 -8
  76. package/build/core-ipc/startup-caps.js +2 -2
  77. package/build/cryptors.js +6 -2
  78. package/build/ipc-via-protobuf/asmail-cap.js +67 -83
  79. package/build/ipc-via-protobuf/bytes.js +16 -17
  80. package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
  81. package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
  82. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  83. package/build/ipc-via-protobuf/connector.js +4 -4
  84. package/build/ipc-via-protobuf/file.d.ts +48 -12
  85. package/build/ipc-via-protobuf/file.js +476 -120
  86. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  87. package/build/ipc-via-protobuf/fs.js +592 -159
  88. package/build/ipc-via-protobuf/log-cap.js +2 -2
  89. package/build/ipc-via-protobuf/mailerid.js +3 -3
  90. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  91. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  92. package/build/ipc-via-protobuf/startup-cap.js +23 -23
  93. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  94. package/build/ipc.js +7 -2
  95. package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
  96. package/build/lib-client/3nstorage/exceptions.js +31 -10
  97. package/build/lib-client/3nstorage/service.d.ts +16 -2
  98. package/build/lib-client/3nstorage/service.js +109 -39
  99. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  100. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  101. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  102. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
  103. package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
  104. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  105. package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
  106. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  107. package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
  108. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  109. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  110. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
  111. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
  112. package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
  113. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  114. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  115. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
  116. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
  117. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  118. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
  119. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
  120. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
  121. package/build/lib-client/3nweb-signup.js +4 -4
  122. package/build/lib-client/asmail/recipient.js +15 -15
  123. package/build/lib-client/asmail/sender.js +22 -22
  124. package/build/lib-client/asmail/service-config.js +3 -3
  125. package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
  126. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  127. package/build/lib-client/cryptor/cryptor.js +4 -2
  128. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  129. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  130. package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
  131. package/build/lib-client/cryptor/worker-js.js +2 -2
  132. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  133. package/build/lib-client/files-select.js +1 -1
  134. package/build/lib-client/files.d.ts +1 -1
  135. package/build/lib-client/files.js +71 -4
  136. package/build/lib-client/fs-collection.js +3 -2
  137. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  138. package/build/lib-client/fs-sync-utils.js +61 -0
  139. package/build/lib-client/fs-view.d.ts +14 -0
  140. package/build/lib-client/fs-view.js +33 -0
  141. package/build/lib-client/key-derivation.js +1 -1
  142. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  143. package/build/lib-client/local-files/dev-file-src.js +2 -2
  144. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  145. package/build/lib-client/local-files/device-fs.js +56 -54
  146. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  147. package/build/lib-client/logging/log-to-file.js +11 -11
  148. package/build/lib-client/mailer-id/login.js +7 -7
  149. package/build/lib-client/mailer-id/provisioner.js +12 -12
  150. package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
  151. package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
  152. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  153. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  154. package/build/lib-client/request-utils.d.ts +1 -0
  155. package/build/lib-client/request-utils.js +14 -14
  156. package/build/lib-client/server-events.d.ts +3 -3
  157. package/build/lib-client/server-events.js +12 -10
  158. package/build/lib-client/service-locator.js +10 -10
  159. package/build/lib-client/user-with-mid-session.js +7 -7
  160. package/build/lib-client/user-with-pkl-session.js +25 -25
  161. package/build/lib-client/ws-utils.js +3 -3
  162. package/build/lib-common/async-cryptor-wrap.js +4 -4
  163. package/build/lib-common/async-fs-node.d.ts +5 -3
  164. package/build/lib-common/async-fs-node.js +19 -18
  165. package/build/lib-common/byte-streaming/pipe.js +1 -1
  166. package/build/lib-common/byte-streaming/wrapping.js +17 -17
  167. package/build/lib-common/canonical-address.js +1 -1
  168. package/build/lib-common/exceptions/error.d.ts +1 -0
  169. package/build/lib-common/exceptions/error.js +7 -6
  170. package/build/lib-common/exceptions/file.js +10 -1
  171. package/build/lib-common/ipc/generic-ipc.js +2 -2
  172. package/build/lib-common/ipc/ws-ipc.js +2 -2
  173. package/build/lib-common/json-utils.js +2 -1
  174. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  175. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  176. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  177. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  178. package/build/lib-common/objs-on-disk/obj-file.js +99 -37
  179. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  180. package/build/lib-common/objs-on-disk/utils.js +4 -4
  181. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  182. package/build/lib-common/processes/deferred.d.ts +6 -0
  183. package/build/lib-common/processes/deferred.js +30 -0
  184. package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
  185. package/build/lib-common/processes/labelled-exec-pools.js +141 -0
  186. package/build/lib-common/processes/pressure.d.ts +7 -0
  187. package/build/lib-common/processes/pressure.js +56 -0
  188. package/build/lib-common/processes/sleep.d.ts +1 -0
  189. package/build/lib-common/processes/sleep.js +26 -0
  190. package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
  191. package/build/lib-common/{processes.js → processes/synced.js} +187 -204
  192. package/build/lib-common/processes/timeout.d.ts +1 -0
  193. package/build/lib-common/processes/timeout.js +51 -0
  194. package/build/lib-common/random-node.js +7 -7
  195. package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
  196. package/build/lib-common/service-api/3nstorage/owner.js +85 -42
  197. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  198. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  199. package/build/lib-common/timed-cache.d.ts +1 -0
  200. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  201. package/build/lib-common/timed-non-weak-cache.js +11 -0
  202. package/build/lib-common/utils-for-observables.d.ts +15 -1
  203. package/build/lib-common/utils-for-observables.js +70 -19
  204. package/build/lib-common/weak-cache.d.ts +1 -0
  205. package/build/lib-common/weak-cache.js +12 -1
  206. package/build/lib-index.d.ts +2 -1
  207. package/build/lib-index.js +10 -7
  208. package/build/protos/asmail.proto.js +12912 -7127
  209. package/build/protos/file.proto.js +4848 -2399
  210. package/build/protos/fs.proto.js +9230 -3445
  211. package/package.json +8 -7
  212. package/protos/file.proto +91 -11
  213. package/protos/fs.proto +107 -8
  214. package/build/core/storage/synced/upsync-status.d.ts +0 -41
  215. package/build/core/storage/synced/upsync-status.js +0 -158
@@ -25,7 +25,7 @@ function exposeLogger(fn) {
25
25
  return buf => {
26
26
  const { logType, msg, err } = logReqType.unpack(buf);
27
27
  const promise = (err ?
28
- fn(logType, msg, protobuf_msg_1.errFromMsg(err)) :
28
+ fn(logType, msg, (0, protobuf_msg_1.errFromMsg)(err)) :
29
29
  fn(logType, msg));
30
30
  return { promise };
31
31
  };
@@ -35,7 +35,7 @@ function makeLogCaller(caller, path) {
35
35
  return (type, msg, err) => {
36
36
  const req = { logType: type, msg };
37
37
  if (err) {
38
- req.err = protobuf_msg_1.errToMsg(err);
38
+ req.err = (0, protobuf_msg_1.errToMsg)(err);
39
39
  }
40
40
  return caller.startPromiseCall(path, logReqType.pack(req));
41
41
  };
@@ -40,7 +40,7 @@ var getUserId;
40
40
  function wrapService(fn) {
41
41
  return () => {
42
42
  const promise = fn()
43
- .then(userId => protobuf_msg_1.encodeToUtf8(userId));
43
+ .then(userId => (0, protobuf_msg_1.encodeToUtf8)(userId));
44
44
  return { promise };
45
45
  };
46
46
  }
@@ -50,9 +50,9 @@ var getUserId;
50
50
  return () => caller.startPromiseCall(path, undefined)
51
51
  .then(buf => {
52
52
  if (!buf) {
53
- throw connector_1.makeIPCException({ missingBodyBytes: true });
53
+ throw (0, connector_1.makeIPCException)({ missingBodyBytes: true });
54
54
  }
55
- return protobuf_msg_1.decodeFromUtf8(buf);
55
+ return (0, protobuf_msg_1.decodeFromUtf8)(buf);
56
56
  });
57
57
  }
58
58
  getUserId.makeCaller = makeCaller;
@@ -33,6 +33,7 @@ export interface Value<T> {
33
33
  export declare function toVal<T>(value: T): Value<T>;
34
34
  export declare function toOptVal<T>(value: T | undefined): Value<T> | undefined;
35
35
  export declare function valOf<T>(valObj: Value<T>): T;
36
+ export declare function intValOf(uint64: Value<number>): number;
36
37
  export declare function valOfOpt<T>(valObj: Value<T> | undefined): T | undefined;
37
38
  export declare function valOfOptJson(valObj: Value<string> | undefined): any | undefined;
38
39
  export declare function toOptJson(json: any): Value<string> | undefined;
@@ -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.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.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");
@@ -34,7 +34,7 @@ function fixInt(uint64) {
34
34
  if (typeof uint64 === 'object') {
35
35
  const { high, low } = uint64;
36
36
  if (high > MAX_HIGH) {
37
- throw connector_1.makeIPCException({
37
+ throw (0, connector_1.makeIPCException)({
38
38
  invalidNumInBody: true,
39
39
  message: 'Integer is greater than 2^53-1'
40
40
  });
@@ -62,7 +62,7 @@ function valOfOptInt(uint64) {
62
62
  if (!uint64) {
63
63
  return;
64
64
  }
65
- return fixInt(valOf(uint64));
65
+ return intValOf(uint64);
66
66
  }
67
67
  exports.valOfOptInt = valOfOptInt;
68
68
  const numValType = protobuf_type_1.ProtoType.for(common_proto_1.common.UInt64Value);
@@ -80,10 +80,10 @@ function errToMsg(err) {
80
80
  return { err: JSON.stringify(err) };
81
81
  }
82
82
  else if (err.runtimeException) {
83
- return { runtimeExcJson: JSON.stringify(err) };
83
+ return { runtimeExcJson: JSON.stringify((0, error_1.recursiveErrJSONify)(err)) };
84
84
  }
85
85
  else {
86
- return { err: error_1.stringifyErr(err) };
86
+ return { err: (0, error_1.stringifyErr)(err) };
87
87
  }
88
88
  }
89
89
  exports.errToMsg = errToMsg;
@@ -108,6 +108,10 @@ function valOf(valObj) {
108
108
  return valObj.value;
109
109
  }
110
110
  exports.valOf = valOf;
111
+ function intValOf(uint64) {
112
+ return fixInt(valOf(uint64));
113
+ }
114
+ exports.intValOf = intValOf;
111
115
  function valOfOpt(valObj) {
112
116
  return (valObj ? valObj.value : undefined);
113
117
  }
@@ -117,7 +121,7 @@ function valOfOptJson(valObj) {
117
121
  return (valObj ? JSON.parse(valObj.value) : undefined);
118
122
  }
119
123
  catch (err) {
120
- throw connector_1.makeIPCException({ cause: err, badReply: true });
124
+ throw (0, connector_1.makeIPCException)({ cause: err, badReply: true });
121
125
  }
122
126
  }
123
127
  exports.valOfOptJson = valOfOptJson;
@@ -133,7 +137,7 @@ function toOptAny(value) {
133
137
  return { bytes: toVal(value) };
134
138
  }
135
139
  else if (ArrayBuffer.isView(value)) {
136
- return { bytes: toVal(buffer_utils_1.toBuffer(value)) };
140
+ return { bytes: toVal((0, buffer_utils_1.toBuffer)(value)) };
137
141
  }
138
142
  else {
139
143
  return { json: toVal(JSON.stringify(value)) };
@@ -20,7 +20,7 @@ exports.makeSignUpCaller = exports.wrapSignUpCAP = exports.makeSignInCaller = ex
20
20
  const protobuf_msg_1 = require("./protobuf-msg");
21
21
  const rxjs_1 = require("rxjs");
22
22
  const operators_1 = require("rxjs/operators");
23
- const processes_1 = require("../lib-common/processes");
23
+ const deferred_1 = require("../lib-common/processes/deferred");
24
24
  const protobuf_type_1 = require("../lib-client/protobuf-type");
25
25
  const startup_proto_1 = require("../protos/startup.proto");
26
26
  function wrapSignInCAP(cap) {
@@ -65,7 +65,7 @@ var getAvailableAddresses;
65
65
  function wrapService(fn) {
66
66
  return buf => {
67
67
  const { name, token } = requestType.unpack(buf);
68
- const promise = fn(name, protobuf_msg_1.valOfOpt(token))
68
+ const promise = fn(name, (0, protobuf_msg_1.valOfOpt)(token))
69
69
  .then(addresses => protobuf_msg_1.strArrValType.pack({ values: addresses }));
70
70
  return { promise };
71
71
  };
@@ -74,8 +74,8 @@ var getAvailableAddresses;
74
74
  function makeCaller(caller, objPath) {
75
75
  const path = objPath.concat('getAvailableAddresses');
76
76
  return (name, token) => caller
77
- .startPromiseCall(path, requestType.pack({ name, token: protobuf_msg_1.toOptVal(token) }))
78
- .then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
77
+ .startPromiseCall(path, requestType.pack({ name, token: (0, protobuf_msg_1.toOptVal)(token) }))
78
+ .then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
79
79
  }
80
80
  getAvailableAddresses.makeCaller = makeCaller;
81
81
  })(getAvailableAddresses || (getAvailableAddresses = {}));
@@ -86,8 +86,8 @@ var addUser;
86
86
  function wrapService(fn) {
87
87
  return buf => {
88
88
  const { userId, token } = requestType.unpack(buf);
89
- const promise = fn(userId, protobuf_msg_1.valOfOpt(token))
90
- .then(wasAdded => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(wasAdded)));
89
+ const promise = fn(userId, (0, protobuf_msg_1.valOfOpt)(token))
90
+ .then(wasAdded => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(wasAdded)));
91
91
  return { promise };
92
92
  };
93
93
  }
@@ -95,7 +95,7 @@ var addUser;
95
95
  function makeCaller(caller, objPath) {
96
96
  const path = objPath.concat('addUser');
97
97
  return (userId, token) => caller
98
- .startPromiseCall(path, requestType.pack({ userId, token: protobuf_msg_1.toOptVal(token) }))
98
+ .startPromiseCall(path, requestType.pack({ userId, token: (0, protobuf_msg_1.toOptVal)(token) }))
99
99
  .then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
100
100
  }
101
101
  addUser.makeCaller = makeCaller;
@@ -108,7 +108,7 @@ var isActivated;
108
108
  return buf => {
109
109
  const { userId } = requestType.unpack(buf);
110
110
  const promise = fn(userId)
111
- .then(isActivated => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(isActivated)));
111
+ .then(isActivated => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(isActivated)));
112
112
  return { promise };
113
113
  };
114
114
  }
@@ -129,7 +129,7 @@ var createUserParams;
129
129
  return buf => {
130
130
  const { pass } = reqWithPassType.unpack(buf);
131
131
  const s = new rxjs_1.Subject();
132
- const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
132
+ const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
133
133
  fn(pass, p => s.next({ p }))
134
134
  .then(() => s.complete(), err => s.error(err));
135
135
  return { obs };
@@ -140,7 +140,7 @@ var createUserParams;
140
140
  const path = objPath.concat('createUserParams');
141
141
  return (pass, progressCB) => {
142
142
  const s = new rxjs_1.Subject();
143
- const completion = processes_1.defer();
143
+ const completion = (0, deferred_1.defer)();
144
144
  s.subscribe({
145
145
  next: buf => {
146
146
  const { p } = progressValueType.unpack(buf);
@@ -170,7 +170,7 @@ var getUsersOnDisk;
170
170
  const path = objPath.concat('getUsersOnDisk');
171
171
  return () => caller
172
172
  .startPromiseCall(path, undefined)
173
- .then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
173
+ .then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
174
174
  }
175
175
  getUsersOnDisk.makeCaller = makeCaller;
176
176
  })(getUsersOnDisk || (getUsersOnDisk = {}));
@@ -182,7 +182,7 @@ var startLoginToRemoteStorage;
182
182
  return buf => {
183
183
  const { address } = requestType.unpack(buf);
184
184
  const promise = fn(address)
185
- .then(started => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(started)));
185
+ .then(started => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(started)));
186
186
  return { promise };
187
187
  };
188
188
  }
@@ -203,10 +203,10 @@ var completeLoginAndLocalSetup;
203
203
  return buf => {
204
204
  const { pass } = reqWithPassType.unpack(buf);
205
205
  const s = new rxjs_1.Subject();
206
- const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
206
+ const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
207
207
  fn(pass, p => s.next({ p }))
208
208
  .then(ok => {
209
- s.next({ decrResult: protobuf_msg_1.toVal(ok), p: 100 });
209
+ s.next({ decrResult: (0, protobuf_msg_1.toVal)(ok), p: 100 });
210
210
  s.complete();
211
211
  }, err => s.error(err));
212
212
  return { obs };
@@ -217,12 +217,12 @@ var completeLoginAndLocalSetup;
217
217
  const path = objPath.concat('completeLoginAndLocalSetup');
218
218
  return (pass, progressCB) => {
219
219
  const s = new rxjs_1.Subject();
220
- const completion = processes_1.defer();
221
- s.asObservable().subscribe({
220
+ const completion = (0, deferred_1.defer)();
221
+ s.subscribe({
222
222
  next: buf => {
223
223
  const { decrResult, p } = progressValueType.unpack(buf);
224
- if (typeof protobuf_msg_1.valOfOpt(decrResult) === 'boolean') {
225
- completion.resolve(protobuf_msg_1.valOfOpt(decrResult));
224
+ if (typeof (0, protobuf_msg_1.valOfOpt)(decrResult) === 'boolean') {
225
+ completion.resolve((0, protobuf_msg_1.valOfOpt)(decrResult));
226
226
  }
227
227
  else {
228
228
  progressCB(p);
@@ -245,10 +245,10 @@ var useExistingStorage;
245
245
  return buf => {
246
246
  const { pass, address } = requestType.unpack(buf);
247
247
  const s = new rxjs_1.Subject();
248
- const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
248
+ const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
249
249
  fn(address, pass, p => s.next({ p }))
250
250
  .then(ok => {
251
- s.next({ decrResult: protobuf_msg_1.toVal(ok), p: 100 });
251
+ s.next({ decrResult: (0, protobuf_msg_1.toVal)(ok), p: 100 });
252
252
  s.complete();
253
253
  }, err => s.error(err));
254
254
  return { obs };
@@ -259,12 +259,12 @@ var useExistingStorage;
259
259
  const path = objPath.concat('useExistingStorage');
260
260
  return (address, pass, progressCB) => {
261
261
  const s = new rxjs_1.Subject();
262
- const completion = processes_1.defer();
262
+ const completion = (0, deferred_1.defer)();
263
263
  s.subscribe({
264
264
  next: buf => {
265
265
  const { decrResult, p } = progressValueType.unpack(buf);
266
- if (typeof protobuf_msg_1.valOfOpt(decrResult) === 'boolean') {
267
- completion.resolve(protobuf_msg_1.valOfOpt(decrResult));
266
+ if (typeof (0, protobuf_msg_1.valOfOpt)(decrResult) === 'boolean') {
267
+ completion.resolve((0, protobuf_msg_1.valOfOpt)(decrResult));
268
268
  }
269
269
  else {
270
270
  progressCB(p);
@@ -66,9 +66,9 @@ var getAppLocalFS;
66
66
  function wrapService(fn, expServices) {
67
67
  return buf => {
68
68
  const { appName } = requestType.unpack(buf);
69
- const promise = fn(protobuf_msg_1.valOfOpt(appName))
69
+ const promise = fn((0, protobuf_msg_1.valOfOpt)(appName))
70
70
  .then(fs => {
71
- const fsMsg = fs_1.exposeFSService(fs, expServices);
71
+ const fsMsg = (0, fs_1.exposeFSService)(fs, expServices);
72
72
  return fs_1.fsMsgType.pack(fsMsg);
73
73
  });
74
74
  return { promise };
@@ -78,10 +78,10 @@ var getAppLocalFS;
78
78
  function makeCaller(caller, objPath) {
79
79
  const path = objPath.concat('getAppLocalFS');
80
80
  return appName => caller
81
- .startPromiseCall(path, requestType.pack({ appName: protobuf_msg_1.toOptVal(appName) }))
81
+ .startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
82
82
  .then(buf => {
83
83
  const fsMsg = fs_1.fsMsgType.unpack(buf);
84
- return fs_1.makeFSCaller(caller, fsMsg);
84
+ return (0, fs_1.makeFSCaller)(caller, fsMsg);
85
85
  });
86
86
  }
87
87
  getAppLocalFS.makeCaller = makeCaller;
@@ -93,9 +93,9 @@ var getAppSyncedFS;
93
93
  function wrapService(fn, expServices) {
94
94
  return buf => {
95
95
  const { appName } = requestType.unpack(buf);
96
- const promise = fn(protobuf_msg_1.valOfOpt(appName))
96
+ const promise = fn((0, protobuf_msg_1.valOfOpt)(appName))
97
97
  .then(fs => {
98
- const fsMsg = fs_1.exposeFSService(fs, expServices);
98
+ const fsMsg = (0, fs_1.exposeFSService)(fs, expServices);
99
99
  return fs_1.fsMsgType.pack(fsMsg);
100
100
  });
101
101
  return { promise };
@@ -105,10 +105,10 @@ var getAppSyncedFS;
105
105
  function makeCaller(caller, objPath) {
106
106
  const path = objPath.concat('getAppSyncedFS');
107
107
  return appName => caller
108
- .startPromiseCall(path, requestType.pack({ appName: protobuf_msg_1.toOptVal(appName) }))
108
+ .startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
109
109
  .then(buf => {
110
110
  const fsMsg = fs_1.fsMsgType.unpack(buf);
111
- return fs_1.makeFSCaller(caller, fsMsg);
111
+ return (0, fs_1.makeFSCaller)(caller, fsMsg);
112
112
  });
113
113
  }
114
114
  getAppSyncedFS.makeCaller = makeCaller;
@@ -120,7 +120,7 @@ var getSysFS;
120
120
  function wrapService(fn, expServices) {
121
121
  return buf => {
122
122
  const { type, path } = requestType.unpack(buf);
123
- const promise = fn(type, protobuf_msg_1.valOfOpt(path))
123
+ const promise = fn(type, (0, protobuf_msg_1.valOfOpt)(path))
124
124
  .then(item => {
125
125
  const msg = fs_1.fsItem.exposeFSItem(expServices, item);
126
126
  return fs_1.fsItem.msgType.pack(msg);
@@ -133,7 +133,7 @@ var getSysFS;
133
133
  const ipcPath = objPath.concat('getSysFS');
134
134
  return (type, path) => caller
135
135
  .startPromiseCall(ipcPath, requestType.pack({
136
- type, path: protobuf_msg_1.toOptVal(path)
136
+ type, path: (0, protobuf_msg_1.toOptVal)(path)
137
137
  }))
138
138
  .then(buf => {
139
139
  const msg = fs_1.fsItem.msgType.unpack(buf);
@@ -149,7 +149,7 @@ var getUserFS;
149
149
  function wrapService(fn, expServices) {
150
150
  return buf => {
151
151
  const { type, path } = requestType.unpack(buf);
152
- const promise = fn(type, protobuf_msg_1.valOfOpt(path))
152
+ const promise = fn(type, (0, protobuf_msg_1.valOfOpt)(path))
153
153
  .then(item => {
154
154
  const msg = fs_1.fsItem.exposeFSItem(expServices, item);
155
155
  return fs_1.fsItem.msgType.pack(msg);
@@ -162,7 +162,7 @@ var getUserFS;
162
162
  const ipcPath = objPath.concat('getUserFS');
163
163
  return (type, path) => caller
164
164
  .startPromiseCall(ipcPath, requestType.pack({
165
- type, path: protobuf_msg_1.toOptVal(path)
165
+ type, path: (0, protobuf_msg_1.toOptVal)(path)
166
166
  }))
167
167
  .then(buf => {
168
168
  const msg = fs_1.fsItem.msgType.unpack(buf);
package/build/ipc.js CHANGED
@@ -17,15 +17,20 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
24
28
  }));
25
29
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.exposeLogger = exports.makeLogCaller = exports.exposeFSService = exports.makeFSCaller = exports.exposeFileService = exports.makeFileCaller = void 0;
29
34
  __exportStar(require("./core-ipc/common-caps"), exports);
30
35
  __exportStar(require("./core-ipc/startup-caps"), exports);
31
36
  __exportStar(require("./ipc-via-protobuf/connector"), exports);
@@ -1,20 +1,24 @@
1
1
  import { ObjId } from "./xsp-fs/common";
2
+ declare type FSSyncException = web3n.files.FSSyncException;
2
3
  export interface StorageException extends web3n.RuntimeException {
3
4
  type: 'storage';
5
+ remoteStorage?: true;
4
6
  objId?: ObjId;
5
7
  version?: number;
6
- objNotFound?: boolean;
7
- objExists?: boolean;
8
- concurrentTransaction?: boolean;
9
- unknownTransaction?: boolean;
10
- versionMismatch?: boolean;
8
+ objNotFound?: true;
9
+ objExists?: true;
10
+ concurrentTransaction?: true;
11
+ unknownTransaction?: true;
12
+ versionMismatch?: true;
11
13
  currentVersion?: number;
12
- storageIsClosed?: boolean;
14
+ storageIsClosed?: true;
13
15
  }
14
16
  export declare function makeStorageException(fields: Partial<StorageException>): StorageException;
15
- export declare function makeObjNotFoundExc(objId: ObjId, version?: number): StorageException;
16
- export declare function makeObjExistsExc(objId: ObjId, version?: number): StorageException;
17
+ export declare function makeObjNotFoundExc(objId: ObjId, version?: number, remoteStorage?: true): StorageException;
18
+ export declare function makeObjExistsExc(objId: ObjId, version?: number, remoteStorage?: true): StorageException;
17
19
  export declare function makeConcurrentTransExc(objId: ObjId): StorageException;
18
20
  export declare function makeUnknownTransactionExc(objId: ObjId): StorageException;
19
21
  export declare function makeVersionMismatchExc(objId: ObjId, currentVersion: number): StorageException;
20
22
  export declare function makeStorageIsClosedExc(): StorageException;
23
+ export declare function makeFSSyncException(path: string, fields: Partial<FSSyncException>): FSSyncException;
24
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2015 - 2016, 2019 3NSoft Inc.
3
+ Copyright (C) 2015 - 2016, 2019, 2022 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -13,9 +13,10 @@
13
13
  See the GNU General Public License for more details.
14
14
 
15
15
  You should have received a copy of the GNU General Public License along with
16
- this program. If not, see <http://www.gnu.org/licenses/>. */
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
17
18
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.makeStorageIsClosedExc = exports.makeVersionMismatchExc = exports.makeUnknownTransactionExc = exports.makeConcurrentTransExc = exports.makeObjExistsExc = exports.makeObjNotFoundExc = exports.makeStorageException = void 0;
19
+ exports.makeFSSyncException = exports.makeStorageIsClosedExc = exports.makeVersionMismatchExc = exports.makeUnknownTransactionExc = exports.makeConcurrentTransExc = exports.makeObjExistsExc = exports.makeObjNotFoundExc = exports.makeStorageException = void 0;
19
20
  function makeStorageException(fields) {
20
21
  const exc = {
21
22
  runtimeException: true,
@@ -27,25 +28,33 @@ function makeStorageException(fields) {
27
28
  return exc;
28
29
  }
29
30
  exports.makeStorageException = makeStorageException;
30
- function makeObjNotFoundExc(objId, version) {
31
- return makeStorageException({ objId, version, objNotFound: true });
31
+ function makeObjNotFoundExc(objId, version, remoteStorage) {
32
+ return makeStorageException({
33
+ objId, version, objNotFound: true, remoteStorage
34
+ });
32
35
  }
33
36
  exports.makeObjNotFoundExc = makeObjNotFoundExc;
34
- function makeObjExistsExc(objId, version) {
35
- return makeStorageException({ objId, version, objExists: true });
37
+ function makeObjExistsExc(objId, version, remoteStorage) {
38
+ return makeStorageException({
39
+ objId, version, objExists: true, remoteStorage
40
+ });
36
41
  }
37
42
  exports.makeObjExistsExc = makeObjExistsExc;
38
43
  function makeConcurrentTransExc(objId) {
39
- return makeStorageException({ objId, concurrentTransaction: true });
44
+ return makeStorageException({
45
+ objId, concurrentTransaction: true, remoteStorage: true
46
+ });
40
47
  }
41
48
  exports.makeConcurrentTransExc = makeConcurrentTransExc;
42
49
  function makeUnknownTransactionExc(objId) {
43
- return makeStorageException({ objId, unknownTransaction: true });
50
+ return makeStorageException({
51
+ objId, unknownTransaction: true, remoteStorage: true
52
+ });
44
53
  }
45
54
  exports.makeUnknownTransactionExc = makeUnknownTransactionExc;
46
55
  function makeVersionMismatchExc(objId, currentVersion) {
47
56
  return makeStorageException({
48
- objId, versionMismatch: true, currentVersion
57
+ objId, versionMismatch: true, currentVersion, remoteStorage: true
49
58
  });
50
59
  }
51
60
  exports.makeVersionMismatchExc = makeVersionMismatchExc;
@@ -53,4 +62,16 @@ function makeStorageIsClosedExc() {
53
62
  return makeStorageException({ storageIsClosed: true });
54
63
  }
55
64
  exports.makeStorageIsClosedExc = makeStorageIsClosedExc;
65
+ function makeFSSyncException(path, fields) {
66
+ const exc = {
67
+ runtimeException: true,
68
+ type: 'fs-sync',
69
+ path
70
+ };
71
+ for (const [key, value] of Object.entries(fields)) {
72
+ exc[key] = value;
73
+ }
74
+ return exc;
75
+ }
76
+ exports.makeFSSyncException = makeFSSyncException;
56
77
  Object.freeze(exports);
@@ -58,11 +58,25 @@ export declare class StorageOwner extends ServiceUser {
58
58
  * complete, or to a transaction id, which must be used for subsequent
59
59
  * request(s).
60
60
  * @param objId is object's id, with null value for root object
61
- * @param bytes are bytes to upload
62
61
  * @param fstReq is options object for the first request
63
62
  * @param followReq is options object for subsequent request(s)
63
+ * @param bytes is an object with header, diff and segs bytes to upload
64
64
  */
65
- saveNewObjVersion(objId: ObjId, bytes: Uint8Array | Uint8Array[], fstReq: FirstSaveReqOpts | undefined, followReq: FollowingSaveReqOpts | undefined): Promise<string | undefined>;
65
+ saveNewObjVersion(objId: ObjId, fstReq: {
66
+ create?: true;
67
+ ver: number;
68
+ last?: true;
69
+ } | undefined, followReq: {
70
+ trans: string;
71
+ ofs: number;
72
+ last?: boolean;
73
+ } | undefined, { header, diff, segs }: {
74
+ header?: Uint8Array;
75
+ diff?: Uint8Array;
76
+ segs?: Uint8Array | Uint8Array[];
77
+ }): Promise<string | undefined>;
78
+ archiveObjVersion(objId: ObjId, currentVer: number): Promise<void>;
79
+ getObjStatus(objId: ObjId): Promise<api.ObjStatus>;
66
80
  /**
67
81
  * This deletes object from being available as currently existing one.
68
82
  * But, it does not remove archived versions of it, even if current varsion