core-3nweb-client-lib 0.31.4 → 0.31.6
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/common-caps.d.ts +2 -4
- package/build/core/index.js +1 -1
- package/build/core-ipc/common-caps.js +37 -3
- package/build/core-ipc/file.js +1 -1
- package/build/core-ipc/fs.js +1 -1
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +5 -2
- package/build/ipc-via-protobuf/connector-clients-side.js +12 -7
- package/build/ipc-via-protobuf/connector.d.ts +5 -2
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ declare namespace web3n.caps.common {
|
|
|
32
32
|
mail?: MailCAPSetting;
|
|
33
33
|
storage?: StorageCAPSetting;
|
|
34
34
|
mailerid?: true;
|
|
35
|
-
|
|
35
|
+
logToPlatform?: true;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
interface StorageCAPSetting {
|
|
@@ -65,12 +65,10 @@ declare namespace web3n.caps.common {
|
|
|
65
65
|
receivingFrom?: 'all' | { whitelist: string[]; };
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
type LogCAPSetting = 'all';
|
|
69
|
-
|
|
70
68
|
interface W3N {
|
|
69
|
+
log: Logger;
|
|
71
70
|
mail?: asmail.Service;
|
|
72
71
|
storage?: storage.Service;
|
|
73
|
-
log?: Logger;
|
|
74
72
|
mailerid?: mailerid.Service;
|
|
75
73
|
}
|
|
76
74
|
|
package/build/core/index.js
CHANGED
|
@@ -44,15 +44,49 @@ function makeW3Nclient(clientSide, extraCAPs) {
|
|
|
44
44
|
mailerid: mailerid_cap_ipc_1.makeMailerIdCaller,
|
|
45
45
|
storage: storage_cap_ipc_1.makeStorageCaller,
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const clientW3N = (0, generic_1.makeClientSide)(clientSide, mainCAPs, extraCAPs);
|
|
48
|
+
addLogToConsoleIfNoCap(clientW3N);
|
|
49
|
+
return clientW3N;
|
|
48
50
|
}
|
|
49
|
-
function promiseW3Nclient(clientSide, extraCAPs) {
|
|
51
|
+
async function promiseW3Nclient(clientSide, extraCAPs) {
|
|
50
52
|
const mainCAPs = {
|
|
51
53
|
log: log_cap_1.makeLogCaller,
|
|
52
54
|
mail: asmail_cap_ipc_1.makeASMailCaller,
|
|
53
55
|
mailerid: mailerid_cap_ipc_1.makeMailerIdCaller,
|
|
54
56
|
storage: storage_cap_ipc_1.promiseStorageCaller,
|
|
55
57
|
};
|
|
56
|
-
|
|
58
|
+
const clientW3N = await (0, generic_1.promiseClientSide)(clientSide, mainCAPs, extraCAPs);
|
|
59
|
+
addLogToConsoleIfNoCap(clientW3N);
|
|
60
|
+
return clientW3N;
|
|
61
|
+
}
|
|
62
|
+
function addLogToConsoleIfNoCap(clientW3N) {
|
|
63
|
+
if (!clientW3N.log) {
|
|
64
|
+
clientW3N.log = async (type, msg, err) => {
|
|
65
|
+
if (type === 'error') {
|
|
66
|
+
if (err === undefined) {
|
|
67
|
+
console.error(msg);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
console.error(msg, err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (type === 'warning') {
|
|
74
|
+
if (err === undefined) {
|
|
75
|
+
console.warn(msg);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
console.warn(msg, err);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (err === undefined) {
|
|
83
|
+
console.log(msg);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.log(msg, err);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
57
91
|
}
|
|
58
92
|
Object.freeze(exports);
|
package/build/core-ipc/file.js
CHANGED
package/build/core-ipc/fs.js
CHANGED
|
@@ -25,11 +25,14 @@ export declare class ClientsSideImpl implements ClientsSide {
|
|
|
25
25
|
private setupFnCall;
|
|
26
26
|
startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
|
|
27
27
|
startObservableCall(path: string[], req: EnvelopeBody, obs: Subject<EnvelopeBody>): () => void;
|
|
28
|
-
registerClientDrop(o: any, srvRef: ObjectReference<any
|
|
28
|
+
registerClientDrop(o: any, srvRef: ObjectReference<any>, reconstructData?: any): void;
|
|
29
29
|
private doOnClientObjDrop;
|
|
30
30
|
private sendObjDropMsg;
|
|
31
31
|
srvRefOf(clientObj: any): ObjectReference<any>;
|
|
32
|
-
findCallingObjByRef<T>(ref: ObjectReference<any>):
|
|
32
|
+
findCallingObjByRef<T, R>(ref: ObjectReference<any>): {
|
|
33
|
+
obj?: T;
|
|
34
|
+
reconstructData?: R;
|
|
35
|
+
} | undefined;
|
|
33
36
|
listObj(path: string[]): string[];
|
|
34
37
|
listObjAsync(path: string[]): Promise<string[]>;
|
|
35
38
|
}
|
|
@@ -211,10 +211,12 @@ class ClientsSideImpl {
|
|
|
211
211
|
throw err;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
registerClientDrop(o, srvRef) {
|
|
214
|
+
registerClientDrop(o, srvRef, reconstructData) {
|
|
215
215
|
o._isObjectFromCore = true;
|
|
216
216
|
this.srvFinalRegistry.register(o, srvRef);
|
|
217
|
-
this.weakSrvByRefs.set(srvRef.path[0],
|
|
217
|
+
this.weakSrvByRefs.set(srvRef.path[0], {
|
|
218
|
+
weakRef: new WeakRef(o), reconstructData
|
|
219
|
+
});
|
|
218
220
|
this.srvRefs.set(o, srvRef);
|
|
219
221
|
}
|
|
220
222
|
doOnClientObjDrop(srvRef) {
|
|
@@ -237,13 +239,16 @@ class ClientsSideImpl {
|
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
findCallingObjByRef(ref) {
|
|
240
|
-
const
|
|
241
|
-
if (!
|
|
242
|
+
const found = this.weakSrvByRefs.get(ref.path[0]);
|
|
243
|
+
if (!found) {
|
|
242
244
|
return;
|
|
243
245
|
}
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
return
|
|
246
|
+
const obj = found.weakRef.deref();
|
|
247
|
+
if (obj) {
|
|
248
|
+
return { obj };
|
|
249
|
+
}
|
|
250
|
+
else if (found.reconstructData) {
|
|
251
|
+
return { reconstructData: found.reconstructData };
|
|
247
252
|
}
|
|
248
253
|
else {
|
|
249
254
|
this.weakSrvByRefs.delete(ref.path[0]);
|
|
@@ -24,11 +24,14 @@ export interface ServicesSide {
|
|
|
24
24
|
export interface Caller {
|
|
25
25
|
startPromiseCall(path: string[], req: EnvelopeBody): Promise<EnvelopeBody>;
|
|
26
26
|
startObservableCall(path: string[], req: EnvelopeBody, obs: SubjectLike<EnvelopeBody>): () => void;
|
|
27
|
-
registerClientDrop(o: any, srvRef: ObjectReference<any
|
|
27
|
+
registerClientDrop(o: any, srvRef: ObjectReference<any>, reconstructData?: any): void;
|
|
28
28
|
srvRefOf(clientObj: any): ObjectReference<any>;
|
|
29
29
|
listObj?: (path: string[]) => string[];
|
|
30
30
|
listObjAsync?: (path: string[]) => Promise<string[]>;
|
|
31
|
-
findCallingObjByRef<T>(ref: ObjectReference<any>):
|
|
31
|
+
findCallingObjByRef<T, R>(ref: ObjectReference<any>): {
|
|
32
|
+
obj?: T;
|
|
33
|
+
reconstructData?: R;
|
|
34
|
+
} | undefined;
|
|
32
35
|
}
|
|
33
36
|
export interface ObjectFromCore {
|
|
34
37
|
_isObjectFromCore: true;
|