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
package/build/core/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FactoryOfFSs } from './storage';
|
|
|
2
2
|
import { makeCryptor } from '../lib-client/cryptor/cryptor';
|
|
3
3
|
import { NetClient } from '../lib-client/request-utils';
|
|
4
4
|
import { ServiceLocatorMaker } from '../lib-client/service-locator';
|
|
5
|
-
declare type RequestedCAPs = web3n.caps.common.
|
|
5
|
+
declare type RequestedCAPs = web3n.caps.common.RequestedCAPs;
|
|
6
6
|
declare type W3N = web3n.caps.common.W3N;
|
|
7
7
|
export interface CoreConf {
|
|
8
8
|
dataDir: string;
|
package/build/core/index.js
CHANGED
|
@@ -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
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.makeASMailCaller = exports.exposeASMailCAP = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const asmail_proto_1 = require("../protos/asmail.proto");
|
|
21
23
|
const connector_1 = require("./connector");
|
|
22
24
|
const rxjs_1 = require("rxjs");
|
|
23
25
|
const operators_1 = require("rxjs/operators");
|
|
@@ -68,9 +70,6 @@ function makeASMailCaller(caller, objPath) {
|
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
exports.makeASMailCaller = makeASMailCaller;
|
|
71
|
-
function asmailType(type) {
|
|
72
|
-
return protobuf_msg_1.makeProtobufTypeFrom('asmail.proto', `asmail.${type}`);
|
|
73
|
-
}
|
|
74
73
|
var getUserId;
|
|
75
74
|
(function (getUserId) {
|
|
76
75
|
function wrapService(fn) {
|
|
@@ -96,8 +95,8 @@ var getUserId;
|
|
|
96
95
|
Object.freeze(getUserId);
|
|
97
96
|
var inboxListMsgs;
|
|
98
97
|
(function (inboxListMsgs) {
|
|
99
|
-
const requestType =
|
|
100
|
-
const replyType =
|
|
98
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.ListMsgsRequestBody);
|
|
99
|
+
const replyType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.ListMsgsInboxReplyBody);
|
|
101
100
|
function unpackMsgInfos(buf) {
|
|
102
101
|
const msgs = protobuf_msg_1.fixArray(replyType.unpack(buf).infos);
|
|
103
102
|
for (const msg of msgs) {
|
|
@@ -128,7 +127,7 @@ var inboxListMsgs;
|
|
|
128
127
|
Object.freeze(inboxListMsgs);
|
|
129
128
|
var removeMsg;
|
|
130
129
|
(function (removeMsg) {
|
|
131
|
-
const requestType =
|
|
130
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.RemoveMsgRequestBody);
|
|
132
131
|
function wrapService(fn) {
|
|
133
132
|
return (reqBody) => {
|
|
134
133
|
const { msgId } = requestType.unpack(reqBody);
|
|
@@ -148,7 +147,7 @@ var removeMsg;
|
|
|
148
147
|
Object.freeze(removeMsg);
|
|
149
148
|
var getMsg;
|
|
150
149
|
(function (getMsg) {
|
|
151
|
-
const requestType =
|
|
150
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.GetMsgRequestBody);
|
|
152
151
|
function wrapService(fn, expServices) {
|
|
153
152
|
return (reqBody) => {
|
|
154
153
|
const { msgId } = requestType.unpack(reqBody);
|
|
@@ -167,7 +166,7 @@ var getMsg;
|
|
|
167
166
|
getMsg.makeCaller = makeCaller;
|
|
168
167
|
})(getMsg || (getMsg = {}));
|
|
169
168
|
Object.freeze(getMsg);
|
|
170
|
-
const incomingMessageType =
|
|
169
|
+
const incomingMessageType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.IncomingMessageMsg);
|
|
171
170
|
function packIncomingMessage(m, expServices) {
|
|
172
171
|
const ipcMsg = {
|
|
173
172
|
msgType: m.msgType,
|
|
@@ -207,7 +206,7 @@ function unpackIncomingMessage(buf, caller) {
|
|
|
207
206
|
}
|
|
208
207
|
var inboxSubscribe;
|
|
209
208
|
(function (inboxSubscribe) {
|
|
210
|
-
const requestType =
|
|
209
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.SubscribeStartCallBody);
|
|
211
210
|
function wrapService(fn, expServices) {
|
|
212
211
|
return buf => {
|
|
213
212
|
const { event } = requestType.unpack(buf);
|
|
@@ -240,7 +239,7 @@ var inboxSubscribe;
|
|
|
240
239
|
Object.freeze(inboxSubscribe);
|
|
241
240
|
var preFlight;
|
|
242
241
|
(function (preFlight) {
|
|
243
|
-
const requestType =
|
|
242
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.PreFlightRequestBody);
|
|
244
243
|
function wrapService(fn) {
|
|
245
244
|
return (reqBody) => {
|
|
246
245
|
const { toAddress } = requestType.unpack(reqBody);
|
|
@@ -261,7 +260,7 @@ var preFlight;
|
|
|
261
260
|
Object.freeze(preFlight);
|
|
262
261
|
var addMsg;
|
|
263
262
|
(function (addMsg) {
|
|
264
|
-
const requestType =
|
|
263
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.AddMsgRequestBody);
|
|
265
264
|
function packMsg(m, caller) {
|
|
266
265
|
const ipcMsg = {
|
|
267
266
|
msgType: m.msgType,
|
|
@@ -361,7 +360,7 @@ var addMsg;
|
|
|
361
360
|
Object.freeze(addMsg);
|
|
362
361
|
var delivListMsgs;
|
|
363
362
|
(function (delivListMsgs) {
|
|
364
|
-
const replyType =
|
|
363
|
+
const replyType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.ListMsgsDeliveryReplyBody);
|
|
365
364
|
function wrapService(fn) {
|
|
366
365
|
return () => {
|
|
367
366
|
const promise = fn()
|
|
@@ -385,7 +384,7 @@ var delivListMsgs;
|
|
|
385
384
|
delivListMsgs.makeCaller = makeCaller;
|
|
386
385
|
})(delivListMsgs || (delivListMsgs = {}));
|
|
387
386
|
Object.freeze(delivListMsgs);
|
|
388
|
-
const deliveryProgressMsgType =
|
|
387
|
+
const deliveryProgressMsgType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.DeliveryProgressMsg);
|
|
389
388
|
function packDeliveryProgress(p) {
|
|
390
389
|
const m = {
|
|
391
390
|
notConnected: protobuf_msg_1.toOptVal(p.notConnected),
|
|
@@ -427,7 +426,7 @@ function unpackDeliveryProgress(m) {
|
|
|
427
426
|
}
|
|
428
427
|
var currentState;
|
|
429
428
|
(function (currentState) {
|
|
430
|
-
const requestType =
|
|
429
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.CurrentStateRequestBody);
|
|
431
430
|
function wrapService(fn) {
|
|
432
431
|
return (reqBody) => {
|
|
433
432
|
const { id } = requestType.unpack(reqBody);
|
|
@@ -458,7 +457,7 @@ var currentState;
|
|
|
458
457
|
Object.freeze(currentState);
|
|
459
458
|
var rmMsg;
|
|
460
459
|
(function (rmMsg) {
|
|
461
|
-
const requestType =
|
|
460
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.RmMsgRequestBody);
|
|
462
461
|
function wrapService(fn) {
|
|
463
462
|
return (reqBody) => {
|
|
464
463
|
const { id, cancelSending } = requestType.unpack(reqBody);
|
|
@@ -479,7 +478,7 @@ var rmMsg;
|
|
|
479
478
|
Object.freeze(rmMsg);
|
|
480
479
|
var observeAllDeliveries;
|
|
481
480
|
(function (observeAllDeliveries) {
|
|
482
|
-
const notifType =
|
|
481
|
+
const notifType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.DeliveryNotificationWithId);
|
|
483
482
|
function wrapService(fn) {
|
|
484
483
|
return () => {
|
|
485
484
|
const s = new rxjs_1.Subject();
|
|
@@ -518,7 +517,7 @@ var observeAllDeliveries;
|
|
|
518
517
|
Object.freeze(observeAllDeliveries);
|
|
519
518
|
var observeDelivery;
|
|
520
519
|
(function (observeDelivery) {
|
|
521
|
-
const requestType =
|
|
520
|
+
const requestType = protobuf_type_1.ProtoType.for(asmail_proto_1.asmail.ObserveDeliveryRequestBody);
|
|
522
521
|
function wrapService(fn) {
|
|
523
522
|
return buf => {
|
|
524
523
|
const { id } = requestType.unpack(buf);
|
|
@@ -2,8 +2,8 @@ import { ObjectReference } from './protobuf-msg';
|
|
|
2
2
|
import { ExposedServices, Caller } from './connector';
|
|
3
3
|
declare type FileByteSink = web3n.files.FileByteSink;
|
|
4
4
|
declare type FileByteSource = web3n.files.FileByteSource;
|
|
5
|
-
export declare function makeSinkCaller(caller: Caller, ref: ObjectReference): FileByteSink;
|
|
6
|
-
export declare function exposeSinkService(sink: FileByteSink, expServices: ExposedServices): ObjectReference
|
|
7
|
-
export declare function makeSrcCaller(caller: Caller, ref: ObjectReference): FileByteSource;
|
|
8
|
-
export declare function exposeSrcService(src: FileByteSource, expServices: ExposedServices): ObjectReference
|
|
5
|
+
export declare function makeSinkCaller(caller: Caller, ref: ObjectReference<'FileByteSink'>): FileByteSink;
|
|
6
|
+
export declare function exposeSinkService(sink: FileByteSink, expServices: ExposedServices): ObjectReference<'FileByteSink'>;
|
|
7
|
+
export declare function makeSrcCaller(caller: Caller, ref: ObjectReference<'FileByteSource'>): FileByteSource;
|
|
8
|
+
export declare function exposeSrcService(src: FileByteSource, expServices: ExposedServices): ObjectReference<'FileByteSource'>;
|
|
9
9
|
export {};
|
|
@@ -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.exposeSrcService = exports.makeSrcCaller = exports.exposeSinkService = exports.makeSinkCaller = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const bytes_proto_1 = require("../protos/bytes.proto");
|
|
21
23
|
const connector_1 = require("./connector");
|
|
22
24
|
function makeSinkCaller(caller, ref) {
|
|
23
25
|
connector_1.checkRefObjTypeIs('FileByteSink', ref);
|
|
@@ -69,9 +71,6 @@ function exposeSrcService(src, expServices) {
|
|
|
69
71
|
return ref;
|
|
70
72
|
}
|
|
71
73
|
exports.exposeSrcService = exposeSrcService;
|
|
72
|
-
function bytesType(type) {
|
|
73
|
-
return protobuf_msg_1.makeProtobufTypeFrom('bytes.proto', `bytes.${type}`);
|
|
74
|
-
}
|
|
75
74
|
var sinkGetSize;
|
|
76
75
|
(function (sinkGetSize) {
|
|
77
76
|
function wrapService(fn) {
|
|
@@ -93,7 +92,7 @@ var sinkGetSize;
|
|
|
93
92
|
Object.freeze(sinkGetSize);
|
|
94
93
|
var sinkSplice;
|
|
95
94
|
(function (sinkSplice) {
|
|
96
|
-
const requestType =
|
|
95
|
+
const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.SpliceRequestBody);
|
|
97
96
|
function wrapService(fn) {
|
|
98
97
|
return buf => {
|
|
99
98
|
const { pos, del, bytes } = requestType.unpack(buf);
|
|
@@ -117,7 +116,7 @@ var sinkSplice;
|
|
|
117
116
|
Object.freeze(sinkSplice);
|
|
118
117
|
var sinkTruncate;
|
|
119
118
|
(function (sinkTruncate) {
|
|
120
|
-
const requestType =
|
|
119
|
+
const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.TruncateRequestBody);
|
|
121
120
|
function wrapService(fn) {
|
|
122
121
|
return buf => {
|
|
123
122
|
const { size } = requestType.unpack(buf);
|
|
@@ -138,7 +137,7 @@ var sinkTruncate;
|
|
|
138
137
|
Object.freeze(sinkTruncate);
|
|
139
138
|
var sinkShowLayout;
|
|
140
139
|
(function (sinkShowLayout) {
|
|
141
|
-
const replyType =
|
|
140
|
+
const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.FileLayoutMsg);
|
|
142
141
|
function packLayout(l) {
|
|
143
142
|
return {
|
|
144
143
|
base: protobuf_msg_1.toOptVal(l.base),
|
|
@@ -172,7 +171,7 @@ var sinkShowLayout;
|
|
|
172
171
|
Object.freeze(sinkShowLayout);
|
|
173
172
|
var sinkDone;
|
|
174
173
|
(function (sinkDone) {
|
|
175
|
-
const requestType =
|
|
174
|
+
const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.DoneRequestBody);
|
|
176
175
|
function wrapService(fn) {
|
|
177
176
|
return buf => {
|
|
178
177
|
const { err } = requestType.unpack(buf);
|
|
@@ -232,8 +231,8 @@ var srcGetPosition;
|
|
|
232
231
|
Object.freeze(srcGetPosition);
|
|
233
232
|
var srcRead;
|
|
234
233
|
(function (srcRead) {
|
|
235
|
-
const requestType =
|
|
236
|
-
const replyType =
|
|
234
|
+
const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadRequestBody);
|
|
235
|
+
const replyType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.ReadReplyBody);
|
|
237
236
|
function wrapService(fn) {
|
|
238
237
|
return buf => {
|
|
239
238
|
const { len } = requestType.unpack(buf);
|
|
@@ -254,7 +253,7 @@ var srcRead;
|
|
|
254
253
|
Object.freeze(srcRead);
|
|
255
254
|
var srcSeek;
|
|
256
255
|
(function (srcSeek) {
|
|
257
|
-
const requestType =
|
|
256
|
+
const requestType = protobuf_type_1.ProtoType.for(bytes_proto_1.bytes.SeekRequestBody);
|
|
258
257
|
function wrapService(fn) {
|
|
259
258
|
return buf => {
|
|
260
259
|
const { offset } = requestType.unpack(buf);
|
|
@@ -20,9 +20,9 @@ export declare class ClientsSideImpl implements ClientsSide {
|
|
|
20
20
|
private startCall;
|
|
21
21
|
startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
|
|
22
22
|
startObservableCall(path: string[], req: EnvelopeBody, obs: Subject<EnvelopeBody>): () => void;
|
|
23
|
-
registerClientDrop(o: any, srvRef: ObjectReference): void;
|
|
23
|
+
registerClientDrop(o: any, srvRef: ObjectReference<any>): void;
|
|
24
24
|
private makeClientDropCB;
|
|
25
25
|
private sendObjDropMsg;
|
|
26
|
-
srvRefOf(clientObj: any): ObjectReference
|
|
26
|
+
srvRefOf(clientObj: any): ObjectReference<any>;
|
|
27
27
|
listObj(path: string[]): string[];
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ObjectReference
|
|
1
|
+
import { ObjectReference } from "./protobuf-msg";
|
|
2
2
|
import { ServicesSide, Envelope, EnvelopeBody, ExposedFn, ExposedObj, ExposedServices } from "./connector";
|
|
3
3
|
export declare class ServicesSideImpl implements ServicesSide {
|
|
4
4
|
private readonly sendMsg;
|
|
@@ -16,8 +16,8 @@ export declare class ServicesSideImpl implements ServicesSide {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class ExposedObjs {
|
|
18
18
|
private readonly objs;
|
|
19
|
-
exposeDroppableService(objType:
|
|
20
|
-
getOriginalObj<T>(ref: ObjectReference): T;
|
|
19
|
+
exposeDroppableService<T>(objType: T, exp: ExposedFn | ExposedObj<any>, original: any): ObjectReference<T>;
|
|
20
|
+
getOriginalObj<T>(ref: ObjectReference<any>): T;
|
|
21
21
|
exposeW3NService(exp: ExposedFn | ExposedObj<any>): void;
|
|
22
22
|
drop(name: string): void;
|
|
23
23
|
find(path: string[] | undefined): ExposedFn | ExposedObj<any> | undefined;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Observable, Observer, Subject } from "rxjs";
|
|
3
|
-
import { ObjectReference,
|
|
3
|
+
import { ObjectReference, Value } from "./protobuf-msg";
|
|
4
|
+
import { ProtoType } from '../lib-client/protobuf-type';
|
|
4
5
|
export interface ExposedServices {
|
|
5
|
-
exposeDroppableService(objType:
|
|
6
|
-
getOriginalObj<T>(ref: ObjectReference): T;
|
|
6
|
+
exposeDroppableService<T>(objType: T, exp: ExposedFn | ExposedObj<any>, original: any): ObjectReference<T>;
|
|
7
|
+
getOriginalObj<T>(ref: ObjectReference<any>): T;
|
|
7
8
|
exposeW3NService(exp: ExposedFn | ExposedObj<any>): void;
|
|
8
9
|
listObj(path: string[]): string[] | null;
|
|
9
10
|
}
|
|
@@ -18,8 +19,8 @@ export interface ServicesSide {
|
|
|
18
19
|
export interface Caller {
|
|
19
20
|
startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
|
|
20
21
|
startObservableCall(path: string[], req: EnvelopeBody, obs: Subject<EnvelopeBody>): () => void;
|
|
21
|
-
registerClientDrop(o: any, srvRef: ObjectReference): void;
|
|
22
|
-
srvRefOf(clientObj: any): ObjectReference
|
|
22
|
+
registerClientDrop(o: any, srvRef: ObjectReference<any>): void;
|
|
23
|
+
srvRefOf(clientObj: any): ObjectReference<any>;
|
|
23
24
|
listObj(path: string[]): string[];
|
|
24
25
|
}
|
|
25
26
|
export interface ClientsSide {
|
|
@@ -43,7 +44,6 @@ export declare class ObjectsConnector {
|
|
|
43
44
|
private sendCallError;
|
|
44
45
|
}
|
|
45
46
|
export declare const W3N_NAME = "w3n";
|
|
46
|
-
export declare function ensureCorrectRefObjType(objType: ExposedObjType): void;
|
|
47
47
|
/**
|
|
48
48
|
* Envelope is a message form that is sent in IPC channel.
|
|
49
49
|
*/
|
|
@@ -59,7 +59,7 @@ export declare type EnvelopeBody = Buffer | void;
|
|
|
59
59
|
export declare type MsgType = ClientToService | ServiceToClient;
|
|
60
60
|
export declare type ClientToService = 'start' | 'cancel' | 'drop' | 'list-obj';
|
|
61
61
|
export declare type ServiceToClient = 'interim' | 'end' | 'error';
|
|
62
|
-
export declare const msgProtoType:
|
|
62
|
+
export declare const msgProtoType: ProtoType<Envelope>;
|
|
63
63
|
export declare type ExposedFn = (reqBody: EnvelopeBody) => ({
|
|
64
64
|
promise?: Promise<EnvelopeBody>;
|
|
65
65
|
obs?: Observable<EnvelopeBody>;
|
|
@@ -86,4 +86,4 @@ export interface IPCException extends web3n.RuntimeException {
|
|
|
86
86
|
path?: string[];
|
|
87
87
|
}
|
|
88
88
|
export declare function makeIPCException(fields: Partial<IPCException>): IPCException;
|
|
89
|
-
export declare function checkRefObjTypeIs(expected:
|
|
89
|
+
export declare function checkRefObjTypeIs<T>(expected: T, ref: ObjectReference<T>): void;
|
|
@@ -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,8 +16,10 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.checkRefObjTypeIs = exports.makeIPCException = exports.msgProtoType = exports.
|
|
19
|
+
exports.checkRefObjTypeIs = exports.makeIPCException = exports.msgProtoType = exports.W3N_NAME = exports.ObjectsConnector = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const ipc_proto_1 = require("../protos/ipc.proto");
|
|
21
23
|
// Note that make_?_Side functions could've been imported normally, but client
|
|
22
24
|
// side uses weakrefs, while services side doesn't, and services side is used
|
|
23
25
|
// in embedding without weakrefs, needing to hide require points.
|
|
@@ -156,22 +158,7 @@ exports.ObjectsConnector = ObjectsConnector;
|
|
|
156
158
|
Object.freeze(ObjectsConnector.prototype);
|
|
157
159
|
Object.freeze(ObjectsConnector);
|
|
158
160
|
exports.W3N_NAME = 'w3n';
|
|
159
|
-
|
|
160
|
-
switch (objType) {
|
|
161
|
-
case 'FileByteSink':
|
|
162
|
-
case 'FileByteSource':
|
|
163
|
-
case 'FileImpl':
|
|
164
|
-
case 'FSImpl':
|
|
165
|
-
case 'SymLinkImpl':
|
|
166
|
-
case 'FSCollection':
|
|
167
|
-
case 'FSItemsIter':
|
|
168
|
-
return;
|
|
169
|
-
default:
|
|
170
|
-
throw new Error(`Object type ${objType} is not known`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
exports.ensureCorrectRefObjType = ensureCorrectRefObjType;
|
|
174
|
-
exports.msgProtoType = protobuf_msg_1.makeProtobufTypeFrom('ipc.proto', 'ipc.Envelope');
|
|
161
|
+
exports.msgProtoType = protobuf_type_1.ProtoType.for(ipc_proto_1.ipc.Envelope);
|
|
175
162
|
function makeIPCException(fields) {
|
|
176
163
|
const exc = {
|
|
177
164
|
runtimeException: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ObjectReference, Value } from "./protobuf-msg";
|
|
3
|
+
import { ProtoType } from '../lib-client/protobuf-type';
|
|
3
4
|
import { ExposedFn, EnvelopeBody, Caller, ExposedServices } from "./connector";
|
|
4
|
-
import { ProtoType } from "../lib-client/protobuf-loader";
|
|
5
5
|
declare type ReadonlyFile = web3n.files.ReadonlyFile;
|
|
6
6
|
declare type ReadonlyFileVersionedAPI = web3n.files.ReadonlyFileVersionedAPI;
|
|
7
7
|
declare type WritableFile = web3n.files.WritableFile;
|
|
@@ -20,7 +20,7 @@ export interface FileMsg {
|
|
|
20
20
|
isVersioned: boolean;
|
|
21
21
|
name: string;
|
|
22
22
|
isNew: boolean;
|
|
23
|
-
impl: ObjectReference
|
|
23
|
+
impl: ObjectReference<'FileImpl'>;
|
|
24
24
|
}
|
|
25
25
|
export declare function packXAttrValue(val: any): EnvelopeBody;
|
|
26
26
|
export declare function unpackXAttrValue(buf: EnvelopeBody): any;
|
|
@@ -91,7 +91,7 @@ export declare namespace vReadJSON {
|
|
|
91
91
|
export declare namespace vGetByteSource {
|
|
92
92
|
interface Reply {
|
|
93
93
|
version: number;
|
|
94
|
-
src: ObjectReference
|
|
94
|
+
src: ObjectReference<'FileByteSource'>;
|
|
95
95
|
}
|
|
96
96
|
const replyType: ProtoType<Reply>;
|
|
97
97
|
function wrapService(fn: ReadonlyFileVersionedAPI['getByteSource'], expServices: ExposedServices): ExposedFn;
|
|
@@ -120,7 +120,7 @@ export declare namespace updateXAttrs {
|
|
|
120
120
|
export declare namespace vGetByteSink {
|
|
121
121
|
interface Reply {
|
|
122
122
|
version: number;
|
|
123
|
-
sink: ObjectReference
|
|
123
|
+
sink: ObjectReference<'FileByteSink'>;
|
|
124
124
|
}
|
|
125
125
|
const replyType: ProtoType<Reply>;
|
|
126
126
|
function wrapService(fn: WritableFileVersionedAPI['getByteSink'], expServices: ExposedServices): ExposedFn;
|
|
@@ -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.vGetByteSink = exports.updateXAttrs = exports.vGetByteSource = exports.vReadJSON = exports.vReadTxt = exports.vReadBytes = exports.vListXAttrs = exports.vGetXAttr = exports.unpackFileEvent = exports.packFileEvent = exports.unpackJSON = exports.packJSON = exports.readBytes = exports.unpackXAttrValue = exports.packXAttrValue = exports.unpackStats = exports.packStats = exports.fileMsgType = exports.exposeFileService = exports.makeFileCaller = void 0;
|
|
20
20
|
const protobuf_msg_1 = require("./protobuf-msg");
|
|
21
|
+
const protobuf_type_1 = require("../lib-client/protobuf-type");
|
|
22
|
+
const file_proto_1 = require("../protos/file.proto");
|
|
21
23
|
const connector_1 = require("./connector");
|
|
22
24
|
const error_1 = require("../lib-common/exceptions/error");
|
|
23
25
|
const bytes_1 = require("./bytes");
|
|
@@ -118,11 +120,8 @@ function exposeFileService(file, expServices) {
|
|
|
118
120
|
return fileMsg;
|
|
119
121
|
}
|
|
120
122
|
exports.exposeFileService = exposeFileService;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
exports.fileMsgType = makeFileType('File');
|
|
125
|
-
const statsMsgType = makeFileType('StatsMsg');
|
|
123
|
+
exports.fileMsgType = protobuf_type_1.ProtoType.for(file_proto_1.file.File);
|
|
124
|
+
const statsMsgType = protobuf_type_1.ProtoType.for(file_proto_1.file.StatsMsg);
|
|
126
125
|
function packStats(s) {
|
|
127
126
|
const msg = {
|
|
128
127
|
writable: s.writable,
|
|
@@ -151,7 +150,7 @@ function unpackStats(buf) {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
exports.unpackStats = unpackStats;
|
|
154
|
-
const fileType =
|
|
153
|
+
const fileType = protobuf_type_1.ProtoType.for(file_proto_1.file.File);
|
|
155
154
|
var stat;
|
|
156
155
|
(function (stat) {
|
|
157
156
|
function wrapService(fn) {
|
|
@@ -171,7 +170,7 @@ var stat;
|
|
|
171
170
|
stat.makeCaller = makeCaller;
|
|
172
171
|
})(stat || (stat = {}));
|
|
173
172
|
Object.freeze(stat);
|
|
174
|
-
const xattrValueType =
|
|
173
|
+
const xattrValueType = protobuf_type_1.ProtoType.for(file_proto_1.file.XAttrValue);
|
|
175
174
|
function packXAttrValue(val) {
|
|
176
175
|
if (Buffer.isBuffer(val)) {
|
|
177
176
|
return xattrValueType.pack({ bytes: protobuf_msg_1.toVal(val) });
|
|
@@ -202,7 +201,7 @@ function unpackXAttrValue(buf) {
|
|
|
202
201
|
exports.unpackXAttrValue = unpackXAttrValue;
|
|
203
202
|
var getXAttr;
|
|
204
203
|
(function (getXAttr) {
|
|
205
|
-
const requestType =
|
|
204
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.GetXAttrRequestBody);
|
|
206
205
|
function wrapService(fn) {
|
|
207
206
|
return buf => {
|
|
208
207
|
const { xaName } = requestType.unpack(buf);
|
|
@@ -242,8 +241,8 @@ var listXAttrs;
|
|
|
242
241
|
Object.freeze(listXAttrs);
|
|
243
242
|
var readBytes;
|
|
244
243
|
(function (readBytes) {
|
|
245
|
-
const requestType =
|
|
246
|
-
const replyType =
|
|
244
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.ReadBytesRequestBody);
|
|
245
|
+
const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.ReadBytesReplyBody);
|
|
247
246
|
function packReply(bytes) {
|
|
248
247
|
return replyType.pack({ bytes: protobuf_msg_1.toOptVal(bytes) });
|
|
249
248
|
}
|
|
@@ -351,7 +350,7 @@ var getByteSource;
|
|
|
351
350
|
getByteSource.makeCaller = makeCaller;
|
|
352
351
|
})(getByteSource || (getByteSource = {}));
|
|
353
352
|
Object.freeze(getByteSource);
|
|
354
|
-
const fileEventType =
|
|
353
|
+
const fileEventType = protobuf_type_1.ProtoType.for(file_proto_1.file.FileEventMsg);
|
|
355
354
|
function packFileEvent(e) {
|
|
356
355
|
const msg = {
|
|
357
356
|
type: e.type,
|
|
@@ -411,8 +410,8 @@ var watch;
|
|
|
411
410
|
Object.freeze(watch);
|
|
412
411
|
var vGetXAttr;
|
|
413
412
|
(function (vGetXAttr) {
|
|
414
|
-
const requestType =
|
|
415
|
-
vGetXAttr.replyType =
|
|
413
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.GetXAttrRequestBody);
|
|
414
|
+
vGetXAttr.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedGetXAttrReplyBody);
|
|
416
415
|
function unpackReply(buf) {
|
|
417
416
|
const { json, str, bytes, version: v } = vGetXAttr.replyType.unpack(buf);
|
|
418
417
|
const version = protobuf_msg_1.fixInt(v);
|
|
@@ -457,7 +456,7 @@ var vGetXAttr;
|
|
|
457
456
|
Object.freeze(vGetXAttr);
|
|
458
457
|
var vListXAttrs;
|
|
459
458
|
(function (vListXAttrs) {
|
|
460
|
-
vListXAttrs.replyType =
|
|
459
|
+
vListXAttrs.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedListXAttrsReplyBody);
|
|
461
460
|
function wrapService(fn) {
|
|
462
461
|
return () => {
|
|
463
462
|
const promise = fn()
|
|
@@ -480,8 +479,8 @@ var vListXAttrs;
|
|
|
480
479
|
Object.freeze(vListXAttrs);
|
|
481
480
|
var vReadBytes;
|
|
482
481
|
(function (vReadBytes) {
|
|
483
|
-
const requestType =
|
|
484
|
-
const replyType =
|
|
482
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.ReadBytesRequestBody);
|
|
483
|
+
const replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedReadBytesReplyBody);
|
|
485
484
|
function packReply(r) {
|
|
486
485
|
return replyType.pack({
|
|
487
486
|
version: r.version, bytes: protobuf_msg_1.toOptVal(r.bytes)
|
|
@@ -515,7 +514,7 @@ var vReadBytes;
|
|
|
515
514
|
Object.freeze(vReadBytes);
|
|
516
515
|
var vReadTxt;
|
|
517
516
|
(function (vReadTxt) {
|
|
518
|
-
vReadTxt.replyType =
|
|
517
|
+
vReadTxt.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedReadTxtReplyBody);
|
|
519
518
|
function wrapService(fn) {
|
|
520
519
|
return () => {
|
|
521
520
|
const promise = fn()
|
|
@@ -538,7 +537,7 @@ var vReadTxt;
|
|
|
538
537
|
Object.freeze(vReadTxt);
|
|
539
538
|
var vReadJSON;
|
|
540
539
|
(function (vReadJSON) {
|
|
541
|
-
vReadJSON.replyType =
|
|
540
|
+
vReadJSON.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedReadJsonReplyBody);
|
|
542
541
|
function wrapService(fn) {
|
|
543
542
|
return () => {
|
|
544
543
|
const promise = fn()
|
|
@@ -568,7 +567,7 @@ var vReadJSON;
|
|
|
568
567
|
Object.freeze(vReadJSON);
|
|
569
568
|
var vGetByteSource;
|
|
570
569
|
(function (vGetByteSource) {
|
|
571
|
-
vGetByteSource.replyType =
|
|
570
|
+
vGetByteSource.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedGetByteSourceReplyBody);
|
|
572
571
|
function wrapService(fn, expServices) {
|
|
573
572
|
return () => {
|
|
574
573
|
const promise = fn()
|
|
@@ -594,7 +593,7 @@ var vGetByteSource;
|
|
|
594
593
|
Object.freeze(vGetByteSource);
|
|
595
594
|
var updateXAttrs;
|
|
596
595
|
(function (updateXAttrs) {
|
|
597
|
-
const requestType =
|
|
596
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.UpdateXAttrsRequestBody);
|
|
598
597
|
function fromReqChanges(r) {
|
|
599
598
|
const attrs = {};
|
|
600
599
|
if (r.set) {
|
|
@@ -668,7 +667,7 @@ var updateXAttrs;
|
|
|
668
667
|
Object.freeze(updateXAttrs);
|
|
669
668
|
var writeBytes;
|
|
670
669
|
(function (writeBytes) {
|
|
671
|
-
const requestType =
|
|
670
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteBytesRequestBody);
|
|
672
671
|
function wrapService(fn) {
|
|
673
672
|
return buf => {
|
|
674
673
|
const { bytes } = requestType.unpack(buf);
|
|
@@ -689,7 +688,7 @@ var writeBytes;
|
|
|
689
688
|
Object.freeze(writeBytes);
|
|
690
689
|
var writeTxt;
|
|
691
690
|
(function (writeTxt) {
|
|
692
|
-
const requestType =
|
|
691
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteTxtRequestBody);
|
|
693
692
|
function wrapService(fn) {
|
|
694
693
|
return buf => {
|
|
695
694
|
const { txt } = requestType.unpack(buf);
|
|
@@ -708,7 +707,7 @@ var writeTxt;
|
|
|
708
707
|
Object.freeze(writeTxt);
|
|
709
708
|
var writeJSON;
|
|
710
709
|
(function (writeJSON) {
|
|
711
|
-
const requestType =
|
|
710
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteJsonRequestBody);
|
|
712
711
|
function wrapService(fn) {
|
|
713
712
|
return buf => {
|
|
714
713
|
const { json } = requestType.unpack(buf);
|
|
@@ -729,7 +728,7 @@ var writeJSON;
|
|
|
729
728
|
Object.freeze(writeJSON);
|
|
730
729
|
var getByteSink;
|
|
731
730
|
(function (getByteSink) {
|
|
732
|
-
const requestType =
|
|
731
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.GetByteSinkRequestBody);
|
|
733
732
|
function wrapService(fn, expServices) {
|
|
734
733
|
return buf => {
|
|
735
734
|
const { truncateFile } = requestType.unpack(buf);
|
|
@@ -758,7 +757,7 @@ var getByteSink;
|
|
|
758
757
|
Object.freeze(getByteSink);
|
|
759
758
|
var copy;
|
|
760
759
|
(function (copy) {
|
|
761
|
-
copy.requestType =
|
|
760
|
+
copy.requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.CopyRequestBody);
|
|
762
761
|
function wrapService(fn, expServices) {
|
|
763
762
|
return buf => {
|
|
764
763
|
const { file: fRef } = copy.requestType.unpack(buf);
|
|
@@ -827,7 +826,7 @@ var vUpdateXAttrs;
|
|
|
827
826
|
Object.freeze(vUpdateXAttrs);
|
|
828
827
|
var vWriteBytes;
|
|
829
828
|
(function (vWriteBytes) {
|
|
830
|
-
const requestType =
|
|
829
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteBytesRequestBody);
|
|
831
830
|
function wrapService(fn) {
|
|
832
831
|
return buf => {
|
|
833
832
|
const { bytes } = requestType.unpack(buf);
|
|
@@ -848,7 +847,7 @@ var vWriteBytes;
|
|
|
848
847
|
Object.freeze(vWriteBytes);
|
|
849
848
|
var vWriteTxt;
|
|
850
849
|
(function (vWriteTxt) {
|
|
851
|
-
const requestType =
|
|
850
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteTxtRequestBody);
|
|
852
851
|
function wrapService(fn) {
|
|
853
852
|
return buf => {
|
|
854
853
|
const { txt } = requestType.unpack(buf);
|
|
@@ -869,7 +868,7 @@ var vWriteTxt;
|
|
|
869
868
|
Object.freeze(vWriteTxt);
|
|
870
869
|
var vWriteJSON;
|
|
871
870
|
(function (vWriteJSON) {
|
|
872
|
-
const requestType =
|
|
871
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.WriteJsonRequestBody);
|
|
873
872
|
function wrapService(fn) {
|
|
874
873
|
return buf => {
|
|
875
874
|
const { json } = requestType.unpack(buf);
|
|
@@ -890,8 +889,8 @@ var vWriteJSON;
|
|
|
890
889
|
Object.freeze(vWriteJSON);
|
|
891
890
|
var vGetByteSink;
|
|
892
891
|
(function (vGetByteSink) {
|
|
893
|
-
const requestType =
|
|
894
|
-
vGetByteSink.replyType =
|
|
892
|
+
const requestType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedGetByteSinkRequestBody);
|
|
893
|
+
vGetByteSink.replyType = protobuf_type_1.ProtoType.for(file_proto_1.file.VersionedGetByteSinkReplyBody);
|
|
895
894
|
function wrapService(fn, expServices) {
|
|
896
895
|
return buf => {
|
|
897
896
|
const { truncateFile, currentVersion } = requestType.unpack(buf);
|