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