File tree Expand file tree Collapse file tree 3 files changed +25
-23
lines changed Expand file tree Collapse file tree 3 files changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import type {
11
11
} from '@netlify/functions' ;
12
12
13
13
import { schema } from '../packages/graphiql/test/schema.js' ;
14
+ import { customExecute } from '../packages/graphiql/test/execute.js' ;
14
15
15
16
/**
16
17
* Handler options when using the netlify adapter
@@ -56,4 +57,4 @@ export function createHandler<Context extends OperationContext = undefined>(
56
57
} ;
57
58
}
58
59
59
- export const handler = createHandler ( { schema } ) ;
60
+ export const handler = createHandler ( { schema, execute : customExecute } ) ;
Original file line number Diff line number Diff line change @@ -12,38 +12,17 @@ import { fileURLToPath } from 'node:url';
12
12
import express from 'express' ;
13
13
import { useServer } from 'graphql-ws/lib/use/ws' ;
14
14
import { WebSocketServer } from 'ws' ;
15
- import { execute , experimentalExecuteIncrementally , version } from 'graphql' ;
16
15
import {
17
16
getGraphQLParameters ,
18
17
processRequest ,
19
18
sendResult ,
20
19
} from 'graphql-helix' ; // update when `graphql-http` is upgraded to support multipart requests for incremental delivery https://github.com/graphql/graphiql/pull/3682#discussion_r1715545279
21
20
22
21
import { schema } from './schema.js' ;
22
+ import { customExecute } from './execute.js' ;
23
23
24
24
const app = express ( ) ;
25
25
26
- const customExecute =
27
- parseInt ( version , 10 ) > 16
28
- ? async ( ...args ) => {
29
- const result = await experimentalExecuteIncrementally ( ...args ) ;
30
-
31
- if ( ! ( 'subsequentResults' in result ) ) {
32
- return result ;
33
- }
34
-
35
- const { initialResult, subsequentResults } = result ;
36
- if ( typeof subsequentResults [ Symbol . asyncIterator ] !== 'function' ) {
37
- return result ;
38
- }
39
-
40
- return ( async function * ( ) {
41
- yield initialResult ;
42
- yield * subsequentResults ;
43
- } ) ( ) ;
44
- }
45
- : execute ;
46
-
47
26
async function handler ( req , res ) {
48
27
const request = {
49
28
body : req . body ,
Original file line number Diff line number Diff line change
1
+ import { execute , experimentalExecuteIncrementally , version } from 'graphql' ;
2
+
3
+ export const customExecute =
4
+ parseInt ( version , 10 ) > 16
5
+ ? async ( ...args ) => {
6
+ const result = await experimentalExecuteIncrementally ( ...args ) ;
7
+
8
+ if ( ! ( 'subsequentResults' in result ) ) {
9
+ return result ;
10
+ }
11
+
12
+ const { initialResult, subsequentResults } = result ;
13
+ if ( typeof subsequentResults [ Symbol . asyncIterator ] !== 'function' ) {
14
+ return result ;
15
+ }
16
+
17
+ return ( async function * ( ) {
18
+ yield initialResult ;
19
+ yield * subsequentResults ;
20
+ } ) ( ) ;
21
+ }
22
+ : execute ;
You can’t perform that action at this time.
0 commit comments