/** * Represents the outputs of dependencies as a record with keys. */ export type HandlerOutputs>> = { [K in keyof D]: D[K] extends Handler ? O : never; }; /** * Represents a handler with its named dependencies and handler function. * * `Ctx` is an arbitrary context type (for example `{ req, res }` in HTTP * adapters). Quilt itself does not assume anything about this shape. */ export type Handler> = Record>> = { /** * Named dependency handlers. Their outputs are made available to this * handler as the `deps` parameter. */ dependencies: D; /** * Executes the handler. * * @param ctx - The execution context (e.g. `{ req, res }`). * @param deps - The outputs from dependencies. */ execute: (ctx: Ctx, deps: HandlerOutputs) => Promise | O; }; /** * Creates a "terminal" handler in a dependency graph. * * Works for both "middleware-like" handlers (that produce values for others) * and "terminal" handlers at the edge of the system. */ export declare function createHandler> = Record>>({ execute, dependencies, }: { execute: (ctx: Ctx, deps: HandlerOutputs) => Promise | O; dependencies?: D; }): Handler; //# sourceMappingURL=Handler.d.ts.map