convex-ents 0.17.0 → 0.18.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/writer.js CHANGED
@@ -815,7 +815,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
815
815
  await this.base.checkUniqueness(value, id);
816
816
  const fields = this.base.fieldsOnly(value);
817
817
  if (Object.keys(fields).length > 0) {
818
- await this.ctx.db.patch(id, fields);
818
+ await this.ctx.db.patch(this.table, id, fields);
819
819
  }
820
820
  const edges = {};
821
821
  await Promise.all(
@@ -881,7 +881,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
881
881
  await this.base.checkReadAndWriteRule("update", docId, value);
882
882
  await this.base.checkUniqueness(value, docId);
883
883
  const fields = this.base.fieldsOnly(value);
884
- await this.ctx.db.replace(docId, fields);
884
+ await this.ctx.db.replace(this.table, docId, fields);
885
885
  const edges = {};
886
886
  await Promise.all(
887
887
  Object.values(
@@ -1105,10 +1105,10 @@ var WriterImplBase = class _WriterImplBase {
1105
1105
  );
1106
1106
  const deletionTime = +/* @__PURE__ */ new Date();
1107
1107
  if (isDeletingSoftly) {
1108
- await this.ctx.db.patch(id, { deletionTime });
1108
+ await this.ctx.db.patch(this.table, id, { deletionTime });
1109
1109
  } else {
1110
1110
  try {
1111
- await this.ctx.db.delete(id);
1111
+ await this.ctx.db.delete(this.table, id);
1112
1112
  } catch {
1113
1113
  }
1114
1114
  }
@@ -1172,7 +1172,7 @@ var WriterImplBase = class _WriterImplBase {
1172
1172
  if (idOrIds.add !== void 0 && idOrIds.add.length > 0) {
1173
1173
  await Promise.all(
1174
1174
  idOrIds.add.map(
1175
- async (id) => this.ctx.db.patch(id, {
1175
+ async (id) => this.ctx.db.patch(edgeDefinition.to, id, {
1176
1176
  [edgeDefinition.ref]: docId
1177
1177
  })
1178
1178
  )
@@ -1195,7 +1195,7 @@ var WriterImplBase = class _WriterImplBase {
1195
1195
  await Promise.all(
1196
1196
  idOrIds.removeEdges.map(async (id) => {
1197
1197
  try {
1198
- await this.ctx.db.delete(id);
1198
+ await this.ctx.db.delete(edgeDefinition.table, id);
1199
1199
  } catch {
1200
1200
  }
1201
1201
  })