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