@statelyai/sdk 0.10.0 → 0.10.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 +97 -13
- package/dist/{graph-DmXh22Zu.d.mts → graph-GeuH-mFK.d.mts} +13 -2
- package/dist/graph.d.mts +1 -1
- package/dist/graphToXStateTS-DOaLOySy.mjs +5486 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.mjs +1 -1
- package/dist/protocol.d.mts +11 -0
- package/dist/studio.mjs +20 -2
- package/dist/sync.d.mts +1 -1
- package/dist/sync.mjs +3225 -30
- package/package.json +2 -2
- package/schemas/statelyai.schema.json +2 -2
- package/dist/graphToXStateTS-moihsH_U.mjs +0 -710
|
@@ -1,710 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
//#region src/statelyPragma.ts
|
|
4
|
-
function findStatelyPragmaAttachments(sourceText, fileName = "machine.ts") {
|
|
5
|
-
const sourceFile = ts.createSourceFile(fileName, sourceText, ts.ScriptTarget.Latest, true, getScriptKind(fileName));
|
|
6
|
-
const attachments = [];
|
|
7
|
-
const visit = (node) => {
|
|
8
|
-
if (ts.isCallExpression(node) && isCreateMachineExpression(node.expression)) {
|
|
9
|
-
const attachNode = findAttachNode(node);
|
|
10
|
-
if (attachNode) attachments.push({
|
|
11
|
-
machineStart: getMachineExpressionStart(node.expression, sourceFile),
|
|
12
|
-
attachStart: attachNode.getStart(sourceFile),
|
|
13
|
-
pragma: findAttachedStatelyPragma(sourceText, attachNode)
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
ts.forEachChild(node, visit);
|
|
17
|
-
};
|
|
18
|
-
visit(sourceFile);
|
|
19
|
-
return attachments;
|
|
20
|
-
}
|
|
21
|
-
function getStatelyPragma(sourceText, fileName = "machine.ts", machineIndex = 0) {
|
|
22
|
-
return findStatelyPragmaAttachments(sourceText, fileName)[machineIndex]?.pragma;
|
|
23
|
-
}
|
|
24
|
-
function upsertStatelyPragma(sourceText, id, options = {}) {
|
|
25
|
-
const attachment = findStatelyPragmaAttachments(sourceText, options.fileName ?? "machine.ts")[options.machineIndex ?? 0];
|
|
26
|
-
if (!attachment) return sourceText;
|
|
27
|
-
const lineEnding = options.lineEnding ?? detectLineEnding(sourceText);
|
|
28
|
-
const canonicalComment = `// @statelyai id=${id}`;
|
|
29
|
-
if (attachment.pragma) return sourceText.slice(0, attachment.pragma.start) + canonicalComment + sourceText.slice(attachment.pragma.end);
|
|
30
|
-
const insertText = `${getIndentationAtOffset(sourceText, attachment.attachStart)}${canonicalComment}${lineEnding}`;
|
|
31
|
-
return sourceText.slice(0, attachment.attachStart) + insertText + sourceText.slice(attachment.attachStart);
|
|
32
|
-
}
|
|
33
|
-
function findAttachedStatelyPragma(sourceText, node) {
|
|
34
|
-
const comments = ts.getLeadingCommentRanges(sourceText, node.getFullStart()) ?? [];
|
|
35
|
-
for (let index = comments.length - 1; index >= 0; index -= 1) {
|
|
36
|
-
const comment = comments[index];
|
|
37
|
-
const parsed = parseStatelyPragma(sourceText, comment.pos, comment.end);
|
|
38
|
-
if (parsed) return parsed;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function parseStatelyPragma(sourceText, start, end) {
|
|
42
|
-
const match = normalizeCommentContent(sourceText.slice(start, end)).match(/^@statelyai(?:\s+(.*))?$/s);
|
|
43
|
-
if (!match) return;
|
|
44
|
-
const fields = parseFields(match[1] ?? "");
|
|
45
|
-
return {
|
|
46
|
-
tag: "@statelyai",
|
|
47
|
-
id: fields.id,
|
|
48
|
-
fields,
|
|
49
|
-
start,
|
|
50
|
-
end
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function normalizeCommentContent(rawComment) {
|
|
54
|
-
if (rawComment.startsWith("//")) return rawComment.slice(2).trim();
|
|
55
|
-
if (rawComment.startsWith("/*")) return rawComment.slice(2, rawComment.endsWith("*/") ? -2 : void 0).split(/\r?\n/).map((line) => line.replace(/^\s*\*\s?/, "")).join(" ").trim();
|
|
56
|
-
return rawComment.trim();
|
|
57
|
-
}
|
|
58
|
-
function parseFields(input) {
|
|
59
|
-
const fields = {};
|
|
60
|
-
for (const token of input.split(/\s+/)) {
|
|
61
|
-
if (!token) continue;
|
|
62
|
-
const equalsIndex = token.indexOf("=");
|
|
63
|
-
if (equalsIndex <= 0) continue;
|
|
64
|
-
const key = token.slice(0, equalsIndex);
|
|
65
|
-
const value = token.slice(equalsIndex + 1);
|
|
66
|
-
if (!key || !value) continue;
|
|
67
|
-
fields[key] = value;
|
|
68
|
-
}
|
|
69
|
-
return fields;
|
|
70
|
-
}
|
|
71
|
-
function findAttachNode(node) {
|
|
72
|
-
let current = node;
|
|
73
|
-
while (current?.parent) {
|
|
74
|
-
if (ts.isVariableStatement(current.parent) || ts.isExpressionStatement(current.parent) || ts.isExportAssignment(current.parent)) return current.parent;
|
|
75
|
-
current = current.parent;
|
|
76
|
-
}
|
|
77
|
-
return current;
|
|
78
|
-
}
|
|
79
|
-
function isCreateMachineExpression(expression) {
|
|
80
|
-
return ts.isIdentifier(expression) && expression.text === "createMachine" || ts.isPropertyAccessExpression(expression) && expression.name.text === "createMachine";
|
|
81
|
-
}
|
|
82
|
-
function getMachineExpressionStart(expression, sourceFile) {
|
|
83
|
-
if (ts.isPropertyAccessExpression(expression)) return expression.name.getStart(sourceFile);
|
|
84
|
-
return expression.getStart(sourceFile);
|
|
85
|
-
}
|
|
86
|
-
function getIndentationAtOffset(sourceText, offset) {
|
|
87
|
-
const lineStart = sourceText.lastIndexOf("\n", Math.max(0, offset - 1)) + 1;
|
|
88
|
-
return sourceText.slice(lineStart, offset).match(/^[ \t]*/)?.[0] ?? "";
|
|
89
|
-
}
|
|
90
|
-
function detectLineEnding(sourceText) {
|
|
91
|
-
return sourceText.includes("\r\n") ? "\r\n" : "\n";
|
|
92
|
-
}
|
|
93
|
-
function getScriptKind(fileName) {
|
|
94
|
-
if (fileName.endsWith(".tsx")) return ts.ScriptKind.TSX;
|
|
95
|
-
if (fileName.endsWith(".jsx")) return ts.ScriptKind.JSX;
|
|
96
|
-
if (fileName.endsWith(".js")) return ts.ScriptKind.JS;
|
|
97
|
-
return ts.ScriptKind.TS;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region ../graph-tools/src/serializeJS.ts
|
|
102
|
-
/**
|
|
103
|
-
* Serializes JavaScript values as JS source code (not JSON).
|
|
104
|
-
* - Unquoted keys for valid identifiers
|
|
105
|
-
* - Single-quoted strings
|
|
106
|
-
* - Omits undefined values
|
|
107
|
-
* - Supports RawCode for verbatim expressions
|
|
108
|
-
* - Supports inline expression directives for verbatim expressions
|
|
109
|
-
*/
|
|
110
|
-
const VALID_IDENT = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
111
|
-
var RawCode = class {
|
|
112
|
-
constructor(code) {
|
|
113
|
-
this.code = code;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
function raw(code) {
|
|
117
|
-
return new RawCode(code);
|
|
118
|
-
}
|
|
119
|
-
function serializeJS(value, indent = 0, step = 2) {
|
|
120
|
-
if (value instanceof RawCode) return value.code;
|
|
121
|
-
if (isInlineExpressionDirective(value)) return value.expr;
|
|
122
|
-
if (value === void 0) return "undefined";
|
|
123
|
-
if (value === null) return "null";
|
|
124
|
-
if (typeof value === "string") return `'${escapeString(value)}'`;
|
|
125
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
126
|
-
if (Array.isArray(value)) return serializeArray(value, indent, step);
|
|
127
|
-
if (typeof value === "object") return serializeObject(value, indent, step);
|
|
128
|
-
return String(value);
|
|
129
|
-
}
|
|
130
|
-
function escapeString(s) {
|
|
131
|
-
return s.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
132
|
-
}
|
|
133
|
-
function serializeArray(arr, indent, step) {
|
|
134
|
-
const filtered = arr.filter((v) => v !== void 0);
|
|
135
|
-
if (filtered.length === 0) return "[]";
|
|
136
|
-
const inner = indent + step;
|
|
137
|
-
const pad = " ".repeat(inner);
|
|
138
|
-
const closePad = " ".repeat(indent);
|
|
139
|
-
return `[\n${filtered.map((v) => `${pad}${serializeJS(v, inner, step)}`).join(",\n")},\n${closePad}]`;
|
|
140
|
-
}
|
|
141
|
-
function serializeObject(obj, indent, step) {
|
|
142
|
-
const entries = Object.entries(obj).filter(([, v]) => v !== void 0);
|
|
143
|
-
if (entries.length === 0) return "{}";
|
|
144
|
-
const inner = indent + step;
|
|
145
|
-
const pad = " ".repeat(inner);
|
|
146
|
-
const closePad = " ".repeat(indent);
|
|
147
|
-
return `{\n${entries.map(([key, val]) => {
|
|
148
|
-
const k = VALID_IDENT.test(key) ? key : `'${escapeString(key)}'`;
|
|
149
|
-
const serialized = serializeJS(val, inner, step);
|
|
150
|
-
if (isRawExpression(val) && serialized.includes("\n")) return `${pad}${k}: ${indentRawCode(serialized, inner)}`;
|
|
151
|
-
return `${pad}${k}: ${serialized}`;
|
|
152
|
-
}).join(",\n")},\n${closePad}}`;
|
|
153
|
-
}
|
|
154
|
-
function isRawExpression(value) {
|
|
155
|
-
return value instanceof RawCode || isInlineExpressionDirective(value);
|
|
156
|
-
}
|
|
157
|
-
function isInlineExpressionDirective(value) {
|
|
158
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
159
|
-
const directive = value;
|
|
160
|
-
return directive["@type"] === "code" && typeof directive.expr === "string";
|
|
161
|
-
}
|
|
162
|
-
function indentRawCode(code, indent) {
|
|
163
|
-
const lines = code.split("\n");
|
|
164
|
-
if (lines.length <= 1) return code;
|
|
165
|
-
const pad = " ".repeat(indent);
|
|
166
|
-
return [lines[0], ...lines.slice(1).map((line) => line.trim() === "" ? "" : `${pad}${line}`)].join("\n");
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region ../graph-tools/src/textUtils.ts
|
|
171
|
-
/**
|
|
172
|
-
* Strips `export default` wrapper from an expression string.
|
|
173
|
-
* E.g. `"export default assign({ ... })"` → `"assign({ ... })"`
|
|
174
|
-
*/
|
|
175
|
-
function stripExportDefault$1(code) {
|
|
176
|
-
const trimmed = code.trim();
|
|
177
|
-
if (trimmed.startsWith("export default ")) return trimmed.slice(15).replace(/;$/, "");
|
|
178
|
-
return trimmed;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region ../graph-tools/src/graphToMachineConfig.ts
|
|
183
|
-
function isAutoGeneratedId(id) {
|
|
184
|
-
return !!id && id.startsWith("$auto-");
|
|
185
|
-
}
|
|
186
|
-
function getSerializedNodeId(node) {
|
|
187
|
-
return node.data.nodeId ?? void 0;
|
|
188
|
-
}
|
|
189
|
-
function getDefaultNodeId(graph, node) {
|
|
190
|
-
if (!node.parentId) return "(machine)";
|
|
191
|
-
const parentNode = graph.nodes.find((candidate) => candidate.id === node.parentId);
|
|
192
|
-
if (!parentNode) return `${node.parentId}.${node.data.key}`;
|
|
193
|
-
return `${getSerializedNodeId(parentNode) ?? getDefaultNodeId(graph, parentNode)}.${node.data.key}`;
|
|
194
|
-
}
|
|
195
|
-
/** Unwrap single-element arrays to a single value (XState single-or-array convention) */
|
|
196
|
-
function singleOrArray(arr) {
|
|
197
|
-
return arr.length === 1 ? arr[0] : arr;
|
|
198
|
-
}
|
|
199
|
-
/** Unwrap each value in a record of arrays */
|
|
200
|
-
function singleOrArrayRecord(record) {
|
|
201
|
-
const result = {};
|
|
202
|
-
for (const [key, arr] of Object.entries(record)) result[key] = singleOrArray(arr);
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Remove empty arrays/objects/strings, unwrap single-element arrays.
|
|
207
|
-
* Matches studio's simplifyAttributes behavior.
|
|
208
|
-
*/
|
|
209
|
-
function simplifyAttributes(obj) {
|
|
210
|
-
for (const key of Object.keys(obj)) {
|
|
211
|
-
const value = obj[key];
|
|
212
|
-
if (value === void 0 || value === null) delete obj[key];
|
|
213
|
-
else if (Array.isArray(value)) {
|
|
214
|
-
if (value.length === 0) delete obj[key];
|
|
215
|
-
else if (value.length === 1) obj[key] = value[0];
|
|
216
|
-
} else if (typeof value === "object" && Object.keys(value).length === 0) delete obj[key];
|
|
217
|
-
else if (typeof value === "string" && value === "") delete obj[key];
|
|
218
|
-
}
|
|
219
|
-
return obj;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Recursively apply simplifyAttributes to a config tree.
|
|
223
|
-
* Cleans up the config and all nested state nodes, transitions, and invokes.
|
|
224
|
-
*/
|
|
225
|
-
function deepSimplify(config) {
|
|
226
|
-
for (const mapKey of ["on", "after"]) {
|
|
227
|
-
const map = config[mapKey];
|
|
228
|
-
if (map && typeof map === "object" && !Array.isArray(map)) {
|
|
229
|
-
for (const [, val] of Object.entries(map)) if (val && typeof val === "object" && !Array.isArray(val)) simplifyAttributes(val);
|
|
230
|
-
else if (Array.isArray(val)) {
|
|
231
|
-
for (const item of val) if (item && typeof item === "object") simplifyAttributes(item);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
for (const key of ["always", "onDone"]) {
|
|
236
|
-
const val = config[key];
|
|
237
|
-
if (val && typeof val === "object" && !Array.isArray(val)) simplifyAttributes(val);
|
|
238
|
-
else if (Array.isArray(val)) {
|
|
239
|
-
for (const item of val) if (item && typeof item === "object") simplifyAttributes(item);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
const invoke = config.invoke;
|
|
243
|
-
if (invoke && typeof invoke === "object" && !Array.isArray(invoke)) simplifyAttributes(invoke);
|
|
244
|
-
else if (Array.isArray(invoke)) {
|
|
245
|
-
for (const item of invoke) if (item && typeof item === "object") simplifyAttributes(item);
|
|
246
|
-
}
|
|
247
|
-
simplifyAttributes(config);
|
|
248
|
-
if (config.states && typeof config.states === "object") for (const stateConfig of Object.values(config.states)) deepSimplify(stateConfig);
|
|
249
|
-
return config;
|
|
250
|
-
}
|
|
251
|
-
function buildMeta(meta, color) {
|
|
252
|
-
const result = {};
|
|
253
|
-
if (meta) {
|
|
254
|
-
for (const [k, v] of Object.entries(meta)) if (v !== void 0 && v !== null) result[k] = v;
|
|
255
|
-
}
|
|
256
|
-
if (color) result["@statelyai.color"] = color;
|
|
257
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
258
|
-
}
|
|
259
|
-
/** Format event param — supports { type: string } (new) and plain string (legacy) */
|
|
260
|
-
function formatEventParam(event) {
|
|
261
|
-
if (event && typeof event === "object" && "type" in event) return `{ type: '${event.type}' }`;
|
|
262
|
-
if (typeof event === "string") return `{ type: '${event}' }`;
|
|
263
|
-
return "{ type: \"unknown\" }";
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Converts a built-in xstate ActionItem to a raw function call expression,
|
|
267
|
-
* or returns a plain { type, params } object for user-defined actions.
|
|
268
|
-
*/
|
|
269
|
-
function serializeActionItem(action) {
|
|
270
|
-
const { type, params } = action;
|
|
271
|
-
const exprCode = type === "xstate.expr" && typeof params?.code === "string" ? params.code : void 0;
|
|
272
|
-
switch (type) {
|
|
273
|
-
case "xstate.raise": {
|
|
274
|
-
const eventStr = formatEventParam(params?.event);
|
|
275
|
-
const opts = [];
|
|
276
|
-
if (params?.id) opts.push(`id: '${params.id}'`);
|
|
277
|
-
if (params?.delay != null) opts.push(`delay: ${JSON.stringify(params.delay)}`);
|
|
278
|
-
return raw(`raise(${eventStr}${opts.length > 0 ? `, { ${opts.join(", ")} }` : ""})`);
|
|
279
|
-
}
|
|
280
|
-
case "xstate.sendTo": {
|
|
281
|
-
const to = params?.to ? `'${params.to}'` : `'unknown'`;
|
|
282
|
-
const eventStr = formatEventParam(params?.event);
|
|
283
|
-
const opts = [];
|
|
284
|
-
if (params?.id) opts.push(`id: '${params.id}'`);
|
|
285
|
-
if (params?.delay != null) opts.push(`delay: ${JSON.stringify(params.delay)}`);
|
|
286
|
-
return raw(`sendTo(${to}, ${eventStr}${opts.length > 0 ? `, { ${opts.join(", ")} }` : ""})`);
|
|
287
|
-
}
|
|
288
|
-
case "xstate.cancel": return raw(`cancel(${params?.sendId ? `'${params.sendId}'` : `'unknown'`})`);
|
|
289
|
-
case "xstate.emit": return raw(`emit(${formatEventParam(params?.event)})`);
|
|
290
|
-
case "xstate.spawnChild": {
|
|
291
|
-
const src = params?.src ? `'${params.src}'` : `'unknown'`;
|
|
292
|
-
const opts = [];
|
|
293
|
-
if (params?.id) opts.push(`id: '${params.id}'`);
|
|
294
|
-
if (params?.systemId) opts.push(`systemId: '${params.systemId}'`);
|
|
295
|
-
return raw(`spawnChild(${src}${opts.length > 0 ? `, { ${opts.join(", ")} }` : ""})`);
|
|
296
|
-
}
|
|
297
|
-
case "xstate.stopChild": return raw(`stopChild(${params?.actorRef ? `'${params.actorRef}'` : `'unknown'`})`);
|
|
298
|
-
case "xstate.log": return raw(`log(${(params?.label ? `'${params.label}'` : void 0) ?? ""})`);
|
|
299
|
-
case "xstate.assign": {
|
|
300
|
-
const assignments = params?.assignment && typeof params.assignment === "object" && !Array.isArray(params.assignment) ? params.assignment : params;
|
|
301
|
-
const entries = Object.entries(assignments ?? {}).filter(([k, v]) => k && v !== void 0);
|
|
302
|
-
if (entries.length === 0) return raw(`assign({ /* ... */ })`);
|
|
303
|
-
return raw(`assign({ ${entries.map(([k, v]) => `${JSON.stringify(k)}: ${formatAssignValue(v)}`).join(", ")} })`);
|
|
304
|
-
}
|
|
305
|
-
default:
|
|
306
|
-
if (exprCode) return raw(stripExportDefault$1(exprCode));
|
|
307
|
-
if (!params || Object.keys(params).length === 0) return { type };
|
|
308
|
-
return {
|
|
309
|
-
type,
|
|
310
|
-
params
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function formatAssignValue(value) {
|
|
315
|
-
if (typeof value !== "string") return JSON.stringify(value);
|
|
316
|
-
const templateExpression = value.match(/^\{\{([\s\S]*)\}\}$/);
|
|
317
|
-
if (templateExpression) return templateExpression[1];
|
|
318
|
-
return JSON.stringify(value);
|
|
319
|
-
}
|
|
320
|
-
/** Normalize tag to string — handles both `string` and `{ name: string }` */
|
|
321
|
-
function tagToString(tag) {
|
|
322
|
-
return typeof tag === "string" ? tag : tag.name;
|
|
323
|
-
}
|
|
324
|
-
function graphToMachineConfig(graph, options = {}) {
|
|
325
|
-
const { showDescriptions = true, showMeta = true } = options;
|
|
326
|
-
const config = {};
|
|
327
|
-
function getNodeConfig(node) {
|
|
328
|
-
const nodeConfig = node.parentId ? {} : config;
|
|
329
|
-
const isRoot = !node.parentId;
|
|
330
|
-
const authoredNodeId = getSerializedNodeId(node) ?? (isRoot ? graph.id : void 0);
|
|
331
|
-
const defaultNodeId = getDefaultNodeId(graph, node);
|
|
332
|
-
const resolvedNodeId = isAutoGeneratedId(authoredNodeId) ? void 0 : isRoot ? authoredNodeId : defaultNodeId === authoredNodeId ? void 0 : authoredNodeId;
|
|
333
|
-
const initialNode = node.data.initialId ? graph.nodes.find((n) => n.id === node.data.initialId) : null;
|
|
334
|
-
const nodeType = [
|
|
335
|
-
"final",
|
|
336
|
-
"history",
|
|
337
|
-
"parallel"
|
|
338
|
-
].includes(node.data.type) ? node.data.type : void 0;
|
|
339
|
-
const tags = node.data.tags;
|
|
340
|
-
Object.assign(nodeConfig, {
|
|
341
|
-
id: resolvedNodeId,
|
|
342
|
-
type: nodeType === "normal" ? void 0 : nodeType ?? void 0,
|
|
343
|
-
initial: initialNode?.data.key,
|
|
344
|
-
...node.data.entry?.length ? { entry: node.data.entry.map(serializeActionItem) } : void 0,
|
|
345
|
-
...node.data.exit?.length ? { exit: node.data.exit.map(serializeActionItem) } : void 0,
|
|
346
|
-
...node.data.invokes?.length ? { invoke: node.data.invokes.map((inv) => ({
|
|
347
|
-
src: inv.src,
|
|
348
|
-
id: inv.id,
|
|
349
|
-
...inv.input ? { input: inv.input } : void 0,
|
|
350
|
-
...inv.output ? { output: inv.output } : void 0
|
|
351
|
-
})) } : void 0,
|
|
352
|
-
...tags?.length ? { tags: tags.map(tagToString) } : void 0,
|
|
353
|
-
...showDescriptions && node.data.description ? { description: node.data.description } : void 0,
|
|
354
|
-
...showMeta && node.data.meta && Object.keys(node.data.meta).length > 0 ? { meta: node.data.meta } : void 0,
|
|
355
|
-
...node.data.history ? { history: node.data.history } : void 0
|
|
356
|
-
});
|
|
357
|
-
const childNodes = graph.nodes.filter((n) => n.parentId === node.id && !n.data.temp);
|
|
358
|
-
const edges = graph.edges.filter((edge) => edge.sourceId === node.id && !edge.data.temp);
|
|
359
|
-
if (edges.length > 0) {
|
|
360
|
-
const on = {};
|
|
361
|
-
const after = {};
|
|
362
|
-
const alwaysArr = [];
|
|
363
|
-
const onDone = {};
|
|
364
|
-
const invokeMap = {};
|
|
365
|
-
for (const edge of edges) {
|
|
366
|
-
const targetNode = graph.nodes.find((n) => n.id === edge.targetId);
|
|
367
|
-
const resolvedTarget = targetNode ? targetNode.parentId === node.parentId ? targetNode.data.key : `#${targetNode.id}` : "";
|
|
368
|
-
const type = edge.data.eventType ?? "";
|
|
369
|
-
const transitionMeta = showMeta ? buildMeta(edge.data.meta, edge.data.color) : void 0;
|
|
370
|
-
const transitionObject = {
|
|
371
|
-
target: edge.data.transitionType === "targetless" ? void 0 : `${resolvedTarget}`,
|
|
372
|
-
...edge.data.transitionType === "reenter" ? { reenter: true } : void 0,
|
|
373
|
-
guard: edge.data.guard ? edge.data.guard.code ? raw(stripExportDefault$1(edge.data.guard.code)) : edge.data.guard : void 0,
|
|
374
|
-
actions: edge.data.actions?.length ? edge.data.actions.map(serializeActionItem) : void 0,
|
|
375
|
-
description: edge.data.description ?? void 0,
|
|
376
|
-
...transitionMeta ? { meta: transitionMeta } : void 0
|
|
377
|
-
};
|
|
378
|
-
if (type === "") alwaysArr.push(transitionObject);
|
|
379
|
-
else if (type.startsWith("xstate.after.")) {
|
|
380
|
-
const delayKey = type.slice(13).split(".")[0];
|
|
381
|
-
if (!after[delayKey]) after[delayKey] = [];
|
|
382
|
-
after[delayKey].push(transitionObject);
|
|
383
|
-
} else if (type === "*") {
|
|
384
|
-
if (!on["*"]) on["*"] = [];
|
|
385
|
-
on["*"].push(transitionObject);
|
|
386
|
-
} else if (type.startsWith("xstate.done.state")) {
|
|
387
|
-
if (!onDone[type]) onDone[type] = [];
|
|
388
|
-
onDone[type].push(transitionObject);
|
|
389
|
-
} else if (type.startsWith("xstate.done.actor.")) {
|
|
390
|
-
const actorId = type.slice(18);
|
|
391
|
-
invokeMap[actorId] = {
|
|
392
|
-
...invokeMap[actorId],
|
|
393
|
-
onDone: (invokeMap[actorId]?.onDone ?? []).concat(transitionObject)
|
|
394
|
-
};
|
|
395
|
-
} else if (type.startsWith("xstate.error.actor.")) {
|
|
396
|
-
const actorId = type.slice(19);
|
|
397
|
-
invokeMap[actorId] = {
|
|
398
|
-
...invokeMap[actorId],
|
|
399
|
-
onError: (invokeMap[actorId]?.onError ?? []).concat(transitionObject)
|
|
400
|
-
};
|
|
401
|
-
} else {
|
|
402
|
-
if (!on[type]) on[type] = [];
|
|
403
|
-
on[type].push(transitionObject);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (Object.keys(on).length > 0) nodeConfig.on = singleOrArrayRecord(on);
|
|
407
|
-
if (Object.keys(after).length > 0) nodeConfig.after = singleOrArrayRecord(after);
|
|
408
|
-
if (alwaysArr.length > 0) nodeConfig.always = singleOrArray(alwaysArr);
|
|
409
|
-
if (Object.keys(onDone).length > 0) nodeConfig.onDone = singleOrArray(Object.values(onDone).flat());
|
|
410
|
-
if (Object.keys(invokeMap).length > 0 && Array.isArray(nodeConfig.invoke)) nodeConfig.invoke = nodeConfig.invoke.map((inv) => {
|
|
411
|
-
const mapped = invokeMap[inv.id];
|
|
412
|
-
if (!mapped) return inv;
|
|
413
|
-
return {
|
|
414
|
-
...inv,
|
|
415
|
-
...mapped.onDone ? { onDone: singleOrArray(mapped.onDone) } : void 0,
|
|
416
|
-
...mapped.onError ? { onError: singleOrArray(mapped.onError) } : void 0
|
|
417
|
-
};
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
if (Array.isArray(nodeConfig.invoke)) nodeConfig.invoke = nodeConfig.invoke.map((inv) => {
|
|
421
|
-
if (!isAutoGeneratedId(inv.id)) return inv;
|
|
422
|
-
const { id: _id, ...rest } = inv;
|
|
423
|
-
return rest;
|
|
424
|
-
});
|
|
425
|
-
if (childNodes.length > 0) {
|
|
426
|
-
nodeConfig.states = {};
|
|
427
|
-
for (const childState of childNodes) nodeConfig.states[childState.data.key] = getNodeConfig(childState);
|
|
428
|
-
}
|
|
429
|
-
return nodeConfig;
|
|
430
|
-
}
|
|
431
|
-
const rootNode = graph.nodes.find((node) => node.data.parentId === null || node.parentId == null);
|
|
432
|
-
if (!rootNode) throw new Error("No root node found");
|
|
433
|
-
getNodeConfig(rootNode);
|
|
434
|
-
return deepSimplify(config);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region src/jsonSchemaToTSType.ts
|
|
439
|
-
function jsonSchemaToTSType(schema) {
|
|
440
|
-
if (!schema) return "unknown";
|
|
441
|
-
if (schema.enum) return schema.enum.map((v) => typeof v === "string" ? `'${v}'` : String(v)).join(" | ");
|
|
442
|
-
if (schema.const !== void 0) return typeof schema.const === "string" ? `'${schema.const}'` : String(schema.const);
|
|
443
|
-
if (schema.oneOf) return schema.oneOf.map((s) => jsonSchemaToTSType(resolveDef(s))).join(" | ");
|
|
444
|
-
if (schema.anyOf) return schema.anyOf.map((s) => jsonSchemaToTSType(resolveDef(s))).join(" | ");
|
|
445
|
-
if (schema.allOf) return schema.allOf.map((s) => jsonSchemaToTSType(resolveDef(s))).join(" & ");
|
|
446
|
-
if (schema.type === "array") return `Array<${jsonSchemaToTSType(resolveDef(schema.items))}>`;
|
|
447
|
-
if (Array.isArray(schema.type)) return schema.type.map((t) => primitiveType(t)).join(" | ");
|
|
448
|
-
if (schema.type === "object" || schema.properties) return objectType(schema);
|
|
449
|
-
if (schema.type) return primitiveType(schema.type);
|
|
450
|
-
return "unknown";
|
|
451
|
-
}
|
|
452
|
-
function primitiveType(type) {
|
|
453
|
-
switch (type) {
|
|
454
|
-
case "string": return "string";
|
|
455
|
-
case "number":
|
|
456
|
-
case "integer": return "number";
|
|
457
|
-
case "boolean": return "boolean";
|
|
458
|
-
case "null": return "null";
|
|
459
|
-
default: return "unknown";
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function objectType(schema) {
|
|
463
|
-
const props = schema.properties;
|
|
464
|
-
if (!props || Object.keys(props).length === 0) {
|
|
465
|
-
if (schema.additionalProperties) return `Record<string, ${jsonSchemaToTSType(resolveDef(schema.additionalProperties))}>`;
|
|
466
|
-
return "Record<string, unknown>";
|
|
467
|
-
}
|
|
468
|
-
const required = new Set(schema.required ?? []);
|
|
469
|
-
return `{ ${Object.entries(props).map(([key, def]) => {
|
|
470
|
-
const type = jsonSchemaToTSType(resolveDef(def));
|
|
471
|
-
return `${key}${required.has(key) ? "" : "?"}: ${type}`;
|
|
472
|
-
}).join("; ")} }`;
|
|
473
|
-
}
|
|
474
|
-
function resolveDef(def) {
|
|
475
|
-
if (!def) return void 0;
|
|
476
|
-
if (Array.isArray(def)) return resolveDef(def[0]);
|
|
477
|
-
if (typeof def === "boolean") return void 0;
|
|
478
|
-
return def;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Build an inline context type string from the schemas.context record.
|
|
482
|
-
* Each key is a context property name, value is its JSONSchema7.
|
|
483
|
-
*/
|
|
484
|
-
function contextSchemaToTSType(context) {
|
|
485
|
-
if (!context || Object.keys(context).length === 0) return null;
|
|
486
|
-
return `{ ${Object.entries(context).map(([key, schema]) => {
|
|
487
|
-
return `${key}: ${jsonSchemaToTSType(schema)}`;
|
|
488
|
-
}).join("; ")} }`;
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Build an event union type from the schemas.events record.
|
|
492
|
-
* Each key is the event type name, value describes the payload properties.
|
|
493
|
-
*/
|
|
494
|
-
function eventsSchemaToTSType(events) {
|
|
495
|
-
if (!events || Object.keys(events).length === 0) return null;
|
|
496
|
-
return Object.entries(events).map(([eventType, schema]) => {
|
|
497
|
-
const props = schema.properties;
|
|
498
|
-
if (!props || Object.keys(props).length === 0) return `{ type: '${eventType}' }`;
|
|
499
|
-
const required = new Set(schema.required ?? []);
|
|
500
|
-
const extraProps = Object.entries(props).filter(([k]) => k !== "type").map(([key, def]) => {
|
|
501
|
-
const type = jsonSchemaToTSType(resolveDef(def));
|
|
502
|
-
return `${key}${required.has(key) ? "" : "?"}: ${type}`;
|
|
503
|
-
});
|
|
504
|
-
if (extraProps.length === 0) return `{ type: '${eventType}' }`;
|
|
505
|
-
return `{ type: '${eventType}'; ${extraProps.join("; ")} }`;
|
|
506
|
-
}).join("\n | ");
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
//#endregion
|
|
510
|
-
//#region src/textUtils.ts
|
|
511
|
-
/**
|
|
512
|
-
* Pure string utilities used by codegen.
|
|
513
|
-
*/
|
|
514
|
-
/**
|
|
515
|
-
* Removes common leading whitespace from all non-empty lines.
|
|
516
|
-
*/
|
|
517
|
-
function dedent(text) {
|
|
518
|
-
const lines = text.split("\n");
|
|
519
|
-
const nonEmptyLines = lines.filter((l) => l.trim().length > 0);
|
|
520
|
-
if (nonEmptyLines.length === 0) return text;
|
|
521
|
-
const minIndent = Math.min(...nonEmptyLines.map((l) => l.match(/^(\s*)/)[1].length));
|
|
522
|
-
if (minIndent === 0) return text;
|
|
523
|
-
return lines.map((l) => l.trim().length > 0 ? l.slice(minIndent) : l).join("\n");
|
|
524
|
-
}
|
|
525
|
-
/**
|
|
526
|
-
* Strips `export default` wrapper from an expression string.
|
|
527
|
-
* E.g. `"export default assign({ ... })"` → `"assign({ ... })"`
|
|
528
|
-
*/
|
|
529
|
-
function stripExportDefault(code) {
|
|
530
|
-
const trimmed = code.trim();
|
|
531
|
-
if (trimmed.startsWith("export default ")) return trimmed.slice(15).replace(/;$/, "");
|
|
532
|
-
return trimmed;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
//#endregion
|
|
536
|
-
//#region src/graphToXStateTS.ts
|
|
537
|
-
function graphToXStateTS(graph, options = {}) {
|
|
538
|
-
const { exportStyle = "named", targetLanguage = "typescript", ...configOptions } = options;
|
|
539
|
-
const schemas = graph.data.schemas;
|
|
540
|
-
const impls = filterInlineImplementations(graph.data.implementations);
|
|
541
|
-
const supportsTypeSyntax = targetLanguage === "typescript";
|
|
542
|
-
const hasSchemas = !!(schemas && (schemas.context || schemas.events || schemas.input || schemas.output));
|
|
543
|
-
const hasActions = !!impls?.actions.length;
|
|
544
|
-
const hasGuards = !!impls?.guards.length;
|
|
545
|
-
const hasActors = !!impls?.actors.length;
|
|
546
|
-
const hasDelays = !!impls?.delays.length;
|
|
547
|
-
const hasSetup = hasSchemas || hasActions || hasGuards || hasActors || hasDelays;
|
|
548
|
-
const builtInActions = getUsedBuiltInActions(graph);
|
|
549
|
-
const imports = buildImports({
|
|
550
|
-
hasSetup,
|
|
551
|
-
hasActors,
|
|
552
|
-
actors: impls?.actors ?? [],
|
|
553
|
-
builtInActions
|
|
554
|
-
});
|
|
555
|
-
const machineConfig = graphToMachineConfig(graph, configOptions);
|
|
556
|
-
let machineExpr;
|
|
557
|
-
if (hasSetup) {
|
|
558
|
-
const setupObj = buildSetupObject(schemas, impls, { includeTypeSyntax: supportsTypeSyntax });
|
|
559
|
-
const configStr = serializeJS(machineConfig, 2);
|
|
560
|
-
machineExpr = `setup(${serializeJS(setupObj, 0)}).createMachine(${configStr})`;
|
|
561
|
-
} else machineExpr = `createMachine(${serializeJS(machineConfig, 0)})`;
|
|
562
|
-
const lines = [];
|
|
563
|
-
lines.push(imports);
|
|
564
|
-
lines.push("");
|
|
565
|
-
lines.push(`const machine = ${machineExpr};`);
|
|
566
|
-
if (exportStyle === "named") {
|
|
567
|
-
lines.push("");
|
|
568
|
-
lines.push("export { machine };");
|
|
569
|
-
} else if (exportStyle === "default") {
|
|
570
|
-
lines.push("");
|
|
571
|
-
lines.push("export default machine;");
|
|
572
|
-
}
|
|
573
|
-
return lines.join("\n") + "\n";
|
|
574
|
-
}
|
|
575
|
-
function filterInlineImplementations(impls) {
|
|
576
|
-
if (!impls) return impls;
|
|
577
|
-
return {
|
|
578
|
-
...impls,
|
|
579
|
-
actions: impls.actions.filter((action) => !action.name.startsWith("inline:")),
|
|
580
|
-
guards: impls.guards.filter((guard) => !guard.name.startsWith("inline:")),
|
|
581
|
-
delays: impls.delays.filter((delay) => !delay.name.startsWith("inline:"))
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
/** Map from xstate action type to the import name */
|
|
585
|
-
const BUILTIN_ACTION_IMPORTS = {
|
|
586
|
-
"xstate.raise": "raise",
|
|
587
|
-
"xstate.sendTo": "sendTo",
|
|
588
|
-
"xstate.cancel": "cancel",
|
|
589
|
-
"xstate.emit": "emit",
|
|
590
|
-
"xstate.spawnChild": "spawnChild",
|
|
591
|
-
"xstate.stopChild": "stopChild",
|
|
592
|
-
"xstate.log": "log",
|
|
593
|
-
"xstate.assign": "assign"
|
|
594
|
-
};
|
|
595
|
-
/** Check inline action/entry/exit code for references to xstate builtins */
|
|
596
|
-
function scanInlineCodeForBuiltins(code, used) {
|
|
597
|
-
const expr = stripExportDefault(code);
|
|
598
|
-
for (const importName of Object.values(BUILTIN_ACTION_IMPORTS)) if (new RegExp(`\\b${importName}\\b`).test(expr)) used.add(importName);
|
|
599
|
-
}
|
|
600
|
-
function getExprActionCode(action) {
|
|
601
|
-
return action.type === "xstate.expr" && typeof action.params?.code === "string" ? action.params.code : void 0;
|
|
602
|
-
}
|
|
603
|
-
function getUsedBuiltInActions(graph) {
|
|
604
|
-
const used = /* @__PURE__ */ new Set();
|
|
605
|
-
for (const node of graph.nodes) for (const action of [...node.data.entry ?? [], ...node.data.exit ?? []]) {
|
|
606
|
-
const imp = BUILTIN_ACTION_IMPORTS[action.type];
|
|
607
|
-
if (imp) used.add(imp);
|
|
608
|
-
const exprCode = getExprActionCode(action);
|
|
609
|
-
if (exprCode) scanInlineCodeForBuiltins(exprCode, used);
|
|
610
|
-
}
|
|
611
|
-
for (const edge of graph.edges) for (const action of edge.data.actions ?? []) {
|
|
612
|
-
const imp = BUILTIN_ACTION_IMPORTS[action.type];
|
|
613
|
-
if (imp) used.add(imp);
|
|
614
|
-
const exprCode = getExprActionCode(action);
|
|
615
|
-
if (exprCode) scanInlineCodeForBuiltins(exprCode, used);
|
|
616
|
-
}
|
|
617
|
-
return used;
|
|
618
|
-
}
|
|
619
|
-
function buildImports({ hasSetup, hasActors, actors, builtInActions }) {
|
|
620
|
-
const xstateImports = [];
|
|
621
|
-
if (hasSetup) xstateImports.push("setup");
|
|
622
|
-
else xstateImports.push("createMachine");
|
|
623
|
-
for (const name of builtInActions) xstateImports.push(name);
|
|
624
|
-
if (hasActors) {
|
|
625
|
-
if (actors.length > 0) xstateImports.push("fromPromise");
|
|
626
|
-
}
|
|
627
|
-
return `import { ${xstateImports.join(", ")} } from 'xstate';`;
|
|
628
|
-
}
|
|
629
|
-
function buildSetupObject(schemas, impls, options) {
|
|
630
|
-
const setup = {};
|
|
631
|
-
const types = buildTypesBlock(schemas, options);
|
|
632
|
-
if (types) setup.types = types;
|
|
633
|
-
if (impls?.actions.length) setup.actions = buildActionsBlock(impls.actions, options);
|
|
634
|
-
if (impls?.guards.length) setup.guards = buildGuardsBlock(impls.guards, options);
|
|
635
|
-
if (impls?.actors.length) setup.actors = buildActorsBlock(impls.actors, options);
|
|
636
|
-
if (impls?.delays.length) setup.delays = buildDelaysBlock(impls.delays);
|
|
637
|
-
return setup;
|
|
638
|
-
}
|
|
639
|
-
function buildTypesBlock(schemas, options) {
|
|
640
|
-
if (!schemas || !options.includeTypeSyntax) return void 0;
|
|
641
|
-
const types = {};
|
|
642
|
-
const contextType = contextSchemaToTSType(schemas.context);
|
|
643
|
-
if (contextType) types.context = raw(`{} as ${contextType}`);
|
|
644
|
-
const eventsType = eventsSchemaToTSType(schemas.events);
|
|
645
|
-
if (eventsType) types.events = raw(`{} as\n | ${eventsType}`);
|
|
646
|
-
if (schemas.input) types.input = raw(`{} as ${jsonSchemaToTSType(schemas.input)}`);
|
|
647
|
-
if (schemas.output) types.output = raw(`{} as ${jsonSchemaToTSType(schemas.output)}`);
|
|
648
|
-
return Object.keys(types).length > 0 ? types : void 0;
|
|
649
|
-
}
|
|
650
|
-
function hasSchemaProperties(schema) {
|
|
651
|
-
if (!schema) return false;
|
|
652
|
-
if (schema.type === "object" || schema.properties) {
|
|
653
|
-
const props = schema.properties;
|
|
654
|
-
return !!props && Object.keys(props).length > 0;
|
|
655
|
-
}
|
|
656
|
-
return true;
|
|
657
|
-
}
|
|
658
|
-
function buildActionsBlock(actions, options) {
|
|
659
|
-
const block = {};
|
|
660
|
-
for (const implementation of actions) if (implementation.code?.body) {
|
|
661
|
-
const exportedExpression = getExportDefaultExpression(implementation.code.body);
|
|
662
|
-
if (exportedExpression) {
|
|
663
|
-
block[implementation.name] = raw(exportedExpression);
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
const params = hasSchemaProperties(implementation.paramsSchema) ? options.includeTypeSyntax ? `, params: ${jsonSchemaToTSType(implementation.paramsSchema)}` : ", params" : "";
|
|
667
|
-
block[implementation.name] = raw(`function ({ context, event }${params ? params : ""}) {\n ${dedent(implementation.code.body)}\n}`);
|
|
668
|
-
} else block[implementation.name] = raw(`function ({ context, event }) {\n // TODO: implement ${implementation.name}\n}`);
|
|
669
|
-
return block;
|
|
670
|
-
}
|
|
671
|
-
function buildGuardsBlock(guards, options) {
|
|
672
|
-
const block = {};
|
|
673
|
-
for (const guard of guards) if (guard.code?.body) {
|
|
674
|
-
const exportedExpression = getExportDefaultExpression(guard.code.body);
|
|
675
|
-
if (exportedExpression) {
|
|
676
|
-
block[guard.name] = raw(exportedExpression);
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
const params = hasSchemaProperties(guard.paramsSchema) ? options.includeTypeSyntax ? `, params: ${jsonSchemaToTSType(guard.paramsSchema)}` : ", params" : "";
|
|
680
|
-
block[guard.name] = raw(`function ({ context, event }${params ? params : ""}) {\n ${dedent(guard.code.body)}\n}`);
|
|
681
|
-
} else block[guard.name] = raw(`function ({ context, event }) {\n // TODO: implement ${guard.name}\n return false;\n}`);
|
|
682
|
-
return block;
|
|
683
|
-
}
|
|
684
|
-
function buildActorsBlock(actors, options) {
|
|
685
|
-
const block = {};
|
|
686
|
-
for (const actor of actors) if (actor.code?.body) {
|
|
687
|
-
const inputType = options.includeTypeSyntax && hasSchemaProperties(actor.inputSchema) ? `: ${jsonSchemaToTSType(actor.inputSchema)}` : "";
|
|
688
|
-
block[actor.name] = raw(`fromPromise(async ({ input }${inputType ? `: { input${inputType} }` : ""}) => {\n ${dedent(actor.code.body)}\n})`);
|
|
689
|
-
} else block[actor.name] = raw(`fromPromise(async ({ input }) => {\n // TODO: implement ${actor.name}\n})`);
|
|
690
|
-
return block;
|
|
691
|
-
}
|
|
692
|
-
function buildDelaysBlock(delays) {
|
|
693
|
-
const block = {};
|
|
694
|
-
for (const delay of delays) if (delay.code?.body) {
|
|
695
|
-
const exportedExpression = getExportDefaultExpression(delay.code.body);
|
|
696
|
-
if (exportedExpression) {
|
|
697
|
-
block[delay.name] = raw(exportedExpression);
|
|
698
|
-
continue;
|
|
699
|
-
}
|
|
700
|
-
block[delay.name] = raw(`function ({ context, event }) {\n ${dedent(delay.code.body)}\n}`);
|
|
701
|
-
} else block[delay.name] = raw(`function () {\n // TODO: implement ${delay.name}\n return 1000;\n}`);
|
|
702
|
-
return block;
|
|
703
|
-
}
|
|
704
|
-
function getExportDefaultExpression(code) {
|
|
705
|
-
const stripped = stripExportDefault(code);
|
|
706
|
-
return stripped === code.trim() ? void 0 : stripped;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
//#endregion
|
|
710
|
-
export { graphToMachineConfig as a, serializeJS as c, upsertStatelyPragma as d, jsonSchemaToTSType as i, findStatelyPragmaAttachments as l, contextSchemaToTSType as n, RawCode as o, eventsSchemaToTSType as r, raw as s, graphToXStateTS as t, getStatelyPragma as u };
|