@graphql-tools/executor-http
Advanced tools
Comparing version 0.0.5 to 0.0.6-alpha-20221207142213-366848a0
@@ -6,3 +6,2 @@ "use strict"; | ||
const graphql_1 = require("graphql"); | ||
const addCancelToResponseStream_js_1 = require("./addCancelToResponseStream.js"); | ||
const isLiveQueryOperationDefinitionNode_js_1 = require("./isLiveQueryOperationDefinitionNode.js"); | ||
@@ -16,2 +15,3 @@ Object.defineProperty(exports, "isLiveQueryOperationDefinitionNode", { enumerable: true, get: function () { return isLiveQueryOperationDefinitionNode_js_1.isLiveQueryOperationDefinitionNode; } }); | ||
const fetch_1 = require("@whatwg-node/fetch"); | ||
const addCancelToResponseStream_js_1 = require("./addCancelToResponseStream.js"); | ||
function buildHTTPExecutor(options) { | ||
@@ -21,3 +21,3 @@ const executor = (request) => { | ||
const fetchFn = (_c = (_b = (_a = request.extensions) === null || _a === void 0 ? void 0 : _a.fetch) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.fetch) !== null && _c !== void 0 ? _c : fetch_1.fetch; | ||
const controller = (0, addCancelToResponseStream_js_1.cancelNeeded)() ? new fetch_1.AbortController() : undefined; | ||
let controller; | ||
let method = ((_d = request.extensions) === null || _d === void 0 ? void 0 : _d.method) || (options === null || options === void 0 ? void 0 : options.method) || 'POST'; | ||
@@ -47,2 +47,3 @@ const operationAst = (0, utils_1.getOperationASTFromRequest)(request); | ||
if (options === null || options === void 0 ? void 0 : options.timeout) { | ||
controller = new fetch_1.AbortController(); | ||
timeoutId = setTimeout(() => { | ||
@@ -54,2 +55,5 @@ if (!(controller === null || controller === void 0 ? void 0 : controller.signal.aborted)) { | ||
} | ||
if (!controller && (0, addCancelToResponseStream_js_1.cancelNeeded)()) { | ||
controller = new fetch_1.AbortController(); | ||
} | ||
return new value_or_promise_1.ValueOrPromise(() => { | ||
@@ -56,0 +60,0 @@ switch (method) { |
import { createGraphQLError, getOperationASTFromRequest, } from '@graphql-tools/utils'; | ||
import { print } from 'graphql'; | ||
import { cancelNeeded } from './addCancelToResponseStream.js'; | ||
import { isLiveQueryOperationDefinitionNode } from './isLiveQueryOperationDefinitionNode.js'; | ||
@@ -11,2 +10,3 @@ import { prepareGETUrl } from './prepareGETUrl.js'; | ||
import { fetch as defaultFetch, AbortController } from '@whatwg-node/fetch'; | ||
import { cancelNeeded } from './addCancelToResponseStream.js'; | ||
export function buildHTTPExecutor(options) { | ||
@@ -16,3 +16,3 @@ const executor = (request) => { | ||
const fetchFn = (_c = (_b = (_a = request.extensions) === null || _a === void 0 ? void 0 : _a.fetch) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.fetch) !== null && _c !== void 0 ? _c : defaultFetch; | ||
const controller = cancelNeeded() ? new AbortController() : undefined; | ||
let controller; | ||
let method = ((_d = request.extensions) === null || _d === void 0 ? void 0 : _d.method) || (options === null || options === void 0 ? void 0 : options.method) || 'POST'; | ||
@@ -42,2 +42,3 @@ const operationAst = getOperationASTFromRequest(request); | ||
if (options === null || options === void 0 ? void 0 : options.timeout) { | ||
controller = new AbortController(); | ||
timeoutId = setTimeout(() => { | ||
@@ -49,2 +50,5 @@ if (!(controller === null || controller === void 0 ? void 0 : controller.signal.aborted)) { | ||
} | ||
if (!controller && cancelNeeded()) { | ||
controller = new AbortController(); | ||
} | ||
return new ValueOrPromise(() => { | ||
@@ -51,0 +55,0 @@ switch (method) { |
{ | ||
"name": "@graphql-tools/executor-http", | ||
"version": "0.0.5", | ||
"version": "0.0.6-alpha-20221207142213-366848a0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,3 +10,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/utils": "9.1.2", | ||
"@graphql-tools/utils": "9.1.3-alpha-20221207142213-366848a0", | ||
"value-or-promise": "1.0.11", | ||
@@ -13,0 +13,0 @@ "@whatwg-node/fetch": "0.5.3", |
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
50901
1039
+ Added@graphql-tools/utils@9.1.3-alpha-20221207142213-366848a0(transitive)
- Removed@graphql-tools/utils@9.1.2(transitive)
Updated@graphql-tools/utils@9.1.3-alpha-20221207142213-366848a0