@statelyai/sdk 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/studio.mjs +20 -2
- package/package.json +1 -1
- package/schemas/statelyai.schema.json +2 -2
package/README.md
CHANGED
|
@@ -23,4 +23,4 @@ Published schemas:
|
|
|
23
23
|
- `@statelyai/sdk/statelyai.schema.json`
|
|
24
24
|
- `@statelyai/sdk/xstate.schema.json`
|
|
25
25
|
|
|
26
|
-
The CLI-facing `statelyai.json` schema now uses top-level `include` / `exclude` globs for local file discovery, plus `
|
|
26
|
+
The CLI-facing `statelyai.json` schema now uses top-level `include` / `exclude` globs for local file discovery, plus `newMachinesDir` for pulling remote-only project machines into new local files.
|
package/dist/studio.mjs
CHANGED
|
@@ -40,13 +40,31 @@ function unwrapResponseData(data) {
|
|
|
40
40
|
if (typeof data === "object" && data !== null && "data" in data) return data.data;
|
|
41
41
|
return data;
|
|
42
42
|
}
|
|
43
|
+
function normalizeProjectMachine(machine) {
|
|
44
|
+
if (typeof machine !== "object" || machine === null) return null;
|
|
45
|
+
const candidate = machine;
|
|
46
|
+
const machineId = typeof candidate.machineId === "string" ? candidate.machineId : typeof candidate.id === "string" ? candidate.id : void 0;
|
|
47
|
+
if (!machineId) return null;
|
|
48
|
+
return {
|
|
49
|
+
machineId,
|
|
50
|
+
name: typeof candidate.name === "string" && candidate.name.trim().length > 0 ? candidate.name : typeof candidate.key === "string" && candidate.key.trim().length > 0 ? candidate.key : machineId
|
|
51
|
+
};
|
|
52
|
+
}
|
|
43
53
|
function normalizeProjectData(project) {
|
|
44
|
-
|
|
54
|
+
const machines = Array.isArray(project.machines) ? project.machines.map((machine) => normalizeProjectMachine(machine)).filter((machine) => machine != null) : [];
|
|
55
|
+
if (project.projectVersionId) return {
|
|
56
|
+
...project,
|
|
57
|
+
machines
|
|
58
|
+
};
|
|
45
59
|
if (project.projectId && project.id) return {
|
|
46
60
|
...project,
|
|
61
|
+
machines,
|
|
47
62
|
projectVersionId: project.id
|
|
48
63
|
};
|
|
49
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
...project,
|
|
66
|
+
machines
|
|
67
|
+
};
|
|
50
68
|
}
|
|
51
69
|
function normalizeRepoUrl(url) {
|
|
52
70
|
if (!url) return;
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"$ref": "#/$defs/globPattern"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"newMachinesDir": {
|
|
51
51
|
"type": "string",
|
|
52
52
|
"minLength": 1,
|
|
53
53
|
"description": "Directory, relative to statelyai.json, where statelyai pull should create new local files for remote-only project machines."
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"defaultXStateVersion": 5,
|
|
70
70
|
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
71
71
|
"exclude": ["**/*.test.ts", "**/*.spec.ts"],
|
|
72
|
-
"
|
|
72
|
+
"newMachinesDir": "src/machines"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
}
|