streamby-core 0.27.1 → 0.27.2
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.
|
@@ -267,7 +267,7 @@ function exportRouter(config) {
|
|
|
267
267
|
if (!project) {
|
|
268
268
|
return res.status(404).json({ message: 'Project not found' });
|
|
269
269
|
}
|
|
270
|
-
const exportMetadata = project.exports
|
|
270
|
+
const exportMetadata = project.exports?.find((e) => e.name?.toLowerCase().trim() === exportName.toLowerCase().trim());
|
|
271
271
|
if (!exportMetadata) {
|
|
272
272
|
return res.status(404).json({ message: 'Export not found in this project' });
|
|
273
273
|
}
|
|
@@ -372,7 +372,7 @@ function exportRouter(config) {
|
|
|
372
372
|
return res.status(501).json({ message: 'SQL public exports not yet implemented' });
|
|
373
373
|
}
|
|
374
374
|
} // end legacy else block
|
|
375
|
-
if (
|
|
375
|
+
if (data === null || data === undefined) {
|
|
376
376
|
return res.status(404).json({ message: 'Export data not found' });
|
|
377
377
|
}
|
|
378
378
|
res.json(data);
|
package/dist/services/export.js
CHANGED
|
@@ -48,7 +48,10 @@ async function createExport(config, projectId, description, exportName, dbType,
|
|
|
48
48
|
storageDbId: targetDb.id,
|
|
49
49
|
};
|
|
50
50
|
const ProjectModel = isSqlProject ? (0, manager_1.getModel)('projects', 'sql') : (0, manager_1.getModel)('projects', 'nosql');
|
|
51
|
-
await ProjectModel.update({ _id: projectId }, { $push: { exports: exportEntry } });
|
|
51
|
+
const updated = await ProjectModel.update({ _id: projectId }, { $push: { exports: exportEntry } });
|
|
52
|
+
if (!updated) {
|
|
53
|
+
throw new Error(`Failed to save export entry to project ${projectId}. The project may not exist or the database update failed.`);
|
|
54
|
+
}
|
|
52
55
|
return { exportId, message: `${exportType} export created successfully` };
|
|
53
56
|
}
|
|
54
57
|
async function updateExport(config, projectId, exportId, description, exportName, dbType, exportType, isPrivate, allowedOrigin, devMode, devPorts, nodeSchema, useConnections, useCredentials) {
|