INDIE UNPKG

1.85 kBTypeScriptView Raw
1
2import { Action } from "../../router/history.js";
3import { DataStrategyFunction } from "../../router/utils.js";
4import { Router } from "../../router/router.js";
5import { RouteModules } from "./routeModules.js";
6import { AssetsManifest } from "./entry.js";
7//#region lib/dom/ssr/single-fetch.d.ts
8declare const SingleFetchRedirectSymbol: unique symbol;
9/**
10 * Describes the operation that initiated an internal router request.
11 *
12 * Requests that reload fetchers as part of a navigation, revalidation, or
13 * initialization redirect keep that initiating `type`. `fetcherKey` identifies
14 * the fetcher being loaded, or is `null` when the request targets route loaders
15 * or actions.
16 *
17 * `navigationType` is the history action (`"PUSH"`, `"REPLACE"`, or `"POP"`)
18 * for navigation-initiated data requests, including reloaded fetchers. It is
19 * `null` for initialization, fetcher, and revalidation requests. Manifest
20 * requests have no navigation type.
21 */
22type RouterFetchContext = {
23 type: "manifest";
24} | {
25 type: "navigation";
26 fetcherKey: string | null;
27 navigationType: Action;
28} | {
29 type: "initialization" | "fetcher" | "revalidation";
30 fetcherKey: string | null;
31 navigationType: null;
32};
33type RouterFetch = (request: Request, context: RouterFetchContext) => Promise<Response>;
34declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, fetchImplementation?: RouterFetch, isApiOnly?: boolean, serverOrigin?: string): DataStrategyFunction;
35declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
36 done: Promise<void>;
37 value: unknown;
38}>;
39//#endregion
40export { RouterFetch, RouterFetchContext, SingleFetchRedirectSymbol, decodeViaTurboStream, getTurboStreamSingleFetchDataStrategy };
\No newline at end of file