From f3f5f3188804197056d34f65f6366e315d27180b Mon Sep 17 00:00:00 2001 From: Ilya Semenov Date: Fri, 21 Jun 2024 11:13:42 +0700 Subject: [PATCH] Type graph resolve result as Promise instead of Query --- .changeset/selfish-drinks-flow.md | 6 ++++++ packages/graphql-orm/src/resolvers/graph.ts | 4 ++-- packages/objection-graphql-resolver/src/resolvers/graph.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/selfish-drinks-flow.md diff --git a/.changeset/selfish-drinks-flow.md b/.changeset/selfish-drinks-flow.md new file mode 100644 index 0000000..e2995e9 --- /dev/null +++ b/.changeset/selfish-drinks-flow.md @@ -0,0 +1,6 @@ +--- +"objection-graphql-resolver": minor +"graphql-orm": minor +--- + +Type graph resolve result as `Promise` instead of `Query`. diff --git a/packages/graphql-orm/src/resolvers/graph.ts b/packages/graphql-orm/src/resolvers/graph.ts index 871369e..a2abfa8 100644 --- a/packages/graphql-orm/src/resolvers/graph.ts +++ b/packages/graphql-orm/src/resolvers/graph.ts @@ -33,10 +33,10 @@ export class GraphResolver { readonly options: GraphResolverOptions = {}, ) {} - resolve( + resolve( query: Orm["Query"], { info, ...context }: GraphResolveOptions, - ) { + ): Promise { const tree = this._get_resolve_tree(info) return this._resolve_type(query, { ...context, tree }) } diff --git a/packages/objection-graphql-resolver/src/resolvers/graph.ts b/packages/objection-graphql-resolver/src/resolvers/graph.ts index 7da0b5c..a640b52 100644 --- a/packages/objection-graphql-resolver/src/resolvers/graph.ts +++ b/packages/objection-graphql-resolver/src/resolvers/graph.ts @@ -30,8 +30,8 @@ class ObjectionGraphResolver extends GraphResolver< resolve( query: Query, options: GraphResolveOptions, - ): Query { - return super.resolve(query, options) as Query + ): Promise { + return super.resolve(query, options) } resolvePage>(