export declare const DEFAULT_DISPATCH_SETTLE_MS = 250; export declare function resolveSelfDispatchBaseUrl(event?: any): string; /** * Resolve this deployment's own address. Prefer the URL for this exact deploy * before stable app URLs: a preview or in-flight deploy must not send a token * minted by its function fleet to a different deploy that happens to serve the * same public hostname. Fall back to the inbound request headers, then the * origin the current request was served on, and finally localhost in dev. * * Throws in production / shared deployments when no env var is set — a silent * fallback to a bad host there would drop background work invisibly. */ export declare function resolveDeploymentBaseUrl(event?: any): string; export interface FireInternalDispatchOptions { baseUrl?: string; event?: any; path: string; taskId: string; body?: Record; settleMs?: number; /** * Await the dispatch response fully instead of racing the settle timer. * * The 250ms settle race is correct for a synchronous handler that must * respond to its own caller quickly — but it is WRONG for a handoff fired * from a function that is about to finish (e.g. a background worker chaining * its continuation chunk): once the handler's promise resolves, the Lambda * freezes and a still-in-flight dispatch fetch is killed WITHOUT rejecting, * so the handoff is lost silently — the error path never fires. With * `awaitResponse: true` the call resolves only after the target confirmed * receipt (Netlify background functions 202 on enqueue, normally well under * a second) and throws on any network error or non-2xx, bounded by * `responseTimeoutMs`. */ awaitResponse?: boolean; responseTimeoutMs?: number; } /** * A non-2xx answer from the dispatch target. Callers decide whether to back * off from `httpStatus` and `retryAfterMs` instead of parsing the message. */ export declare class SelfDispatchHttpError extends Error { readonly httpStatus: number; readonly retryAfterMs?: number; /** Origin the request went to; never a path, query, or credentials. */ readonly target?: string; constructor(message: string, httpStatus: number, retryAfterMs?: number, target?: string); } /** * A dispatch that never got an HTTP answer: the connection was refused, DNS * failed, or the response timer ran out. `fetch` reports all of these as an * opaque `fetch failed` with the real code one `cause` down, so this names * where the request went (`target`, an origin) and why (`causeCode`, such as * `ECONNREFUSED`, `ENOTFOUND` or `TimeoutError`). */ export declare class SelfDispatchNetworkError extends Error { readonly target: string; readonly causeCode?: string; constructor(path: string, target: string, cause: unknown); } export declare function fireInternalDispatch(options: FireInternalDispatchOptions): Promise;