|
1 | | -import { createYoga } from "graphql-yoga"; |
| 1 | +import { |
| 2 | + type YogaServerOptions, |
| 3 | + createYoga as nativeCreateYoga, |
| 4 | +} from "graphql-yoga"; |
2 | 5 | import { createAbilityBuilder } from "./abilityBuilder"; |
3 | 6 | import { createContextFunction } from "./context"; |
4 | 7 | import { createObjectImplementer } from "./object"; |
@@ -88,9 +91,13 @@ export const rumble = < |
88 | 91 | makePubSubInstance, |
89 | 92 | }); |
90 | 93 |
|
91 | | - const yoga = () => |
92 | | - createYoga<RequestEvent>({ |
93 | | - ...rumbleInput.nativeServerOptions, |
| 94 | + const createYoga = ( |
| 95 | + args: |
| 96 | + | Omit<YogaServerOptions<RequestEvent, any>, "schema" | "context"> |
| 97 | + | undefined, |
| 98 | + ) => |
| 99 | + nativeCreateYoga<RequestEvent>({ |
| 100 | + ...args, |
94 | 101 | schema: schemaBuilder.toSchema(), |
95 | 102 | context, |
96 | 103 | }); |
@@ -118,19 +125,19 @@ export const rumble = < |
118 | 125 | */ |
119 | 126 | schemaBuilder, |
120 | 127 | /** |
121 | | - * The native yoga instance. Can be used to run an actual HTTP server. |
| 128 | + * Creates the native yoga instance. Can be used to run an actual HTTP server. |
122 | 129 | * |
123 | 130 | * @example |
124 | 131 | * |
125 | 132 | * ```ts |
126 | 133 | import { createServer } from "node:http"; |
127 | | - * const server = createServer(yoga()); |
| 134 | + * const server = createServer(createYoga()); |
128 | 135 | server.listen(3000, () => { |
129 | 136 | console.info("Visit http://localhost:3000/graphql"); |
130 | 137 | }); |
131 | 138 | * ``` |
132 | 139 | */ |
133 | | - yoga, |
| 140 | + createYoga, |
134 | 141 | /** |
135 | 142 | * A function for creating default objects for your schema |
136 | 143 | */ |
|
0 commit comments