/** * Get the path to the maintenance file */ export declare function maintenanceFilePath(): string; export declare function comingSoonFilePath(): string; export declare function siteModeFilePath(mode: SiteMode): string; /** * Check if the application is in maintenance mode */ export declare function isDownForMaintenance(): Promise; export declare function isComingSoon(): Promise; /** * Get the maintenance mode payload */ export declare function maintenancePayload(): Promise; export declare function comingSoonPayload(): Promise; export declare function siteModePayload(mode: SiteMode): Promise; export declare function activeSiteModePayload(): Promise; /** * Put the application into maintenance mode */ export declare function down(options?: Partial): Promise; export declare function comingSoon(options?: Partial): Promise; /** * Bring the application out of maintenance mode */ export declare function up(): Promise; export declare function launch(): Promise; /** * Check if an IP address is allowed during maintenance */ export declare function isAllowedIp(ip: string, allowed?: string[], trustLocalhost?: boolean): boolean; /** * Check if a request has a valid bypass cookie */ export declare function bypassCookieName(mode?: SiteMode): string; export declare function hasValidBypassCookie(cookies: Record, secret: string, mode?: SiteMode): boolean; /** * Check if a request path matches the bypass secret */ export declare function isSecretPath(path: string, secret: string): boolean; /** * Generate maintenance mode HTML response */ export declare function maintenanceHtml(payload: MaintenancePayload): string; /** * Create a maintenance mode response */ export declare function maintenanceResponse(payload: MaintenancePayload): Response; export declare function siteModeResponse(payload: MaintenancePayload): Response; /** * Create bypass cookie */ export declare function bypassCookieValue(secret: string, mode?: SiteMode): string; /** * Single source of truth for the maintenance / coming-soon gate. * * Returns a `Response` to short-circuit the request, or `null` to let * normal request handling continue. * * Used by: * - the dev server's `onRequest` hook (so the gate runs before the * stx-serve view router or the API proxy ever sees the request); * - the global `Maintenance` middleware in production. * * Order of checks (mirrors Laravel): * 1. No active site-mode (no down file, no coming-soon file, no env * override) → pass through. * 2. Path is always-allowed (the holding page itself, email * subscribe, static assets) → pass through. * 3. Path matches the secret token → set mode-aware bypass cookie, * redirect home (coming-soon lands on `/?preview=` so the * client-side gate unlocks in the same visit when tokens match). * 4. Bypass cookie present OR client IP allowed → pass through. * 5. Otherwise → return the active mode's response (redirect for * coming-soon when a redirect URL is configured; HTML page for * maintenance). */ export declare function maintenanceGate(req: Request): Promise; export declare interface MaintenancePayload { mode?: SiteMode time: number message?: string title?: string retry?: number secret?: string allowed?: string[] status?: number template?: string redirect?: string } export type SiteMode = 'maintenance' | 'coming-soon';