core-3nweb-client-lib 0.20.7 → 0.22.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 (68) hide show
  1. package/build/api-defs/common-caps.d.ts +0 -1
  2. package/build/api-defs/files.d.ts +8 -7
  3. package/build/api-defs/startup.d.ts +0 -1
  4. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -2
  5. package/build/core/asmail/inbox/attachments/fs.js +3 -2
  6. package/build/core/asmail/msg/common.d.ts +2 -2
  7. package/build/core/asmail/msg/common.js +3 -2
  8. package/build/core/asmail/msg/opener.d.ts +2 -2
  9. package/build/core/asmail/msg/opener.js +3 -2
  10. package/build/core/asmail/msg/packer.d.ts +2 -2
  11. package/build/core/asmail/msg/packer.js +7 -6
  12. package/build/core/index.d.ts +3 -3
  13. package/build/core/index.js +24 -31
  14. package/build/core/storage/index.js +2 -2
  15. package/build/core/storage/local/obj-files.js +8 -5
  16. package/build/core/storage/local/obj-status.js +4 -3
  17. package/build/core/storage/synced/obj-status.js +4 -3
  18. package/build/core-ipc/startup-caps.js +0 -3
  19. package/build/ipc-via-protobuf/bytes.js +1 -1
  20. package/build/lib-client/3nstorage/xsp-fs/attrs.d.ts +28 -0
  21. package/build/lib-client/3nstorage/xsp-fs/attrs.js +337 -0
  22. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +1 -1
  23. package/build/lib-client/3nstorage/xsp-fs/common.js +3 -2
  24. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +31 -18
  25. package/build/lib-client/3nstorage/xsp-fs/file-node.js +130 -118
  26. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +0 -1
  27. package/build/lib-client/3nstorage/xsp-fs/file.js +14 -49
  28. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.d.ts +1 -1
  29. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +95 -91
  30. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +19 -24
  31. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +133 -190
  32. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +3 -4
  33. package/build/lib-client/3nstorage/xsp-fs/fs.js +18 -21
  34. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +13 -8
  35. package/build/lib-client/3nstorage/xsp-fs/link-node.js +46 -38
  36. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +17 -35
  37. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +34 -127
  38. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +57 -0
  39. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +182 -0
  40. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.d.ts +3 -0
  41. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +87 -0
  42. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.d.ts +6 -0
  43. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +1022 -0
  44. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  45. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  46. package/build/lib-client/local-files/device-fs.js +7 -3
  47. package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -2
  48. package/build/lib-client/objs-on-disk/obj-on-disk.js +8 -7
  49. package/build/lib-common/big-endian.d.ts +0 -24
  50. package/build/lib-common/big-endian.js +16 -78
  51. package/build/lib-common/exceptions/file.js +5 -1
  52. package/build/lib-common/obj-streaming/sink-utils.d.ts +0 -4
  53. package/build/lib-common/obj-streaming/sink-utils.js +4 -70
  54. package/build/lib-common/objs-on-disk/file-layout.js +2 -1
  55. package/build/lib-common/objs-on-disk/obj-file.js +2 -2
  56. package/build/lib-common/objs-on-disk/utils.js +2 -1
  57. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +2 -1
  58. package/build/lib-index.d.ts +1 -0
  59. package/build/lib-index.js +3 -0
  60. package/package.json +2 -2
  61. package/build/lib-client/files/file-attrs.d.ts +0 -76
  62. package/build/lib-client/files/file-attrs.js +0 -549
  63. package/build/lib-client/files/file-layout.d.ts +0 -56
  64. package/build/lib-client/files/file-layout.js +0 -456
  65. package/build/lib-client/files/file-sink.d.ts +0 -33
  66. package/build/lib-client/files/file-sink.js +0 -173
  67. package/build/lib-client/files/file-source.d.ts +0 -19
  68. package/build/lib-client/files/file-source.js +0 -115
