@graphql-tools/executor-http
Advanced tools
Comparing version 1.0.1-alpha-20230602225650-ac681a05 to 1.0.1-alpha-20230703105305-7699546f
@@ -7,3 +7,2 @@ "use strict"; | ||
const utils_1 = require("@graphql-tools/utils"); | ||
const merge_1 = require("dset/merge"); | ||
const addCancelToResponseStream_js_1 = require("./addCancelToResponseStream.js"); | ||
@@ -36,27 +35,2 @@ function isIncomingMessage(body) { | ||
const executionResult = {}; | ||
function handleResult(result) { | ||
if (result.path) { | ||
const path = ['data', ...result.path]; | ||
executionResult.data = executionResult.data || {}; | ||
if (result.items) { | ||
for (const item of result.items) { | ||
(0, merge_1.dset)(executionResult, path, item); | ||
} | ||
} | ||
if (result.data) { | ||
(0, merge_1.dset)(executionResult, ['data', ...result.path], result.data); | ||
} | ||
} | ||
else if (result.data) { | ||
executionResult.data = executionResult.data || {}; | ||
Object.assign(executionResult.data, result.data); | ||
} | ||
if (result.errors) { | ||
executionResult.errors = executionResult.errors || []; | ||
executionResult.errors.push(...result.errors); | ||
} | ||
if (result.incremental) { | ||
result.incremental.forEach(handleResult); | ||
} | ||
} | ||
if (asyncIterator == null) { | ||
@@ -67,4 +41,7 @@ return executionResult; | ||
if (part.json) { | ||
const chunk = part.body; | ||
handleResult(chunk); | ||
const incrementalResult = part.body; | ||
(0, utils_1.mergeIncrementalResult)({ | ||
incrementalResult, | ||
executionResult, | ||
}); | ||
return executionResult; | ||
@@ -71,0 +48,0 @@ } |
import { meros as merosIncomingMessage } from 'meros/node'; | ||
import { meros as merosReadableStream } from 'meros/browser'; | ||
import { mapAsyncIterator } from '@graphql-tools/utils'; | ||
import { dset } from 'dset/merge'; | ||
import { mapAsyncIterator, mergeIncrementalResult } from '@graphql-tools/utils'; | ||
import { addCancelToResponseStream } from './addCancelToResponseStream.js'; | ||
@@ -32,27 +31,2 @@ function isIncomingMessage(body) { | ||
const executionResult = {}; | ||
function handleResult(result) { | ||
if (result.path) { | ||
const path = ['data', ...result.path]; | ||
executionResult.data = executionResult.data || {}; | ||
if (result.items) { | ||
for (const item of result.items) { | ||
dset(executionResult, path, item); | ||
} | ||
} | ||
if (result.data) { | ||
dset(executionResult, ['data', ...result.path], result.data); | ||
} | ||
} | ||
else if (result.data) { | ||
executionResult.data = executionResult.data || {}; | ||
Object.assign(executionResult.data, result.data); | ||
} | ||
if (result.errors) { | ||
executionResult.errors = executionResult.errors || []; | ||
executionResult.errors.push(...result.errors); | ||
} | ||
if (result.incremental) { | ||
result.incremental.forEach(handleResult); | ||
} | ||
} | ||
if (asyncIterator == null) { | ||
@@ -63,4 +37,7 @@ return executionResult; | ||
if (part.json) { | ||
const chunk = part.body; | ||
handleResult(chunk); | ||
const incrementalResult = part.body; | ||
mergeIncrementalResult({ | ||
incrementalResult, | ||
executionResult, | ||
}); | ||
return executionResult; | ||
@@ -67,0 +44,0 @@ } |
{ | ||
"name": "@graphql-tools/executor-http", | ||
"version": "1.0.1-alpha-20230602225650-ac681a05", | ||
"version": "1.0.1-alpha-20230703105305-7699546f", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,7 +10,6 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/utils": "^10.0.0", | ||
"@graphql-tools/utils": "10.0.2-alpha-20230703105305-7699546f", | ||
"value-or-promise": "^1.0.12", | ||
"@whatwg-node/fetch": "^0.9.2-rc-20230602215806-47b588a", | ||
"@whatwg-node/fetch": "^0.9.0", | ||
"@repeaterjs/repeater": "^3.0.4", | ||
"dset": "^3.1.2", | ||
"meros": "^1.2.1", | ||
@@ -17,0 +16,0 @@ "extract-files": "^11.0.0", |
8
52896
1100
+ Added@graphql-tools/utils@10.0.2-alpha-20230703105305-7699546f(transitive)
- Removeddset@^3.1.2
- Removed@graphql-tools/utils@10.2.1(transitive)
- Removedcross-inspect@1.0.0(transitive)
Updated@graphql-tools/utils@10.0.2-alpha-20230703105305-7699546f
Updated@whatwg-node/fetch@^0.9.0