core-3nweb-client-lib 0.24.0 → 0.24.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/web3n.d.ts +6 -6
- package/build/ipc-via-protobuf/asmail-cap.js +17 -18
- package/build/ipc-via-protobuf/bytes.js +10 -11
- package/build/ipc-via-protobuf/connector.d.ts +2 -1
- package/build/ipc-via-protobuf/connector.js +4 -2
- package/build/ipc-via-protobuf/file.d.ts +1 -1
- package/build/ipc-via-protobuf/file.js +30 -31
- package/build/ipc-via-protobuf/fs.d.ts +1 -1
- 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 +1 -2
- 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/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- 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/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/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) 2020 3NSoft Inc.
|
|
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
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.fsItem = exports.fsMsgType = exports.exposeFSService = exports.makeFSCaller = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const fs_proto_1 = require("../protos/fs.proto");
|
|
21
23
|
const connector_1 = require("./connector");
|
|
22
24
|
const file_1 = require("./file");
|
|
23
25
|
const file = require("./file");
|
|
@@ -165,13 +167,10 @@ function exposeFSService(fs, expServices) {
|
|
|
165
167
|
return fsMsg;
|
|
166
168
|
}
|
|
167
169
|
exports.exposeFSService = exposeFSService;
|
|
168
|
-
|
|
169
|
-
return protobuf_msg_1.makeProtobufTypeFrom('fs.proto', `fs.${type}`);
|
|
170
|
-
}
|
|
171
|
-
exports.fsMsgType = makeFSType('FS');
|
|
170
|
+
exports.fsMsgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FS);
|
|
172
171
|
var checkPresence;
|
|
173
172
|
(function (checkPresence) {
|
|
174
|
-
const requestType =
|
|
173
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.CheckPresenceRequestBody);
|
|
175
174
|
function wrapService(fn) {
|
|
176
175
|
return buf => {
|
|
177
176
|
const { path, throwIfMissing } = requestType.unpack(buf);
|
|
@@ -202,7 +201,7 @@ var checkPresence;
|
|
|
202
201
|
checkPresence.makeLinkCaller = makeLinkCaller;
|
|
203
202
|
})(checkPresence || (checkPresence = {}));
|
|
204
203
|
Object.freeze(checkPresence);
|
|
205
|
-
const reqWithPathType =
|
|
204
|
+
const reqWithPathType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.PathOnlyRequestBody);
|
|
206
205
|
var stat;
|
|
207
206
|
(function (stat) {
|
|
208
207
|
function wrapService(fn) {
|
|
@@ -225,7 +224,7 @@ var stat;
|
|
|
225
224
|
Object.freeze(stat);
|
|
226
225
|
var getXAttr;
|
|
227
226
|
(function (getXAttr) {
|
|
228
|
-
getXAttr.requestType =
|
|
227
|
+
getXAttr.requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.GetXAttrRequestBody);
|
|
229
228
|
function wrapService(fn) {
|
|
230
229
|
return buf => {
|
|
231
230
|
const { path, xaName } = getXAttr.requestType.unpack(buf);
|
|
@@ -264,8 +263,8 @@ var listXAttrs;
|
|
|
264
263
|
listXAttrs.makeCaller = makeCaller;
|
|
265
264
|
})(listXAttrs || (listXAttrs = {}));
|
|
266
265
|
Object.freeze(listXAttrs);
|
|
267
|
-
const symLinkMsgType =
|
|
268
|
-
const symLinkTargetType =
|
|
266
|
+
const symLinkMsgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.SymLink);
|
|
267
|
+
const symLinkTargetType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.SymLinkTargetReplyBody);
|
|
269
268
|
function exposeSymLink(link, expServices) {
|
|
270
269
|
const exp = () => {
|
|
271
270
|
if (link.isFile) {
|
|
@@ -346,7 +345,7 @@ var readLink;
|
|
|
346
345
|
readLink.makeCaller = makeCaller;
|
|
347
346
|
})(readLink || (readLink = {}));
|
|
348
347
|
Object.freeze(readLink);
|
|
349
|
-
const fsEventMsgType =
|
|
348
|
+
const fsEventMsgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSEventMsg);
|
|
350
349
|
function packFSEvent(e) {
|
|
351
350
|
const m = {
|
|
352
351
|
type: e.type,
|
|
@@ -487,7 +486,7 @@ var readonlySubRoot;
|
|
|
487
486
|
Object.freeze(readonlySubRoot);
|
|
488
487
|
var listFolder;
|
|
489
488
|
(function (listFolder) {
|
|
490
|
-
const requestType =
|
|
489
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.ListFolderReplyBody);
|
|
491
490
|
function wrapService(fn) {
|
|
492
491
|
return buf => {
|
|
493
492
|
const { path } = reqWithPathType.unpack(buf);
|
|
@@ -548,7 +547,7 @@ var readTxtFile;
|
|
|
548
547
|
Object.freeze(readTxtFile);
|
|
549
548
|
var readBytes;
|
|
550
549
|
(function (readBytes) {
|
|
551
|
-
readBytes.requestType =
|
|
550
|
+
readBytes.requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.ReadBytesRequestBody);
|
|
552
551
|
function wrapService(fn) {
|
|
553
552
|
return buf => {
|
|
554
553
|
const { path, start, end } = readBytes.requestType.unpack(buf);
|
|
@@ -623,7 +622,7 @@ var readonlyFile;
|
|
|
623
622
|
Object.freeze(readonlyFile);
|
|
624
623
|
var select;
|
|
625
624
|
(function (select) {
|
|
626
|
-
const requestType =
|
|
625
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.SelectRequestBody);
|
|
627
626
|
function criteriaToMsg(sc) {
|
|
628
627
|
const c = {
|
|
629
628
|
action: sc.action,
|
|
@@ -751,8 +750,8 @@ var fsCollection;
|
|
|
751
750
|
fsCollection.makeCollectionCaller = makeCollectionCaller;
|
|
752
751
|
let get;
|
|
753
752
|
(function (get) {
|
|
754
|
-
const requestType =
|
|
755
|
-
const replyType =
|
|
753
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSCGetRequestBody);
|
|
754
|
+
const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSCGetReplyBody);
|
|
756
755
|
function wrapService(fn, expServices) {
|
|
757
756
|
return buf => {
|
|
758
757
|
const { name } = requestType.unpack(buf);
|
|
@@ -780,7 +779,7 @@ var fsCollection;
|
|
|
780
779
|
Object.freeze(get);
|
|
781
780
|
let getAll;
|
|
782
781
|
(function (getAll) {
|
|
783
|
-
const replyType =
|
|
782
|
+
const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSCGetAllReplyBody);
|
|
784
783
|
function wrapService(fn, expServices) {
|
|
785
784
|
return buf => {
|
|
786
785
|
const promise = fn()
|
|
@@ -831,7 +830,7 @@ var fsCollection;
|
|
|
831
830
|
caller.registerClientDrop(iter, ref);
|
|
832
831
|
return iter;
|
|
833
832
|
}
|
|
834
|
-
const iterResMsgType =
|
|
833
|
+
const iterResMsgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.IterResMsg);
|
|
835
834
|
function packIterRes(res, expServices) {
|
|
836
835
|
let msg;
|
|
837
836
|
if (res.done) {
|
|
@@ -892,7 +891,7 @@ var fsCollection;
|
|
|
892
891
|
Object.freeze(entries);
|
|
893
892
|
let watch;
|
|
894
893
|
(function (watch) {
|
|
895
|
-
const eventType =
|
|
894
|
+
const eventType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.CollectionEvent);
|
|
896
895
|
function wrapService(fn, expServices) {
|
|
897
896
|
return () => {
|
|
898
897
|
const s = new rxjs_1.Subject();
|
|
@@ -947,7 +946,7 @@ var fsCollection;
|
|
|
947
946
|
Object.freeze(fsCollection);
|
|
948
947
|
var fsItem;
|
|
949
948
|
(function (fsItem) {
|
|
950
|
-
fsItem.msgType =
|
|
949
|
+
fsItem.msgType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.FSItem);
|
|
951
950
|
function exposeFSItem(expServices, item) {
|
|
952
951
|
const msg = {
|
|
953
952
|
isLink: protobuf_msg_1.toOptVal(item.isLink)
|
|
@@ -1073,7 +1072,7 @@ var vListXAttrs;
|
|
|
1073
1072
|
Object.freeze(vListXAttrs);
|
|
1074
1073
|
var vListFolder;
|
|
1075
1074
|
(function (vListFolder) {
|
|
1076
|
-
const replyType =
|
|
1075
|
+
const replyType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.VersionedListFolderReplyBody);
|
|
1077
1076
|
function wrapService(fn) {
|
|
1078
1077
|
return buf => {
|
|
1079
1078
|
const { path } = reqWithPathType.unpack(buf);
|
|
@@ -1199,7 +1198,7 @@ var vGetByteSource;
|
|
|
1199
1198
|
Object.freeze(vGetByteSource);
|
|
1200
1199
|
var updateXAttrs;
|
|
1201
1200
|
(function (updateXAttrs) {
|
|
1202
|
-
const requestType =
|
|
1201
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.UpdateXAttrsRequestBody);
|
|
1203
1202
|
function unpackRequest(buf) {
|
|
1204
1203
|
const { changes, path } = requestType.unpack(buf);
|
|
1205
1204
|
return { path, changes: file.updateXAttrs.fromReqChanges(changes) };
|
|
@@ -1227,7 +1226,7 @@ var updateXAttrs;
|
|
|
1227
1226
|
Object.freeze(updateXAttrs);
|
|
1228
1227
|
var makeFolder;
|
|
1229
1228
|
(function (makeFolder) {
|
|
1230
|
-
const requestType =
|
|
1229
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.MakeFolderRequestBody);
|
|
1231
1230
|
function wrapService(fn) {
|
|
1232
1231
|
return buf => {
|
|
1233
1232
|
const { path, exclusive } = requestType.unpack(buf);
|
|
@@ -1248,7 +1247,7 @@ var makeFolder;
|
|
|
1248
1247
|
Object.freeze(makeFolder);
|
|
1249
1248
|
var deleteFolder;
|
|
1250
1249
|
(function (deleteFolder) {
|
|
1251
|
-
const requestType =
|
|
1250
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.DeleteFolderRequestBody);
|
|
1252
1251
|
function wrapService(fn) {
|
|
1253
1252
|
return buf => {
|
|
1254
1253
|
const { path, removeContent } = requestType.unpack(buf);
|
|
@@ -1305,7 +1304,7 @@ var deleteLink;
|
|
|
1305
1304
|
Object.freeze(deleteLink);
|
|
1306
1305
|
var move;
|
|
1307
1306
|
(function (move) {
|
|
1308
|
-
const requestType =
|
|
1307
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.MoveRequestBody);
|
|
1309
1308
|
function wrapService(fn) {
|
|
1310
1309
|
return buf => {
|
|
1311
1310
|
const { src, dst } = requestType.unpack(buf);
|
|
@@ -1324,7 +1323,7 @@ var move;
|
|
|
1324
1323
|
Object.freeze(move);
|
|
1325
1324
|
var copyFile;
|
|
1326
1325
|
(function (copyFile) {
|
|
1327
|
-
const requestType =
|
|
1326
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.CopyFileRequestBody);
|
|
1328
1327
|
function wrapService(fn) {
|
|
1329
1328
|
return buf => {
|
|
1330
1329
|
const { src, dst, overwrite } = requestType.unpack(buf);
|
|
@@ -1345,7 +1344,7 @@ var copyFile;
|
|
|
1345
1344
|
Object.freeze(copyFile);
|
|
1346
1345
|
var copyFolder;
|
|
1347
1346
|
(function (copyFolder) {
|
|
1348
|
-
const requestType =
|
|
1347
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.CopyFolderRequestBody);
|
|
1349
1348
|
function wrapService(fn) {
|
|
1350
1349
|
return buf => {
|
|
1351
1350
|
const { src, dst, mergeAndOverwrite } = requestType.unpack(buf);
|
|
@@ -1366,7 +1365,7 @@ var copyFolder;
|
|
|
1366
1365
|
Object.freeze(copyFolder);
|
|
1367
1366
|
var saveFile;
|
|
1368
1367
|
(function (saveFile) {
|
|
1369
|
-
const requestType =
|
|
1368
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.SaveFileRequestBody);
|
|
1370
1369
|
function wrapService(fn, expServices) {
|
|
1371
1370
|
return buf => {
|
|
1372
1371
|
const { dst, file, overwrite } = requestType.unpack(buf);
|
|
@@ -1388,7 +1387,7 @@ var saveFile;
|
|
|
1388
1387
|
Object.freeze(saveFile);
|
|
1389
1388
|
var saveFolder;
|
|
1390
1389
|
(function (saveFolder) {
|
|
1391
|
-
const requestType =
|
|
1390
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.SaveFolderRequestBody);
|
|
1392
1391
|
function wrapService(fn, expServices) {
|
|
1393
1392
|
return buf => {
|
|
1394
1393
|
const { dst, folder: file, overwrite } = requestType.unpack(buf);
|
|
@@ -1410,7 +1409,7 @@ var saveFolder;
|
|
|
1410
1409
|
Object.freeze(saveFolder);
|
|
1411
1410
|
var link;
|
|
1412
1411
|
(function (link) {
|
|
1413
|
-
const requestType =
|
|
1412
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.LinkRequestBody);
|
|
1414
1413
|
function wrapService(fn, expServices) {
|
|
1415
1414
|
return buf => {
|
|
1416
1415
|
const { path, target } = requestType.unpack(buf);
|
|
@@ -1428,7 +1427,7 @@ var link;
|
|
|
1428
1427
|
link.makeCaller = makeCaller;
|
|
1429
1428
|
})(link || (link = {}));
|
|
1430
1429
|
Object.freeze(link);
|
|
1431
|
-
const pathAndFileOptsType =
|
|
1430
|
+
const pathAndFileOptsType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.PathAndOptFileFlags);
|
|
1432
1431
|
function packPathAndFlags(path, flags) {
|
|
1433
1432
|
return pathAndFileOptsType.pack({ path, flags: optFlagsToMsg(flags) });
|
|
1434
1433
|
}
|
|
@@ -1504,7 +1503,7 @@ var writableFile;
|
|
|
1504
1503
|
Object.freeze(writableFile);
|
|
1505
1504
|
var writeJSONFile;
|
|
1506
1505
|
(function (writeJSONFile) {
|
|
1507
|
-
const requestType =
|
|
1506
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.WriteJsonFileRequestBody);
|
|
1508
1507
|
function wrapService(fn) {
|
|
1509
1508
|
return buf => {
|
|
1510
1509
|
const { path, json, flags } = requestType.unpack(buf);
|
|
@@ -1525,7 +1524,7 @@ var writeJSONFile;
|
|
|
1525
1524
|
Object.freeze(writeJSONFile);
|
|
1526
1525
|
var writeTxtFile;
|
|
1527
1526
|
(function (writeTxtFile) {
|
|
1528
|
-
const requestType =
|
|
1527
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.WriteTxtFileRequestBody);
|
|
1529
1528
|
function wrapService(fn) {
|
|
1530
1529
|
return buf => {
|
|
1531
1530
|
const { path, txt, flags } = requestType.unpack(buf);
|
|
@@ -1546,7 +1545,7 @@ var writeTxtFile;
|
|
|
1546
1545
|
Object.freeze(writeTxtFile);
|
|
1547
1546
|
var writeBytes;
|
|
1548
1547
|
(function (writeBytes) {
|
|
1549
|
-
const requestType =
|
|
1548
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.WriteBytesRequestBody);
|
|
1550
1549
|
function wrapService(fn) {
|
|
1551
1550
|
return buf => {
|
|
1552
1551
|
const { path, bytes, flags } = requestType.unpack(buf);
|
|
@@ -1631,7 +1630,7 @@ function optVerFlagsFromMsg(m) {
|
|
|
1631
1630
|
}
|
|
1632
1631
|
var vWriteJSONFile;
|
|
1633
1632
|
(function (vWriteJSONFile) {
|
|
1634
|
-
const requestType =
|
|
1633
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.VersionedWriteJsonFileRequestBody);
|
|
1635
1634
|
function wrapService(fn) {
|
|
1636
1635
|
return buf => {
|
|
1637
1636
|
const { path, json, flags } = requestType.unpack(buf);
|
|
@@ -1654,7 +1653,7 @@ var vWriteJSONFile;
|
|
|
1654
1653
|
Object.freeze(vWriteJSONFile);
|
|
1655
1654
|
var vWriteTxtFile;
|
|
1656
1655
|
(function (vWriteTxtFile) {
|
|
1657
|
-
const requestType =
|
|
1656
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.VersionedWriteTxtFileRequestBody);
|
|
1658
1657
|
function wrapService(fn) {
|
|
1659
1658
|
return buf => {
|
|
1660
1659
|
const { path, txt, flags } = requestType.unpack(buf);
|
|
@@ -1677,7 +1676,7 @@ var vWriteTxtFile;
|
|
|
1677
1676
|
Object.freeze(vWriteTxtFile);
|
|
1678
1677
|
var vWriteBytes;
|
|
1679
1678
|
(function (vWriteBytes) {
|
|
1680
|
-
const requestType =
|
|
1679
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.VersionedWriteBytesRequestBody);
|
|
1681
1680
|
function wrapService(fn) {
|
|
1682
1681
|
return buf => {
|
|
1683
1682
|
const { path, bytes, flags } = requestType.unpack(buf);
|
|
@@ -1702,7 +1701,7 @@ var vWriteBytes;
|
|
|
1702
1701
|
Object.freeze(vWriteBytes);
|
|
1703
1702
|
var vGetByteSink;
|
|
1704
1703
|
(function (vGetByteSink) {
|
|
1705
|
-
const requestType =
|
|
1704
|
+
const requestType = protobuf_type_1.ProtoType.for(fs_proto_1.fs.VersionedGetByteSinkRequestBody);
|
|
1706
1705
|
function wrapService(fn, expServices) {
|
|
1707
1706
|
return buf => {
|
|
1708
1707
|
const { path, flags } = requestType.unpack(buf);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 3NSoft Inc.
|
|
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
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.makeLogCaller = exports.exposeLogger = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const logReqType = loggerType('LogRequestBody');
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const logger_proto_1 = require("../protos/logger.proto");
|
|
23
|
+
const logReqType = protobuf_type_1.ProtoType.for(logger_proto_1.logger.LogRequestBody);
|
|
25
24
|
function exposeLogger(fn) {
|
|
26
25
|
return buf => {
|
|
27
26
|
const { logType, msg, err } = logReqType.unpack(buf);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 3NSoft Inc.
|
|
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
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.makeMailerIdCaller = exports.exposeMailerIdCAP = void 0;
|
|
20
20
|
const connector_1 = require("./connector");
|
|
21
|
-
const
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const mailerid_proto_1 = require("../protos/mailerid.proto");
|
|
22
23
|
function exposeMailerIdCAP(cap) {
|
|
23
24
|
return {
|
|
24
25
|
getUserId: getUserId.wrapService(cap.getUserId),
|
|
@@ -33,9 +34,6 @@ function makeMailerIdCaller(caller, objPath) {
|
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
exports.makeMailerIdCaller = makeMailerIdCaller;
|
|
36
|
-
function maileridType(type) {
|
|
37
|
-
return protobuf_msg_1.makeProtobufTypeFrom('mailerid.proto', `mailerid.${type}`);
|
|
38
|
-
}
|
|
39
37
|
var getUserId;
|
|
40
38
|
(function (getUserId) {
|
|
41
39
|
function wrapService(fn) {
|
|
@@ -61,8 +59,8 @@ var getUserId;
|
|
|
61
59
|
Object.freeze(getUserId);
|
|
62
60
|
var login;
|
|
63
61
|
(function (login) {
|
|
64
|
-
const requestType =
|
|
65
|
-
const replyType =
|
|
62
|
+
const requestType = protobuf_type_1.ProtoType.for(mailerid_proto_1.mailerid.LoginRequestBody);
|
|
63
|
+
const replyType = protobuf_type_1.ProtoType.for(mailerid_proto_1.mailerid.LoginReplyBody);
|
|
66
64
|
function wrapService(fn) {
|
|
67
65
|
return bytes => {
|
|
68
66
|
const { serviceUrl } = requestType.unpack(bytes);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EnvelopeBody } from './connector';
|
|
3
|
-
import { ProtoType } from '../lib-client/protobuf-
|
|
3
|
+
import { ProtoType } from '../lib-client/protobuf-type';
|
|
4
4
|
declare type RuntimeException = web3n.RuntimeException;
|
|
5
|
-
export declare function makeProtobufTypeFrom<T extends object>(protoFile: string, typeName: string): ProtoType<T>;
|
|
6
5
|
export interface ObjectReference<T> {
|
|
7
6
|
objType: T;
|
|
8
7
|
path: 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
|
|
@@ -16,30 +16,15 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
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 =
|
|
19
|
+
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;
|
|
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");
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
// we won't get here if referenced module exists, but metro packager
|
|
31
|
-
// in LiqudCore needs static path require
|
|
32
|
-
const fallback = require('./proto-defs');
|
|
33
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName, fallback);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.makeProtobufTypeFrom = makeProtobufTypeFrom;
|
|
37
|
-
function commonType(type) {
|
|
38
|
-
return makeProtobufTypeFrom('common.proto', `common.${type}`);
|
|
39
|
-
}
|
|
40
|
-
exports.objRefType = commonType('ObjectReference');
|
|
41
|
-
exports.boolValType = commonType('BooleanValue');
|
|
42
|
-
exports.strArrValType = commonType('StringArrayValue');
|
|
23
|
+
const common_proto_1 = require("../protos/common.proto");
|
|
24
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
25
|
+
exports.objRefType = protobuf_type_1.ProtoType.for(common_proto_1.common.ObjectReference);
|
|
26
|
+
exports.boolValType = protobuf_type_1.ProtoType.for(common_proto_1.common.BooleanValue);
|
|
27
|
+
exports.strArrValType = protobuf_type_1.ProtoType.for(common_proto_1.common.StringArrayValue);
|
|
43
28
|
function fixArray(arr) {
|
|
44
29
|
return (arr ? arr : []);
|
|
45
30
|
}
|
|
@@ -80,7 +65,7 @@ function valOfOptInt(uint64) {
|
|
|
80
65
|
return fixInt(valOf(uint64));
|
|
81
66
|
}
|
|
82
67
|
exports.valOfOptInt = valOfOptInt;
|
|
83
|
-
const numValType =
|
|
68
|
+
const numValType = protobuf_type_1.ProtoType.for(common_proto_1.common.UInt64Value);
|
|
84
69
|
function packInt(uint64) {
|
|
85
70
|
return numValType.pack({ value: uint64 });
|
|
86
71
|
}
|
|
@@ -89,7 +74,7 @@ function unpackInt(buf) {
|
|
|
89
74
|
return fixInt(valOf(numValType.unpack(buf)));
|
|
90
75
|
}
|
|
91
76
|
exports.unpackInt = unpackInt;
|
|
92
|
-
exports.errBodyType =
|
|
77
|
+
exports.errBodyType = protobuf_type_1.ProtoType.for(common_proto_1.common.ErrorValue);
|
|
93
78
|
function errToMsg(err) {
|
|
94
79
|
if (typeof err !== 'object') {
|
|
95
80
|
return { err: JSON.stringify(err) };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 3NSoft Inc.
|
|
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
|
|
@@ -21,6 +21,8 @@ const protobuf_msg_1 = require("./protobuf-msg");
|
|
|
21
21
|
const rxjs_1 = require("rxjs");
|
|
22
22
|
const operators_1 = require("rxjs/operators");
|
|
23
23
|
const processes_1 = require("../lib-common/processes");
|
|
24
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
25
|
+
const startup_proto_1 = require("../protos/startup.proto");
|
|
24
26
|
function wrapSignInCAP(cap) {
|
|
25
27
|
return {
|
|
26
28
|
completeLoginAndLocalSetup: completeLoginAndLocalSetup.wrapService(cap.completeLoginAndLocalSetup),
|
|
@@ -57,12 +59,9 @@ function makeSignUpCaller(caller, objPath) {
|
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
exports.makeSignUpCaller = makeSignUpCaller;
|
|
60
|
-
function startupType(type) {
|
|
61
|
-
return protobuf_msg_1.makeProtobufTypeFrom('startup.proto', `startup.${type}`);
|
|
62
|
-
}
|
|
63
62
|
var getAvailableAddresses;
|
|
64
63
|
(function (getAvailableAddresses) {
|
|
65
|
-
const requestType =
|
|
64
|
+
const requestType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.GetAvailableAddressesRequestBody);
|
|
66
65
|
function wrapService(fn) {
|
|
67
66
|
return buf => {
|
|
68
67
|
const { name, token } = requestType.unpack(buf);
|
|
@@ -83,7 +82,7 @@ var getAvailableAddresses;
|
|
|
83
82
|
Object.freeze(getAvailableAddresses);
|
|
84
83
|
var addUser;
|
|
85
84
|
(function (addUser) {
|
|
86
|
-
const requestType =
|
|
85
|
+
const requestType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.AddUserRequestBody);
|
|
87
86
|
function wrapService(fn) {
|
|
88
87
|
return buf => {
|
|
89
88
|
const { userId, token } = requestType.unpack(buf);
|
|
@@ -104,7 +103,7 @@ var addUser;
|
|
|
104
103
|
Object.freeze(addUser);
|
|
105
104
|
var isActivated;
|
|
106
105
|
(function (isActivated_1) {
|
|
107
|
-
const requestType =
|
|
106
|
+
const requestType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.IsActivatedRequestBody);
|
|
108
107
|
function wrapService(fn) {
|
|
109
108
|
return buf => {
|
|
110
109
|
const { userId } = requestType.unpack(buf);
|
|
@@ -123,7 +122,7 @@ var isActivated;
|
|
|
123
122
|
isActivated_1.makeCaller = makeCaller;
|
|
124
123
|
})(isActivated || (isActivated = {}));
|
|
125
124
|
Object.freeze(isActivated);
|
|
126
|
-
const reqWithPassType =
|
|
125
|
+
const reqWithPassType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.PassOnlyRequestBody);
|
|
127
126
|
var createUserParams;
|
|
128
127
|
(function (createUserParams) {
|
|
129
128
|
function wrapService(fn) {
|
|
@@ -178,7 +177,7 @@ var getUsersOnDisk;
|
|
|
178
177
|
Object.freeze(getUsersOnDisk);
|
|
179
178
|
var startLoginToRemoteStorage;
|
|
180
179
|
(function (startLoginToRemoteStorage) {
|
|
181
|
-
const requestType =
|
|
180
|
+
const requestType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.StartLoginToRemoteStorageRequestBody);
|
|
182
181
|
function wrapService(fn) {
|
|
183
182
|
return buf => {
|
|
184
183
|
const { address } = requestType.unpack(buf);
|
|
@@ -197,7 +196,7 @@ var startLoginToRemoteStorage;
|
|
|
197
196
|
startLoginToRemoteStorage.makeCaller = makeCaller;
|
|
198
197
|
})(startLoginToRemoteStorage || (startLoginToRemoteStorage = {}));
|
|
199
198
|
Object.freeze(startLoginToRemoteStorage);
|
|
200
|
-
const progressValueType =
|
|
199
|
+
const progressValueType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.ProgressValue);
|
|
201
200
|
var completeLoginAndLocalSetup;
|
|
202
201
|
(function (completeLoginAndLocalSetup) {
|
|
203
202
|
function wrapService(fn) {
|
|
@@ -241,7 +240,7 @@ var completeLoginAndLocalSetup;
|
|
|
241
240
|
Object.freeze(completeLoginAndLocalSetup);
|
|
242
241
|
var useExistingStorage;
|
|
243
242
|
(function (useExistingStorage) {
|
|
244
|
-
const requestType =
|
|
243
|
+
const requestType = protobuf_type_1.ProtoType.for(startup_proto_1.startup.UseExistingStorageRequestBody);
|
|
245
244
|
function wrapService(fn) {
|
|
246
245
|
return buf => {
|
|
247
246
|
const { pass, address } = requestType.unpack(buf);
|
|
@@ -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
|
|
@@ -19,6 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.makeStorageCaller = exports.exposeStorageCAP = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
21
|
const fs_1 = require("./fs");
|
|
22
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
23
|
+
const storage_proto_1 = require("../protos/storage.proto");
|
|
22
24
|
function exposeStorageCAP(cap, expServices) {
|
|
23
25
|
const wrap = {
|
|
24
26
|
getAppLocalFS: getAppLocalFS.wrapService(cap.getAppLocalFS, expServices),
|
|
@@ -50,12 +52,9 @@ function makeStorageCaller(caller, objPath) {
|
|
|
50
52
|
return storage;
|
|
51
53
|
}
|
|
52
54
|
exports.makeStorageCaller = makeStorageCaller;
|
|
53
|
-
function storageType(type) {
|
|
54
|
-
return protobuf_msg_1.makeProtobufTypeFrom('storage.proto', `storage.${type}`);
|
|
55
|
-
}
|
|
56
55
|
var getAppLocalFS;
|
|
57
56
|
(function (getAppLocalFS) {
|
|
58
|
-
const requestType =
|
|
57
|
+
const requestType = protobuf_type_1.ProtoType.for(storage_proto_1.storage.GetAppLocalFSRequestBody);
|
|
59
58
|
function wrapService(fn, expServices) {
|
|
60
59
|
return buf => {
|
|
61
60
|
const { appName } = requestType.unpack(buf);
|
|
@@ -82,7 +81,7 @@ var getAppLocalFS;
|
|
|
82
81
|
Object.freeze(getAppLocalFS);
|
|
83
82
|
var getAppSyncedFS;
|
|
84
83
|
(function (getAppSyncedFS) {
|
|
85
|
-
const requestType =
|
|
84
|
+
const requestType = protobuf_type_1.ProtoType.for(storage_proto_1.storage.GetAppSyncedFSRequestBody);
|
|
86
85
|
function wrapService(fn, expServices) {
|
|
87
86
|
return buf => {
|
|
88
87
|
const { appName } = requestType.unpack(buf);
|
|
@@ -109,7 +108,7 @@ var getAppSyncedFS;
|
|
|
109
108
|
Object.freeze(getAppSyncedFS);
|
|
110
109
|
var getSysFS;
|
|
111
110
|
(function (getSysFS) {
|
|
112
|
-
const requestType =
|
|
111
|
+
const requestType = protobuf_type_1.ProtoType.for(storage_proto_1.storage.GetSysFSRequestBody);
|
|
113
112
|
function wrapService(fn, expServices) {
|
|
114
113
|
return buf => {
|
|
115
114
|
const { type, path } = requestType.unpack(buf);
|
|
@@ -138,7 +137,7 @@ var getSysFS;
|
|
|
138
137
|
Object.freeze(getSysFS);
|
|
139
138
|
var getUserFS;
|
|
140
139
|
(function (getUserFS) {
|
|
141
|
-
const requestType =
|
|
140
|
+
const requestType = protobuf_type_1.ProtoType.for(storage_proto_1.storage.GetUserFSRequestBody);
|
|
142
141
|
function wrapService(fn, expServices) {
|
|
143
142
|
return buf => {
|
|
144
143
|
const { type, path } = requestType.unpack(buf);
|
|
@@ -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
|
|
@@ -22,7 +22,8 @@ const os_1 = require("os");
|
|
|
22
22
|
const processes_1 = require("../../lib-common/processes");
|
|
23
23
|
const error_1 = require("../../lib-common/exceptions/error");
|
|
24
24
|
const path_1 = require("path");
|
|
25
|
-
const
|
|
25
|
+
const protobuf_type_1 = require("../protobuf-type");
|
|
26
|
+
const cryptor_proto_1 = require("../../protos/cryptor.proto");
|
|
26
27
|
const assert_1 = require("../../lib-common/assert");
|
|
27
28
|
const MAX_IDLE_MILLIS = 60 * 1000;
|
|
28
29
|
const jsWorkerFName = 'worker-js.js';
|
|
@@ -264,8 +265,8 @@ exports.makeInWorkerCryptor = (logErr, logWarning, maxThreads) => {
|
|
|
264
265
|
class WasmWorkers extends Workers {
|
|
265
266
|
constructor(logErr, logWarning, maxThreads) {
|
|
266
267
|
super(workerScriptFor('wasm'), logErr, logWarning, maxThreads);
|
|
267
|
-
this.reqType =
|
|
268
|
-
this.replyType =
|
|
268
|
+
this.reqType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Request);
|
|
269
|
+
this.replyType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Reply);
|
|
269
270
|
}
|
|
270
271
|
call(req, interim) {
|
|
271
272
|
const msg = this.reqType.pack(req);
|
|
@@ -296,27 +297,13 @@ function toLocalErr(replyErr) {
|
|
|
296
297
|
return new Error(`WASM cryptor ${replyErr.condition}: ${replyErr.message}`);
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
|
-
function makeProtobufType(type) {
|
|
300
|
-
const protoFile = 'cryptor.proto';
|
|
301
|
-
const typeName = `cryptor.${type}`;
|
|
302
|
-
try {
|
|
303
|
-
// make sure to copy protos with compile step (use npm script)
|
|
304
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName);
|
|
305
|
-
}
|
|
306
|
-
catch (err) {
|
|
307
|
-
// we won't get here if referenced module exists, but metro packager
|
|
308
|
-
// in LiqudCore needs static path require
|
|
309
|
-
const fallback = require('./proto-defs');
|
|
310
|
-
return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName, fallback);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
300
|
exports.makeInWorkerWasmCryptor = (logErr, logWarning, maxThreads) => {
|
|
314
301
|
assert_1.assert(typeof logErr === 'function');
|
|
315
302
|
assert_1.assert(typeof logWarning === 'function');
|
|
316
303
|
const workers = new WasmWorkers(logErr, logWarning, maxThreads);
|
|
317
304
|
const close = workers.close.bind(workers);
|
|
318
|
-
const boolValType =
|
|
319
|
-
const kpairType =
|
|
305
|
+
const boolValType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.BoolVal);
|
|
306
|
+
const kpairType = protobuf_type_1.ProtoType.for(cryptor_proto_1.cryptor.Keypair);
|
|
320
307
|
const cryptor = {
|
|
321
308
|
scrypt: (passwd, salt, logN, r, p, dkLen, progressCB) => workers.call({
|
|
322
309
|
func: 1,
|