UNPKG

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