// @flow export type UpdateType = 'create' | 'update' | 'delete' | 'swap' | 'connect' | 'disconnect'; export type ArrayActionType = 'UPDATE_ARRAY' | 'CREATE_ARRAY' | 'DELETE_ARRAY'; export type ConnectActionType = 'CONNECT' | 'DISCONNECT' | 'CREATE_AND_CONNECT' | 'DISCONNECT_AND_DELETE' | 'UPDATE_CONNECT'; export type ObjectActionType = 'UPDATE_OBJECT'; export type NoopType = 'NOOP'; export type ActionType = ArrayActionType | ConnectActionType | ObjectActionType | NoopType; export type Action = { type: T, payload: { key: string, id?: string, path?: string, value: any, relation?: Object, transformGqlPayload?: Function } } export interface Pattern { actions: Array; addAction(action: T): void; mergeAction(): Array; } export type ActionManagerStore = { [key: string]: Pattern> | Array<{ id: string, array: Pattern>, connect: Pattern> }> } export interface ActionManagerDef { store: ActionManagerStore; addAction(action: Action): void; getActions(key: string, id?: string): Array> }