@coderich/autograph 0.13.94 → 0.13.95

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.94",
4
+ "version": "0.13.95",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -300,19 +300,18 @@ module.exports = class Resolver {
300
300
  const tquery = $query.transform(false);
301
301
  const query = tquery.toObject();
302
302
  const type = query.isMutation ? 'Mutation' : 'Query';
303
- let event = this.#createEvent(query);
303
+ const event = this.#createEvent(query);
304
304
 
305
305
  return Emitter.emit(`pre${type}`, event).then(async (resultEarly) => {
306
306
  if (resultEarly !== undefined) return resultEarly; // Nothing to validate/transform
307
307
  // if (query.crud === 'update' && Util.isEqual({ added: {}, updated: {}, deleted: {} }, Util.changeset(query.doc, query.input))) return query.doc;
308
+
308
309
  if (['create', 'update'].includes(query.crud)) {
309
310
  tquery.validate(); // Transformation sets $thunks
310
311
  await Promise.all([...query.input.$thunks]);
311
- event = this.#createEvent(query);
312
312
  await Emitter.emit('validate', event);
313
- } else {
314
- event = this.#createEvent(query);
315
313
  }
314
+
316
315
  return thunk(tquery);
317
316
  }).then((result) => {
318
317
  event.result = result; // backwards compat