File tree Expand file tree Collapse file tree 4 files changed +91
-31
lines changed Expand file tree Collapse file tree 4 files changed +91
-31
lines changed Original file line number Diff line number Diff line change 9
9
[libs]
10
10
11
11
[options]
12
+ experimental.const_params=true
Original file line number Diff line number Diff line change @@ -143,17 +143,36 @@ export function execute(
143
143
// Extract arguments from object args if provided.
144
144
const args = arguments . length === 1 ? argsOrSchema : undefined ;
145
145
const schema = args ? args . schema : argsOrSchema ;
146
- if ( args ) {
147
- /* eslint-disable no-param-reassign */
148
- document = args . document ;
149
- rootValue = args . rootValue ;
150
- contextValue = args . contextValue ;
151
- variableValues = args . variableValues ;
152
- operationName = args . operationName ;
153
- fieldResolver = args . fieldResolver ;
154
- /* eslint-enable no-param-reassign, no-redeclare */
155
- }
146
+ return args ?
147
+ executeImpl (
148
+ schema ,
149
+ args . document ,
150
+ args . rootValue ,
151
+ args . contextValue ,
152
+ args . variableValues ,
153
+ args . operationName ,
154
+ args . fieldResolver ,
155
+ ) :
156
+ executeImpl (
157
+ schema ,
158
+ document ,
159
+ rootValue ,
160
+ contextValue ,
161
+ variableValues ,
162
+ operationName ,
163
+ fieldResolver ,
164
+ ) ;
165
+ }
156
166
167
+ function executeImpl(
168
+ schema,
169
+ document,
170
+ rootValue,
171
+ contextValue,
172
+ variableValues,
173
+ operationName,
174
+ fieldResolver
175
+ ) {
157
176
// If arguments are missing or incorrect, throw an error.
158
177
assertValidExecutionArguments (
159
178
schema ,
Original file line number Diff line number Diff line change @@ -77,17 +77,36 @@ export function graphql(
77
77
// Extract arguments from object args if provided.
78
78
const args = arguments . length === 1 ? argsOrSchema : undefined ;
79
79
const schema = args ? args . schema : argsOrSchema ;
80
- if ( args ) {
81
- /* eslint-disable no-param-reassign */
82
- source = args . source ;
83
- rootValue = args . rootValue ;
84
- contextValue = args . contextValue ;
85
- variableValues = args . variableValues ;
86
- operationName = args . operationName ;
87
- fieldResolver = args . fieldResolver ;
88
- /* eslint-enable no-param-reassign, no-redeclare */
89
- }
80
+ return args ?
81
+ graphqlImpl (
82
+ schema ,
83
+ args . source ,
84
+ args . rootValue ,
85
+ args . contextValue ,
86
+ args . variableValues ,
87
+ args . operationName ,
88
+ args . fieldResolver ,
89
+ ) :
90
+ graphqlImpl (
91
+ schema ,
92
+ source ,
93
+ rootValue ,
94
+ contextValue ,
95
+ variableValues ,
96
+ operationName ,
97
+ fieldResolver ,
98
+ ) ;
99
+ }
90
100
101
+ function graphqlImpl(
102
+ schema,
103
+ source,
104
+ rootValue,
105
+ contextValue,
106
+ variableValues,
107
+ operationName,
108
+ fieldResolver
109
+ ) {
91
110
return new Promise ( resolve => {
92
111
// Parse
93
112
let document ;
Original file line number Diff line number Diff line change @@ -73,18 +73,39 @@ export function subscribe(
73
73
// Extract arguments from object args if provided.
74
74
const args = arguments . length === 1 ? argsOrSchema : undefined ;
75
75
const schema = args ? args . schema : argsOrSchema ;
76
- if ( args ) {
77
- /* eslint-disable no-param-reassign */
78
- document = args . document ;
79
- rootValue = args . rootValue ;
80
- contextValue = args . contextValue ;
81
- variableValues = args . variableValues ;
82
- operationName = args . operationName ;
83
- fieldResolver = args . fieldResolver ;
84
- subscribeFieldResolver = args . subscribeFieldResolver ;
85
- /* eslint-enable no-param-reassign, no-redeclare */
86
- }
76
+ return args ?
77
+ subscribeImpl (
78
+ schema ,
79
+ args . document ,
80
+ args . rootValue ,
81
+ args . contextValue ,
82
+ args . variableValues ,
83
+ args . operationName ,
84
+ args . fieldResolver ,
85
+ args . subscribeFieldResolver ,
86
+ ) :
87
+ subscribeImpl (
88
+ schema ,
89
+ document ,
90
+ rootValue ,
91
+ contextValue ,
92
+ variableValues ,
93
+ operationName ,
94
+ fieldResolver ,
95
+ subscribeFieldResolver ,
96
+ ) ;
97
+ }
87
98
99
+ function subscribeImpl(
100
+ schema,
101
+ document,
102
+ rootValue,
103
+ contextValue,
104
+ variableValues,
105
+ operationName,
106
+ fieldResolver,
107
+ subscribeFieldResolver
108
+ ) {
88
109
const subscription = createSourceEventStream (
89
110
schema ,
90
111
document ,
You can’t perform that action at this time.
0 commit comments