@coderich/autograph 0.13.99 → 0.13.100
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 +5 -5
- package/src/schema/Schema.js +1 -1
package/package.json
CHANGED
package/src/data/Resolver.js
CHANGED
|
@@ -72,7 +72,7 @@ module.exports = class Resolver {
|
|
|
72
72
|
* @returns {QueryResolver|QueryResolverTransaction} - An API to build and execute a query
|
|
73
73
|
*/
|
|
74
74
|
match(model) {
|
|
75
|
-
return this.#sessions.
|
|
75
|
+
return this.#sessions.at(-1)?.at(-1)?.match(model) ?? new QueryResolver({
|
|
76
76
|
resolver: this,
|
|
77
77
|
schema: this.#schema,
|
|
78
78
|
context: this.#context,
|
|
@@ -104,8 +104,8 @@ module.exports = class Resolver {
|
|
|
104
104
|
transaction(isolated = true, parent = this) {
|
|
105
105
|
if (isolated) return this.clone().transaction(false, parent);
|
|
106
106
|
|
|
107
|
-
const currSession = this.#sessions.
|
|
108
|
-
const currTransaction = currSession?.
|
|
107
|
+
const currSession = this.#sessions.at(-1);
|
|
108
|
+
const currTransaction = currSession?.at(-1);
|
|
109
109
|
const realTransaction = new Transaction({ resolver: this, schema: this.#schema, context: this.#context });
|
|
110
110
|
const thunks = currTransaction ? currSession.thunks : []; // If in a transaction, piggy back off session
|
|
111
111
|
|
|
@@ -194,7 +194,7 @@ module.exports = class Resolver {
|
|
|
194
194
|
async resolve(query) {
|
|
195
195
|
let thunk;
|
|
196
196
|
const { doc, model, crud, isMutation, flags } = query.toObject();
|
|
197
|
-
const currSession = this.#sessions.
|
|
197
|
+
const currSession = this.#sessions.at(-1);
|
|
198
198
|
|
|
199
199
|
if (isMutation) {
|
|
200
200
|
thunk = tquery => this.#schema.models[model].source.client.resolve(tquery.toDriver().toObject()).then((results) => {
|
|
@@ -336,7 +336,7 @@ module.exports = class Resolver {
|
|
|
336
336
|
query.match = event.args.where;
|
|
337
337
|
query.toObject = () => query;
|
|
338
338
|
event.merged = event.input;
|
|
339
|
-
event.input = event.args?.input;
|
|
339
|
+
event.input = Util.unflatten(event.args?.input, { safe: true });
|
|
340
340
|
event.doc ??= {};
|
|
341
341
|
|
|
342
342
|
return event;
|
package/src/schema/Schema.js
CHANGED
|
@@ -495,7 +495,7 @@ module.exports = class Schema {
|
|
|
495
495
|
|
|
496
496
|
Util.traverse(Object.values($model.fields), (f, info) => {
|
|
497
497
|
const path = info.path.concat(f.name);
|
|
498
|
-
if (f.isEmbedded) return { value: f.model.fields, info: { path } };
|
|
498
|
+
if (f.isEmbedded) return { value: Object.values(f.model.fields), info: { path } };
|
|
499
499
|
if (f.isScalar) $model.ignorePaths.push(path.join('.'));
|
|
500
500
|
return null;
|
|
501
501
|
}, { path: [] });
|