@statelyai/sdk 0.38.1 → 0.39.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 +3 -0
- package/dist/assetStorage.d.mts +1 -1
- package/dist/editorHostProtocol.d.mts +8 -3
- package/dist/embed.d.mts +2 -2
- package/dist/embed.mjs +6 -1
- package/dist/{graph-C--idnZO.d.mts → graph-CfWCJS4m.d.mts} +6 -2
- package/dist/graph.d.mts +1 -1
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +4 -3
- package/dist/{inspect-Ca_ZPcrf.mjs → inspect-Bs7a6Sbq.mjs} +21 -3
- package/dist/{inspect-BEboOFmE.d.mts → inspect-JNvMtuzC.d.mts} +7 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +3 -2
- package/dist/preview.d.mts +36 -0
- package/dist/preview.mjs +92 -0
- package/dist/{protocol-weYUfy3l.d.mts → protocol-D3XQmmmv.d.mts} +37 -6
- package/dist/protocol.d.mts +2 -2
- package/dist/relay.d.mts +1 -1
- package/dist/relay.mjs +2 -0
- package/dist/{version-IE72VxaP.mjs → version-hQHX5bet.mjs} +5 -1
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -96,6 +96,9 @@ also update that frame surface.
|
|
|
96
96
|
If the initial theme is omitted, the SDK keeps the iframe hidden until the
|
|
97
97
|
machine loads or reports an error, so a theme supplied only to `init` cannot
|
|
98
98
|
flash the default theme. The surrounding host supplies the waiting surface.
|
|
99
|
+
For same-site OAuth embeds without an API key, the sign-in prompt reports
|
|
100
|
+
`unauthenticated` through `onError` and reveals the iframe. Keep it mounted;
|
|
101
|
+
initialization remains queued until sign-in completes and the editor is ready.
|
|
99
102
|
Source conversion failures notify `onError` and reveal the editor's error screen.
|
|
100
103
|
Protocol incompatibility also restores the frame's visibility and reports the
|
|
101
104
|
failure to the host.
|
package/dist/assetStorage.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as GraphPatch } from "./index-DfMkVP94.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { mn as EmbedPanelConfig, mt as ProjectWorkspaceConfig, n as AuthenticationRecovery, pn as PresentationMetadataInitializer, rt as ProjectEmbedMachine } from "./protocol-D3XQmmmv.mjs";
|
|
3
3
|
import { a as MachineSourceLocations, t as EditorCapabilities } from "./editor-sync-types-Ch5P5XRj.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/editorHostProtocol.d.ts
|
|
@@ -34,8 +34,13 @@ type EditorHostInboundMessage = {
|
|
|
34
34
|
type: '@statelyai.change';
|
|
35
35
|
graph: unknown;
|
|
36
36
|
machineConfig: unknown;
|
|
37
|
-
machineId?: string;
|
|
38
|
-
|
|
37
|
+
machineId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* `external`: the editor has applied a host source refresh, not a visual
|
|
40
|
+
* edit. `layout`: automatic layout positions to persist as presentation.
|
|
41
|
+
*/
|
|
42
|
+
source?: 'external' | 'layout'; /** Internal persistence payload sent with Studio-linked layout changes. */
|
|
43
|
+
serialized?: Record<string, string>;
|
|
39
44
|
sourceBaselineGraph?: unknown;
|
|
40
45
|
patches?: unknown[];
|
|
41
46
|
sourceLocations?: MachineSourceLocations;
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ProfileManifest, o as GraphPatch } from "./index-DfMkVP94.mjs";
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
3
|
-
import { $ as MachineVersionAutoSaveOptions, A as ExportFormat, E as EmbedMode, F as HostUpdateOptions, Q as MachineSourceLocations,
|
|
2
|
+
import { i as StatelyGraph } from "./graph-CfWCJS4m.mjs";
|
|
3
|
+
import { $ as MachineVersionAutoSaveOptions, A as ExportFormat, E as EmbedMode, F as HostUpdateOptions, Q as MachineSourceLocations, Qt as UploadResult, S as EmbedEventName, X as MachineInitOptions, at as ProjectInitOptions, b as EmbedEventHandler, dt as ProjectWorkspaceActionIcon, f as CommentsConfig, gt as ProjectWorkspaceMachineOrigin, h as EditorCapabilities, hn as EmbedPanelPosition, ht as ProjectWorkspaceMachine, i as CapabilityDeniedEvent, j as ExportFormatMap, k as ExportCallOptions, mn as EmbedPanelConfig, mt as ProjectWorkspaceConfig, nn as ViewerOptions, pt as ProjectWorkspaceCapabilities, rt as ProjectEmbedMachine, ut as ProjectWorkspaceAction, v as EmbedDocument, vt as ProjectWorkspaceProject, w as EmbedExtensionsManifest, x as EmbedEventMap, y as EmbedDocumentLanguage, z as InitOptions } from "./protocol-D3XQmmmv.mjs";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
import { GraphDiff } from "@statelyai/graph";
|
|
6
6
|
|
package/dist/embed.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./protocol-M3Zeun3o.mjs";
|
|
2
|
-
import { c as createPendingExportManager, l as settingsWithViewMode, r as createPostMessageTransport, s as createEventRegistry, t as SDK_VERSION, u as toInitMessage } from "./version-
|
|
2
|
+
import { c as createPendingExportManager, l as settingsWithViewMode, r as createPostMessageTransport, s as createEventRegistry, t as SDK_VERSION, u as toInitMessage } from "./version-hQHX5bet.mjs";
|
|
3
3
|
import { EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/embed.ts
|
|
@@ -92,6 +92,8 @@ function extractInitOptions(options) {
|
|
|
92
92
|
capabilities: options.capabilities,
|
|
93
93
|
examples: options.examples,
|
|
94
94
|
panels: options.panels,
|
|
95
|
+
panelLayout: options.panelLayout,
|
|
96
|
+
defaultPanelSide: options.defaultPanelSide,
|
|
95
97
|
commentsByMachineId: options.commentsByMachineId,
|
|
96
98
|
projectWorkspace: options.projectWorkspace,
|
|
97
99
|
projectWorkspaceOpen: options.projectWorkspaceOpen,
|
|
@@ -113,6 +115,8 @@ function extractInitOptions(options) {
|
|
|
113
115
|
capabilities: options.capabilities,
|
|
114
116
|
examples: options.examples,
|
|
115
117
|
panels: options.panels,
|
|
118
|
+
panelLayout: options.panelLayout,
|
|
119
|
+
defaultPanelSide: options.defaultPanelSide,
|
|
116
120
|
comments: options.comments,
|
|
117
121
|
sourceLocations: options.sourceLocations,
|
|
118
122
|
chrome: options.chrome?.controls ? { controls: options.chrome.controls } : void 0,
|
|
@@ -291,6 +295,7 @@ function createStatelyEmbed(options) {
|
|
|
291
295
|
graph: change.graph,
|
|
292
296
|
machineConfig: change.machineConfig,
|
|
293
297
|
machineId: change.machineId,
|
|
298
|
+
...change.source ? { source: change.source } : {},
|
|
294
299
|
patches: change.patches,
|
|
295
300
|
sourceLocations: change.sourceLocations
|
|
296
301
|
});
|
|
@@ -268,13 +268,17 @@ type DigraphInlineAction = {
|
|
|
268
268
|
};
|
|
269
269
|
type DigraphBuiltinAction = DigraphAssignAction | DigraphRaiseAction | DigraphLogAction | DigraphSendToAction | DigraphStopAction;
|
|
270
270
|
type DigraphAction = DigraphNamedAction | DigraphInlineAction | DigraphBuiltinAction;
|
|
271
|
-
type AssetTemplate = '@stately.image' | '@figma.link' | '@stately.video' | '@stately.pdf' | '@stately.text' | '@stately.unknown';
|
|
271
|
+
type AssetTemplate = '@stately.iframe' | '@stately.image' | '@figma.link' | '@stately.video' | '@stately.pdf' | '@stately.text' | '@stately.unknown';
|
|
272
272
|
type AssetSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
273
273
|
interface AssetProperties {
|
|
274
274
|
uuid: string;
|
|
275
275
|
url: string;
|
|
276
276
|
}
|
|
277
|
-
type DigraphAssetProperties<T extends AssetTemplate> = T extends '@stately.
|
|
277
|
+
type DigraphAssetProperties<T extends AssetTemplate> = T extends '@stately.iframe' ? AssetProperties & {
|
|
278
|
+
size: AssetSize;
|
|
279
|
+
width?: number;
|
|
280
|
+
height?: number;
|
|
281
|
+
} : T extends '@stately.image' ? AssetProperties & {
|
|
278
282
|
size: AssetSize;
|
|
279
283
|
path: string;
|
|
280
284
|
} : T extends '@figma.link' ? AssetProperties & {
|
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-CfWCJS4m.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,13 +1,14 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
2
|
import { o as GraphPatch, r as ActionLocation } from "./index-DfMkVP94.mjs";
|
|
3
|
-
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-
|
|
4
|
-
import { $ as MachineVersionAutoSaveOptions, A as ExportFormat, C as EmbedExample, E as EmbedMode, F as HostUpdateOptions, G as InspectionTakenTransition, I as INSPECTION_PROTOCOL_VERSION, K as InspectorLoadedEvent, L as INSPECTION_ROOM_QUERY_PARAM, S as EmbedEventName, V as InspectionAction, W as InspectionSentEvent,
|
|
3
|
+
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-CfWCJS4m.mjs";
|
|
4
|
+
import { $ as MachineVersionAutoSaveOptions, A as ExportFormat, C as EmbedExample, E as EmbedMode, F as HostUpdateOptions, G as InspectionTakenTransition, I as INSPECTION_PROTOCOL_VERSION, K as InspectorLoadedEvent, L as INSPECTION_ROOM_QUERY_PARAM, Qt as UploadResult, S as EmbedEventName, V as InspectionAction, W as InspectionSentEvent, _ as EmbedChromeOptions, an as createInspectionActorId, b as EmbedEventHandler, cn as isEmbedExample, dn as mergeInspectorSettings, dt as ProjectWorkspaceActionIcon, f as CommentsConfig, fn as resolveInspectorSettings, gt as ProjectWorkspaceMachineOrigin, h as EditorCapabilities, hn as EmbedPanelPosition, ht as ProjectWorkspaceMachine, i as CapabilityDeniedEvent, in as assertEmbedExamples, j as ExportFormatMap, k as ExportCallOptions, ln as isEmbedExampleMachine, m as EMBED_DOCUMENT_LIMITS, mn as EmbedPanelConfig, mt as ProjectWorkspaceConfig, nn as ViewerOptions, on as createInspectionRoomUrls, p as EMBED_DOCUMENT_LANGUAGES, pn as PresentationMetadataInitializer, pt as ProjectWorkspaceCapabilities, q as InspectorSettings, r as CapabilityDeniedCapability, rt as ProjectEmbedMachine, sn as getInspectionRoomId, ut as ProjectWorkspaceAction, v as EmbedDocument, vt as ProjectWorkspaceProject, x as EmbedEventMap, y as EmbedDocumentLanguage, z as InitOptions } from "./protocol-D3XQmmmv.mjs";
|
|
5
5
|
import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
6
6
|
import { StatelyAuthMode, StatelyCredential, createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
7
7
|
import { EDITOR_PROTOCOL_VERSION, EditorHostDiagnostic, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostValidationIssue } from "./editorHostProtocol.mjs";
|
|
8
8
|
import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, PlanSourceUpdateInput, SourceUpdateEdit, SourceUpdatePlan, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
9
|
-
import { _ as createWebSocketTransport, a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, g as createPostMessageTransport, h as TransportFailure, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-
|
|
9
|
+
import { _ as createWebSocketTransport, a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, g as createPostMessageTransport, h as TransportFailure, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-JNvMtuzC.mjs";
|
|
10
10
|
import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-DSwp5rXP.mjs";
|
|
11
11
|
import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
12
12
|
import { CreateInspectionRelayOptions, InspectionRelay, InspectionRelayEffect, InspectionRelayPeer, InspectionRelayRole, InspectionRelaySnapshot, createInspectionRelay } from "./relay.mjs";
|
|
13
|
-
|
|
13
|
+
import { PreviewEvent, PreviewState, connectPreviewHost, createPreview } from "./preview.mjs";
|
|
14
|
+
export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CommentsConfig, type ConnectedRepo, type CreateInspectionRelayOptions, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, DEFAULT_STATELY_BASE_URL, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, type EditorCapabilities, type EditorHostDiagnostic, type EditorHostExportFormat, type EditorHostInboundMessage, type EditorHostInitOptions, type EditorHostOutboundMessage, type EditorHostValidationIssue, type EmbedChromeOptions, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedExample, type EmbedFormatContext, type EmbedFormatDefinition, type EmbedGraph, type EmbedMode, type EmbedPanelConfig, type EmbedPanelPosition, type EmbedProfileDefinition, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesInput, type ExtractMachinesResponse, type ExtractedMachine, type ExtractedMachines, type GetMachineOptions, type GraphPatch, type HostUpdateOptions, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, type InitOptions, type InspectedEvent, type InspectedSnapshot, type InspectedTransition, type InspectionAction, type InspectionRelay, type InspectionRelayEffect, type InspectionRelayPeer, type InspectionRelayRole, type InspectionRelaySnapshot, type InspectionSentEvent, type InspectionTakenTransition, type Inspector, type InspectorConnection, type InspectorDiscoveryEntry, type InspectorEvents, type InspectorInspectionEvent, type InspectorLoadedEvent, type InspectorSettings, type LegacyProjectVisibility, type LegacyUpdateMachineInput, type Machine, type MachineVersion, type MachineVersionAutoSaveOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSourceUpdateInput, type PresentationMetadataInitializer, type PreviewEvent, type PreviewState, type Project, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectMachineSummary, type ProjectSummary, type ProjectVisibility, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, type RepoType, type ResourceErrorCode, type S3UploadTarget, type SourceUpdateEdit, type SourceUpdatePlan, 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 StudioAction, StudioApiError, type StudioApiErrorOptions, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type StudioRequestOptions, type SupabaseStorageClient, type Transport, type TransportFailure, type UpdateMachineInput, type UpdateProjectInput, type UploadResult, type VerifyApiKeyResponse, type VerifyResult, type ViewerOptions, type XStateVersion, assertEmbedExamples, buildAuthorizeUrl, connectPreviewHost, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createPreview, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, fromStudioMachine, getCredentialToken, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine, mergeInspectorSettings, refreshToken, registerOAuthClient, resolveInspectorSettings, studioMachineConverter, toStudioMachine };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-uGK1kS0n.mjs";
|
|
2
2
|
import { c as createInspectionRoomUrls, d as isEmbedExampleMachine, i as INSPECTION_ROOM_QUERY_PARAM, l as getInspectionRoomId, m as resolveInspectorSettings, n as EMBED_DOCUMENT_LIMITS, o as assertEmbedExamples, p as mergeInspectorSettings, r as INSPECTION_PROTOCOL_VERSION, s as createInspectionActorId, t as EMBED_DOCUMENT_LANGUAGES, u as isEmbedExample } from "./protocol-M3Zeun3o.mjs";
|
|
3
|
-
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-
|
|
3
|
+
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-hQHX5bet.mjs";
|
|
4
4
|
import { EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol.mjs";
|
|
5
5
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
6
6
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { connectPreviewHost, createPreview } from "./preview.mjs";
|
|
8
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-Bs7a6Sbq.mjs";
|
|
8
9
|
import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
9
10
|
import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
10
11
|
import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
11
12
|
import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
|
|
12
13
|
import { createInspectionRelay } from "./relay.mjs";
|
|
13
14
|
|
|
14
|
-
export { DEFAULT_STATELY_BASE_URL, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, StatelyApiError, StudioApiError, assertEmbedExamples, buildAuthorizeUrl, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, fromStudioMachine, getCredentialToken, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine, mergeInspectorSettings, refreshToken, registerOAuthClient, resolveInspectorSettings, studioMachineConverter, toStudioMachine };
|
|
15
|
+
export { DEFAULT_STATELY_BASE_URL, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, StatelyApiError, StudioApiError, assertEmbedExamples, buildAuthorizeUrl, connectPreviewHost, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createPreview, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, fromStudioMachine, getCredentialToken, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine, mergeInspectorSettings, refreshToken, registerOAuthClient, resolveInspectorSettings, studioMachineConverter, toStudioMachine };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as createInspectionRoomUrls, l as getInspectionRoomId, m as resolveInspectorSettings, p as mergeInspectorSettings, r as INSPECTION_PROTOCOL_VERSION } from "./protocol-M3Zeun3o.mjs";
|
|
2
|
-
import { a as assertEmbedDocuments, c as createPendingExportManager, i as createWebSocketTransport, n as inspectionRuntime, o as assertEmbedPanels, s as createEventRegistry, t as SDK_VERSION } from "./version-
|
|
2
|
+
import { a as assertEmbedDocuments, c as createPendingExportManager, i as createWebSocketTransport, n as inspectionRuntime, o as assertEmbedPanels, s as createEventRegistry, t as SDK_VERSION } from "./version-hQHX5bet.mjs";
|
|
3
|
+
import { isPreviewEvent } from "./preview.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/openBrowser.ts
|
|
5
6
|
async function openBrowser(url) {
|
|
@@ -128,7 +129,7 @@ function createInspector(options = {}) {
|
|
|
128
129
|
let preferredSessionId = options.selectedSessionId ?? options.selectedActorId;
|
|
129
130
|
const environmentUrl = typeof process !== "undefined" ? process.env?.STATELY_INSPECT_URL : void 0;
|
|
130
131
|
const url = options.url ?? environmentUrl ?? "wss://sky.stately.ai";
|
|
131
|
-
const { inspectorBaseUrl, name, machines: configuredMachines, serializeSnapshot = defaultSerializeSnapshot, panels, documents, readOnly, depth, capabilities, sessionIdReuse = "stopped", transport: injectedTransport } = options;
|
|
132
|
+
const { inspectorBaseUrl, name, machines: configuredMachines, serializeSnapshot = defaultSerializeSnapshot, panels, panelLayout, defaultPanelSide, documents, readOnly, depth, capabilities, sessionIdReuse = "stopped", transport: injectedTransport } = options;
|
|
132
133
|
const declaredMachines = { ...configuredMachines };
|
|
133
134
|
const launch = options.launch ?? (options.autoOpen === true ? "browser" : "none");
|
|
134
135
|
const extractMachine = options.extractMachine ?? options.extractMachineConfig ?? defaultExtractMachineConfig;
|
|
@@ -272,6 +273,20 @@ function createInspector(options = {}) {
|
|
|
272
273
|
if (destroyed) return;
|
|
273
274
|
if (msg.producerId && msg.producerId !== producerId) return;
|
|
274
275
|
switch (msg.type) {
|
|
276
|
+
case "@statelyai.system.sendEvent": {
|
|
277
|
+
if (options.bidirectional !== true || !isPreviewEvent(msg.event)) break;
|
|
278
|
+
const actor = actorsByResolvedSessionId.get(msg.sessionId);
|
|
279
|
+
if (!actor || terminatedActors.has(actor) || actor.getSnapshot().status !== "active") break;
|
|
280
|
+
try {
|
|
281
|
+
actor.send?.(msg.event);
|
|
282
|
+
} catch (cause) {
|
|
283
|
+
emitLocal("error", {
|
|
284
|
+
code: "inspection_failed",
|
|
285
|
+
message: cause instanceof Error ? cause.message : String(cause)
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
275
290
|
case "@statelyai.system.loaded":
|
|
276
291
|
emitLocal("loaded", { ...msg.producerId && { producerId: msg.producerId } });
|
|
277
292
|
break;
|
|
@@ -495,6 +510,7 @@ function createInspector(options = {}) {
|
|
|
495
510
|
type: "@statelyai.system.init",
|
|
496
511
|
protocolVersion: INSPECTION_PROTOCOL_VERSION,
|
|
497
512
|
mode: "inspecting",
|
|
513
|
+
...options.bidirectional === true && { bidirectional: true },
|
|
498
514
|
actors: allEntries.map(toSystemEntry),
|
|
499
515
|
...configuredMachines !== void 0 || Object.keys(declaredMachines).length > 0 ? { machines: { ...declaredMachines } } : {},
|
|
500
516
|
...selectedSessionId && { selectedSessionId },
|
|
@@ -504,7 +520,9 @@ function createInspector(options = {}) {
|
|
|
504
520
|
...readOnly !== void 0 && { readOnly },
|
|
505
521
|
...depth !== void 0 && { depth },
|
|
506
522
|
...capabilities !== void 0 && { capabilities },
|
|
507
|
-
...panels && { panels }
|
|
523
|
+
...panels && { panels },
|
|
524
|
+
...panelLayout && { panelLayout },
|
|
525
|
+
...defaultPanelSide && { defaultPanelSide }
|
|
508
526
|
};
|
|
509
527
|
}
|
|
510
528
|
function sendInit() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ExportFormat, G as InspectionTakenTransition, H as InspectionClientMetadata, K as InspectorLoadedEvent, V as InspectionAction, W as InspectionSentEvent, Z as MachinePayload, j as ExportFormatMap, k as ExportCallOptions,
|
|
1
|
+
import { A as ExportFormat, G as InspectionTakenTransition, H as InspectionClientMetadata, K as InspectorLoadedEvent, V as InspectionAction, W as InspectionSentEvent, Z as MachinePayload, j as ExportFormatMap, k as ExportCallOptions, nn as ViewerOptions, q as InspectorSettings, x as EmbedEventMap, yt as ProtocolMessage } from "./protocol-D3XQmmmv.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/transport.d.ts
|
|
4
4
|
interface TransportFailure {
|
|
@@ -43,6 +43,10 @@ interface MinimalActorRef {
|
|
|
43
43
|
};
|
|
44
44
|
src?: unknown;
|
|
45
45
|
getSnapshot(): MinimalSnapshot;
|
|
46
|
+
send?(event: {
|
|
47
|
+
type: string;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}): void;
|
|
46
50
|
system: {
|
|
47
51
|
inspect: (observer: (event: InspectorInspectionEvent) => void) => {
|
|
48
52
|
unsubscribe: () => void;
|
|
@@ -144,6 +148,8 @@ interface ManualActorOptions {
|
|
|
144
148
|
systemId?: string;
|
|
145
149
|
}
|
|
146
150
|
interface CreateInspectorOptions extends ViewerOptions<InspectorSettings> {
|
|
151
|
+
/** Allow this inspector to send events to owned, live runtime actors. Default false. */
|
|
152
|
+
bidirectional?: boolean;
|
|
147
153
|
/**
|
|
148
154
|
* WebSocket relay base URL. Defaults to `STATELY_INSPECT_URL`, then
|
|
149
155
|
* `wss://sky.stately.ai`. Passing this option always wins.
|
package/dist/inspect.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as ExportFormat, E as EmbedMode, G as InspectionTakenTransition, K as InspectorLoadedEvent, S as EmbedEventName, V as InspectionAction, W as InspectionSentEvent, Z as MachinePayload, b as EmbedEventHandler, h as EditorCapabilities, j as ExportFormatMap, k as ExportCallOptions,
|
|
2
|
-
import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-
|
|
1
|
+
import { A as ExportFormat, E as EmbedMode, G as InspectionTakenTransition, K as InspectorLoadedEvent, S as EmbedEventName, V as InspectionAction, W as InspectionSentEvent, Z as MachinePayload, b as EmbedEventHandler, h as EditorCapabilities, j as ExportFormatMap, k as ExportCallOptions, mn as EmbedPanelConfig, nn as ViewerOptions, q as InspectorSettings, v as EmbedDocument, x as EmbedEventMap } from "./protocol-D3XQmmmv.mjs";
|
|
2
|
+
import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-JNvMtuzC.mjs";
|
|
3
3
|
export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedDocument, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, EmbedPanelConfig, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorConnection, InspectorDiscoveryEntry, InspectorEvents, InspectorInspectionEvent, InspectorLoadedEvent, InspectorSettings, MachinePayload, ManualActorOptions, Transport, ViewerOptions, createInspector, createStatelyInspector };
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./protocol-M3Zeun3o.mjs";
|
|
2
|
-
import "./version-
|
|
3
|
-
import
|
|
2
|
+
import "./version-hQHX5bet.mjs";
|
|
3
|
+
import "./preview.mjs";
|
|
4
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-Bs7a6Sbq.mjs";
|
|
4
5
|
|
|
5
6
|
export { createInspector, createStatelyInspector };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/preview.d.ts
|
|
2
|
+
/** A preview observes editor-owned state and may request events. */
|
|
3
|
+
interface PreviewState {
|
|
4
|
+
machine: unknown;
|
|
5
|
+
snapshot: unknown;
|
|
6
|
+
mode: string;
|
|
7
|
+
canSend: boolean;
|
|
8
|
+
surface: 'inline' | 'preview';
|
|
9
|
+
}
|
|
10
|
+
type PreviewEvent = {
|
|
11
|
+
type: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
declare function isPreviewEvent(event: unknown): event is PreviewEvent;
|
|
15
|
+
/** Connect only the expected child window, including opaque sandbox origins. */
|
|
16
|
+
declare function connectPreviewHost(options: {
|
|
17
|
+
window: Window;
|
|
18
|
+
getState(): PreviewState;
|
|
19
|
+
onEvent(event: PreviewEvent): void; /** Required for a detached, unsandboxed wrapper; sandbox children use null. */
|
|
20
|
+
origin?: string;
|
|
21
|
+
}): {
|
|
22
|
+
update: () => void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
};
|
|
25
|
+
/** No machine/snapshot mutation API: the connected editor remains the owner. */
|
|
26
|
+
declare function createPreview(options?: {
|
|
27
|
+
target?: Window;
|
|
28
|
+
targetOrigin?: string;
|
|
29
|
+
}): {
|
|
30
|
+
getState: () => PreviewState | undefined;
|
|
31
|
+
subscribe(listener: (state: PreviewState) => void): () => void;
|
|
32
|
+
send(event: PreviewEvent): boolean;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { PreviewEvent, PreviewState, connectPreviewHost, createPreview, isPreviewEvent };
|
package/dist/preview.mjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//#region src/preview.ts
|
|
2
|
+
function isPreviewEvent(event) {
|
|
3
|
+
return !!event && typeof event === "object" && typeof event.type === "string" && event.type.trim().length > 0 && !event.type.startsWith("xstate.") && !event.type.startsWith("@xstate.");
|
|
4
|
+
}
|
|
5
|
+
/** Connect only the expected child window, including opaque sandbox origins. */
|
|
6
|
+
function connectPreviewHost(options) {
|
|
7
|
+
let port;
|
|
8
|
+
const update = () => {
|
|
9
|
+
if (!port) return;
|
|
10
|
+
try {
|
|
11
|
+
port.postMessage({
|
|
12
|
+
type: "@statelyai.preview.state",
|
|
13
|
+
state: options.getState()
|
|
14
|
+
});
|
|
15
|
+
} catch {}
|
|
16
|
+
};
|
|
17
|
+
const receive = (event) => {
|
|
18
|
+
if (event.source !== options.window || event.origin !== (options.origin ?? "null") || event.data?.type !== "@statelyai.preview.ready" || typeof event.data.requestId !== "string") return;
|
|
19
|
+
port?.close();
|
|
20
|
+
const channel = new MessageChannel();
|
|
21
|
+
port = channel.port1;
|
|
22
|
+
port.onmessage = ({ data }) => {
|
|
23
|
+
if (data?.type === "@statelyai.preview.event" && options.getState().canSend && isPreviewEvent(data.event)) options.onEvent(data.event);
|
|
24
|
+
};
|
|
25
|
+
options.window.postMessage({
|
|
26
|
+
type: "@statelyai.preview.connect",
|
|
27
|
+
requestId: event.data.requestId
|
|
28
|
+
}, options.origin ?? "*", [channel.port2]);
|
|
29
|
+
update();
|
|
30
|
+
};
|
|
31
|
+
window.addEventListener("message", receive);
|
|
32
|
+
return {
|
|
33
|
+
update,
|
|
34
|
+
destroy() {
|
|
35
|
+
window.removeEventListener("message", receive);
|
|
36
|
+
port?.close();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** No machine/snapshot mutation API: the connected editor remains the owner. */
|
|
41
|
+
function createPreview(options = {}) {
|
|
42
|
+
const target = options.target ?? (window.parent !== window ? window.parent : window.opener);
|
|
43
|
+
const requestId = crypto.randomUUID();
|
|
44
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
45
|
+
let state;
|
|
46
|
+
let port;
|
|
47
|
+
const ready = () => target?.postMessage({
|
|
48
|
+
type: "@statelyai.preview.ready",
|
|
49
|
+
requestId
|
|
50
|
+
}, options.targetOrigin ?? "*");
|
|
51
|
+
const receive = (event) => {
|
|
52
|
+
if (event.source !== target || options.targetOrigin && event.origin !== options.targetOrigin || event.data?.type !== "@statelyai.preview.connect" || event.data.requestId !== requestId || !event.ports[0] || port) return;
|
|
53
|
+
port = event.ports[0];
|
|
54
|
+
clearInterval(retry);
|
|
55
|
+
port.onmessage = ({ data }) => {
|
|
56
|
+
if (data?.type !== "@statelyai.preview.state") return;
|
|
57
|
+
state = data.state;
|
|
58
|
+
for (const listener of listeners) listener(state);
|
|
59
|
+
};
|
|
60
|
+
port.start();
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener("message", receive);
|
|
63
|
+
const retry = setInterval(ready, 500);
|
|
64
|
+
ready();
|
|
65
|
+
return {
|
|
66
|
+
getState: () => state,
|
|
67
|
+
subscribe(listener) {
|
|
68
|
+
listeners.add(listener);
|
|
69
|
+
if (state) listener(state);
|
|
70
|
+
return () => {
|
|
71
|
+
listeners.delete(listener);
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
send(event) {
|
|
75
|
+
if (!state?.canSend || !isPreviewEvent(event)) return false;
|
|
76
|
+
port?.postMessage({
|
|
77
|
+
type: "@statelyai.preview.event",
|
|
78
|
+
event
|
|
79
|
+
});
|
|
80
|
+
return !!port;
|
|
81
|
+
},
|
|
82
|
+
destroy() {
|
|
83
|
+
clearInterval(retry);
|
|
84
|
+
window.removeEventListener("message", receive);
|
|
85
|
+
port?.close();
|
|
86
|
+
listeners.clear();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
92
|
+
export { connectPreviewHost, createPreview, isPreviewEvent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ProfileManifest, o as GraphPatch } from "./index-DfMkVP94.mjs";
|
|
2
|
-
import { b as DigraphConfig, i as StatelyGraph } from "./graph-
|
|
2
|
+
import { b as DigraphConfig, i as StatelyGraph } from "./graph-CfWCJS4m.mjs";
|
|
3
3
|
import { a as MachineSourceLocations$1, i as EditorSyncStateSourceLocation, n as EditorSyncSourceLocation, r as EditorSyncSourceRange, t as EditorCapabilities$1 } from "./editor-sync-types-Ch5P5XRj.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/embedPanel.d.ts
|
|
@@ -267,7 +267,8 @@ interface EmbedEventMap {
|
|
|
267
267
|
change: {
|
|
268
268
|
graph: StatelyGraph;
|
|
269
269
|
machineConfig: unknown;
|
|
270
|
-
machineId?: string;
|
|
270
|
+
machineId?: string; /** See `ChangeMessage.source`. */
|
|
271
|
+
source?: 'external' | 'layout';
|
|
271
272
|
patches?: unknown[];
|
|
272
273
|
sourceLocations?: MachineSourceLocations;
|
|
273
274
|
};
|
|
@@ -368,6 +369,19 @@ interface ViewerOptions<Settings = Record<string, unknown>> {
|
|
|
368
369
|
/** Ephemeral, read-only reference documents owned by the host. */
|
|
369
370
|
documents?: EmbedDocument[];
|
|
370
371
|
panels?: EmbedPanelConfig[];
|
|
372
|
+
/**
|
|
373
|
+
* How panels adapt to the embed's size. `'auto'` (default) follows the
|
|
374
|
+
* container: at 900px or narrower at most one panel opens initially, at
|
|
375
|
+
* 560px or narrower panel tabs dock at the bottom, and mouse users never get
|
|
376
|
+
* the touch phone layout. `'fixed'` uses the app's viewport breakpoints.
|
|
377
|
+
*/
|
|
378
|
+
panelLayout?: 'auto' | 'fixed';
|
|
379
|
+
/**
|
|
380
|
+
* Side that every side panel opens on when the editor is 900px wide or
|
|
381
|
+
* narrower, so two panels never squeeze the canvas. Defaults to the
|
|
382
|
+
* `panels.defaultSide` setting (`'right'`).
|
|
383
|
+
*/
|
|
384
|
+
defaultPanelSide?: 'left' | 'right';
|
|
371
385
|
theme?: 'light' | 'dark';
|
|
372
386
|
viewMode?: 'graph' | 'list';
|
|
373
387
|
settings?: Settings;
|
|
@@ -642,6 +656,8 @@ interface InspectionSentEvent {
|
|
|
642
656
|
}
|
|
643
657
|
interface SystemInitMessage extends ViewerOptions<InspectorSettings> {
|
|
644
658
|
type: '@statelyai.system.init';
|
|
659
|
+
/** Permit event requests to owned runtime actors. Default false. */
|
|
660
|
+
bidirectional?: boolean;
|
|
645
661
|
protocolVersion: number;
|
|
646
662
|
/** All known actors at the moment the system is first streamed. */
|
|
647
663
|
actors: ActorSystemEntry[];
|
|
@@ -732,8 +748,15 @@ interface ChangeMessage {
|
|
|
732
748
|
graph: StatelyGraph;
|
|
733
749
|
machineConfig: unknown;
|
|
734
750
|
machineId?: string;
|
|
735
|
-
/**
|
|
736
|
-
|
|
751
|
+
/**
|
|
752
|
+
* `external`: the editor has applied a host source refresh, not a visual
|
|
753
|
+
* edit. `layout`: positions from an automatic layout of a machine (or
|
|
754
|
+
* region) that had no stored layout. Persist them so later loads skip
|
|
755
|
+
* automatic layout. Only sent when the user can edit; not an unsaved change.
|
|
756
|
+
*/
|
|
757
|
+
source?: 'external' | 'layout';
|
|
758
|
+
/** Internal persistence payload sent with Studio-linked layout changes. */
|
|
759
|
+
serialized?: Record<string, string>;
|
|
737
760
|
/** Source version beneath the visible graph when a draft is retained. */
|
|
738
761
|
sourceBaselineGraph?: StatelyGraph;
|
|
739
762
|
patches?: unknown[];
|
|
@@ -888,7 +911,15 @@ interface ExtensionResultMessage {
|
|
|
888
911
|
/** All messages a client (embed/inspector) can send to the viz. */
|
|
889
912
|
type ClientMessage = InitMessage | SetApiKeyMessage | EditorHandshakeMessage | SavedMessage | ClipboardReadResponseMessage | ClipboardWriteResponseMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | ProjectSetWorkspaceOpenMessage | UpdateMessage | HighlightMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | ToastDismissMessage | InspectSnapshotMessage | SystemInitMessage | SystemSelectActorMessage | SystemActorRegisteredMessage | SystemActorEventMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ExtensionResultMessage | ErrorMessage;
|
|
890
913
|
/** All messages the viz can send back to a client. */
|
|
891
|
-
|
|
914
|
+
interface SystemSendEventMessage {
|
|
915
|
+
type: '@statelyai.system.sendEvent';
|
|
916
|
+
sessionId: string;
|
|
917
|
+
event: {
|
|
918
|
+
type: string;
|
|
919
|
+
[key: string]: unknown;
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
type VizMessage = SystemSendEventMessage | LoginMessage | SystemLoadedMessage | ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | VersionSaveRequestedMessage | ProjectMachineSelectedMessage | ProjectWorkspaceActionMessage | ProjectWorkspaceOpenChangedMessage | ViewModeChangedMessage | PanelChangedMessage | ModeChangedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage | ExtensionCallMessage;
|
|
892
923
|
interface InspectionClientMetadata {
|
|
893
924
|
name?: string;
|
|
894
925
|
machineId?: string;
|
|
@@ -917,4 +948,4 @@ declare const PREFIX = "@statelyai.";
|
|
|
917
948
|
/** Current WebSocket inspection protocol version. */
|
|
918
949
|
declare const INSPECTION_PROTOCOL_VERSION = 2;
|
|
919
950
|
//#endregion
|
|
920
|
-
export { MachineVersionAutoSaveOptions as $,
|
|
951
|
+
export { MachineVersionAutoSaveOptions as $, ValidationIssue as $t, ExportFormat as A, SetApiKeyMessage as At, InspectSnapshotMessage as B, SystemActorStoppedMessage as Bt, EmbedExample as C, RegisteredMessage as Ct, ErrorCode as D, SavedMessage as Dt, EmbedMode as E, SaveMessage as Et, HostUpdateOptions as F, SourceRange as Ft, InspectionTakenTransition as G, ToastDismissMessage as Gt, InspectionClientMetadata as H, SystemLoadedMessage as Ht, INSPECTION_PROTOCOL_VERSION as I, StateSourceLocation as It, LoadedMessage as J, UploadCapabilitiesMessage as Jt, InspectorLoadedEvent as K, ToastMessage as Kt, INSPECTION_ROOM_QUERY_PARAM as L, SystemActorEventMessage as Lt, ExtensionCallMessage as M, SetSettingsMessage as Mt, ExtensionResultMessage as N, SetThemeMessage as Nt, ErrorMessage as O, SerializedInspectionMachine as Ot, HighlightMessage as P, SourceLocation as Pt, MachineSourceLocations as Q, UploadResult as Qt, InitMessage as R, SystemActorRegisteredMessage as Rt, EmbedEventName as S, RegisterMessage as St, EmbedFormatManifest as T, RetrievedMessage as Tt, InspectionRoomUrls as U, SystemSelectActorMessage as Ut, InspectionAction as V, SystemInitMessage as Vt, InspectionSentEvent as W, SystemSendEventMessage as Wt, MachineInitOptions as X, UploadRequestMessage as Xt, LoginMessage as Y, UploadFileInfo as Yt, MachinePayload as Z, UploadResponseMessage as Zt, EmbedChromeOptions as _, ProjectWorkspaceOpenChangedMessage as _t, CapabilityDeniedMessage as a, createInspectionActorId as an, ProjectInitOptions as at, EmbedEventHandler as b, ReadOnlyReason as bt, ClipboardReadMessage as c, isEmbedExample as cn, ProjectSetWorkspaceOpenMessage as ct, ClipboardWriteResponseMessage as d, mergeInspectorSettings as dn, ProjectWorkspaceActionIcon as dt, VersionSaveRequestedMessage as en, ModeChangedMessage as et, CommentsConfig as f, resolveInspectorSettings as fn, ProjectWorkspaceActionMessage as ft, EditorHandshakeMessage as g, ProjectWorkspaceMachineOrigin as gt, EditorCapabilities as h, EmbedPanelPosition as hn, ProjectWorkspaceMachine as ht, CapabilityDeniedEvent as i, assertEmbedExamples as in, ProjectInitMessage as it, ExportFormatMap as j, SetModeMessage as jt, ExportCallOptions as k, SessionMessage as kt, ClipboardReadResponseMessage as l, isEmbedExampleMachine as ln, ProjectUpdateMessage as lt, EMBED_DOCUMENT_LIMITS as m, EmbedPanelConfig as mn, ProjectWorkspaceConfig as mt, AuthenticationRecovery as n, ViewerOptions as nn, PanelChangedMessage as nt, ChangeMessage as o, createInspectionRoomUrls as on, ProjectMachineSelectedMessage as ot, EMBED_DOCUMENT_LANGUAGES as p, PresentationMetadataInitializer as pn, ProjectWorkspaceCapabilities as pt, InspectorSettings as q, UpdateMessage as qt, CapabilityDeniedCapability as r, VizMessage as rn, ProjectEmbedMachine as rt, ClientMessage as s, getInspectionRoomId as sn, ProjectSelectMachineMessage as st, ActorSystemEntry as t, ViewModeChangedMessage as tn, PREFIX as tt, ClipboardWriteMessage as u, isSerializedInspectionMachine as un, ProjectWorkspaceAction as ut, EmbedDocument as v, ProjectWorkspaceProject as vt, EmbedExtensionsManifest as w, RetrieveMessage as wt, EmbedEventMap as x, ReadyMessage as xt, EmbedDocumentLanguage as y, ProtocolMessage as yt, InitOptions as z, SystemActorSnapshotMessage as zt };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as MachineVersionAutoSaveOptions, $t as
|
|
2
|
-
export { ActorSystemEntry, AuthenticationRecovery, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedChromeOptions, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExample, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, EmbedPanelConfig, EmbedPanelPosition, ErrorCode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, HighlightMessage, HostUpdateOptions, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, InspectorLoadedEvent, InspectorSettings, LoadedMessage, LoginMessage, MachineInitOptions, MachinePayload, MachineSourceLocations, MachineVersionAutoSaveOptions, ModeChangedMessage, PREFIX, PanelChangedMessage, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SerializedInspectionMachine, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemLoadedMessage, SystemSelectActorMessage, ToastDismissMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VersionSaveRequestedMessage, ViewModeChangedMessage, ViewerOptions, VizMessage, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine, isSerializedInspectionMachine, mergeInspectorSettings, resolveInspectorSettings };
|
|
1
|
+
import { $ as MachineVersionAutoSaveOptions, $t as ValidationIssue, A as ExportFormat, At as SetApiKeyMessage, B as InspectSnapshotMessage, Bt as SystemActorStoppedMessage, C as EmbedExample, Ct as RegisteredMessage, D as ErrorCode, Dt as SavedMessage, E as EmbedMode, Et as SaveMessage, F as HostUpdateOptions, Ft as SourceRange, G as InspectionTakenTransition, Gt as ToastDismissMessage, H as InspectionClientMetadata, Ht as SystemLoadedMessage, I as INSPECTION_PROTOCOL_VERSION, It as StateSourceLocation, J as LoadedMessage, Jt as UploadCapabilitiesMessage, K as InspectorLoadedEvent, Kt as ToastMessage, L as INSPECTION_ROOM_QUERY_PARAM, Lt as SystemActorEventMessage, M as ExtensionCallMessage, Mt as SetSettingsMessage, N as ExtensionResultMessage, Nt as SetThemeMessage, O as ErrorMessage, Ot as SerializedInspectionMachine, P as HighlightMessage, Pt as SourceLocation, Q as MachineSourceLocations, Qt as UploadResult, R as InitMessage, Rt as SystemActorRegisteredMessage, S as EmbedEventName, St as RegisterMessage, T as EmbedFormatManifest, Tt as RetrievedMessage, U as InspectionRoomUrls, Ut as SystemSelectActorMessage, V as InspectionAction, Vt as SystemInitMessage, W as InspectionSentEvent, Wt as SystemSendEventMessage, X as MachineInitOptions, Xt as UploadRequestMessage, Y as LoginMessage, Yt as UploadFileInfo, Z as MachinePayload, Zt as UploadResponseMessage, _ as EmbedChromeOptions, _t as ProjectWorkspaceOpenChangedMessage, a as CapabilityDeniedMessage, an as createInspectionActorId, at as ProjectInitOptions, b as EmbedEventHandler, bt as ReadOnlyReason, c as ClipboardReadMessage, cn as isEmbedExample, ct as ProjectSetWorkspaceOpenMessage, d as ClipboardWriteResponseMessage, dn as mergeInspectorSettings, dt as ProjectWorkspaceActionIcon, en as VersionSaveRequestedMessage, et as ModeChangedMessage, f as CommentsConfig, fn as resolveInspectorSettings, ft as ProjectWorkspaceActionMessage, g as EditorHandshakeMessage, gt as ProjectWorkspaceMachineOrigin, h as EditorCapabilities, hn as EmbedPanelPosition, ht as ProjectWorkspaceMachine, i as CapabilityDeniedEvent, in as assertEmbedExamples, it as ProjectInitMessage, j as ExportFormatMap, jt as SetModeMessage, k as ExportCallOptions, kt as SessionMessage, l as ClipboardReadResponseMessage, ln as isEmbedExampleMachine, lt as ProjectUpdateMessage, m as EMBED_DOCUMENT_LIMITS, mn as EmbedPanelConfig, mt as ProjectWorkspaceConfig, n as AuthenticationRecovery, nn as ViewerOptions, nt as PanelChangedMessage, o as ChangeMessage, on as createInspectionRoomUrls, ot as ProjectMachineSelectedMessage, p as EMBED_DOCUMENT_LANGUAGES, pt as ProjectWorkspaceCapabilities, q as InspectorSettings, qt as UpdateMessage, r as CapabilityDeniedCapability, rn as VizMessage, rt as ProjectEmbedMachine, s as ClientMessage, sn as getInspectionRoomId, st as ProjectSelectMachineMessage, t as ActorSystemEntry, tn as ViewModeChangedMessage, tt as PREFIX, u as ClipboardWriteMessage, un as isSerializedInspectionMachine, ut as ProjectWorkspaceAction, v as EmbedDocument, vt as ProjectWorkspaceProject, w as EmbedExtensionsManifest, wt as RetrieveMessage, x as EmbedEventMap, xt as ReadyMessage, y as EmbedDocumentLanguage, yt as ProtocolMessage, z as InitOptions, zt as SystemActorSnapshotMessage } from "./protocol-D3XQmmmv.mjs";
|
|
2
|
+
export { ActorSystemEntry, AuthenticationRecovery, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedChromeOptions, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExample, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, EmbedPanelConfig, EmbedPanelPosition, ErrorCode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, HighlightMessage, HostUpdateOptions, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, InspectorLoadedEvent, InspectorSettings, LoadedMessage, LoginMessage, MachineInitOptions, MachinePayload, MachineSourceLocations, MachineVersionAutoSaveOptions, ModeChangedMessage, PREFIX, PanelChangedMessage, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SerializedInspectionMachine, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemLoadedMessage, SystemSelectActorMessage, SystemSendEventMessage, ToastDismissMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VersionSaveRequestedMessage, ViewModeChangedMessage, ViewerOptions, VizMessage, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine, isSerializedInspectionMachine, mergeInspectorSettings, resolveInspectorSettings };
|
package/dist/relay.d.mts
CHANGED
package/dist/relay.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const FORWARD_ONLY_MESSAGE_TYPES = new Set([
|
|
|
20
20
|
"@statelyai.loaded",
|
|
21
21
|
"@statelyai.system.loaded",
|
|
22
22
|
"@statelyai.capabilityDenied",
|
|
23
|
+
"@statelyai.system.sendEvent",
|
|
23
24
|
"@statelyai.register",
|
|
24
25
|
"@statelyai.registered"
|
|
25
26
|
]);
|
|
@@ -41,6 +42,7 @@ function validationError(message) {
|
|
|
41
42
|
if (!isSupportedMessageType(message.type)) return `Unsupported inspection message type ${String(message.type)}`;
|
|
42
43
|
const hasString = (key) => typeof message[key] === "string" && message[key] !== "";
|
|
43
44
|
switch (message.type) {
|
|
45
|
+
case "@statelyai.system.sendEvent": return hasString("producerId") && hasString("sessionId") && message.event && typeof message.event === "object" && typeof message.event.type === "string" ? null : "sendEvent requires producerId, sessionId, and an event";
|
|
44
46
|
case "@statelyai.setSettings": return message.settings && typeof message.settings === "object" && !Array.isArray(message.settings) ? null : "setSettings requires a settings object";
|
|
45
47
|
case "@statelyai.system.init": return message.protocolVersion === INSPECTION_PROTOCOL_VERSION && Array.isArray(message.actors) ? null : "system.init requires the current protocolVersion and actors array";
|
|
46
48
|
case "@statelyai.system.selectActor":
|
|
@@ -144,6 +144,8 @@ function toInitMessage(options) {
|
|
|
144
144
|
capabilities: options.capabilities,
|
|
145
145
|
examples: options.examples,
|
|
146
146
|
panels: options.panels,
|
|
147
|
+
panelLayout: options.panelLayout,
|
|
148
|
+
defaultPanelSide: options.defaultPanelSide,
|
|
147
149
|
commentsByMachineId: options.commentsByMachineId,
|
|
148
150
|
projectWorkspace: options.projectWorkspace,
|
|
149
151
|
projectWorkspaceOpen: options.projectWorkspaceOpen,
|
|
@@ -165,6 +167,8 @@ function toInitMessage(options) {
|
|
|
165
167
|
capabilities: options.capabilities,
|
|
166
168
|
examples: options.examples,
|
|
167
169
|
panels: options.panels,
|
|
170
|
+
panelLayout: options.panelLayout,
|
|
171
|
+
defaultPanelSide: options.defaultPanelSide,
|
|
168
172
|
comments: options.comments,
|
|
169
173
|
sourceLocations: options.sourceLocations,
|
|
170
174
|
chrome: options.chrome,
|
|
@@ -379,7 +383,7 @@ function createWebSocketTransport(options) {
|
|
|
379
383
|
|
|
380
384
|
//#endregion
|
|
381
385
|
//#region src/version.ts
|
|
382
|
-
const SDK_VERSION = "0.
|
|
386
|
+
const SDK_VERSION = "0.39.0";
|
|
383
387
|
function inspectionRuntime() {
|
|
384
388
|
if (typeof window !== "undefined") return "browser";
|
|
385
389
|
if (typeof process !== "undefined" && process.versions?.node) return "node";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statelyai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stately-sdk": "./dist/bin.mjs"
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/embed.d.mts",
|
|
22
22
|
"import": "./dist/embed.mjs"
|
|
23
23
|
},
|
|
24
|
+
"./preview": {
|
|
25
|
+
"types": "./dist/preview.d.mts",
|
|
26
|
+
"import": "./dist/preview.mjs"
|
|
27
|
+
},
|
|
24
28
|
"./inspect": {
|
|
25
29
|
"types": "./dist/inspect.d.mts",
|
|
26
30
|
"import": "./dist/inspect.mjs"
|
|
@@ -92,8 +96,8 @@
|
|
|
92
96
|
"ws": "^8.19.0",
|
|
93
97
|
"xstate": "^5.0.0",
|
|
94
98
|
"xstate-v6": "npm:xstate@6.0.0-alpha.65",
|
|
95
|
-
"@statelyai/api-contract": "0.6.
|
|
96
|
-
"@statelyai/graph-tools": "0.
|
|
99
|
+
"@statelyai/api-contract": "0.6.5",
|
|
100
|
+
"@statelyai/graph-tools": "0.10.0"
|
|
97
101
|
},
|
|
98
102
|
"peerDependencies": {
|
|
99
103
|
"ws": "^8.19.0"
|