@graphql-tools/utils
Advanced tools
Comparing version 10.3.0-alpha-20240702150657-b50b1dda80c0083a63896cdbfd42efdcdf4c0b98 to 10.3.0-alpha-20240702193427-1ce4b1efdef732d2635b657df6273a975a19d217
@@ -62,1 +62,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./debugTimer.js"), exports); | ||
tslib_1.__exportStar(require("./createDeferred.js"), exports); |
@@ -180,7 +180,35 @@ "use strict"; | ||
const finalType = schema.getType(value.__typename); | ||
const { fields: collectedFields } = (0, collectFields_js_1.collectSubFields)(schema, fragments, variableValues, finalType, fieldNodes); | ||
let { fields: collectedFields, patches } = (0, collectFields_js_1.collectSubFields)(schema, fragments, variableValues, finalType, fieldNodes); | ||
if (patches.length) { | ||
collectedFields = new Map(collectedFields); | ||
for (const patch of patches) { | ||
for (const [responseKey, fields] of patch.fields) { | ||
const existingFields = collectedFields.get(responseKey); | ||
if (existingFields) { | ||
existingFields.push(...fields); | ||
} | ||
else { | ||
collectedFields.set(responseKey, fields); | ||
} | ||
} | ||
} | ||
} | ||
return visitObjectValue(value, finalType, collectedFields, schema, fragments, variableValues, resultVisitorMap, pathIndex, errors, errorInfo); | ||
} | ||
else if ((0, graphql_1.isObjectType)(nullableType)) { | ||
const { fields: collectedFields } = (0, collectFields_js_1.collectSubFields)(schema, fragments, variableValues, nullableType, fieldNodes); | ||
let { fields: collectedFields, patches } = (0, collectFields_js_1.collectSubFields)(schema, fragments, variableValues, nullableType, fieldNodes); | ||
if (patches.length) { | ||
collectedFields = new Map(collectedFields); | ||
for (const patch of patches) { | ||
for (const [responseKey, fields] of patch.fields) { | ||
const existingFields = collectedFields.get(responseKey); | ||
if (existingFields) { | ||
existingFields.push(...fields); | ||
} | ||
else { | ||
collectedFields.set(responseKey, fields); | ||
} | ||
} | ||
} | ||
} | ||
return visitObjectValue(value, nullableType, collectedFields, schema, fragments, variableValues, resultVisitorMap, pathIndex, errors, errorInfo); | ||
@@ -187,0 +215,0 @@ } |
@@ -57,1 +57,2 @@ export * from './loaders.js'; | ||
export * from './debugTimer.js'; | ||
export * from './createDeferred.js'; |
@@ -174,7 +174,35 @@ import { getNullableType, isAbstractType, isListType, isObjectType, Kind, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, } from 'graphql'; | ||
const finalType = schema.getType(value.__typename); | ||
const { fields: collectedFields } = collectSubFields(schema, fragments, variableValues, finalType, fieldNodes); | ||
let { fields: collectedFields, patches } = collectSubFields(schema, fragments, variableValues, finalType, fieldNodes); | ||
if (patches.length) { | ||
collectedFields = new Map(collectedFields); | ||
for (const patch of patches) { | ||
for (const [responseKey, fields] of patch.fields) { | ||
const existingFields = collectedFields.get(responseKey); | ||
if (existingFields) { | ||
existingFields.push(...fields); | ||
} | ||
else { | ||
collectedFields.set(responseKey, fields); | ||
} | ||
} | ||
} | ||
} | ||
return visitObjectValue(value, finalType, collectedFields, schema, fragments, variableValues, resultVisitorMap, pathIndex, errors, errorInfo); | ||
} | ||
else if (isObjectType(nullableType)) { | ||
const { fields: collectedFields } = collectSubFields(schema, fragments, variableValues, nullableType, fieldNodes); | ||
let { fields: collectedFields, patches } = collectSubFields(schema, fragments, variableValues, nullableType, fieldNodes); | ||
if (patches.length) { | ||
collectedFields = new Map(collectedFields); | ||
for (const patch of patches) { | ||
for (const [responseKey, fields] of patch.fields) { | ||
const existingFields = collectedFields.get(responseKey); | ||
if (existingFields) { | ||
existingFields.push(...fields); | ||
} | ||
else { | ||
collectedFields.set(responseKey, fields); | ||
} | ||
} | ||
} | ||
} | ||
return visitObjectValue(value, nullableType, collectedFields, schema, fragments, variableValues, resultVisitorMap, pathIndex, errors, errorInfo); | ||
@@ -181,0 +209,0 @@ } |
{ | ||
"name": "@graphql-tools/utils", | ||
"version": "10.3.0-alpha-20240702150657-b50b1dda80c0083a63896cdbfd42efdcdf4c0b98", | ||
"version": "10.3.0-alpha-20240702193427-1ce4b1efdef732d2635b657df6273a975a19d217", | ||
"description": "Common package containing utils and types for GraphQL tools", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -57,1 +57,2 @@ export * from './loaders.js'; | ||
export * from './debugTimer.js'; | ||
export * from './createDeferred.js'; |
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
508893
246
11046