core-3nweb-client-lib 0.20.1 → 0.20.5
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/core-ipc/common-caps.d.ts +4 -9
- package/build/core-ipc/common-caps.js +18 -48
- package/build/core-ipc/generic.d.ts +10 -0
- package/build/core-ipc/generic.js +63 -0
- package/build/core-ipc/startup-caps.d.ts +3 -2
- package/build/core-ipc/startup-caps.js +16 -18
- package/build/ipc-via-protobuf/connector-services-side.js +1 -1
- package/build/ipc-via-protobuf/protobuf-msg.js +2 -2
- package/build/lib-client/cryptor/cryptor-in-worker.js +3 -3
- 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 +12 -15
- package/build/lib-client/protobuf-loader.d.ts +3 -1
- package/build/lib-client/protobuf-loader.js +7 -6
- package/package.json +1 -1
|
Binary file
|
|
@@ -24,16 +24,6 @@ const protobuf_loader_1 = require("../protobuf-loader");
|
|
|
24
24
|
const processes_1 = require("../../lib-common/processes");
|
|
25
25
|
const assert_1 = require("../../lib-common/assert");
|
|
26
26
|
const error_1 = require("../../lib-common/exceptions/error");
|
|
27
|
-
function inNextTick(f) {
|
|
28
|
-
return new Promise((resolve, reject) => process.nextTick(() => {
|
|
29
|
-
try {
|
|
30
|
-
resolve(f());
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
reject(err);
|
|
34
|
-
}
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
27
|
function wasmBytes() {
|
|
38
28
|
// There is a bug with electrons 12, 13, that doesn't let
|
|
39
29
|
// worker_thread read this file from asar pack, even though main thread
|
|
@@ -65,8 +55,8 @@ function makeProtobufType(type) {
|
|
|
65
55
|
catch (err) {
|
|
66
56
|
// we won't get here if referenced module exists, but metro packager
|
|
67
57
|
// in LiqudCore needs static path require
|
|
68
|
-
require('./proto-defs');
|
|
69
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName);
|
|
58
|
+
const fallback = require('./proto-defs');
|
|
59
|
+
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName, fallback);
|
|
70
60
|
}
|
|
71
61
|
}
|
|
72
62
|
function toArgs(...args) {
|
|
@@ -91,9 +81,16 @@ function makeInProcessWasmCryptor() {
|
|
|
91
81
|
const wasmInstance = wasm_mp1_modules_1.startWasmFrom(wasmBytes());
|
|
92
82
|
let deferred = undefined;
|
|
93
83
|
let interimSink = undefined;
|
|
94
|
-
function call(req, interim) {
|
|
84
|
+
async function call(req, interim) {
|
|
85
|
+
// In LiquidCore on iOS call was able to get before completion of
|
|
86
|
+
// previous call, therefore, the following await loop is needed.
|
|
87
|
+
while (!!deferred) {
|
|
88
|
+
try {
|
|
89
|
+
await deferred.promise;
|
|
90
|
+
}
|
|
91
|
+
catch (err) { }
|
|
92
|
+
}
|
|
95
93
|
deferred = processes_1.defer();
|
|
96
|
-
const promise = deferred.promise;
|
|
97
94
|
if (interim) {
|
|
98
95
|
interimSink = interim;
|
|
99
96
|
}
|
|
@@ -105,7 +102,7 @@ function makeInProcessWasmCryptor() {
|
|
|
105
102
|
deferred === null || deferred === void 0 ? void 0 : deferred.reject(err);
|
|
106
103
|
}
|
|
107
104
|
});
|
|
108
|
-
return promise;
|
|
105
|
+
return deferred.promise;
|
|
109
106
|
}
|
|
110
107
|
wasmInstance.setMsgListener(msg => {
|
|
111
108
|
assert_1.assert(!!deferred, `Deferred is expected to be available for this output from wasm`);
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export declare class ProtoType<T extends object> {
|
|
3
3
|
private type;
|
|
4
4
|
private constructor();
|
|
5
|
-
static makeFrom<T extends object>(searchDir: string, protoFile: string, typeName: string
|
|
5
|
+
static makeFrom<T extends object>(searchDir: string, protoFile: string, typeName: string, fallbackMod?: {
|
|
6
|
+
protos: object;
|
|
7
|
+
}): ProtoType<T>;
|
|
6
8
|
pack(msg: T): Buffer;
|
|
7
9
|
unpack(bytes: Buffer | void): T;
|
|
8
10
|
packToBase64(msg: T): string;
|
|
@@ -25,8 +25,8 @@ class ProtoType {
|
|
|
25
25
|
this.type = type;
|
|
26
26
|
Object.freeze(this);
|
|
27
27
|
}
|
|
28
|
-
static makeFrom(searchDir, protoFile, typeName) {
|
|
29
|
-
const root = loadRoot(searchDir, protoFile);
|
|
28
|
+
static makeFrom(searchDir, protoFile, typeName, fallbackMod) {
|
|
29
|
+
const root = loadRoot(searchDir, protoFile, fallbackMod);
|
|
30
30
|
const type = root.lookupType(typeName);
|
|
31
31
|
return new ProtoType(type);
|
|
32
32
|
}
|
|
@@ -58,7 +58,7 @@ exports.ProtoType = ProtoType;
|
|
|
58
58
|
Object.freeze(ProtoType.prototype);
|
|
59
59
|
Object.freeze(ProtoType);
|
|
60
60
|
const roots = new Map();
|
|
61
|
-
function loadRoot(searchDir, fileName) {
|
|
61
|
+
function loadRoot(searchDir, fileName, fallbackMod) {
|
|
62
62
|
const filePath = path_1.resolve(searchDir, 'protos', fileName);
|
|
63
63
|
let root = roots.get(filePath);
|
|
64
64
|
if (!root) {
|
|
@@ -67,9 +67,10 @@ function loadRoot(searchDir, fileName) {
|
|
|
67
67
|
root = protobuf.loadSync(filePath);
|
|
68
68
|
}
|
|
69
69
|
catch (err) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if (!fallbackMod) {
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
const protos = fallbackMod.protos;
|
|
73
74
|
if (!protos || (typeof protos !== 'object')) {
|
|
74
75
|
throw new Error(`proto-defs doesn't have expected object`);
|
|
75
76
|
}
|