wired in project isolation

This commit is contained in:
Storme-bit
2026-04-15 02:36:37 -07:00
parent e8b81554c7
commit f83e37f5c7
3 changed files with 237 additions and 127 deletions
@@ -115,6 +115,24 @@ async function deleteProject(id) {
if (!res.ok) throw new Error(`Failed to delete project: ${res.status}`);
}
async function getProjectSessions(projectId) {
const url = new URL(`${BASE_URL}/sessions`);
url.searchParams.set('limit', 200); // generous upper bound
url.searchParams.set('offset', 0);
url.searchParams.set('projectId', projectId);
const res = await fetch(url.toString());
if (!res.ok) throw new Error(`Failed to fetch project sessions: ${res.status}`);
return res.json(); // returns array of session objects
}
async function getProject(id) {
const res = await fetch(`${BASE_URL}/projects/${id}`);
if (res.status === 404) return null;
if (!res.ok) throw new Error(`Failed to fetch project: ${res.status}`);
return res.json();
}
module.exports = {
getSessionByExternalId,
createSession,
@@ -129,4 +147,6 @@ module.exports = {
getProjects,
updateProject,
deleteProject,
getProjectSessions,
getProject,
}