@coderich/autograph 0.13.90 → 0.13.92

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderich/autograph",
3
3
  "main": "index.js",
4
- "version": "0.13.90",
4
+ "version": "0.13.92",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -220,17 +220,18 @@ module.exports = class QueryBuilder {
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];
224
- if (input === undefined) input = {};
225
- if (id !== undefined) input.id = id;
226
- this.#query.args.input = input;
227
- return this.terminate(Object.assign(this.#query, {
228
- op,
229
- key: `${crud}${this.#query.model}`,
230
- crud: ['push', 'pull', 'splice'].includes(crud) ? 'update' : crud,
231
- input,
232
- isMutation: true,
233
- }));
223
+ const key = `${crud}${this.#query.model}`;
224
+ const $crud = ['push', 'pull', 'splice'].includes(crud) ? 'update' : crud;
225
+ let input;
226
+
227
+ if (['create', 'update'].includes($crud)) {
228
+ input = op === 'createMany' ? args : args[0];
229
+ if (input === undefined) input = {};
230
+ if (id !== undefined) input.id = id;
231
+ this.#query.args.input = input;
232
+ }
233
+
234
+ return this.terminate(Object.assign(this.#query, { op, key, crud: $crud, input, isMutation: true }));
234
235
  }
235
236
 
236
237
  #propCheck(prop, ...checks) {
@@ -22,7 +22,7 @@ module.exports = class QueryResolver extends QueryBuilder {
22
22
 
23
23
  terminate() {
24
24
  const query = super.terminate();
25
- const { op, input } = query.toObject();
25
+ const { op, args: { input } } = query.toObject();
26
26
 
27
27
  // Resolve
28
28
  switch (op) {