UNPKG

2.26 kBTypeScriptView Raw
1import { DirectiveNode, FieldNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, EnumValueNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode } from 'graphql';
2export interface IdValue {
3 type: 'id';
4 id: string;
5 generated: boolean;
6 typename: string | undefined;
7}
8export interface JsonValue {
9 type: 'json';
10 json: any;
11}
12export declare type ListValue = Array<null | IdValue>;
13export declare type StoreValue = number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object;
14export declare type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;
15export declare function isScalarValue(value: ValueNode): value is ScalarValue;
16export declare type NumberValue = IntValueNode | FloatValueNode;
17export declare function isNumberValue(value: ValueNode): value is NumberValue;
18export declare function valueToObjectRepresentation(argObj: any, name: NameNode, value: ValueNode, variables?: Object): void;
19export declare function storeKeyNameFromField(field: FieldNode, variables?: Object): string;
20export declare type Directives = {
21 [directiveName: string]: {
22 [argName: string]: any;
23 };
24};
25export declare function getStoreKeyName(fieldName: string, args?: Object, directives?: Directives): string;
26export declare function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables: Object): Object;
27export declare function resultKeyNameFromField(field: FieldNode): string;
28export declare function isField(selection: SelectionNode): selection is FieldNode;
29export declare function isInlineFragment(selection: SelectionNode): selection is InlineFragmentNode;
30export declare function isIdValue(idObject: StoreValue): idObject is IdValue;
31export declare type IdConfig = {
32 id: string;
33 typename: string | undefined;
34};
35export declare function toIdValue(idConfig: string | IdConfig, generated?: boolean): IdValue;
36export declare function isJsonValue(jsonObject: StoreValue): jsonObject is JsonValue;
37export declare type VariableValue = (node: VariableNode) => any;
38export declare function valueFromNode(node: ValueNode, onVariable?: VariableValue): any;
39//# sourceMappingURL=storeUtils.d.ts.map
\No newline at end of file