@fal-ai/client
Version:
The fal.ai client for JavaScript and TypeScript
39 lines (38 loc) • 1.45 kB
TypeScript
/**
* Minimum allowed request timeout in seconds.
* Matches the Python client's MIN_REQUEST_TIMEOUT_SECONDS.
*/
export declare const MIN_REQUEST_TIMEOUT_SECONDS = 1;
/**
* Header name for server-side request timeout.
*/
export declare const REQUEST_TIMEOUT_HEADER = "x-fal-request-timeout";
/**
* Header name for timeout type (user vs infrastructure).
*/
export declare const REQUEST_TIMEOUT_TYPE_HEADER = "x-fal-request-timeout-type";
/**
* Header name for queue priority.
*/
export declare const QUEUE_PRIORITY_HEADER = "x-fal-queue-priority";
/**
* Header name for runner hint.
*/
export declare const RUNNER_HINT_HEADER = "x-fal-runner-hint";
/**
* Validates the timeout and returns the header value as a string.
* Throws an error if the timeout is invalid.
*
* @param timeout - The timeout value in seconds (must be > MIN_REQUEST_TIMEOUT_SECONDS)
* @returns The timeout as a string suitable for the header value
* @throws Error if timeout is not a valid number or is <= MIN_REQUEST_TIMEOUT_SECONDS
*/
export declare function validateTimeoutHeader(timeout: number): string;
/**
* Creates headers object with the timeout header if timeout is provided.
* Returns an empty object if timeout is undefined.
*
* @param timeout - Optional timeout value in seconds
* @returns Headers object with REQUEST_TIMEOUT_HEADER if timeout is provided
*/
export declare function buildTimeoutHeaders(timeout?: number): Record<string, string>;