UNPKG

@apollo/client-integration-tanstack-start

Version:

This package provides integrations between Apollo Client and TanStack Start to support modern streaming SSR.

75 lines (69 loc) 2.71 kB
import { TsrSerializable, AnyRouter } from '@tanstack/router-core'; import * as ACCore from '@apollo/client'; import * as Streaming from '@apollo/client-react-streaming'; import { ApolloClient as ApolloClient$1, InMemoryCache as InMemoryCache$1 } from '@apollo/client-react-streaming'; /** @public */ declare namespace ApolloClientIntegration { /** @public */ interface RouterContext { apolloClient: Streaming.ApolloClient; preloadQuery: PreloadTransportedQueryFunction; } /** @public */ interface PreloadTransportedQueryFunction { <TData = unknown, TVariables extends ACCore.OperationVariables = ACCore.OperationVariables>(query: ACCore.DocumentNode | ACCore.TypedDocumentNode<TData, TVariables>, options?: Streaming.PreloadTransportedQueryOptions<TData, NoInfer<TVariables>>): TransportedQueryRef<TData, TVariables>; } /** @public */ interface TransportedQueryRef<TData = unknown, TVariables extends ACCore.OperationVariables = ACCore.OperationVariables> extends Streaming.TransportedQueryRef<TData, TVariables>, TsrSerializable { } } /** @public */ declare function routerWithApolloClient<TRouter extends AnyRouter>(router: TRouter["options"]["context"] extends ApolloClientIntegration.RouterContext ? TRouter : never, apolloClient: ApolloClient): TRouter; declare namespace routerWithApolloClient { var defaultContext: ApolloClientIntegration.RouterContext; } /** @public */ declare namespace ApolloClient { /** @public */ interface Options extends ApolloClient$1.Options { } } /** * A version of `ApolloClient` to be used with TanStack Start. * * For more documentation, please see {@link https://www.apollographql.com/docs/react/api/core/ApolloClient | the Apollo Client API documentation}. * * @public */ declare class ApolloClient extends ApolloClient$1 { /** * Information about the current package and it's export names, for use in error messages. * * @internal */ static readonly info: { pkg: string; client: string; cache: string; }; } /** * A version of `InMemoryCache` to be used with TanStack Start. * * For more documentation, please see {@link https://www.apollographql.com/docs/react/api/cache/InMemoryCache | the Apollo Client API documentation}. * * @public */ declare class InMemoryCache extends InMemoryCache$1 { /** * Information about the current package and it's export names, for use in error messages. * * @internal */ static readonly info: { pkg: string; client: string; cache: string; }; } export { ApolloClient, ApolloClientIntegration, InMemoryCache, routerWithApolloClient };