@coderich/autograph 0.13.17 → 0.13.19

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.17",
4
+ "version": "0.13.19",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -209,7 +209,7 @@ module.exports = class Resolver {
209
209
  currSession?.thunks.push(...this.#sessions.map(s => () => s.parent.clear(model)));
210
210
 
211
211
  // Return results
212
- return results;
212
+ return oquery.crud === 'delete' ? oquery.doc : results;
213
213
  });
214
214
  } else {
215
215
  thunk = () => this.#dataLoaders[model].resolve(tquery);
@@ -218,7 +218,7 @@ module.exports = class Resolver {
218
218
  return this.#createSystemEvent(tquery, () => {
219
219
  return thunk().then((result) => {
220
220
  if (oquery.flags?.required && (result == null || result?.length === 0)) throw Boom.notFound();
221
- return this.toResultSet(model, result, tquery.toObject());
221
+ return oquery.crud === 'delete' ? result : this.toResultSet(model, result);
222
222
  });
223
223
  });
224
224
  }
@@ -82,7 +82,7 @@ module.exports = class QueryResolver extends QueryBuilder {
82
82
  case 'deleteOne': {
83
83
  return this.#get(query).then((doc) => {
84
84
  return this.#resolveReferentialIntegrity(query).then(() => {
85
- return this.#resolver.resolve(query).then(() => doc);
85
+ return this.#resolver.resolve(query.clone({ doc })).then(() => doc);
86
86
  });
87
87
  });
88
88
  }