@statelyai/sdk 0.22.0 → 0.22.1
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/{editorHostSession-HRuIaZ2G.mjs → editorHostSession-BZE_Wm0m.mjs} +22 -9
- package/dist/{editorHostSession-lL7wPLnL.d.mts → editorHostSession-CMwC9KKh.d.mts} +6 -1
- package/dist/editorHostSession.d.mts +2 -2
- package/dist/editorHostSession.mjs +2 -2
- package/dist/embed.d.mts +2 -2
- package/dist/embed.mjs +1 -1
- package/dist/{graph-DYjfFztq.d.mts → graph-1fwR0Ynl.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-Bakx1tkW.d.mts → index-D_pO_Pr8.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{inspect-DDl5w1sy.mjs → inspect-CXkNcKu4.mjs} +1 -1
- package/dist/inspect.mjs +2 -2
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +2 -2
- package/dist/{statelyPragma-CokFTPgT.mjs → statelyPragma-DfKQ-kPr.mjs} +23 -5
- package/dist/{studio-DYI613t_.d.mts → studio-CkrbMK00.d.mts} +1 -1
- package/dist/studio.d.mts +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +5 -2
- package/dist/{version-3cKMfysA.mjs → version-yzel-kpS.mjs} +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -94,6 +94,9 @@ CLI and editor-extension hosts use `EditorHostSession` from
|
|
|
94
94
|
clipboard requests, and editor protocol negotiation. Use
|
|
95
95
|
`createRemoteEditorSyncBackend` for two-way validation of the versioned Editor
|
|
96
96
|
Sync HTTP contract.
|
|
97
|
+
Remote authentication failures are surfaced as `EditorSyncError` with HTTP
|
|
98
|
+
status and protocol error code metadata so hosts can refresh credentials and
|
|
99
|
+
retry once without depending on response-message text.
|
|
97
100
|
Hosts keep ownership of files, credentials, UI, and transport adapters.
|
|
98
101
|
|
|
99
102
|
Key capabilities:
|
|
@@ -4,6 +4,10 @@ import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs"
|
|
|
4
4
|
//#region ../api-contract/dist/editor-sync.mjs
|
|
5
5
|
const EDITOR_SYNC_PROTOCOL_VERSION = 1;
|
|
6
6
|
const EDITOR_SYNC_PROTOCOL_HEADER = "X-Stately-Editor-Sync-Version";
|
|
7
|
+
const editorSyncErrorResponseSchema = object({
|
|
8
|
+
error: string(),
|
|
9
|
+
code: string().optional()
|
|
10
|
+
}).passthrough();
|
|
7
11
|
const editorCapabilitiesSchema = object({
|
|
8
12
|
edit: boolean().optional(),
|
|
9
13
|
export: boolean().optional(),
|
|
@@ -102,6 +106,16 @@ const editorSyncAccessResponseSchema = object({ access: editorSyncAccessSchema }
|
|
|
102
106
|
|
|
103
107
|
//#endregion
|
|
104
108
|
//#region src/editorHostSession.ts
|
|
109
|
+
var EditorSyncError = class extends Error {
|
|
110
|
+
status;
|
|
111
|
+
code;
|
|
112
|
+
constructor(message, status, code) {
|
|
113
|
+
super(message);
|
|
114
|
+
this.name = "EditorSyncError";
|
|
115
|
+
this.status = status;
|
|
116
|
+
this.code = code;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
105
119
|
function createRemoteEditorSyncBackend(options) {
|
|
106
120
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
107
121
|
async function post(pathname, body) {
|
|
@@ -118,10 +132,7 @@ function createRemoteEditorSyncBackend(options) {
|
|
|
118
132
|
});
|
|
119
133
|
assertEditorSyncResponseProtocol(response);
|
|
120
134
|
const data = await response.json().catch(() => null);
|
|
121
|
-
if (!response.ok)
|
|
122
|
-
const message = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : `HTTP ${response.status}`;
|
|
123
|
-
throw new Error(message);
|
|
124
|
-
}
|
|
135
|
+
if (!response.ok) throwEditorSyncError(response.status, data);
|
|
125
136
|
return data;
|
|
126
137
|
}
|
|
127
138
|
return {
|
|
@@ -144,12 +155,14 @@ async function fetchEditorSyncAccess(options) {
|
|
|
144
155
|
});
|
|
145
156
|
assertEditorSyncResponseProtocol(response);
|
|
146
157
|
const data = await response.json().catch(() => null);
|
|
147
|
-
if (!response.ok)
|
|
148
|
-
const message = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : `HTTP ${response.status}`;
|
|
149
|
-
throw new Error(message);
|
|
150
|
-
}
|
|
158
|
+
if (!response.ok) throwEditorSyncError(response.status, data);
|
|
151
159
|
return editorSyncAccessResponseSchema.parse(data).access;
|
|
152
160
|
}
|
|
161
|
+
function throwEditorSyncError(status, data) {
|
|
162
|
+
const parsed = editorSyncErrorResponseSchema.safeParse(data);
|
|
163
|
+
const error = parsed.success ? parsed.data : void 0;
|
|
164
|
+
throw new EditorSyncError(error?.error ?? `HTTP ${status}`, status, error?.code);
|
|
165
|
+
}
|
|
153
166
|
function assertEditorSyncResponseProtocol(response) {
|
|
154
167
|
const selectedVersion = response.headers.get(EDITOR_SYNC_PROTOCOL_HEADER);
|
|
155
168
|
if (selectedVersion === null || selectedVersion === String(EDITOR_SYNC_PROTOCOL_VERSION)) return;
|
|
@@ -476,4 +489,4 @@ function stateSourceLocationUris(sourceLocations) {
|
|
|
476
489
|
}
|
|
477
490
|
|
|
478
491
|
//#endregion
|
|
479
|
-
export {
|
|
492
|
+
export { fetchEditorSyncAccess as i, EditorSyncError as n, createRemoteEditorSyncBackend as r, EditorHostSession as t };
|
|
@@ -125,6 +125,11 @@ interface RemoteEditorSyncBackendOptions {
|
|
|
125
125
|
apiKey?: string;
|
|
126
126
|
fetch?: typeof globalThis.fetch;
|
|
127
127
|
}
|
|
128
|
+
declare class EditorSyncError extends Error {
|
|
129
|
+
readonly status: number;
|
|
130
|
+
readonly code: string | undefined;
|
|
131
|
+
constructor(message: string, status: number, code?: string);
|
|
132
|
+
}
|
|
128
133
|
declare function createRemoteEditorSyncBackend(options: RemoteEditorSyncBackendOptions): EditorSyncBackend;
|
|
129
134
|
declare function fetchEditorSyncAccess(options: RemoteEditorSyncBackendOptions): Promise<EditorSyncAccess>;
|
|
130
135
|
interface EditorSourceHost {
|
|
@@ -181,4 +186,4 @@ declare class EditorHostSession {
|
|
|
181
186
|
private resolveRetrieved;
|
|
182
187
|
}
|
|
183
188
|
//#endregion
|
|
184
|
-
export {
|
|
189
|
+
export { EditorSyncError as a, fetchEditorSyncAccess as c, EditorHostInboundMessage as d, EditorHostInitOptions as f, EditorSyncBackend as i, EDITOR_PROTOCOL_VERSION as l, EditorHostValidationIssue as m, EditorHostSessionOptions as n, RemoteEditorSyncBackendOptions as o, EditorHostOutboundMessage as p, EditorSourceHost as r, createRemoteEditorSyncBackend as s, EditorHostSession as t, EditorHostExportFormat as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { EDITOR_PROTOCOL_VERSION, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorSourceHost, EditorSyncBackend, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
1
|
+
import { a as EditorSyncError, c as fetchEditorSyncAccess, d as EditorHostInboundMessage, f as EditorHostInitOptions, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostValidationIssue, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostOutboundMessage, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostExportFormat } from "./editorHostSession-CMwC9KKh.mjs";
|
|
2
|
+
export { EDITOR_PROTOCOL_VERSION, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorSourceHost, EditorSyncBackend, EditorSyncError, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
|
-
import { n as
|
|
3
|
+
import { i as fetchEditorSyncAccess, n as EditorSyncError, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-BZE_Wm0m.mjs";
|
|
4
4
|
|
|
5
|
-
export { EDITOR_PROTOCOL_VERSION, EditorHostSession, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
5
|
+
export { EDITOR_PROTOCOL_VERSION, EditorHostSession, EditorSyncError, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ProfileManifest } from "./index-
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
1
|
+
import { i as ProfileManifest } from "./index-D_pO_Pr8.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-1fwR0Ynl.mjs";
|
|
3
3
|
import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
|
package/dist/embed.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-
|
|
1
|
+
import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-yzel-kpS.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embed.ts
|
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-1fwR0Ynl.mjs";
|
|
2
2
|
export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
|
|
@@ -2547,7 +2547,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2547
2547
|
type GraphPatch = output<typeof graphPatchSchema>;
|
|
2548
2548
|
/** AI-only schema: semantic ops + shared ops (no generic graph ops) */
|
|
2549
2549
|
//#endregion
|
|
2550
|
-
//#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.
|
|
2550
|
+
//#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.47/node_modules/xstate/dist/declarations/src/index.d.ts
|
|
2551
2551
|
declare global {
|
|
2552
2552
|
interface SymbolConstructor {
|
|
2553
2553
|
readonly observable: symbol;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
|
-
import { _ as GraphPatch, a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, m as ActionLocation, n as CodeGenGraph, o as XStateTSOptions, p as serializeJS, r as MachineConfigOptions, s as contextSchemaToTSType, u as graphToXStateTS } from "./index-
|
|
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-
|
|
2
|
+
import { _ as GraphPatch, a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, m as ActionLocation, n as CodeGenGraph, o as XStateTSOptions, p as serializeJS, r as MachineConfigOptions, s as contextSchemaToTSType, u as graphToXStateTS } from "./index-D_pO_Pr8.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-1fwR0Ynl.mjs";
|
|
4
4
|
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, ProjectEmbedMachine, UploadResult, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
5
5
|
import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
6
6
|
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-B0ZTKri2.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { c as fetchEditorSyncAccess, d as EditorHostInboundMessage, f as EditorHostInitOptions, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostValidationIssue, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostOutboundMessage, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostExportFormat } from "./editorHostSession-CMwC9KKh.mjs";
|
|
8
8
|
import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
9
9
|
import { a as InspectedTransition, c as InspectorInspectionEvent, d as createStatelyInspector, f as Transport, h as createWebSocketTransport, i as InspectedSnapshot, l as ManualActorOptions, m as createPostMessageTransport, n as CreateInspectorOptions, o as Inspector, p as TransportFailure, r as InspectedEvent, s as InspectorEvents, t as AdoptedActor, u as createInspector } from "./inspect-CGJR4iZK.mjs";
|
|
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-
|
|
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-CkrbMK00.mjs";
|
|
11
11
|
import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
12
12
|
import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
|
|
13
13
|
import { CreateInspectionRelayOptions, InspectionRelay, InspectionRelayEffect, InspectionRelayPeer, InspectionRelayRole, InspectionRelaySnapshot, createInspectionRelay } from "./relay.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
3
|
-
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-
|
|
3
|
+
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-yzel-kpS.mjs";
|
|
4
4
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
5
5
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { i as fetchEditorSyncAccess, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-BZE_Wm0m.mjs";
|
|
7
7
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-iNSHtNmP.mjs";
|
|
8
|
-
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, l as graphToMachineConfig, m as serializeJS, n as getStatelyPragma, o as contextSchemaToTSType, p as raw, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-
|
|
8
|
+
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, l as graphToMachineConfig, m as serializeJS, n as getStatelyPragma, o as contextSchemaToTSType, p as raw, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-DfKQ-kPr.mjs";
|
|
9
9
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
10
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
10
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-CXkNcKu4.mjs";
|
|
11
11
|
import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
12
12
|
import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
13
13
|
import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INSPECTION_PROTOCOL_VERSION, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
2
|
-
import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-
|
|
2
|
+
import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-yzel-kpS.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./version-
|
|
2
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
1
|
+
import "./version-yzel-kpS.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-CXkNcKu4.mjs";
|
|
3
3
|
|
|
4
4
|
export { createInspector, createStatelyInspector };
|
package/dist/patchTypes.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as GraphPatch, g as EditorStateType, h as CanvasColor, m as ActionLocation, v as ImplementationSourceType } from "./index-
|
|
1
|
+
import { _ as GraphPatch, g as EditorStateType, h as CanvasColor, m as ActionLocation, v as ImplementationSourceType } from "./index-D_pO_Pr8.mjs";
|
|
2
2
|
export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ProfileManifest } from "./index-
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
1
|
+
import { i as ProfileManifest } from "./index-D_pO_Pr8.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-1fwR0Ynl.mjs";
|
|
3
3
|
import { c as EditorSyncSourceLocation, f as MachineSourceLocations$1, l as EditorSyncSourceRange, t as EditorCapabilities$1, u as EditorSyncStateSourceLocation } from "./editor-sync-types-C-zWaaVk.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/protocol.d.ts
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { a as discriminatedUnion, c as object, d as union, f as unknown, i as custom, l as record, n as array, o as literal, r as boolean, s as number, t as _enum, u as string } from "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
-
import "xstate";
|
|
4
3
|
import "xstate/graph";
|
|
5
4
|
|
|
6
5
|
//#region ../../node_modules/.pnpm/js-yaml@4.2.0/node_modules/js-yaml/dist/js-yaml.mjs
|
|
@@ -2472,7 +2471,7 @@ function stripExportDefault(code) {
|
|
|
2472
2471
|
return trimmed;
|
|
2473
2472
|
}
|
|
2474
2473
|
const XSTATE_V5_PROFILE = "@statelyai/xstate@5.30.0";
|
|
2475
|
-
const XSTATE_V6_PROFILE = "@statelyai/xstate@6.0.0-alpha.
|
|
2474
|
+
const XSTATE_V6_PROFILE = "@statelyai/xstate@6.0.0-alpha.47";
|
|
2476
2475
|
const LEGACY_MACHINE_PROFILES = ["xstate-v5", "xstate-v6-alpha"];
|
|
2477
2476
|
function normalizeMachineProfile(profile) {
|
|
2478
2477
|
return profile === "xstate-v5" ? XSTATE_V5_PROFILE : profile === "xstate-v6-alpha" ? XSTATE_V6_PROFILE : profile;
|
|
@@ -2868,10 +2867,11 @@ function graphToMachineConfig(graph, options = {}) {
|
|
|
2868
2867
|
Object.assign(nodeConfig, {
|
|
2869
2868
|
id: resolvedNodeId,
|
|
2870
2869
|
type: nodeType === "normal" ? void 0 : nodeType ?? void 0,
|
|
2871
|
-
initial: initialNode ? node.data.initialInput !== void 0 ? {
|
|
2870
|
+
initial: initialNode ? nodeType === "history" ? void 0 : node.data.initialInput !== void 0 ? {
|
|
2872
2871
|
target: initialNode.data.key,
|
|
2873
2872
|
input: node.data.initialInput
|
|
2874
2873
|
} : initialNode.data.key : void 0,
|
|
2874
|
+
target: nodeType === "history" && initialNode ? initialNode.data.key : void 0,
|
|
2875
2875
|
...node.data.timeout !== void 0 ? { timeout: node.data.timeout } : void 0,
|
|
2876
2876
|
...node.data.route !== void 0 ? { route: node.data.route } : void 0,
|
|
2877
2877
|
...node.data.entry?.length ? { entry: node.data.entry.map(serializeActionItem) } : void 0,
|
|
@@ -3817,10 +3817,28 @@ function guardParams(fn) {
|
|
|
3817
3817
|
if (!param) return "()";
|
|
3818
3818
|
return `(${param.getText()})`;
|
|
3819
3819
|
}
|
|
3820
|
+
function transitionContextIdentity(fn) {
|
|
3821
|
+
const parameter = fn.parameters[0]?.name;
|
|
3822
|
+
if (!parameter) return null;
|
|
3823
|
+
if (ts.isIdentifier(parameter)) return `${parameter.text}.context`;
|
|
3824
|
+
if (!ts.isObjectBindingPattern(parameter)) return null;
|
|
3825
|
+
for (const element of parameter.elements) {
|
|
3826
|
+
if (!ts.isIdentifier(element.name)) continue;
|
|
3827
|
+
if ((element.propertyName ? propName(element.propertyName) : element.name.text) === "context") return element.name.text;
|
|
3828
|
+
}
|
|
3829
|
+
return null;
|
|
3830
|
+
}
|
|
3831
|
+
function omitIdentityTransitionContext(transition, identity) {
|
|
3832
|
+
const context = transition.context;
|
|
3833
|
+
if (!identity || !context || typeof context !== "object" || context["@type"] !== "code" || context.expr !== identity) return transition;
|
|
3834
|
+
const { context: _context, ...rest } = transition;
|
|
3835
|
+
return rest;
|
|
3836
|
+
}
|
|
3820
3837
|
function normalizeFunctionTransition(fn, bindings, depth) {
|
|
3821
3838
|
if (fn.body && ts.isBlock(fn.body) && hasUnsafeVariableInitializer(fn.body)) return fallbackFunctionTransition(fn);
|
|
3822
3839
|
const branches = ts.isArrowFunction(fn) && !ts.isBlock(fn.body) ? expressionBranches(fn.body, bindings, depth + 1) : fn.body && ts.isBlock(fn.body) ? statementBranches(fn.body.statements, bindings, enqueueParamName(fn)) : [];
|
|
3823
3840
|
if (branches.some((branch) => branch.unknown)) return fallbackFunctionTransition(fn);
|
|
3841
|
+
const contextIdentity = transitionContextIdentity(fn);
|
|
3824
3842
|
const transitions = branches.map((branch) => {
|
|
3825
3843
|
const transition = transitionFromValue(branch.result, branch.actions);
|
|
3826
3844
|
if (!transition) return null;
|
|
@@ -3832,10 +3850,10 @@ function normalizeFunctionTransition(fn, bindings, depth) {
|
|
|
3832
3850
|
} : transition;
|
|
3833
3851
|
}
|
|
3834
3852
|
const guard = guardFromConditions(branch.conds, guardParams(fn));
|
|
3835
|
-
return guard ? {
|
|
3853
|
+
return omitIdentityTransitionContext(guard ? {
|
|
3836
3854
|
...transition,
|
|
3837
3855
|
guard
|
|
3838
|
-
} : transition;
|
|
3856
|
+
} : transition, contextIdentity);
|
|
3839
3857
|
}).filter((transition) => Boolean(transition));
|
|
3840
3858
|
if (transitions.length === 1) return transitions[0];
|
|
3841
3859
|
if (transitions.length > 1) return transitions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as output, C as ZodNumber, D as ZodString, E as ZodRecord, O as ZodUnion, S as ZodNullable, T as ZodOptional, b as ZodEnum, j as $strip, k as ZodUnknown, w as ZodObject, x as ZodLiteral, y as ZodArray } from "./index-
|
|
1
|
+
import { A as output, C as ZodNumber, D as ZodString, E as ZodRecord, O as ZodUnion, S as ZodNullable, T as ZodOptional, b as ZodEnum, j as $strip, k as ZodUnknown, w as ZodObject, x as ZodLiteral, y as ZodArray } from "./index-D_pO_Pr8.mjs";
|
|
2
2
|
import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-B0ZTKri2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region ../api-contract/dist/errors.d.mts
|
package/dist/studio.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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, p as LegacyExtractMachinesOptions, 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-
|
|
1
|
+
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, p as LegacyExtractMachinesOptions, 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-CkrbMK00.mjs";
|
|
2
2
|
export { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, DEFAULT_STATELY_BASE_URL, EnsureProjectInput, ExtractMachinesInput, ExtractMachinesResponse, ExtractedMachine, ExtractedMachines, GetMachineOptions, LegacyExtractMachinesOptions, LegacyProjectVisibility, LegacyUpdateMachineInput, Machine, MachineVersion, Project, ProjectData, ProjectMachine, ProjectMachineSummary, ProjectSummary, ProjectVisibility, RepoType, ResourceErrorCode, StudioApiError, StudioApiErrorOptions, StudioClient, StudioClientOptions, StudioMachineRecord, StudioRequestOptions, UpdateMachineInput, UpdateProjectInput, VerifyApiKeyResponse, VerifyResult, XStateVersion, createStatelyClient };
|
package/dist/sync.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as DigraphConfig, i as StatelyGraph } from "./graph-
|
|
2
|
-
import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-
|
|
1
|
+
import { b as DigraphConfig, i as StatelyGraph } from "./graph-1fwR0Ynl.mjs";
|
|
2
|
+
import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-CkrbMK00.mjs";
|
|
3
3
|
import { GraphDiff } from "@statelyai/graph";
|
|
4
4
|
|
|
5
5
|
//#region src/sync.d.ts
|
package/dist/sync.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { r as createStatelyClient } from "./studio-iNSHtNmP.mjs";
|
|
3
|
-
import { f as normalizeMachineProfile, h as xstateSourceToConfig, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as serializeJS, n as getStatelyPragma, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-
|
|
3
|
+
import { f as normalizeMachineProfile, h as xstateSourceToConfig, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as serializeJS, n as getStatelyPragma, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-DfKQ-kPr.mjs";
|
|
4
4
|
import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
|
|
5
5
|
import * as ts$1 from "typescript";
|
|
6
6
|
import ts from "typescript";
|
|
@@ -155,7 +155,10 @@ function collectXStateSourceLocations(sourceText, document, options = {}) {
|
|
|
155
155
|
const rootProfile = detectXStateSourceProfile(sourceText);
|
|
156
156
|
const referencedStateSymbols = new Set([...states, ...statesObjectLocations].map((state) => state.symbol).filter((symbol) => typeof symbol === "string"));
|
|
157
157
|
const resolvedTransitionFunctions = collectResolvedTransitionFunctions(root, bindings);
|
|
158
|
-
const inferredProfile = rootProfile === "xstate-v6-alpha" || resolvedTransitionFunctions.size > 0 || [...referencedStateSymbols].some((symbol) =>
|
|
158
|
+
const inferredProfile = rootProfile === "xstate-v6-alpha" || resolvedTransitionFunctions.size > 0 || [...referencedStateSymbols].some((symbol) => {
|
|
159
|
+
const binding = bindings.get(symbol);
|
|
160
|
+
return binding?.kind === "createStateConfig" || detectXStateSourceProfile(binding?.sourceFile.text ?? "") === "xstate-v6-alpha";
|
|
161
|
+
}) ? "xstate-v6-alpha" : rootProfile;
|
|
159
162
|
return {
|
|
160
163
|
version: 1,
|
|
161
164
|
profile: packageProfile?.profile ?? inferredProfile,
|
|
@@ -331,7 +331,7 @@ function createWebSocketTransport(options) {
|
|
|
331
331
|
|
|
332
332
|
//#endregion
|
|
333
333
|
//#region src/version.ts
|
|
334
|
-
const SDK_VERSION = "0.22.
|
|
334
|
+
const SDK_VERSION = "0.22.1";
|
|
335
335
|
function inspectionRuntime() {
|
|
336
336
|
if (typeof window !== "undefined") return "browser";
|
|
337
337
|
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.22.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stately-sdk": "./dist/bin.mjs"
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"jsdom": "^27.4.0",
|
|
94
94
|
"tsdown": "0.21.0-beta.2",
|
|
95
95
|
"vitest": "^3.2.4",
|
|
96
|
-
"@statelyai/api-contract": "0.3.
|
|
97
|
-
"@statelyai/graph-tools": "0.2.
|
|
96
|
+
"@statelyai/api-contract": "0.3.7",
|
|
97
|
+
"@statelyai/graph-tools": "0.2.1"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.4"
|