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 CHANGED
@@ -1389,6 +1389,9 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
1389
1389
  ).map(async (edgeDefinition) => {
1390
1390
  const key = edgeDefinition.name;
1391
1391
  const idOrIds = value[key];
1392
+ if (idOrIds === void 0) {
1393
+ return;
1394
+ }
1392
1395
  if (edgeDefinition.cardinality === "single") {
1393
1396
  if (edgeDefinition.type === "ref") {
1394
1397
  const oldDoc = await this.ctx.db.get(docId);
@@ -1398,11 +1401,9 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
1398
1401
  }
1399
1402
  } else {
1400
1403
  if (edgeDefinition.type === "field") {
1401
- if (idOrIds !== void 0) {
1402
- throw new Error("Cannot set 1:many edge from many end.");
1403
- }
1404
+ throw new Error("Cannot set 1:many edge from many end.");
1404
1405
  } else {
1405
- const requested = new Set(idOrIds ?? []);
1406
+ const requested = new Set(idOrIds);
1406
1407
  const removeEdges = (await this.ctx.db.query(edgeDefinition.table).withIndex(
1407
1408
  edgeDefinition.field,
1408
1409
  (q) => q.eq(edgeDefinition.field, docId)
@@ -1421,7 +1422,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
1421
1422
  return true;
1422
1423
  }).map(([edgeId]) => edgeId);
1423
1424
  edges[key] = {
1424
- add: idOrIds ?? [],
1425
+ add: idOrIds,
1425
1426
  removeEdges
1426
1427
  };
1427
1428
  }