@opengeni/api-router 0.15.6 → 0.16.4

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.
@@ -14,6 +14,7 @@ import { requireAccessGrant } from "@opengeni/core";
14
14
  import { recordWorkspaceUsage, requireLimit } from "@opengeni/core";
15
15
  import type { ApiRouteDeps } from "@opengeni/core";
16
16
  import {
17
+ captureScheduledTaskRestoreState,
17
18
  createValidatedScheduledTask,
18
19
  manualScheduledTaskTriggerUsageKey,
19
20
  manualScheduledTaskTriggerWorkflowId,
@@ -69,6 +70,7 @@ export function registerScheduledTaskRoutes(app: Hono, deps: ApiRouteDeps): void
69
70
  const grant = await requireAccessGrant(c, deps, workspaceId, "scheduled_tasks:manage");
70
71
  const taskId = c.req.param("taskId");
71
72
  const existing = await requireScheduledTaskForApi(db, workspaceId, taskId);
73
+ const previous = await captureScheduledTaskRestoreState(db, existing);
72
74
  const rawPayload = await c.req.json();
73
75
  const payload = UpdateScheduledTaskRequest.parse(rawPayload);
74
76
  const update = await validatedScheduledTaskUpdate({
@@ -81,7 +83,7 @@ export function registerScheduledTaskRoutes(app: Hono, deps: ApiRouteDeps): void
81
83
  toolsProvided: scheduledTaskToolsProvided(rawPayload),
82
84
  });
83
85
  const task = await updateScheduledTask(db, workspaceId, taskId, update);
84
- await syncUpdatedScheduledTask({ db, workflowClient, previous: existing, task });
86
+ await syncUpdatedScheduledTask({ db, workflowClient, previous, task });
85
87
  return c.json(task);
86
88
  });
87
89
 
@@ -89,8 +91,9 @@ export function registerScheduledTaskRoutes(app: Hono, deps: ApiRouteDeps): void
89
91
  const workspaceId = c.req.param("workspaceId");
90
92
  await requireAccessGrant(c, deps, workspaceId, "scheduled_tasks:manage");
91
93
  const existing = await requireScheduledTaskForApi(db, workspaceId, c.req.param("taskId"));
94
+ const previous = await captureScheduledTaskRestoreState(db, existing);
92
95
  const task = await updateScheduledTask(db, workspaceId, existing.id, { status: "paused" });
93
- await syncUpdatedScheduledTask({ db, workflowClient, previous: existing, task });
96
+ await syncUpdatedScheduledTask({ db, workflowClient, previous, task });
94
97
  return c.json(task);
95
98
  });
96
99
 
@@ -98,8 +101,9 @@ export function registerScheduledTaskRoutes(app: Hono, deps: ApiRouteDeps): void
98
101
  const workspaceId = c.req.param("workspaceId");
99
102
  await requireAccessGrant(c, deps, workspaceId, "scheduled_tasks:manage");
100
103
  const existing = await requireScheduledTaskForApi(db, workspaceId, c.req.param("taskId"));
104
+ const previous = await captureScheduledTaskRestoreState(db, existing);
101
105
  const task = await updateScheduledTask(db, workspaceId, existing.id, { status: "active" });
102
- await syncUpdatedScheduledTask({ db, workflowClient, previous: existing, task });
106
+ await syncUpdatedScheduledTask({ db, workflowClient, previous, task });
103
107
  return c.json(task);
104
108
  });
105
109
 
@@ -1367,6 +1367,7 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
1367
1367
  accountId: grant.accountId,
1368
1368
  workspaceId,
1369
1369
  sessionId,
1370
+ subjectId: grant.subjectId,
1370
1371
  payload: event.payload,
1371
1372
  clientEventId: event.clientEventId ?? null,
1372
1373
  });