@dxos/rpc 0.5.1-main.851eea2 → 0.5.1-main.85b05df
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/dist/lib/browser/index.mjs +63 -54
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +63 -54
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/rpc.d.ts +6 -2
- package/dist/types/src/rpc.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/rpc.ts +29 -22
- package/src/service.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"inject-globals:@inject-globals":{"bytes":384,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/errors.ts":{"bytes":1482,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/rpc.ts":{"bytes":
|
|
1
|
+
{"inputs":{"inject-globals:@inject-globals":{"bytes":384,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/errors.ts":{"bytes":1482,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/rpc.ts":{"bytes":61305,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/mesh/rpc/src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/service.ts":{"bytes":22389,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/core/mesh/rpc/src/rpc.ts","kind":"import-statement","original":"./rpc"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/testing.ts":{"bytes":2972,"imports":[{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/trace.ts":{"bytes":3543,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/rpc","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/core/mesh/rpc/src/index.ts":{"bytes":786,"imports":[{"path":"packages/core/mesh/rpc/src/rpc.ts","kind":"import-statement","original":"./rpc"},{"path":"packages/core/mesh/rpc/src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"packages/core/mesh/rpc/src/service.ts","kind":"import-statement","original":"./service"},{"path":"packages/core/mesh/rpc/src/testing.ts","kind":"import-statement","original":"./testing"},{"path":"packages/core/mesh/rpc/src/trace.ts","kind":"import-statement","original":"./trace"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"packages/core/mesh/rpc/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":42635},"packages/core/mesh/rpc/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/codec-protobuf","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/rpc","kind":"import-statement","external":true}],"exports":["PortTracer","ProtoRpcPeer","RpcPeer","createBundledRpcClient","createBundledRpcServer","createLinkedPorts","createProtoRpcPeer","createRpcClient","createRpcServer","createServiceBundle","decodeRpcError","parseMethodName"],"entryPoint":"packages/core/mesh/rpc/src/index.ts","inputs":{"inject-globals:@inject-globals":{"bytesInOutput":79},"packages/core/mesh/rpc/src/rpc.ts":{"bytesInOutput":17929},"packages/core/mesh/rpc/src/errors.ts":{"bytesInOutput":228},"packages/core/mesh/rpc/src/index.ts":{"bytesInOutput":0},"packages/core/mesh/rpc/src/service.ts":{"bytesInOutput":4242},"packages/core/mesh/rpc/src/testing.ts":{"bytesInOutput":528},"packages/core/mesh/rpc/src/trace.ts":{"bytesInOutput":732}},"bytes":24327}}}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
62
62
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/rpc/src/rpc.ts";
|
|
63
63
|
var DEFAULT_TIMEOUT = 3e3;
|
|
64
64
|
var BYE_SEND_TIMEOUT = 2e3;
|
|
65
|
+
var DEBUG_CALLS = true;
|
|
65
66
|
var CLOSE_TIMEOUT = 3e3;
|
|
66
67
|
var PendingRpcRequest = class {
|
|
67
68
|
constructor(resolve, reject, stream) {
|
|
@@ -112,7 +113,7 @@ var RpcPeer = class {
|
|
|
112
113
|
} catch (err) {
|
|
113
114
|
import_log.log.catch(err, void 0, {
|
|
114
115
|
F: __dxlog_file,
|
|
115
|
-
L:
|
|
116
|
+
L: 153,
|
|
116
117
|
S: this,
|
|
117
118
|
C: (f, a) => f(...a)
|
|
118
119
|
});
|
|
@@ -124,9 +125,11 @@ var RpcPeer = class {
|
|
|
124
125
|
this._remoteOpenTrigger.wake();
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
|
-
(0, import_log.log)("sending open message",
|
|
128
|
+
(0, import_log.log)("sending open message", {
|
|
129
|
+
state: this._state
|
|
130
|
+
}, {
|
|
128
131
|
F: __dxlog_file,
|
|
129
|
-
L:
|
|
132
|
+
L: 165,
|
|
130
133
|
S: this,
|
|
131
134
|
C: (f, a) => f(...a)
|
|
132
135
|
});
|
|
@@ -141,7 +144,7 @@ var RpcPeer = class {
|
|
|
141
144
|
open: true
|
|
142
145
|
}).catch((err) => import_log.log.warn(err, void 0, {
|
|
143
146
|
F: __dxlog_file,
|
|
144
|
-
L:
|
|
147
|
+
L: 174,
|
|
145
148
|
S: this,
|
|
146
149
|
C: (f, a) => f(...a)
|
|
147
150
|
}));
|
|
@@ -151,13 +154,14 @@ var RpcPeer = class {
|
|
|
151
154
|
this._closingTrigger.wait()
|
|
152
155
|
]);
|
|
153
156
|
this._clearOpenInterval?.();
|
|
154
|
-
this._state = "OPENED";
|
|
155
157
|
if (this._state !== "OPENED") {
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
|
-
(0, import_log.log)("sending second open message",
|
|
160
|
+
(0, import_log.log)("sending second open message", {
|
|
161
|
+
state: this._state
|
|
162
|
+
}, {
|
|
159
163
|
F: __dxlog_file,
|
|
160
|
-
L:
|
|
164
|
+
L: 188,
|
|
161
165
|
S: this,
|
|
162
166
|
C: (f, a) => f(...a)
|
|
163
167
|
});
|
|
@@ -187,7 +191,7 @@ var RpcPeer = class {
|
|
|
187
191
|
err
|
|
188
192
|
}, {
|
|
189
193
|
F: __dxlog_file,
|
|
190
|
-
L:
|
|
194
|
+
L: 210,
|
|
191
195
|
S: this,
|
|
192
196
|
C: (f, a) => f(...a)
|
|
193
197
|
});
|
|
@@ -195,7 +199,7 @@ var RpcPeer = class {
|
|
|
195
199
|
try {
|
|
196
200
|
(0, import_log.log)("closing waiting on bye", void 0, {
|
|
197
201
|
F: __dxlog_file,
|
|
198
|
-
L:
|
|
202
|
+
L: 213,
|
|
199
203
|
S: this,
|
|
200
204
|
C: (f, a) => f(...a)
|
|
201
205
|
});
|
|
@@ -207,7 +211,7 @@ var RpcPeer = class {
|
|
|
207
211
|
err
|
|
208
212
|
}, {
|
|
209
213
|
F: __dxlog_file,
|
|
210
|
-
L:
|
|
214
|
+
L: 216,
|
|
211
215
|
S: this,
|
|
212
216
|
C: (f, a) => f(...a)
|
|
213
217
|
});
|
|
@@ -247,11 +251,11 @@ var RpcPeer = class {
|
|
|
247
251
|
const decoded = RpcMessage.decode(msg, {
|
|
248
252
|
preserveAny: true
|
|
249
253
|
});
|
|
250
|
-
(0, import_log.log)("received message", {
|
|
254
|
+
DEBUG_CALLS && (0, import_log.log)("received message", {
|
|
251
255
|
type: Object.keys(decoded)[0]
|
|
252
256
|
}, {
|
|
253
257
|
F: __dxlog_file,
|
|
254
|
-
L:
|
|
258
|
+
L: 260,
|
|
255
259
|
S: this,
|
|
256
260
|
C: (f, a) => f(...a)
|
|
257
261
|
});
|
|
@@ -259,7 +263,7 @@ var RpcPeer = class {
|
|
|
259
263
|
if (this._state !== "OPENED" && this._state !== "OPENING") {
|
|
260
264
|
(0, import_log.log)("received request while closed", void 0, {
|
|
261
265
|
F: __dxlog_file,
|
|
262
|
-
L:
|
|
266
|
+
L: 264,
|
|
263
267
|
S: this,
|
|
264
268
|
C: (f, a) => f(...a)
|
|
265
269
|
});
|
|
@@ -277,7 +281,7 @@ var RpcPeer = class {
|
|
|
277
281
|
method: req.method
|
|
278
282
|
}, {
|
|
279
283
|
F: __dxlog_file,
|
|
280
|
-
L:
|
|
284
|
+
L: 276,
|
|
281
285
|
S: this,
|
|
282
286
|
C: (f, a) => f(...a)
|
|
283
287
|
});
|
|
@@ -289,7 +293,7 @@ var RpcPeer = class {
|
|
|
289
293
|
close: response.close
|
|
290
294
|
}, {
|
|
291
295
|
F: __dxlog_file,
|
|
292
|
-
L:
|
|
296
|
+
L: 278,
|
|
293
297
|
S: this,
|
|
294
298
|
C: (f, a) => f(...a)
|
|
295
299
|
});
|
|
@@ -298,29 +302,29 @@ var RpcPeer = class {
|
|
|
298
302
|
}).catch((err) => {
|
|
299
303
|
import_log.log.warn("failed during close", err, {
|
|
300
304
|
F: __dxlog_file,
|
|
301
|
-
L:
|
|
305
|
+
L: 286,
|
|
302
306
|
S: this,
|
|
303
307
|
C: (f, a) => f(...a)
|
|
304
308
|
});
|
|
305
309
|
});
|
|
306
310
|
});
|
|
307
311
|
} else {
|
|
308
|
-
(0, import_log.log)("request", {
|
|
312
|
+
DEBUG_CALLS && (0, import_log.log)("request", {
|
|
309
313
|
method: req.method
|
|
310
314
|
}, {
|
|
311
315
|
F: __dxlog_file,
|
|
312
|
-
L:
|
|
316
|
+
L: 290,
|
|
313
317
|
S: this,
|
|
314
318
|
C: (f, a) => f(...a)
|
|
315
319
|
});
|
|
316
320
|
const response = await this._callHandler(req);
|
|
317
|
-
(0, import_log.log)("sending response", {
|
|
321
|
+
DEBUG_CALLS && (0, import_log.log)("sending response", {
|
|
318
322
|
method: req.method,
|
|
319
323
|
response: response.payload?.type_url,
|
|
320
324
|
error: response.error
|
|
321
325
|
}, {
|
|
322
326
|
F: __dxlog_file,
|
|
323
|
-
L:
|
|
327
|
+
L: 293,
|
|
324
328
|
S: this,
|
|
325
329
|
C: (f, a) => f(...a)
|
|
326
330
|
});
|
|
@@ -332,7 +336,7 @@ var RpcPeer = class {
|
|
|
332
336
|
if (this._state !== "OPENED") {
|
|
333
337
|
(0, import_log.log)("received response while closed", void 0, {
|
|
334
338
|
F: __dxlog_file,
|
|
335
|
-
L:
|
|
339
|
+
L: 302,
|
|
336
340
|
S: this,
|
|
337
341
|
C: (f, a) => f(...a)
|
|
338
342
|
});
|
|
@@ -341,7 +345,7 @@ var RpcPeer = class {
|
|
|
341
345
|
const responseId = decoded.response.id;
|
|
342
346
|
(0, import_invariant.invariant)(typeof responseId === "number", void 0, {
|
|
343
347
|
F: __dxlog_file,
|
|
344
|
-
L:
|
|
348
|
+
L: 307,
|
|
345
349
|
S: this,
|
|
346
350
|
A: [
|
|
347
351
|
"typeof responseId === 'number'",
|
|
@@ -353,7 +357,7 @@ var RpcPeer = class {
|
|
|
353
357
|
responseId
|
|
354
358
|
}, {
|
|
355
359
|
F: __dxlog_file,
|
|
356
|
-
L:
|
|
360
|
+
L: 309,
|
|
357
361
|
S: this,
|
|
358
362
|
C: (f, a) => f(...a)
|
|
359
363
|
});
|
|
@@ -363,19 +367,21 @@ var RpcPeer = class {
|
|
|
363
367
|
if (!item.stream) {
|
|
364
368
|
this._outgoingRequests.delete(responseId);
|
|
365
369
|
}
|
|
366
|
-
(0, import_log.log)("response", {
|
|
370
|
+
DEBUG_CALLS && (0, import_log.log)("response", {
|
|
367
371
|
type_url: decoded.response.payload?.type_url
|
|
368
372
|
}, {
|
|
369
373
|
F: __dxlog_file,
|
|
370
|
-
L:
|
|
374
|
+
L: 319,
|
|
371
375
|
S: this,
|
|
372
376
|
C: (f, a) => f(...a)
|
|
373
377
|
});
|
|
374
378
|
item.resolve(decoded.response);
|
|
375
379
|
} else if (decoded.open) {
|
|
376
|
-
(0, import_log.log)("received open message",
|
|
380
|
+
(0, import_log.log)("received open message", {
|
|
381
|
+
state: this._state
|
|
382
|
+
}, {
|
|
377
383
|
F: __dxlog_file,
|
|
378
|
-
L:
|
|
384
|
+
L: 322,
|
|
379
385
|
S: this,
|
|
380
386
|
C: (f, a) => f(...a)
|
|
381
387
|
});
|
|
@@ -386,21 +392,24 @@ var RpcPeer = class {
|
|
|
386
392
|
openAck: true
|
|
387
393
|
});
|
|
388
394
|
} else if (decoded.openAck) {
|
|
389
|
-
(0, import_log.log)("received openAck message",
|
|
395
|
+
(0, import_log.log)("received openAck message", {
|
|
396
|
+
state: this._state
|
|
397
|
+
}, {
|
|
390
398
|
F: __dxlog_file,
|
|
391
|
-
L:
|
|
399
|
+
L: 329,
|
|
392
400
|
S: this,
|
|
393
401
|
C: (f, a) => f(...a)
|
|
394
402
|
});
|
|
395
403
|
if (this._params.noHandshake) {
|
|
396
404
|
return;
|
|
397
405
|
}
|
|
406
|
+
this._state = "OPENED";
|
|
398
407
|
this._remoteOpenTrigger.wake();
|
|
399
408
|
} else if (decoded.streamClose) {
|
|
400
409
|
if (this._state !== "OPENED") {
|
|
401
410
|
(0, import_log.log)("received stream close while closed", void 0, {
|
|
402
411
|
F: __dxlog_file,
|
|
403
|
-
L:
|
|
412
|
+
L: 338,
|
|
404
413
|
S: this,
|
|
405
414
|
C: (f, a) => f(...a)
|
|
406
415
|
});
|
|
@@ -410,13 +419,13 @@ var RpcPeer = class {
|
|
|
410
419
|
id: decoded.streamClose.id
|
|
411
420
|
}, {
|
|
412
421
|
F: __dxlog_file,
|
|
413
|
-
L:
|
|
422
|
+
L: 342,
|
|
414
423
|
S: this,
|
|
415
424
|
C: (f, a) => f(...a)
|
|
416
425
|
});
|
|
417
426
|
(0, import_invariant.invariant)(typeof decoded.streamClose.id === "number", void 0, {
|
|
418
427
|
F: __dxlog_file,
|
|
419
|
-
L:
|
|
428
|
+
L: 343,
|
|
420
429
|
S: this,
|
|
421
430
|
A: [
|
|
422
431
|
"typeof decoded.streamClose.id === 'number'",
|
|
@@ -429,7 +438,7 @@ var RpcPeer = class {
|
|
|
429
438
|
id: decoded.streamClose.id
|
|
430
439
|
}, {
|
|
431
440
|
F: __dxlog_file,
|
|
432
|
-
L:
|
|
441
|
+
L: 346,
|
|
433
442
|
S: this,
|
|
434
443
|
C: (f, a) => f(...a)
|
|
435
444
|
});
|
|
@@ -442,7 +451,7 @@ var RpcPeer = class {
|
|
|
442
451
|
if (this._state !== "CLOSING" && this._state !== "CLOSED") {
|
|
443
452
|
(0, import_log.log)("replying to bye", void 0, {
|
|
444
453
|
F: __dxlog_file,
|
|
445
|
-
L:
|
|
454
|
+
L: 356,
|
|
446
455
|
S: this,
|
|
447
456
|
C: (f, a) => f(...a)
|
|
448
457
|
});
|
|
@@ -458,7 +467,7 @@ var RpcPeer = class {
|
|
|
458
467
|
msg
|
|
459
468
|
}, {
|
|
460
469
|
F: __dxlog_file,
|
|
461
|
-
L:
|
|
470
|
+
L: 364,
|
|
462
471
|
S: this,
|
|
463
472
|
C: (f, a) => f(...a)
|
|
464
473
|
});
|
|
@@ -470,11 +479,11 @@ var RpcPeer = class {
|
|
|
470
479
|
* Peer should be open before making this call.
|
|
471
480
|
*/
|
|
472
481
|
async call(method, request, options) {
|
|
473
|
-
(0, import_log.log)("calling", {
|
|
482
|
+
DEBUG_CALLS && (0, import_log.log)("calling", {
|
|
474
483
|
method
|
|
475
484
|
}, {
|
|
476
485
|
F: __dxlog_file,
|
|
477
|
-
L:
|
|
486
|
+
L: 374,
|
|
478
487
|
S: this,
|
|
479
488
|
C: (f, a) => f(...a)
|
|
480
489
|
});
|
|
@@ -501,7 +510,7 @@ var RpcPeer = class {
|
|
|
501
510
|
response = await waiting;
|
|
502
511
|
(0, import_invariant.invariant)(response.id === id, void 0, {
|
|
503
512
|
F: __dxlog_file,
|
|
504
|
-
L:
|
|
513
|
+
L: 399,
|
|
505
514
|
S: this,
|
|
506
515
|
A: [
|
|
507
516
|
"response.id === id",
|
|
@@ -580,7 +589,7 @@ ${stack.getStack()}`;
|
|
|
580
589
|
}).catch((err) => {
|
|
581
590
|
import_log.log.catch(err, void 0, {
|
|
582
591
|
F: __dxlog_file,
|
|
583
|
-
L:
|
|
592
|
+
L: 472,
|
|
584
593
|
S: this,
|
|
585
594
|
C: (f, a) => f(...a)
|
|
586
595
|
});
|
|
@@ -589,11 +598,11 @@ ${stack.getStack()}`;
|
|
|
589
598
|
});
|
|
590
599
|
}
|
|
591
600
|
async _sendMessage(message, timeout) {
|
|
592
|
-
(0, import_log.log)("sending message", {
|
|
601
|
+
DEBUG_CALLS && (0, import_log.log)("sending message", {
|
|
593
602
|
type: Object.keys(message)[0]
|
|
594
603
|
}, {
|
|
595
604
|
F: __dxlog_file,
|
|
596
|
-
L:
|
|
605
|
+
L: 479,
|
|
597
606
|
S: this,
|
|
598
607
|
C: (f, a) => f(...a)
|
|
599
608
|
});
|
|
@@ -605,7 +614,7 @@ ${stack.getStack()}`;
|
|
|
605
614
|
try {
|
|
606
615
|
(0, import_invariant.invariant)(typeof req.id === "number", void 0, {
|
|
607
616
|
F: __dxlog_file,
|
|
608
|
-
L:
|
|
617
|
+
L: 485,
|
|
609
618
|
S: this,
|
|
610
619
|
A: [
|
|
611
620
|
"typeof req.id === 'number'",
|
|
@@ -614,7 +623,7 @@ ${stack.getStack()}`;
|
|
|
614
623
|
});
|
|
615
624
|
(0, import_invariant.invariant)(req.payload, void 0, {
|
|
616
625
|
F: __dxlog_file,
|
|
617
|
-
L:
|
|
626
|
+
L: 486,
|
|
618
627
|
S: this,
|
|
619
628
|
A: [
|
|
620
629
|
"req.payload",
|
|
@@ -623,14 +632,14 @@ ${stack.getStack()}`;
|
|
|
623
632
|
});
|
|
624
633
|
(0, import_invariant.invariant)(req.method, void 0, {
|
|
625
634
|
F: __dxlog_file,
|
|
626
|
-
L:
|
|
635
|
+
L: 487,
|
|
627
636
|
S: this,
|
|
628
637
|
A: [
|
|
629
638
|
"req.method",
|
|
630
639
|
""
|
|
631
640
|
]
|
|
632
641
|
});
|
|
633
|
-
const response = await this._params.callHandler(req.method, req.payload);
|
|
642
|
+
const response = await this._params.callHandler(req.method, req.payload, this._params.handlerRpcOptions);
|
|
634
643
|
return {
|
|
635
644
|
id: req.id,
|
|
636
645
|
payload: response
|
|
@@ -646,7 +655,7 @@ ${stack.getStack()}`;
|
|
|
646
655
|
try {
|
|
647
656
|
(0, import_invariant.invariant)(this._params.streamHandler, "Requests with streaming responses are not supported.", {
|
|
648
657
|
F: __dxlog_file,
|
|
649
|
-
L:
|
|
658
|
+
L: 504,
|
|
650
659
|
S: this,
|
|
651
660
|
A: [
|
|
652
661
|
"this._params.streamHandler",
|
|
@@ -655,7 +664,7 @@ ${stack.getStack()}`;
|
|
|
655
664
|
});
|
|
656
665
|
(0, import_invariant.invariant)(typeof req.id === "number", void 0, {
|
|
657
666
|
F: __dxlog_file,
|
|
658
|
-
L:
|
|
667
|
+
L: 505,
|
|
659
668
|
S: this,
|
|
660
669
|
A: [
|
|
661
670
|
"typeof req.id === 'number'",
|
|
@@ -664,7 +673,7 @@ ${stack.getStack()}`;
|
|
|
664
673
|
});
|
|
665
674
|
(0, import_invariant.invariant)(req.payload, void 0, {
|
|
666
675
|
F: __dxlog_file,
|
|
667
|
-
L:
|
|
676
|
+
L: 506,
|
|
668
677
|
S: this,
|
|
669
678
|
A: [
|
|
670
679
|
"req.payload",
|
|
@@ -673,14 +682,14 @@ ${stack.getStack()}`;
|
|
|
673
682
|
});
|
|
674
683
|
(0, import_invariant.invariant)(req.method, void 0, {
|
|
675
684
|
F: __dxlog_file,
|
|
676
|
-
L:
|
|
685
|
+
L: 507,
|
|
677
686
|
S: this,
|
|
678
687
|
A: [
|
|
679
688
|
"req.method",
|
|
680
689
|
""
|
|
681
690
|
]
|
|
682
691
|
});
|
|
683
|
-
const responseStream = this._params.streamHandler(req.method, req.payload);
|
|
692
|
+
const responseStream = this._params.streamHandler(req.method, req.payload, this._params.handlerRpcOptions);
|
|
684
693
|
responseStream.onReady(() => {
|
|
685
694
|
callback({
|
|
686
695
|
id: req.id,
|
|
@@ -767,19 +776,19 @@ var createProtoRpcPeer = ({ requested, exposed, handlers, encodingOptions, ...re
|
|
|
767
776
|
}
|
|
768
777
|
const peer = new RpcPeer({
|
|
769
778
|
...rest,
|
|
770
|
-
callHandler: (method, request) => {
|
|
779
|
+
callHandler: (method, request, options) => {
|
|
771
780
|
const [serviceName, methodName] = parseMethodName(method);
|
|
772
781
|
if (!exposedRpcs[serviceName]) {
|
|
773
782
|
throw new Error(`Service not supported: ${serviceName}`);
|
|
774
783
|
}
|
|
775
|
-
return exposedRpcs[serviceName].call(methodName, request);
|
|
784
|
+
return exposedRpcs[serviceName].call(methodName, request, options);
|
|
776
785
|
},
|
|
777
|
-
streamHandler: (method, request) => {
|
|
786
|
+
streamHandler: (method, request, options) => {
|
|
778
787
|
const [serviceName, methodName] = parseMethodName(method);
|
|
779
788
|
if (!exposedRpcs[serviceName]) {
|
|
780
789
|
throw new Error(`Service not supported: ${serviceName}`);
|
|
781
790
|
}
|
|
782
|
-
return exposedRpcs[serviceName].callStream(methodName, request);
|
|
791
|
+
return exposedRpcs[serviceName].callStream(methodName, request, options);
|
|
783
792
|
}
|
|
784
793
|
});
|
|
785
794
|
const requestedRpcs = {};
|