@statelyai/sdk 0.26.2 → 0.27.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 +30 -2
- package/dist/auth.d.mts +1 -1
- package/dist/{editorHostSession-DFjM-RoT.d.mts → editorHostSession-CWAuoMtC.d.mts} +9 -3
- package/dist/{editorHostSession-CwGeXJ6g.mjs → editorHostSession-shrjfosC.mjs} +6 -3
- package/dist/editorHostSession.d.mts +1 -1
- package/dist/editorHostSession.mjs +1 -1
- package/dist/embed.d.mts +6 -3
- package/dist/embed.mjs +23 -1
- package/dist/embedPanel-Bpbq4sfJ.d.mts +13 -0
- package/dist/{graph-DoUReqxz.d.mts → graph-BwHnhzpC.d.mts} +48 -6
- package/dist/graph.d.mts +1 -1
- package/dist/graph.mjs +36 -4
- package/dist/{index-DKRB-u93.d.mts → index-D2I1qPsf.d.mts} +19 -3
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +6 -6
- package/dist/{inspect-Br_vS_lK.d.mts → inspect-D61HS-t7.d.mts} +2 -5
- package/dist/{inspect-BA3EPIz9.mjs → inspect-_E2lVbQA.mjs} +2 -4
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +2 -2
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +46 -15
- package/dist/{statelyPragma-CWxhEIcZ.mjs → statelyPragma-DD7wx7-b.mjs} +1198 -31
- package/dist/{studio-B6P177N3.d.mts → studio-B9-1Ynrx.d.mts} +4 -2
- package/dist/{studio-iNSHtNmP.mjs → studio-CNkxMZyz.mjs} +4 -1
- package/dist/studio.d.mts +1 -1
- package/dist/studio.mjs +1 -1
- package/dist/sync.d.mts +12 -4
- package/dist/sync.mjs +2920 -262
- package/dist/{version-DKSLBwJ9.mjs → version-7SUCFMqb.mjs} +34 -8
- package/package.json +3 -3
- package/schemas/xstate.schema.json +41 -5
- /package/dist/{auth-B0ZTKri2.d.mts → auth-BPyCCHYo.d.mts} +0 -0
- /package/dist/{editor-sync-types-C-zWaaVk.d.mts → editor-sync-types-CTKArS8n.d.mts} +0 -0
|
@@ -22,6 +22,21 @@ function assertEmbedDocuments(documents) {
|
|
|
22
22
|
}
|
|
23
23
|
if (totalLength > EMBED_DOCUMENT_LIMITS.maxTotalLength) throw new TypeError("Embed documents exceed the 2 MiB character limit.");
|
|
24
24
|
}
|
|
25
|
+
function assertEmbedPanels(panels) {
|
|
26
|
+
if (panels === void 0) return;
|
|
27
|
+
if (!Array.isArray(panels)) throw new TypeError("Embed panels must be an array.");
|
|
28
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const panel of panels) {
|
|
30
|
+
if (!panel || typeof panel !== "object" || typeof panel.id !== "string") throw new TypeError("Every embed panel must be an object with an id.");
|
|
31
|
+
if (seen.has(panel.id)) throw new TypeError(`Duplicate embed panel id: ${panel.id}`);
|
|
32
|
+
seen.add(panel.id);
|
|
33
|
+
if (panel.position !== void 0 && ![
|
|
34
|
+
"left",
|
|
35
|
+
"right",
|
|
36
|
+
"bottom"
|
|
37
|
+
].includes(panel.position)) throw new TypeError(`Invalid embed panel position: ${panel.position}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
25
40
|
const jsonResultFormats = new Set([
|
|
26
41
|
"digraph",
|
|
27
42
|
"xstate-json",
|
|
@@ -114,6 +129,7 @@ function createPendingExportManager(sendRetrieve) {
|
|
|
114
129
|
function toInitMessage(options) {
|
|
115
130
|
assertEmbedDocuments(options.documents);
|
|
116
131
|
assertEmbedExamples(options.examples);
|
|
132
|
+
assertEmbedPanels(options.panels);
|
|
117
133
|
if ("machines" in options) return {
|
|
118
134
|
type: "@statelyai.project.init",
|
|
119
135
|
machines: options.machines,
|
|
@@ -125,9 +141,7 @@ function toInitMessage(options) {
|
|
|
125
141
|
depth: options.depth,
|
|
126
142
|
capabilities: options.capabilities,
|
|
127
143
|
examples: options.examples,
|
|
128
|
-
|
|
129
|
-
rightPanels: options.panels?.rightPanels,
|
|
130
|
-
activePanels: options.panels?.activePanels,
|
|
144
|
+
panels: options.panels,
|
|
131
145
|
commentsByMachineId: options.commentsByMachineId,
|
|
132
146
|
projectWorkspace: options.projectWorkspace,
|
|
133
147
|
projectWorkspaceOpen: options.projectWorkspaceOpen,
|
|
@@ -148,9 +162,7 @@ function toInitMessage(options) {
|
|
|
148
162
|
depth: options.depth,
|
|
149
163
|
capabilities: options.capabilities,
|
|
150
164
|
examples: options.examples,
|
|
151
|
-
|
|
152
|
-
rightPanels: options.panels?.rightPanels,
|
|
153
|
-
activePanels: options.panels?.activePanels,
|
|
165
|
+
panels: options.panels,
|
|
154
166
|
comments: options.comments,
|
|
155
167
|
sourceLocations: options.sourceLocations,
|
|
156
168
|
settings: options.settings,
|
|
@@ -242,8 +254,22 @@ function createWebSocketTransport(options) {
|
|
|
242
254
|
reconnectAttempts++;
|
|
243
255
|
reconnectTimer = setTimeout(connect, delay);
|
|
244
256
|
}
|
|
257
|
+
function disposeSocket(socket) {
|
|
258
|
+
socket.onmessage = null;
|
|
259
|
+
socket.onclose = null;
|
|
260
|
+
socket.onerror = null;
|
|
261
|
+
if (socket.readyState === WebSocket.CONNECTING) socket.onopen = () => socket.close();
|
|
262
|
+
else {
|
|
263
|
+
socket.onopen = null;
|
|
264
|
+
socket.close();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
245
267
|
function connect() {
|
|
246
268
|
if (destroyed || terminalFailure) return;
|
|
269
|
+
if (ws) {
|
|
270
|
+
disposeSocket(ws);
|
|
271
|
+
ws = null;
|
|
272
|
+
}
|
|
247
273
|
try {
|
|
248
274
|
ws = new WebSocket(url);
|
|
249
275
|
} catch {
|
|
@@ -315,7 +341,7 @@ function createWebSocketTransport(options) {
|
|
|
315
341
|
if (destroyed) return;
|
|
316
342
|
destroyed = true;
|
|
317
343
|
if (reconnectTimer) clearTimeout(reconnectTimer);
|
|
318
|
-
ws
|
|
344
|
+
if (ws) disposeSocket(ws);
|
|
319
345
|
ws = null;
|
|
320
346
|
messageHandlers.clear();
|
|
321
347
|
readyHandlers.clear();
|
|
@@ -338,7 +364,7 @@ function createWebSocketTransport(options) {
|
|
|
338
364
|
|
|
339
365
|
//#endregion
|
|
340
366
|
//#region src/version.ts
|
|
341
|
-
const SDK_VERSION = "0.
|
|
367
|
+
const SDK_VERSION = "0.27.0";
|
|
342
368
|
function inspectionRuntime() {
|
|
343
369
|
if (typeof window !== "undefined") return "browser";
|
|
344
370
|
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.27.0",
|
|
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.
|
|
96
|
+
"@statelyai/api-contract": "0.3.13",
|
|
97
|
+
"@statelyai/graph-tools": "0.5.0"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.4"
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"type": "array",
|
|
50
50
|
"items": { "type": "string", "minLength": 1 }
|
|
51
51
|
},
|
|
52
|
+
"matches": { "$ref": "#/$defs/jsonObject" },
|
|
53
|
+
"context": { "$ref": "#/$defs/jsonValue" },
|
|
52
54
|
"guard": { "$ref": "#/$defs/guardObject" },
|
|
53
55
|
"actions": {
|
|
54
56
|
"type": "array",
|
|
@@ -56,13 +58,35 @@
|
|
|
56
58
|
},
|
|
57
59
|
"reenter": { "type": "boolean" },
|
|
58
60
|
"meta": { "$ref": "#/$defs/jsonObject" },
|
|
59
|
-
"description": { "type": "string" }
|
|
61
|
+
"description": { "type": "string" },
|
|
62
|
+
"input": { "$ref": "#/$defs/jsonValue" }
|
|
60
63
|
}
|
|
61
64
|
},
|
|
62
65
|
"transitionArray": {
|
|
63
66
|
"type": "array",
|
|
64
67
|
"items": { "$ref": "#/$defs/transitionObject" }
|
|
65
68
|
},
|
|
69
|
+
"choiceObject": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"additionalProperties": false,
|
|
72
|
+
"required": ["target"],
|
|
73
|
+
"properties": {
|
|
74
|
+
"target": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": { "type": "string", "minLength": 1 }
|
|
77
|
+
},
|
|
78
|
+
"when": { "$ref": "#/$defs/guardObject" },
|
|
79
|
+
"context": { "$ref": "#/$defs/jsonValue" },
|
|
80
|
+
"input": { "$ref": "#/$defs/jsonValue" },
|
|
81
|
+
"description": { "type": "string" },
|
|
82
|
+
"reenter": { "type": "boolean" },
|
|
83
|
+
"meta": { "$ref": "#/$defs/jsonObject" }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"choiceArray": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": { "$ref": "#/$defs/choiceObject" }
|
|
89
|
+
},
|
|
66
90
|
"transitionsByEvent": {
|
|
67
91
|
"type": "object",
|
|
68
92
|
"additionalProperties": { "$ref": "#/$defs/transitionArray" }
|
|
@@ -73,12 +97,14 @@
|
|
|
73
97
|
"required": ["src"],
|
|
74
98
|
"properties": {
|
|
75
99
|
"id": { "type": "string" },
|
|
76
|
-
"
|
|
100
|
+
"registryKey": { "type": "string" },
|
|
77
101
|
"src": { "type": "string", "minLength": 1 },
|
|
78
102
|
"input": { "$ref": "#/$defs/jsonValue" },
|
|
79
103
|
"onDone": { "$ref": "#/$defs/transitionArray" },
|
|
80
104
|
"onError": { "$ref": "#/$defs/transitionArray" },
|
|
81
|
-
"onSnapshot": { "$ref": "#/$defs/transitionArray" }
|
|
105
|
+
"onSnapshot": { "$ref": "#/$defs/transitionArray" },
|
|
106
|
+
"timeout": { "$ref": "#/$defs/jsonValue" },
|
|
107
|
+
"onTimeout": { "$ref": "#/$defs/transitionArray" }
|
|
82
108
|
}
|
|
83
109
|
},
|
|
84
110
|
"stateNodeConfig": {
|
|
@@ -87,7 +113,7 @@
|
|
|
87
113
|
"properties": {
|
|
88
114
|
"id": { "type": "string" },
|
|
89
115
|
"type": {
|
|
90
|
-
"enum": ["atomic", "compound", "parallel", "final", "history"]
|
|
116
|
+
"enum": ["atomic", "compound", "parallel", "final", "history", "choice"]
|
|
91
117
|
},
|
|
92
118
|
"history": {
|
|
93
119
|
"anyOf": [
|
|
@@ -113,10 +139,15 @@
|
|
|
113
139
|
"items": { "$ref": "#/$defs/actionObject" }
|
|
114
140
|
},
|
|
115
141
|
"onDone": { "$ref": "#/$defs/transitionArray" },
|
|
142
|
+
"onError": { "$ref": "#/$defs/transitionArray" },
|
|
143
|
+
"onTimeout": { "$ref": "#/$defs/transitionArray" },
|
|
116
144
|
"after": { "$ref": "#/$defs/transitionsByEvent" },
|
|
117
145
|
"always": { "$ref": "#/$defs/transitionArray" },
|
|
146
|
+
"choice": { "$ref": "#/$defs/choiceArray" },
|
|
118
147
|
"meta": { "$ref": "#/$defs/jsonObject" },
|
|
119
148
|
"output": { "$ref": "#/$defs/jsonValue" },
|
|
149
|
+
"timeout": { "$ref": "#/$defs/jsonValue" },
|
|
150
|
+
"route": { "$ref": "#/$defs/jsonValue" },
|
|
120
151
|
"order": { "type": "number" },
|
|
121
152
|
"tags": {
|
|
122
153
|
"type": "array",
|
|
@@ -133,7 +164,7 @@
|
|
|
133
164
|
"properties": {
|
|
134
165
|
"id": { "type": "string" },
|
|
135
166
|
"type": {
|
|
136
|
-
"enum": ["atomic", "compound", "parallel", "final", "history"]
|
|
167
|
+
"enum": ["atomic", "compound", "parallel", "final", "history", "choice"]
|
|
137
168
|
},
|
|
138
169
|
"history": {
|
|
139
170
|
"anyOf": [
|
|
@@ -159,10 +190,15 @@
|
|
|
159
190
|
"items": { "$ref": "#/$defs/actionObject" }
|
|
160
191
|
},
|
|
161
192
|
"onDone": { "$ref": "#/$defs/transitionArray" },
|
|
193
|
+
"onError": { "$ref": "#/$defs/transitionArray" },
|
|
194
|
+
"onTimeout": { "$ref": "#/$defs/transitionArray" },
|
|
162
195
|
"after": { "$ref": "#/$defs/transitionsByEvent" },
|
|
163
196
|
"always": { "$ref": "#/$defs/transitionArray" },
|
|
197
|
+
"choice": { "$ref": "#/$defs/choiceArray" },
|
|
164
198
|
"meta": { "$ref": "#/$defs/jsonObject" },
|
|
165
199
|
"output": { "$ref": "#/$defs/jsonValue" },
|
|
200
|
+
"timeout": { "$ref": "#/$defs/jsonValue" },
|
|
201
|
+
"route": { "$ref": "#/$defs/jsonValue" },
|
|
166
202
|
"order": { "type": "number" },
|
|
167
203
|
"tags": {
|
|
168
204
|
"type": "array",
|
|
File without changes
|
|
File without changes
|