UNPKG

1.49 kBTypeScriptView Raw
1import { ActorRefLike, AnyEventObject, AnyTransitionDefinition, Snapshot } from "./types.js";
2export type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedMicrostepEvent | InspectedActionEvent;
3interface BaseInspectionEventProperties {
4 rootId: string;
5 /**
6 * The relevant actorRef for the inspection event.
7 *
8 * - For snapshot events, this is the `actorRef` of the snapshot.
9 * - For event events, this is the target `actorRef` (recipient of event).
10 * - For actor events, this is the `actorRef` of the registered actor.
11 */
12 actorRef: ActorRefLike;
13}
14export interface InspectedSnapshotEvent extends BaseInspectionEventProperties {
15 type: '@xstate.snapshot';
16 event: AnyEventObject;
17 snapshot: Snapshot<unknown>;
18}
19interface InspectedMicrostepEvent extends BaseInspectionEventProperties {
20 type: '@xstate.microstep';
21 event: AnyEventObject;
22 snapshot: Snapshot<unknown>;
23 _transitions: AnyTransitionDefinition[];
24}
25export interface InspectedActionEvent extends BaseInspectionEventProperties {
26 type: '@xstate.action';
27 action: {
28 type: string;
29 params: unknown;
30 };
31}
32export interface InspectedEventEvent extends BaseInspectionEventProperties {
33 type: '@xstate.event';
34 sourceRef: ActorRefLike | undefined;
35 event: AnyEventObject;
36}
37export interface InspectedActorEvent extends BaseInspectionEventProperties {
38 type: '@xstate.actor';
39}
40export {};