@dxos/rpc 0.5.1-next.638da00 → 0.5.1-next.65aaa36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/rpc",
3
- "version": "0.5.1-next.638da00",
3
+ "version": "0.5.1-next.65aaa36",
4
4
  "description": "A lightweight, transport-agnostic RPC implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -16,14 +16,14 @@
16
16
  "src"
17
17
  ],
18
18
  "dependencies": {
19
- "@dxos/async": "0.5.1-next.638da00",
20
- "@dxos/debug": "0.5.1-next.638da00",
21
- "@dxos/codec-protobuf": "0.5.1-next.638da00",
22
- "@dxos/log": "0.5.1-next.638da00",
23
- "@dxos/node-std": "0.5.1-next.638da00",
24
- "@dxos/invariant": "0.5.1-next.638da00",
25
- "@dxos/protocols": "0.5.1-next.638da00",
26
- "@dxos/util": "0.5.1-next.638da00"
19
+ "@dxos/async": "0.5.1-next.65aaa36",
20
+ "@dxos/codec-protobuf": "0.5.1-next.65aaa36",
21
+ "@dxos/debug": "0.5.1-next.65aaa36",
22
+ "@dxos/log": "0.5.1-next.65aaa36",
23
+ "@dxos/invariant": "0.5.1-next.65aaa36",
24
+ "@dxos/node-std": "0.5.1-next.65aaa36",
25
+ "@dxos/protocols": "0.5.1-next.65aaa36",
26
+ "@dxos/util": "0.5.1-next.65aaa36"
27
27
  },
28
28
  "devDependencies": {
29
29
  "earljs": "~0.1.10",
package/src/rpc.ts CHANGED
@@ -28,18 +28,13 @@ export interface RpcPeerOptions {
28
28
  */
29
29
  timeout?: number;
30
30
 
31
- callHandler: (method: string, request: Any, options?: RequestOptions) => MaybePromise<Any>;
32
- streamHandler?: (method: string, request: Any, options?: RequestOptions) => Stream<Any>;
31
+ callHandler: (method: string, request: Any) => MaybePromise<Any>;
32
+ streamHandler?: (method: string, request: Any) => Stream<Any>;
33
33
 
34
34
  /**
35
35
  * Do not require or send handshake messages.
36
36
  */
37
37
  noHandshake?: boolean;
38
-
39
- /**
40
- * What options get passed to the `callHandler` and `streamHandler`.
41
- */
42
- handlerRpcOptions?: RequestOptions;
43
38
  }
44
39
 
45
40
  /**
@@ -486,7 +481,7 @@ export class RpcPeer {
486
481
  invariant(req.payload);
487
482
  invariant(req.method);
488
483
 
489
- const response = await this._params.callHandler(req.method, req.payload, this._params.handlerRpcOptions);
484
+ const response = await this._params.callHandler(req.method, req.payload);
490
485
  return {
491
486
  id: req.id,
492
487
  payload: response,
@@ -506,7 +501,7 @@ export class RpcPeer {
506
501
  invariant(req.payload);
507
502
  invariant(req.method);
508
503
 
509
- const responseStream = this._params.streamHandler(req.method, req.payload, this._params.handlerRpcOptions);
504
+ const responseStream = this._params.streamHandler(req.method, req.payload);
510
505
  responseStream.onReady(() => {
511
506
  callback({
512
507
  id: req.id,
package/src/service.ts CHANGED
@@ -103,22 +103,22 @@ export const createProtoRpcPeer = <Client = {}, Server = {}>({
103
103
  const peer = new RpcPeer({
104
104
  ...rest,
105
105
 
106
- callHandler: (method, request, options) => {
106
+ callHandler: (method, request) => {
107
107
  const [serviceName, methodName] = parseMethodName(method);
108
108
  if (!exposedRpcs[serviceName]) {
109
109
  throw new Error(`Service not supported: ${serviceName}`);
110
110
  }
111
111
 
112
- return exposedRpcs[serviceName].call(methodName, request, options);
112
+ return exposedRpcs[serviceName].call(methodName, request);
113
113
  },
114
114
 
115
- streamHandler: (method, request, options) => {
115
+ streamHandler: (method, request) => {
116
116
  const [serviceName, methodName] = parseMethodName(method);
117
117
  if (!exposedRpcs[serviceName]) {
118
118
  throw new Error(`Service not supported: ${serviceName}`);
119
119
  }
120
120
 
121
- return exposedRpcs[serviceName].callStream(methodName, request, options);
121
+ return exposedRpcs[serviceName].callStream(methodName, request);
122
122
  },
123
123
  });
124
124