@coderich/autograph 0.13.27 → 0.13.28
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 +1 -1
- package/src/data/Resolver.js +2 -2
- package/src/query/Query.js +8 -2
package/package.json
CHANGED
package/src/data/Resolver.js
CHANGED
|
@@ -300,8 +300,8 @@ module.exports = class Resolver {
|
|
|
300
300
|
return Emitter.emit(`pre${type}`, event).then(async (resultEarly) => {
|
|
301
301
|
if (resultEarly !== undefined) return resultEarly; // Nothing to validate/transform
|
|
302
302
|
// if (query.crud === 'update' && Util.isEqual({ added: {}, updated: {}, deleted: {} }, Util.changeset(query.doc, query.input))) return query.doc;
|
|
303
|
-
const tquery = await $query.transform();
|
|
304
|
-
|
|
303
|
+
const tquery = await $query.transform(false);
|
|
304
|
+
await Emitter.emit('validate', event);
|
|
305
305
|
return thunk(tquery);
|
|
306
306
|
}).then((result) => {
|
|
307
307
|
event.doc ??= result; // Case of create
|
package/src/query/Query.js
CHANGED
|
@@ -62,12 +62,18 @@ module.exports = class Query {
|
|
|
62
62
|
/**
|
|
63
63
|
* Transform entire query via pipeline. At minimum, pipeline is needed to unflatten the data...
|
|
64
64
|
*/
|
|
65
|
-
transform() {
|
|
65
|
+
transform(asClone = true) {
|
|
66
66
|
return Promise.all([
|
|
67
67
|
this.pipeline('input', this.#query.input),
|
|
68
68
|
this.#query.isNative ? this.#query.where : this.pipeline('where', this.#query.where ?? {}),
|
|
69
69
|
this.pipeline('sort', this.#query.sort),
|
|
70
|
-
]).then(([input, where, sort]) =>
|
|
70
|
+
]).then(([input, where, sort]) => {
|
|
71
|
+
if (asClone) return this.clone({ input, where, sort });
|
|
72
|
+
this.#query.input = input;
|
|
73
|
+
this.#query.where = where;
|
|
74
|
+
this.#query.sort = sort;
|
|
75
|
+
return this;
|
|
76
|
+
});
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
/**
|