import { ApolloQueueEntryOperation, ApolloOfflineQueue } from "./ApolloOfflineTypes"; import { CacheUpdates } from "offix-cache"; import { FetchResult } from "apollo-link"; import ApolloClient from "apollo-client"; import { NormalizedCacheObject } from "apollo-cache-inmemory"; export declare function addOptimisticResponse(apolloClient: ApolloClient, { op, qid }: ApolloQueueEntryOperation): void; export declare function removeOptimisticResponse(apolloClient: ApolloClient, { op, qid }: ApolloQueueEntryOperation): void; export declare function restoreOptimisticResponse(apolloClient: ApolloClient, mutationCacheUpdates: CacheUpdates, { op, qid }: ApolloQueueEntryOperation): void; /** * Imagine we do a mutation that creates a new object while offline. * This object is given a temporary client generated ID. * If we do subsequent edits to that object, those edits will also reference the client generated ID. * Once the initial mutation to create the object is successful, * we need to update all references in the queue to the client generated ID * with the actual ID returned from the server. */ export declare function replaceClientGeneratedIDsInQueue(queue: ApolloOfflineQueue, operation: ApolloQueueEntryOperation, result: FetchResult): void;