/** * Gateway fetch rewrite — patches global fetch to route GraphQL requests * to the correct gateway domain based on the current hostname. * * This is necessary because the app shell serves from one domain (e.g., app.burdenoff.com) * but GraphQL requests need to go to separate gateway domains * (e.g., graphql.burdenoff.com, graphqlworkspaces.burdenoff.com). * * @module @burdenoff/fe-libs/shared/utils/gatewayFetchRewrite * * @example * ```ts * // In main.tsx, before React renders: * import { installGatewayFetchRewrite, resolveGatewayBases } from "@burdenoff/fe-libs/shared/utils"; * * const bases = resolveGatewayBases(); * installGatewayFetchRewrite(bases); * ``` */ export interface GatewayBases { globalBase: string; workspaceBase: string; } export interface GatewayBaseMapping { /** Hostname (lowercase) */ hostname: string; /** Gateway bases for this hostname */ bases: GatewayBases; } export declare function clearGatewayGraphQLResponseCache(): void; /** * Resolve gateway base URLs from the current hostname. * * @param extraMappings - Additional hostname → gateway base mappings (e.g., for product-specific domains) * @param localDefaults - Override defaults for local development */ export declare function resolveGatewayBases(extraMappings?: GatewayBaseMapping[], localDefaults?: GatewayBases): GatewayBases; /** * @deprecated Browser service-token headers are intentionally unsupported. * Cloudflare Access client secrets must never be attached from app code. */ export declare function maybeAttachCfAccessHeaders(request: Request, _gatewayOrigins: ReadonlySet, _clientId?: string, _clientSecret?: string): Request; /** * Options for installGatewayFetchRewrite. */ export interface GatewayFetchRewriteOptions { /** * @deprecated Browser Cloudflare Access service-token forwarding is disabled. * Client secrets must stay out of browser request headers. */ cfAccess?: { clientId?: string; clientSecret?: string; }; } /** * Install a global fetch interceptor that rewrites GraphQL request URLs * to the correct gateway domain based on the URL path. * * - `/global/graphql` → globalBase * - `/workspaces/graphql` → workspaceBase * * @param bases - Gateway base URLs to rewrite to * @param options - Deprecated options retained for source compatibility; ignored */ export declare function installGatewayFetchRewrite(bases: GatewayBases, _options?: GatewayFetchRewriteOptions): void; /** * Suppress verbose console output in production/non-debug environments. * * @param envFlag - Environment variable name to check for verbose mode (default: "VITE_VERBOSE_CONSOLE") */ export declare function suppressConsole(envFlag?: string): void; //# sourceMappingURL=gatewayFetchRewrite.d.ts.map