@@ -1,115 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (C) 2020 3NSoft Inc.
4
-
5
- This program is free software: you can redistribute it and/or modify it under
6
- the terms of the GNU General Public License as published by the Free Software
7
- Foundation, either version 3 of the License, or (at your option) any later
8
- version.
9
-
10
- This program is distributed in the hope that it will be useful, but
11
- WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- See the GNU General Public License for more details.
14
-
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/>.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.fileSrcFromContinuousSrc = exports.FileBytes = void 0;
20
- const assert_1 = require("../../lib-common/assert");
21
- const bytes_fifo_buffer_1 = require("../../lib-common/byte-streaming/bytes-fifo-buffer");
22
- const file_layout_1 = require("./file-layout");
23
- const wrapping_1 = require("../../lib-common/byte-streaming/wrapping");
24
- class FileBytes {
25
- constructor(rawSrc, layout) {
26
- this.rawSrc = rawSrc;
27
- this.layout = layout;
28
- this.pos = 0;
29
- Object.seal(this);
30
- }
31
- static async from(src, attrs) {
32
- const layoutOfs = (attrs ? attrs.getFileLayoutOfs() : undefined);
33
- if (typeof layoutOfs !== 'number') {
34
- return fileSrcFromContinuousSrc(src);
35
- }
36
- const layout = await file_layout_1.ROFileLayout.readFromSrc(src, layoutOfs);
37
- const fileBytes = new FileBytes(src, layout);
38
- return wrapping_1.wrapAndSyncFileSource(fileBytes);
39
- }
40
- getFileSections(ofs, len) {
41
- if (!Number.isInteger(ofs) || (ofs < 0)) {
42
- throw new Error(`Given offset is not a non-negative integer: ${ofs}`);
43
- }
44
- if (!Number.isInteger(len) || (len < 0)) {
45
- throw new Error(`Given length is not a non-negative integer: ${len}`);
46
- }
47
- return this.layout.getSectionsIn(ofs, len)
48
- .map(s => ({
49
- ofs: s.ofs,
50
- len: s.len,
51
- hasContent: (typeof s.ofsInSrc === 'number')
52
- }));
53
- }
54
- async read(len) {
55
- const sections = this.layout.getSectionsIn(this.pos, len);
56
- if (!sections || (sections.length === 0)) {
57
- return;
58
- }
59
- let bytes;
60
- if (sections.length === 0) {
61
- bytes = await this.getSectionBytes(sections[0]);
62
- }
63
- else {
64
- const buf = new bytes_fifo_buffer_1.BytesFIFOBuffer();
65
- for (const s of sections) {
66
- buf.push(await this.getSectionBytes(s));
67
- }
68
- bytes = buf.getBytes(undefined);
69
- }
70
- this.pos += bytes.length;
71
- return bytes;
72
- }
73
- async getSectionBytes(s) {
74
- if (s.ofsInSrc === undefined) {
75
- // we use an implicit initializing bytes to zero in alloc
76
- return Buffer.alloc(s.len);
77
- }
78
- else {
79
- await this.rawSrc.seek(s.ofsInSrc);
80
- const bytes = await this.rawSrc.read(s.len);
81
- if (!bytes) {
82
- throw new Error(`Byte source produces no bytes where file content is expected`);
83
- }
84
- return bytes;
85
- }
86
- }
87
- async getSize() {
88
- return this.layout.contentSize;
89
- }
90
- async seek(offset) {
91
- assert_1.assert(Number.isInteger(offset) && (offset >= 0), `Offset must be a non-negative integer, but ${offset} is given instead`);
92
- this.pos = ((offset >= this.layout.contentSize) ?
93
- this.layout.contentSize : offset);
94
- }
95
- async getPosition() {
96
- return this.pos;
97
- }
98
- }
99
- exports.FileBytes = FileBytes;
100
- Object.freeze(FileBytes.prototype);
101
- Object.freeze(FileBytes);
102
- function fileSrcFromContinuousSrc(src) {
103
- const w = {
104
- getPosition: src.getPosition,
105
- getSize: async () => {
106
- const { size } = await src.getSize();
107
- return size;
108
- },
109
- read: src.read,
110
- seek: src.seek
111
- };
112
- return w;
113
- }
114
- exports.fileSrcFromContinuousSrc = fileSrcFromContinuousSrc;
115
- Object.freeze(exports);