initial commit of actions

This commit is contained in:
Dominik Polakovics Polakovics 2026-01-31 18:56:04 +01:00
commit 949ece5785
44660 changed files with 12034344 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import { TwirpContext } from "./context";
import { TwirpError } from "./errors";
export interface ServerHooks<T extends TwirpContext = TwirpContext> {
requestReceived?: (ctx: T) => void | Promise<void>;
requestRouted?: (ctx: T) => void | Promise<void>;
/**@deprecated Use responsePrepared instead*/
requestPrepared?: (ctx: T) => void | Promise<void>;
responsePrepared?: (ctx: T) => void | Promise<void>;
/**@deprecated Use responseSent instead*/
requestSent?: (ctx: T) => void | Promise<void>;
responseSent?: (ctx: T) => void | Promise<void>;
error?: (ctx: T, err: TwirpError) => void | Promise<void>;
}
export declare function chainHooks<T extends TwirpContext = TwirpContext>(...hooks: ServerHooks<T>[]): ServerHooks<T> | null;
export declare function isHook<T extends TwirpContext = TwirpContext>(object: any): object is ServerHooks<T>;