UNPKG

@gqty/react

Version:

The No-GraphQL Client for React

26 lines (25 loc) 1.82 kB
import { Selection, getArrayFields, getFields, prepass, selectFields, type FetchOptions, type GQtyError } from 'gqty'; import * as React from 'react'; export declare const IS_BROWSER: boolean; export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect; export type LegacyFetchPolicy = 'cache-and-network' | 'cache-first' | 'network-only' | 'no-cache'; export declare const legacyFetchPolicyMap: Record<LegacyFetchPolicy, FetchOptions['cachePolicy']>; export declare const translateFetchPolicy: (fetchPolicy: LegacyFetchPolicy) => FetchOptions["cachePolicy"]; export type SelectionsOrProxy<T> = (Selection | T)[]; export declare const useExtractedSelections: <T extends object>(input?: SelectionsOrProxy<T>) => Set<Selection>; export type List<T> = Set<T> | Array<T>; export declare function toSetIfNeeded<T>(list: List<T>): Set<T>; export declare function isSelectionIncluded(selection: Selection, selectionList: List<Selection>): boolean; export declare function isAnySelectionIncluded(selectionsToCheck: List<Selection>, selectionsList: List<Selection>): boolean; export declare function isAnySelectionIncludedInMatrix(selectionsToCheck: List<Selection>, selectionsMatrix: List<List<Selection>>): boolean; export type OnErrorHandler = (error: GQtyError) => void; export declare const coreHelpers: { prepass: typeof prepass; getFields: typeof getFields; getArrayFields: typeof getArrayFields; selectFields: typeof selectFields; castNotSkeleton: <T>(v: T) => import("gqty").NotSkeleton<T>; castNotSkeletonDeep: <T>(v: T) => import("gqty").NotSkeletonDeep<T>; }; export declare function uniqBy<TNode>(list: TNode[], cb?: (node: TNode) => unknown): TNode[]; export declare function sortBy<TNode>(list: TNode[], cb: (node: TNode) => number | string, order?: 'asc' | 'desc'): TNode[];