core-3nweb-client-lib 0.47.4 → 0.48.1

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 (94) hide show
  1. package/build/core/asmail/delivery/common.d.ts +2 -0
  2. package/build/core/asmail/delivery/msg.js +2 -2
  3. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
  4. package/build/core/asmail/inbox/attachments/fs.js +4 -3
  5. package/build/core/asmail/inbox/index.d.ts +3 -0
  6. package/build/core/asmail/inbox/index.js +4 -3
  7. package/build/core/asmail/inbox/msg-on-disk.js +1 -1
  8. package/build/core/asmail/index.d.ts +3 -1
  9. package/build/core/asmail/index.js +5 -2
  10. package/build/core/asmail/msg/packer.d.ts +4 -2
  11. package/build/core/asmail/msg/packer.js +28 -22
  12. package/build/core/asmail/sending-params/index.d.ts +2 -1
  13. package/build/core/asmail/sending-params/index.js +2 -2
  14. package/build/core/asmail/sending-params/invitations-anon.d.ts +3 -1
  15. package/build/core/asmail/sending-params/invitations-anon.js +6 -5
  16. package/build/core/id-manager/index.d.ts +4 -2
  17. package/build/core/id-manager/index.js +8 -7
  18. package/build/core/index.d.ts +3 -1
  19. package/build/core/index.js +11 -10
  20. package/build/core/keyring/common.d.ts +3 -2
  21. package/build/core/keyring/common.js +7 -7
  22. package/build/core/keyring/correspondent-keys.d.ts +4 -2
  23. package/build/core/keyring/correspondent-keys.js +10 -9
  24. package/build/core/keyring/index.d.ts +3 -1
  25. package/build/core/keyring/index.js +6 -5
  26. package/build/core/keyring/published-intro-key.d.ts +3 -1
  27. package/build/core/keyring/published-intro-key.js +8 -5
  28. package/build/core/startup/sign-up.d.ts +7 -5
  29. package/build/core/startup/sign-up.js +9 -8
  30. package/build/core/storage/index.d.ts +5 -3
  31. package/build/core/storage/index.js +9 -8
  32. package/build/core/storage/local/storage.d.ts +3 -1
  33. package/build/core/storage/local/storage.js +5 -4
  34. package/build/core/storage/synced/storage.d.ts +4 -2
  35. package/build/core/storage/synced/storage.js +7 -6
  36. package/build/injected-globals/platform-devfs.d.ts +13 -20
  37. package/build/ipc-via-protobuf/connector-services-side.js +1 -2
  38. package/build/lib-client/mailer-id/provisioner.d.ts +3 -1
  39. package/build/lib-client/mailer-id/provisioner.js +3 -3
  40. package/build/lib-client/objs-on-disk/obj-folders.js +3 -2
  41. package/build/lib-client/request-utils.d.ts +2 -2
  42. package/build/lib-client/request-utils.js +3 -3
  43. package/build/lib-client/xsp-fs/common.d.ts +2 -0
  44. package/build/lib-client/xsp-fs/common.js +2 -1
  45. package/build/lib-client/xsp-fs/file-node.d.ts +2 -1
  46. package/build/lib-client/xsp-fs/file-node.js +3 -3
  47. package/build/lib-client/xsp-fs/folder-node.d.ts +3 -2
  48. package/build/lib-client/xsp-fs/folder-node.js +10 -11
  49. package/build/lib-client/xsp-fs/link-node.d.ts +2 -1
  50. package/build/lib-client/xsp-fs/link-node.js +3 -3
  51. package/build/lib-client/xsp-fs/node-persistence.d.ts +4 -2
  52. package/build/lib-client/xsp-fs/node-persistence.js +4 -4
  53. package/build/lib-common/async-fs-node.d.ts +13 -17
  54. package/build/lib-common/mailerid-sigs/id-provider.d.ts +6 -5
  55. package/build/lib-common/mailerid-sigs/id-provider.js +7 -7
  56. package/build/lib-common/mailerid-sigs/user.d.ts +3 -2
  57. package/build/lib-common/mailerid-sigs/user.js +1 -1
  58. package/build/lib-common/mailerid-sigs/utils-NaCl-Ed.d.ts +3 -2
  59. package/build/lib-common/mailerid-sigs/utils-NaCl-Ed.js +4 -4
  60. package/build/lib-common/processes/sleep.js +2 -1
  61. package/build/lib-common/rng-def.d.ts +3 -0
  62. package/build/lib-common/rng-def.js +32 -0
  63. package/build/lib-common/timed-non-weak-cache.js +3 -2
  64. package/build/lib-common/weak-cache.js +2 -1
  65. package/build/{lib-common → lib-common-on-node}/random-node.js +2 -2
  66. package/build/lib-common-on-node/request-from-node.js +2 -2
  67. package/build/tests/caps-api/asmail/specs/send-with-attacment-from-storage.js +2 -2
  68. package/build/tests/caps-api/file-sink-checks/different-cases.js +1 -1
  69. package/build/tests/caps-api/file-sink-checks/splice.js +5 -5
  70. package/build/tests/caps-api/file-sink-checks/truncate.js +2 -2
  71. package/build/tests/caps-api/fs-checks/not-versioned/getByteSink.js +3 -3
  72. package/build/tests/caps-api/fs-checks/not-versioned/getByteSource.js +2 -2
  73. package/build/tests/caps-api/fs-checks/not-versioned/readBytes.js +3 -3
  74. package/build/tests/caps-api/fs-checks/not-versioned/writeBytes.js +10 -10
  75. package/build/tests/caps-api/fs-checks/sync-on-one-dev/startUpload.js +1 -1
  76. package/build/tests/caps-api/fs-checks/sync-on-one-dev/stat.js +1 -1
  77. package/build/tests/caps-api/fs-checks/sync-on-one-dev/status.js +1 -1
  78. package/build/tests/caps-api/fs-checks/sync-on-one-dev/upload.js +1 -1
  79. package/build/tests/caps-api/fs-checks/sync-with-two-devs/conflicts.js +1 -1
  80. package/build/tests/caps-api/fs-checks/sync-with-two-devs/update-propagation.js +1 -1
  81. package/build/tests/caps-api/fs-checks/versioned/archiveCurrent.js +1 -1
  82. package/build/tests/caps-api/fs-checks/versioned/getByteSink.js +4 -4
  83. package/build/tests/caps-api/fs-checks/versioned/getByteSource.js +2 -2
  84. package/build/tests/caps-api/fs-checks/versioned/readBytes.js +3 -3
  85. package/build/tests/caps-api/fs-checks/versioned/writeBytes.js +9 -9
  86. package/build/tests/caps-api/fs-checks/with-core-restarts/xattrs.js +1 -1
  87. package/build/tests/caps-api/startup/signin-empty-cache.js +1 -1
  88. package/build/tests/computer.3nweb.core/id-manager.js +1 -1
  89. package/build/tests/libs-for-tests/core-runner.js +2 -2
  90. package/build/tests/units/folder-node-serialization.js +1 -1
  91. package/build/tests/units/mid-sigs-NaCl-Ed.js +10 -9
  92. package/build/tests/units/obj-folders.js +1 -1
  93. package/package.json +1 -1
  94. /package/build/{lib-common → lib-common-on-node}/random-node.d.ts +0 -0
