core-3nweb-client-lib 0.26.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/asmail.d.ts +1 -1
- package/build/api-defs/files.d.ts +281 -75
- 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.d.ts +2 -1
- package/build/core/asmail/inbox/attachments/fs.js +9 -4
- 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/index.d.ts +43 -0
- package/build/core/{id-manager.js → id-manager/index.js} +36 -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.d.ts +2 -1
- package/build/core/index.js +31 -33
- package/build/core/sign-in.d.ts +1 -2
- package/build/core/sign-in.js +8 -17
- package/build/core/sign-up.d.ts +2 -0
- package/build/core/sign-up.js +11 -10
- 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 +5 -17
- package/build/core/storage/index.js +78 -119
- 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 +10 -7
- 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 +1 -0
- package/build/core/storage/synced/obj-files-gc.js +76 -39
- package/build/core/storage/synced/obj-files.d.ts +50 -36
- package/build/core/storage/synced/obj-files.js +201 -162
- package/build/core/storage/synced/obj-status.d.ts +99 -86
- package/build/core/storage/synced/obj-status.js +520 -251
- 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 +24 -10
- package/build/core/storage/synced/storage.js +147 -47
- 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 +210 -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 +1 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +14 -15
- 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 +16 -1
- package/build/lib-client/3nstorage/exceptions.js +21 -3
- package/build/lib-client/3nstorage/service.d.ts +21 -3
- package/build/lib-client/3nstorage/service.js +128 -46
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
- package/build/lib-client/3nstorage/util/file-based-json.js +3 -2
- 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/attrs.js +17 -17
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +44 -19
- package/build/lib-client/3nstorage/xsp-fs/common.js +30 -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 +32 -13
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +752 -192
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
- package/build/lib-client/3nstorage/xsp-fs/fs.js +236 -119
- 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 -29
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +232 -127
- 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.d.ts +2 -1
- package/build/lib-client/user-with-mid-session.js +14 -8
- 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 +17 -17
- 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.d.ts +4 -2
- package/build/lib-common/exceptions/file.js +24 -54
- package/build/lib-common/ipc/generic-ipc.js +5 -4
- 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 +101 -42
- package/build/lib-common/service-api/3nstorage/owner.js +83 -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 +7 -5
- package/protos/file.proto +91 -19
- package/protos/fs.proto +107 -8
- package/build/core/id-manager.d.ts +0 -46
|
@@ -22,7 +22,7 @@ const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
|
22
22
|
const bytes_proto_1 = require("../protos/bytes.proto");
|
|
23
23
|
const connector_1 = require("./connector");
|
|
24
24
|
function makeSinkCaller(caller, ref) {
|
|
25
|
-
connector_1.checkRefObjTypeIs('FileByteSink', ref);
|
|
25
|
+
(0, connector_1.checkRefObjTypeIs)('FileByteSink', ref);
|
|
26
26
|
const objPath = ref.path;
|
|
27
27
|
const sink = {
|
|
28
28
|
done: sinkDone.makeCaller(caller, objPath),
|
|
@@ -48,7 +48,7 @@ function exposeSinkService(sink, expServices) {
|
|
|
48
48
|
}
|
|
49
49
|
exports.exposeSinkService = exposeSinkService;
|
|
50
50
|
function makeSrcCaller(caller, ref) {
|
|
51
|
-
connector_1.checkRefObjTypeIs('FileByteSource', ref);
|
|
51
|
+
(0, connector_1.checkRefObjTypeIs)('FileByteSource', ref);
|
|
52
52
|
const objPath = ref.path;
|
|
53
53
|
const src = {
|
|
54
54
|
getPosition: srcGetPosition.makeCaller(caller, objPath),
|
|
@@ -96,7 +96,7 @@ var sinkSplice;
|
|
|
96
96
|
function wrapService(fn) {
|
|
97
97
|
return buf => {
|
|
98
98
|
const { pos, del, bytes } = requestType.unpack(buf);
|
|
99
|
-
const promise = fn(protobuf_msg_1.fixInt(pos), protobuf_msg_1.fixInt(del), protobuf_msg_1.valOfOpt(bytes));
|
|
99
|
+
const promise = fn((0, protobuf_msg_1.fixInt)(pos), (0, protobuf_msg_1.fixInt)(del), (0, protobuf_msg_1.valOfOpt)(bytes));
|
|
100
100
|
return { promise };
|
|
101
101
|
};
|
|
102
102
|
}
|
|
@@ -106,8 +106,7 @@ var sinkSplice;
|
|
|
106
106
|
return async (pos, del, bytes) => {
|
|
107
107
|
await caller
|
|
108
108
|
.startPromiseCall(path, requestType.pack({
|
|
109
|
-
pos, del,
|
|
110
|
-
bytes: protobuf_msg_1.toOptVal(bytes)
|
|
109
|
+
pos, del, bytes: (0, protobuf_msg_1.toOptVal)(bytes)
|
|
111
110
|
}));
|
|
112
111
|
};
|
|
113
112
|
}
|
|
@@ -120,7 +119,7 @@ var sinkTruncate;
|
|
|
120
119
|
function wrapService(fn) {
|
|
121
120
|
return buf => {
|
|
122
121
|
const { size } = requestType.unpack(buf);
|
|
123
|
-
const promise = fn(protobuf_msg_1.fixInt(size));
|
|
122
|
+
const promise = fn((0, protobuf_msg_1.fixInt)(size));
|
|
124
123
|
return { promise };
|
|
125
124
|
};
|
|
126
125
|
}
|
|
@@ -140,15 +139,15 @@ var sinkShowLayout;
|
|
|
140
139
|
const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.FileLayoutMsg);
|
|
141
140
|
function packLayout(l) {
|
|
142
141
|
return {
|
|
143
|
-
base: protobuf_msg_1.toOptVal(l.base),
|
|
142
|
+
base: (0, protobuf_msg_1.toOptVal)(l.base),
|
|
144
143
|
sections: l.sections
|
|
145
144
|
};
|
|
146
145
|
}
|
|
147
146
|
function unpackLayout(msg) {
|
|
148
147
|
return {
|
|
149
|
-
base: protobuf_msg_1.valOfOptInt(msg.base),
|
|
150
|
-
sections: protobuf_msg_1.fixArray(msg.sections).map(({ src, ofs, len }) => ({
|
|
151
|
-
src, ofs: protobuf_msg_1.fixInt(ofs), len: protobuf_msg_1.fixInt(len)
|
|
148
|
+
base: (0, protobuf_msg_1.valOfOptInt)(msg.base),
|
|
149
|
+
sections: (0, protobuf_msg_1.fixArray)(msg.sections).map(({ src, ofs, len }) => ({
|
|
150
|
+
src, ofs: (0, protobuf_msg_1.fixInt)(ofs), len: (0, protobuf_msg_1.fixInt)(len)
|
|
152
151
|
}))
|
|
153
152
|
};
|
|
154
153
|
}
|
|
@@ -175,7 +174,7 @@ var sinkDone;
|
|
|
175
174
|
function wrapService(fn) {
|
|
176
175
|
return buf => {
|
|
177
176
|
const { err } = requestType.unpack(buf);
|
|
178
|
-
const promise = (err ? fn(protobuf_msg_1.errFromMsg(err)) : fn());
|
|
177
|
+
const promise = (err ? fn((0, protobuf_msg_1.errFromMsg)(err)) : fn());
|
|
179
178
|
return { promise };
|
|
180
179
|
};
|
|
181
180
|
}
|
|
@@ -183,7 +182,7 @@ var sinkDone;
|
|
|
183
182
|
function makeCaller(caller, objPath) {
|
|
184
183
|
const path = objPath.concat('done');
|
|
185
184
|
return async (err) => {
|
|
186
|
-
const req = (err ? { err: protobuf_msg_1.errToMsg(err) } : {});
|
|
185
|
+
const req = (err ? { err: (0, protobuf_msg_1.errToMsg)(err) } : {});
|
|
187
186
|
await caller
|
|
188
187
|
.startPromiseCall(path, requestType.pack(req));
|
|
189
188
|
};
|
|
@@ -236,8 +235,8 @@ var srcRead;
|
|
|
236
235
|
function wrapService(fn) {
|
|
237
236
|
return buf => {
|
|
238
237
|
const { len } = requestType.unpack(buf);
|
|
239
|
-
const promise = fn(protobuf_msg_1.valOfOptInt(len))
|
|
240
|
-
.then(bytes => replyType.pack({ bytes: protobuf_msg_1.toOptVal(bytes) }));
|
|
238
|
+
const promise = fn((0, protobuf_msg_1.valOfOptInt)(len))
|
|
239
|
+
.then(bytes => replyType.pack({ bytes: (0, protobuf_msg_1.toOptVal)(bytes) }));
|
|
241
240
|
return { promise };
|
|
242
241
|
};
|
|
243
242
|
}
|
|
@@ -245,8 +244,8 @@ var srcRead;
|
|
|
245
244
|
function makeCaller(caller, objPath) {
|
|
246
245
|
const path = objPath.concat('read');
|
|
247
246
|
return len => caller
|
|
248
|
-
.startPromiseCall(path, requestType.pack({ len: protobuf_msg_1.toOptVal(len) }))
|
|
249
|
-
.then(buf => protobuf_msg_1.valOfOpt(replyType.unpack(buf).bytes));
|
|
247
|
+
.startPromiseCall(path, requestType.pack({ len: (0, protobuf_msg_1.toOptVal)(len) }))
|
|
248
|
+
.then(buf => (0, protobuf_msg_1.valOfOpt)(replyType.unpack(buf).bytes));
|
|
250
249
|
}
|
|
251
250
|
srcRead.makeCaller = makeCaller;
|
|
252
251
|
})(srcRead || (srcRead = {}));
|
|
@@ -257,7 +256,7 @@ var srcSeek;
|
|
|
257
256
|
function wrapService(fn) {
|
|
258
257
|
return buf => {
|
|
259
258
|
const { offset } = requestType.unpack(buf);
|
|
260
|
-
const promise = fn(protobuf_msg_1.fixInt(offset));
|
|
259
|
+
const promise = fn((0, protobuf_msg_1.fixInt)(offset));
|
|
261
260
|
return { promise };
|
|
262
261
|
};
|
|
263
262
|
}
|
|
@@ -19,6 +19,7 @@ export declare class ClientsSideImpl implements ClientsSide {
|
|
|
19
19
|
private retryWithOtherCallNum;
|
|
20
20
|
private nextFnCallNum;
|
|
21
21
|
caller(): Caller;
|
|
22
|
+
private throwIfStopped;
|
|
22
23
|
private startCall;
|
|
23
24
|
private setupFnCall;
|
|
24
25
|
startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
|
|
@@ -61,7 +61,7 @@ class ClientsSideImpl {
|
|
|
61
61
|
}
|
|
62
62
|
sendCallCancellation(fnCallNum) {
|
|
63
63
|
this.sendMsg({
|
|
64
|
-
headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'cancel' }
|
|
64
|
+
headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'cancel' }
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
processInterimCallReply(fnCallNum, body) {
|
|
@@ -106,7 +106,7 @@ class ClientsSideImpl {
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
this.fnCalls.delete(fnCallNum);
|
|
109
|
-
const err = (body ? protobuf_msg_1.errFromMsg(protobuf_msg_1.errBodyType.unpack(body)) : undefined);
|
|
109
|
+
const err = (body ? (0, protobuf_msg_1.errFromMsg)(protobuf_msg_1.errBodyType.unpack(body)) : undefined);
|
|
110
110
|
if (err && (err.type === 'ipc')
|
|
111
111
|
&& err.duplicateFnCallNum) {
|
|
112
112
|
this.retryWithOtherCallNum(call);
|
|
@@ -173,23 +173,26 @@ class ClientsSideImpl {
|
|
|
173
173
|
};
|
|
174
174
|
return callerWrap;
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
throwIfStopped() {
|
|
177
177
|
if (this.isStopped) {
|
|
178
|
-
throw connector_1.makeIPCException({
|
|
178
|
+
throw (0, connector_1.makeIPCException)({ ipcNotConnected: true });
|
|
179
179
|
}
|
|
180
|
+
}
|
|
181
|
+
startCall(reqEnv) {
|
|
182
|
+
this.throwIfStopped();
|
|
180
183
|
this.sendMsg(reqEnv);
|
|
181
184
|
}
|
|
182
185
|
setupFnCall(path, body, deferred, obs) {
|
|
183
186
|
const fnCallNum = this.nextFnCallNum();
|
|
184
187
|
const reqEnv = {
|
|
185
|
-
headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'start', path },
|
|
186
|
-
body: protobuf_msg_1.toOptVal(body)
|
|
188
|
+
headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'start', path },
|
|
189
|
+
body: (0, protobuf_msg_1.toOptVal)(body)
|
|
187
190
|
};
|
|
188
191
|
this.fnCalls.set(fnCallNum, { deferred, obs, reqEnv });
|
|
189
192
|
return reqEnv;
|
|
190
193
|
}
|
|
191
194
|
startPromiseCall(path, req) {
|
|
192
|
-
const deferred = deferred_1.defer();
|
|
195
|
+
const deferred = (0, deferred_1.defer)();
|
|
193
196
|
const reqEnv = this.setupFnCall(path, req, deferred, undefined);
|
|
194
197
|
const fnCallNum = reqEnv.headers.fnCallNum.value;
|
|
195
198
|
try {
|
|
@@ -214,7 +217,7 @@ class ClientsSideImpl {
|
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
219
|
registerClientDrop(o, srvRef) {
|
|
217
|
-
const clientRef = weakref_1.makeWeakRefFor(o);
|
|
220
|
+
const clientRef = (0, weakref_1.makeWeakRefFor)(o);
|
|
218
221
|
this.weakRefs.add(clientRef);
|
|
219
222
|
clientRef.addCallback(this.makeClientDropCB(clientRef, srvRef));
|
|
220
223
|
this.srvRefs.set(o, srvRef);
|
|
@@ -237,19 +240,15 @@ class ClientsSideImpl {
|
|
|
237
240
|
return srvRef;
|
|
238
241
|
}
|
|
239
242
|
else {
|
|
240
|
-
throw connector_1.makeIPCException({ 'objectNotFound': true });
|
|
243
|
+
throw (0, connector_1.makeIPCException)({ 'objectNotFound': true });
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
listObj(path) {
|
|
244
|
-
|
|
245
|
-
throw connector_1.makeIPCException({ 'ipcNotConnected': true });
|
|
246
|
-
}
|
|
247
|
+
this.throwIfStopped();
|
|
247
248
|
return this.syncReqToListObj(path);
|
|
248
249
|
}
|
|
249
250
|
listObjAsync(path) {
|
|
250
|
-
|
|
251
|
-
throw connector_1.makeIPCException({ 'ipcNotConnected': true });
|
|
252
|
-
}
|
|
251
|
+
this.throwIfStopped();
|
|
253
252
|
return this.asyncReqToListObj(path);
|
|
254
253
|
}
|
|
255
254
|
}
|
|
@@ -41,22 +41,22 @@ class ServicesSideImpl {
|
|
|
41
41
|
}
|
|
42
42
|
sendCallError(fnCallNum, err) {
|
|
43
43
|
this.sendMsg({
|
|
44
|
-
headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'error' },
|
|
45
|
-
body: protobuf_msg_1.toVal(protobuf_msg_1.errBodyType.pack(protobuf_msg_1.errToMsg(err)))
|
|
44
|
+
headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'error' },
|
|
45
|
+
body: (0, protobuf_msg_1.toVal)(protobuf_msg_1.errBodyType.pack((0, protobuf_msg_1.errToMsg)(err)))
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
sendCallReply(fnCallNum, last, body) {
|
|
49
49
|
this.sendMsg({
|
|
50
50
|
headers: {
|
|
51
|
-
fnCallNum: protobuf_msg_1.toVal(fnCallNum),
|
|
51
|
+
fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum),
|
|
52
52
|
msgType: (last ? 'end' : 'interim')
|
|
53
53
|
},
|
|
54
|
-
body: protobuf_msg_1.toOptVal(body)
|
|
54
|
+
body: (0, protobuf_msg_1.toOptVal)(body)
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
processCallStart(fnCallNum, path, body) {
|
|
58
58
|
if (this.fnCallProcs.has(fnCallNum)) {
|
|
59
|
-
this.sendCallError(fnCallNum, connector_1.makeIPCException({ duplicateFnCallNum: true }));
|
|
59
|
+
this.sendCallError(fnCallNum, (0, connector_1.makeIPCException)({ duplicateFnCallNum: true }));
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
@@ -113,7 +113,7 @@ class ServicesSideImpl {
|
|
|
113
113
|
this.exposedObjs.drop(path[0]);
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
throw connector_1.makeIPCException({ invalidPath: true, path });
|
|
116
|
+
throw (0, connector_1.makeIPCException)({ invalidPath: true, path });
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
processListObj(fnCallNum, path) {
|
|
@@ -124,7 +124,7 @@ class ServicesSideImpl {
|
|
|
124
124
|
this.sendCallReply(fnCallNum, true, buf);
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
const exc = connector_1.makeIPCException({ 'objectNotFound': true });
|
|
127
|
+
const exc = (0, connector_1.makeIPCException)({ 'objectNotFound': true });
|
|
128
128
|
this.sendCallError(fnCallNum, exc);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -151,7 +151,7 @@ class ExposedObjs {
|
|
|
151
151
|
exposeDroppableService(objType, exp, original) {
|
|
152
152
|
let id;
|
|
153
153
|
do {
|
|
154
|
-
id = random_node_1.stringOfB64CharsSync(20);
|
|
154
|
+
id = (0, random_node_1.stringOfB64CharsSync)(20);
|
|
155
155
|
} while (this.objs.has(id));
|
|
156
156
|
this.objs.set(id, { exp, original });
|
|
157
157
|
return { objType, path: [id] };
|
|
@@ -162,7 +162,7 @@ class ExposedObjs {
|
|
|
162
162
|
return o.original;
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
throw connector_1.makeIPCException({ 'objectNotFound': true });
|
|
165
|
+
throw (0, connector_1.makeIPCException)({ 'objectNotFound': true });
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
exposeW3NService(exp) {
|
|
@@ -199,7 +199,7 @@ class ExposedObjs {
|
|
|
199
199
|
return fn;
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
|
-
throw connector_1.makeIPCException({ callFnNotFound: true, path });
|
|
202
|
+
throw (0, connector_1.makeIPCException)({ callFnNotFound: true, path });
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
dropAll() {
|
|
@@ -104,8 +104,8 @@ class ObjectsConnector {
|
|
|
104
104
|
processIncomingMsg(msg) {
|
|
105
105
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
106
106
|
const { msgType, path, fnCallNum: cNum } = msg.headers;
|
|
107
|
-
const fnCallNum = protobuf_msg_1.valOfOptInt(cNum);
|
|
108
|
-
const body = protobuf_msg_1.valOfOpt(msg.body);
|
|
107
|
+
const fnCallNum = (0, protobuf_msg_1.valOfOptInt)(cNum);
|
|
108
|
+
const body = (0, protobuf_msg_1.valOfOpt)(msg.body);
|
|
109
109
|
try {
|
|
110
110
|
if (typeof fnCallNum === 'number') {
|
|
111
111
|
if (msgType === 'start') {
|
|
@@ -149,8 +149,8 @@ class ObjectsConnector {
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
const msg = {
|
|
152
|
-
headers: { fnCallNum: protobuf_msg_1.toVal(fnCallNum), msgType: 'error' },
|
|
153
|
-
body: protobuf_msg_1.toVal(protobuf_msg_1.errBodyType.pack(protobuf_msg_1.errToMsg(err)))
|
|
152
|
+
headers: { fnCallNum: (0, protobuf_msg_1.toVal)(fnCallNum), msgType: 'error' },
|
|
153
|
+
body: (0, protobuf_msg_1.toVal)(protobuf_msg_1.errBodyType.pack((0, protobuf_msg_1.errToMsg)(err)))
|
|
154
154
|
};
|
|
155
155
|
this.msgSink.next(msg);
|
|
156
156
|
}
|
|
@@ -8,20 +8,27 @@ declare type WritableFile = web3n.files.WritableFile;
|
|
|
8
8
|
declare type WritableFileVersionedAPI = web3n.files.WritableFileVersionedAPI;
|
|
9
9
|
declare type File = web3n.files.File;
|
|
10
10
|
declare type Stats = web3n.files.Stats;
|
|
11
|
+
declare type SyncStatus = web3n.files.SyncStatus;
|
|
11
12
|
declare type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
12
13
|
declare type FileEvent = web3n.files.FileEvent;
|
|
14
|
+
declare type RemoteEvent = web3n.files.RemoteEvent;
|
|
15
|
+
declare type OptionsToAdopteRemote = web3n.files.OptionsToAdopteRemote;
|
|
16
|
+
declare type OptionsToUploadLocal = web3n.files.OptionsToUploadLocal;
|
|
13
17
|
export declare function makeFileCaller(caller: Caller, fileMsg: FileMsg): File;
|
|
14
18
|
export declare function exposeFileService(file: File, expServices: ExposedServices): FileMsg;
|
|
15
|
-
export declare const fileMsgType: ProtoType<FileMsg>;
|
|
16
|
-
export declare function packStats(s: Stats): Buffer;
|
|
17
|
-
export declare function unpackStats(buf: Buffer | void): Stats;
|
|
18
19
|
export interface FileMsg {
|
|
19
20
|
writable: boolean;
|
|
20
21
|
isVersioned: boolean;
|
|
22
|
+
isSynced: boolean;
|
|
21
23
|
name: string;
|
|
22
24
|
isNew: boolean;
|
|
23
25
|
impl: ObjectReference<'FileImpl'>;
|
|
24
26
|
}
|
|
27
|
+
export declare const fileMsgType: ProtoType<FileMsg>;
|
|
28
|
+
export declare function packStats(s: Stats): Buffer;
|
|
29
|
+
export declare function unpackStats(buf: Buffer | void): Stats;
|
|
30
|
+
export declare function packSyncStatus(s: SyncStatus): Buffer;
|
|
31
|
+
export declare function unpackSyncStatus(buf: Buffer | void): SyncStatus;
|
|
25
32
|
export declare function packXAttrValue(val: any): EnvelopeBody;
|
|
26
33
|
export declare function unpackXAttrValue(buf: EnvelopeBody): any;
|
|
27
34
|
export declare namespace readBytes {
|
|
@@ -32,8 +39,8 @@ export declare namespace readBytes {
|
|
|
32
39
|
}
|
|
33
40
|
export declare function packJSON(json: any): EnvelopeBody;
|
|
34
41
|
export declare function unpackJSON(buf: EnvelopeBody): any;
|
|
35
|
-
export declare function packFileEvent(e: FileEvent): Buffer;
|
|
36
|
-
export declare function unpackFileEvent(buf: EnvelopeBody): FileEvent;
|
|
42
|
+
export declare function packFileEvent(e: FileEvent | RemoteEvent): Buffer;
|
|
43
|
+
export declare function unpackFileEvent(buf: EnvelopeBody): FileEvent | RemoteEvent;
|
|
37
44
|
export declare namespace vGetXAttr {
|
|
38
45
|
interface Reply {
|
|
39
46
|
version: number;
|
|
@@ -97,16 +104,21 @@ export declare namespace vGetByteSource {
|
|
|
97
104
|
function wrapService(fn: ReadonlyFileVersionedAPI['getByteSource'], expServices: ExposedServices): ExposedFn;
|
|
98
105
|
function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileVersionedAPI['getByteSource'];
|
|
99
106
|
}
|
|
107
|
+
export interface XAttrMsg {
|
|
108
|
+
xaName: string;
|
|
109
|
+
str?: Value<string>;
|
|
110
|
+
json?: Value<string>;
|
|
111
|
+
bytes?: Value<Buffer>;
|
|
112
|
+
}
|
|
113
|
+
export declare function xattrToMsg(xaName: string, val: any): XAttrMsg;
|
|
114
|
+
export declare function xattrFromMsg(msg: XAttrMsg): {
|
|
115
|
+
name: string;
|
|
116
|
+
value: any;
|
|
117
|
+
};
|
|
100
118
|
export declare namespace updateXAttrs {
|
|
101
|
-
interface Attr {
|
|
102
|
-
xaName: string;
|
|
103
|
-
str?: Value<string>;
|
|
104
|
-
json?: Value<string>;
|
|
105
|
-
bytes?: Value<Buffer>;
|
|
106
|
-
}
|
|
107
119
|
interface Request {
|
|
108
120
|
changes: {
|
|
109
|
-
set:
|
|
121
|
+
set: XAttrMsg[];
|
|
110
122
|
remove: string[];
|
|
111
123
|
};
|
|
112
124
|
}
|
|
@@ -126,4 +138,28 @@ export declare namespace vGetByteSink {
|
|
|
126
138
|
function wrapService(fn: WritableFileVersionedAPI['getByteSink'], expServices: ExposedServices): ExposedFn;
|
|
127
139
|
function makeCaller(caller: Caller, objPath: string[]): WritableFileVersionedAPI['getByteSink'];
|
|
128
140
|
}
|
|
141
|
+
export interface OptionsToUploadLocalMsg {
|
|
142
|
+
localVersion?: Value<number>;
|
|
143
|
+
uploadVersion?: Value<number>;
|
|
144
|
+
}
|
|
145
|
+
export declare function optionsToUploadLocalToMsg(opts?: OptionsToUploadLocal): OptionsToUploadLocalMsg | undefined;
|
|
146
|
+
export declare function optionsToUploadLocalFromMsg(opts?: OptionsToUploadLocalMsg): OptionsToUploadLocal | undefined;
|
|
147
|
+
export interface OptionsToAdopteRemoteMsg {
|
|
148
|
+
dropLocalVer?: Value<boolean>;
|
|
149
|
+
remoteVersion?: Value<number>;
|
|
150
|
+
}
|
|
151
|
+
export declare function remoteAdoptionOptsToMsg(opts: OptionsToAdopteRemote | undefined): OptionsToAdopteRemoteMsg | undefined;
|
|
152
|
+
export declare function remoteAdoptionOptsFromMsg(msg: OptionsToAdopteRemoteMsg | undefined): OptionsToAdopteRemote | undefined;
|
|
153
|
+
export declare namespace vListVersions {
|
|
154
|
+
function packReply(v: {
|
|
155
|
+
current?: number;
|
|
156
|
+
archived?: number[];
|
|
157
|
+
}): Buffer;
|
|
158
|
+
function unpackReply(b: Buffer): {
|
|
159
|
+
current?: number;
|
|
160
|
+
archived?: number[];
|
|
161
|
+
};
|
|
162
|
+
function wrapService(fn: ReadonlyFileVersionedAPI['listVersions']): ExposedFn;
|
|
163
|
+
function makeCaller(caller: Caller, objPath: string[]): ReadonlyFileVersionedAPI['listVersions'];
|
|
164
|
+
}
|
|
129
165
|
export {};
|