@graphql-tools/stitch 10.2.3 → 10.2.4-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a

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,18 @@
1
1
  # @graphql-tools/stitch
2
2
 
3
+ ## 10.2.4-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#2555](https://github.com/graphql-hive/gateway/pull/2555) [`8e3a749`](https://github.com/graphql-hive/gateway/commit/8e3a749008cfbbbaddf5a726e6631941007ebf7a) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Flush deferred merged fields without blocking the initial payload
9
+
10
+ Deferred fields on merged entity types are now delegated when their deferred resolvers run instead of being included in the initial delegation plan. This allows the initial payload to be delivered before slower merged subgraph fields resolve.
11
+ - Updated dependencies [[`8e3a749`](https://github.com/graphql-hive/gateway/commit/8e3a749008cfbbbaddf5a726e6631941007ebf7a)]:
12
+ - @graphql-tools/delegate@12.1.3-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a
13
+ - @graphql-tools/batch-delegate@10.0.31-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a
14
+ - @graphql-tools/wrap@11.1.23-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a
15
+
3
16
  ## 10.2.3
4
17
  ### Patch Changes
5
18
 
package/dist/index.cjs CHANGED
@@ -189,7 +189,7 @@ function resolveOne(value, context, info, stitchingInfo, providedFields) {
189
189
 
190
190
  function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaType, fieldNodes, fragments, variableValues, subschema, providedSelectionNode, context, info) {
191
191
  const sourceSchema = subschema.transformedSchema;
192
- let { fields: subFieldNodesByResponseKey, patches } = utils.collectSubFields(
192
+ let { fields: subFieldNodesByResponseKey } = utils.collectSubFields(
193
193
  schema,
194
194
  fragments,
195
195
  variableValues,
@@ -197,23 +197,6 @@ function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaTy
197
197
  fieldNodes
198
198
  );
199
199
  let mapChanged = false;
200
- if (patches.length) {
201
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
202
- for (const patch of patches) {
203
- for (const [responseKey, fields2] of patch.fields) {
204
- if (!mapChanged) {
205
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
206
- mapChanged = true;
207
- }
208
- const existingSubFieldNodes = subFieldNodesByResponseKey.get(responseKey);
209
- if (existingSubFieldNodes) {
210
- existingSubFieldNodes.push(...fields2);
211
- } else {
212
- subFieldNodesByResponseKey.set(responseKey, fields2);
213
- }
214
- }
215
- }
216
- }
217
200
  const fieldsNotInSchema = /* @__PURE__ */ new Set();
218
201
  if (graphql.isAbstractType(gatewayType)) {
219
202
  fieldsNotInSchema.add({
@@ -224,27 +207,13 @@ function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaTy
224
207
  }
225
208
  });
226
209
  for (const possibleType of schema.getPossibleTypes(gatewayType)) {
227
- const { fields: subFieldNodesOfPossibleType, patches: patches2 } = utils.collectSubFields(
210
+ const { fields: subFieldNodesOfPossibleType } = utils.collectSubFields(
228
211
  schema,
229
212
  fragments,
230
213
  variableValues,
231
214
  possibleType,
232
215
  fieldNodes
233
216
  );
234
- for (const patch of patches2) {
235
- for (const [responseKey, fields2] of patch.fields) {
236
- if (!mapChanged) {
237
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
238
- mapChanged = true;
239
- }
240
- const existingSubFieldNodes = subFieldNodesByResponseKey.get(responseKey);
241
- if (existingSubFieldNodes) {
242
- existingSubFieldNodes.push(...fields2);
243
- } else {
244
- subFieldNodesByResponseKey.set(responseKey, fields2);
245
- }
246
- }
247
- }
248
217
  for (const [responseKey, subFieldNodes] of subFieldNodesOfPossibleType) {
249
218
  if (!mapChanged) {
250
219
  subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
package/dist/index.js CHANGED
@@ -187,7 +187,7 @@ function resolveOne(value, context, info, stitchingInfo, providedFields) {
187
187
 
188
188
  function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaType, fieldNodes, fragments, variableValues, subschema, providedSelectionNode, context, info) {
189
189
  const sourceSchema = subschema.transformedSchema;
190
- let { fields: subFieldNodesByResponseKey, patches } = collectSubFields(
190
+ let { fields: subFieldNodesByResponseKey } = collectSubFields(
191
191
  schema,
192
192
  fragments,
193
193
  variableValues,
@@ -195,23 +195,6 @@ function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaTy
195
195
  fieldNodes
196
196
  );
197
197
  let mapChanged = false;
198
- if (patches.length) {
199
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
200
- for (const patch of patches) {
201
- for (const [responseKey, fields2] of patch.fields) {
202
- if (!mapChanged) {
203
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
204
- mapChanged = true;
205
- }
206
- const existingSubFieldNodes = subFieldNodesByResponseKey.get(responseKey);
207
- if (existingSubFieldNodes) {
208
- existingSubFieldNodes.push(...fields2);
209
- } else {
210
- subFieldNodesByResponseKey.set(responseKey, fields2);
211
- }
212
- }
213
- }
214
- }
215
198
  const fieldsNotInSchema = /* @__PURE__ */ new Set();
216
199
  if (isAbstractType(gatewayType)) {
217
200
  fieldsNotInSchema.add({
@@ -222,27 +205,13 @@ function getFieldsNotInSubschema(schema, stitchingInfo, gatewayType, subschemaTy
222
205
  }
223
206
  });
224
207
  for (const possibleType of schema.getPossibleTypes(gatewayType)) {
225
- const { fields: subFieldNodesOfPossibleType, patches: patches2 } = collectSubFields(
208
+ const { fields: subFieldNodesOfPossibleType } = collectSubFields(
226
209
  schema,
227
210
  fragments,
228
211
  variableValues,
229
212
  possibleType,
230
213
  fieldNodes
231
214
  );
232
- for (const patch of patches2) {
233
- for (const [responseKey, fields2] of patch.fields) {
234
- if (!mapChanged) {
235
- subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
236
- mapChanged = true;
237
- }
238
- const existingSubFieldNodes = subFieldNodesByResponseKey.get(responseKey);
239
- if (existingSubFieldNodes) {
240
- existingSubFieldNodes.push(...fields2);
241
- } else {
242
- subFieldNodesByResponseKey.set(responseKey, fields2);
243
- }
244
- }
245
- }
246
215
  for (const [responseKey, subFieldNodes] of subFieldNodesOfPossibleType) {
247
216
  if (!mapChanged) {
248
217
  subFieldNodesByResponseKey = new Map(subFieldNodesByResponseKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/stitch",
3
- "version": "10.2.3",
3
+ "version": "10.2.4-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {
@@ -38,13 +38,13 @@
38
38
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@graphql-tools/batch-delegate": "^10.0.30",
42
- "@graphql-tools/delegate": "^12.1.2",
41
+ "@graphql-tools/batch-delegate": "10.0.31-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a",
42
+ "@graphql-tools/delegate": "12.1.3-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a",
43
43
  "@graphql-tools/executor": "^1.4.13",
44
44
  "@graphql-tools/merge": "^9.1.5",
45
45
  "@graphql-tools/schema": "^10.0.29",
46
46
  "@graphql-tools/utils": "^11.0.0",
47
- "@graphql-tools/wrap": "^11.1.22",
47
+ "@graphql-tools/wrap": "11.1.23-alpha-8e3a749008cfbbbaddf5a726e6631941007ebf7a",
48
48
  "@whatwg-node/promise-helpers": "^1.3.2",
49
49
  "tslib": "^2.8.1"
50
50
  },