streamby-core 0.29.6 → 0.29.7

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.
@@ -9,11 +9,9 @@ const mongodb_1 = require("mongodb");
9
9
  function workflowRouter(config) {
10
10
  const router = (0, express_1.Router)();
11
11
  const Project = (0, manager_1.getModel)('projects');
12
- // A project has exactly one Workflow (the central canvas). It is stored as the
13
- // single `project.workflow` object. Reads fall back to the legacy `workflows[0]`
14
- // array so pre-migration data keeps working; PATCH upserts and writes only the
15
- // new single field (and clears the legacy array on Mongo).
16
- const resolveWorkflow = (project) => project.workflow ?? (project.workflows ?? [])[0] ?? null;
12
+ // A project has exactly one Workflow (the central canvas), stored as the single
13
+ // `project.workflow` object. PATCH upserts it.
14
+ const resolveWorkflow = (project) => project.workflow ?? null;
17
15
  router.get('/projects/:id/workflow', async (req, res) => {
18
16
  try {
19
17
  const auth = await config.authProvider(req);
@@ -70,7 +68,7 @@ function workflowRouter(config) {
70
68
  await SqlProject.update({ _id: projectId }, { workflow: updated });
71
69
  }
72
70
  else {
73
- await Project.update({ _id: new mongodb_1.ObjectId(projectId) }, { $set: { workflow: updated }, $unset: { workflows: '' } });
71
+ await Project.update({ _id: new mongodb_1.ObjectId(projectId) }, { $set: { workflow: updated } });
74
72
  }
75
73
  res.json({ data: updated, message: 'Workflow updated successfully' });
76
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamby-core",
3
- "version": "0.29.6",
3
+ "version": "0.29.7",
4
4
  "description": "StreamBy middleware framework for media storage management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",