@wundergraph/composition
Advanced tools
Comparing version 0.20.1 to 0.20.2
@@ -8,2 +8,3 @@ "use strict"; | ||
const utils_2 = require("../ast/utils"); | ||
const type_merging_1 = require("../schema-building/type-merging"); | ||
function createMultiGraphAndRenameRootTypes(ff, subgraph) { | ||
@@ -23,2 +24,9 @@ let parentData; | ||
const fieldData = (0, utils_1.getOrThrowError)(parentData.fieldDataByFieldName, fieldName, `${parentTypeName}.fieldDataByFieldName`); | ||
const operationType = subgraph.operationTypes.get(fieldData.namedTypeName); | ||
if (operationType) { | ||
const defaultTypeName = (0, utils_1.getOrThrowError)(utils_2.operationTypeNodeToDefaultType, operationType, string_constants_1.OPERATION_TO_DEFAULT); | ||
if (fieldData.namedTypeName !== defaultTypeName) { | ||
(0, type_merging_1.renameNamedTypeName)(fieldData, defaultTypeName, ff.errors); | ||
} | ||
} | ||
if (overriddenFieldNames?.has(fieldName)) { | ||
@@ -25,0 +33,0 @@ // overridden fields should not trigger shareable errors |
import { TypeNode } from 'graphql'; | ||
import { FieldData } from './type-definition-data'; | ||
export type MergedTypeResult = { | ||
@@ -8,1 +9,2 @@ typeErrors?: string[]; | ||
export declare function getMostRestrictiveMergedTypeNode(current: TypeNode, other: TypeNode, hostPath: string, errors: Error[]): MergedTypeResult; | ||
export declare function renameNamedTypeName(fieldData: FieldData, newNamedTypeName: string, errors: Error[]): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMostRestrictiveMergedTypeNode = exports.getLeastRestrictiveMergedTypeNode = void 0; | ||
exports.renameNamedTypeName = exports.getMostRestrictiveMergedTypeNode = exports.getLeastRestrictiveMergedTypeNode = void 0; | ||
const graphql_1 = require("graphql"); | ||
@@ -8,2 +8,3 @@ const errors_1 = require("../errors/errors"); | ||
const constants_1 = require("../utils/constants"); | ||
const utils_1 = require("../ast/utils"); | ||
var DivergentType; | ||
@@ -96,2 +97,17 @@ (function (DivergentType) { | ||
exports.getMostRestrictiveMergedTypeNode = getMostRestrictiveMergedTypeNode; | ||
function renameNamedTypeName(fieldData, newNamedTypeName, errors) { | ||
let typeNode = fieldData.type; | ||
for (let i = 0; i < constants_1.MAXIMUM_TYPE_NESTING; i++) { | ||
if (typeNode.kind === graphql_1.Kind.NAMED_TYPE) { | ||
fieldData.namedTypeName = newNamedTypeName; | ||
typeNode.name = (0, utils_1.stringToNameNode)(newNamedTypeName); | ||
return; | ||
} | ||
typeNode = typeNode.type; | ||
} | ||
// Use a dummy renamed type if the traversal fails | ||
fieldData.type = { kind: graphql_1.Kind.NAMED_TYPE, name: (0, utils_1.stringToNameNode)(newNamedTypeName) }; | ||
errors.push((0, errors_1.maximumTypeNestingExceededError)(`${fieldData.originalParentTypeName}.${fieldData.name}`, constants_1.MAXIMUM_TYPE_NESTING)); | ||
} | ||
exports.renameNamedTypeName = renameNamedTypeName; | ||
//# sourceMappingURL=type-merging.js.map |
{ | ||
"name": "@wundergraph/composition", | ||
"version": "0.20.1", | ||
"version": "0.20.2", | ||
"author": { | ||
@@ -39,3 +39,3 @@ "name": "WunderGraph Maintainers", | ||
}, | ||
"gitHead": "fc3aaba5b38bffc60dfc4b1ca5f46e86eef041be" | ||
"gitHead": "72845be73487daf38cd4117d05980424d6cf1cb7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
836021
9025