feat(core-realtime): IRealtimeHandler + IInboundDescriptor types
This commit is contained in:
14
packages/core-realtime/src/realtime-handler.interface.ts
Normal file
14
packages/core-realtime/src/realtime-handler.interface.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { z } from "zod";
|
||||
import type { RealtimeChannelDescriptor } from "./realtime-channel";
|
||||
|
||||
export type RealtimeContext = {
|
||||
userId: string | null;
|
||||
roles: string[];
|
||||
};
|
||||
|
||||
export type IRealtimeHandler<T> = (input: T, ctx: RealtimeContext) => Promise<void>;
|
||||
|
||||
export type IInboundDescriptor<TName extends string, TSchema extends z.ZodType> = {
|
||||
readonly descriptor: RealtimeChannelDescriptor<TName, TSchema>;
|
||||
readonly handler: IRealtimeHandler<z.infer<TSchema>>;
|
||||
};
|
||||
Reference in New Issue
Block a user