counterfact
Version:
Generate a TypeScript-based mock server from an OpenAPI spec in seconds — with stateful routes, hot reload, and REPL support.
18 lines (16 loc) • 669 B
text/typescript
import type { WideResponseBuilder } from "./wide-response-builder.js";
/**
* The loosely-typed argument object passed to wide (catch-all) route handlers.
* Unlike the generated operation argument types, all fields are typed as
* `unknown` or broad index signatures. Use this when writing handlers that
* should accept any request without compile-time schema enforcement.
*/
export interface WideOperationArgument {
body: unknown;
context: unknown;
headers: { [key: string]: string };
path: { [key: string]: string };
proxy: (url: string) => { proxyUrl: string };
query: { [key: string]: string };
response: { [key: number]: WideResponseBuilder };
}