import { type Event, type Store } from "effector"; import type { ApolloClient, DocumentNode, OperationVariables, StoreObject, TypedDocumentNode } from "@apollo/client"; interface CreateFragmentBindingOptions { /** Your Apollo Client instance. */ client: ApolloClient | Store>; /** * A GraphQL Document with a single `fragment` that you're binding. */ document: DocumentNode | TypedDocumentNode; /** * A trigger to setup the binding. * * When called, will start listening to the Apollo Cache. Usually, * this will will be your `appStarted` event. */ setup: Event; /** * A trigger to teardown the binding. * * Acts as a full `reset` action on binding, stopping listening to * Apollo Cache and clearing `$data`. * * You must then call `setup` again to re-activate the binding. */ teardown?: Event; /** * A map of Variables that your fragment uses. * Can be omitted if the fragment uses no variables. */ variables?: Store; /** * Define how to identify a specific fragment. * * When provided with `Store`, treat this as a ready-to-use * canonical Cache ID. * * When provided with `Store`, treat this as an object * with all required _key fields_. It'll be passed to `cache.identify`. */ id: Store | Store; /** Watch for optimistic updates? */ optimistic?: boolean; /** The name of your binding. Will be derived from the `document` if abscent. */ name?: string; } export interface FragmentBinding { /** * The fragment data. Will be null if entry was not found in cache, or if * the binding has not been set up yet. */ $data: Store; /** * Is this binding active? * * Only active binding is fully set up, watches cache and keeps `$data` in sync. */ $active: Store; meta: { name: string; document: TypedDocumentNode; client: Store>; }; } /** * Allows you to bind a GraphQL fragment to Effector. * * Creates a live fragment binding to Apollo Cache. When cache updates, * so will this binding. This allows you to access on small chunks of * cached data. * * Note: binding _does not_ make a network request. It only binds already * existing, cached data so it's accessible from Effector. */ export declare function createFragmentBinding({ client, document, setup, teardown, id, variables, optimistic, name, }: CreateFragmentBindingOptions): FragmentBinding; export {};