@nodescript/protocomm
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -19,3 +19,3 @@ import { Event } from 'typesafe-event'; | ||
const json = typeof msg === 'object' ? msg : JSON.parse(String(msg)); | ||
const req = RpcMethodRequest.decode(json); | ||
const req = RpcMethodRequest.decode(json, { strictRequired: true }); | ||
id = req.id; | ||
@@ -48,5 +48,5 @@ const result = await this.runMethod(req); | ||
} | ||
const decodedParams = reqSchema.decode(params); | ||
const decodedParams = reqSchema.decode(params, { strictRequired: true }); | ||
const res = await methodImpl.call(domainImpl, decodedParams); | ||
return resSchema.decode(res); | ||
return resSchema.decode(res, { strictRequired: true }); | ||
} | ||
@@ -56,2 +56,3 @@ registerEvents() { | ||
for (const [eventName] of Object.entries(domainDef.events)) { | ||
const { paramSchema } = this.protocolIndex.lookupEvent(domainName, eventName); | ||
const ev = this.protocolImpl[domainName][eventName]; | ||
@@ -62,3 +63,3 @@ if (ev instanceof Event) { | ||
event: eventName, | ||
params, | ||
params: paramSchema.decode(params), | ||
})); | ||
@@ -65,0 +66,0 @@ } |
{ | ||
"name": "@nodescript/protocomm", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Bi-directional transport-agnostic JSON-based messaging", |
Sorry, the diff of this file is not supported yet
35310
529