import { ApolloCache } from '@apollo/client/core'; export type LogLevel = 'log' | 'warn' | 'error'; export type LogLine = [LogLevel, any[]]; export type TriggerUninstallFunction = () => void; export type TriggerFunction = (persist: () => void) => TriggerUninstallFunction; export type PersistenceMapperFunction = (data: any) => Promise; export type PersistedData = T | string | null; export interface PersistentStorage { getItem: (key: string) => Promise | T | null; setItem: (key: string, value: T) => Promise | Promise | void | T; removeItem: (key: string) => Promise | Promise | void; } type StorageType = TSerialize extends true ? PersistentStorage : PersistentStorage; export interface ApolloPersistOptions< TSerialized, TSerialize extends boolean = true > { cache: ApolloCache; storage: StorageType, TSerialize>; trigger?: 'write' | 'background' | TriggerFunction | false; debounce?: number; key?: string; serialize?: TSerialize; maxSize?: number | false; persistenceMapper?: PersistenceMapperFunction; debug?: boolean; }