@jxsuite/server 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/studio-api.js +10 -1
package/package.json
CHANGED
package/src/studio-api.js
CHANGED
|
@@ -353,7 +353,7 @@ export async function handleStudioApi(req, url, root, activeProjectRoot = null)
|
|
|
353
353
|
// Shorthand: infer type from value
|
|
354
354
|
return { name, type: typeof d, default: d };
|
|
355
355
|
}
|
|
356
|
-
return { name, type: d.type, default: d.default };
|
|
356
|
+
return { name, type: d.type, default: d.default, format: d.format };
|
|
357
357
|
}),
|
|
358
358
|
hasElements: Array.isArray(content.$elements) && content.$elements.length > 0,
|
|
359
359
|
});
|
|
@@ -859,6 +859,15 @@ export async function handleStudioApi(req, url, root, activeProjectRoot = null)
|
|
|
859
859
|
return Response.json({ diff });
|
|
860
860
|
}
|
|
861
861
|
|
|
862
|
+
if (gitCmd === "show" && req.method === "GET") {
|
|
863
|
+
const fp = url.searchParams.get("path");
|
|
864
|
+
const ref = url.searchParams.get("ref") || "HEAD";
|
|
865
|
+
if (!fp) return Response.json({ error: "Missing path" }, { status: 400 });
|
|
866
|
+
if (fp.includes("..")) return Response.json({ error: "Invalid path" }, { status: 400 });
|
|
867
|
+
const content = await runGit(["show", `${ref}:${fp}`]);
|
|
868
|
+
return Response.json({ content, format: fp.endsWith(".md") ? "markdown" : "json" });
|
|
869
|
+
}
|
|
870
|
+
|
|
862
871
|
if (gitCmd === "discard" && req.method === "POST") {
|
|
863
872
|
const { files } = await req.json();
|
|
864
873
|
if (!Array.isArray(files) || files.length === 0)
|