@coderich/autograph 0.13.94 → 0.13.96

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.96",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,7 +23,8 @@ module.exports = class Pipeline {
23
23
  return Util.uvl(factory(args), args.value);
24
24
  } catch (e) {
25
25
  const { data = {} } = e;
26
- throw Boom.boomify(e, { data: { ...args, ...data } });
26
+ throw Boom.boomify(e, { data });
27
+ // throw Boom.boomify(e, { data: { ...args, ...data } });
27
28
  }
28
29
  }, 'name', { value: name });
29
30
 
@@ -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
@@ -65,6 +65,7 @@ module.exports = class Query {
65
65
  validate() {
66
66
  const args = { query: this.#query, resolver: this.#resolver, context: this.#context };
67
67
  this.#query.input = this.#model.transformers.validate.transform(this.#query.input, args);
68
+ return this;
68
69
  }
69
70
 
70
71
  /**
@@ -509,7 +509,6 @@ module.exports = class Schema {
509
509
 
510
510
  // Field resolution comes first (unshift)
511
511
  thunks.unshift(($schema) => {
512
- $field.parent = $model;
513
512
  $field.model = $schema.models[$field.type];
514
513
  $field.linkTo = $schema.models[$field.linkTo];
515
514
  $field.crud = Util.uvl($field.crud, $field.model?.scope, 'crud');