@coderich/autograph 0.13.89 → 0.13.90
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/package.json
CHANGED
|
@@ -219,12 +219,13 @@ module.exports = class QueryBuilder {
|
|
|
219
219
|
args = args.flat();
|
|
220
220
|
const { id, limit } = this.#query;
|
|
221
221
|
const suffix = id || limit === 1 || (crud === 'create' && args.length < 2) ? 'One' : 'Many';
|
|
222
|
-
|
|
222
|
+
const op = `${crud}${suffix}`;
|
|
223
|
+
let input = op === 'createMany' ? args : args[0];
|
|
223
224
|
if (input === undefined) input = {};
|
|
224
225
|
if (id !== undefined) input.id = id;
|
|
225
226
|
this.#query.args.input = input;
|
|
226
227
|
return this.terminate(Object.assign(this.#query, {
|
|
227
|
-
op
|
|
228
|
+
op,
|
|
228
229
|
key: `${crud}${this.#query.model}`,
|
|
229
230
|
crud: ['push', 'pull', 'splice'].includes(crud) ? 'update' : crud,
|
|
230
231
|
input,
|
|
@@ -54,7 +54,7 @@ module.exports = class QueryResolver extends QueryBuilder {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
case 'pushMany': {
|
|
57
|
-
const [[key, values]] = Object.entries(input
|
|
57
|
+
const [[key, values]] = Object.entries(input);
|
|
58
58
|
return this.#find(query).then((docs) => {
|
|
59
59
|
return this.#resolver.transaction(false).run(Promise.all(docs.map(doc => this.#resolver.match(this.#model.name).id(doc.id).push(key, values))));
|
|
60
60
|
});
|
|
@@ -72,7 +72,7 @@ module.exports = class QueryResolver extends QueryBuilder {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
case 'pullMany': {
|
|
75
|
-
const [[key, values]] = Object.entries(input
|
|
75
|
+
const [[key, values]] = Object.entries(input);
|
|
76
76
|
return this.#find(query).then((docs) => {
|
|
77
77
|
return this.#resolver.transaction(false).run(Promise.all(docs.map(doc => this.#resolver.match(this.#model.name).id(doc.id).pull(key, values))));
|
|
78
78
|
});
|