core-3nweb-client-lib 0.22.1 → 0.24.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/core/index.d.ts +1 -1
- package/build/core/index.js +1 -1
- package/build/ipc-via-protobuf/asmail-cap.js +17 -18
- package/build/ipc-via-protobuf/bytes.d.ts +4 -4
- package/build/ipc-via-protobuf/bytes.js +10 -11
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +2 -2
- package/build/ipc-via-protobuf/connector-services-side.d.ts +3 -3
- package/build/ipc-via-protobuf/connector-services-side.js +0 -1
- package/build/ipc-via-protobuf/connector.d.ts +8 -8
- package/build/ipc-via-protobuf/connector.js +5 -18
- package/build/ipc-via-protobuf/file.d.ts +4 -4
- package/build/ipc-via-protobuf/file.js +30 -31
- package/build/ipc-via-protobuf/fs.d.ts +3 -3
- package/build/ipc-via-protobuf/fs.js +37 -38
- package/build/ipc-via-protobuf/log-cap.js +4 -5
- package/build/ipc-via-protobuf/mailerid.js +5 -7
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +4 -6
- package/build/ipc-via-protobuf/protobuf-msg.js +9 -24
- package/build/ipc-via-protobuf/startup-cap.js +10 -11
- package/build/ipc-via-protobuf/storage-cap.js +7 -8
- package/build/lib-client/cryptor/cryptor-in-worker.js +7 -20
- package/build/lib-client/cryptor/in-proc-wasm.js +7 -20
- package/build/lib-client/{protobuf-loader.d.ts → protobuf-type.d.ts} +2 -4
- package/build/lib-client/{protobuf-loader.js → protobuf-type.js} +3 -43
- package/build/lib-index.d.ts +0 -1
- package/build/protos/asmail.proto.js +22296 -0
- package/build/protos/bytes.proto.js +3614 -0
- package/build/protos/common.proto.js +1863 -0
- package/build/protos/cryptor.proto.js +1667 -0
- package/build/protos/file.proto.js +7264 -0
- package/build/protos/fs.proto.js +17142 -0
- package/build/protos/ipc.proto.js +2349 -0
- package/build/protos/logger.proto.js +2112 -0
- package/build/protos/mailerid.proto.js +2249 -0
- package/build/protos/startup.proto.js +3291 -0
- package/build/protos/storage.proto.js +2689 -0
- package/package.json +2 -2
- package/{build/ipc-via-protobuf/protos → protos}/asmail.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/bytes.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/common.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/file.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/fs.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/ipc.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/logger.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/mailerid.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/startup.proto +0 -0
- package/{build/ipc-via-protobuf/protos → protos}/storage.proto +0 -0
- package/build/api-defs/asmail.d.ts +0 -292
- package/build/api-defs/common-caps.d.ts +0 -84
- package/build/api-defs/files.d.ts +0 -1037
- package/build/api-defs/mailerid.d.ts +0 -29
- package/build/api-defs/startup.d.ts +0 -121
- package/build/api-defs/storage.d.ts +0 -69
- package/build/api-defs/web3n.d.ts +0 -50
- package/build/ipc-via-protobuf/proto-defs.js +0 -1092
- package/build/lib-client/cryptor/proto-defs.js +0 -50
- package/build/lib-client/cryptor/protos/cryptor.proto +0 -45
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2021 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2021 - 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
|
|
@@ -20,7 +20,8 @@ exports.makeInProcessWasmCryptor = void 0;
|
|
|
20
20
|
const wasm_mp1_modules_1 = require("./wasm-mp1-modules");
|
|
21
21
|
const fs_1 = require("fs");
|
|
22
22
|
const path_1 = require("path");
|
|
23
|
-
const
|
|
23
|
+
const protobuf_type_1 = require("../protobuf-type");
|
|
24
|
+
const cryptor_proto_1 = require("../../protos/cryptor.proto");
|
|
24
25
|
const processes_1 = require("../../lib-common/processes");
|
|
25
26
|
const assert_1 = require("../../lib-common/assert");
|
|
26
27
|
const error_1 = require("../../lib-common/exceptions/error");
|
|
@@ -45,20 +46,6 @@ function wasmBytes() {
|
|
|
45
46
|
return Buffer.from(str, 'base64');
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
function makeProtobufType(type) {
|
|
49
|
-
const protoFile = 'cryptor.proto';
|
|
50
|
-
const typeName = `cryptor.${type}`;
|
|
51
|
-
try {
|
|
52
|
-
// make sure to copy protos with compile step (use npm script)
|
|
53
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
// we won't get here if referenced module exists, but metro packager
|
|
57
|
-
// in LiqudCore needs static path require
|
|
58
|
-
const fallback = require('./proto-defs');
|
|
59
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName, fallback);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
49
|
function toArgs(...args) {
|
|
63
50
|
return args.map(val => ({ val }));
|
|
64
51
|
}
|
|
@@ -73,10 +60,10 @@ function toLocalErr(replyErr) {
|
|
|
73
60
|
return new Error(`WASM cryptor ${replyErr.condition}: ${replyErr.message}`);
|
|
74
61
|
}
|
|
75
62
|
}
|
|
76
|
-
const reqType =
|
|
77
|
-
const replyType =
|
|
78
|
-
const boolValType =
|
|
79
|
-
const kpairType =
|
|
63
|
+
const reqType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Request);
|
|
64
|
+
const replyType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Reply);
|
|
65
|
+
const boolValType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.BoolVal);
|
|
66
|
+
const kpairType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Keypair);
|
|
80
67
|
function makeInProcessWasmCryptor() {
|
|
81
68
|
const wasmInstance = wasm_mp1_modules_1.startWasmFrom(wasmBytes());
|
|
82
69
|
let deferred = undefined;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
export declare class ProtoType<T extends object> {
|
|
3
|
-
private type;
|
|
3
|
+
private readonly type;
|
|
4
4
|
private constructor();
|
|
5
|
-
static
|
|
6
|
-
protos: object;
|
|
7
|
-
}): ProtoType<T>;
|
|
5
|
+
static for<T extends object>(type: any): ProtoType<T>;
|
|
8
6
|
pack(msg: T): Buffer;
|
|
9
7
|
unpack(bytes: Buffer | void): T;
|
|
10
8
|
packToBase64(msg: T): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 -
|
|
3
|
+
Copyright (C) 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
|
|
@@ -17,17 +17,13 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.ProtoType = void 0;
|
|
20
|
-
const protobuf = require("protobufjs");
|
|
21
|
-
const path_1 = require("path");
|
|
22
|
-
const fs = require("fs");
|
|
23
20
|
class ProtoType {
|
|
24
21
|
constructor(type) {
|
|
22
|
+
this.type = type;
|
|
25
23
|
this.type = type;
|
|
26
24
|
Object.freeze(this);
|
|
27
25
|
}
|
|
28
|
-
static
|
|
29
|
-
const root = loadRoot(searchDir, protoFile, fallbackMod);
|
|
30
|
-
const type = root.lookupType(typeName);
|
|
26
|
+
static for(type) {
|
|
31
27
|
return new ProtoType(type);
|
|
32
28
|
}
|
|
33
29
|
pack(msg) {
|
|
@@ -57,40 +53,4 @@ class ProtoType {
|
|
|
57
53
|
exports.ProtoType = ProtoType;
|
|
58
54
|
Object.freeze(ProtoType.prototype);
|
|
59
55
|
Object.freeze(ProtoType);
|
|
60
|
-
const roots = new Map();
|
|
61
|
-
function loadRoot(searchDir, fileName, fallbackMod) {
|
|
62
|
-
const filePath = path_1.resolve(searchDir, 'protos', fileName);
|
|
63
|
-
let root = roots.get(filePath);
|
|
64
|
-
if (!root) {
|
|
65
|
-
// if proto files file, we try to get definitions from the module
|
|
66
|
-
try {
|
|
67
|
-
root = protobuf.loadSync(filePath);
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
if (!fallbackMod) {
|
|
71
|
-
throw err;
|
|
72
|
-
}
|
|
73
|
-
const protos = fallbackMod.protos;
|
|
74
|
-
if (!protos || (typeof protos !== 'object')) {
|
|
75
|
-
throw new Error(`proto-defs doesn't have expected object`);
|
|
76
|
-
}
|
|
77
|
-
const initFunc = fs.readFileSync;
|
|
78
|
-
try {
|
|
79
|
-
fs.readFileSync = (fName) => {
|
|
80
|
-
const protoDefsStr = protos[fName];
|
|
81
|
-
if (!protoDefsStr) {
|
|
82
|
-
throw new Error(`Don't have in module proto definition for ${fName}`);
|
|
83
|
-
}
|
|
84
|
-
return Buffer.from(protoDefsStr, 'utf8');
|
|
85
|
-
};
|
|
86
|
-
root = protobuf.loadSync(fileName);
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
fs.readFileSync = initFunc;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
roots.set(filePath, root);
|
|
93
|
-
}
|
|
94
|
-
return root;
|
|
95
|
-
}
|
|
96
56
|
Object.freeze(exports);
|
package/build/lib-index.d.ts
CHANGED