convex-ents 0.17.1 → 0.18.1
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/deletion.js +2 -2
- package/dist/deletion.js.map +1 -1
- package/dist/functions.js +6 -6
- package/dist/functions.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/writer.js +6 -6
- package/dist/writer.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -523,10 +523,10 @@ var WriterImplBase = class _WriterImplBase {
|
|
|
523
523
|
);
|
|
524
524
|
const deletionTime = +/* @__PURE__ */ new Date();
|
|
525
525
|
if (isDeletingSoftly) {
|
|
526
|
-
await this.ctx.db.patch(id, { deletionTime });
|
|
526
|
+
await this.ctx.db.patch(this.table, id, { deletionTime });
|
|
527
527
|
} else {
|
|
528
528
|
try {
|
|
529
|
-
await this.ctx.db.delete(id);
|
|
529
|
+
await this.ctx.db.delete(this.table, id);
|
|
530
530
|
} catch {
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -590,7 +590,7 @@ var WriterImplBase = class _WriterImplBase {
|
|
|
590
590
|
if (idOrIds.add !== void 0 && idOrIds.add.length > 0) {
|
|
591
591
|
await Promise.all(
|
|
592
592
|
idOrIds.add.map(
|
|
593
|
-
async (id) => this.ctx.db.patch(id, {
|
|
593
|
+
async (id) => this.ctx.db.patch(edgeDefinition.to, id, {
|
|
594
594
|
[edgeDefinition.ref]: docId
|
|
595
595
|
})
|
|
596
596
|
)
|
|
@@ -613,7 +613,7 @@ var WriterImplBase = class _WriterImplBase {
|
|
|
613
613
|
await Promise.all(
|
|
614
614
|
idOrIds.removeEdges.map(async (id) => {
|
|
615
615
|
try {
|
|
616
|
-
await this.ctx.db.delete(id);
|
|
616
|
+
await this.ctx.db.delete(edgeDefinition.table, id);
|
|
617
617
|
} catch {
|
|
618
618
|
}
|
|
619
619
|
})
|
|
@@ -1737,7 +1737,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
|
|
|
1737
1737
|
await this.base.checkUniqueness(value, id);
|
|
1738
1738
|
const fields = this.base.fieldsOnly(value);
|
|
1739
1739
|
if (Object.keys(fields).length > 0) {
|
|
1740
|
-
await this.ctx.db.patch(id, fields);
|
|
1740
|
+
await this.ctx.db.patch(this.table, id, fields);
|
|
1741
1741
|
}
|
|
1742
1742
|
const edges = {};
|
|
1743
1743
|
await Promise.all(
|
|
@@ -1803,7 +1803,7 @@ var PromiseEntWriterImpl = class extends PromiseEntOrNullImpl {
|
|
|
1803
1803
|
await this.base.checkReadAndWriteRule("update", docId, value);
|
|
1804
1804
|
await this.base.checkUniqueness(value, docId);
|
|
1805
1805
|
const fields = this.base.fieldsOnly(value);
|
|
1806
|
-
await this.ctx.db.replace(docId, fields);
|
|
1806
|
+
await this.ctx.db.replace(this.table, docId, fields);
|
|
1807
1807
|
const edges = {};
|
|
1808
1808
|
await Promise.all(
|
|
1809
1809
|
Object.values(
|
|
@@ -2085,7 +2085,7 @@ async function progressScheduledDeletion(cascade, counter, stack) {
|
|
|
2085
2085
|
if ("id" in last) {
|
|
2086
2086
|
const edgeArgs = last.edges[0];
|
|
2087
2087
|
if (edgeArgs === void 0) {
|
|
2088
|
-
await ctx.db.delete(last.id);
|
|
2088
|
+
await ctx.db.delete(last.table, last.id);
|
|
2089
2089
|
if (stack.length > 1) {
|
|
2090
2090
|
await continueOrSchedule(cascade, counter, stack.slice(0, -1));
|
|
2091
2091
|
}
|
|
@@ -2141,7 +2141,7 @@ async function paginateOrCascade(cascade, counter, stack, { table, approach, ind
|
|
|
2141
2141
|
] : [updated]
|
|
2142
2142
|
);
|
|
2143
2143
|
if (approach === "paginate") {
|
|
2144
|
-
await Promise.all(page.map((doc) => ctx.db.delete(doc._id)));
|
|
2144
|
+
await Promise.all(page.map((doc) => ctx.db.delete(table, doc._id)));
|
|
2145
2145
|
}
|
|
2146
2146
|
await continueOrSchedule(cascade, updatedCounter, updatedStack);
|
|
2147
2147
|
}
|