Skip to content

Type Alias: JSONRPCMappingOptions ​

JSONRPCMappingOptions = object

How jsonRPCServiceEntrypoint maps a JSON-RPC request to a service action's pattern and input.

Properties ​

methodField? ​

optional methodField?: string

The pattern field receiving the request's method: with 'method', {"method": "user.get", "params": {"id": 1}} is dispatched as {method: 'user.get', id: 1}, the action declared with @ServiceAction({method: 'user.get'}).

Default ​

ts
'method'

positionalParams? ​

optional positionalParams?: string

The input field receiving the params given by position (an array): with 'args', {"method": "sum", "params": [1, 2]} is dispatched as {method: 'sum', args: [1, 2]}.

Default ​

none: the params by position are refused with INVALID_PARAMS


toPattern? ​

optional toPattern?: (method, params) => Record<string, unknown>

Build the pattern and the input of a request's action from its method and its params, replacing methodField and positionalParams. A thrown error answers the request with INVALID_PARAMS.

Parameters ​

method ​

string

params ​

Record<string, unknown> | unknown[] | undefined

Returns ​

Record<string, unknown>

Released under the MIT License.