core-3nweb-client-lib 0.25.5 → 0.26.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.
- package/README.md +2 -2
- package/build/api-defs/files.d.ts +23 -20
- package/build/core/asmail/config/common.js +2 -2
- package/build/core/asmail/delivery/index.js +4 -3
- package/build/core/asmail/delivery/msg.js +5 -4
- package/build/core/asmail/delivery/per-recipient-wip.js +2 -2
- package/build/core/asmail/inbox/attachments/fs.js +6 -0
- package/build/core/asmail/inbox/cached-msgs.js +2 -2
- package/build/core/asmail/inbox/inbox-events.js +2 -1
- package/build/core/asmail/inbox/index.js +2 -2
- package/build/core/asmail/inbox/msg-downloader.js +2 -2
- package/build/core/asmail/inbox/msg-indexing.js +3 -3
- package/build/core/asmail/inbox/msg-on-disk.js +2 -2
- package/build/core/asmail/keyring/keyring-storage.js +2 -2
- package/build/core/asmail/sending-params/own-params.js +2 -2
- package/build/core/asmail/sending-params/params-from-others.js +2 -2
- package/build/core/id-manager.js +2 -2
- package/build/core/sign-in.d.ts +5 -4
- package/build/core/sign-in.js +9 -11
- package/build/core/sign-up.d.ts +1 -0
- package/build/core/sign-up.js +7 -3
- package/build/core/storage/common/json-saving.d.ts +21 -0
- package/build/core/storage/common/json-saving.js +82 -0
- package/build/core/storage/common/obj-info-file.d.ts +43 -0
- package/build/core/storage/common/obj-info-file.js +119 -3
- package/build/core/storage/index.js +1 -1
- package/build/core/storage/local/obj-files-gc.js +8 -6
- package/build/core/storage/local/obj-files.d.ts +3 -3
- package/build/core/storage/local/obj-files.js +9 -9
- package/build/core/storage/local/obj-status.d.ts +9 -25
- package/build/core/storage/local/obj-status.js +28 -110
- package/build/core/storage/local/storage.d.ts +8 -1
- package/build/core/storage/local/storage.js +10 -2
- package/build/core/storage/synced/downloader.js +6 -5
- package/build/core/storage/synced/obj-files-gc.d.ts +1 -0
- package/build/core/storage/synced/obj-files-gc.js +44 -5
- package/build/core/storage/synced/obj-files.d.ts +13 -20
- package/build/core/storage/synced/obj-files.js +70 -48
- package/build/core/storage/synced/obj-status.d.ts +74 -15
- package/build/core/storage/synced/obj-status.js +291 -107
- package/build/core/storage/synced/remote-events.js +32 -26
- package/build/core/storage/synced/storage.d.ts +11 -1
- package/build/core/storage/synced/storage.js +28 -3
- package/build/core/storage/synced/upsyncer.d.ts +8 -7
- package/build/core/storage/synced/upsyncer.js +211 -163
- package/build/ipc-via-protobuf/asmail-cap.js +17 -34
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +2 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +50 -12
- package/build/ipc-via-protobuf/file.js +26 -18
- package/build/ipc-via-protobuf/fs.js +33 -35
- package/build/ipc-via-protobuf/mailerid.js +3 -2
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +2 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +11 -1
- package/build/ipc-via-protobuf/startup-cap.js +5 -5
- package/build/lib-client/3nstorage/exceptions.d.ts +9 -8
- package/build/lib-client/3nstorage/exceptions.js +18 -9
- package/build/lib-client/3nstorage/service.js +10 -6
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +18 -4
- package/build/lib-client/3nstorage/xsp-fs/common.js +6 -1
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +3 -3
- package/build/lib-client/3nstorage/xsp-fs/file.js +4 -1
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +27 -13
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +11 -6
- package/build/lib-client/3nstorage/xsp-fs/fs.js +189 -58
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +4 -0
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +51 -24
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +2 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +2 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +3 -3
- package/build/lib-client/cryptor/cryptor-in-worker.js +4 -4
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-wasm.js +2 -2
- package/build/lib-client/files.js +2 -0
- package/build/lib-client/fs-collection.js +3 -2
- package/build/lib-client/logging/log-to-file.js +4 -4
- package/build/lib-client/objs-on-disk/file-writing-proc.js +2 -2
- package/build/lib-client/objs-on-disk/obj-folders.js +2 -2
- package/build/lib-client/request-utils.js +2 -2
- package/build/lib-client/server-events.js +4 -3
- package/build/lib-client/ws-utils.js +2 -2
- package/build/lib-common/async-fs-node.js +4 -3
- package/build/lib-common/byte-streaming/wrapping.js +17 -17
- package/build/lib-common/exceptions/file.js +6 -1
- package/build/lib-common/ipc/generic-ipc.js +2 -2
- package/build/lib-common/json-utils.js +2 -1
- package/build/lib-common/objs-on-disk/obj-file.js +4 -3
- package/build/lib-common/objs-on-disk/utils.js +2 -2
- package/build/lib-common/processes/deferred.d.ts +6 -0
- package/build/lib-common/processes/deferred.js +30 -0
- package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
- package/build/lib-common/processes/labelled-exec-pools.js +141 -0
- package/build/lib-common/processes/pressure.d.ts +7 -0
- package/build/lib-common/processes/pressure.js +56 -0
- package/build/lib-common/processes/sleep.d.ts +1 -0
- package/build/lib-common/processes/sleep.js +26 -0
- package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
- package/build/lib-common/{processes.js → processes/synced.js} +187 -204
- package/build/lib-common/processes/timeout.d.ts +1 -0
- package/build/lib-common/processes/timeout.js +51 -0
- package/build/lib-common/service-api/3nstorage/owner.d.ts +5 -4
- package/build/lib-common/service-api/3nstorage/owner.js +3 -2
- package/build/lib-common/utils-for-observables.d.ts +15 -1
- package/build/lib-common/utils-for-observables.js +68 -17
- package/build/protos/asmail.proto.js +404 -78
- package/build/protos/file.proto.js +370 -44
- package/build/protos/fs.proto.js +404 -78
- package/package.json +4 -4
- package/protos/file.proto +10 -2
- package/protos/fs.proto +2 -2
- package/build/core/storage/synced/upsync-status.d.ts +0 -41
- package/build/core/storage/synced/upsync-status.js +0 -158
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2020, 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,7 +13,8 @@
|
|
|
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
19
|
exports.StorageOwner = void 0;
|
|
19
20
|
/**
|
|
@@ -142,7 +143,7 @@ class StorageOwner extends user_with_mid_session_1.ServiceUser {
|
|
|
142
143
|
};
|
|
143
144
|
}
|
|
144
145
|
else if (rep.status === api.currentObj.SC.unknownObj) {
|
|
145
|
-
throw exceptions_1.makeObjNotFoundExc(objId);
|
|
146
|
+
throw exceptions_1.makeObjNotFoundExc(objId, undefined, true);
|
|
146
147
|
}
|
|
147
148
|
else {
|
|
148
149
|
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
@@ -177,7 +178,7 @@ class StorageOwner extends user_with_mid_session_1.ServiceUser {
|
|
|
177
178
|
return rep.data;
|
|
178
179
|
}
|
|
179
180
|
else if (rep.status === api.currentObj.SC.unknownObj) {
|
|
180
|
-
throw exceptions_1.makeObjNotFoundExc(objId);
|
|
181
|
+
throw exceptions_1.makeObjNotFoundExc(objId, undefined, true);
|
|
181
182
|
}
|
|
182
183
|
else {
|
|
183
184
|
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
@@ -212,8 +213,11 @@ class StorageOwner extends user_with_mid_session_1.ServiceUser {
|
|
|
212
213
|
if (rep.status === api.currentObj.SC.okPut) {
|
|
213
214
|
return rep.data.transactionId;
|
|
214
215
|
}
|
|
216
|
+
else if (rep.status === api.currentObj.SC.objAlreadyExists) {
|
|
217
|
+
throw exceptions_1.makeObjExistsExc(objId, undefined, true);
|
|
218
|
+
}
|
|
215
219
|
else if (rep.status === api.currentObj.SC.unknownObj) {
|
|
216
|
-
throw exceptions_1.makeObjNotFoundExc(objId);
|
|
220
|
+
throw exceptions_1.makeObjNotFoundExc(objId, undefined, true);
|
|
217
221
|
}
|
|
218
222
|
else if (rep.status === api.currentObj.SC.concurrentTransaction) {
|
|
219
223
|
throw exceptions_1.makeConcurrentTransExc(objId);
|
|
@@ -251,7 +255,7 @@ class StorageOwner extends user_with_mid_session_1.ServiceUser {
|
|
|
251
255
|
throw exceptions_1.makeConcurrentTransExc(objId);
|
|
252
256
|
}
|
|
253
257
|
else if (rep.status === api.currentObj.SC.unknownObj) {
|
|
254
|
-
throw exceptions_1.makeObjNotFoundExc(objId);
|
|
258
|
+
throw exceptions_1.makeObjNotFoundExc(objId, undefined, true);
|
|
255
259
|
}
|
|
256
260
|
else {
|
|
257
261
|
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { ScryptGenParams } from '../../key-derivation';
|
|
2
2
|
import { AsyncSBoxCryptor, Subscribe, ObjSource } from 'xsp-files';
|
|
3
3
|
import { objChanged, objRemoved } from '../../../lib-common/service-api/3nstorage/owner';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { UpSyncTaskInfo } from '../../../core/storage/synced/obj-status';
|
|
4
6
|
export { AsyncSBoxCryptor } from 'xsp-files';
|
|
5
7
|
export { FolderInJSON } from './folder-node';
|
|
6
8
|
declare type StorageType = web3n.files.FSType;
|
|
9
|
+
declare type FolderEvent = web3n.files.FolderEvent;
|
|
10
|
+
declare type FileEvent = web3n.files.FileEvent;
|
|
11
|
+
declare type Stats = web3n.files.Stats;
|
|
7
12
|
export interface RemoteObjRemovalEvent extends objRemoved.Event {
|
|
8
13
|
type: 'remote-delete';
|
|
9
14
|
}
|
|
@@ -16,6 +21,7 @@ export interface Node {
|
|
|
16
21
|
name: string;
|
|
17
22
|
type: NodeType;
|
|
18
23
|
processRemoteEvent: (event: RemoteEvent) => Promise<void>;
|
|
24
|
+
broadcastUpSyncEvent(task: UpSyncTaskInfo): void;
|
|
19
25
|
localDelete(): Promise<void>;
|
|
20
26
|
}
|
|
21
27
|
export declare type NodeType = 'file' | 'link' | 'folder';
|
|
@@ -47,11 +53,18 @@ export declare class NodesContainer {
|
|
|
47
53
|
reserveId(objId: string): boolean;
|
|
48
54
|
clear(): void;
|
|
49
55
|
}
|
|
56
|
+
export interface NodeEvent {
|
|
57
|
+
objId: ObjId;
|
|
58
|
+
parentObjId?: ObjId;
|
|
59
|
+
event: FolderEvent | FileEvent;
|
|
60
|
+
}
|
|
50
61
|
export interface Storage {
|
|
51
62
|
readonly type: StorageType;
|
|
52
63
|
readonly versioned: boolean;
|
|
53
64
|
readonly cryptor: AsyncSBoxCryptor;
|
|
54
65
|
readonly nodes: NodesContainer;
|
|
66
|
+
getNodeEvents(): Observable<NodeEvent>;
|
|
67
|
+
broadcastNodeEvent(objId: ObjId, parentObjId: ObjId | undefined, ev: FolderEvent | FileEvent): void;
|
|
55
68
|
/**
|
|
56
69
|
* This returns a storage of another type, for use by link functionality.
|
|
57
70
|
* @param type is a type of a requested storage.
|
|
@@ -67,20 +80,20 @@ export interface Storage {
|
|
|
67
80
|
* This returns a promise, resolvable to source for a requested object.
|
|
68
81
|
* @param objId
|
|
69
82
|
*/
|
|
70
|
-
getObj(objId:
|
|
83
|
+
getObj(objId: ObjId): Promise<ObjSource>;
|
|
71
84
|
/**
|
|
72
85
|
* This saves given object, asynchronously.
|
|
73
86
|
* @param objId
|
|
74
87
|
* @param version
|
|
75
88
|
* @param sinkSub is a sink subscribe function
|
|
76
89
|
*/
|
|
77
|
-
saveObj(objId:
|
|
90
|
+
saveObj(objId: ObjId, version: number, sinkSub: Subscribe): Promise<void>;
|
|
78
91
|
/**
|
|
79
92
|
* This asynchronously removes an object. Note that it does not remove
|
|
80
93
|
* archived version, only current one.
|
|
81
94
|
* @param objId
|
|
82
95
|
*/
|
|
83
|
-
removeObj(objId:
|
|
96
|
+
removeObj(objId: ObjId): Promise<void>;
|
|
84
97
|
/**
|
|
85
98
|
* This asynchronously runs closing cleanup.
|
|
86
99
|
*/
|
|
@@ -93,6 +106,7 @@ export interface SyncedStorage extends Storage {
|
|
|
93
106
|
* This returns a promise, resolvable to root key generation parameters.
|
|
94
107
|
*/
|
|
95
108
|
getRootKeyDerivParamsFromServer(): Promise<ScryptGenParams>;
|
|
96
|
-
getRemoteConflictObjVersion(objId:
|
|
109
|
+
getRemoteConflictObjVersion(objId: ObjId, version: number): Promise<ObjSource>;
|
|
110
|
+
getObjSyncInfo(objId: ObjId): Promise<Stats['sync']>;
|
|
97
111
|
}
|
|
98
112
|
export declare function wrapSyncStorageImplementation(impl: SyncedStorage): SyncedStorage;
|
|
@@ -98,6 +98,8 @@ function wrapStorageImplementation(impl) {
|
|
|
98
98
|
type: impl.type,
|
|
99
99
|
versioned: impl.versioned,
|
|
100
100
|
nodes: impl.nodes,
|
|
101
|
+
getNodeEvents: impl.getNodeEvents.bind(impl),
|
|
102
|
+
broadcastNodeEvent: impl.broadcastNodeEvent.bind(impl),
|
|
101
103
|
storageForLinking: impl.storageForLinking.bind(impl),
|
|
102
104
|
generateNewObjId: impl.generateNewObjId.bind(impl),
|
|
103
105
|
getObj: impl.getObj.bind(impl),
|
|
@@ -119,11 +121,14 @@ function wrapSyncStorageImplementation(impl) {
|
|
|
119
121
|
generateNewObjId: storageWrap.generateNewObjId,
|
|
120
122
|
getObj: storageWrap.getObj,
|
|
121
123
|
nodes: storageWrap.nodes,
|
|
124
|
+
getNodeEvents: storageWrap.getNodeEvents,
|
|
125
|
+
broadcastNodeEvent: storageWrap.broadcastNodeEvent,
|
|
122
126
|
removeObj: storageWrap.removeObj,
|
|
123
127
|
saveObj: storageWrap.saveObj,
|
|
124
128
|
storageForLinking: storageWrap.storageForLinking,
|
|
125
129
|
getRootKeyDerivParamsFromServer: impl.getRootKeyDerivParamsFromServer.bind(impl),
|
|
126
|
-
getRemoteConflictObjVersion: impl.getRemoteConflictObjVersion.bind(impl)
|
|
130
|
+
getRemoteConflictObjVersion: impl.getRemoteConflictObjVersion.bind(impl),
|
|
131
|
+
getObjSyncInfo: impl.getObjSyncInfo.bind(impl)
|
|
127
132
|
};
|
|
128
133
|
return Object.freeze(wrap);
|
|
129
134
|
}
|
|
@@ -23,7 +23,7 @@ exports.FileNode = void 0;
|
|
|
23
23
|
*/
|
|
24
24
|
const node_in_fs_1 = require("./node-in-fs");
|
|
25
25
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
26
|
-
const
|
|
26
|
+
const deferred_1 = require("../../../lib-common/processes/deferred");
|
|
27
27
|
const xsp_files_1 = require("xsp-files");
|
|
28
28
|
const assert_1 = require("../../../lib-common/assert");
|
|
29
29
|
const attrs_1 = require("./attrs");
|
|
@@ -177,8 +177,8 @@ class FileNode extends node_in_fs_1.NodeInFS {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
async writeSink(truncate, currentVersion, changes) {
|
|
180
|
-
const deferredSink =
|
|
181
|
-
const newSize =
|
|
180
|
+
const deferredSink = deferred_1.defer();
|
|
181
|
+
const newSize = deferred_1.defer();
|
|
182
182
|
let version = 0; // need to set any value to satisfy compiler
|
|
183
183
|
const completion = this.doChange(false, async () => {
|
|
184
184
|
const { attrs, xattrs, newVersion, sinkPromise, sub } = await this.startMakingSinkInsideChange(truncate, currentVersion, changes);
|
|
@@ -26,6 +26,7 @@ const files_1 = require("../../files");
|
|
|
26
26
|
const file_node_1 = require("./file-node");
|
|
27
27
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
28
28
|
const pipe_1 = require("../../../lib-common/byte-streaming/pipe");
|
|
29
|
+
const utils_for_observables_1 = require("../../../lib-common/utils-for-observables");
|
|
29
30
|
class FileObject {
|
|
30
31
|
constructor(name, isNew, node, makeOrGetNode, writable) {
|
|
31
32
|
this.name = name;
|
|
@@ -60,11 +61,13 @@ class FileObject {
|
|
|
60
61
|
if (!this.v.node) {
|
|
61
62
|
throw file_1.makeFileException(file_1.Code.notFound, this.name);
|
|
62
63
|
}
|
|
64
|
+
const sync = await this.v.node.sync();
|
|
63
65
|
const attrs = this.v.node.getAttrs();
|
|
64
66
|
const stat = {
|
|
65
67
|
writable: this.writable,
|
|
66
68
|
size: this.v.node.size,
|
|
67
69
|
version: this.v.node.version,
|
|
70
|
+
sync,
|
|
68
71
|
isFile: true,
|
|
69
72
|
ctime: new Date(attrs.ctime),
|
|
70
73
|
mtime: new Date(attrs.mtime),
|
|
@@ -87,7 +90,7 @@ class FileObject {
|
|
|
87
90
|
throw new Error(`Node for file ${this.name} is not yet initialized`);
|
|
88
91
|
}
|
|
89
92
|
const sub = this.v.node.event$
|
|
90
|
-
.subscribe(observer);
|
|
93
|
+
.subscribe(utils_for_observables_1.toRxObserver(observer));
|
|
91
94
|
return () => sub.unsubscribe();
|
|
92
95
|
}
|
|
93
96
|
async readBytes(start, end) {
|
|
@@ -27,7 +27,7 @@ const error_1 = require("../../../lib-common/exceptions/error");
|
|
|
27
27
|
const node_in_fs_1 = require("./node-in-fs");
|
|
28
28
|
const file_node_1 = require("./file-node");
|
|
29
29
|
const link_node_1 = require("./link-node");
|
|
30
|
-
const
|
|
30
|
+
const deferred_1 = require("../../../lib-common/processes/deferred");
|
|
31
31
|
const json_utils_1 = require("../../../lib-common/json-utils");
|
|
32
32
|
const xsp_files_1 = require("xsp-files");
|
|
33
33
|
const random = require("../../../lib-common/random-node");
|
|
@@ -62,6 +62,17 @@ class FolderPersistance extends node_persistence_1.NodePersistance {
|
|
|
62
62
|
}
|
|
63
63
|
Object.freeze(FolderPersistance.prototype);
|
|
64
64
|
Object.freeze(FolderPersistance);
|
|
65
|
+
let nextMoveLabel = Math.floor(Math.random() / 2 * Number.MAX_SAFE_INTEGER);
|
|
66
|
+
function getMoveLabel() {
|
|
67
|
+
const label = nextMoveLabel;
|
|
68
|
+
if (nextMoveLabel >= Number.MAX_SAFE_INTEGER) {
|
|
69
|
+
nextMoveLabel = 0;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
nextMoveLabel += 1;
|
|
73
|
+
}
|
|
74
|
+
return label;
|
|
75
|
+
}
|
|
65
76
|
class FolderNode extends node_in_fs_1.NodeInFS {
|
|
66
77
|
constructor(storage, name, objId, zNonce, version, parentId, key, setNewAttrs) {
|
|
67
78
|
super(storage, 'folder', name, objId, version, parentId);
|
|
@@ -183,7 +194,7 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
183
194
|
if (nodePromise) {
|
|
184
195
|
return { nodeOrPromise: nodePromise };
|
|
185
196
|
}
|
|
186
|
-
const deferred =
|
|
197
|
+
const deferred = deferred_1.defer();
|
|
187
198
|
this.storage.nodes.setPromise(objId, deferred.promise);
|
|
188
199
|
return { deferred };
|
|
189
200
|
}
|
|
@@ -462,28 +473,30 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
462
473
|
}
|
|
463
474
|
if (dst === this) {
|
|
464
475
|
// In this case we only need to change child's name
|
|
465
|
-
|
|
476
|
+
await this.changeChildName(childName, nameInDst);
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
const childJSON = this.getNodeInfo(childName);
|
|
480
|
+
// we have two transitions here, in this and in dst.
|
|
481
|
+
const moveLabel = getMoveLabel();
|
|
482
|
+
await dst.moveChildIn(nameInDst, childJSON, moveLabel);
|
|
483
|
+
await this.moveChildOut(childName, moveLabel);
|
|
466
484
|
}
|
|
467
|
-
const childJSON = this.getNodeInfo(childName);
|
|
468
|
-
// we have two transitions here, in this and in dst.
|
|
469
|
-
await Promise.all([
|
|
470
|
-
await dst.moveChildIn(nameInDst, childJSON),
|
|
471
|
-
await this.moveChildOut(childName)
|
|
472
|
-
]);
|
|
473
485
|
}
|
|
474
|
-
async moveChildOut(name) {
|
|
486
|
+
async moveChildOut(name, moveLabel) {
|
|
475
487
|
await this.doTransition(async (state, version) => {
|
|
476
488
|
delete state.nodes[name];
|
|
477
489
|
const event = {
|
|
478
490
|
type: 'entry-removal',
|
|
479
491
|
path: this.name,
|
|
480
492
|
name,
|
|
481
|
-
newVersion: version
|
|
493
|
+
newVersion: version,
|
|
494
|
+
moveLabel
|
|
482
495
|
};
|
|
483
496
|
return event;
|
|
484
497
|
});
|
|
485
498
|
}
|
|
486
|
-
async moveChildIn(newName, child) {
|
|
499
|
+
async moveChildIn(newName, child, moveLabel) {
|
|
487
500
|
child = json_utils_1.copy(child);
|
|
488
501
|
await this.doTransition(async (state, version) => {
|
|
489
502
|
child.name = newName;
|
|
@@ -497,7 +510,8 @@ class FolderNode extends node_in_fs_1.NodeInFS {
|
|
|
497
510
|
isFolder: child.isFolder,
|
|
498
511
|
isLink: child.isLink
|
|
499
512
|
},
|
|
500
|
-
newVersion: version
|
|
513
|
+
newVersion: version,
|
|
514
|
+
moveLabel
|
|
501
515
|
};
|
|
502
516
|
return event;
|
|
503
517
|
});
|
|
@@ -23,12 +23,14 @@ declare type FileByteSource = web3n.files.FileByteSource;
|
|
|
23
23
|
declare type FileByteSink = web3n.files.FileByteSink;
|
|
24
24
|
declare type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
25
25
|
export declare class XspFS implements WritableFS {
|
|
26
|
-
|
|
27
|
-
writable: boolean;
|
|
26
|
+
readonly writable: boolean;
|
|
28
27
|
name: string;
|
|
29
|
-
type: FSType;
|
|
30
|
-
v: V;
|
|
28
|
+
readonly type: FSType;
|
|
29
|
+
readonly v: V;
|
|
30
|
+
private store;
|
|
31
|
+
private readonly fsObs;
|
|
31
32
|
private constructor();
|
|
33
|
+
private storage;
|
|
32
34
|
readonlySubRoot(path: string): Promise<ReadonlyFS>;
|
|
33
35
|
writableSubRoot(path: string, flags?: web3n.files.VersionedFileFlags): Promise<WritableFS>;
|
|
34
36
|
/**
|
|
@@ -74,6 +76,7 @@ export declare class XspFS implements WritableFS {
|
|
|
74
76
|
readLink(path: string): Promise<SymLink>;
|
|
75
77
|
getLinkParams(): Promise<LinkParameters<any>>;
|
|
76
78
|
static makeFolderFromLinkParams(storage: Storage, params: LinkParameters<FolderLinkParams>): Promise<ReadonlyFS | WritableFS>;
|
|
79
|
+
private getCloseEvent$;
|
|
77
80
|
watchFolder(path: string, observer: Observer<FolderEvent>): () => void;
|
|
78
81
|
watchFile(path: string, observer: Observer<FileEvent>): () => void;
|
|
79
82
|
watchTree(path: string, observer: Observer<FolderEvent | FileEvent>): () => void;
|
|
@@ -93,8 +96,10 @@ export declare class XspFS implements WritableFS {
|
|
|
93
96
|
}
|
|
94
97
|
declare type WritableFSVersionedAPI = web3n.files.WritableFSVersionedAPI;
|
|
95
98
|
declare class V implements WritableFSVersionedAPI {
|
|
96
|
-
|
|
97
|
-
constructor();
|
|
99
|
+
private rootNode;
|
|
100
|
+
constructor(root: FolderNode);
|
|
101
|
+
close(): void;
|
|
102
|
+
getRootIfNotClosed(excPath: string): FolderNode;
|
|
98
103
|
getOrCreateFile(path: string, flags: FileFlags): Promise<FileNode>;
|
|
99
104
|
get(path: string): Promise<NodeInFS<any>>;
|
|
100
105
|
updateXAttrs(path: string, changes: XAttrsChanges): Promise<number>;
|