import type { AnyClient, AnyConnection } from "@gadgetinc/core"; import type { AnyVariables, Client, CombinedError, DocumentInput, GraphQLRequestParams, Operation, OperationContext, OperationResult, RequestPolicy } from "@urql/core"; type Dispose = void | (() => void); type AnyActionArg = [] | [any]; type ActionDispatch = (...args: ActionArg) => void; type Context<_T> = { Provider: unknown; Consumer: unknown; }; interface FrameworkBindings { deepEqual: (a: A, b: B) => boolean; useEffect: (fn: () => Dispose, deps?: any[]) => void; useMemo: (factory: () => T, deps: any[]) => T; useRef: (initial: T) => { current: T; }; useState: (initial: T | (() => T)) => [T, (next: T) => void]; useContext: (ctx: any) => T; createContext: (defaultValue: T) => Context; useCallback: any>(fn: T, deps: any[]) => T; useReducer: (reducer: (prevState: S, ...args: A) => S, initialArg: I, init?: (i: I) => S) => [S, ActionDispatch]; Fragment: unknown; } export type UseQueryArgs = { requestPolicy?: RequestPolicy; context?: Partial; pause?: boolean; } & GraphQLRequestParams; export interface UseQueryState { fetching: boolean; stale: boolean; data?: Data; error?: CombinedError; extensions?: Record; operation?: Operation; } type UseQueryExecute = (opts?: Partial) => void; export type UseQueryResponse = [UseQueryState, UseQueryExecute]; export interface UseMutationState { fetching: boolean; stale: boolean; data?: Data; error?: CombinedError; extensions?: Record; operation?: Operation; } type UseMutationExecute = (variables: Variables, context?: Partial) => Promise>; export type UseMutationResponse = [ UseMutationState, UseMutationExecute ]; interface UrqlBindings { Provider: (props: { client: Client; children: any; }) => any; useQuery: (args: UseQueryArgs) => UseQueryResponse; useMutation: (query: DocumentInput) => UseMutationResponse; } export interface GadgetApiContext { api: AnyClient; connection: AnyConnection; } export interface RuntimeAdapter { GadgetApiContext: Context; framework: FrameworkBindings; urql: UrqlBindings; } export {};