convex-ents 0.14.0 → 0.15.0
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/functions.js +6 -5
- package/dist/functions.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/writer.js +6 -5
- package/dist/writer.js.map +1 -1
- package/package.json +1 -1
package/dist/writer.js
CHANGED
|
@@ -887,6 +887,9 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
|
|
|
887
887
|
).map(async (edgeDefinition) => {
|
|
888
888
|
const key = edgeDefinition.name;
|
|
889
889
|
const idOrIds = value[key];
|
|
890
|
+
if (idOrIds === void 0) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
890
893
|
if (edgeDefinition.cardinality === "single") {
|
|
891
894
|
if (edgeDefinition.type === "ref") {
|
|
892
895
|
const oldDoc = await this.ctx.db.get(docId);
|
|
@@ -896,11 +899,9 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
|
|
|
896
899
|
}
|
|
897
900
|
} else {
|
|
898
901
|
if (edgeDefinition.type === "field") {
|
|
899
|
-
|
|
900
|
-
throw new Error("Cannot set 1:many edge from many end.");
|
|
901
|
-
}
|
|
902
|
+
throw new Error("Cannot set 1:many edge from many end.");
|
|
902
903
|
} else {
|
|
903
|
-
const requested = new Set(idOrIds
|
|
904
|
+
const requested = new Set(idOrIds);
|
|
904
905
|
const removeEdges = (await this.ctx.db.query(edgeDefinition.table).withIndex(
|
|
905
906
|
edgeDefinition.field,
|
|
906
907
|
(q) => q.eq(edgeDefinition.field, docId)
|
|
@@ -919,7 +920,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
|
|
|
919
920
|
return true;
|
|
920
921
|
}).map(([edgeId]) => edgeId);
|
|
921
922
|
edges[key] = {
|
|
922
|
-
add: idOrIds
|
|
923
|
+
add: idOrIds,
|
|
923
924
|
removeEdges
|
|
924
925
|
};
|
|
925
926
|
}
|