import { Pipe, PipeOutput, PipeInput } from 'valleyed'; import { D as Db } from '../db-C8YY1yTO.js'; import '../core-BrkNSwvc.js'; import 'mongodb'; import '../kafka-Cf-TUJgv.js'; import '../overrides-6Hxg764S.js'; type EventDefinition
, R> = { pipe: P; handle: (payload: PipeOutput
, context: EventContext) => R | Promise , context: EventContext) => void;
async?: (result: R, payload: PipeOutput , context: EventContext) => void;
};
type EventContext = {
key: string;
by: string | undefined;
at: Date;
firstRun: boolean;
};
type EventDoc = {
key: string;
name: string;
ts: number;
body: unknown;
steps: {
status: 'start' | 'sync' | 'async';
ts: number;
}[];
by?: string;
};
type Context = Partial , R>(name: string, def: EventDefinition ): (payload: PipeInput , context: Context) => Promise