core-3nweb-client-lib 0.27.1 → 0.27.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api-defs/files.d.ts +4 -7
- package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
- package/build/core/asmail/inbox/attachments/fs.js +4 -3
- package/build/core/asmail/inbox/index.js +1 -1
- package/build/core/id-manager/index.d.ts +43 -0
- package/build/core/{id-manager.js → id-manager/index.js} +33 -114
- package/build/core/id-manager/key-storage.d.ts +21 -0
- package/build/core/id-manager/key-storage.js +96 -0
- package/build/core/index.js +21 -23
- package/build/core/sign-in.d.ts +1 -2
- package/build/core/sign-in.js +4 -13
- package/build/core/sign-up.d.ts +2 -0
- package/build/core/sign-up.js +2 -1
- package/build/core/storage/index.d.ts +4 -2
- package/build/core/storage/index.js +36 -57
- package/build/core/storage/local/storage.d.ts +1 -1
- package/build/core/storage/synced/obj-files-gc.d.ts +1 -4
- package/build/core/storage/synced/obj-files-gc.js +1 -18
- package/build/core/storage/synced/obj-files.d.ts +9 -1
- package/build/core/storage/synced/obj-files.js +41 -33
- package/build/core/storage/synced/obj-status.d.ts +18 -7
- package/build/core/storage/synced/obj-status.js +148 -83
- package/build/core/storage/synced/storage.d.ts +7 -2
- package/build/core/storage/synced/storage.js +50 -10
- package/build/core/storage/synced/upsyncer.d.ts +4 -4
- package/build/core/storage/synced/upsyncer.js +12 -6
- package/build/lib-client/3nstorage/exceptions.d.ts +13 -1
- package/build/lib-client/3nstorage/exceptions.js +9 -3
- package/build/lib-client/3nstorage/service.d.ts +6 -1
- package/build/lib-client/3nstorage/service.js +31 -15
- package/build/lib-client/3nstorage/util/file-based-json.js +2 -1
- package/build/lib-client/3nstorage/util/for-arrays.d.ts +1 -0
- package/build/lib-client/3nstorage/util/for-arrays.js +32 -0
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +5 -4
- package/build/lib-client/3nstorage/xsp-fs/common.js +1 -0
- package/build/lib-client/3nstorage/xsp-fs/file.js +2 -2
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +11 -5
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +232 -68
- package/build/lib-client/3nstorage/xsp-fs/fs.js +15 -19
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +4 -9
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +16 -17
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +1 -1
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/local-files/device-fs.js +11 -11
- package/build/lib-client/user-with-mid-session.d.ts +2 -1
- package/build/lib-client/user-with-mid-session.js +7 -1
- package/build/lib-common/async-fs-node.js +8 -8
- package/build/lib-common/exceptions/file.d.ts +4 -2
- package/build/lib-common/exceptions/file.js +24 -58
- package/build/lib-common/ipc/generic-ipc.js +5 -4
- package/build/lib-common/objs-on-disk/utils.js +1 -1
- package/build/lib-common/service-api/3nstorage/owner.d.ts +8 -5
- package/build/lib-common/service-api/3nstorage/owner.js +2 -1
- package/package.json +3 -2
- package/build/core/id-manager.d.ts +0 -46
|
@@ -29,6 +29,7 @@ const exceptions_1 = require("../exceptions");
|
|
|
29
29
|
const rxjs_1 = require("rxjs");
|
|
30
30
|
const operators_1 = require("rxjs/operators");
|
|
31
31
|
const attrs_1 = require("./attrs");
|
|
32
|
+
const assert_1 = require("../../../lib-common/assert");
|
|
32
33
|
class NodeInFS {
|
|
33
34
|
constructor(storage, type, name, objId, currentVersion, parentId) {
|
|
34
35
|
this.storage = storage;
|
|
@@ -124,7 +125,7 @@ class NodeInFS {
|
|
|
124
125
|
else {
|
|
125
126
|
if (version) {
|
|
126
127
|
if (this.currentVersion !== version) {
|
|
127
|
-
throw (0, file_1.makeFileException)(
|
|
128
|
+
throw (0, file_1.makeFileException)('versionMismatch', this.name);
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
else {
|
|
@@ -135,15 +136,11 @@ class NodeInFS {
|
|
|
135
136
|
return version;
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
removeNonFolderObj(src) {
|
|
140
|
+
(0, assert_1.assert)(this.type !== 'folder');
|
|
141
|
+
return this.doChange(true, () => this.removeThisNodeAsLeaf(src));
|
|
140
142
|
}
|
|
141
|
-
|
|
142
|
-
* This non-synchronized method deletes object from storage, and detaches
|
|
143
|
-
* this node from storage. Make sure to call it inside access synchronization
|
|
144
|
-
* construct.
|
|
145
|
-
*/
|
|
146
|
-
async delete(src) {
|
|
143
|
+
async removeThisNodeAsLeaf(src) {
|
|
147
144
|
await this.storage.removeObj(this.objId);
|
|
148
145
|
this.storage.nodes.delete(this);
|
|
149
146
|
this.currentVersion = -1;
|
|
@@ -171,11 +168,11 @@ class NodeInFS {
|
|
|
171
168
|
this.writeProc = new synced_1.SingleProc();
|
|
172
169
|
}
|
|
173
170
|
if (!awaitPrevChange && this.writeProc.isProcessing()) {
|
|
174
|
-
throw (0, file_1.makeFileException)(
|
|
171
|
+
throw (0, file_1.makeFileException)('concurrentUpdate', this.name + ` type ${this.type}`);
|
|
175
172
|
}
|
|
176
173
|
const res = await this.writeProc.startOrChain(async () => {
|
|
177
174
|
if (this.currentVersion < 0) {
|
|
178
|
-
throw (0, file_1.makeFileException)(
|
|
175
|
+
throw (0, file_1.makeFileException)('notFound', this.name, `Object is marked removed`);
|
|
179
176
|
}
|
|
180
177
|
try {
|
|
181
178
|
const res = await change();
|
|
@@ -187,17 +184,17 @@ class NodeInFS {
|
|
|
187
184
|
}
|
|
188
185
|
if (exc.type === 'storage') {
|
|
189
186
|
if (exc.concurrentTransaction) {
|
|
190
|
-
throw (0, file_1.makeFileException)(
|
|
187
|
+
throw (0, file_1.makeFileException)('concurrentUpdate', this.name, exc);
|
|
191
188
|
}
|
|
192
189
|
else if (exc.objNotFound) {
|
|
193
|
-
throw (0, file_1.makeFileException)(
|
|
190
|
+
throw (0, file_1.makeFileException)('notFound', this.name, exc);
|
|
194
191
|
}
|
|
195
192
|
}
|
|
196
193
|
else if ((exc.type === 'file')
|
|
197
194
|
|| (exc.type === 'fs-sync')) {
|
|
198
195
|
throw exc;
|
|
199
196
|
}
|
|
200
|
-
throw (0, file_1.makeFileException)(
|
|
197
|
+
throw (0, file_1.makeFileException)('ioError', this.name, exc);
|
|
201
198
|
}
|
|
202
199
|
});
|
|
203
200
|
return res;
|
|
@@ -258,7 +255,7 @@ class NodeInFS {
|
|
|
258
255
|
async updateStatusInfo() {
|
|
259
256
|
const storage = this.syncedStorage();
|
|
260
257
|
const status = await storage.updateStatusInfo(this.objId);
|
|
261
|
-
return
|
|
258
|
+
return status;
|
|
262
259
|
}
|
|
263
260
|
isSyncedVersionOnDisk(version) {
|
|
264
261
|
const storage = this.syncedStorage();
|
|
@@ -350,8 +347,7 @@ class NodeInFS {
|
|
|
350
347
|
return;
|
|
351
348
|
}
|
|
352
349
|
const { localVersion, createOnRemote, uploadVersion } = toUpload;
|
|
353
|
-
const uploadHeader = (
|
|
354
|
-
await this.uploadHeaderChange(localVersion, uploadVersion));
|
|
350
|
+
const uploadHeader = await this.uploadHeaderChange(localVersion, uploadVersion);
|
|
355
351
|
const storage = this.syncedStorage();
|
|
356
352
|
await storage.upload(this.objId, localVersion, uploadVersion, uploadHeader, createOnRemote);
|
|
357
353
|
await this.doChange(true, async () => {
|
|
@@ -366,6 +362,9 @@ class NodeInFS {
|
|
|
366
362
|
}
|
|
367
363
|
}
|
|
368
364
|
async uploadHeaderChange(localVersion, uploadVersion) {
|
|
365
|
+
if (localVersion === uploadVersion) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
369
368
|
const currentSrc = await this.storage.getObjSrc(this.objId, localVersion);
|
|
370
369
|
const localHeader = await currentSrc.readHeader();
|
|
371
370
|
const uploadHeader = await this.crypto.reencryptHeader(localHeader, uploadVersion);
|
|
@@ -82,6 +82,6 @@ class ReadonlyPayloadV1 {
|
|
|
82
82
|
Object.freeze(ReadonlyPayloadV1.prototype);
|
|
83
83
|
Object.freeze(ReadonlyPayloadV1);
|
|
84
84
|
function makeEndlessException() {
|
|
85
|
-
return (0, file_1.makeFileException)(
|
|
85
|
+
return (0, file_1.makeFileException)('isEndless', '');
|
|
86
86
|
}
|
|
87
87
|
Object.freeze(exports);
|