@statelyai/sdk 0.12.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/auth.d.mts +1 -1
- package/dist/embed.mjs +1 -1
- package/dist/{graph-Dq5ycdSq.d.mts → graph-R0sbxnZ7.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +6 -4
- package/dist/{inspect-BmZUcnZB.d.mts → inspect-BMHheAvx.d.mts} +85 -4
- package/dist/inspect-D9GyHTTW.mjs +469 -0
- package/dist/inspect.d.mts +3 -3
- package/dist/inspect.mjs +2 -305
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +35 -6
- package/dist/protocol.mjs +3 -1
- package/dist/relay.d.mts +43 -0
- package/dist/relay.mjs +153 -0
- package/dist/studio.d.mts +1 -1
- package/dist/sync.d.mts +1 -1
- package/dist/sync.mjs +1 -1
- package/dist/{transport-DysvAtl5.mjs → transport-D2Ud05yg.mjs} +178 -2
- package/package.json +6 -1
- /package/dist/{auth-DO1-eQcU.d.mts → auth-DmPZiERd.d.mts} +0 -0
- /package/dist/{dist-C-AdA8Iw.mjs → dist-CHGcvOdQ.mjs} +0 -0
- /package/dist/{index-BRW2DecD.d.mts → index-DVjNSTuQ.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -117,19 +117,27 @@ self-hosted deployments that intentionally accept unauthenticated calls.
|
|
|
117
117
|
|
|
118
118
|
### Inspector
|
|
119
119
|
|
|
120
|
+
<!-- createInspector API from src/inspect.ts -->
|
|
121
|
+
|
|
120
122
|
Stream live actor-system state to the Stately inspector over WebSockets, with support for automatic XState actor adoption and manual actor registration.
|
|
121
123
|
|
|
122
124
|
```ts
|
|
123
125
|
import { createActor } from 'xstate';
|
|
124
|
-
import {
|
|
126
|
+
import { createInspector } from '@statelyai/sdk';
|
|
125
127
|
|
|
126
128
|
const actor = createActor(machine);
|
|
127
|
-
const inspector =
|
|
129
|
+
const inspector = createInspector({
|
|
130
|
+
url: 'ws://localhost:1999/inspect/local',
|
|
131
|
+
});
|
|
128
132
|
|
|
129
133
|
inspector.inspect(actor);
|
|
130
134
|
actor.start();
|
|
131
135
|
```
|
|
132
136
|
|
|
137
|
+
XState v5 and v6 inspection events normalize to actor, transition, and stop
|
|
138
|
+
events before crossing the WebSocket protocol.
|
|
139
|
+
In Node, the inspector opens in the default browser automatically.
|
|
140
|
+
|
|
133
141
|
### CLI and sync
|
|
134
142
|
|
|
135
143
|
A `statelyai` CLI for syncing local XState source files with Stately Studio projects: push local machines to the cloud, pull remote changes back into source, and open a local file in a browser-backed visual editor session.
|
package/dist/auth.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-
|
|
1
|
+
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-DmPZiERd.mjs";
|
|
2
2
|
export { StatelyAuthMode, StatelyCredential, createAuthorizationHeader, getCredentialToken };
|
package/dist/embed.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as createPendingExportManager, i as createEventRegistry, n as createPostMessageTransport, o as toInitMessage } from "./transport-D2Ud05yg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/embed.ts
|
|
4
4
|
function buildEmbedUrl(options) {
|
package/dist/graph.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-
|
|
1
|
+
import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-R0sbxnZ7.mjs";
|
|
2
2
|
export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
|
-
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
2
|
+
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
3
3
|
import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
4
|
-
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-
|
|
4
|
+
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-DmPZiERd.mjs";
|
|
5
5
|
import { AssetConfig, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
6
|
-
import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-
|
|
7
|
-
import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-
|
|
8
|
-
import { a as
|
|
6
|
+
import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-DVjNSTuQ.mjs";
|
|
7
|
+
import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-R0sbxnZ7.mjs";
|
|
8
|
+
import { a as InspectorEvents, c as createStatelyInspector, d as MultiplexedWebSocketConnectionOptions, f as Transport, h as createWebSocketTransport, i as Inspector, l as MultiplexedChannelOptions, m as createPostMessageTransport, n as CreateInspectorOptions, o as ManualActorOptions, p as createMultiplexedWebSocketConnection, r as InspectedTransition, s as createInspector, t as AdoptedActor, u as MultiplexedWebSocketConnection } from "./inspect-BMHheAvx.mjs";
|
|
9
9
|
import { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, EnsureProjectInput, ExtractMachinesResponse, ExtractedMachine, GetMachineOptions, ProjectData, ProjectMachine, ProjectVisibility, RepoType, StudioApiError, StudioClient, StudioClientOptions, StudioMachineRecord, UpdateMachineInput, VerifyApiKeyResponse, XStateVersion, createStatelyClient } from "./studio.mjs";
|
|
10
10
|
import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
11
11
|
import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
|
|
12
|
+
import { CreateInspectionRelayOptions, InspectionRelay, InspectionRelayEffect, InspectionRelayPeer, InspectionRelayRole, InspectionRelaySnapshot, createInspectionRelay } from "./relay.mjs";
|
|
12
13
|
//#region src/statelyPragma.d.ts
|
|
13
14
|
interface StatelyPragma {
|
|
14
15
|
tag: '@statelyai';
|
|
@@ -31,4 +32,4 @@ declare function findStatelyPragmaAttachments(sourceText: string, fileName?: str
|
|
|
31
32
|
declare function getStatelyPragma(sourceText: string, fileName?: string, machineIndex?: number): StatelyPragma | undefined;
|
|
32
33
|
declare function upsertStatelyPragma(sourceText: string, id: string, options?: UpsertStatelyPragmaOptions): string;
|
|
33
34
|
//#endregion
|
|
34
|
-
export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesResponse, type ExtractedMachine, type GetMachineOptions, type GraphPatch, type InitOptions, type Inspector, type InspectorEvents, type MachineConfigOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectVisibility, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RepoType, type ResolvedSyncInput, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type UpdateMachineInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type XStateTSOptions, type XStateVersion, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
35
|
+
export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectionRelayOptions, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesResponse, type ExtractedMachine, type GetMachineOptions, type GraphPatch, INSPECTION_PROTOCOL_VERSION, type InitOptions, type InspectedTransition, type InspectionAction, type InspectionRelay, type InspectionRelayEffect, type InspectionRelayPeer, type InspectionRelayRole, type InspectionRelaySnapshot, type InspectionSentEvent, type InspectionTakenTransition, type Inspector, type InspectorEvents, type MachineConfigOptions, type ManualActorOptions, type MultiplexedChannelOptions, type MultiplexedWebSocketConnection, type MultiplexedWebSocketConnectionOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectVisibility, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RepoType, type ResolvedSyncInput, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type UpdateMachineInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type XStateTSOptions, type XStateVersion, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionRelay, createInspector, createMultiplexedWebSocketConnection, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { n as createWebSocketTransport, t as
|
|
1
|
+
import { n as createPostMessageTransport, r as createWebSocketTransport, t as createMultiplexedWebSocketConnection } from "./transport-D2Ud05yg.mjs";
|
|
2
|
+
import { INSPECTION_PROTOCOL_VERSION } from "./protocol.mjs";
|
|
2
3
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
3
4
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
4
|
-
import { createStatelyInspector } from "./inspect.mjs";
|
|
5
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-D9GyHTTW.mjs";
|
|
5
6
|
import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
6
7
|
import { StudioApiError, createStatelyClient } from "./studio.mjs";
|
|
7
8
|
import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
8
9
|
import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
9
|
-
import { a as eventsSchemaToTSType, c as jsonSchemaToTSType, f as findStatelyPragmaAttachments, l as raw, m as upsertStatelyPragma, n as RawCode, o as graphToMachineConfig, p as getStatelyPragma, r as contextSchemaToTSType, s as graphToXStateTS, u as serializeJS } from "./dist-
|
|
10
|
+
import { a as eventsSchemaToTSType, c as jsonSchemaToTSType, f as findStatelyPragmaAttachments, l as raw, m as upsertStatelyPragma, n as RawCode, o as graphToMachineConfig, p as getStatelyPragma, r as contextSchemaToTSType, s as graphToXStateTS, u as serializeJS } from "./dist-CHGcvOdQ.mjs";
|
|
10
11
|
import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
|
|
12
|
+
import { createInspectionRelay } from "./relay.mjs";
|
|
11
13
|
|
|
12
|
-
export { RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
14
|
+
export { INSPECTION_PROTOCOL_VERSION, RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionRelay, createInspector, createMultiplexedWebSocketConnection, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorCapabilities, EmbedEventMap, ExportCallOptions, ExportFormat, ExportFormatMap, ProtocolMessage } from "./protocol.mjs";
|
|
1
|
+
import { EditorCapabilities, EmbedEventMap, ExportCallOptions, ExportFormat, ExportFormatMap, InspectionAction, InspectionSentEvent, InspectionTakenTransition, ProtocolMessage } from "./protocol.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/transport.d.ts
|
|
4
4
|
interface Transport {
|
|
@@ -29,6 +29,39 @@ interface WebSocketTransportOptions {
|
|
|
29
29
|
maxReconnectAttempts?: number;
|
|
30
30
|
}
|
|
31
31
|
declare function createWebSocketTransport(options: WebSocketTransportOptions): Transport;
|
|
32
|
+
interface MultiplexedWebSocketConnectionOptions {
|
|
33
|
+
url: string;
|
|
34
|
+
role: 'client' | 'viz';
|
|
35
|
+
/** First (primary) session to register on connect. */
|
|
36
|
+
sessionId: string;
|
|
37
|
+
/** Metadata for the primary session. */
|
|
38
|
+
metadata?: {
|
|
39
|
+
name?: string;
|
|
40
|
+
machineId?: string;
|
|
41
|
+
};
|
|
42
|
+
reconnect?: boolean;
|
|
43
|
+
maxReconnectAttempts?: number;
|
|
44
|
+
}
|
|
45
|
+
interface MultiplexedChannelOptions {
|
|
46
|
+
/** Session id this channel targets. */
|
|
47
|
+
sessionId: string;
|
|
48
|
+
/** Optional metadata for this session. */
|
|
49
|
+
metadata?: {
|
|
50
|
+
name?: string;
|
|
51
|
+
machineId?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface MultiplexedWebSocketConnection {
|
|
55
|
+
/** Open a channel for a sessionId. Re-opening an existing session returns the same channel. */
|
|
56
|
+
openChannel(options: MultiplexedChannelOptions): Transport;
|
|
57
|
+
/** Close the connection and all its channels. */
|
|
58
|
+
destroy(): void;
|
|
59
|
+
/** Whether the underlying WebSocket is connected + the primary session is registered. */
|
|
60
|
+
readonly ready: boolean;
|
|
61
|
+
/** Primary session id (first registered). */
|
|
62
|
+
readonly primarySessionId: string;
|
|
63
|
+
}
|
|
64
|
+
declare function createMultiplexedWebSocketConnection(options: MultiplexedWebSocketConnectionOptions): MultiplexedWebSocketConnection;
|
|
32
65
|
//#endregion
|
|
33
66
|
//#region src/inspect.d.ts
|
|
34
67
|
interface MinimalActorRef {
|
|
@@ -39,6 +72,7 @@ interface MinimalActorRef {
|
|
|
39
72
|
logic?: {
|
|
40
73
|
config?: unknown;
|
|
41
74
|
};
|
|
75
|
+
src?: unknown;
|
|
42
76
|
getSnapshot(): MinimalSnapshot;
|
|
43
77
|
system: {
|
|
44
78
|
inspect: (observer: (event: InspectionEvent) => void) => {
|
|
@@ -56,6 +90,10 @@ type InspectionEvent = {
|
|
|
56
90
|
type: '@xstate.actor';
|
|
57
91
|
actorRef: MinimalActorRef;
|
|
58
92
|
rootId: string;
|
|
93
|
+
parentRef?: MinimalActorRef;
|
|
94
|
+
id?: string;
|
|
95
|
+
src?: unknown;
|
|
96
|
+
snapshot?: MinimalSnapshot;
|
|
59
97
|
} | {
|
|
60
98
|
type: '@xstate.snapshot';
|
|
61
99
|
actorRef: MinimalActorRef;
|
|
@@ -68,12 +106,34 @@ type InspectionEvent = {
|
|
|
68
106
|
rootId: string;
|
|
69
107
|
sourceRef?: MinimalActorRef;
|
|
70
108
|
event: unknown;
|
|
109
|
+
} | {
|
|
110
|
+
type: '@xstate.transition';
|
|
111
|
+
actorRef: MinimalActorRef;
|
|
112
|
+
rootId: string;
|
|
113
|
+
snapshot: MinimalSnapshot;
|
|
114
|
+
event: unknown;
|
|
115
|
+
sourceRef?: MinimalActorRef;
|
|
116
|
+
targetRef?: MinimalActorRef;
|
|
117
|
+
eventType?: string;
|
|
118
|
+
microsteps?: unknown[];
|
|
119
|
+
actions?: Array<{
|
|
120
|
+
type: string;
|
|
121
|
+
params: unknown;
|
|
122
|
+
}>;
|
|
123
|
+
sent?: Array<{
|
|
124
|
+
targetRef?: MinimalActorRef;
|
|
125
|
+
targetId: string;
|
|
126
|
+
event: unknown;
|
|
127
|
+
delay?: number;
|
|
128
|
+
id?: string;
|
|
129
|
+
}>;
|
|
71
130
|
} | {
|
|
72
131
|
type: '@xstate.microstep';
|
|
73
132
|
actorRef: MinimalActorRef;
|
|
74
133
|
rootId: string;
|
|
75
134
|
snapshot: MinimalSnapshot;
|
|
76
135
|
event: unknown;
|
|
136
|
+
_transitions?: unknown[];
|
|
77
137
|
} | {
|
|
78
138
|
type: '@xstate.action';
|
|
79
139
|
actorRef: MinimalActorRef;
|
|
@@ -99,9 +159,28 @@ interface AdoptedActor {
|
|
|
99
159
|
/** Machine config sent to the visualizer, or `null` for non-machine actors. */
|
|
100
160
|
machineConfig: unknown;
|
|
101
161
|
}
|
|
162
|
+
/** One normalized transition, independent of the XState inspection version. */
|
|
163
|
+
interface InspectedTransition {
|
|
164
|
+
actorId: string;
|
|
165
|
+
sourceActorId: string | null;
|
|
166
|
+
previousSnapshot: unknown | null;
|
|
167
|
+
snapshot: unknown;
|
|
168
|
+
event: unknown | null;
|
|
169
|
+
actions: InspectionAction[];
|
|
170
|
+
transitions: InspectionTakenTransition[];
|
|
171
|
+
sent: InspectionSentEvent[];
|
|
172
|
+
}
|
|
102
173
|
interface InspectorEvents {
|
|
174
|
+
actor: AdoptedActor;
|
|
175
|
+
transition: InspectedTransition;
|
|
176
|
+
stop: {
|
|
177
|
+
actorId: string;
|
|
178
|
+
};
|
|
179
|
+
/** @deprecated Use `actor`. */
|
|
103
180
|
register: AdoptedActor;
|
|
181
|
+
/** @deprecated Use `transition`. */
|
|
104
182
|
snapshot: AdoptedActor;
|
|
183
|
+
/** @deprecated Use `stop`. */
|
|
105
184
|
stopped: {
|
|
106
185
|
actorId: string;
|
|
107
186
|
};
|
|
@@ -141,7 +220,7 @@ interface CreateInspectorOptions {
|
|
|
141
220
|
* Extract the machine config for a given actor. Defaults to reading
|
|
142
221
|
* `actor.logic.config`. Return `null` for non-machine actors.
|
|
143
222
|
*/
|
|
144
|
-
extractMachineConfig?: (actor: any) => unknown;
|
|
223
|
+
extractMachineConfig?: (actor: any, source?: unknown) => unknown;
|
|
145
224
|
/** Selected actor id to focus on first. Defaults to the first inspected root. */
|
|
146
225
|
selectedActorId?: string;
|
|
147
226
|
/** Panel layout forwarded into the system init message. */
|
|
@@ -200,6 +279,8 @@ interface Inspector {
|
|
|
200
279
|
/** Tear down the WebSocket + xstate subscription. */
|
|
201
280
|
destroy(): void;
|
|
202
281
|
}
|
|
203
|
-
declare function
|
|
282
|
+
declare function createInspector(options?: CreateInspectorOptions): Inspector;
|
|
283
|
+
/** @deprecated Use {@link createInspector}. */
|
|
284
|
+
declare const createStatelyInspector: typeof createInspector;
|
|
204
285
|
//#endregion
|
|
205
|
-
export {
|
|
286
|
+
export { InspectorEvents as a, createStatelyInspector as c, MultiplexedWebSocketConnectionOptions as d, Transport as f, createWebSocketTransport as h, Inspector as i, MultiplexedChannelOptions as l, createPostMessageTransport as m, CreateInspectorOptions as n, ManualActorOptions as o, createMultiplexedWebSocketConnection as p, InspectedTransition as r, createInspector as s, AdoptedActor as t, MultiplexedWebSocketConnection as u };
|