@apollo-orbit/angular
Version:
A fully-featured GraphQL client for Angular with modular state management.
10 lines (9 loc) • 479 B
TypeScript
import { Action, ActionInstance, State } from '@apollo-orbit/core';
import { ApolloCache } from '@apollo/client/core';
import { Observable } from 'rxjs';
export type StateFactory = () => State;
export type ActionFn<T> = (action: T, context: ActionContext) => void | Promise<any> | Observable<any>;
export interface ActionContext<TCacheShape = any> {
cache: ApolloCache<TCacheShape>;
dispatch<TAction extends Action | ActionInstance>(action: TAction): Observable<void>;
}