UNPKG

1.25 kBTypeScriptView Raw
1import { Client, OperationContext, OperationResult, RequestPolicy, TypedDocumentNode } from '@urql/core';
2import { Getter, WritableAtom } from 'jotai';
3declare type AtomWithQueryAction = {
4 type: 'reexecute';
5 opts?: Partial<OperationContext>;
6};
7declare type OperationResultWithData<Data, Variables> = OperationResult<Data, Variables> & {
8 data: Data;
9};
10declare type QueryArgs<Data, Variables extends object> = {
11 query: TypedDocumentNode<Data, Variables> | string;
12 variables?: Variables;
13 requestPolicy?: RequestPolicy;
14 context?: Partial<OperationContext>;
15};
16declare type QueryArgsWithPause<Data, Variables extends object> = QueryArgs<Data, Variables> & {
17 pause: boolean;
18};
19export declare function atomWithQuery<Data, Variables extends object>(createQueryArgs: (get: Getter) => QueryArgs<Data, Variables>, getClient?: (get: Getter) => Client): WritableAtom<OperationResultWithData<Data, Variables>, AtomWithQueryAction>;
20export declare function atomWithQuery<Data, Variables extends object>(createQueryArgs: (get: Getter) => QueryArgsWithPause<Data, Variables>, getClient?: (get: Getter) => Client): WritableAtom<OperationResultWithData<Data, Variables> | null, AtomWithQueryAction>;
21export {};