wenay-common2 1.0.40 → 1.0.42
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.
|
@@ -14,11 +14,6 @@ function createClient(socket, key, opts) {
|
|
|
14
14
|
let strictData = {};
|
|
15
15
|
let strictWaiters = [];
|
|
16
16
|
let debug = false;
|
|
17
|
-
const unpackResult = (v) => {
|
|
18
|
-
if (!v)
|
|
19
|
-
return v;
|
|
20
|
-
return v;
|
|
21
|
-
};
|
|
22
17
|
socket.on(key, (msg) => {
|
|
23
18
|
if (!Array.isArray(msg))
|
|
24
19
|
return;
|
|
@@ -33,11 +28,11 @@ function createClient(socket, key, opts) {
|
|
|
33
28
|
callbacks.delete(cbId);
|
|
34
29
|
pool.release(cbId);
|
|
35
30
|
}
|
|
36
|
-
msg[3] ? req.fail(msg[3]) : req.ok(unpackResult(msg[2]));
|
|
31
|
+
msg[3] ? req.fail(msg[3]) : req.ok((0, rpc_walk_1.unpackResult)(msg[2]));
|
|
37
32
|
break;
|
|
38
33
|
}
|
|
39
34
|
case rpc_protocol_1.Pkt.CB: {
|
|
40
|
-
callbacks.get(msg[1])?.(...(msg[2] || []));
|
|
35
|
+
callbacks.get(msg[1])?.(...(msg[2] || []).map(rpc_walk_1.unpackResult));
|
|
41
36
|
break;
|
|
42
37
|
}
|
|
43
38
|
case rpc_protocol_1.Pkt.CB_END: {
|
|
@@ -189,7 +189,7 @@ function createServer(socket, key, target, hooks, limits) {
|
|
|
189
189
|
send([rpc_protocol_1.Pkt.RESP, reqId, (0, rpc_walk_1.packResult)(current)]);
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
|
-
const args = (0, rpc_walk_1.unpack)(rawArgsOrSteps, (cbId, cbArgs) => send([rpc_protocol_1.Pkt.CB, cbId, cbArgs]), (cbId) => send([rpc_protocol_1.Pkt.CB_END, cbId]), lim);
|
|
192
|
+
const args = (0, rpc_walk_1.unpack)(rawArgsOrSteps, (cbId, cbArgs) => send([rpc_protocol_1.Pkt.CB, cbId, cbArgs.map(rpc_walk_1.packResult)]), (cbId) => send([rpc_protocol_1.Pkt.CB_END, cbId]), lim);
|
|
193
193
|
const res = await fn.apply(ctx, args);
|
|
194
194
|
if (wait)
|
|
195
195
|
send([rpc_protocol_1.Pkt.RESP, reqId, (0, rpc_walk_1.packResult)(res)]);
|
|
@@ -38,6 +38,8 @@ function walk(val, onLeaf, lim, depth = 0) {
|
|
|
38
38
|
}
|
|
39
39
|
if (val == null || typeof val !== "object")
|
|
40
40
|
return onLeaf(val);
|
|
41
|
+
if (val instanceof Date || val instanceof Map || val instanceof Set || val instanceof RegExp)
|
|
42
|
+
return onLeaf(val);
|
|
41
43
|
if (ALL_MARKERS.has(Object.keys(val)[0]))
|
|
42
44
|
return onLeaf(val);
|
|
43
45
|
if (Array.isArray(val)) {
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|