@statelyai/sdk 0.6.1 → 0.7.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 +16 -15
- package/dist/assetStorage.d.mts +1 -1
- package/dist/cli.d.mts +32 -9
- package/dist/cli.mjs +374 -26
- package/dist/embed.d.mts +1 -1
- package/dist/embed.mjs +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +1 -1
- package/dist/{inspect-BMIJcsFh.d.mts → inspect-YoEwfiKb.d.mts} +1 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +1 -1
- package/dist/{protocol-CDoCcaIP.d.mts → protocol-s9zwsiCW.d.mts} +1 -2
- package/dist/studio.d.mts +7 -1
- package/dist/studio.mjs +18 -3
- package/dist/sync-DLkTmSyA.mjs +2513 -0
- package/dist/sync.d.mts +20 -2
- package/dist/sync.mjs +4 -376
- package/dist/{transport-C0eTgNNu.mjs → transport-C8UTS3Fa.mjs} +1 -1
- package/package.json +5 -2
- package/schemas/statelyai.schema.json +1 -1
- package/schemas/xstate-json.schema.json +214 -0
- /package/dist/{graph-DpBGHZwl.d.mts → graph-zuNj3kfa.d.mts} +0 -0
package/dist/studio.mjs
CHANGED
|
@@ -40,6 +40,14 @@ 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 normalizeProjectData(project) {
|
|
44
|
+
if (project.projectVersionId) return project;
|
|
45
|
+
if (project.projectId && project.id) return {
|
|
46
|
+
...project,
|
|
47
|
+
projectVersionId: project.id
|
|
48
|
+
};
|
|
49
|
+
return project;
|
|
50
|
+
}
|
|
43
51
|
function normalizeRepoUrl(url) {
|
|
44
52
|
if (!url) return;
|
|
45
53
|
return url.replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -71,14 +79,14 @@ function createStatelyClient(options = {}) {
|
|
|
71
79
|
} },
|
|
72
80
|
projects: {
|
|
73
81
|
list() {
|
|
74
|
-
return request("/projects", { method: "GET" });
|
|
82
|
+
return request("/projects", { method: "GET" }).then((projects) => projects.map(normalizeProjectData));
|
|
75
83
|
},
|
|
76
84
|
create(input) {
|
|
77
85
|
return request("/projects/create", {
|
|
78
86
|
method: "POST",
|
|
79
87
|
headers: { "Content-Type": "application/json" },
|
|
80
88
|
body: JSON.stringify(input)
|
|
81
|
-
});
|
|
89
|
+
}).then(normalizeProjectData);
|
|
82
90
|
},
|
|
83
91
|
async ensure(input) {
|
|
84
92
|
if (input.repo && input.matchConnectedRepo !== false) {
|
|
@@ -88,7 +96,7 @@ function createStatelyClient(options = {}) {
|
|
|
88
96
|
return this.create(input);
|
|
89
97
|
},
|
|
90
98
|
get(projectId) {
|
|
91
|
-
return request(`/projects/${encodeURIComponent(projectId)}`, { method: "GET" });
|
|
99
|
+
return request(`/projects/${encodeURIComponent(projectId)}`, { method: "GET" }).then(normalizeProjectData);
|
|
92
100
|
}
|
|
93
101
|
},
|
|
94
102
|
machines: {
|
|
@@ -102,6 +110,13 @@ function createStatelyClient(options = {}) {
|
|
|
102
110
|
async createMany(input) {
|
|
103
111
|
return [await this.create(input)];
|
|
104
112
|
},
|
|
113
|
+
update(input) {
|
|
114
|
+
return request(`/machines/${encodeURIComponent(input.id)}`, {
|
|
115
|
+
method: "PATCH",
|
|
116
|
+
headers: { "Content-Type": "application/json" },
|
|
117
|
+
body: JSON.stringify(input)
|
|
118
|
+
});
|
|
119
|
+
},
|
|
105
120
|
get(machineId, getOptions = {}) {
|
|
106
121
|
const search = new URLSearchParams();
|
|
107
122
|
if (getOptions.version) search.set("version", getOptions.version);
|