@exulu/backend 0.2.2 → 0.2.3
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/dist/index.cjs +12 -3
- package/dist/index.js +12 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2778,13 +2778,22 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
|
|
|
2778
2778
|
if (!exists) {
|
|
2779
2779
|
throw new Error("Table with name " + context.getTableName() + " does not exist.");
|
|
2780
2780
|
}
|
|
2781
|
-
const
|
|
2781
|
+
const query = db2.from(context.getTableName()).select("id");
|
|
2782
2782
|
if (id) {
|
|
2783
|
-
|
|
2783
|
+
query.where({ id });
|
|
2784
2784
|
}
|
|
2785
2785
|
if (external_id) {
|
|
2786
|
-
|
|
2786
|
+
query.where({ external_id });
|
|
2787
2787
|
}
|
|
2788
|
+
const item = await query.first();
|
|
2789
|
+
if (!item) {
|
|
2790
|
+
throw new Error("Item not found.");
|
|
2791
|
+
}
|
|
2792
|
+
const chunks = await db2.from(context.getChunksTableName()).where({ source: item.id }).select("id");
|
|
2793
|
+
if (chunks.length > 0) {
|
|
2794
|
+
await db2.from(context.getChunksTableName()).where({ source: item.id }).delete();
|
|
2795
|
+
}
|
|
2796
|
+
const mutation = db2.from(context.getTableName()).where({ id: item.id }).delete().returning("id");
|
|
2788
2797
|
const result = await mutation;
|
|
2789
2798
|
return result;
|
|
2790
2799
|
};
|
package/dist/index.js
CHANGED
|
@@ -2737,13 +2737,22 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
|
|
|
2737
2737
|
if (!exists) {
|
|
2738
2738
|
throw new Error("Table with name " + context.getTableName() + " does not exist.");
|
|
2739
2739
|
}
|
|
2740
|
-
const
|
|
2740
|
+
const query = db2.from(context.getTableName()).select("id");
|
|
2741
2741
|
if (id) {
|
|
2742
|
-
|
|
2742
|
+
query.where({ id });
|
|
2743
2743
|
}
|
|
2744
2744
|
if (external_id) {
|
|
2745
|
-
|
|
2745
|
+
query.where({ external_id });
|
|
2746
2746
|
}
|
|
2747
|
+
const item = await query.first();
|
|
2748
|
+
if (!item) {
|
|
2749
|
+
throw new Error("Item not found.");
|
|
2750
|
+
}
|
|
2751
|
+
const chunks = await db2.from(context.getChunksTableName()).where({ source: item.id }).select("id");
|
|
2752
|
+
if (chunks.length > 0) {
|
|
2753
|
+
await db2.from(context.getChunksTableName()).where({ source: item.id }).delete();
|
|
2754
|
+
}
|
|
2755
|
+
const mutation = db2.from(context.getTableName()).where({ id: item.id }).delete().returning("id");
|
|
2747
2756
|
const result = await mutation;
|
|
2748
2757
|
return result;
|
|
2749
2758
|
};
|