@graphql-tools/executor 0.0.19 → 0.0.20-alpha-20230425141142-b461e3ff
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/execution/execute.js
CHANGED
|
@@ -224,16 +224,14 @@ function executeOperation(exeContext) {
|
|
|
224
224
|
function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) {
|
|
225
225
|
return (0, utils_1.promiseReduce)(fields, (results, [responseName, fieldNodes]) => {
|
|
226
226
|
const fieldPath = (0, utils_1.addPath)(path, responseName, parentType.name);
|
|
227
|
-
return new value_or_promise_1.ValueOrPromise(() => executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath))
|
|
228
|
-
.then(result => {
|
|
227
|
+
return new value_or_promise_1.ValueOrPromise(() => executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath)).then(result => {
|
|
229
228
|
if (result === undefined) {
|
|
230
229
|
return results;
|
|
231
230
|
}
|
|
232
231
|
results[responseName] = result;
|
|
233
232
|
return results;
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
}, Object.create(null));
|
|
233
|
+
});
|
|
234
|
+
}, Object.create(null)).resolve();
|
|
237
235
|
}
|
|
238
236
|
/**
|
|
239
237
|
* Implements the "Executing selection sets" section of the spec
|
|
@@ -9,13 +9,10 @@ exports.promiseForObject = void 0;
|
|
|
9
9
|
* `Promise.all` so it will work with any implementation of ES6 promises.
|
|
10
10
|
*/
|
|
11
11
|
async function promiseForObject(object) {
|
|
12
|
-
const keys = Object.keys(object);
|
|
13
|
-
const values = Object.values(object);
|
|
14
|
-
const resolvedValues = await Promise.all(values);
|
|
15
12
|
const resolvedObject = Object.create(null);
|
|
16
|
-
|
|
17
|
-
resolvedObject[
|
|
18
|
-
}
|
|
13
|
+
await Promise.all(Object.entries(object).map(async ([key, value]) => {
|
|
14
|
+
resolvedObject[key] = await value;
|
|
15
|
+
}));
|
|
19
16
|
return resolvedObject;
|
|
20
17
|
}
|
|
21
18
|
exports.promiseForObject = promiseForObject;
|
package/esm/execution/execute.js
CHANGED
|
@@ -217,16 +217,14 @@ function executeOperation(exeContext) {
|
|
|
217
217
|
function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) {
|
|
218
218
|
return promiseReduce(fields, (results, [responseName, fieldNodes]) => {
|
|
219
219
|
const fieldPath = addPath(path, responseName, parentType.name);
|
|
220
|
-
return new ValueOrPromise(() => executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath))
|
|
221
|
-
.then(result => {
|
|
220
|
+
return new ValueOrPromise(() => executeField(exeContext, parentType, sourceValue, fieldNodes, fieldPath)).then(result => {
|
|
222
221
|
if (result === undefined) {
|
|
223
222
|
return results;
|
|
224
223
|
}
|
|
225
224
|
results[responseName] = result;
|
|
226
225
|
return results;
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
}, Object.create(null));
|
|
226
|
+
});
|
|
227
|
+
}, Object.create(null)).resolve();
|
|
230
228
|
}
|
|
231
229
|
/**
|
|
232
230
|
* Implements the "Executing selection sets" section of the spec
|
|
@@ -6,12 +6,9 @@
|
|
|
6
6
|
* `Promise.all` so it will work with any implementation of ES6 promises.
|
|
7
7
|
*/
|
|
8
8
|
export async function promiseForObject(object) {
|
|
9
|
-
const keys = Object.keys(object);
|
|
10
|
-
const values = Object.values(object);
|
|
11
|
-
const resolvedValues = await Promise.all(values);
|
|
12
9
|
const resolvedObject = Object.create(null);
|
|
13
|
-
|
|
14
|
-
resolvedObject[
|
|
15
|
-
}
|
|
10
|
+
await Promise.all(Object.entries(object).map(async ([key, value]) => {
|
|
11
|
+
resolvedObject[key] = await value;
|
|
12
|
+
}));
|
|
16
13
|
return resolvedObject;
|
|
17
14
|
}
|