Skip to content

Commit 0472d78

Browse files
committed
Sofa
1 parent 14dd78d commit 0472d78

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

examples/hello-world/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
/* eslint-disable no-undef */
12
/* eslint-disable @typescript-eslint/no-var-requires */
2-
// eslint-disable-next-line no-undef
33
const { createServer } = require('node:http')
4-
// eslint-disable-next-line no-undef
54
const { createYoga, createSchema } = require('graphql-yoga')
65

76
const yoga = createYoga({

packages/graphql-yoga/src/server.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ export type BatchingOptions =
192192
* Base class that can be extended to create a GraphQL server with any HTTP server framework.
193193
* @internal
194194
*/
195-
export class YogaServer<TServerContext, TUserContext> {
195+
196+
export class YogaServer<
197+
TServerContext extends Record<string, any>,
198+
TUserContext extends Record<string, any>,
199+
> {
196200
/**
197201
* Instance of envelop
198202
*/
@@ -270,11 +274,7 @@ export class YogaServer<TServerContext, TUserContext> {
270274
this.graphqlEndpoint = options?.graphqlEndpoint || '/graphql'
271275
const graphqlEndpoint = this.graphqlEndpoint
272276

273-
const plugins: Plugin<
274-
TUserContext & TServerContext & YogaInitialContext,
275-
TServerContext,
276-
{}
277-
>[] = [
277+
const plugins = [
278278
useEngine({ parse, validate, execute, subscribe, specifiedRules }),
279279
// Use the schema provided by the user
280280
!!options?.schema && useSchema(options.schema),
@@ -377,7 +377,7 @@ export class YogaServer<TServerContext, TUserContext> {
377377
)
378378
},
379379
},
380-
]
380+
] as Plugin[]
381381

382382
this.getEnveloped = envelop({
383383
plugins,
@@ -386,7 +386,7 @@ export class YogaServer<TServerContext, TUserContext> {
386386
this.plugins = this.getEnveloped._plugins as Plugin<
387387
TUserContext & TServerContext & YogaInitialContext,
388388
TServerContext,
389-
{}
389+
TUserContext
390390
>[]
391391

392392
this.onRequestHooks = []

packages/plugins/sofa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"access": "public"
5050
},
5151
"dependencies": {
52-
"sofa-api": "0.12.0"
52+
"sofa-api": "0.14.0"
5353
},
5454
"peerDependencies": {
5555
"graphql": "^15.2.0 || ^16.0.0",

packages/plugins/sofa/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { OpenAPI, useSofa as createSofaHandler } from 'sofa-api'
22
import { Plugin, YogaInitialContext, YogaServerInstance } from 'graphql-yoga'
3-
import { SofaHandler } from './types'
4-
import { getSwaggerUIHTMLForSofa } from './swaggerUI'
3+
import { SofaHandler } from './types.js'
4+
import { getSwaggerUIHTMLForSofa } from './swaggerUI.js'
55

66
export { OpenAPI } from 'sofa-api'
77

pnpm-lock.yaml

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)