@coderich/autograph 0.13.102 → 0.13.103
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 +11 -7
package/package.json
CHANGED
package/src/data/Resolver.js
CHANGED
|
@@ -47,6 +47,7 @@ module.exports = class Resolver {
|
|
|
47
47
|
clone() {
|
|
48
48
|
return new Resolver({
|
|
49
49
|
schema: this.#schema,
|
|
50
|
+
xschema: this.#xschema,
|
|
50
51
|
context: this.#context,
|
|
51
52
|
});
|
|
52
53
|
}
|
|
@@ -141,11 +142,10 @@ module.exports = class Resolver {
|
|
|
141
142
|
* @returns {*} - The promise resolution
|
|
142
143
|
*/
|
|
143
144
|
run(promise) {
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
145
|
+
return this.commit().then(() => promise);
|
|
146
|
+
// return this.commit().then(() => promise).catch((e) => {
|
|
147
|
+
// return this.rollback().then(() => Promise.reject(e));
|
|
148
|
+
// });
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
@@ -308,7 +308,7 @@ module.exports = class Resolver {
|
|
|
308
308
|
const type = query.isMutation ? 'Mutation' : 'Query';
|
|
309
309
|
const event = this.#createEvent(query);
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
const promise = Emitter.emit(`pre${type}`, event).then(async (resultEarly) => {
|
|
312
312
|
if (resultEarly !== undefined) return resultEarly; // Nothing to validate/transform
|
|
313
313
|
// if (query.crud === 'update' && Util.isEqual({ added: {}, updated: {}, deleted: {} }, Util.changeset(query.doc, query.input))) return query.doc;
|
|
314
314
|
|
|
@@ -319,7 +319,9 @@ module.exports = class Resolver {
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
return thunk(tquery);
|
|
322
|
-
})
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
promise.then((result) => {
|
|
323
325
|
event.result = result; // backwards compat
|
|
324
326
|
query.result = result;
|
|
325
327
|
return Emitter.emit(`post${type}`, event);
|
|
@@ -328,6 +330,8 @@ module.exports = class Resolver {
|
|
|
328
330
|
// const { data = {} } = e;
|
|
329
331
|
// throw Boom.boomify(e, { data: { ...event, ...data } });
|
|
330
332
|
});
|
|
333
|
+
|
|
334
|
+
return promise;
|
|
331
335
|
}
|
|
332
336
|
|
|
333
337
|
#createEvent(query) {
|