import { wrapQueryRef } from "@apollo/client/react/internal"; import type { ReadableStreamLinkEvent } from "./ReadableStreamLink.js"; import type { QueryRef } from "@apollo/client/react"; import type { DocumentNode, ApolloClient, OperationVariables, TypedDocumentNode } from "@apollo/client"; import { type TransportedOptions } from "./DataTransportAbstraction/transportedOptions.js"; import { type JsonString } from "@apollo/client-react-streaming/stream-utils"; type RestrictedPreloadOptions = { fetchPolicy?: "network-only" | "cache-and-network" | "cache-first"; returnPartialData?: false; nextFetchPolicy?: undefined; pollInterval?: undefined; }; /** @public */ export type PreloadTransportedQueryOptions = Omit, "query"> & RestrictedPreloadOptions; type TransportedQueryRefOptions = TransportedOptions & RestrictedPreloadOptions; /** * A `TransportedQueryRef` is an opaque object accessible via renderProp within `PreloadQuery`. * * A child client component reading the `TransportedQueryRef` via useReadQuery will suspend until the promise resolves. * * @public */ export interface TransportedQueryRef extends QueryRef { /** * Temporarily disabled - see https://github.com/apollographql/apollo-client-integrations/issues/332 * * Will now be be `undefined` both in React Server Components and Client Components until we can find a better resolution. */ toPromise?: undefined; /** @internal */ $__apollo_queryRef: { options: TransportedQueryRefOptions; stream: ReadableStream>; /** * A unique key for this query, to ensure it is only hydrated once, * even if it should get transported over the wire in a way that results * in multiple objects describing the same queryRef. * This key will be used to store the queryRef in the suspence cache. * * The chances of this happening should be slim (it is handled within * React thanks to https://github.com/facebook/react/pull/28996), but * as we use transported queryRefs with multiple frameworks with distinct * transport mechanisms, this seems like a safe option. */ queryKey: string; }; } /** @public */ export interface PreloadTransportedQueryFunction { (query: DocumentNode | TypedDocumentNode, options?: PreloadTransportedQueryOptions>): TransportedQueryRef; } /** @internal */ export declare function getInjectableEventStream(): readonly [ReadableStreamDefaultController, ReadableStream]; /** @public */ export declare function createTransportedQueryPreloader(client: ApolloClient, { prepareForReuse, notTransportedOptionOverrides, }?: { /** * Set this to `true` to indicate that this `queryRef` will be reused within the same process with the same Apollo Client instance without being dehydrated and hydrated. * In that case, it will already be written to the suspense cache so it doesn't need to be hydrated by re-running the query with a fake network request. */ prepareForReuse?: boolean; notTransportedOptionOverrides?: never; } | { prepareForReuse?: never; /** * Overrides to the options that should happen only in the `preloader` call, but should not be transported/hydrated on the client. */ notTransportedOptionOverrides?: Partial>; }): PreloadTransportedQueryFunction; /** @public */ export declare function reviveTransportedQueryRef(queryRef: TransportedQueryRef, client: ApolloClient): asserts queryRef is TransportedQueryRef & ReturnType; /** @public */ export declare function isTransportedQueryRef(queryRef: any): queryRef is TransportedQueryRef; /** @public */ export declare function useWrapTransportedQueryRef(queryRef: QueryRef | TransportedQueryRef): QueryRef; export {}; //# sourceMappingURL=transportedQueryRef.d.ts.map