UNPKG

@loona/core

Version:

App State Management done with GraphQL (core package)

33 lines (32 loc) 1.36 kB
import { DocumentNode, GraphQLError } from 'graphql'; import { MutationOptions } from 'apollo-client'; import { FetchResult } from 'apollo-link'; import { MutationDef, MutationObject } from './types/mutation'; import { Store } from './internal/store'; import { Manager } from './manager'; export declare class MutationManager extends Store<MutationDef> { constructor(defs?: MutationDef[]); add(defs: MutationDef[]): void; } export declare function mutationToType(action: MutationObject): string; export declare function getMutation(action: any): DocumentNode; export declare function isMutation(action: any): action is MutationObject; export declare function getNameOfMutation(mutation: DocumentNode): string; export declare function withUpdates<T, V>(config: MutationOptions<any, V>, manager: Manager): MutationOptions<any, V>; export declare function buildActionFromResult<T, V>(config: MutationOptions<T, V>, result: FetchResult<T>): { type: string; options: MutationOptions<T, V>; ok: boolean; errors?: ReadonlyArray<GraphQLError>; data?: T | { [key: string]: any; }; extensions?: Record<string, any>; context?: any; }; export declare function buildActionFromError<T, V>(config: MutationOptions<T, V>, error: any): { type: string; options: MutationOptions<T, V>; ok: boolean; error: any; };