@coderich/autograph 0.13.93 → 0.13.94

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.93",
4
+ "version": "0.13.94",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -12,7 +12,8 @@
12
12
  "scripts": {
13
13
  "test": "NODE_OPTIONS=\"--stack-trace-limit=1000\" jest --config=jest.config.js",
14
14
  "lint": "eslint ./",
15
- "dev": "coderich-dev"
15
+ "dev": "coderich-dev",
16
+ "clinic": "clinic flame -- node ./test/server"
16
17
  },
17
18
  "dependencies": {
18
19
  "@coderich/util": "1.2.1",
@@ -35,6 +36,7 @@
35
36
  "@coderich/autograph-db-tests": "*",
36
37
  "@coderich/autograph-mongodb": "*",
37
38
  "@graphql-tools/schema": "10.0.0",
39
+ "clinic": "13.0.0",
38
40
  "graphql": "16.8.1",
39
41
  "mongodb": "5.9.2",
40
42
  "mongodb-memory-server": "8.13.0"
@@ -297,16 +297,14 @@ module.exports = class Resolver {
297
297
  }
298
298
 
299
299
  #createSystemEvent($query, thunk = () => {}) {
300
- let tquery = $query.transform(false);
301
- let query = tquery.toObject();
300
+ const tquery = $query.transform(false);
301
+ const query = tquery.toObject();
302
302
  const type = query.isMutation ? 'Mutation' : 'Query';
303
303
  let 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
- tquery = $query.transform(false);
309
- query = tquery.toObject();
310
308
  if (['create', 'update'].includes(query.crud)) {
311
309
  tquery.validate(); // Transformation sets $thunks
312
310
  await Promise.all([...query.input.$thunks]);
@@ -331,7 +329,7 @@ module.exports = class Resolver {
331
329
 
332
330
  // Backwards compat
333
331
  Object.assign(event, query);
334
- query.match = query.where;
332
+ query.match = event.args.where;
335
333
  query.toObject = () => query;
336
334
  event.merged = event.input;
337
335
  event.input = event.args?.input;
@@ -17,7 +17,7 @@ module.exports = class Transformer {
17
17
  const result = this.#config.shape[prop].reduce((value, t) => {
18
18
  previousValue = value;
19
19
  if (typeof t === 'function') return Util.uvl(t({ startValue, value, ...this.#config.args }), value);
20
- prop = t;
20
+ prop = t; // rename key
21
21
  return value;
22
22
  }, startValue);
23
23