import { DocumentNode, OperationVariables, QueryHookOptions } from '@apollo/client'; import { PaginatedQueryData, QueryData, ReadResult, PaginatedReadResult } from "./reads.js"; /** * A read result that supports React Suspense and includes an error. * * @experimental This is an experimental type that can change at any time. */ export type SuspenseResultWithError = { data: undefined; error: E; } | { data: T; error: undefined; }; /** * A read result that supports React Suspense * * @experimental This is an experimental type that can change at any time. */ export type SuspenseResult = { data: T; }; /** * @deprecated Use {@link SuspenseResult | `SuspenseResult`} instead. */ export type SuspenseReadResult = SuspenseResultWithError; /** * Helper type to enable Suspense mode. * * @experimental This is an experimental type that can change at any time. */ export type SuspenseEnabled = T & { suspense: true; }; /** * @internal */ export type UseSuspenseQueryArgs = { suspense: true; query: DocumentNode; options: QueryHookOptions; }; /** * @internal */ export type UseQueryArgs = { suspense: false; query: DocumentNode; options: QueryHookOptions; }; /** * @internal */ export type UseSuspendableQueryArgs = UseSuspenseQueryArgs | UseQueryArgs; /** * @internal */ export declare function useSuspendableQuery(args: UseSuspendableQueryArgs, TVariables>): ReadResult | SuspenseResult; /** * A paginated read result that supports React Suspense. * * @experimental This is an experimental type that can change at any time. */ export type SuspensePaginatedResult = SuspenseResult & { /** * @deprecated not used with Suspense mode */ beforeCount: number; /** * Whether there are more items to fetch in the next page */ hasMore: boolean; /** * Fetches the next page of items. * * Calling this function will cause the component to re-suspend, * unless the call site is wrapped in [startTransition](https://react.dev/reference/react/startTransition). * * @returns A promise that resolves when the operation is complete, regardless if it had any items to fetch. */ next: () => Promise; /** * Fetches the previous page of items. * * Calling this function will cause the component to re-suspend, * unless the call site is wrapped in [startTransition](https://react.dev/reference/react/startTransition). * * @returns A promise that resolves when the operation is complete, regardless if it had any items to fetch. */ prev: () => Promise; }; /** * A paginated read result that supports React Suspense. * * @experimental This is an experimental type that can change at any time. */ export type SuspendablePaginatedResult = PaginatedReadResult | SuspensePaginatedResult; /** * @internal */ export declare function useSuspendablePaginatedQuery(args: UseSuspendableQueryArgs, TVariables>): PaginatedReadResult | SuspensePaginatedResult;