UNPKG

@nestjs/microservices

Version:

Nest - modern, fast, powerful node.js web framework (@microservices)

19 lines (18 loc) 527 B
import { RpcParamtype } from '../enums/rpc-paramtype.enum.js'; export class RpcParamsFactory { exchangeKeyForValue(type, data, args) { if (!args) { return null; } switch (type) { case RpcParamtype.PAYLOAD: return data ? args[0]?.[data] : args[0]; case RpcParamtype.CONTEXT: return args[1]; case RpcParamtype.GRPC_CALL: return args[2]; default: return null; } } }