import type { JsonApiResponse } from "../../types.js"; export type QueryValue = string | number | Array | undefined; export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; /** * Resolve the per-request HTTP timeout in milliseconds. * * Reads BOOND_HTTP_TIMEOUT_MS at call time so tests / runtime overrides take * effect without restarting the process. Falls back to the default for * unset, non-numeric, or non-positive values. * * Exported for unit testing. */ export declare function resolveTimeoutMs(): number; /** * Defense-in-depth against path traversal / query injection through entity * ids interpolated into API paths at ~40 call sites. Even though the id * schemas are now numeric-only, a future tool could forget to validate, so we * assert here that the path is well-formed: it must start with `/`, carry no * query (`?`) or fragment (`#`) — those arrive via `queryParams`, never the * path — and contain no traversal (`..`) or percent/backslash escapes. Built * paths only ever combine static segments with numeric ids and hyphenated tab * names, so this rejects nothing legitimate. Exported for unit testing. */ export declare function assertSafeApiPath(path: string): void; /** * Validates `path` and resolves it against `baseUrl`, returning the * constructed URL. Throws if the path is unsafe (see `assertSafeApiPath`) or * if the resolved URL escapes the configured API base origin/path. Exported * for unit testing. */ export declare function resolveApiUrl(baseUrl: string, path: string): URL; /** What a helper hands to `send()`: everything but the plumbing. */ export interface SendOptions { method?: HttpMethod; query?: Record; /** * Request body, reused verbatim on every attempt: a JSON string or a * `FormData` (both are re-serialised by `fetch` per call, so a retry never * sends a consumed stream). */ body?: string | FormData; /** Extra headers (`Accept`, `Content-Type`); the auth header is added per attempt. */ headers?: Record; /** * Cancellation signal. Defaults to the current MCP request's `extra.signal` * (`currentRequestSignal()`, issue #231) — pass one only to override it. */ signal?: AbortSignal; } /** * Send one request through the whole pipeline — URL guard, per-identity rate * limiter, auth header resolved per attempt (so an OAuth refresh between two * tries is picked up), per-attempt timeout, retry policy with `Retry-After`, * error mapping — and return the first **2xx** `Response`, body unread. * * Throws `BoondApiError` on a non-2xx that the policy does not retry (or once * retries are exhausted), the standard timeout `Error` when an attempt never * completed, `RequestCancelledError` (name `AbortError`) when the client * cancelled — checked before each attempt, while waiting for a rate-limit * token, during the fetch itself and during a backoff, and never retried — * and the raw network error otherwise. */ export declare function send(path: string, options?: SendOptions): Promise; /** JSON:API request. `body` is serialised for POST / PUT / PATCH only. */ export declare function apiRequest(path: string, method?: HttpMethod, body?: unknown, queryParams?: Record): Promise; /** * POST a multipart/form-data payload to the BoondManager API (document * upload). Form values are simple string fields — the file itself travels by * reference via the `fileUrl` field (Boond downloads it server-side), so the * MCP server never buffers file bytes. */ export declare function apiUploadForm(path: string, fields: Record): Promise; //# sourceMappingURL=transport.d.ts.map