fix(virtualstream): Expose transport localData to handlers via TypedTools; improve VirtualStream payload encode/decode to preserve built-ins and handle nested arrays/objects

This commit is contained in:
2025-12-03 23:51:47 +00:00
parent 248430b5ad
commit b730a977dc
5 changed files with 32 additions and 2 deletions

View File

@@ -2,6 +2,12 @@ import { TypedResponseError } from './classes.typedresponseerror.js';
import * as plugins from './plugins.js';
export class TypedTools {
/**
* Local data passed from the transport layer.
* This can contain connection-specific context like the WebSocket peer.
*/
public localData: Record<string, any> = {};
public async passGuards<T = any>(guardsArg: plugins.smartguard.Guard<T>[], dataArg: T) {
const guardSet = new plugins.smartguard.GuardSet<T>(guardsArg);
const guardResult = await guardSet.allGuardsPass(dataArg);