From 8c60508f111f91852ba6331e9c87f70ae5d02891 Mon Sep 17 00:00:00 2001 From: Sean aye Date: Thu, 3 Jun 2021 11:40:38 -0400 Subject: [PATCH] allow for schema transforms --- applyGraphQL.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applyGraphQL.ts b/applyGraphQL.ts index 3994bf2..fdfe7e3 100644 --- a/applyGraphQL.ts +++ b/applyGraphQL.ts @@ -2,6 +2,7 @@ import { graphql, gql } from "./deps.ts"; import { renderPlaygroundPage } from "./graphql-playground-html/render-playground-html.ts"; import { makeExecutableSchema } from "./graphql-tools/schema/makeExecutableSchema.ts"; import { fileUploadMiddleware, GraphQLUpload } from "./fileUpload.ts"; +import { SchemaTransform } from "./graphql-tools/utils/index.ts" interface Constructable { new (...args: any): T & OakRouter; @@ -19,6 +20,7 @@ export interface ApplyGraphQLOptions { resolvers: ResolversProps; context?: (ctx: any) => any; usePlayground?: boolean; + schemaTransforms?: SchemaTransform[] } export interface ResolversProps { @@ -34,6 +36,7 @@ export async function applyGraphQL({ resolvers, context, usePlayground = true, + schemaTransforms = [] }: ApplyGraphQLOptions): Promise { const router = new Router(); @@ -56,6 +59,7 @@ export async function applyGraphQL({ const schema = makeExecutableSchema({ typeDefs: augmentedTypeDefs, resolvers: [resolvers], + schemaTransforms }); await router.post(path, fileUploadMiddleware, async (ctx: any) => {