core-3nweb-client-lib 0.26.0 → 0.27.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/build/api-defs/asmail.d.ts +1 -1
- package/build/api-defs/files.d.ts +278 -69
- package/build/core/app-files.js +7 -7
- package/build/core/asmail/config/common.js +2 -2
- package/build/core/asmail/config/index.js +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -1
- package/build/core/asmail/delivery/common.js +7 -7
- package/build/core/asmail/delivery/index.js +5 -5
- package/build/core/asmail/delivery/msg.js +4 -4
- package/build/core/asmail/delivery/per-recipient-wip.js +1 -1
- package/build/core/asmail/inbox/attachments/fs.js +5 -1
- package/build/core/asmail/inbox/cached-msgs.js +1 -1
- package/build/core/asmail/inbox/inbox-events.js +4 -4
- package/build/core/asmail/inbox/index.js +10 -10
- package/build/core/asmail/inbox/msg-downloader.js +1 -1
- package/build/core/asmail/inbox/msg-indexing.js +1 -1
- package/build/core/asmail/inbox/msg-on-disk.js +5 -5
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/index.js +13 -8
- package/build/core/asmail/key-verification.js +5 -5
- package/build/core/asmail/keyring/common.js +7 -6
- package/build/core/asmail/keyring/correspondent-keys.js +8 -7
- package/build/core/asmail/keyring/id-to-email-map.js +2 -1
- package/build/core/asmail/keyring/index.d.ts +7 -8
- package/build/core/asmail/keyring/index.js +15 -14
- package/build/core/asmail/keyring/keyring-storage.js +2 -1
- package/build/core/asmail/msg/opener.js +3 -3
- package/build/core/asmail/msg/packer.js +13 -13
- package/build/core/asmail/sending-params/own-params.js +2 -2
- package/build/core/asmail/sending-params/params-from-others.js +1 -1
- package/build/core/id-manager.js +6 -3
- package/build/core/index.d.ts +2 -1
- package/build/core/index.js +14 -14
- package/build/core/sign-in.js +5 -5
- package/build/core/sign-up.js +9 -9
- package/build/core/storage/common/json-saving.js +2 -2
- package/build/core/storage/common/obj-info-file.d.ts +12 -4
- package/build/core/storage/common/obj-info-file.js +66 -34
- package/build/core/storage/common/utils.d.ts +2 -0
- package/build/core/storage/common/utils.js +32 -0
- package/build/core/storage/index.d.ts +3 -17
- package/build/core/storage/index.js +56 -76
- package/build/core/storage/local/obj-files-gc.d.ts +2 -0
- package/build/core/storage/local/obj-files-gc.js +49 -37
- package/build/core/storage/local/obj-files.d.ts +4 -7
- package/build/core/storage/local/obj-files.js +7 -10
- package/build/core/storage/local/obj-status.d.ts +12 -6
- package/build/core/storage/local/obj-status.js +24 -9
- package/build/core/storage/local/storage.d.ts +9 -6
- package/build/core/storage/local/storage.js +29 -18
- package/build/core/storage/synced/downloader.js +1 -1
- package/build/core/storage/synced/obj-files-gc.d.ts +5 -1
- package/build/core/storage/synced/obj-files-gc.js +91 -37
- package/build/core/storage/synced/obj-files.d.ts +42 -36
- package/build/core/storage/synced/obj-files.js +178 -147
- package/build/core/storage/synced/obj-status.d.ts +87 -85
- package/build/core/storage/synced/obj-status.js +463 -259
- package/build/core/storage/synced/remote-events.d.ts +11 -12
- package/build/core/storage/synced/remote-events.js +73 -56
- package/build/core/storage/synced/storage.d.ts +18 -9
- package/build/core/storage/synced/storage.js +108 -48
- package/build/core/storage/synced/upload-header-file.d.ts +4 -0
- package/build/core/storage/synced/upload-header-file.js +64 -0
- package/build/core/storage/synced/upsyncer.d.ts +12 -7
- package/build/core/storage/synced/upsyncer.js +204 -280
- package/build/core/storage/system-folders/apps-data.d.ts +16 -0
- package/build/core/storage/system-folders/apps-data.js +110 -0
- package/build/core/storage/system-folders/index.d.ts +18 -0
- package/build/core/storage/system-folders/index.js +77 -0
- package/build/core-ipc/common-caps.js +3 -3
- package/build/core-ipc/generic.js +8 -8
- package/build/core-ipc/startup-caps.js +2 -2
- package/build/cryptors.js +6 -2
- package/build/ipc-via-protobuf/asmail-cap.js +58 -57
- package/build/ipc-via-protobuf/bytes.js +16 -17
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +61 -24
- package/build/ipc-via-protobuf/connector-services-side.js +10 -10
- package/build/ipc-via-protobuf/connector.js +4 -4
- package/build/ipc-via-protobuf/file.d.ts +48 -12
- package/build/ipc-via-protobuf/file.js +474 -126
- package/build/ipc-via-protobuf/fs.d.ts +8 -0
- package/build/ipc-via-protobuf/fs.js +577 -142
- package/build/ipc-via-protobuf/log-cap.js +2 -2
- package/build/ipc-via-protobuf/mailerid.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
- package/build/ipc-via-protobuf/startup-cap.js +21 -21
- package/build/ipc-via-protobuf/storage-cap.js +12 -12
- package/build/ipc.js +7 -2
- package/build/lib-client/3nstorage/exceptions.d.ts +3 -0
- package/build/lib-client/3nstorage/exceptions.js +13 -1
- package/build/lib-client/3nstorage/service.d.ts +15 -2
- package/build/lib-client/3nstorage/service.js +104 -38
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
- package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
- package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +42 -18
- package/build/lib-client/3nstorage/xsp-fs/common.js +29 -19
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +17 -13
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
- package/build/lib-client/3nstorage/xsp-fs/file.js +73 -25
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +575 -179
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
- package/build/lib-client/3nstorage/xsp-fs/fs.js +231 -110
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -24
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +229 -123
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +17 -18
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -3
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +53 -53
- package/build/lib-client/3nweb-signup.js +4 -4
- package/build/lib-client/asmail/recipient.js +15 -15
- package/build/lib-client/asmail/sender.js +22 -22
- package/build/lib-client/asmail/service-config.js +3 -3
- package/build/lib-client/cryptor/cryptor-in-worker.js +18 -16
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.js +4 -2
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +1 -1
- package/build/lib-client/cryptor/in-proc-wasm.js +6 -6
- package/build/lib-client/cryptor/worker-js.js +2 -2
- package/build/lib-client/cryptor/worker-wasm.js +2 -2
- package/build/lib-client/files-select.js +1 -1
- package/build/lib-client/files.d.ts +1 -1
- package/build/lib-client/files.js +71 -6
- package/build/lib-client/fs-collection.js +1 -1
- package/build/lib-client/fs-sync-utils.d.ts +5 -0
- package/build/lib-client/fs-sync-utils.js +61 -0
- package/build/lib-client/fs-view.d.ts +14 -0
- package/build/lib-client/fs-view.js +33 -0
- package/build/lib-client/key-derivation.js +1 -1
- package/build/lib-client/local-files/dev-file-sink.js +9 -9
- package/build/lib-client/local-files/dev-file-src.js +2 -2
- package/build/lib-client/local-files/device-fs.d.ts +1 -1
- package/build/lib-client/local-files/device-fs.js +56 -54
- package/build/lib-client/logging/log-to-file.d.ts +1 -1
- package/build/lib-client/logging/log-to-file.js +7 -7
- package/build/lib-client/mailer-id/login.js +7 -7
- package/build/lib-client/mailer-id/provisioner.js +12 -12
- package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -3
- package/build/lib-client/objs-on-disk/obj-folders.js +31 -31
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
- package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
- package/build/lib-client/request-utils.d.ts +1 -0
- package/build/lib-client/request-utils.js +13 -13
- package/build/lib-client/server-events.d.ts +3 -3
- package/build/lib-client/server-events.js +9 -8
- package/build/lib-client/service-locator.js +10 -10
- package/build/lib-client/user-with-mid-session.js +7 -7
- package/build/lib-client/user-with-pkl-session.js +25 -25
- package/build/lib-client/ws-utils.js +2 -2
- package/build/lib-common/async-cryptor-wrap.js +4 -4
- package/build/lib-common/async-fs-node.d.ts +5 -3
- package/build/lib-common/async-fs-node.js +16 -16
- package/build/lib-common/byte-streaming/pipe.js +1 -1
- package/build/lib-common/byte-streaming/wrapping.js +13 -13
- package/build/lib-common/canonical-address.js +1 -1
- package/build/lib-common/exceptions/error.d.ts +1 -0
- package/build/lib-common/exceptions/error.js +7 -6
- package/build/lib-common/exceptions/file.js +4 -0
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
- package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
- package/build/lib-common/objs-on-disk/file-layout.js +130 -12
- package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
- package/build/lib-common/objs-on-disk/obj-file.js +96 -35
- package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
- package/build/lib-common/objs-on-disk/utils.js +3 -3
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
- package/build/lib-common/processes/labelled-exec-pools.d.ts +1 -1
- package/build/lib-common/processes/labelled-exec-pools.js +1 -1
- package/build/lib-common/processes/pressure.js +2 -2
- package/build/lib-common/processes/synced.js +1 -1
- package/build/lib-common/processes/timeout.js +2 -2
- package/build/lib-common/random-node.js +7 -7
- package/build/lib-common/service-api/3nstorage/owner.d.ts +95 -39
- package/build/lib-common/service-api/3nstorage/owner.js +82 -40
- package/build/lib-common/service-api/asmail/delivery.js +2 -2
- package/build/lib-common/service-api/asmail/retrieval.js +1 -1
- package/build/lib-common/timed-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.js +11 -0
- package/build/lib-common/utils-for-observables.js +4 -4
- package/build/lib-common/weak-cache.d.ts +1 -0
- package/build/lib-common/weak-cache.js +12 -1
- package/build/lib-index.d.ts +2 -1
- package/build/lib-index.js +10 -7
- package/build/protos/asmail.proto.js +12955 -7496
- package/build/protos/file.proto.js +4867 -2744
- package/build/protos/fs.proto.js +9227 -3768
- package/package.json +6 -5
- package/protos/file.proto +91 -19
- package/protos/fs.proto +107 -8
|
@@ -25,7 +25,7 @@ function exposeLogger(fn) {
|
|
|
25
25
|
return buf => {
|
|
26
26
|
const { logType, msg, err } = logReqType.unpack(buf);
|
|
27
27
|
const promise = (err ?
|
|
28
|
-
fn(logType, msg, protobuf_msg_1.errFromMsg(err)) :
|
|
28
|
+
fn(logType, msg, (0, protobuf_msg_1.errFromMsg)(err)) :
|
|
29
29
|
fn(logType, msg));
|
|
30
30
|
return { promise };
|
|
31
31
|
};
|
|
@@ -35,7 +35,7 @@ function makeLogCaller(caller, path) {
|
|
|
35
35
|
return (type, msg, err) => {
|
|
36
36
|
const req = { logType: type, msg };
|
|
37
37
|
if (err) {
|
|
38
|
-
req.err = protobuf_msg_1.errToMsg(err);
|
|
38
|
+
req.err = (0, protobuf_msg_1.errToMsg)(err);
|
|
39
39
|
}
|
|
40
40
|
return caller.startPromiseCall(path, logReqType.pack(req));
|
|
41
41
|
};
|
|
@@ -40,7 +40,7 @@ var getUserId;
|
|
|
40
40
|
function wrapService(fn) {
|
|
41
41
|
return () => {
|
|
42
42
|
const promise = fn()
|
|
43
|
-
.then(userId => protobuf_msg_1.encodeToUtf8(userId));
|
|
43
|
+
.then(userId => (0, protobuf_msg_1.encodeToUtf8)(userId));
|
|
44
44
|
return { promise };
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -50,9 +50,9 @@ var getUserId;
|
|
|
50
50
|
return () => caller.startPromiseCall(path, undefined)
|
|
51
51
|
.then(buf => {
|
|
52
52
|
if (!buf) {
|
|
53
|
-
throw connector_1.makeIPCException({ missingBodyBytes: true });
|
|
53
|
+
throw (0, connector_1.makeIPCException)({ missingBodyBytes: true });
|
|
54
54
|
}
|
|
55
|
-
return protobuf_msg_1.decodeFromUtf8(buf);
|
|
55
|
+
return (0, protobuf_msg_1.decodeFromUtf8)(buf);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
getUserId.makeCaller = makeCaller;
|
|
@@ -33,6 +33,7 @@ export interface Value<T> {
|
|
|
33
33
|
export declare function toVal<T>(value: T): Value<T>;
|
|
34
34
|
export declare function toOptVal<T>(value: T | undefined): Value<T> | undefined;
|
|
35
35
|
export declare function valOf<T>(valObj: Value<T>): T;
|
|
36
|
+
export declare function intValOf(uint64: Value<number>): number;
|
|
36
37
|
export declare function valOfOpt<T>(valObj: Value<T> | undefined): T | undefined;
|
|
37
38
|
export declare function valOfOptJson(valObj: Value<string> | undefined): any | undefined;
|
|
38
39
|
export declare function toOptJson(json: any): Value<string> | undefined;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.decodeFromUtf8 = exports.encodeToUtf8 = exports.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = void 0;
|
|
19
|
+
exports.decodeFromUtf8 = exports.encodeToUtf8 = exports.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.intValOf = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = void 0;
|
|
20
20
|
const connector_1 = require("./connector");
|
|
21
21
|
const error_1 = require("../lib-common/exceptions/error");
|
|
22
22
|
const buffer_utils_1 = require("../lib-common/buffer-utils");
|
|
@@ -34,7 +34,7 @@ function fixInt(uint64) {
|
|
|
34
34
|
if (typeof uint64 === 'object') {
|
|
35
35
|
const { high, low } = uint64;
|
|
36
36
|
if (high > MAX_HIGH) {
|
|
37
|
-
throw connector_1.makeIPCException({
|
|
37
|
+
throw (0, connector_1.makeIPCException)({
|
|
38
38
|
invalidNumInBody: true,
|
|
39
39
|
message: 'Integer is greater than 2^53-1'
|
|
40
40
|
});
|
|
@@ -62,7 +62,7 @@ function valOfOptInt(uint64) {
|
|
|
62
62
|
if (!uint64) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return intValOf(uint64);
|
|
66
66
|
}
|
|
67
67
|
exports.valOfOptInt = valOfOptInt;
|
|
68
68
|
const numValType = protobuf_type_1.ProtoType.for(common_proto_1.common.UInt64Value);
|
|
@@ -80,10 +80,10 @@ function errToMsg(err) {
|
|
|
80
80
|
return { err: JSON.stringify(err) };
|
|
81
81
|
}
|
|
82
82
|
else if (err.runtimeException) {
|
|
83
|
-
return { runtimeExcJson: JSON.stringify(err) };
|
|
83
|
+
return { runtimeExcJson: JSON.stringify((0, error_1.recursiveErrJSONify)(err)) };
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
return { err: error_1.stringifyErr(err) };
|
|
86
|
+
return { err: (0, error_1.stringifyErr)(err) };
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.errToMsg = errToMsg;
|
|
@@ -108,6 +108,10 @@ function valOf(valObj) {
|
|
|
108
108
|
return valObj.value;
|
|
109
109
|
}
|
|
110
110
|
exports.valOf = valOf;
|
|
111
|
+
function intValOf(uint64) {
|
|
112
|
+
return fixInt(valOf(uint64));
|
|
113
|
+
}
|
|
114
|
+
exports.intValOf = intValOf;
|
|
111
115
|
function valOfOpt(valObj) {
|
|
112
116
|
return (valObj ? valObj.value : undefined);
|
|
113
117
|
}
|
|
@@ -117,7 +121,7 @@ function valOfOptJson(valObj) {
|
|
|
117
121
|
return (valObj ? JSON.parse(valObj.value) : undefined);
|
|
118
122
|
}
|
|
119
123
|
catch (err) {
|
|
120
|
-
throw connector_1.makeIPCException({ cause: err, badReply: true });
|
|
124
|
+
throw (0, connector_1.makeIPCException)({ cause: err, badReply: true });
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
exports.valOfOptJson = valOfOptJson;
|
|
@@ -133,7 +137,7 @@ function toOptAny(value) {
|
|
|
133
137
|
return { bytes: toVal(value) };
|
|
134
138
|
}
|
|
135
139
|
else if (ArrayBuffer.isView(value)) {
|
|
136
|
-
return { bytes: toVal(buffer_utils_1.toBuffer(value)) };
|
|
140
|
+
return { bytes: toVal((0, buffer_utils_1.toBuffer)(value)) };
|
|
137
141
|
}
|
|
138
142
|
else {
|
|
139
143
|
return { json: toVal(JSON.stringify(value)) };
|
|
@@ -65,7 +65,7 @@ var getAvailableAddresses;
|
|
|
65
65
|
function wrapService(fn) {
|
|
66
66
|
return buf => {
|
|
67
67
|
const { name, token } = requestType.unpack(buf);
|
|
68
|
-
const promise = fn(name, protobuf_msg_1.valOfOpt(token))
|
|
68
|
+
const promise = fn(name, (0, protobuf_msg_1.valOfOpt)(token))
|
|
69
69
|
.then(addresses => protobuf_msg_1.strArrValType.pack({ values: addresses }));
|
|
70
70
|
return { promise };
|
|
71
71
|
};
|
|
@@ -74,8 +74,8 @@ var getAvailableAddresses;
|
|
|
74
74
|
function makeCaller(caller, objPath) {
|
|
75
75
|
const path = objPath.concat('getAvailableAddresses');
|
|
76
76
|
return (name, token) => caller
|
|
77
|
-
.startPromiseCall(path, requestType.pack({ name, token: protobuf_msg_1.toOptVal(token) }))
|
|
78
|
-
.then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
77
|
+
.startPromiseCall(path, requestType.pack({ name, token: (0, protobuf_msg_1.toOptVal)(token) }))
|
|
78
|
+
.then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
79
79
|
}
|
|
80
80
|
getAvailableAddresses.makeCaller = makeCaller;
|
|
81
81
|
})(getAvailableAddresses || (getAvailableAddresses = {}));
|
|
@@ -86,8 +86,8 @@ var addUser;
|
|
|
86
86
|
function wrapService(fn) {
|
|
87
87
|
return buf => {
|
|
88
88
|
const { userId, token } = requestType.unpack(buf);
|
|
89
|
-
const promise = fn(userId, protobuf_msg_1.valOfOpt(token))
|
|
90
|
-
.then(wasAdded => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(wasAdded)));
|
|
89
|
+
const promise = fn(userId, (0, protobuf_msg_1.valOfOpt)(token))
|
|
90
|
+
.then(wasAdded => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(wasAdded)));
|
|
91
91
|
return { promise };
|
|
92
92
|
};
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ var addUser;
|
|
|
95
95
|
function makeCaller(caller, objPath) {
|
|
96
96
|
const path = objPath.concat('addUser');
|
|
97
97
|
return (userId, token) => caller
|
|
98
|
-
.startPromiseCall(path, requestType.pack({ userId, token: protobuf_msg_1.toOptVal(token) }))
|
|
98
|
+
.startPromiseCall(path, requestType.pack({ userId, token: (0, protobuf_msg_1.toOptVal)(token) }))
|
|
99
99
|
.then(buf => protobuf_msg_1.boolValType.unpack(buf).value);
|
|
100
100
|
}
|
|
101
101
|
addUser.makeCaller = makeCaller;
|
|
@@ -108,7 +108,7 @@ var isActivated;
|
|
|
108
108
|
return buf => {
|
|
109
109
|
const { userId } = requestType.unpack(buf);
|
|
110
110
|
const promise = fn(userId)
|
|
111
|
-
.then(isActivated => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(isActivated)));
|
|
111
|
+
.then(isActivated => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(isActivated)));
|
|
112
112
|
return { promise };
|
|
113
113
|
};
|
|
114
114
|
}
|
|
@@ -129,7 +129,7 @@ var createUserParams;
|
|
|
129
129
|
return buf => {
|
|
130
130
|
const { pass } = reqWithPassType.unpack(buf);
|
|
131
131
|
const s = new rxjs_1.Subject();
|
|
132
|
-
const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
|
|
132
|
+
const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
|
|
133
133
|
fn(pass, p => s.next({ p }))
|
|
134
134
|
.then(() => s.complete(), err => s.error(err));
|
|
135
135
|
return { obs };
|
|
@@ -140,7 +140,7 @@ var createUserParams;
|
|
|
140
140
|
const path = objPath.concat('createUserParams');
|
|
141
141
|
return (pass, progressCB) => {
|
|
142
142
|
const s = new rxjs_1.Subject();
|
|
143
|
-
const completion = deferred_1.defer();
|
|
143
|
+
const completion = (0, deferred_1.defer)();
|
|
144
144
|
s.subscribe({
|
|
145
145
|
next: buf => {
|
|
146
146
|
const { p } = progressValueType.unpack(buf);
|
|
@@ -170,7 +170,7 @@ var getUsersOnDisk;
|
|
|
170
170
|
const path = objPath.concat('getUsersOnDisk');
|
|
171
171
|
return () => caller
|
|
172
172
|
.startPromiseCall(path, undefined)
|
|
173
|
-
.then(buf => protobuf_msg_1.fixArray(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
173
|
+
.then(buf => (0, protobuf_msg_1.fixArray)(protobuf_msg_1.strArrValType.unpack(buf).values));
|
|
174
174
|
}
|
|
175
175
|
getUsersOnDisk.makeCaller = makeCaller;
|
|
176
176
|
})(getUsersOnDisk || (getUsersOnDisk = {}));
|
|
@@ -182,7 +182,7 @@ var startLoginToRemoteStorage;
|
|
|
182
182
|
return buf => {
|
|
183
183
|
const { address } = requestType.unpack(buf);
|
|
184
184
|
const promise = fn(address)
|
|
185
|
-
.then(started => protobuf_msg_1.boolValType.pack(protobuf_msg_1.toVal(started)));
|
|
185
|
+
.then(started => protobuf_msg_1.boolValType.pack((0, protobuf_msg_1.toVal)(started)));
|
|
186
186
|
return { promise };
|
|
187
187
|
};
|
|
188
188
|
}
|
|
@@ -203,10 +203,10 @@ var completeLoginAndLocalSetup;
|
|
|
203
203
|
return buf => {
|
|
204
204
|
const { pass } = reqWithPassType.unpack(buf);
|
|
205
205
|
const s = new rxjs_1.Subject();
|
|
206
|
-
const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
|
|
206
|
+
const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
|
|
207
207
|
fn(pass, p => s.next({ p }))
|
|
208
208
|
.then(ok => {
|
|
209
|
-
s.next({ decrResult: protobuf_msg_1.toVal(ok), p: 100 });
|
|
209
|
+
s.next({ decrResult: (0, protobuf_msg_1.toVal)(ok), p: 100 });
|
|
210
210
|
s.complete();
|
|
211
211
|
}, err => s.error(err));
|
|
212
212
|
return { obs };
|
|
@@ -217,12 +217,12 @@ var completeLoginAndLocalSetup;
|
|
|
217
217
|
const path = objPath.concat('completeLoginAndLocalSetup');
|
|
218
218
|
return (pass, progressCB) => {
|
|
219
219
|
const s = new rxjs_1.Subject();
|
|
220
|
-
const completion = deferred_1.defer();
|
|
220
|
+
const completion = (0, deferred_1.defer)();
|
|
221
221
|
s.subscribe({
|
|
222
222
|
next: buf => {
|
|
223
223
|
const { decrResult, p } = progressValueType.unpack(buf);
|
|
224
|
-
if (typeof protobuf_msg_1.valOfOpt(decrResult) === 'boolean') {
|
|
225
|
-
completion.resolve(protobuf_msg_1.valOfOpt(decrResult));
|
|
224
|
+
if (typeof (0, protobuf_msg_1.valOfOpt)(decrResult) === 'boolean') {
|
|
225
|
+
completion.resolve((0, protobuf_msg_1.valOfOpt)(decrResult));
|
|
226
226
|
}
|
|
227
227
|
else {
|
|
228
228
|
progressCB(p);
|
|
@@ -245,10 +245,10 @@ var useExistingStorage;
|
|
|
245
245
|
return buf => {
|
|
246
246
|
const { pass, address } = requestType.unpack(buf);
|
|
247
247
|
const s = new rxjs_1.Subject();
|
|
248
|
-
const obs = s.asObservable().pipe(operators_1.map(v => progressValueType.pack(v)));
|
|
248
|
+
const obs = s.asObservable().pipe((0, operators_1.map)(v => progressValueType.pack(v)));
|
|
249
249
|
fn(address, pass, p => s.next({ p }))
|
|
250
250
|
.then(ok => {
|
|
251
|
-
s.next({ decrResult: protobuf_msg_1.toVal(ok), p: 100 });
|
|
251
|
+
s.next({ decrResult: (0, protobuf_msg_1.toVal)(ok), p: 100 });
|
|
252
252
|
s.complete();
|
|
253
253
|
}, err => s.error(err));
|
|
254
254
|
return { obs };
|
|
@@ -259,12 +259,12 @@ var useExistingStorage;
|
|
|
259
259
|
const path = objPath.concat('useExistingStorage');
|
|
260
260
|
return (address, pass, progressCB) => {
|
|
261
261
|
const s = new rxjs_1.Subject();
|
|
262
|
-
const completion = deferred_1.defer();
|
|
262
|
+
const completion = (0, deferred_1.defer)();
|
|
263
263
|
s.subscribe({
|
|
264
264
|
next: buf => {
|
|
265
265
|
const { decrResult, p } = progressValueType.unpack(buf);
|
|
266
|
-
if (typeof protobuf_msg_1.valOfOpt(decrResult) === 'boolean') {
|
|
267
|
-
completion.resolve(protobuf_msg_1.valOfOpt(decrResult));
|
|
266
|
+
if (typeof (0, protobuf_msg_1.valOfOpt)(decrResult) === 'boolean') {
|
|
267
|
+
completion.resolve((0, protobuf_msg_1.valOfOpt)(decrResult));
|
|
268
268
|
}
|
|
269
269
|
else {
|
|
270
270
|
progressCB(p);
|
|
@@ -66,9 +66,9 @@ var getAppLocalFS;
|
|
|
66
66
|
function wrapService(fn, expServices) {
|
|
67
67
|
return buf => {
|
|
68
68
|
const { appName } = requestType.unpack(buf);
|
|
69
|
-
const promise = fn(protobuf_msg_1.valOfOpt(appName))
|
|
69
|
+
const promise = fn((0, protobuf_msg_1.valOfOpt)(appName))
|
|
70
70
|
.then(fs => {
|
|
71
|
-
const fsMsg = fs_1.exposeFSService(fs, expServices);
|
|
71
|
+
const fsMsg = (0, fs_1.exposeFSService)(fs, expServices);
|
|
72
72
|
return fs_1.fsMsgType.pack(fsMsg);
|
|
73
73
|
});
|
|
74
74
|
return { promise };
|
|
@@ -78,10 +78,10 @@ var getAppLocalFS;
|
|
|
78
78
|
function makeCaller(caller, objPath) {
|
|
79
79
|
const path = objPath.concat('getAppLocalFS');
|
|
80
80
|
return appName => caller
|
|
81
|
-
.startPromiseCall(path, requestType.pack({ appName: protobuf_msg_1.toOptVal(appName) }))
|
|
81
|
+
.startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
|
|
82
82
|
.then(buf => {
|
|
83
83
|
const fsMsg = fs_1.fsMsgType.unpack(buf);
|
|
84
|
-
return fs_1.makeFSCaller(caller, fsMsg);
|
|
84
|
+
return (0, fs_1.makeFSCaller)(caller, fsMsg);
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
getAppLocalFS.makeCaller = makeCaller;
|
|
@@ -93,9 +93,9 @@ var getAppSyncedFS;
|
|
|
93
93
|
function wrapService(fn, expServices) {
|
|
94
94
|
return buf => {
|
|
95
95
|
const { appName } = requestType.unpack(buf);
|
|
96
|
-
const promise = fn(protobuf_msg_1.valOfOpt(appName))
|
|
96
|
+
const promise = fn((0, protobuf_msg_1.valOfOpt)(appName))
|
|
97
97
|
.then(fs => {
|
|
98
|
-
const fsMsg = fs_1.exposeFSService(fs, expServices);
|
|
98
|
+
const fsMsg = (0, fs_1.exposeFSService)(fs, expServices);
|
|
99
99
|
return fs_1.fsMsgType.pack(fsMsg);
|
|
100
100
|
});
|
|
101
101
|
return { promise };
|
|
@@ -105,10 +105,10 @@ var getAppSyncedFS;
|
|
|
105
105
|
function makeCaller(caller, objPath) {
|
|
106
106
|
const path = objPath.concat('getAppSyncedFS');
|
|
107
107
|
return appName => caller
|
|
108
|
-
.startPromiseCall(path, requestType.pack({ appName: protobuf_msg_1.toOptVal(appName) }))
|
|
108
|
+
.startPromiseCall(path, requestType.pack({ appName: (0, protobuf_msg_1.toOptVal)(appName) }))
|
|
109
109
|
.then(buf => {
|
|
110
110
|
const fsMsg = fs_1.fsMsgType.unpack(buf);
|
|
111
|
-
return fs_1.makeFSCaller(caller, fsMsg);
|
|
111
|
+
return (0, fs_1.makeFSCaller)(caller, fsMsg);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
getAppSyncedFS.makeCaller = makeCaller;
|
|
@@ -120,7 +120,7 @@ var getSysFS;
|
|
|
120
120
|
function wrapService(fn, expServices) {
|
|
121
121
|
return buf => {
|
|
122
122
|
const { type, path } = requestType.unpack(buf);
|
|
123
|
-
const promise = fn(type, protobuf_msg_1.valOfOpt(path))
|
|
123
|
+
const promise = fn(type, (0, protobuf_msg_1.valOfOpt)(path))
|
|
124
124
|
.then(item => {
|
|
125
125
|
const msg = fs_1.fsItem.exposeFSItem(expServices, item);
|
|
126
126
|
return fs_1.fsItem.msgType.pack(msg);
|
|
@@ -133,7 +133,7 @@ var getSysFS;
|
|
|
133
133
|
const ipcPath = objPath.concat('getSysFS');
|
|
134
134
|
return (type, path) => caller
|
|
135
135
|
.startPromiseCall(ipcPath, requestType.pack({
|
|
136
|
-
type, path: protobuf_msg_1.toOptVal(path)
|
|
136
|
+
type, path: (0, protobuf_msg_1.toOptVal)(path)
|
|
137
137
|
}))
|
|
138
138
|
.then(buf => {
|
|
139
139
|
const msg = fs_1.fsItem.msgType.unpack(buf);
|
|
@@ -149,7 +149,7 @@ var getUserFS;
|
|
|
149
149
|
function wrapService(fn, expServices) {
|
|
150
150
|
return buf => {
|
|
151
151
|
const { type, path } = requestType.unpack(buf);
|
|
152
|
-
const promise = fn(type, protobuf_msg_1.valOfOpt(path))
|
|
152
|
+
const promise = fn(type, (0, protobuf_msg_1.valOfOpt)(path))
|
|
153
153
|
.then(item => {
|
|
154
154
|
const msg = fs_1.fsItem.exposeFSItem(expServices, item);
|
|
155
155
|
return fs_1.fsItem.msgType.pack(msg);
|
|
@@ -162,7 +162,7 @@ var getUserFS;
|
|
|
162
162
|
const ipcPath = objPath.concat('getUserFS');
|
|
163
163
|
return (type, path) => caller
|
|
164
164
|
.startPromiseCall(ipcPath, requestType.pack({
|
|
165
|
-
type, path: protobuf_msg_1.toOptVal(path)
|
|
165
|
+
type, path: (0, protobuf_msg_1.toOptVal)(path)
|
|
166
166
|
}))
|
|
167
167
|
.then(buf => {
|
|
168
168
|
const msg = fs_1.fsItem.msgType.unpack(buf);
|
package/build/ipc.js
CHANGED
|
@@ -17,15 +17,20 @@
|
|
|
17
17
|
*/
|
|
18
18
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
19
|
if (k2 === undefined) k2 = k;
|
|
20
|
-
Object.
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
21
25
|
}) : (function(o, m, k, k2) {
|
|
22
26
|
if (k2 === undefined) k2 = k;
|
|
23
27
|
o[k2] = m[k];
|
|
24
28
|
}));
|
|
25
29
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !
|
|
30
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
31
|
};
|
|
28
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.exposeLogger = exports.makeLogCaller = exports.exposeFSService = exports.makeFSCaller = exports.exposeFileService = exports.makeFileCaller = void 0;
|
|
29
34
|
__exportStar(require("./core-ipc/common-caps"), exports);
|
|
30
35
|
__exportStar(require("./core-ipc/startup-caps"), exports);
|
|
31
36
|
__exportStar(require("./ipc-via-protobuf/connector"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjId } from "./xsp-fs/common";
|
|
2
|
+
declare type FSSyncException = web3n.files.FSSyncException;
|
|
2
3
|
export interface StorageException extends web3n.RuntimeException {
|
|
3
4
|
type: 'storage';
|
|
4
5
|
remoteStorage?: true;
|
|
@@ -19,3 +20,5 @@ export declare function makeConcurrentTransExc(objId: ObjId): StorageException;
|
|
|
19
20
|
export declare function makeUnknownTransactionExc(objId: ObjId): StorageException;
|
|
20
21
|
export declare function makeVersionMismatchExc(objId: ObjId, currentVersion: number): StorageException;
|
|
21
22
|
export declare function makeStorageIsClosedExc(): StorageException;
|
|
23
|
+
export declare function makeFSSyncException(path: string, fields: Partial<FSSyncException>): FSSyncException;
|
|
24
|
+
export {};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.makeStorageIsClosedExc = exports.makeVersionMismatchExc = exports.makeUnknownTransactionExc = exports.makeConcurrentTransExc = exports.makeObjExistsExc = exports.makeObjNotFoundExc = exports.makeStorageException = void 0;
|
|
19
|
+
exports.makeFSSyncException = exports.makeStorageIsClosedExc = exports.makeVersionMismatchExc = exports.makeUnknownTransactionExc = exports.makeConcurrentTransExc = exports.makeObjExistsExc = exports.makeObjNotFoundExc = exports.makeStorageException = void 0;
|
|
20
20
|
function makeStorageException(fields) {
|
|
21
21
|
const exc = {
|
|
22
22
|
runtimeException: true,
|
|
@@ -62,4 +62,16 @@ function makeStorageIsClosedExc() {
|
|
|
62
62
|
return makeStorageException({ storageIsClosed: true });
|
|
63
63
|
}
|
|
64
64
|
exports.makeStorageIsClosedExc = makeStorageIsClosedExc;
|
|
65
|
+
function makeFSSyncException(path, fields) {
|
|
66
|
+
const exc = {
|
|
67
|
+
runtimeException: true,
|
|
68
|
+
type: 'fs-sync',
|
|
69
|
+
path
|
|
70
|
+
};
|
|
71
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
72
|
+
exc[key] = value;
|
|
73
|
+
}
|
|
74
|
+
return exc;
|
|
75
|
+
}
|
|
76
|
+
exports.makeFSSyncException = makeFSSyncException;
|
|
65
77
|
Object.freeze(exports);
|
|
@@ -58,11 +58,24 @@ export declare class StorageOwner extends ServiceUser {
|
|
|
58
58
|
* complete, or to a transaction id, which must be used for subsequent
|
|
59
59
|
* request(s).
|
|
60
60
|
* @param objId is object's id, with null value for root object
|
|
61
|
-
* @param bytes are bytes to upload
|
|
62
61
|
* @param fstReq is options object for the first request
|
|
63
62
|
* @param followReq is options object for subsequent request(s)
|
|
63
|
+
* @param bytes is an object with header, diff and segs bytes to upload
|
|
64
64
|
*/
|
|
65
|
-
saveNewObjVersion(objId: ObjId,
|
|
65
|
+
saveNewObjVersion(objId: ObjId, fstReq: {
|
|
66
|
+
ver: number;
|
|
67
|
+
last?: true;
|
|
68
|
+
} | undefined, followReq: {
|
|
69
|
+
trans: string;
|
|
70
|
+
ofs: number;
|
|
71
|
+
last?: boolean;
|
|
72
|
+
} | undefined, { header, diff, segs }: {
|
|
73
|
+
header?: Uint8Array;
|
|
74
|
+
diff?: Uint8Array;
|
|
75
|
+
segs?: Uint8Array | Uint8Array[];
|
|
76
|
+
}): Promise<string | undefined>;
|
|
77
|
+
archiveObjVersion(objId: ObjId, currentVer: number): Promise<void>;
|
|
78
|
+
getObjStatus(objId: ObjId): Promise<api.ObjStatus>;
|
|
66
79
|
/**
|
|
67
80
|
* This deletes object from being available as currently existing one.
|
|
68
81
|
* But, it does not remove archived versions of it, even if current varsion
|