@openinc/parse-server-opendash 4.8.6 → 4.8.7
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.
|
@@ -97,13 +97,27 @@ async function relationObjects(owner, field, batchSize = 500) {
|
|
|
97
97
|
const out = [];
|
|
98
98
|
let skip = 0;
|
|
99
99
|
for (;;) {
|
|
100
|
-
|
|
100
|
+
// Not `stableOrder`: a relation query sorted by `createdAt` makes Parse
|
|
101
|
+
// page the *join table* instead of the objects
|
|
102
|
+
// (`DatabaseController.relatedIds`), while this loop advances by the
|
|
103
|
+
// objects that came back. A join row whose object is gone — v1 deleted
|
|
104
|
+
// steps and media without unlinking them — then shifts every later page
|
|
105
|
+
// and repeats objects: the first customer run wrote a template with one
|
|
106
|
+
// step twice. `objectId` alone is unique and keeps paging on the objects.
|
|
107
|
+
const page = await relation
|
|
108
|
+
.query()
|
|
109
|
+
.limit(batchSize)
|
|
110
|
+
.skip(skip)
|
|
111
|
+
.ascending("objectId")
|
|
112
|
+
.find(env_js_1.MK);
|
|
101
113
|
if (page.length === 0)
|
|
102
114
|
break;
|
|
103
115
|
out.push(...page);
|
|
104
116
|
skip += page.length;
|
|
105
117
|
}
|
|
106
|
-
|
|
118
|
+
// Insert order for the callers, restored in memory.
|
|
119
|
+
return out.sort((a, b) => (a.createdAt?.getTime() ?? 0) - (b.createdAt?.getTime() ?? 0) ||
|
|
120
|
+
(a.id ?? "").localeCompare(b.id ?? ""));
|
|
107
121
|
}
|
|
108
122
|
/** The objectIds of a relation, read completely. */
|
|
109
123
|
async function relationIds(owner, field, batchSize = 500) {
|
|
@@ -45,7 +45,8 @@ export interface Pass {
|
|
|
45
45
|
* order ties differently on every query. With `skip` paging that returns a row on
|
|
46
46
|
* two pages and silently drops another — the first customer dry run did exactly
|
|
47
47
|
* that: pass 10 "updated" 4 comments with an empty map, i.e. saw 4 twice and
|
|
48
|
-
* missed 4. Every paging loop
|
|
48
|
+
* missed 4. Every paging loop over a class uses the same {@link STABLE_ORDER};
|
|
49
|
+
* relation queries must not — see `relationObjects`.
|
|
49
50
|
*/
|
|
50
51
|
export declare function pages<T extends Parse.Object>(build: () => Parse.Query<T>, batchSize: number): AsyncGenerator<T[]>;
|
|
51
52
|
/** Insert order with a unique tie-breaker — the only safe order to `skip` over. */
|
|
@@ -34,7 +34,8 @@ const env_js_1 = require("./env.js");
|
|
|
34
34
|
* order ties differently on every query. With `skip` paging that returns a row on
|
|
35
35
|
* two pages and silently drops another — the first customer dry run did exactly
|
|
36
36
|
* that: pass 10 "updated" 4 comments with an empty map, i.e. saw 4 twice and
|
|
37
|
-
* missed 4. Every paging loop
|
|
37
|
+
* missed 4. Every paging loop over a class uses the same {@link STABLE_ORDER};
|
|
38
|
+
* relation queries must not — see `relationObjects`.
|
|
38
39
|
*/
|
|
39
40
|
async function* pages(build, batchSize) {
|
|
40
41
|
let skip = 0;
|
|
@@ -218,6 +218,10 @@ exports.pass16 = {
|
|
|
218
218
|
updatedAt: row.updatedAt,
|
|
219
219
|
});
|
|
220
220
|
configIds.set(context, id);
|
|
221
|
+
// A step met twice in one run must update, not create a second config.
|
|
222
|
+
if (!existing) {
|
|
223
|
+
existingConfigs.set(context, new index_js_1.Meta_Config({ objectId: id }));
|
|
224
|
+
}
|
|
221
225
|
existing ? entry.updated++ : entry.created++;
|
|
222
226
|
configsWritten += 1;
|
|
223
227
|
}
|