@graphql-tools/executor-http
Advanced tools
Comparing version 1.1.10-alpha-abea9bd8412c9792fca736f8ec86ab064517f224 to 1.1.10-alpha-aca8226f5009130ae3371b2e10a2e88555fb41f5
# @graphql-tools/executor-http | ||
## 1.1.10-alpha-abea9bd8412c9792fca736f8ec86ab064517f224 | ||
## 1.1.10-alpha-aca8226f5009130ae3371b2e10a2e88555fb41f5 | ||
### Patch Changes | ||
- [#98](https://github.com/graphql-hive/gateway/pull/98) [`3290cdd`](https://github.com/graphql-hive/gateway/commit/3290cdd564ea51739556154472c01ac921f2f91d) Thanks [@ardatan](https://github.com/ardatan)! - Bun support by using native Bun API whenever possible | ||
- [#164](https://github.com/graphql-hive/gateway/pull/164) [`310613d`](https://github.com/graphql-hive/gateway/commit/310613d68d1df3e2bceafbd0730084a4c83527bf) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates: | ||
- Updated dependency [`@graphql-tools/utils@^10.6.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.6.0) (from `^10.5.6`, in `dependencies`) | ||
- [#98](https://github.com/graphql-hive/gateway/pull/98) [`697308d`](https://github.com/graphql-hive/gateway/commit/697308df3b2dd96f28dc65a5f5361a911077e022) Thanks [@ardatan](https://github.com/ardatan)! - Bun support by using native Bun API whenever possible | ||
## 1.1.9 | ||
@@ -10,0 +14,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { isAsyncIterable, isPromise, inspect, mapAsyncIterator, mergeIncrementalResult, memoize1, getOperationASTFromRequest, createGraphQLError } from '@graphql-tools/utils'; | ||
import { isAsyncIterable, isPromise, fakePromise, inspect, mapAsyncIterator, mergeIncrementalResult, memoize1, getOperationASTFromRequest, mapMaybePromise, createGraphQLError } from '@graphql-tools/utils'; | ||
import { File, FormData, TextDecoder, fetch } from '@whatwg-node/fetch'; | ||
@@ -73,3 +73,3 @@ import { ValueOrPromise } from 'value-or-promise'; | ||
const chunks = []; | ||
return Promise.resolve().then(async () => { | ||
return fakePromise(void 0).then(async () => { | ||
for await (const chunk of stream) { | ||
@@ -92,7 +92,14 @@ if (chunk) { | ||
} | ||
return ValueOrPromise.all( | ||
uploads.map( | ||
(upload, i) => new ValueOrPromise(() => handleUpload(upload, i)) | ||
) | ||
).then(() => form).resolve(); | ||
const jobs = []; | ||
for (const i in uploads) { | ||
const upload = uploads[i]; | ||
const job = handleUpload(upload, Number(i)); | ||
if (isPromise(job)) { | ||
jobs.push(job); | ||
} | ||
} | ||
if (jobs.length > 0) { | ||
return Promise.all(jobs).then(() => form); | ||
} | ||
return form; | ||
} | ||
@@ -319,28 +326,29 @@ function isBlob(obj) { | ||
upstreamErrorExtensions.request.body = body; | ||
return new ValueOrPromise( | ||
() => createFormDataFromVariables(body, { | ||
return mapMaybePromise( | ||
createFormDataFromVariables(body, { | ||
File: options?.File, | ||
FormData: options?.FormData | ||
}) | ||
).then((body2) => { | ||
if (typeof body2 === "string" && !headers["content-type"]) { | ||
upstreamErrorExtensions.request.body = body2; | ||
headers["content-type"] = "application/json"; | ||
}), | ||
(body2) => { | ||
if (typeof body2 === "string" && !headers["content-type"]) { | ||
upstreamErrorExtensions.request.body = body2; | ||
headers["content-type"] = "application/json"; | ||
} | ||
const fetchOptions = { | ||
method: "POST", | ||
body: body2, | ||
headers, | ||
signal | ||
}; | ||
if (options?.credentials != null) { | ||
fetchOptions.credentials = options.credentials; | ||
} | ||
return fetchFn( | ||
endpoint, | ||
fetchOptions, | ||
request.context, | ||
request.info | ||
); | ||
} | ||
const fetchOptions = { | ||
method: "POST", | ||
body: body2, | ||
headers, | ||
signal | ||
}; | ||
if (options?.credentials != null) { | ||
fetchOptions.credentials = options.credentials; | ||
} | ||
return fetchFn( | ||
endpoint, | ||
fetchOptions, | ||
request.context, | ||
request.info | ||
); | ||
}).resolve(); | ||
); | ||
} | ||
@@ -464,3 +472,3 @@ } | ||
} | ||
return new ValueOrPromise(() => baseExecutor(request)).then((res) => { | ||
return mapMaybePromise(baseExecutor(request), (res) => { | ||
result = res; | ||
@@ -471,3 +479,3 @@ if (result?.errors?.length) { | ||
return result; | ||
}).resolve(); | ||
}); | ||
} | ||
@@ -474,0 +482,0 @@ return retryAttempt(); |
{ | ||
"name": "@graphql-tools/executor-http", | ||
"version": "1.1.10-alpha-abea9bd8412c9792fca736f8ec86ab064517f224", | ||
"version": "1.1.10-alpha-aca8226f5009130ae3371b2e10a2e88555fb41f5", | ||
"type": "module", | ||
@@ -42,3 +42,3 @@ "description": "A set of utils for faster development of GraphQL tools", | ||
"dependencies": { | ||
"@graphql-tools/utils": "^10.5.6", | ||
"@graphql-tools/utils": "^10.6.0", | ||
"@repeaterjs/repeater": "^3.0.4", | ||
@@ -45,0 +45,0 @@ "@whatwg-node/fetch": "^0.10.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62823
1191
Updated@graphql-tools/utils@^10.6.0