@loona/core
Version:
App State Management done with GraphQL (core package)
21 lines (20 loc) • 1.1 kB
TypeScript
import { DocumentNode } from 'graphql';
import { ApolloClient } from 'apollo-client';
import { ReceivedContext, Context } from './types/common';
import { Action, MutationAsAction } from './types/effect';
export declare function buildContext(context: ReceivedContext, client: ApolloClient<any>): Context;
export declare function buildGetCacheKey(cache: any): (obj: {
__typename: string;
id: string | number;
}) => any;
export declare function getFragmentTypename(fragment: DocumentNode): string;
export declare function patchQuery(client: ApolloClient<any>): <R = any>(query: DocumentNode | {
query: DocumentNode;
variables: {
[key: string]: any;
};
}, patchFn: (data: R) => any) => R;
export declare function patchFragment(context: ReceivedContext, client: ApolloClient<any>): <R = any>(fragment: DocumentNode, obj: any, patchFn: (data: R) => any) => R;
export declare function isDocument(doc: any): doc is DocumentNode;
export declare function isMutationAsAction(action: Action): action is MutationAsAction;
export declare function getActionType(action: any): string;