@apollo/client-react-streaming
Version:
This package provides building blocks to create framework-level integration of Apollo Client with React's streaming SSR. See the [@apollo/client-integration-nextjs](https://github.com/apollographql/apollo-client-integrations/tree/main/packages/nextjs) pac
25 lines • 974 B
TypeScript
import type { RehydrationCache } from "./types.js";
import type { QueryEvent } from "@apollo/client-react-streaming";
import type { Revive, Stringify } from "./serialization.js";
export type DataTransport<T> = Array<T> | {
push(...args: T[]): void;
};
type DataToTransport = {
rehydrate: RehydrationCache;
events: QueryEvent[];
};
/**
* Returns a string of JavaScript that can be used to transport data to the client.
*/
export declare function transportDataToJS(data: DataToTransport, stringify: Stringify): string;
/**
* Registers a lazy queue that will be filled with data by `transportDataToJS`.
* All incoming data will be added either to the rehydration cache or the result cache.
*/
export declare function registerDataTransport({ onQueryEvent, onRehydrate, revive, }: {
onQueryEvent(event: QueryEvent): void;
onRehydrate(rehydrate: RehydrationCache): void;
revive: Revive;
}): void;
export {};
//# sourceMappingURL=dataTransport.d.ts.map