import { Action, Event, EventObject, SingleOrArray, SendAction, SendActionOptions, CancelAction, ActionObject, ActionType, Assigner, PropertyAssigner, AssignAction, ActionFunction, ActionFunctionMap, ActivityActionObject, ActionTypes, ActivityDefinition, RaiseAction, RaiseActionObject, DoneEvent, ErrorPlatformEvent, DoneEventObject, SendExpr, SendActionObject, PureAction, LogExpr, LogAction, LogActionObject, DelayFunctionMap, SCXML, ExprWithMeta, ChooseCondition, ChooseAction, AnyEventObject, Expr, StopAction, StopActionObject, Cast, EventFrom, AnyActorRef, PredictableActionArgumentsExec, RaiseActionOptions, NoInfer, BaseActionObject, LowInfer } from './types'; import * as actionTypes from './actionTypes'; import { State } from './State'; import { StateNode } from './StateNode'; export { actionTypes }; export declare const initEvent: SCXML.Event<{ type: ActionTypes; }>; 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?: SingleOrArray> | undefined, actionFunctionMap?: ActionFunctionMap | 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: NoInfer> | SendExpr, options?: RaiseActionOptions): RaiseAction; export declare function resolveRaise(action: RaiseAction, ctx: TContext, _event: SCXML.Event, delaysMap?: DelayFunctionMap): RaiseActionObject; /** * 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. * * @deprecated Use the `sendTo(...)` action creator instead. * * @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. * - `to` - 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: SCXML.Event, delaysMap?: DelayFunctionMap): SendActionObject; /** * Sends an event to this machine's parent. * * @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; declare type InferEvent = { [T in E['type']]: { type: T; } & Extract; }[E['type']]; /** * Sends an event to an actor. * * @param actor The `ActorRef` to send the event to. * @param event The event to send, or an expression that evaluates to the event to send * @param options Send action options * @returns An XState send action object */ export declare function sendTo(actor: string | TActor | ((ctx: TContext, event: TEvent) => TActor), event: EventFrom | SendExpr, EventObject>>>, options?: SendActionOptions): SendAction; /** * Sends an update event to this machine's parent. */ export declare function sendUpdate(): SendAction; /** * Sends an event back to the sender of the original event. * * @param event The event to send back to the sender * @param options Options to pass into the send event */ export declare function respond(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?: string | LogExpr, label?: string): LogAction; export declare const resolveLog: (action: LogAction, ctx: TContext, _event: SCXML.Event) => LogActionObject; /** * 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 actorRef The activity to stop. */ export declare function stop(actorRef: string | Expr): StopAction; export declare function resolveStop(action: StopAction, context: TContext, _event: SCXML.Event): StopActionObject; /** * Updates the current context of the machine. * * @param assignment An object that represents the partial context to update. */ export declare const assign: (assignment: Assigner, TExpressionEvent> | PropertyAssigner, TExpressionEvent>) => 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: TExpressionEvent) => SingleOrArray | ActionFunction> | undefined): PureAction; /** * Forwards (sends) an event to a specified service. * * @param target The target service to forward the event to. * @param options Options to pass into the send action creator. */ export declare function forwardTo(target: Required>['to'], options?: SendActionOptions): SendAction; /** * Escalates an error by sending it as an event to this machine's parent. * * @param errorData The error data to send, or the expression function that * takes in the `context`, `event`, and `meta`, and returns the error data to send. * @param options Options to pass into the send action creator. */ export declare function escalate(errorData: TErrorData | ExprWithMeta, options?: SendActionOptions): SendAction; export declare function choose(conds: Array>): ChooseAction; export declare function resolveActions(machine: StateNode, currentState: State | undefined, currentContext: TContext, _event: SCXML.Event, actionBlocks: Array<{ type: string; actions: Array>; }>, predictableExec?: PredictableActionArgumentsExec, preserveActionOrder?: boolean): [Array>, TContext]; //# sourceMappingURL=actions.d.ts.map