@nestjs/microservices
Version:
Nest - modern, fast, powerful node.js web framework (@microservices)
27 lines (26 loc) • 848 B
TypeScript
export interface PacketId {
id: string;
}
/**
* Out-of-band values that travel with a packet but are not part of its
* payload - a trace id, a tenant, a locale. Set on the client through
* `ClientProxy#setOnDispatchHook`, read on the server from the RPC context.
*/
export type PacketMetadata = Record<string, string>;
export interface ReadPacket<T = any> {
pattern: any;
data: T;
metadata?: PacketMetadata;
}
export interface WritePacket<T = any> {
err?: any;
response?: T;
isDisposed?: boolean;
status?: string;
}
export type OutgoingRequest = ReadPacket & PacketId;
export type IncomingRequest = ReadPacket & PacketId;
export type OutgoingEvent = ReadPacket;
export type IncomingEvent = ReadPacket;
export type IncomingResponse = WritePacket & PacketId;
export type OutgoingResponse = WritePacket & PacketId;