core-3nweb-client-lib 0.26.1 → 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 (199) hide show
  1. package/build/api-defs/asmail.d.ts +1 -1
  2. package/build/api-defs/files.d.ts +278 -69
  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.js +5 -1
  12. package/build/core/asmail/inbox/cached-msgs.js +1 -1
  13. package/build/core/asmail/inbox/inbox-events.js +4 -4
  14. package/build/core/asmail/inbox/index.js +10 -10
  15. package/build/core/asmail/inbox/msg-downloader.js +1 -1
  16. package/build/core/asmail/inbox/msg-indexing.js +1 -1
  17. package/build/core/asmail/inbox/msg-on-disk.js +5 -5
  18. package/build/core/asmail/index.d.ts +3 -3
  19. package/build/core/asmail/index.js +13 -8
  20. package/build/core/asmail/key-verification.js +5 -5
  21. package/build/core/asmail/keyring/common.js +7 -6
  22. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  23. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  24. package/build/core/asmail/keyring/index.d.ts +7 -8
  25. package/build/core/asmail/keyring/index.js +15 -14
  26. package/build/core/asmail/keyring/keyring-storage.js +2 -1
  27. package/build/core/asmail/msg/opener.js +3 -3
  28. package/build/core/asmail/msg/packer.js +13 -13
  29. package/build/core/asmail/sending-params/own-params.js +2 -2
  30. package/build/core/asmail/sending-params/params-from-others.js +1 -1
  31. package/build/core/id-manager.js +6 -3
  32. package/build/core/index.d.ts +2 -1
  33. package/build/core/index.js +14 -14
  34. package/build/core/sign-in.js +5 -5
  35. package/build/core/sign-up.js +9 -9
  36. package/build/core/storage/common/json-saving.js +2 -2
  37. package/build/core/storage/common/obj-info-file.d.ts +12 -4
  38. package/build/core/storage/common/obj-info-file.js +66 -34
  39. package/build/core/storage/common/utils.d.ts +2 -0
  40. package/build/core/storage/common/utils.js +32 -0
  41. package/build/core/storage/index.d.ts +3 -17
  42. package/build/core/storage/index.js +56 -76
  43. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  44. package/build/core/storage/local/obj-files-gc.js +49 -37
  45. package/build/core/storage/local/obj-files.d.ts +4 -7
  46. package/build/core/storage/local/obj-files.js +7 -10
  47. package/build/core/storage/local/obj-status.d.ts +12 -6
  48. package/build/core/storage/local/obj-status.js +24 -9
  49. package/build/core/storage/local/storage.d.ts +9 -6
  50. package/build/core/storage/local/storage.js +29 -18
  51. package/build/core/storage/synced/downloader.js +1 -1
  52. package/build/core/storage/synced/obj-files-gc.d.ts +5 -1
  53. package/build/core/storage/synced/obj-files-gc.js +91 -37
  54. package/build/core/storage/synced/obj-files.d.ts +42 -36
  55. package/build/core/storage/synced/obj-files.js +178 -147
  56. package/build/core/storage/synced/obj-status.d.ts +87 -85
  57. package/build/core/storage/synced/obj-status.js +463 -259
  58. package/build/core/storage/synced/remote-events.d.ts +11 -12
  59. package/build/core/storage/synced/remote-events.js +73 -56
  60. package/build/core/storage/synced/storage.d.ts +18 -9
  61. package/build/core/storage/synced/storage.js +108 -48
  62. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  63. package/build/core/storage/synced/upload-header-file.js +64 -0
  64. package/build/core/storage/synced/upsyncer.d.ts +12 -7
  65. package/build/core/storage/synced/upsyncer.js +205 -280
  66. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  67. package/build/core/storage/system-folders/apps-data.js +110 -0
  68. package/build/core/storage/system-folders/index.d.ts +18 -0
  69. package/build/core/storage/system-folders/index.js +77 -0
  70. package/build/core-ipc/common-caps.js +3 -3
  71. package/build/core-ipc/generic.js +8 -8
  72. package/build/core-ipc/startup-caps.js +2 -2
  73. package/build/cryptors.js +6 -2
  74. package/build/ipc-via-protobuf/asmail-cap.js +58 -57
  75. package/build/ipc-via-protobuf/bytes.js +16 -17
  76. package/build/ipc-via-protobuf/connector-clients-side.d.ts +1 -0
  77. package/build/ipc-via-protobuf/connector-clients-side.js +14 -15
  78. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  79. package/build/ipc-via-protobuf/connector.js +4 -4
  80. package/build/ipc-via-protobuf/file.d.ts +48 -12
  81. package/build/ipc-via-protobuf/file.js +474 -126
  82. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  83. package/build/ipc-via-protobuf/fs.js +577 -142
  84. package/build/ipc-via-protobuf/log-cap.js +2 -2
  85. package/build/ipc-via-protobuf/mailerid.js +3 -3
  86. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  87. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  88. package/build/ipc-via-protobuf/startup-cap.js +21 -21
  89. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  90. package/build/ipc.js +7 -2
  91. package/build/lib-client/3nstorage/exceptions.d.ts +3 -0
  92. package/build/lib-client/3nstorage/exceptions.js +13 -1
  93. package/build/lib-client/3nstorage/service.d.ts +16 -2
  94. package/build/lib-client/3nstorage/service.js +104 -38
  95. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  96. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  97. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  98. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +42 -18
  99. package/build/lib-client/3nstorage/xsp-fs/common.js +29 -19
  100. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  101. package/build/lib-client/3nstorage/xsp-fs/file-node.js +17 -13
  102. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  103. package/build/lib-client/3nstorage/xsp-fs/file.js +73 -25
  104. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  105. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  106. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +575 -179
  107. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
  108. package/build/lib-client/3nstorage/xsp-fs/fs.js +231 -110
  109. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  110. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  111. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -24
  112. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +229 -123
  113. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  114. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +17 -18
  115. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -3
  116. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +53 -53
  117. package/build/lib-client/3nweb-signup.js +4 -4
  118. package/build/lib-client/asmail/recipient.js +15 -15
  119. package/build/lib-client/asmail/sender.js +22 -22
  120. package/build/lib-client/asmail/service-config.js +3 -3
  121. package/build/lib-client/cryptor/cryptor-in-worker.js +18 -16
  122. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  123. package/build/lib-client/cryptor/cryptor.js +4 -2
  124. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  125. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  126. package/build/lib-client/cryptor/in-proc-wasm.js +6 -6
  127. package/build/lib-client/cryptor/worker-js.js +2 -2
  128. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  129. package/build/lib-client/files-select.js +1 -1
  130. package/build/lib-client/files.d.ts +1 -1
  131. package/build/lib-client/files.js +71 -6
  132. package/build/lib-client/fs-collection.js +1 -1
  133. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  134. package/build/lib-client/fs-sync-utils.js +61 -0
  135. package/build/lib-client/fs-view.d.ts +14 -0
  136. package/build/lib-client/fs-view.js +33 -0
  137. package/build/lib-client/key-derivation.js +1 -1
  138. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  139. package/build/lib-client/local-files/dev-file-src.js +2 -2
  140. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  141. package/build/lib-client/local-files/device-fs.js +56 -54
  142. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  143. package/build/lib-client/logging/log-to-file.js +7 -7
  144. package/build/lib-client/mailer-id/login.js +7 -7
  145. package/build/lib-client/mailer-id/provisioner.js +12 -12
  146. package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -3
  147. package/build/lib-client/objs-on-disk/obj-folders.js +31 -31
  148. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  149. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  150. package/build/lib-client/request-utils.d.ts +1 -0
  151. package/build/lib-client/request-utils.js +13 -13
  152. package/build/lib-client/server-events.d.ts +3 -3
  153. package/build/lib-client/server-events.js +9 -8
  154. package/build/lib-client/service-locator.js +10 -10
  155. package/build/lib-client/user-with-mid-session.js +7 -7
  156. package/build/lib-client/user-with-pkl-session.js +25 -25
  157. package/build/lib-client/ws-utils.js +2 -2
  158. package/build/lib-common/async-cryptor-wrap.js +4 -4
  159. package/build/lib-common/async-fs-node.d.ts +5 -3
  160. package/build/lib-common/async-fs-node.js +16 -16
  161. package/build/lib-common/byte-streaming/pipe.js +1 -1
  162. package/build/lib-common/byte-streaming/wrapping.js +13 -13
  163. package/build/lib-common/canonical-address.js +1 -1
  164. package/build/lib-common/exceptions/error.d.ts +1 -0
  165. package/build/lib-common/exceptions/error.js +7 -6
  166. package/build/lib-common/exceptions/file.js +4 -0
  167. package/build/lib-common/ipc/ws-ipc.js +2 -2
  168. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  169. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  170. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  171. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  172. package/build/lib-common/objs-on-disk/obj-file.js +96 -35
  173. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  174. package/build/lib-common/objs-on-disk/utils.js +3 -3
  175. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  176. package/build/lib-common/processes/labelled-exec-pools.d.ts +1 -1
  177. package/build/lib-common/processes/labelled-exec-pools.js +1 -1
  178. package/build/lib-common/processes/pressure.js +2 -2
  179. package/build/lib-common/processes/synced.js +1 -1
  180. package/build/lib-common/processes/timeout.js +2 -2
  181. package/build/lib-common/random-node.js +7 -7
  182. package/build/lib-common/service-api/3nstorage/owner.d.ts +95 -35
  183. package/build/lib-common/service-api/3nstorage/owner.js +82 -40
  184. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  185. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  186. package/build/lib-common/timed-cache.d.ts +1 -0
  187. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  188. package/build/lib-common/timed-non-weak-cache.js +11 -0
  189. package/build/lib-common/utils-for-observables.js +4 -4
  190. package/build/lib-common/weak-cache.d.ts +1 -0
  191. package/build/lib-common/weak-cache.js +12 -1
  192. package/build/lib-index.d.ts +2 -1
  193. package/build/lib-index.js +10 -7
  194. package/build/protos/asmail.proto.js +12955 -7496
  195. package/build/protos/file.proto.js +4867 -2744
  196. package/build/protos/fs.proto.js +9227 -3768
  197. package/package.json +6 -5
  198. package/protos/file.proto +91 -19
  199. package/protos/fs.proto +107 -8
