UNPKG

1.89 kBTypeScriptView Raw
1import { DirectiveNode, FieldNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode, SelectionSetNode, DocumentNode } from 'graphql';
2import { FragmentMap } from './fragments';
3export interface Reference {
4 readonly __ref: string;
5}
6export declare function makeReference(id: string): Reference;
7export declare function isReference(obj: any): obj is Reference;
8export type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object;
9export interface StoreObject {
10 __typename?: string;
11 [storeFieldName: string]: StoreValue;
12}
13export declare function isDocumentNode(value: any): value is DocumentNode;
14export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void;
15export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string;
16export type Directives = {
17 [directiveName: string]: {
18 [argName: string]: any;
19 };
20};
21export declare const getStoreKeyName: ((fieldName: string, args?: Record<string, any> | null, directives?: Directives) => string) & {
22 setStringify(s: typeof stringify): (value: any) => string;
23};
24declare let stringify: (value: any) => string;
25export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables?: Record<string, any>): Object | null;
26export declare function resultKeyNameFromField(field: FieldNode): string;
27export declare function getTypenameFromResult(result: Record<string, any>, selectionSet: SelectionSetNode, fragmentMap?: FragmentMap): string | undefined;
28export declare function isField(selection: SelectionNode): selection is FieldNode;
29export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode;
30export type VariableValue = (node: VariableNode) => any;
31export {};
32//# sourceMappingURL=storeUtils.d.ts.map
\No newline at end of file