import { b as QueryType, v as Query } from "./index-l2pJm30F.js"; import { a as Trigger, c as Triggers, o as TriggerOptions, s as TriggerType, t as FormattedResults } from "./index-D9P9itFa-C0Jtggx-.js"; import { FunctionComponent } from "react"; import { CookieSerializeOptions } from "cookie"; //#region ../../node_modules/@stefanprobst/rehype-extract-toc/src/index.d.ts interface TocEntry { value: string; depth: number; id?: string; children?: Array; } type Toc = Array; declare module "vfile" { interface DataMap { toc: Toc; } } //#endregion //#region private/universal/types/util.d.ts interface QueryItemBase { /** * The query that should be executed on the server. * * We are tracking queries as strings instead of objects because we are performing a * lot of comparisons and deduplication across the framework, so tracking them as * strings is more efficient than stringifying them again for every comparison. * Especially because we only need the raw object once at the end, when actually * executing the queries. */ query: string; database?: string; result?: FormattedResults[number]; error?: unknown; /** * The ID of a particular connection to the database, through which the query should be * streamed. Allows for ensuring transport order between multiple writes. */ stream?: string; } interface QueryItemRead extends QueryItemBase { type: 'read'; paginationDetails?: { countForQueryAtIndex: PaginationInstruction['queryIndex']; direction: PaginationInstruction['direction']; }; /** Whether the query is addressing multiple models at once. */ multiModel?: boolean; } interface QueryItemWrite extends QueryItemBase { type: 'write'; hookHash: string; } type PaginationInstruction = { leafIndex: number; hookHash: number; queryIndex: number; direction: 'before' | 'after'; cursor: string; targetModel?: string; }; type GeoLocation = { country: string | null; region: string | null; city: string | null; latitude: number | null; longitude: number | null; timeZone: string | null; }; interface UserAgent { browser: string | null; browserVersion: string | null; deviceType: 'desktop' | 'mobile' | 'tablet' | null; os: string | null; osVersion: string | null; } type PageFetchingOptions = { /** * This property is used by `useMutation` on the client and allows for processing * queries on the edge, after which the edge then makes the results of the queries * available to the client using the defined checksum. */ queries?: QueryItemWrite[]; /** * A list of files that are referenced from the queries. */ files?: Map; /** * The page to render instead of the requested one in the case that an error has * occurred with the provided queries. This is useful if a new page was requested, but * the old page should be re-rendered if an error has occurred. */ errorFallback?: string; /** * By default, the URL in the address bar of the browser will be updated after every * page transition. If this is not desired, you can disable it by setting this property * to `false`. */ updateAddressBar?: boolean; }; interface CustomNavigator { userAgent: UniversalContext['userAgent']; geoLocation: UniversalContext['geoLocation']; languages: UniversalContext['languages']; } //#endregion //#region private/universal/utils/index.d.ts type SetExistingCookie = (value: T$1, options?: CookieOptions) => void; type SetCookie = (name: string, ...rest: Parameters>) => void; interface CookieOptions { /** * Allows for making cookies accessible to the client, instead of allowing only the * server to read and modify them. */ client?: true; /** * Allows for restricting the cookie to a specific URL path of the app. * * @default '/' */ path?: string; } /** * Generates a function that can be used to set new cookies. * * @param serverContext - A server context object. * * @returns The function that can be used for setting cookies. */ //#endregion //#region private/server/types/index.d.ts type WaitUntil = (promise: Promise) => void; type TableOfContents = Toc; interface PageMetadata { title?: Set; themeColor?: string; colorScheme?: 'light' | 'dark'; description?: string; icon?: string; openGraph?: { title?: string; description?: string; siteName?: string; images?: { url: string; width: number; height: number; }[]; }; x?: { title?: string; description?: string; card?: string; site?: string; creator?: string; images?: string[]; }; htmlClassName?: string; bodyClassName?: string; } interface TriggerOptions$1 extends TriggerOptions { /** * A list of cookies that are stored on the client. */ cookies: ServerContext['cookies']; /** * Used for setting new cookies that should be stored on the client, updating existing * ones, or deleting existing ones. */ setCookie: SetCookie; /** * Details about the client that is accessing the application. */ navigator: CustomNavigator; /** * The URL of the page for which the trigger is being executed. */ location: URL; /** * Indicates whether the incoming query stems from a headless source, meaning the * application's browser client or REST API. * * In such cases, it is advised to validate the authority of the incoming query within * triggers, by performing permission validation. */ headless: boolean; } type Trigger$1> = Trigger; type Triggers$1 = Triggers>; //#endregion //#region private/server/worker/tree.d.ts interface Collected { queries: (QueryItemRead | QueryItemWrite)[]; redirect?: string; metadata: PageMetadata; cookies?: Record; } //#endregion //#region private/server/context.d.ts /** This context can only be consumed by server components. */ type ServerContext | Array = Record | null>> = Omit, 'collected'> & { cookies: Record; collected: Collected; currentLeafIndex: number | null; waitUntil: WaitUntil; flushSession?: (/** A list of write queries that should be executed. */ queries: Array, /** The ID of a particular database connection to stream the queries through. */ queryStream?: string) => Promise<{ results?: Collected['queries']; }>; }; //#endregion //#region private/universal/context.d.ts /** This context can be consumed by client and server components. */ type UniversalContext | Array = Record | null>> = { url: string; params: TParams extends Array ? { [K in TParams[number]]: string } : TParams; userAgent: UserAgent; geoLocation: GeoLocation; addressBarInSync: boolean; languages: string[]; collected: { queries: QueryItemWrite[]; }; }; //#endregion export { Triggers$1 as a, PageFetchingOptions as c, TriggerOptions$1 as i, TableOfContents as n, SetExistingCookie as o, Trigger$1 as r, CustomNavigator as s, PageMetadata as t };