//#region src/client/transport.d.ts /** * Transport layer for the EmDash client. * * Implements a composable interceptor pipeline that modifies requests * and responses. The client calls `transport.fetch(request)` — everything * else (auth, CSRF, retry) is handled by interceptors. */ /** * An interceptor can modify the request, call next(), inspect * the response, and optionally retry. */ type Interceptor = (request: Request, next: (request: Request) => Promise) => Promise; interface TransportOptions { interceptors?: Interceptor[]; } /** * Creates a fetch function that runs requests through an interceptor pipeline. */ declare function createTransport(options?: TransportOptions): { fetch: (request: Request) => Promise; }; /** * Adds X-EmDash-Request: 1 and Origin headers to mutation requests * (POST, PUT, DELETE). The custom header satisfies EmDash's CSRF check; * the Origin header satisfies Astro's built-in origin verification which * rejects server-side POST requests that lack a matching Origin. */ declare function csrfInterceptor(): Interceptor; /** * Adds Authorization: Bearer header from a static token. */ declare function tokenInterceptor(token: string): Interceptor; /** * Dev bypass interceptor. Calls the dev-bypass endpoint on first request * to establish a session, then forwards the session cookie on subsequent * requests. */ declare function devBypassInterceptor(baseUrl: string): Interceptor; //#endregion export { tokenInterceptor as a, devBypassInterceptor as i, createTransport as n, csrfInterceptor as r, Interceptor as t }; //# sourceMappingURL=transport-DDEHAmW4.d.mts.map