import { Action, Event, EventObject, SingleOrArray, SendAction, SendActionOptions, CancelAction, ActionObject, ActionType, Assigner, AssignAction, ActionFunction, ActionFunctionMap, ActivityActionObject, ActionTypes, ActivityDefinition, RaiseEvent, DoneEvent, ErrorPlatformEvent, DoneEventObject, SendExpr, SendActionObject, OmniEventObject, PureAction } from './types'; import * as actionTypes from './actionTypes'; export { actionTypes }; export declare const initEvent: { type: ActionTypes.Init; }; export declare function toEventObject(event: Event, payload?: Record & { type?: never; }): TEvent; export declare function getActionFunction(actionType: ActionType, actionFunctionMap?: ActionFunctionMap): ActionObject | ActionFunction | undefined; export declare function toActionObject(action: Action, actionFunctionMap?: ActionFunctionMap): ActionObject; export declare const toActionObjects: (action?: string | ActionObject | ActionFunction | Action[] | undefined, actionFunctionMap?: Record | ActionFunction> | undefined) => ActionObject[]; export declare function toActivityDefinition(action: string | ActivityDefinition): ActivityDefinition; /** * Raises an event. This places the event in the internal event queue, so that * the event is immediately consumed by the machine in the current step. * * @param eventType The event to raise. */ export declare function raise(event: Event): RaiseEvent; /** * Sends an event. This returns an action that will be read by an interpreter to * send the event in the next step, after the current step is finished executing. * * @param event The event to send. * @param options Options to pass into the send event: * - `id` - The unique send event identifier (used with `cancel()`). * - `delay` - The number of milliseconds to delay the sending of the event. * - `target` - The target of this event (by default, the machine the event was sent from). */ export declare function send(event: Event | SendExpr, options?: SendActionOptions): SendAction; export declare function resolveSend(action: SendAction, ctx: TContext, event: TEvent): SendActionObject>; /** * Sends an event to this machine's parent machine. * * @param event The event to send to the parent machine. * @param options Options to pass into the send event. */ export declare function sendParent(event: Event | SendExpr, options?: SendActionOptions): SendAction; /** * * @param expr The expression function to evaluate which will be logged. * Takes in 2 arguments: * - `ctx` - the current state context * - `event` - the event that caused this action to be executed. * @param label The label to give to the logged expression. */ export declare function log(expr?: (ctx: TContext, event: TEvent) => any, label?: string): { type: ActionTypes; label: string | undefined; expr: (ctx: TContext, event: TEvent) => any; }; /** * Cancels an in-flight `send(...)` action. A canceled sent action will not * be executed, nor will its event be sent, unless it has already been sent * (e.g., if `cancel(...)` is called after the `send(...)` action's `delay`). * * @param sendId The `id` of the `send(...)` action to cancel. */ export declare const cancel: (sendId: string | number) => CancelAction; /** * Starts an activity. * * @param activity The activity to start. */ export declare function start(activity: string | ActivityDefinition): ActivityActionObject; /** * Stops an activity. * * @param activity The activity to stop. */ export declare function stop(activity: string | ActivityDefinition): ActivityActionObject; /** * Updates the current context of the machine. * * @param assignment An object that represents the partial context to update. */ export declare const assign: (assignment: Assigner | Partial<{ [K in keyof TContext]: ((context: TContext, event: TEvent) => TContext[K]) | TContext[K]; }>) => AssignAction; export declare function isActionObject(action: Action): action is ActionObject; /** * Returns an event type that represents an implicit event that * is sent after the specified `delay`. * * @param delayRef The delay in milliseconds * @param id The state node ID where this event is handled */ export declare function after(delayRef: number | string, id?: string): string; /** * Returns an event that represents that a final state node * has been reached in the parent state node. * * @param id The final state node's parent state node `id` * @param data The data to pass into the event */ export declare function done(id: string, data?: any): DoneEventObject; /** * Returns an event that represents that an invoked service has terminated. * * An invoked service is terminated when it has reached a top-level final state node, * but not when it is canceled. * * @param id The final state node ID * @param data The data to pass into the event */ export declare function doneInvoke(id: string, data?: any): DoneEvent; export declare function error(id: string, data?: any): (ErrorPlatformEvent & string); export declare function pure(getActions: ((context: TContext, event: OmniEventObject) => SingleOrArray> | undefined)): PureAction;