convex-ents 0.9.2 → 0.9.4
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 +29 -25
- package/dist/deletion.js.map +1 -1
- package/dist/functions.js +18 -5
- package/dist/functions.js.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +2 -1
- package/dist/schema.js +10 -2
- package/dist/schema.js.map +1 -1
- package/dist/writer.js +17 -4
- package/dist/writer.js.map +1 -1
- package/package.json +1 -1
package/dist/deletion.js
CHANGED
|
@@ -23,11 +23,15 @@ __export(deletion_exports, {
|
|
|
23
23
|
scheduledDeleteFactory: () => scheduledDeleteFactory
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(deletion_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_server3 = require("convex/server");
|
|
27
|
+
var import_values2 = require("convex/values");
|
|
28
|
+
|
|
29
|
+
// src/schema.ts
|
|
30
|
+
var import_server = require("convex/server");
|
|
27
31
|
var import_values = require("convex/values");
|
|
28
32
|
|
|
29
33
|
// src/writer.ts
|
|
30
|
-
var
|
|
34
|
+
var import_server2 = require("convex/server");
|
|
31
35
|
|
|
32
36
|
// src/functions.ts
|
|
33
37
|
function getEdgeDefinitions(entDefinitions, table) {
|
|
@@ -35,41 +39,41 @@ function getEdgeDefinitions(entDefinitions, table) {
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
// src/deletion.ts
|
|
38
|
-
var vApproach =
|
|
42
|
+
var vApproach = import_values2.v.union(import_values2.v.literal("cascade"), import_values2.v.literal("paginate"));
|
|
39
43
|
function scheduledDeleteFactory(entDefinitions, options) {
|
|
40
|
-
const selfRef = options?.scheduledDelete ?? (0,
|
|
44
|
+
const selfRef = options?.scheduledDelete ?? (0, import_server3.makeFunctionReference)(
|
|
41
45
|
"functions:scheduledDelete"
|
|
42
46
|
);
|
|
43
|
-
return (0,
|
|
47
|
+
return (0, import_server3.internalMutationGeneric)({
|
|
44
48
|
args: {
|
|
45
|
-
origin:
|
|
46
|
-
id:
|
|
47
|
-
table:
|
|
48
|
-
deletionTime:
|
|
49
|
+
origin: import_values2.v.object({
|
|
50
|
+
id: import_values2.v.string(),
|
|
51
|
+
table: import_values2.v.string(),
|
|
52
|
+
deletionTime: import_values2.v.number()
|
|
49
53
|
}),
|
|
50
|
-
stack:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
id:
|
|
54
|
-
table:
|
|
55
|
-
edges:
|
|
56
|
-
|
|
54
|
+
stack: import_values2.v.array(
|
|
55
|
+
import_values2.v.union(
|
|
56
|
+
import_values2.v.object({
|
|
57
|
+
id: import_values2.v.string(),
|
|
58
|
+
table: import_values2.v.string(),
|
|
59
|
+
edges: import_values2.v.array(
|
|
60
|
+
import_values2.v.object({
|
|
57
61
|
approach: vApproach,
|
|
58
|
-
table:
|
|
59
|
-
indexName:
|
|
62
|
+
table: import_values2.v.string(),
|
|
63
|
+
indexName: import_values2.v.string()
|
|
60
64
|
})
|
|
61
65
|
)
|
|
62
66
|
}),
|
|
63
|
-
|
|
67
|
+
import_values2.v.object({
|
|
64
68
|
approach: vApproach,
|
|
65
|
-
cursor:
|
|
66
|
-
table:
|
|
67
|
-
indexName:
|
|
68
|
-
fieldValue:
|
|
69
|
+
cursor: import_values2.v.union(import_values2.v.string(), import_values2.v.null()),
|
|
70
|
+
table: import_values2.v.string(),
|
|
71
|
+
indexName: import_values2.v.string(),
|
|
72
|
+
fieldValue: import_values2.v.any()
|
|
69
73
|
})
|
|
70
74
|
)
|
|
71
75
|
),
|
|
72
|
-
inProgress:
|
|
76
|
+
inProgress: import_values2.v.boolean()
|
|
73
77
|
},
|
|
74
78
|
handler: async (ctx, { origin, stack, inProgress }) => {
|
|
75
79
|
const originId = ctx.db.normalizeId(origin.table, origin.id);
|
|
@@ -259,7 +263,7 @@ async function paginate(ctx, {
|
|
|
259
263
|
isDone = false;
|
|
260
264
|
break;
|
|
261
265
|
}
|
|
262
|
-
const size = JSON.stringify((0,
|
|
266
|
+
const size = JSON.stringify((0, import_values2.convexToJson)(doc)).length * 8;
|
|
263
267
|
results.push(doc);
|
|
264
268
|
bytesRead += size;
|
|
265
269
|
if (bytesRead > maximumBytesRead) {
|