import { type HttpRouter } from "convex/server"; import type { ComponentApi } from "../component/_generated/component.js"; /** * Register app-owned HTTP routes for static hosting. * * Prefer mounting the component's own HTTP routes when it can own the URL * prefix. Use this compatibility mode when existing app HTTP routes must stay * at the same root. Exact app routes take precedence over this catch-all. * Assets and deployment state still live in the component. * * @example * ```typescript * // convex/convex.config.ts * const app = defineApp(); * app.use(staticHosting); // no httpPrefix: the app owns HTTP routing * * // convex/http.ts * const http = httpRouter(); * auth.addHttpRoutes(http); * registerStaticRoutes(http, components.staticHosting); * export default http; * ``` */ export declare function registerStaticRoutes(http: HttpRouter, component: ComponentApi, { pathPrefix, spaFallback, cdnBaseUrl, }?: { /** URL prefix where the app should serve static files. */ pathPrefix?: string; /** Override the deployment's SPA fallback setting. */ spaFallback?: boolean; /** Optional custom base URL for convex-fs blob redirects. */ cdnBaseUrl?: string | ((request: Request) => string); }): void; /** * Expose a query that clients can subscribe to for live reload on deploy. * This is only needed if you use `UpdateBanner` / `useDeploymentUpdates` from * `@convex-dev/static-hosting/react`. If you don't surface deployment updates * in your app, you don't need to call this. * * @example * ```typescript * // convex/staticHosting.ts * import { exposeDeploymentQuery } from "@convex-dev/static-hosting"; * import { components } from "./_generated/api"; * * export const { getCurrentDeployment } = exposeDeploymentQuery( * components.staticHosting, * ); * ``` */ export declare function exposeDeploymentQuery(component: ComponentApi): { getCurrentDeployment: import("convex/server").RegisteredQuery<"public", {}, Promise<{ _creationTime: number; _id: string; currentDeploymentId: string; deployedAt: number; spaFallback?: boolean; } | null>>; }; /** * Derive the Convex cloud URL from a `.convex.site` hostname. * Useful when your frontend is served from Convex static hosting and needs * to connect to its own Convex backend without an explicit env var. * * @example * ```typescript * import { getConvexUrl } from "@convex-dev/static-hosting"; * * const convexUrl = import.meta.env.VITE_CONVEX_URL ?? getConvexUrl(); * const convex = new ConvexReactClient(convexUrl); * ``` */ export declare function getConvexUrl(): string; //# sourceMappingURL=index.d.ts.map