@@ -19,10 +19,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.TimeWindowCache = void 0;
20
20
  class TimeWindowCache {
21
21
  constructor(periodMillis) {
22
+ var _a, _b;
22
23
  this.filling = new Map();
23
24
  this.waiting = new Map();
24
- this.interval = setInterval(() => this.dropAndRotate(), periodMillis)
25
- .unref();
25
+ this.interval = setInterval(() => this.dropAndRotate(), periodMillis);
26
+ (_b = (_a = this.interval).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
26
27
  Object.seal(this);
27
28
  }
28
29
  dropAndRotate() {
@@ -64,11 +64,12 @@ Object.freeze(WeakCache.prototype);
64
64
  Object.freeze(WeakCache);
65
65
  class WeakCacheWithMinLifeTime {
66
66
  constructor(millis) {
67
+ var _a, _b;
67
68
  this.wCache = new WeakCache();
68
69
  this.filling = new Map();
69
70
  this.waiting = new Map();
70
71
  this.interval = setInterval(() => { this.dropAndRotate(); }, millis);
71
- this.interval.unref();
72
+ (_b = (_a = this.interval).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
72
73
  Object.seal(this);
73
74
  }
74
75
  dropAndRotate() {
@@ -25,7 +25,7 @@ exports.stringOfB64UrlSafeCharsSync = stringOfB64UrlSafeCharsSync;
25
25
  exports.stringOfB64CharsSync = stringOfB64CharsSync;
26
26
  exports.stringOfB64UrlSafeChars = stringOfB64UrlSafeChars;
27
27
  exports.stringOfB64Chars = stringOfB64Chars;
28
- const buffer_utils_1 = require("./buffer-utils");
28
+ const buffer_utils_1 = require("../lib-common/buffer-utils");
29
29
  const crypto_1 = require("crypto");
30
30
  function bytesSync(numOfBytes) {
31
31
  return (0, crypto_1.randomBytes)(numOfBytes);
@@ -44,7 +44,7 @@ function uint8Sync() {
44
44
  return (0, crypto_1.randomBytes)(1)[0];
45
45
  }
46
46
  async function uint8() {
47
- return (await (0, crypto_1.randomBytes)(1))[0];
47
+ return (await bytes(1))[0];
48
48
  }
49
49
  function uint48Sync() {
50
50
  const b = (0, crypto_1.randomBytes)(6);
@@ -21,8 +21,8 @@ const https = require("https");
21
21
  const request_utils_1 = require("../lib-client/request-utils");
22
22
  function makeRequestFromNode() {
23
23
  const nodeRequest = (opts) => https.request(opts);
24
- return (opts, contentType, reqBody) => {
25
- const httpsOpts = (0, request_utils_1.formHttpsReqOpts)(opts, contentType, reqBody);
24
+ return (opts, reqContentType, reqBody) => {
25
+ const httpsOpts = (0, request_utils_1.formHttpsReqOpts)(opts, reqContentType, reqBody);
26
26
  return (0, request_utils_1.processRequest)(nodeRequest, httpsOpts, opts, reqBody);
27
27
  };
28
28
  }
@@ -17,10 +17,10 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const test_utils_1 = require("../test-utils");
22
22
  const sleep_1 = require("../../../../lib-common/processes/sleep");
23
- const random_node_2 = require("../../../../lib-common/random-node");
23
+ const random_node_2 = require("../../../../lib-common-on-node/random-node");
24
24
  const files = [{
25
25
  content: 'This is file content for file #1',
26
26
  name: 'file1'
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: 'gives file sink',
23
23
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: 'gives file sinks, able to splice file content',
@@ -44,14 +44,14 @@ it.func = async function (s) {
44
44
  let layout = await sink.showLayout();
45
45
  expect(Array.isArray(layout.sections)).toBeTruthy();
46
46
  expect(layout.sections.length).toBe(0);
47
- const chunk1 = (0, random_node_1.bytesSync)(10000);
47
+ const chunk1 = await (0, random_node_1.bytes)(10000);
48
48
  await sink.splice(0, chunk1.length, chunk1);
49
49
  size = await sink.getSize();
50
50
  expect(size).toBe(10000);
51
51
  layout = await sink.showLayout();
52
52
  expect(layout.sections.length).toBe(1);
53
53
  expectSection(layout, 0, 'new', 0, size);
54
- const chunk2 = (0, random_node_1.bytesSync)(100);
54
+ const chunk2 = await (0, random_node_1.bytes)(100);
55
55
  await sink.splice(11000, 0, chunk2);
56
56
  size = await sink.getSize();
57
57
  layout = await sink.showLayout();
@@ -89,9 +89,9 @@ it.func = async function (s) {
89
89
  // setup original file
90
90
  const fName = 'file1';
91
91
  let sink = await testFS.getByteSink(fName, { create: true, exclusive: true });
92
- const chunk1 = (0, random_node_1.bytesSync)(10000);
92
+ const chunk1 = await (0, random_node_1.bytes)(10000);
93
93
  await sink.splice(0, chunk1.length, chunk1);
94
- const chunk2 = (0, random_node_1.bytesSync)(100);
94
+ const chunk2 = await (0, random_node_1.bytes)(100);
95
95
  await sink.splice(11000, 0, chunk2);
96
96
  await sink.done();
97
97
  const initSize = await sink.getSize();
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: 'gives file sinks, able to truncate file content',
@@ -55,7 +55,7 @@ it.func = async function (s) {
55
55
  else {
56
56
  expectSection(layout, 0, 'empty', 0, 10000);
57
57
  }
58
- const chunk = (0, random_node_1.bytesSync)(10000);
58
+ const chunk = await (0, random_node_1.bytes)(10000);
59
59
  await sink.splice(0, chunk.length, chunk);
60
60
  size = await sink.getSize();
61
61
  expect(size).toBe(10000);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  const sink_utils_1 = require("../../../../lib-common/obj-streaming/sink-utils");
23
23
  exports.specs = {
@@ -41,7 +41,7 @@ it = { expectation: 'creates file in existing folder' };
41
41
  it.func = async function (s) {
42
42
  const { testFS } = s;
43
43
  const path = 'file1';
44
- const content = (0, random_node_1.bytesSync)(2 * 1024);
44
+ const content = await (0, random_node_1.bytes)(2 * 1024);
45
45
  expect(await testFS.checkFilePresence(path)).toBe(false);
46
46
  const sink = await testFS.getByteSink(path, { create: true });
47
47
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -81,7 +81,7 @@ it = { expectation: 'opens existing file' };
81
81
  it.func = async function (s) {
82
82
  const { testFS } = s;
83
83
  const path = 'file2';
84
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
84
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
85
85
  const originalSize = bytes.length;
86
86
  await testFS.writeBytes(path, bytes);
87
87
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.getByteSource',
@@ -37,7 +37,7 @@ exports.specs.its.push(it);
37
37
  it = { expectation: 'reads file bytes with seeking available' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
- const original = (0, random_node_1.bytesSync)(12 * 1024 + 3);
40
+ const original = await (0, random_node_1.bytes)(12 * 1024 + 3);
41
41
  let fName = 'file1';
42
42
  await testFS.writeBytes(fName, original);
43
43
  let src = await testFS.getByteSource(fName);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.readBytes',
@@ -42,7 +42,7 @@ exports.specs.its.push(it);
42
42
  it = { expectation: 'reads whole file' };
43
43
  it.func = async function (s) {
44
44
  const { testFS } = s;
45
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 3);
45
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 3);
46
46
  let fName = 'file1';
47
47
  await testFS.writeBytes(fName, originalBytes);
48
48
  let bytes = await testFS.readBytes(fName);
@@ -57,7 +57,7 @@ it = { expectation: 'reads part of the file' };
57
57
  it.func = async function (s) {
58
58
  const { testFS } = s;
59
59
  let fName = 'file3';
60
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 333);
60
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 333);
61
61
  await testFS.writeBytes(fName, originalBytes);
62
62
  let bytes = await testFS.readBytes(fName, 12, 3456);
63
63
  expect((0, bytes_equal_1.bytesEqual)(bytes, originalBytes.subarray(12, 3456))).withContext('should read from a proper file interior').toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.writeBytes',
@@ -26,7 +26,7 @@ exports.specs = {
26
26
  let it = { expectation: 'if not allowed to create, fails for missing file' };
27
27
  it.func = async function (s) {
28
28
  const { testFS } = s;
29
- await testFS.writeBytes('non-existing-file', (0, random_node_1.bytesSync)(123), {})
29
+ await testFS.writeBytes('non-existing-file', await (0, random_node_1.bytes)(123), {})
30
30
  .then(() => {
31
31
  fail('should fail for missing file');
32
32
  }, (e) => {
@@ -38,7 +38,7 @@ it = { expectation: 'creates file in existing folder' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
40
  let path = 'file1';
41
- let content = (0, random_node_1.bytesSync)(2 * 1024);
41
+ let content = await (0, random_node_1.bytes)(2 * 1024);
42
42
  expect(await testFS.checkFilePresence(path)).toBe(false);
43
43
  await testFS.writeBytes(path, content);
44
44
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -56,7 +56,7 @@ it.func = async function (s) {
56
56
  expect(await testFS.checkFolderPresence(grParent)).toBe(false);
57
57
  expect(await testFS.checkFolderPresence(parent2)).toBe(false);
58
58
  expect(await testFS.checkFolderPresence(path)).toBe(false);
59
- let content = (0, random_node_1.bytesSync)(2 * 1024);
59
+ let content = await (0, random_node_1.bytes)(2 * 1024);
60
60
  await testFS.writeBytes(path, content);
61
61
  expect(await testFS.checkFolderPresence(grParent)).toBe(true);
62
62
  expect(await testFS.checkFolderPresence(parent2)).toBe(true);
@@ -70,13 +70,13 @@ it.func = async function (s) {
70
70
  const { testFS } = s;
71
71
  let path = 'file3';
72
72
  // setup initial file
73
- let initBytes = (0, random_node_1.bytesSync)(123);
73
+ let initBytes = await (0, random_node_1.bytes)(123);
74
74
  await testFS.writeBytes(path, initBytes);
75
75
  expect(await testFS.checkFilePresence(path)).toBe(true);
76
76
  let bytes = await testFS.readBytes(path);
77
77
  expect((0, bytes_equal_1.bytesEqual)(initBytes, bytes)).toBe(true);
78
78
  // write new file content
79
- let newContent = (0, random_node_1.bytesSync)(3223);
79
+ let newContent = await (0, random_node_1.bytes)(3223);
80
80
  await testFS.writeBytes(path, newContent);
81
81
  expect(await testFS.checkFilePresence(path)).toBe(true);
82
82
  bytes = await testFS.readBytes(path);
@@ -88,11 +88,11 @@ it.func = async function (s) {
88
88
  const { testFS } = s;
89
89
  let path = 'file4';
90
90
  // setup initial file
91
- let initBytes = (0, random_node_1.bytesSync)(123);
91
+ let initBytes = await (0, random_node_1.bytes)(123);
92
92
  await testFS.writeBytes(path, initBytes);
93
93
  expect(await testFS.checkFilePresence(path)).toBe(true);
94
94
  // try an exclusive write
95
- let newContent = (0, random_node_1.bytesSync)(3223);
95
+ let newContent = await (0, random_node_1.bytes)(3223);
96
96
  await testFS.writeBytes(path, newContent, { create: true, exclusive: true })
97
97
  .then(() => {
98
98
  fail('exclusive-create write operation must fail, when file exists.');
@@ -111,7 +111,7 @@ it.func = async function (s) {
111
111
  const { testFS } = s;
112
112
  let path = 'file5';
113
113
  // write some bytes
114
- let bytesToWrite = (0, random_node_1.bytesSync)(3000000);
114
+ let bytesToWrite = await (0, random_node_1.bytes)(3000000);
115
115
  await testFS.writeBytes(path, bytesToWrite);
116
116
  expect(await testFS.checkFilePresence(path)).toBe(true);
117
117
  // check that same bytes are read
@@ -128,7 +128,7 @@ it.func = async function (s) {
128
128
  ['file-16kb', 4 * kb4],
129
129
  ['file-20kb', 5 * kb4],
130
130
  ]) {
131
- const content = (0, random_node_1.bytesSync)(contentLen);
131
+ const content = await (0, random_node_1.bytes)(contentLen);
132
132
  await testFS.writeBytes(fName, content);
133
133
  expect((0, bytes_equal_1.bytesEqual)((await testFS.readBytes(fName)), content)).toBeTrue();
134
134
  }
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const deferred_1 = require("../../../../lib-common/processes/deferred");
23
23
  exports.specs = {
@@ -18,7 +18,7 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
20
  const sleep_1 = require("../../../../lib-common/processes/sleep");
21
- const random_node_1 = require("../../../../lib-common/random-node");
21
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
22
22
  exports.specs = {
23
23
  description: '.v.stat',
24
24
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '.v.sync.status',
23
23
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const sleep_1 = require("../../../../lib-common/processes/sleep");
23
23
  exports.specs = {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const watching_1 = require("../../../libs-for-tests/watching");
23
23
  exports.specs = {
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
20
  const buffer_utils_1 = require("../../../../lib-common/buffer-utils");
21
21
  const deferred_1 = require("../../../../lib-common/processes/deferred");
22
- const random_node_1 = require("../../../../lib-common/random-node");
22
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
23
23
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
24
24
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
25
25
  const test_utils_1 = require("../test-utils");
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '.v.archiveCurrent',
23
23
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  const sink_utils_1 = require("../../../../lib-common/obj-streaming/sink-utils");
23
23
  exports.specs = {
@@ -42,7 +42,7 @@ it = { expectation: 'creates file in existing folder' };
42
42
  it.func = async function (s) {
43
43
  const { testFS } = s;
44
44
  const path = 'file1';
45
- const content = (0, random_node_1.bytesSync)(2 * 1024);
45
+ const content = await (0, random_node_1.bytes)(2 * 1024);
46
46
  expect(await testFS.checkFilePresence(path)).toBe(false);
47
47
  const { sink, version: v } = await testFS.v.getByteSink(path, { create: true });
48
48
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -83,7 +83,7 @@ it = { expectation: 'opens existing file' };
83
83
  it.func = async function (s) {
84
84
  const { testFS } = s;
85
85
  const path = 'file2';
86
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
86
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
87
87
  const originalSize = bytes.length;
88
88
  const v = await testFS.v.writeBytes(path, bytes);
89
89
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -100,7 +100,7 @@ it = { expectation: `doesn't advance file version when write is cancelled` };
100
100
  it.func = async function (s) {
101
101
  const { testFS } = s;
102
102
  const path = 'file2';
103
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
103
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
104
104
  const initVersion = await testFS.v.writeBytes(path, bytes);
105
105
  let { sink, version } = await testFS.v.getByteSink(path, {});
106
106
  expect(version).toBe(initVersion + 1);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.getByteSource',
@@ -38,7 +38,7 @@ exports.specs.its.push(it);
38
38
  it = { expectation: 'reads file bytes with seeking available' };
39
39
  it.func = async function (s) {
40
40
  const { testFS } = s;
41
- let original = (0, random_node_1.bytesSync)(12 * 1024 + 3);
41
+ let original = await (0, random_node_1.bytes)(12 * 1024 + 3);
42
42
  let fName = 'file1';
43
43
  let v1 = await testFS.v.writeBytes(fName, original);
44
44
  let { src, version } = await testFS.v.getByteSource(fName);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.readBytes',
@@ -43,7 +43,7 @@ exports.specs.its.push(it);
43
43
  it = { expectation: 'reads whole file' };
44
44
  it.func = async function (s) {
45
45
  const { testFS } = s;
46
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 3);
46
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 3);
47
47
  let fName = 'file1';
48
48
  let v1 = await testFS.v.writeBytes(fName, originalBytes);
49
49
  let { bytes, version } = await testFS.v.readBytes(fName);
@@ -60,7 +60,7 @@ it = { expectation: 'reads part of the file' };
60
60
  it.func = async function (s) {
61
61
  const { testFS } = s;
62
62
  let fName = 'file3';
63
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 333);
63
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 333);
64
64
  let v = await testFS.v.writeBytes(fName, originalBytes);
65
65
  let { bytes, version } = await testFS.v.readBytes(fName, 12, 3456);
66
66
  expect((0, bytes_equal_1.bytesEqual)(bytes, originalBytes.subarray(12, 3456))).withContext('should read from a proper file interior').toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.writeBytes',
@@ -26,7 +26,7 @@ exports.specs = {
26
26
  let it = { expectation: 'if not allowed to create, fails for missing file' };
27
27
  it.func = async function (s) {
28
28
  const { testFS } = s;
29
- await testFS.v.writeBytes('non-existing-file', (0, random_node_1.bytesSync)(123), {})
29
+ await testFS.v.writeBytes('non-existing-file', await (0, random_node_1.bytes)(123), {})
30
30
  .then(() => {
31
31
  fail('should fail for missing file');
32
32
  }, (e) => {
@@ -38,7 +38,7 @@ it = { expectation: 'creates file in existing folder' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
40
  let path = 'file1';
41
- let content = (0, random_node_1.bytesSync)(2 * 1024);
41
+ let content = await (0, random_node_1.bytes)(2 * 1024);
42
42
  expect(await testFS.checkFilePresence(path)).toBe(false);
43
43
  let v = await testFS.v.writeBytes(path, content);
44
44
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -57,7 +57,7 @@ it.func = async function (s) {
57
57
  expect(await testFS.checkFolderPresence(grParent)).toBe(false);
58
58
  expect(await testFS.checkFolderPresence(parent2)).toBe(false);
59
59
  expect(await testFS.checkFolderPresence(path)).toBe(false);
60
- let content = (0, random_node_1.bytesSync)(2 * 1024);
60
+ let content = await (0, random_node_1.bytes)(2 * 1024);
61
61
  let v = await testFS.v.writeBytes(path, content);
62
62
  expect(await testFS.checkFolderPresence(grParent)).toBe(true);
63
63
  expect(await testFS.checkFolderPresence(parent2)).toBe(true);
@@ -72,14 +72,14 @@ it.func = async function (s) {
72
72
  const { testFS } = s;
73
73
  let path = 'file3';
74
74
  // setup initial file
75
- let initBytes = (0, random_node_1.bytesSync)(123);
75
+ let initBytes = await (0, random_node_1.bytes)(123);
76
76
  let v1 = await testFS.v.writeBytes(path, initBytes);
77
77
  expect(await testFS.checkFilePresence(path)).toBe(true);
78
78
  let { bytes, version } = await testFS.v.readBytes(path);
79
79
  expect((0, bytes_equal_1.bytesEqual)(initBytes, bytes)).toBe(true);
80
80
  expect(version).toBe(v1);
81
81
  // write new file content
82
- let newContent = (0, random_node_1.bytesSync)(3223);
82
+ let newContent = await (0, random_node_1.bytes)(3223);
83
83
  let v2 = await testFS.v.writeBytes(path, newContent);
84
84
  expect(await testFS.checkFilePresence(path)).toBe(true);
85
85
  expect(v2).toBeGreaterThan(v1);
@@ -93,11 +93,11 @@ it.func = async function (s) {
93
93
  const { testFS } = s;
94
94
  let path = 'file4';
95
95
  // setup initial file
96
- let initBytes = (0, random_node_1.bytesSync)(123);
96
+ let initBytes = await (0, random_node_1.bytes)(123);
97
97
  let v = await testFS.v.writeBytes(path, initBytes);
98
98
  expect(await testFS.checkFilePresence(path)).toBe(true);
99
99
  // try an exclusive write
100
- let newContent = (0, random_node_1.bytesSync)(3223);
100
+ let newContent = await (0, random_node_1.bytes)(3223);
101
101
  await testFS.writeBytes(path, newContent, { create: true, exclusive: true })
102
102
  .then(() => {
103
103
  fail('exclusive-create write operation must fail, when file exists.');
@@ -118,7 +118,7 @@ it.func = async function (s) {
118
118
  ['file-4kb', kb4],
119
119
  ['file-16kb', 4 * kb4],
120
120
  ]) {
121
- const content = (0, random_node_1.bytesSync)(contentLen);
121
+ const content = await (0, random_node_1.bytes)(contentLen);
122
122
  await testFS.v.writeBytes(fName, content);
123
123
  expect((0, bytes_equal_1.bytesEqual)((await testFS.v.readBytes(fName)).bytes, content))
124
124
  .toBeTrue();
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '--',
23
23
  its: []
@@ -21,7 +21,7 @@ const setups_1 = require("../../libs-for-tests/setups");
21
21
  const startup_1 = require("../../libs-for-tests/startup");
22
22
  const core_runner_1 = require("../../libs-for-tests/core-runner");
23
23
  const sleep_1 = require("../../../lib-common/processes/sleep");
24
- const random_node_1 = require("../../../lib-common/random-node");
24
+ const random_node_1 = require("../../../lib-common-on-node/random-node");
25
25
  // NOTE: it-specs inside signIn process expect to run in a given order -- they
26
26
  // change app's state, expected by following specs in this describe.
27
27
  describe('signIn process (empty cache)', () => {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const key_storage_1 = require("../../core/id-manager/key-storage");
20
- const random_node_1 = require("../../lib-common/random-node");
20
+ const random_node_1 = require("../../lib-common-on-node/random-node");
21
21
  const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
22
22
  const json_equal_1 = require("../libs-for-tests/json-equal");
23
23
  const setups_1 = require("../libs-for-tests/setups");
@@ -20,7 +20,7 @@ exports.CoreRunner = exports.testApp = void 0;
20
20
  const lib_index_1 = require("../../lib-index");
21
21
  const path_1 = require("path");
22
22
  const async_fs_node_1 = require("../../lib-common/async-fs-node");
23
- const random_node_1 = require("../../lib-common/random-node");
23
+ const random_node_1 = require("../../lib-common-on-node/random-node");
24
24
  const app_files_1 = require("../../core/app-files");
25
25
  const log_to_file_1 = require("../../lib-client/logging/log-to-file");
26
26
  const error_1 = require("../../lib-common/exceptions/error");
@@ -91,7 +91,7 @@ class CoreRunner {
91
91
  resolve(texts);
92
92
  }
93
93
  }))
94
- }), napi_nacl_1.makeNativeCryptor);
94
+ }), napi_nacl_1.makeNativeCryptor, random_node_1.bytes);
95
95
  }
96
96
  async close() {
97
97
  if (this.appCaps) {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const folder_node_serialization_1 = require("../../lib-client/xsp-fs/folder-node-serialization");
20
- const random = require("../../lib-common/random-node");
20
+ const random = require("../../lib-common-on-node/random-node");
21
21
  const bytes_fifo_buffer_1 = require("../../lib-common/byte-streaming/bytes-fifo-buffer");
22
22
  const bytes_equal_1 = require("../libs-for-tests/bytes-equal");
23
23
  const fileNode1 = {