@statelyai/sdk 0.34.1 → 0.34.2
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 +28 -5
- package/dist/assetStorage.d.mts +1 -1
- package/dist/{dist-NJFkDQjK.mjs → dist-DsOTTfYv.mjs} +243 -16
- package/dist/{editorHostSession-Bj5YcijC.mjs → editorHostSession-DCTHhBqC.mjs} +1 -1
- package/dist/{editorHostSession-DBLSyHJs.d.mts → editorHostSession-yGUKdLjq.d.mts} +1 -1
- package/dist/editorHostSession.d.mts +1 -1
- package/dist/editorHostSession.mjs +2 -2
- package/dist/embed.d.mts +3 -3
- package/dist/embed.mjs +1 -1
- package/dist/{graph-Ciocekxl.d.mts → graph-DVfx7FwN.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-DZivqh0u.d.mts → index-A5CMACoO.d.mts} +32 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/{inspect-BbvfH0Q1.d.mts → inspect-DBH9oOAd.d.mts} +1 -1
- package/dist/{inspect-DW30GMge.mjs → inspect-ZVDq9tK2.mjs} +48 -32
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +2 -2
- package/dist/patchTypes.d.mts +1 -1
- package/dist/{protocol-B7q2lWj_.d.mts → protocol-CCf9j_SZ.d.mts} +2 -2
- package/dist/protocol.d.mts +1 -1
- package/dist/relay.d.mts +1 -1
- package/dist/relay.mjs +40 -1
- package/dist/{studio-CKdEPGKY.d.mts → studio-CFN3-0-2.d.mts} +1 -1
- package/dist/studio.d.mts +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +1 -1
- package/dist/{version-BEfUEyPL.mjs → version-CUFh-PYe.mjs} +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -223,6 +223,12 @@ Resource operations always require a credential.
|
|
|
223
223
|
Stream live actor-system state to the hosted Stately inspector. Zero-config
|
|
224
224
|
inspection needs no API key or local relay.
|
|
225
225
|
|
|
226
|
+
For an app that only needs actor inspection, install
|
|
227
|
+
[`@statelyai/inspector`](../inspector) instead. It provides the same
|
|
228
|
+
`createInspector` API without installing the SDK's source-sync, graph, and Node
|
|
229
|
+
relay dependencies. In the examples below, import from `@statelyai/inspector`
|
|
230
|
+
when using that package.
|
|
231
|
+
|
|
226
232
|
`selectedSessionId` takes the exact session id: `actor.sessionId` for runtime
|
|
227
233
|
actors (or your `resolveSessionId` result), and `${producerId}:${id}` for manual
|
|
228
234
|
actors. For example, with `producerId: 'demo'`, select `inspector.actor('root')`
|
|
@@ -236,9 +242,14 @@ const inspector = createInspector();
|
|
|
236
242
|
const { inspect } = inspector;
|
|
237
243
|
|
|
238
244
|
const actor = createActor(machine, { inspect });
|
|
245
|
+
// With XState v6, the inspector shows this actor's graph before start().
|
|
239
246
|
actor.start();
|
|
240
247
|
```
|
|
241
248
|
|
|
249
|
+
Before `start()`, the XState v6 actor view has no active-state highlight. The
|
|
250
|
+
first runtime transition updates that same actor view. An initial error is
|
|
251
|
+
shown immediately, even if `start()` produces no transition.
|
|
252
|
+
|
|
242
253
|
The inspector also accepts read-only `documents`, panel configuration, initial
|
|
243
254
|
`viewMode`, and typed display `settings`. Use `selectActor(sessionId)`,
|
|
244
255
|
`setTheme(theme)`, `setViewMode(mode)`, and `setSettings(settings)` to control the
|
|
@@ -307,7 +318,12 @@ replacement; late observations from a displaced actor are ignored.
|
|
|
307
318
|
|
|
308
319
|
The resolver's third argument is the parent's resolved id, so recreated child
|
|
309
320
|
actors can use stable paths instead of accumulating runtime session ids. IDs
|
|
310
|
-
must
|
|
321
|
+
must be unique along each parent-child path. Sibling actors may reuse one id
|
|
322
|
+
after its previous owner reaches `done`, `stopped`, or `error`; setting
|
|
323
|
+
`sessionIdReuse: "always"` also permits explicit replacement of an active
|
|
324
|
+
sibling. The displaced actor's later observations are ignored. Inspector
|
|
325
|
+
callback errors emit `on('error', ...)` with code `inspection_failed` and do not
|
|
326
|
+
interrupt the actor system.
|
|
311
327
|
|
|
312
328
|
To present a stopped request-scoped runtime as waiting for its next resume, map
|
|
313
329
|
its serialized status to a non-terminal value such as `suspended` in
|
|
@@ -332,6 +348,9 @@ keep it private. Hosted replay expires after 24
|
|
|
332
348
|
hours without activity. Only actor checkpoints and observations are replayed;
|
|
333
349
|
export traffic is live-only, and auth/upload/embed-control messages are rejected.
|
|
334
350
|
AI-backed features remain separately authenticated.
|
|
351
|
+
The relay keeps a complete current actor checkpoint while bounding recent
|
|
352
|
+
observation history, so joining after many actor registrations still initializes
|
|
353
|
+
the viewer.
|
|
335
354
|
|
|
336
355
|
After successful registration, hosted Sky records coarse connection analytics:
|
|
337
356
|
role, normalized browser origin or `unknown`, localhost status, runtime,
|
|
@@ -399,10 +418,14 @@ regeneration when the source cannot be reconciled safely.
|
|
|
399
418
|
<!-- graph conversion and codegen exports from src/graph.ts and src/index.ts -->
|
|
400
419
|
|
|
401
420
|
Convert between Studio graph data, XState machine configs, and TypeScript
|
|
402
|
-
source with `graphToXStateTS`.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
421
|
+
source with `graphToXStateTS`. `graphToXStateTSResult` also reports code leaves
|
|
422
|
+
that a profile replaced to keep an export syntactically valid;
|
|
423
|
+
`getProfileCodeIssues` inspects them without exporting, and
|
|
424
|
+
`recoverInvalidProfileCode` applies the profile's exact fallback functions to a
|
|
425
|
+
copy. Source-location documents retain authored code instead of applying these
|
|
426
|
+
export-only stubs. Use `graphToXStateFSM` for a flat `createFSM` projection and
|
|
427
|
+
`getXStateFSMCompatibilityIssues` before exporting to report semantics that the
|
|
428
|
+
compact FSM cannot represent. Generate types from JSON Schema.
|
|
406
429
|
|
|
407
430
|
## Support
|
|
408
431
|
|
package/dist/assetStorage.d.mts
CHANGED
|
@@ -3832,12 +3832,18 @@ function actionCodeExpression(expr, source) {
|
|
|
3832
3832
|
}]
|
|
3833
3833
|
};
|
|
3834
3834
|
}
|
|
3835
|
-
function inlineCodeExpression$1(expr) {
|
|
3836
|
-
|
|
3835
|
+
function inlineCodeExpression$1(expr, sourceValue) {
|
|
3836
|
+
const result = {
|
|
3837
3837
|
"@type": "code",
|
|
3838
3838
|
lang: "ts",
|
|
3839
3839
|
expr: stripExportDefault(expr)
|
|
3840
3840
|
};
|
|
3841
|
+
const sourceId = sourceValue?.__stately_source_id__;
|
|
3842
|
+
if (sourceId !== void 0) Object.defineProperty(result, "__stately_source_id__", {
|
|
3843
|
+
value: sourceId,
|
|
3844
|
+
enumerable: true
|
|
3845
|
+
});
|
|
3846
|
+
return result;
|
|
3841
3847
|
}
|
|
3842
3848
|
/**
|
|
3843
3849
|
* Serialize an edge guard for a machine config. Codegen emits inline guards as
|
|
@@ -3850,7 +3856,7 @@ function serializeGuard(guard, asTypeRef) {
|
|
|
3850
3856
|
type: guard.type,
|
|
3851
3857
|
params: guard.params
|
|
3852
3858
|
} : { type: guard.type };
|
|
3853
|
-
return guard.code ? inlineCodeExpression$1(guard.code) : guard;
|
|
3859
|
+
return guard.code ? inlineCodeExpression$1(guard.code, guard) : guard;
|
|
3854
3860
|
}
|
|
3855
3861
|
/**
|
|
3856
3862
|
* Converts a built-in xstate ActionItem to a code expression directive,
|
|
@@ -3862,13 +3868,13 @@ function serializeActionItem(action, keepChooseStructured = false) {
|
|
|
3862
3868
|
type,
|
|
3863
3869
|
params
|
|
3864
3870
|
};
|
|
3865
|
-
if (type === "xstate.enqueue" && typeof params?.code === "string") return inlineCodeExpression$1(params.code);
|
|
3871
|
+
if (type === "xstate.enqueue" && typeof params?.code === "string") return inlineCodeExpression$1(params.code, action);
|
|
3866
3872
|
const exprCode = type === "xstate.expr" && typeof params?.code === "string" ? params.code : void 0;
|
|
3867
3873
|
if (isBuiltInActionType(type)) {
|
|
3868
3874
|
const builtInAction = XSTATE_BUILT_IN_ACTIONS[type];
|
|
3869
3875
|
return actionCodeExpression(emitBuiltInAction(type, params), builtInAction);
|
|
3870
3876
|
}
|
|
3871
|
-
if (exprCode) return inlineCodeExpression$1(exprCode);
|
|
3877
|
+
if (exprCode) return inlineCodeExpression$1(exprCode, action);
|
|
3872
3878
|
if (!params || Object.keys(params).length === 0) return { type };
|
|
3873
3879
|
return {
|
|
3874
3880
|
type,
|
|
@@ -4310,6 +4316,135 @@ const XSTATE_AUTHORING = {
|
|
|
4310
4316
|
supportsTargetlessEdges: true,
|
|
4311
4317
|
supportsReenterEdges: true
|
|
4312
4318
|
};
|
|
4319
|
+
function hasNoParseErrors(source) {
|
|
4320
|
+
return (ts.createSourceFile("profile-code.ts", source, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS).parseDiagnostics?.length ?? 0) === 0;
|
|
4321
|
+
}
|
|
4322
|
+
function isExpression(code) {
|
|
4323
|
+
return code.trim().length > 0 && hasNoParseErrors(`(${code})`);
|
|
4324
|
+
}
|
|
4325
|
+
function isImplementation(code) {
|
|
4326
|
+
return isExpression(stripExportDefault(code)) || hasNoParseErrors(`function implementation() {\n${code}\n}`);
|
|
4327
|
+
}
|
|
4328
|
+
function isAsyncImplementation(code) {
|
|
4329
|
+
return isExpression(stripExportDefault(code)) || hasNoParseErrors(`async function implementation() {\n${code}\n}`);
|
|
4330
|
+
}
|
|
4331
|
+
function pathEndsWith(location, suffix) {
|
|
4332
|
+
return suffix.every((segment, index) => location.path[location.path.length - suffix.length + index] === segment);
|
|
4333
|
+
}
|
|
4334
|
+
function commented(code) {
|
|
4335
|
+
return code.replace(/\r\n?|\u2028|\u2029/g, "\n").split("\n").map((line) => `// ${line}`).join("\n");
|
|
4336
|
+
}
|
|
4337
|
+
function indent(code, spaces) {
|
|
4338
|
+
const prefix = " ".repeat(spaces);
|
|
4339
|
+
return code.split("\n").map((line) => `${prefix}${line}`).join("\n");
|
|
4340
|
+
}
|
|
4341
|
+
function indentAfterFirstLine(code, spaces) {
|
|
4342
|
+
const [first = "", ...rest] = code.split("\n");
|
|
4343
|
+
if (rest.length === 0) return first;
|
|
4344
|
+
return `${first}\n${indent(rest.join("\n"), spaces)}`;
|
|
4345
|
+
}
|
|
4346
|
+
const throwingBody = (invalidCode) => `// FIXME(stately): authored code does not compile\n${commented(invalidCode)}\nthrow new Error('Invalid authored code');`;
|
|
4347
|
+
const falseBody = (invalidCode) => `// FIXME(stately): authored code does not compile\n${commented(invalidCode)}\nreturn false;`;
|
|
4348
|
+
const throwingExpression = (invalidCode) => `(() => {\n${indent(throwingBody(invalidCode), 2)}\n})()`;
|
|
4349
|
+
const functionThrowingExpression = (invalidCode) => `() => {\n${indent(throwingBody(invalidCode), 2)}\n}`;
|
|
4350
|
+
const functionFalseExpression = (invalidCode) => `() => {\n${indent(falseBody(invalidCode), 2)}\n}`;
|
|
4351
|
+
const throwingImplementationBody = (invalidCode) => indentAfterFirstLine(throwingBody(invalidCode), 2);
|
|
4352
|
+
const falseImplementationBody = (invalidCode) => indentAfterFirstLine(falseBody(invalidCode), 2);
|
|
4353
|
+
function implementationTarget(location, collection) {
|
|
4354
|
+
const index = location.path[3];
|
|
4355
|
+
const implementations = location.graph.data.implementations?.[collection];
|
|
4356
|
+
const implementation = typeof index === "number" ? implementations?.[index] : void 0;
|
|
4357
|
+
if (!implementation?.id) return void 0;
|
|
4358
|
+
return {
|
|
4359
|
+
kind: "source",
|
|
4360
|
+
sourceType: collection === "actors" ? "actor" : collection.slice(0, -1),
|
|
4361
|
+
id: implementation.id,
|
|
4362
|
+
label: implementation.name || implementation.id
|
|
4363
|
+
};
|
|
4364
|
+
}
|
|
4365
|
+
function entityTarget(location) {
|
|
4366
|
+
const [collection, index] = location.path;
|
|
4367
|
+
const isNode = collection === "nodes" && typeof index === "number";
|
|
4368
|
+
const isEdge = collection === "edges" && typeof index === "number";
|
|
4369
|
+
const owner = isNode ? location.graph.nodes[index] : isEdge ? location.graph.edges[index] : void 0;
|
|
4370
|
+
if (!owner) return void 0;
|
|
4371
|
+
const dataOffset = location.path.indexOf("data");
|
|
4372
|
+
const field = location.path[dataOffset + 1];
|
|
4373
|
+
const itemIndex = location.path[dataOffset + 2];
|
|
4374
|
+
if ((field === "entry" || field === "exit" || field === "actions") && typeof itemIndex === "number") {
|
|
4375
|
+
const action = owner.data[field]?.[itemIndex];
|
|
4376
|
+
if (action?.id) return {
|
|
4377
|
+
kind: "entity",
|
|
4378
|
+
id: `action:${action.id}`,
|
|
4379
|
+
label: action.type ? `Action: ${action.type}` : "Action"
|
|
4380
|
+
};
|
|
4381
|
+
}
|
|
4382
|
+
if (field === "invokes" && typeof itemIndex === "number") {
|
|
4383
|
+
const invoke = owner.data.invokes?.[itemIndex];
|
|
4384
|
+
if (invoke?.id) return {
|
|
4385
|
+
kind: "entity",
|
|
4386
|
+
id: `invoke:${invoke.id}`,
|
|
4387
|
+
label: invoke.src ? `Invoke: ${invoke.src}` : "Invoke"
|
|
4388
|
+
};
|
|
4389
|
+
}
|
|
4390
|
+
if (isEdge && field === "guard") return {
|
|
4391
|
+
kind: "entity",
|
|
4392
|
+
id: `guard:${owner.id}`,
|
|
4393
|
+
label: "Guard"
|
|
4394
|
+
};
|
|
4395
|
+
if (isEdge && field === "context") return {
|
|
4396
|
+
kind: "entity",
|
|
4397
|
+
id: `context:${owner.id}`,
|
|
4398
|
+
label: "Context"
|
|
4399
|
+
};
|
|
4400
|
+
if (field === "meta") return {
|
|
4401
|
+
kind: "entity",
|
|
4402
|
+
id: `meta:${owner.id}`,
|
|
4403
|
+
label: "Meta"
|
|
4404
|
+
};
|
|
4405
|
+
}
|
|
4406
|
+
const implementationBlock = (name, collection, exportInvalid, isValid = isImplementation) => ({
|
|
4407
|
+
name,
|
|
4408
|
+
matches: ({ path }) => path.length === 6 && path[0] === "data" && path[1] === "implementations" && path[2] === collection && typeof path[3] === "number" && path[4] === "code" && path[5] === "body",
|
|
4409
|
+
isValid,
|
|
4410
|
+
exportInvalid,
|
|
4411
|
+
getTarget: (location) => implementationTarget(location, collection)
|
|
4412
|
+
});
|
|
4413
|
+
const XSTATE_CODE_BLOCKS = [
|
|
4414
|
+
implementationBlock("action implementation", "actions", throwingImplementationBody),
|
|
4415
|
+
implementationBlock("guard implementation", "guards", falseImplementationBody),
|
|
4416
|
+
implementationBlock("actor implementation", "actors", throwingImplementationBody, isAsyncImplementation),
|
|
4417
|
+
implementationBlock("delay implementation", "delays", throwingImplementationBody),
|
|
4418
|
+
{
|
|
4419
|
+
name: "inline guard",
|
|
4420
|
+
matches: (location) => pathEndsWith(location, ["guard", "code"]),
|
|
4421
|
+
isValid: isExpression,
|
|
4422
|
+
exportInvalid: functionFalseExpression,
|
|
4423
|
+
getTarget: entityTarget
|
|
4424
|
+
},
|
|
4425
|
+
{
|
|
4426
|
+
name: "inline action",
|
|
4427
|
+
matches: (location) => {
|
|
4428
|
+
if (!pathEndsWith(location, ["params", "code"])) return false;
|
|
4429
|
+
const owner = location.ancestors.at(-2);
|
|
4430
|
+
return !!owner && typeof owner === "object" && owner.type === "xstate.expr";
|
|
4431
|
+
},
|
|
4432
|
+
isValid: isExpression,
|
|
4433
|
+
exportInvalid: functionThrowingExpression,
|
|
4434
|
+
getTarget: entityTarget,
|
|
4435
|
+
getSourceValue: (location) => {
|
|
4436
|
+
const owner = location.ancestors.at(-2);
|
|
4437
|
+
return owner && typeof owner === "object" ? owner : void 0;
|
|
4438
|
+
}
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
name: "code expression",
|
|
4442
|
+
matches: (location) => pathEndsWith(location, ["expr"]) && !!location.parent && typeof location.parent === "object" && location.parent["@type"] === "code",
|
|
4443
|
+
isValid: isExpression,
|
|
4444
|
+
exportInvalid: throwingExpression,
|
|
4445
|
+
getTarget: entityTarget
|
|
4446
|
+
}
|
|
4447
|
+
];
|
|
4313
4448
|
const XSTATE_PROFILE_MANIFESTS = [{
|
|
4314
4449
|
profile: XSTATE_V5_PROFILE,
|
|
4315
4450
|
namespace: "@statelyai.xstate",
|
|
@@ -4318,6 +4453,7 @@ const XSTATE_PROFILE_MANIFESTS = [{
|
|
|
4318
4453
|
name: "XState v5",
|
|
4319
4454
|
formats: [...XSTATE_FORMATS],
|
|
4320
4455
|
authoring: XSTATE_AUTHORING,
|
|
4456
|
+
code: { blocks: XSTATE_CODE_BLOCKS },
|
|
4321
4457
|
operations: {
|
|
4322
4458
|
simulate: true,
|
|
4323
4459
|
validate: true,
|
|
@@ -4331,6 +4467,7 @@ const XSTATE_PROFILE_MANIFESTS = [{
|
|
|
4331
4467
|
name: "XState v6 alpha",
|
|
4332
4468
|
formats: [...XSTATE_FORMATS],
|
|
4333
4469
|
authoring: XSTATE_AUTHORING,
|
|
4470
|
+
code: { blocks: XSTATE_CODE_BLOCKS },
|
|
4334
4471
|
operations: {
|
|
4335
4472
|
simulate: true,
|
|
4336
4473
|
validate: true,
|
|
@@ -5924,6 +6061,78 @@ function extractXStateMachineConfigEntries(source, options = {}) {
|
|
|
5924
6061
|
visit(file);
|
|
5925
6062
|
return found;
|
|
5926
6063
|
}
|
|
6064
|
+
function getProfileCodeIssues(graph, profile) {
|
|
6065
|
+
return visitProfileCode(graph, profile).issues;
|
|
6066
|
+
}
|
|
6067
|
+
function recoverInvalidProfileCode(graph, profile) {
|
|
6068
|
+
const result = visitProfileCode(graph, profile, true);
|
|
6069
|
+
return {
|
|
6070
|
+
graph: result.value,
|
|
6071
|
+
issues: result.issues
|
|
6072
|
+
};
|
|
6073
|
+
}
|
|
6074
|
+
function visitProfileCode(graph, profile, recover = false) {
|
|
6075
|
+
const blocks = profile?.code?.blocks ?? [];
|
|
6076
|
+
const issues = [];
|
|
6077
|
+
const occurrences = [];
|
|
6078
|
+
const visit = (value, path, ancestors) => {
|
|
6079
|
+
const parent = ancestors.at(-1);
|
|
6080
|
+
if (typeof value === "string") {
|
|
6081
|
+
const location = {
|
|
6082
|
+
graph,
|
|
6083
|
+
path,
|
|
6084
|
+
parent,
|
|
6085
|
+
ancestors
|
|
6086
|
+
};
|
|
6087
|
+
const block = blocks.find((candidate) => candidate.matches(location));
|
|
6088
|
+
if (!block) return value;
|
|
6089
|
+
const issue = toIssue(graph, block, location, value);
|
|
6090
|
+
const valid = block.isValid(value);
|
|
6091
|
+
occurrences.push({
|
|
6092
|
+
...issue,
|
|
6093
|
+
sourceValue: block.getSourceValue?.(location) ?? (parent && typeof parent === "object" ? parent : void 0),
|
|
6094
|
+
valid
|
|
6095
|
+
});
|
|
6096
|
+
if (valid) return value;
|
|
6097
|
+
issues.push(issue);
|
|
6098
|
+
return recover ? block.exportInvalid(value) : value;
|
|
6099
|
+
}
|
|
6100
|
+
if (!value || typeof value !== "object") return value;
|
|
6101
|
+
if (!recover) {
|
|
6102
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
6103
|
+
if (typeof key === "symbol") continue;
|
|
6104
|
+
visit(value[key], [...path, Array.isArray(value) ? Number(key) : String(key)], [...ancestors, value]);
|
|
6105
|
+
}
|
|
6106
|
+
return value;
|
|
6107
|
+
}
|
|
6108
|
+
const clone = Array.isArray(value) ? [] : {};
|
|
6109
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
6110
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
6111
|
+
if (!descriptor) continue;
|
|
6112
|
+
if ("value" in descriptor && typeof key !== "symbol") descriptor.value = visit(descriptor.value, [...path, Array.isArray(value) ? Number(key) : String(key)], [...ancestors, value]);
|
|
6113
|
+
Object.defineProperty(clone, key, descriptor);
|
|
6114
|
+
}
|
|
6115
|
+
return clone;
|
|
6116
|
+
};
|
|
6117
|
+
return {
|
|
6118
|
+
value: visit(graph, [], []),
|
|
6119
|
+
issues,
|
|
6120
|
+
occurrences
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
6123
|
+
function toIssue(graph, block, location, invalidCode) {
|
|
6124
|
+
const { path } = location;
|
|
6125
|
+
const nodeIndex = path[0] === "nodes" ? path[1] : void 0;
|
|
6126
|
+
const edgeIndex = path[0] === "edges" ? path[1] : void 0;
|
|
6127
|
+
return {
|
|
6128
|
+
block: block.name,
|
|
6129
|
+
path,
|
|
6130
|
+
invalidCode,
|
|
6131
|
+
nodeIds: typeof nodeIndex === "number" && graph.nodes[nodeIndex] ? [graph.nodes[nodeIndex].id] : [],
|
|
6132
|
+
edgeIds: typeof edgeIndex === "number" && graph.edges[edgeIndex] ? [graph.edges[edgeIndex].id] : [],
|
|
6133
|
+
target: block.getTarget?.(location)
|
|
6134
|
+
};
|
|
6135
|
+
}
|
|
5927
6136
|
function jsonSchemaToTSType(schema) {
|
|
5928
6137
|
if (!schema) return "unknown";
|
|
5929
6138
|
if (schema.enum) return schema.enum.map((v) => typeof v === "string" ? `'${v}'` : String(v)).join(" | ");
|
|
@@ -6127,8 +6336,19 @@ function isRequiredProperty(key, definition, required) {
|
|
|
6127
6336
|
return typeof definition === "object" && definition !== null && definition.required === true;
|
|
6128
6337
|
}
|
|
6129
6338
|
function graphToXStateTS(graph, options = {}) {
|
|
6130
|
-
|
|
6131
|
-
|
|
6339
|
+
return graphToXStateTSResult(graph, options).source;
|
|
6340
|
+
}
|
|
6341
|
+
function graphToXStateTSResult(inputGraph, options = {}) {
|
|
6342
|
+
const inferredXStateVersion = isXStateV6ProfileRef(inputGraph.data.profile ?? "xstate-v5") ? 6 : 5;
|
|
6343
|
+
const { exportStyle = "named", targetLanguage = "typescript", xstateVersion = inferredXStateVersion, xstateV6SchemaFormat = "types", profile: profileOverride, recoverInvalidCode = true, ...configOptions } = options;
|
|
6344
|
+
const graphProfile = getProfileManifest(normalizeProfileRef(inputGraph.data.profile ?? "xstate-v5"));
|
|
6345
|
+
const profile = profileOverride ?? graphProfile ?? getProfileManifest(xstateVersion === 6 ? XSTATE_V6_PROFILE : XSTATE_V5_PROFILE);
|
|
6346
|
+
const profileGraph = inputGraph;
|
|
6347
|
+
const recovered = recoverInvalidCode ? recoverInvalidProfileCode(profileGraph, profile) : {
|
|
6348
|
+
graph: profileGraph,
|
|
6349
|
+
issues: getProfileCodeIssues(profileGraph, profile)
|
|
6350
|
+
};
|
|
6351
|
+
const graph = recovered.graph;
|
|
6132
6352
|
const schemas = graph.data.schemas;
|
|
6133
6353
|
const impls = filterInlineImplementations$1(graph.data.implementations);
|
|
6134
6354
|
const supportsTypeSyntax = targetLanguage === "typescript";
|
|
@@ -6188,7 +6408,14 @@ function graphToXStateTS(graph, options = {}) {
|
|
|
6188
6408
|
lines.push("");
|
|
6189
6409
|
lines.push("export default machine;");
|
|
6190
6410
|
}
|
|
6191
|
-
return
|
|
6411
|
+
return {
|
|
6412
|
+
source: lines.join("\n") + "\n",
|
|
6413
|
+
diagnostics: recovered.issues
|
|
6414
|
+
};
|
|
6415
|
+
}
|
|
6416
|
+
function markDiagnosticSource(value, code) {
|
|
6417
|
+
const id = value && typeof value === "object" ? value[SERIALIZED_SOURCE_ID] : void 0;
|
|
6418
|
+
return id === void 0 ? code : `/*__stately_diagnostic_${id}_start__*/${code}/*__stately_diagnostic_${id}_end__*/`;
|
|
6192
6419
|
}
|
|
6193
6420
|
function stripStateSchemas(config) {
|
|
6194
6421
|
delete config.schemas;
|
|
@@ -6375,13 +6602,13 @@ function guardCondition(value) {
|
|
|
6375
6602
|
if (arrow < 0) return null;
|
|
6376
6603
|
const params = expression.slice(0, arrow).trim();
|
|
6377
6604
|
const body = expression.slice(arrow + 2).trim();
|
|
6378
|
-
const callCondition = `(${expression})({ context, event, input, output, actions, guards, children, self, system })`;
|
|
6605
|
+
const callCondition = `(${markDiagnosticSource(value, expression)})({ context, event, input, output, actions, guards, children, self, system })`;
|
|
6379
6606
|
if (body.startsWith("{")) return {
|
|
6380
6607
|
condition: callCondition,
|
|
6381
6608
|
callCondition
|
|
6382
6609
|
};
|
|
6383
6610
|
return {
|
|
6384
|
-
condition: body,
|
|
6611
|
+
condition: markDiagnosticSource(value, body),
|
|
6385
6612
|
callCondition,
|
|
6386
6613
|
firstParam: params.startsWith("(") && params.endsWith(")") ? params.slice(1, -1).trim() : params
|
|
6387
6614
|
};
|
|
@@ -6555,7 +6782,7 @@ function buildV6TransitionFunction(transitions) {
|
|
|
6555
6782
|
function toV6ActionField(actions) {
|
|
6556
6783
|
if (actions.length === 1) {
|
|
6557
6784
|
const expr = inlineExpr(actions[0]);
|
|
6558
|
-
if (expr && isCompleteFunctionExpression(stripExportDefault(expr))) return raw(stripExportDefault(expr));
|
|
6785
|
+
if (expr && isCompleteFunctionExpression(stripExportDefault(expr))) return raw(stripExportDefault(expr), actions[0] && typeof actions[0] === "object" ? actions[0] : void 0);
|
|
6559
6786
|
}
|
|
6560
6787
|
return buildV6ActionFunction(actions) ?? actions;
|
|
6561
6788
|
}
|
|
@@ -6654,14 +6881,14 @@ function actionToV6Effect(action) {
|
|
|
6654
6881
|
const expr = inlineExpr(action);
|
|
6655
6882
|
if (expr) {
|
|
6656
6883
|
const assignment = getV6AssignmentContextValue(expr);
|
|
6657
|
-
if (assignment) return { contextValue: assignment };
|
|
6658
|
-
if (expr.startsWith("enq(") || expr.startsWith("enq.")) return { statements: [expr] };
|
|
6884
|
+
if (assignment) return { contextValue: markDiagnosticSource(action, assignment) };
|
|
6885
|
+
if (expr.startsWith("enq(") || expr.startsWith("enq.")) return { statements: [markDiagnosticSource(action, expr)] };
|
|
6659
6886
|
const builtIn = expr.match(/^(raise|emit|sendTo|cancel|log|spawnChild|stopChild)\(([\s\S]*)\)$/);
|
|
6660
6887
|
if (builtIn) {
|
|
6661
6888
|
const [, name, args] = builtIn;
|
|
6662
|
-
return { statements: [`enq.${name === "spawnChild" ? "spawn" : name === "stopChild" ? "stop" : name}(${args})`] };
|
|
6889
|
+
return { statements: [markDiagnosticSource(action, `enq.${name === "spawnChild" ? "spawn" : name === "stopChild" ? "stop" : name}(${args})`)] };
|
|
6663
6890
|
}
|
|
6664
|
-
return { statements: [`enq(${expr})`] };
|
|
6891
|
+
return { statements: [markDiagnosticSource(action, `enq(${expr})`)] };
|
|
6665
6892
|
}
|
|
6666
6893
|
if (!action || typeof action !== "object" || Array.isArray(action)) return null;
|
|
6667
6894
|
const record = action;
|
|
@@ -6922,7 +7149,7 @@ function buildTypesBlock(schemas, options) {
|
|
|
6922
7149
|
const contextType = contextSchemaToTSType(schemas.context);
|
|
6923
7150
|
if (contextType) types.context = raw(`{} as ${contextType}`);
|
|
6924
7151
|
const eventsType = eventsSchemaToTSType(schemas.events);
|
|
6925
|
-
if (eventsType) types.events = raw(`{} as\n
|
|
7152
|
+
if (eventsType) types.events = raw(`{} as\n | ${eventsType}`);
|
|
6926
7153
|
if (schemas.input) types.input = raw(`{} as ${jsonSchemaToTSType(schemas.input)}`);
|
|
6927
7154
|
if (schemas.output) types.output = raw(`{} as ${jsonSchemaToTSType(schemas.output)}`);
|
|
6928
7155
|
return Object.keys(types).length > 0 ? types : void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as object, 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 { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
|
|
3
|
-
import { p as graphChangeToPatchesResult } from "./dist-
|
|
3
|
+
import { p as graphChangeToPatchesResult } from "./dist-DsOTTfYv.mjs";
|
|
4
4
|
import * as ts$1 from "typescript";
|
|
5
5
|
|
|
6
6
|
//#region ../api-contract/dist/editor-sync.mjs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Q as ProjectEmbedMachine, an as EmbedPanelConfig, lt as ProjectWorkspaceConfig } from "./protocol-
|
|
1
|
+
import { Q as ProjectEmbedMachine, an as EmbedPanelConfig, lt as ProjectWorkspaceConfig } from "./protocol-CCf9j_SZ.mjs";
|
|
2
2
|
import { a as EditorSyncParseRequest, d as EditorSyncTextReplacement, f as MachineSourceLocations, i as EditorSyncApplyResponse, n as EditorSyncAccess, o as EditorSyncParseResponse, r as EditorSyncApplyRequest, s as EditorSyncSourceDocument, t as EditorCapabilities } from "./editor-sync-types-D7YYz6fb.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/editorHostProtocol.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, c as EditorSyncError, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-
|
|
1
|
+
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, c as EditorSyncError, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-yGUKdLjq.mjs";
|
|
2
2
|
export { EDITOR_PROTOCOL_VERSION, EditorHostDiagnostic, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorHostWorkspaceMachine, EditorHostWorkspaceSession, EditorHostWorkspaceSessionOptions, EditorSourceHost, EditorSyncBackend, EditorSyncError, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
|
|
3
|
-
import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, r as EditorSyncError, t as EditorHostSession } from "./editorHostSession-
|
|
4
|
-
import "./dist-
|
|
3
|
+
import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, r as EditorSyncError, t as EditorHostSession } from "./editorHostSession-DCTHhBqC.mjs";
|
|
4
|
+
import "./dist-DsOTTfYv.mjs";
|
|
5
5
|
|
|
6
6
|
export { EDITOR_PROTOCOL_VERSION, EditorHostSession, EditorHostWorkspaceSession, EditorSyncError, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as ProfileManifest } from "./index-
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
3
|
-
import { D as ExportCallOptions, F as InitOptions, G as MachineInitOptions, Gt as UploadResult, J as MachineVersionAutoSaveOptions, O as ExportFormat, Q as ProjectEmbedMachine, S as EmbedExtensionsManifest, Yt as ViewerOptions, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, et as ProjectInitOptions, g as EmbedDocument, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, pt as ProjectWorkspaceProject, q as MachineSourceLocations, r as CapabilityDeniedEvent, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-
|
|
1
|
+
import { i as ProfileManifest } from "./index-A5CMACoO.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-DVfx7FwN.mjs";
|
|
3
|
+
import { D as ExportCallOptions, F as InitOptions, G as MachineInitOptions, Gt as UploadResult, J as MachineVersionAutoSaveOptions, O as ExportFormat, Q as ProjectEmbedMachine, S as EmbedExtensionsManifest, Yt as ViewerOptions, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, et as ProjectInitOptions, g as EmbedDocument, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, pt as ProjectWorkspaceProject, q as MachineSourceLocations, r as CapabilityDeniedEvent, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-CCf9j_SZ.mjs";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/embed.d.ts
|
package/dist/embed.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./protocol-BsBGRISR.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-CUFh-PYe.mjs";
|
|
3
3
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
|
|
4
4
|
|
|
5
5
|
//#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-DVfx7FwN.mjs";
|
|
2
2
|
export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
|
|
@@ -3000,6 +3000,30 @@ type ProfileMigration = {
|
|
|
3000
3000
|
migrate: (data: Readonly<ProfileDataSet>, context: ProfileProjectionContext) => ProfileProjectionResult;
|
|
3001
3001
|
};
|
|
3002
3002
|
type FormatId = string;
|
|
3003
|
+
type ProfileCodeLocation = {
|
|
3004
|
+
graph: Readonly<ProfileGraph>;
|
|
3005
|
+
path: readonly (string | number)[];
|
|
3006
|
+
parent: unknown;
|
|
3007
|
+
ancestors: readonly unknown[];
|
|
3008
|
+
};
|
|
3009
|
+
type ProfileCodeTarget = {
|
|
3010
|
+
kind: 'entity';
|
|
3011
|
+
id: string;
|
|
3012
|
+
label: string;
|
|
3013
|
+
} | {
|
|
3014
|
+
kind: 'source';
|
|
3015
|
+
id: string;
|
|
3016
|
+
label: string;
|
|
3017
|
+
sourceType: string;
|
|
3018
|
+
};
|
|
3019
|
+
type ProfileCodeBlock = {
|
|
3020
|
+
name: string;
|
|
3021
|
+
matches: (location: ProfileCodeLocation) => boolean;
|
|
3022
|
+
isValid: (code: string) => boolean;
|
|
3023
|
+
exportInvalid: (invalidCode: string) => string; /** Editor destination used to surface and navigate code diagnostics. */
|
|
3024
|
+
getTarget?: (location: ProfileCodeLocation) => ProfileCodeTarget | undefined; /** Object used by source generation to locate this block in a full document. */
|
|
3025
|
+
getSourceValue?: (location: ProfileCodeLocation) => object | undefined;
|
|
3026
|
+
};
|
|
3003
3027
|
type ProfileFormatManifest = {
|
|
3004
3028
|
format: FormatId;
|
|
3005
3029
|
import?: boolean;
|
|
@@ -3053,7 +3077,10 @@ type ProfileManifest = {
|
|
|
3053
3077
|
graph?: {
|
|
3054
3078
|
dataSchema?: JSONSchema7;
|
|
3055
3079
|
}; /** Profile-owned editor vocabulary. The canvas itself only assumes a graph. */
|
|
3056
|
-
authoring?: ProfileAuthoringManifest;
|
|
3080
|
+
authoring?: ProfileAuthoringManifest; /** Profile-owned authored code locations and syntax-safe export fallbacks. */
|
|
3081
|
+
code?: {
|
|
3082
|
+
blocks: readonly ProfileCodeBlock[];
|
|
3083
|
+
};
|
|
3057
3084
|
operations?: Partial<Record<'simulate' | 'validate' | 'export', boolean>>;
|
|
3058
3085
|
restrictFormatsToListed?: boolean;
|
|
3059
3086
|
features?: Record<string, boolean | Record<string, unknown>>;
|
|
@@ -3072,6 +3099,10 @@ interface XStateTSOptions extends MachineConfigOptions {
|
|
|
3072
3099
|
targetLanguage?: 'typescript' | 'javascript';
|
|
3073
3100
|
xstateVersion?: 5 | 6;
|
|
3074
3101
|
xstateV6SchemaFormat?: 'types' | 'zod';
|
|
3102
|
+
/** Overrides the selected XState profile's code validation/export policy. */
|
|
3103
|
+
profile?: ProfileManifest;
|
|
3104
|
+
/** Keep authored invalid code for virtual source documents with edit slices. */
|
|
3105
|
+
recoverInvalidCode?: boolean;
|
|
3075
3106
|
}
|
|
3076
3107
|
declare function graphToXStateTS(graph: CodeGenGraph, options?: XStateTSOptions): string;
|
|
3077
3108
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
|
-
import { S as GraphPatch, _ as raw, a as RawCode, c as XStateV4TSOptions, d as getXStateFSMCompatibilityIssues, f as graphToMachineConfig, g as jsonSchemaToTSType, h as graphToXStateV4TS, l as contextSchemaToTSType, m as graphToXStateTS, n as CodeGenGraph, o as XStateFSMOptions, p as graphToXStateFSM, r as MachineConfigOptions, s as XStateTSOptions, u as eventsSchemaToTSType, v as serializeJS, y as ActionLocation } 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-
|
|
4
|
-
import { $t as createInspectionRoomUrls, B as InspectionSentEvent, D as ExportCallOptions, F as InitOptions, Gt as UploadResult, H as InspectorLoadedEvent, J as MachineVersionAutoSaveOptions, L as InspectionAction, M as INSPECTION_PROTOCOL_VERSION, N as INSPECTION_ROOM_QUERY_PARAM, O as ExportFormat, Q as ProjectEmbedMachine, Qt as createInspectionActorId, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, Zt as assertEmbedExamples, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, en as getInspectionRoomId, f as EMBED_DOCUMENT_LANGUAGES, g as EmbedDocument, in as resolveInspectorSettings, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, n as CapabilityDeniedCapability, nn as isEmbedExampleMachine, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, p as EMBED_DOCUMENT_LIMITS, pt as ProjectWorkspaceProject, r as CapabilityDeniedEvent, rn as mergeInspectorSettings, tn as isEmbedExample, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, x as EmbedExample, y as EmbedEventMap } from "./protocol-
|
|
2
|
+
import { S as GraphPatch, _ as raw, a as RawCode, c as XStateV4TSOptions, d as getXStateFSMCompatibilityIssues, f as graphToMachineConfig, g as jsonSchemaToTSType, h as graphToXStateV4TS, l as contextSchemaToTSType, m as graphToXStateTS, n as CodeGenGraph, o as XStateFSMOptions, p as graphToXStateFSM, r as MachineConfigOptions, s as XStateTSOptions, u as eventsSchemaToTSType, v as serializeJS, y as ActionLocation } from "./index-A5CMACoO.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-DVfx7FwN.mjs";
|
|
4
|
+
import { $t as createInspectionRoomUrls, B as InspectionSentEvent, D as ExportCallOptions, F as InitOptions, Gt as UploadResult, H as InspectorLoadedEvent, J as MachineVersionAutoSaveOptions, L as InspectionAction, M as INSPECTION_PROTOCOL_VERSION, N as INSPECTION_ROOM_QUERY_PARAM, O as ExportFormat, Q as ProjectEmbedMachine, Qt as createInspectionActorId, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, Zt as assertEmbedExamples, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, en as getInspectionRoomId, f as EMBED_DOCUMENT_LANGUAGES, g as EmbedDocument, in as resolveInspectorSettings, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, n as CapabilityDeniedCapability, nn as isEmbedExampleMachine, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, p as EMBED_DOCUMENT_LIMITS, pt as ProjectWorkspaceProject, r as CapabilityDeniedEvent, rn as mergeInspectorSettings, tn as isEmbedExample, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, x as EmbedExample, y as EmbedEventMap } from "./protocol-CCf9j_SZ.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-CVFc85uF.mjs";
|
|
7
|
-
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-
|
|
7
|
+
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-yGUKdLjq.mjs";
|
|
8
8
|
import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, 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-
|
|
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-
|
|
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-DBH9oOAd.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-CFN3-0-2.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 { c as createInspectionRoomUrls, d as isEmbedExampleMachine, f as mergeInspectorSettings, i as INSPECTION_ROOM_QUERY_PARAM, l as getInspectionRoomId, n as EMBED_DOCUMENT_LIMITS, o as assertEmbedExamples, p as resolveInspectorSettings, r as INSPECTION_PROTOCOL_VERSION, s as createInspectionActorId, t as EMBED_DOCUMENT_LANGUAGES, u as isEmbedExample } from "./protocol-BsBGRISR.mjs";
|
|
3
|
-
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-
|
|
3
|
+
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-CUFh-PYe.mjs";
|
|
4
4
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
|
|
5
5
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
6
|
-
import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, t as EditorHostSession } from "./editorHostSession-
|
|
6
|
+
import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, t as EditorHostSession } from "./editorHostSession-DCTHhBqC.mjs";
|
|
7
7
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-BZP6DaIO.mjs";
|
|
8
|
-
import { S as serializeJS, _ as graphToXStateV4TS, f as getXStateFSMCompatibilityIssues, g as graphToXStateTS, h as graphToXStateFSM, l as eventsSchemaToTSType, m as graphToMachineConfig, n as RawCode, o as contextSchemaToTSType, x as raw, y as jsonSchemaToTSType } from "./dist-
|
|
8
|
+
import { S as serializeJS, _ as graphToXStateV4TS, f as getXStateFSMCompatibilityIssues, g as graphToXStateTS, h as graphToXStateFSM, l as eventsSchemaToTSType, m as graphToMachineConfig, n as RawCode, o as contextSchemaToTSType, x as raw, y as jsonSchemaToTSType } from "./dist-DsOTTfYv.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-ZVDq9tK2.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,4 +1,4 @@
|
|
|
1
|
-
import { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, R as InspectionClientMetadata, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, k as ExportFormatMap, mt as ProtocolMessage, y as EmbedEventMap } from "./protocol-
|
|
1
|
+
import { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, R as InspectionClientMetadata, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, k as ExportFormatMap, mt as ProtocolMessage, y as EmbedEventMap } from "./protocol-CCf9j_SZ.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/transport.d.ts
|
|
4
4
|
interface TransportFailure {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createInspectionRoomUrls, f as mergeInspectorSettings, l as getInspectionRoomId, p as resolveInspectorSettings, r as INSPECTION_PROTOCOL_VERSION } from "./protocol-BsBGRISR.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-CUFh-PYe.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
|
@@ -252,12 +252,19 @@ function createInspector(options = {}) {
|
|
|
252
252
|
function emitLocal(event, data) {
|
|
253
253
|
const set = localListeners[event];
|
|
254
254
|
if (!set) return;
|
|
255
|
-
for (const handler of set)
|
|
255
|
+
for (const handler of set) try {
|
|
256
|
+
handler(data);
|
|
257
|
+
} catch (cause) {
|
|
258
|
+
if (event === "error") console.error("Inspector error listener failed:", cause);
|
|
259
|
+
else emitLocal("error", {
|
|
260
|
+
code: "inspection_failed",
|
|
261
|
+
message: cause instanceof Error ? cause.message : String(cause)
|
|
262
|
+
});
|
|
263
|
+
}
|
|
256
264
|
}
|
|
257
265
|
const actors = /* @__PURE__ */ new Map();
|
|
258
266
|
const resolvedSessionIds = /* @__PURE__ */ new WeakMap();
|
|
259
267
|
const actorsByResolvedSessionId = /* @__PURE__ */ new Map();
|
|
260
|
-
const runtimeRoots = /* @__PURE__ */ new WeakMap();
|
|
261
268
|
const terminatedActors = /* @__PURE__ */ new WeakSet();
|
|
262
269
|
const reboundActors = /* @__PURE__ */ new WeakSet();
|
|
263
270
|
const manualSessionIds = /* @__PURE__ */ new Map();
|
|
@@ -265,28 +272,21 @@ function createInspector(options = {}) {
|
|
|
265
272
|
const locallyRegistered = /* @__PURE__ */ new Set();
|
|
266
273
|
/** v5 emits transition facets separately; accumulate them until snapshot. */
|
|
267
274
|
const pendingTransitions = /* @__PURE__ */ new Map();
|
|
268
|
-
function
|
|
269
|
-
const known = runtimeRoots.get(actorRef);
|
|
270
|
-
if (known) return known;
|
|
271
|
-
let rootRef = parentRef ?? actorRef;
|
|
272
|
-
while (rootRef._parent) rootRef = rootRef._parent;
|
|
273
|
-
runtimeRoots.set(actorRef, rootRef);
|
|
274
|
-
return rootRef;
|
|
275
|
-
}
|
|
276
|
-
function sessionIdOf(actorRef, parentRef = actorRef._parent, runtimeRoot) {
|
|
275
|
+
function sessionIdOf(actorRef, parentRef = actorRef._parent) {
|
|
277
276
|
const existing = resolvedSessionIds.get(actorRef);
|
|
278
277
|
if (existing) return existing;
|
|
279
|
-
const parentSessionId = parentRef ? sessionIdOf(parentRef, parentRef._parent
|
|
278
|
+
const parentSessionId = parentRef ? sessionIdOf(parentRef, parentRef._parent) : null;
|
|
280
279
|
const resolved = options.resolveSessionId?.(actorRef, actorRef.sessionId, parentSessionId) ?? actorRef.sessionId;
|
|
281
280
|
if (typeof resolved !== "string" || resolved.length === 0) throw new Error("createInspector(): resolveSessionId must return a non-empty string.");
|
|
282
|
-
|
|
281
|
+
for (let ancestor = parentRef; ancestor; ancestor = ancestor._parent) if (sessionIdOf(ancestor, ancestor._parent) === resolved) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
282
|
+
assertSessionIdAvailable(actorRef, resolved);
|
|
283
283
|
return claimSessionId(actorRef, resolved);
|
|
284
284
|
}
|
|
285
|
-
function assertSessionIdAvailable(actorRef, resolved
|
|
285
|
+
function assertSessionIdAvailable(actorRef, resolved) {
|
|
286
286
|
const claimedBy = actorsByResolvedSessionId.get(resolved);
|
|
287
287
|
const claimedEntry = actors.get(resolved);
|
|
288
288
|
if (claimedBy !== void 0 && claimedBy !== actorRef) {
|
|
289
|
-
if (
|
|
289
|
+
if (!terminatedActors.has(claimedBy) && !isStoppedSnapshot(readSnapshot(claimedBy)) && sessionIdReuse !== "always") throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
290
290
|
}
|
|
291
291
|
if (claimedBy === void 0 && claimedEntry) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
292
292
|
}
|
|
@@ -310,7 +310,7 @@ function createInspector(options = {}) {
|
|
|
310
310
|
function rootSessionIdOf(runtimeRootId, actorRef) {
|
|
311
311
|
let rootRef = actorRef;
|
|
312
312
|
while (rootRef._parent) rootRef = rootRef._parent;
|
|
313
|
-
return rootRef.sessionId === runtimeRootId ? sessionIdOf(rootRef, void 0
|
|
313
|
+
return rootRef.sessionId === runtimeRootId ? sessionIdOf(rootRef, void 0) : runtimeRootId;
|
|
314
314
|
}
|
|
315
315
|
function emitRegisterOnce(entry) {
|
|
316
316
|
if (locallyRegistered.has(entry.sessionId)) return;
|
|
@@ -335,9 +335,9 @@ function createInspector(options = {}) {
|
|
|
335
335
|
function toEntry(actorRef, rootActorId, details) {
|
|
336
336
|
const parentRef = details?.parentRef ?? actorRef._parent;
|
|
337
337
|
const sessionId = sessionIdOf(actorRef, parentRef);
|
|
338
|
-
const snapshot = details?.snapshot ?? readSnapshot(actorRef);
|
|
339
|
-
const serialized = snapshot
|
|
340
|
-
if (snapshot
|
|
338
|
+
const snapshot = details?.snapshot === null ? null : details?.snapshot ?? readSnapshot(actorRef);
|
|
339
|
+
const serialized = snapshot == null ? null : serializeSnapshot(snapshot);
|
|
340
|
+
if (snapshot != null) trackTermination(actorRef, snapshot);
|
|
341
341
|
return {
|
|
342
342
|
sessionId,
|
|
343
343
|
actorId: details?.id ?? actorRef.id ?? sessionId,
|
|
@@ -364,27 +364,30 @@ function createInspector(options = {}) {
|
|
|
364
364
|
function resolveActorTreeSessionIds(rootRef) {
|
|
365
365
|
const pending = /* @__PURE__ */ new Map();
|
|
366
366
|
const owners = /* @__PURE__ */ new Map();
|
|
367
|
-
function visit(actorRef, parentRef) {
|
|
367
|
+
function visit(actorRef, parentRef, ancestorIds = /* @__PURE__ */ new Set()) {
|
|
368
368
|
const existing = resolvedSessionIds.get(actorRef);
|
|
369
369
|
const parentSessionId = parentRef ? resolvedSessionIds.get(parentRef) ?? pending.get(parentRef)?.resolved : null;
|
|
370
370
|
const resolved = existing ?? options.resolveSessionId?.(actorRef, actorRef.sessionId, parentSessionId ?? null) ?? actorRef.sessionId;
|
|
371
371
|
if (typeof resolved !== "string" || resolved.length === 0) throw new Error("createInspector(): resolveSessionId must return a non-empty string.");
|
|
372
|
+
if (ancestorIds.has(resolved)) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
372
373
|
const localOwner = owners.get(resolved);
|
|
373
|
-
if (localOwner && localOwner !== actorRef)
|
|
374
|
+
if (localOwner && localOwner !== actorRef) {
|
|
375
|
+
if (sessionIdReuse !== "always" && !isStoppedSnapshot(readSnapshot(localOwner))) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
376
|
+
}
|
|
374
377
|
owners.set(resolved, actorRef);
|
|
375
378
|
if (!existing) pending.set(actorRef, {
|
|
376
379
|
resolved,
|
|
377
380
|
parentRef
|
|
378
381
|
});
|
|
379
|
-
assertSessionIdAvailable(actorRef, resolved
|
|
382
|
+
assertSessionIdAvailable(actorRef, resolved);
|
|
380
383
|
const children = actorRef.getSnapshot()?.children ?? {};
|
|
381
|
-
|
|
384
|
+
const childAncestorIds = new Set(ancestorIds);
|
|
385
|
+
childAncestorIds.add(resolved);
|
|
386
|
+
for (const child of Object.values(children)) if (child) visit(child, actorRef, childAncestorIds);
|
|
382
387
|
}
|
|
383
388
|
visit(rootRef);
|
|
384
|
-
for (const [actorRef, { resolved }] of pending)
|
|
385
|
-
|
|
386
|
-
claimSessionId(actorRef, resolved);
|
|
387
|
-
}
|
|
389
|
+
for (const [actorRef, { resolved }] of pending) if (owners.get(resolved) === actorRef) claimSessionId(actorRef, resolved);
|
|
390
|
+
else resolvedSessionIds.set(actorRef, resolved);
|
|
388
391
|
}
|
|
389
392
|
/**
|
|
390
393
|
* Walk the actor tree and populate the local `actors` map. Idempotent —
|
|
@@ -409,6 +412,7 @@ function createInspector(options = {}) {
|
|
|
409
412
|
}
|
|
410
413
|
function backfillActorTree(actorRef, rootActorId, publish = false) {
|
|
411
414
|
const sessionId = sessionIdOf(actorRef);
|
|
415
|
+
if (!isCurrentOwner(actorRef)) return;
|
|
412
416
|
const existing = actors.get(sessionId);
|
|
413
417
|
const replaces = reboundActors.delete(actorRef);
|
|
414
418
|
const entry = !existing || replaces ? toEntry(actorRef, rootActorId) : existing;
|
|
@@ -585,14 +589,16 @@ function createInspector(options = {}) {
|
|
|
585
589
|
const isNewRoot = !observedRootIds.has(rootActorId);
|
|
586
590
|
observedRootIds.add(rootActorId);
|
|
587
591
|
switch (event.type) {
|
|
588
|
-
case "@xstate.actor":
|
|
592
|
+
case "@xstate.actor": {
|
|
593
|
+
const initialSnapshot = event.snapshot ?? readSnapshot(event.actorRef);
|
|
589
594
|
handleActor(event.actorRef, rootActorId, {
|
|
590
595
|
parentRef: event.parentRef,
|
|
591
596
|
id: event.id,
|
|
592
597
|
source: event.src,
|
|
593
|
-
snapshot:
|
|
598
|
+
snapshot: isStoppedSnapshot(initialSnapshot) ? initialSnapshot : null
|
|
594
599
|
});
|
|
595
600
|
break;
|
|
601
|
+
}
|
|
596
602
|
case "@xstate.event": {
|
|
597
603
|
const sessionId = sessionIdOf(event.actorRef);
|
|
598
604
|
if (!actors.has(sessionId)) handleActor(event.actorRef, rootActorId);
|
|
@@ -626,6 +632,16 @@ function createInspector(options = {}) {
|
|
|
626
632
|
}
|
|
627
633
|
if (isNewRoot && !initSent) sendInit();
|
|
628
634
|
}
|
|
635
|
+
function safelyHandleInspectionEvent(event) {
|
|
636
|
+
try {
|
|
637
|
+
handleInspectionEvent(event);
|
|
638
|
+
} catch (cause) {
|
|
639
|
+
emitLocal("error", {
|
|
640
|
+
code: "inspection_failed",
|
|
641
|
+
message: cause instanceof Error ? cause.message : String(cause)
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
}
|
|
629
645
|
function attachActor(actor) {
|
|
630
646
|
const root = actor;
|
|
631
647
|
resolveActorTreeSessionIds(root);
|
|
@@ -638,7 +654,7 @@ function createInspector(options = {}) {
|
|
|
638
654
|
}
|
|
639
655
|
materializePendingInit();
|
|
640
656
|
observedRootIds.add(rootActorId);
|
|
641
|
-
const subscription = root.system.inspect(
|
|
657
|
+
const subscription = root.system.inspect(safelyHandleInspectionEvent);
|
|
642
658
|
inspectedRoots.set(rootActorId, {
|
|
643
659
|
actor: root,
|
|
644
660
|
subscription
|
|
@@ -764,7 +780,7 @@ function createInspector(options = {}) {
|
|
|
764
780
|
},
|
|
765
781
|
inspectorUrl,
|
|
766
782
|
ready,
|
|
767
|
-
inspect:
|
|
783
|
+
inspect: safelyHandleInspectionEvent,
|
|
768
784
|
attach: attachActor,
|
|
769
785
|
on(event, handler) {
|
|
770
786
|
if (!localListeners[event]) localListeners[event] = /* @__PURE__ */ new Set();
|
package/dist/inspect.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, an as EmbedPanelConfig, b as EmbedEventName, g as EmbedDocument, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-
|
|
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 { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, an as EmbedPanelConfig, b as EmbedEventName, g as EmbedDocument, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-CCf9j_SZ.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-DBH9oOAd.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,5 @@
|
|
|
1
1
|
import "./protocol-BsBGRISR.mjs";
|
|
2
|
-
import "./version-
|
|
3
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
2
|
+
import "./version-CUFh-PYe.mjs";
|
|
3
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-ZVDq9tK2.mjs";
|
|
4
4
|
|
|
5
5
|
export { createInspector, createStatelyInspector };
|
package/dist/patchTypes.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-
|
|
1
|
+
import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-A5CMACoO.mjs";
|
|
2
2
|
export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
|
|
@@ -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-A5CMACoO.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-DVfx7FwN.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-D7YYz6fb.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/embedPanel.d.ts
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ProjectInitMessage, $t as createInspectionRoomUrls, A as ExtensionCallMessage, At as StateSourceLocation, B as InspectionSentEvent, Bt as UpdateMessage, C as EmbedFormatManifest, Ct as SessionMessage, D as ExportCallOptions, Dt as SetThemeMessage, E as ErrorMessage, Et as SetSettingsMessage, F as InitOptions, Ft as SystemInitMessage, G as MachineInitOptions, Gt as UploadResult, H as InspectorLoadedEvent, Ht as UploadFileInfo, I as InspectSnapshotMessage, It as SystemLoadedMessage, J as MachineVersionAutoSaveOptions, Jt as ViewModeChangedMessage, K as MachinePayload, Kt as ValidationIssue, L as InspectionAction, Lt as SystemSelectActorMessage, M as INSPECTION_PROTOCOL_VERSION, Mt as SystemActorRegisteredMessage, N as INSPECTION_ROOM_QUERY_PARAM, Nt as SystemActorSnapshotMessage, O as ExportFormat, Ot as SourceLocation, P as InitMessage, Pt as SystemActorStoppedMessage, Q as ProjectEmbedMachine, Qt as createInspectionActorId, R as InspectionClientMetadata, Rt as ToastDismissMessage, S as EmbedExtensionsManifest, St as SavedMessage, T as ErrorCode, Tt as SetModeMessage, U as InspectorSettings, Ut as UploadRequestMessage, V as InspectionTakenTransition, Vt as UploadCapabilitiesMessage, W as LoadedMessage, Wt as UploadResponseMessage, X as PREFIX, Xt as VizMessage, Y as ModeChangedMessage, Yt as ViewerOptions, Z as PanelChangedMessage, Zt as assertEmbedExamples, _ as EmbedDocumentLanguage, _t as RegisterMessage, a as ChangeMessage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, bt as RetrievedMessage, c as ClipboardReadResponseMessage, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, en as getInspectionRoomId, et as ProjectInitOptions, f as EMBED_DOCUMENT_LANGUAGES, ft as ProjectWorkspaceOpenChangedMessage, g as EmbedDocument, gt as ReadyMessage, h as EditorHandshakeMessage, ht as ReadOnlyReason, i as CapabilityDeniedMessage, in as resolveInspectorSettings, it as ProjectUpdateMessage, j as ExtensionResultMessage, jt as SystemActorEventMessage, k as ExportFormatMap, kt as SourceRange, l as ClipboardWriteMessage, lt as ProjectWorkspaceConfig, m as EditorCapabilities, mt as ProtocolMessage, n as CapabilityDeniedCapability, nn as isEmbedExampleMachine, nt as ProjectSelectMachineMessage, o as ClientMessage, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, p as EMBED_DOCUMENT_LIMITS, pt as ProjectWorkspaceProject, q as MachineSourceLocations, qt as VersionSaveRequestedMessage, r as CapabilityDeniedEvent, rn as mergeInspectorSettings, rt as ProjectSetWorkspaceOpenMessage, s as ClipboardReadMessage, st as ProjectWorkspaceActionMessage, t as ActorSystemEntry, tn as isEmbedExample, tt as ProjectMachineSelectedMessage, u as ClipboardWriteResponseMessage, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, vt as RegisteredMessage, w as EmbedMode, wt as SetApiKeyMessage, x as EmbedExample, xt as SaveMessage, y as EmbedEventMap, yt as RetrieveMessage, z as InspectionRoomUrls, zt as ToastMessage } from "./protocol-
|
|
1
|
+
import { $ as ProjectInitMessage, $t as createInspectionRoomUrls, A as ExtensionCallMessage, At as StateSourceLocation, B as InspectionSentEvent, Bt as UpdateMessage, C as EmbedFormatManifest, Ct as SessionMessage, D as ExportCallOptions, Dt as SetThemeMessage, E as ErrorMessage, Et as SetSettingsMessage, F as InitOptions, Ft as SystemInitMessage, G as MachineInitOptions, Gt as UploadResult, H as InspectorLoadedEvent, Ht as UploadFileInfo, I as InspectSnapshotMessage, It as SystemLoadedMessage, J as MachineVersionAutoSaveOptions, Jt as ViewModeChangedMessage, K as MachinePayload, Kt as ValidationIssue, L as InspectionAction, Lt as SystemSelectActorMessage, M as INSPECTION_PROTOCOL_VERSION, Mt as SystemActorRegisteredMessage, N as INSPECTION_ROOM_QUERY_PARAM, Nt as SystemActorSnapshotMessage, O as ExportFormat, Ot as SourceLocation, P as InitMessage, Pt as SystemActorStoppedMessage, Q as ProjectEmbedMachine, Qt as createInspectionActorId, R as InspectionClientMetadata, Rt as ToastDismissMessage, S as EmbedExtensionsManifest, St as SavedMessage, T as ErrorCode, Tt as SetModeMessage, U as InspectorSettings, Ut as UploadRequestMessage, V as InspectionTakenTransition, Vt as UploadCapabilitiesMessage, W as LoadedMessage, Wt as UploadResponseMessage, X as PREFIX, Xt as VizMessage, Y as ModeChangedMessage, Yt as ViewerOptions, Z as PanelChangedMessage, Zt as assertEmbedExamples, _ as EmbedDocumentLanguage, _t as RegisterMessage, a as ChangeMessage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, bt as RetrievedMessage, c as ClipboardReadResponseMessage, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, en as getInspectionRoomId, et as ProjectInitOptions, f as EMBED_DOCUMENT_LANGUAGES, ft as ProjectWorkspaceOpenChangedMessage, g as EmbedDocument, gt as ReadyMessage, h as EditorHandshakeMessage, ht as ReadOnlyReason, i as CapabilityDeniedMessage, in as resolveInspectorSettings, it as ProjectUpdateMessage, j as ExtensionResultMessage, jt as SystemActorEventMessage, k as ExportFormatMap, kt as SourceRange, l as ClipboardWriteMessage, lt as ProjectWorkspaceConfig, m as EditorCapabilities, mt as ProtocolMessage, n as CapabilityDeniedCapability, nn as isEmbedExampleMachine, nt as ProjectSelectMachineMessage, o as ClientMessage, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, p as EMBED_DOCUMENT_LIMITS, pt as ProjectWorkspaceProject, q as MachineSourceLocations, qt as VersionSaveRequestedMessage, r as CapabilityDeniedEvent, rn as mergeInspectorSettings, rt as ProjectSetWorkspaceOpenMessage, s as ClipboardReadMessage, st as ProjectWorkspaceActionMessage, t as ActorSystemEntry, tn as isEmbedExample, tt as ProjectMachineSelectedMessage, u as ClipboardWriteResponseMessage, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, vt as RegisteredMessage, w as EmbedMode, wt as SetApiKeyMessage, x as EmbedExample, xt as SaveMessage, y as EmbedEventMap, yt as RetrieveMessage, z as InspectionRoomUrls, zt as ToastMessage } from "./protocol-CCf9j_SZ.mjs";
|
|
2
2
|
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExample, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, EmbedPanelConfig, EmbedPanelPosition, ErrorCode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, InspectorLoadedEvent, InspectorSettings, LoadedMessage, 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, 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, mergeInspectorSettings, resolveInspectorSettings };
|
package/dist/relay.d.mts
CHANGED
package/dist/relay.mjs
CHANGED
|
@@ -64,6 +64,41 @@ function errorMessage(code, message) {
|
|
|
64
64
|
function compactReplay(replay, message, max) {
|
|
65
65
|
const record = message;
|
|
66
66
|
const type = record.type;
|
|
67
|
+
const checkpoint = type === "@statelyai.system.actorRegistered" || type === "@statelyai.system.actorSnapshot" || type === "@statelyai.system.actorStopped" ? replay.find((entry) => entry.type === "@statelyai.system.init") : void 0;
|
|
68
|
+
if (checkpoint && typeof record.sessionId === "string") {
|
|
69
|
+
const actorIndex = checkpoint.actors.findIndex((actor) => actor.sessionId === record.sessionId);
|
|
70
|
+
if (type === "@statelyai.system.actorRegistered") {
|
|
71
|
+
const nextActor = {
|
|
72
|
+
sessionId: record.sessionId,
|
|
73
|
+
actorId: record.actorId,
|
|
74
|
+
...typeof record.displayName === "string" && { displayName: record.displayName },
|
|
75
|
+
parentSessionId: record.parentSessionId,
|
|
76
|
+
machine: record.machine,
|
|
77
|
+
snapshot: record.snapshot
|
|
78
|
+
};
|
|
79
|
+
if (actorIndex >= 0) checkpoint.actors[actorIndex] = nextActor;
|
|
80
|
+
else checkpoint.actors.push(nextActor);
|
|
81
|
+
for (let index = replay.length - 1; index >= 0; index--) {
|
|
82
|
+
const previous = replay[index];
|
|
83
|
+
if (previous.sessionId === record.sessionId && typeof previous.type === "string" && previous.type.startsWith("@statelyai.system.actor")) replay.splice(index, 1);
|
|
84
|
+
}
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const actor = checkpoint.actors[actorIndex];
|
|
88
|
+
if (actor) {
|
|
89
|
+
if (type === "@statelyai.system.actorSnapshot") checkpoint.actors[actorIndex] = {
|
|
90
|
+
...actor,
|
|
91
|
+
snapshot: record.snapshot
|
|
92
|
+
};
|
|
93
|
+
else if (type === "@statelyai.system.actorStopped") {
|
|
94
|
+
checkpoint.actors[actorIndex] = {
|
|
95
|
+
...actor,
|
|
96
|
+
stopped: true
|
|
97
|
+
};
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
67
102
|
if (type === "@statelyai.setSettings" || type === "@statelyai.system.selectActor") {
|
|
68
103
|
const index = replay.findIndex((entry) => entry.type === "@statelyai.system.init");
|
|
69
104
|
const init = replay[index];
|
|
@@ -97,7 +132,11 @@ function compactReplay(replay, message, max) {
|
|
|
97
132
|
if (index >= 0) replay.splice(index, 1);
|
|
98
133
|
}
|
|
99
134
|
replay.push(message);
|
|
100
|
-
|
|
135
|
+
while (replay.length > max) {
|
|
136
|
+
const oldestDelta = replay.findIndex((entry) => entry.type !== "@statelyai.system.init" && entry.type !== "@statelyai.init");
|
|
137
|
+
if (oldestDelta < 0) break;
|
|
138
|
+
replay.splice(oldestDelta, 1);
|
|
139
|
+
}
|
|
101
140
|
}
|
|
102
141
|
/**
|
|
103
142
|
* Runtime-neutral implementation of one inspection room.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ZodObject, D as ZodLiteral, E as ZodEnum, F as ZodUnknown, I as output, L as $loose, M as ZodRecord, N as ZodString, O as ZodNullable, P as ZodUnion, R as $strip, T as ZodBoolean, j as ZodOptional, k as ZodNumber, w as ZodArray } from "./index-
|
|
1
|
+
import { A as ZodObject, D as ZodLiteral, E as ZodEnum, F as ZodUnknown, I as output, L as $loose, M as ZodRecord, N as ZodString, O as ZodNullable, P as ZodUnion, R as $strip, T as ZodBoolean, j as ZodOptional, k as ZodNumber, w as ZodArray } from "./index-A5CMACoO.mjs";
|
|
2
2
|
import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-CVFc85uF.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-CFN3-0-2.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-DVfx7FwN.mjs";
|
|
2
|
+
import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-CFN3-0-2.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-BZP6DaIO.mjs";
|
|
3
|
-
import { C as toXStateV6MachineConfig, S as serializeJS, a as alignCompareGraphIds, b as normalizeMachineProfile, c as diffGraphsSemantically, d as getDelayKeyFromEventType, g as graphToXStateTS, i as XSTATE_V6_FN_TRANSITION_META, m as graphToMachineConfig, p as graphChangeToPatchesResult, r as XSTATE_V6_BRANCH_DESCRIPTION_META, s as detectXStateSourceProfile, t as INLINE_EXPRESSION_DIRECTIVE_FIELDS, u as extractXStateMachineConfigEntries, v as isCodeExpression } from "./dist-
|
|
3
|
+
import { C as toXStateV6MachineConfig, S as serializeJS, a as alignCompareGraphIds, b as normalizeMachineProfile, c as diffGraphsSemantically, d as getDelayKeyFromEventType, g as graphToXStateTS, i as XSTATE_V6_FN_TRANSITION_META, m as graphToMachineConfig, p as graphChangeToPatchesResult, r as XSTATE_V6_BRANCH_DESCRIPTION_META, s as detectXStateSourceProfile, t as INLINE_EXPRESSION_DIRECTIVE_FIELDS, u as extractXStateMachineConfigEntries, v as isCodeExpression } from "./dist-DsOTTfYv.mjs";
|
|
4
4
|
import { n as getStatelyPragma, r as upsertStatelyPragma, t as findStatelyPragmaAttachments } from "./statelyPragma-YtVaBuIe.mjs";
|
|
5
5
|
import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
|
|
6
6
|
import * as ts$1 from "typescript";
|
|
@@ -378,7 +378,7 @@ function createWebSocketTransport(options) {
|
|
|
378
378
|
|
|
379
379
|
//#endregion
|
|
380
380
|
//#region src/version.ts
|
|
381
|
-
const SDK_VERSION = "0.34.
|
|
381
|
+
const SDK_VERSION = "0.34.2";
|
|
382
382
|
function inspectionRuntime() {
|
|
383
383
|
if (typeof window !== "undefined") return "browser";
|
|
384
384
|
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.34.
|
|
3
|
+
"version": "0.34.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stately-sdk": "./dist/bin.mjs"
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@statelyai/graph": "^2.1.0",
|
|
85
|
-
"esbuild": "^0.27.0",
|
|
86
85
|
"typescript": "^5.9.3",
|
|
87
86
|
"ws": "^8.19.0",
|
|
88
87
|
"xstate": "^5.0.0"
|
|
@@ -93,8 +92,9 @@
|
|
|
93
92
|
"jsdom": "^27.4.0",
|
|
94
93
|
"tsdown": "0.21.0-beta.2",
|
|
95
94
|
"vitest": "^3.2.4",
|
|
96
|
-
"
|
|
97
|
-
"@statelyai/
|
|
95
|
+
"xstate-v6": "npm:xstate@6.0.0-alpha.51",
|
|
96
|
+
"@statelyai/api-contract": "0.5.2",
|
|
97
|
+
"@statelyai/graph-tools": "0.9.0"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.4"
|