@@ -48,7 +48,7 @@ class MailSender {
48
48
  return this.uri;
49
49
  }
50
50
  get serviceDomain() {
51
- return url_1.parse(this.uri).hostname;
51
+ return (0, url_1.parse)(this.uri).hostname;
52
52
  }
53
53
  /**
54
54
  * This static method creates a fresh, as apposed to restarted, sender.
@@ -84,7 +84,7 @@ class MailSender {
84
84
  return ms;
85
85
  }
86
86
  async setDeliveryUrl(serviceUrl) {
87
- const info = await service_locator_1.asmailInfoAt(this.net, serviceUrl);
87
+ const info = await (0, service_locator_1.asmailInfoAt)(this.net, serviceUrl);
88
88
  if (!info.delivery) {
89
89
  throw new Error(`Missing delivery service url in ASMail information at ${serviceUrl}`);
90
90
  }
@@ -161,7 +161,7 @@ class MailSender {
161
161
  prepareRedirectOrThrowUp(rep) {
162
162
  if (("string" !== typeof rep.redirect) ||
163
163
  (rep.redirect.length === 0) ||
164
- (url_1.parse(rep.redirect).protocol !== 'https:')) {
164
+ ((0, url_1.parse)(rep.redirect).protocol !== 'https:')) {
165
165
  throw this.badRedirectExc();
166
166
  }
167
167
  // refuse second redirect
@@ -195,10 +195,10 @@ class MailSender {
195
195
  }, reqData);
196
196
  if (rep.status === api.preFlight.SC.ok) {
197
197
  if (typeof rep.data.maxMsgLength !== 'number') {
198
- throw request_utils_1.makeException(rep, 'Malformed reply: missing number maxMsgLength');
198
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: missing number maxMsgLength');
199
199
  }
200
200
  if (rep.data.maxMsgLength < 500) {
201
- throw request_utils_1.makeException(rep, 'Malformed reply: maxMsgLength is too short');
201
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: maxMsgLength is too short');
202
202
  }
203
203
  this.maxMsgLength = rep.data.maxMsgLength;
204
204
  return rep.data;
@@ -217,7 +217,7 @@ class MailSender {
217
217
  throw this.inboxIsFullExc();
218
218
  }
219
219
  else {
220
- throw request_utils_1.makeException(rep, 'Unexpected status');
220
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
221
221
  }
222
222
  }
223
223
  /**
@@ -245,14 +245,14 @@ class MailSender {
245
245
  }, reqData);
246
246
  if (rep.status == api.sessionStart.SC.ok) {
247
247
  if (typeof rep.data.maxMsgLength !== 'number') {
248
- throw request_utils_1.makeException(rep, 'Malformed reply: missing number maxMsgLength');
248
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: missing number maxMsgLength');
249
249
  }
250
250
  if (rep.data.maxMsgLength < 500) {
251
- throw request_utils_1.makeException(rep, 'Malformed reply: maxMsgLength is too short');
251
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: maxMsgLength is too short');
252
252
  }
253
253
  this.maxMsgLength = rep.data.maxMsgLength;
254
254
  if ('string' !== typeof rep.data.sessionId) {
255
- throw request_utils_1.makeException(rep, 'Malformed reply: missing sessionId string');
255
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: missing sessionId string');
256
256
  }
257
257
  this.sessionId = rep.data.sessionId;
258
258
  delete rep.data.sessionId;
@@ -272,7 +272,7 @@ class MailSender {
272
272
  throw this.inboxIsFullExc();
273
273
  }
274
274
  else {
275
- throw request_utils_1.makeException(rep, 'Unexpected status');
275
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
276
276
  }
277
277
  }
278
278
  async restartSession() {
@@ -290,14 +290,14 @@ class MailSender {
290
290
  }, reqData);
291
291
  if (rep.status == api.sessionRestart.SC.ok) {
292
292
  if (typeof rep.data.maxMsgLength !== 'number') {
293
- throw request_utils_1.makeException(rep, 'Malformed reply: missing number maxMsgLength');
293
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: missing number maxMsgLength');
294
294
  }
295
295
  if (rep.data.maxMsgLength < 500) {
296
- throw request_utils_1.makeException(rep, 'Malformed reply: maxMsgLength is too short');
296
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: maxMsgLength is too short');
297
297
  }
298
298
  this.maxMsgLength = rep.data.maxMsgLength;
299
299
  if (typeof rep.data.sessionId !== 'string') {
300
- throw request_utils_1.makeException(rep, 'Malformed reply: missing sessionId string');
300
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: missing sessionId string');
301
301
  }
302
302
  this.sessionId = rep.data.sessionId;
303
303
  if ((typeof rep.data.maxChunkSize === 'number') &&
@@ -314,7 +314,7 @@ class MailSender {
314
314
  throw this.unknownRecipientExc();
315
315
  }
316
316
  else {
317
- throw request_utils_1.makeException(rep, 'Unexpected status');
317
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
318
318
  }
319
319
  }
320
320
  /**
@@ -344,7 +344,7 @@ class MailSender {
344
344
  throw this.authFailedOnDeliveryExc();
345
345
  }
346
346
  else {
347
- throw request_utils_1.makeException(rep, 'Unexpected status');
347
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
348
348
  }
349
349
  }
350
350
  /**
@@ -369,7 +369,7 @@ class MailSender {
369
369
  throw this.recipientHasNoPubKeyExc();
370
370
  }
371
371
  else {
372
- throw request_utils_1.makeException(rep, 'Unexpected status');
372
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
373
373
  }
374
374
  }
375
375
  /**
@@ -391,12 +391,12 @@ class MailSender {
391
391
  if (rep.status == api.msgMeta.SC.ok) {
392
392
  if (('string' !== typeof rep.data.msgId) ||
393
393
  (rep.data.msgId.length === 0)) {
394
- throw request_utils_1.makeException(rep, 'Malformed reply: msgId string is missing');
394
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: msgId string is missing');
395
395
  }
396
396
  this.msgId = rep.data.msgId;
397
397
  if (typeof rep.data.maxChunkSize === 'number') {
398
398
  if (rep.data.maxChunkSize < 64 * 1024) {
399
- throw request_utils_1.makeException(rep, 'Malformed reply: maxChunkSize is too small');
399
+ throw (0, request_utils_1.makeException)(rep, 'Malformed reply: maxChunkSize is too small');
400
400
  }
401
401
  else if (rep.data.maxChunkSize < this.maxChunkSize) {
402
402
  this.maxChunkSize = rep.data.maxChunkSize;
@@ -411,7 +411,7 @@ class MailSender {
411
411
  };
412
412
  }
413
413
  else {
414
- throw request_utils_1.makeException(rep, 'Unexpected status');
414
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
415
415
  }
416
416
  }
417
417
  async trySessionRestart() {
@@ -449,7 +449,7 @@ class MailSender {
449
449
  return this.sendObj(objId, bytes, fstReq, followReq);
450
450
  }
451
451
  else {
452
- throw request_utils_1.makeException(rep, 'Unexpected status, when session restart is not expected to happen');
452
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status, when session restart is not expected to happen');
453
453
  }
454
454
  }
455
455
  else if (rep.status === api.msgObj.SC.ok) {
@@ -457,7 +457,7 @@ class MailSender {
457
457
  return;
458
458
  }
459
459
  else {
460
- throw request_utils_1.makeException(rep, 'Unexpected status');
460
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
461
461
  }
462
462
  }
463
463
  /**
@@ -473,7 +473,7 @@ class MailSender {
473
473
  this.sessionId = undefined;
474
474
  }
475
475
  else {
476
- throw request_utils_1.makeException(rep, 'Unexpected status');
476
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
477
477
  }
478
478
  }
479
479
  async cancelDelivery() {
@@ -31,7 +31,7 @@ class MailConfigurator extends user_with_mid_session_1.ServiceUser {
31
31
  canBeRedirected: true
32
32
  }, getSigner, async () => {
33
33
  const serviceUrl = await mainUrlGetter();
34
- const info = await service_locator_1.asmailInfoAt(this.net, serviceUrl);
34
+ const info = await (0, service_locator_1.asmailInfoAt)(this.net, serviceUrl);
35
35
  if (!info.config) {
36
36
  throw new Error(`Missing configuration service url in ASMail information at ${serviceUrl}`);
37
37
  }
@@ -47,7 +47,7 @@ class MailConfigurator extends user_with_mid_session_1.ServiceUser {
47
47
  responseType: 'json'
48
48
  });
49
49
  if (rep.status !== api.PARAM_SC.ok) {
50
- throw request_utils_1.makeException(rep, 'Unexpected status');
50
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
51
51
  }
52
52
  return rep.data;
53
53
  }
@@ -57,7 +57,7 @@ class MailConfigurator extends user_with_mid_session_1.ServiceUser {
57
57
  method: 'PUT',
58
58
  }, param);
59
59
  if (rep.status !== api.PARAM_SC.ok) {
60
- throw request_utils_1.makeException(rep, 'Unexpected status');
60
+ throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
61
61
  }
62
62
  }
63
63
  }
@@ -39,10 +39,10 @@ function workerScriptFor(impl) {
39
39
  const dirWithThis = ((asarInd < 0) ?
40
40
  __dirname : `${__dirname.substring(0, asarInd + 8)}.unpacked${__dirname.substring(asarInd + 8)}`);
41
41
  if (impl === 'js') {
42
- return path_1.join(dirWithThis, jsWorkerFName);
42
+ return (0, path_1.join)(dirWithThis, jsWorkerFName);
43
43
  }
44
44
  else if (impl === 'wasm') {
45
- return path_1.join(dirWithThis, wasmWorkerFName);
45
+ return (0, path_1.join)(dirWithThis, wasmWorkerFName);
46
46
  }
47
47
  else {
48
48
  throw new Error(`Unknown worker implementation ${impl}`);
@@ -71,7 +71,7 @@ class Workers {
71
71
  }
72
72
  }, MAX_IDLE_MILLIS).unref();
73
73
  this.maxThreads = Math.max(1, ((typeof maxThreads === 'number') ?
74
- maxThreads : os_1.cpus().length - 1));
74
+ maxThreads : (0, os_1.cpus)().length - 1));
75
75
  }
76
76
  async getIdleWorker() {
77
77
  const idle = this.idleWorkers.pop();
@@ -82,7 +82,7 @@ class Workers {
82
82
  return this.makeWorker();
83
83
  }
84
84
  else {
85
- const deferred = deferred_1.defer();
85
+ const deferred = (0, deferred_1.defer)();
86
86
  this.waitingForIdle.push(deferred);
87
87
  const worker = await deferred.promise;
88
88
  return worker;
@@ -104,7 +104,7 @@ class Workers {
104
104
  }
105
105
  async makeWorker() {
106
106
  const workerData = {
107
- loadDir: path_1.dirname(this.workerScript)
107
+ loadDir: (0, path_1.dirname)(this.workerScript)
108
108
  };
109
109
  const worker = new worker_threads_1.Worker(this.workerScript, { workerData });
110
110
  this.allWorkers.add(worker);
@@ -146,7 +146,7 @@ class Workers {
146
146
  const sink = this.replySinks.get(worker);
147
147
  if (sink) {
148
148
  this.replySinks.delete(worker);
149
- const errWrapped = error_1.errWithCause(err, `Error in cryptor worker thread`);
149
+ const errWrapped = (0, error_1.errWithCause)(err, `Error in cryptor worker thread`);
150
150
  this.logErr(errWrapped);
151
151
  sink.res.reject(errWrapped);
152
152
  }
@@ -156,11 +156,11 @@ class Workers {
156
156
  });
157
157
  worker.on('exit', err => {
158
158
  if (err && !this.isClosed) {
159
- this.logErr(error_1.errWithCause(err, `Worker exited with error ${err}`));
159
+ this.logErr((0, error_1.errWithCause)(err, `Worker exited with error ${err}`));
160
160
  }
161
161
  });
162
162
  const workerReady = new Promise((resolve, reject) => {
163
- const errOnStart = (err) => reject(error_1.errWithCause(err, `Failed to start cryptor worker in thread`));
163
+ const errOnStart = (err) => reject((0, error_1.errWithCause)(err, `Failed to start cryptor worker in thread`));
164
164
  const earlyExit = (exitCode) => reject(new Error(`Thread with worker cryptor exited early with code ${exitCode}`));
165
165
  worker.on('error', errOnStart);
166
166
  worker.on('exit', earlyExit);
@@ -216,7 +216,7 @@ class JsWorkers extends Workers {
216
216
  super(workerScriptFor('js'), logErr, logWarning, maxThreads);
217
217
  }
218
218
  call(func, args, trans, interim) {
219
- return this.doRequest({ func, args }, trans, { res: deferred_1.defer(), interim });
219
+ return this.doRequest({ func, args }, trans, { res: (0, deferred_1.defer)(), interim });
220
220
  }
221
221
  processReply(reply) {
222
222
  return reply;
@@ -235,9 +235,9 @@ Object.freeze(JsWorkers);
235
235
  // }
236
236
  // return transferLst;
237
237
  // }
238
- exports.makeInWorkerCryptor = (logErr, logWarning, maxThreads) => {
239
- assert_1.assert(typeof logErr === 'function');
240
- assert_1.assert(typeof logWarning === 'function');
238
+ const makeInWorkerCryptor = (logErr, logWarning, maxThreads) => {
239
+ (0, assert_1.assert)(typeof logErr === 'function');
240
+ (0, assert_1.assert)(typeof logWarning === 'function');
241
241
  const workers = new JsWorkers(logErr, logWarning, maxThreads);
242
242
  const close = workers.close.bind(workers);
243
243
  const cryptor = {
@@ -262,6 +262,7 @@ exports.makeInWorkerCryptor = (logErr, logWarning, maxThreads) => {
262
262
  };
263
263
  return { cryptor, close };
264
264
  };
265
+ exports.makeInWorkerCryptor = makeInWorkerCryptor;
265
266
  class WasmWorkers extends Workers {
266
267
  constructor(logErr, logWarning, maxThreads) {
267
268
  super(workerScriptFor('wasm'), logErr, logWarning, maxThreads);
@@ -270,7 +271,7 @@ class WasmWorkers extends Workers {
270
271
  }
271
272
  call(req, interim) {
272
273
  const msg = this.reqType.pack(req);
273
- return this.doRequest(msg, undefined, { res: deferred_1.defer(), interim });
274
+ return this.doRequest(msg, undefined, { res: (0, deferred_1.defer)(), interim });
274
275
  }
275
276
  processReply(replyBytes) {
276
277
  const { res, interim, err } = this.replyType.unpack(replyBytes);
@@ -297,9 +298,9 @@ function toLocalErr(replyErr) {
297
298
  return new Error(`WASM cryptor ${replyErr.condition}: ${replyErr.message}`);
298
299
  }
299
300
  }
300
- exports.makeInWorkerWasmCryptor = (logErr, logWarning, maxThreads) => {
301
- assert_1.assert(typeof logErr === 'function');
302
- assert_1.assert(typeof logWarning === 'function');
301
+ const makeInWorkerWasmCryptor = (logErr, logWarning, maxThreads) => {
302
+ (0, assert_1.assert)(typeof logErr === 'function');
303
+ (0, assert_1.assert)(typeof logWarning === 'function');
303
304
  const workers = new WasmWorkers(logErr, logWarning, maxThreads);
304
305
  const close = workers.close.bind(workers);
305
306
  const boolValType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.BoolVal);
@@ -362,4 +363,5 @@ exports.makeInWorkerWasmCryptor = (logErr, logWarning, maxThreads) => {
362
363
  };
363
364
  return { cryptor, close };
364
365
  };
366
+ exports.makeInWorkerWasmCryptor = makeInWorkerWasmCryptor;
365
367
  Object.freeze(exports);