///
import { Component, ReactNode } from 'react';
import { CombinedError } from '../modules/error';
import { ClientEvent, IClient, IMutation, IQuery } from '../interfaces/index';
export interface IClientProps {
client: IClient;
children: (obj: object) => ReactNode;
subscription?: IQuery;
query?: IQuery | IQuery[];
mutation?: IMutation;
updateSubscription?: (prev: object | null, next: object | null) => object | null;
cache?: boolean;
typeInvalidation?: boolean;
shouldInvalidate?: (changedTypes: string[], typeNames: string[], response: object, data: object) => boolean;
}
export interface IClientFetchOpts {
skipCache: boolean;
}
export interface IClientState {
fetching: boolean;
loaded: boolean;
error?: Error | CombinedError | CombinedError[];
data: object | object[] | IClientState[];
}
export default class UrqlClient extends Component {
static defaultProps: {
cache: boolean;
typeInvalidation: boolean;
};
state: {
data: any;
error: any;
fetching: boolean;
loaded: boolean;
};
willUpdateSubscription: boolean;
subscription: any;
query: any;
mutations: {};
typeNames: any[];
unsubscribe: any;
subscriptionSub: any;
querySub: any;
componentDidMount(): void;
componentDidUpdate(prevProps: any): void;
componentWillUnmount(): void;
invalidate: (queryObject: any) => Promise;
invalidateAll: () => Promise;
read: (query: any) => Promise;
updateCache: (callback: any) => Promise;
formatProps: (props: any) => void;
update: (event: ClientEvent) => void;
refreshAllFromCache: () => void;
fetch: (opts?: IClientFetchOpts, initial?: boolean) => void;
subscribeToQuery: () => void;
mutate: (mutation: any) => Promise