@graphql-tools/executor-http 3.5.1 → 3.6.0-rc-ba101919fe16148c95452aa9d387ea45fa958e70

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @graphql-tools/executor-http
2
2
 
3
+ ## 3.6.0-rc-ba101919fe16148c95452aa9d387ea45fa958e70
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [#2717](https://github.com/graphql-hive/gateway/pull/2717) [`cc5870d`](https://github.com/graphql-hive/gateway/commit/cc5870de856effe1e277b79ee2cd87bd046179a2) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Add `deduplicateInflightRequestsPerContext` option to the HTTP executor
9
+
10
+ When `true` (default), inflight requests are deduplicated only within the same `context` object. When `false`, identical requests are deduplicated across different contexts within the same executor.
11
+
12
+ Hive Gateway's HTTP transport sets it to `false` so that identical subgraph requests coming from different clients are deduplicated.
13
+
3
14
  ## 3.5.1
4
15
  ### Patch Changes
5
16
 
package/dist/index.cjs CHANGED
@@ -841,7 +841,7 @@ function buildHTTPExecutor(options) {
841
841
  return runInflightRequest();
842
842
  }
843
843
  let inflightRequests = inflightRequestsWithoutContext;
844
- if (context != null) {
844
+ if (context != null && options?.deduplicateInflightRequestsPerContext !== false) {
845
845
  if (Object(context) !== context) {
846
846
  return runInflightRequest();
847
847
  }
package/dist/index.d.cts CHANGED
@@ -104,11 +104,25 @@ interface HTTPExecutorOptions {
104
104
  *
105
105
  * Requests are deduplicated only within the same executor and the same `context` object,
106
106
  * because the `fetch` implementation receives the `context` and may handle each request
107
- * differently.
107
+ * differently. See `deduplicateInflightRequestsPerContext` to deduplicate across contexts.
108
108
  *
109
109
  * @default true
110
110
  */
111
111
  deduplicateInflightRequests?: boolean;
112
+ /**
113
+ * Whether inflight requests are deduplicated only within the same `context` object.
114
+ *
115
+ * When `false`, identical requests are deduplicated across different contexts within the
116
+ * same executor. Use this only when the `fetch` implementation does not handle requests
117
+ * differently based on the `context`, because the `context` of the first request will be
118
+ * used for all deduplicated requests.
119
+ *
120
+ * Hive Gateway's HTTP transport always sets this to `false` so that identical subgraph
121
+ * requests from different clients are deduplicated.
122
+ *
123
+ * @default true
124
+ */
125
+ deduplicateInflightRequestsPerContext?: boolean;
112
126
  /**
113
127
  * This option allows you to include the response detauls in the result extensions when a request fails.
114
128
  * This can be useful for debugging and error handling purposes, as it provides additional context about the response that led to the error.
package/dist/index.d.ts CHANGED
@@ -104,11 +104,25 @@ interface HTTPExecutorOptions {
104
104
  *
105
105
  * Requests are deduplicated only within the same executor and the same `context` object,
106
106
  * because the `fetch` implementation receives the `context` and may handle each request
107
- * differently.
107
+ * differently. See `deduplicateInflightRequestsPerContext` to deduplicate across contexts.
108
108
  *
109
109
  * @default true
110
110
  */
111
111
  deduplicateInflightRequests?: boolean;
112
+ /**
113
+ * Whether inflight requests are deduplicated only within the same `context` object.
114
+ *
115
+ * When `false`, identical requests are deduplicated across different contexts within the
116
+ * same executor. Use this only when the `fetch` implementation does not handle requests
117
+ * differently based on the `context`, because the `context` of the first request will be
118
+ * used for all deduplicated requests.
119
+ *
120
+ * Hive Gateway's HTTP transport always sets this to `false` so that identical subgraph
121
+ * requests from different clients are deduplicated.
122
+ *
123
+ * @default true
124
+ */
125
+ deduplicateInflightRequestsPerContext?: boolean;
112
126
  /**
113
127
  * This option allows you to include the response detauls in the result extensions when a request fails.
114
128
  * This can be useful for debugging and error handling purposes, as it provides additional context about the response that led to the error.
package/dist/index.js CHANGED
@@ -839,7 +839,7 @@ function buildHTTPExecutor(options) {
839
839
  return runInflightRequest();
840
840
  }
841
841
  let inflightRequests = inflightRequestsWithoutContext;
842
- if (context != null) {
842
+ if (context != null && options?.deduplicateInflightRequestsPerContext !== false) {
843
843
  if (Object(context) !== context) {
844
844
  return runInflightRequest();
845
845
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor-http",
3
- "version": "3.5.1",
3
+ "version": "3.6.0-rc-ba101919fe16148c95452aa9d387ea45fa958e70",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {