@graphql-toolkit/schema-merging
Advanced tools
Comparing version 0.6.8-alpha-a0567ec.0 to 0.6.8-alpha-d7391a9.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const _1 = require("."); | ||
function alreadyExists(arr, other) { | ||
return !!arr.find(v => v.name.value === other.name.value); | ||
} | ||
function mergeEnumValues(first, second) { | ||
const enumValueMap = new Map(); | ||
for (const firstValue of first) { | ||
enumValueMap.set(firstValue.name.value, firstValue); | ||
} | ||
for (const secondValue of second) { | ||
const enumValue = secondValue.name.value; | ||
if (enumValueMap.has(enumValue)) { | ||
const firstValue = enumValueMap.get(enumValue); | ||
firstValue.description = secondValue.description || firstValue.description; | ||
firstValue.directives = _1.mergeDirectives(secondValue.directives, firstValue.directives); | ||
} | ||
else { | ||
enumValueMap.set(enumValue, secondValue); | ||
} | ||
} | ||
return [...enumValueMap.values()]; | ||
return [...second, ...first.filter(d => !alreadyExists(second, d))]; | ||
} | ||
exports.mergeEnumValues = mergeEnumValues; | ||
//# sourceMappingURL=enum-values.js.map |
@@ -34,3 +34,2 @@ "use strict"; | ||
existing['directives'] = directives_1.mergeDirectives(field['directives'], existing['directives'], config); | ||
existing['description'] = field['description'] || existing['description']; | ||
} | ||
@@ -37,0 +36,0 @@ else { |
@@ -1,20 +0,7 @@ | ||
import { mergeDirectives } from '.'; | ||
function alreadyExists(arr, other) { | ||
return !!arr.find(v => v.name.value === other.name.value); | ||
} | ||
export function mergeEnumValues(first, second) { | ||
const enumValueMap = new Map(); | ||
for (const firstValue of first) { | ||
enumValueMap.set(firstValue.name.value, firstValue); | ||
} | ||
for (const secondValue of second) { | ||
const enumValue = secondValue.name.value; | ||
if (enumValueMap.has(enumValue)) { | ||
const firstValue = enumValueMap.get(enumValue); | ||
firstValue.description = secondValue.description || firstValue.description; | ||
firstValue.directives = mergeDirectives(secondValue.directives, firstValue.directives); | ||
} | ||
else { | ||
enumValueMap.set(enumValue, secondValue); | ||
} | ||
} | ||
return [...enumValueMap.values()]; | ||
return [...second, ...first.filter(d => !alreadyExists(second, d))]; | ||
} | ||
//# sourceMappingURL=enum-values.js.map |
@@ -32,3 +32,2 @@ import { extractType, isWrappingTypeNode, isListTypeNode, isNonNullTypeNode, printTypeNode } from './utils'; | ||
existing['directives'] = mergeDirectives(field['directives'], existing['directives'], config); | ||
existing['description'] = field['description'] || existing['description']; | ||
} | ||
@@ -35,0 +34,0 @@ else { |
{ | ||
"name": "@graphql-toolkit/schema-merging", | ||
"version": "0.6.8-alpha-a0567ec.0+a0567ec", | ||
"version": "0.6.8-alpha-d7391a9.3+d7391a9", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -25,10 +25,10 @@ "repository": "git@github.com:dotansimha/graphql-toolkit.git", | ||
"@types/deepmerge": "2.2.0", | ||
"@types/jest": "24.0.21", | ||
"@types/jest": "24.0.22", | ||
"graphql": "14.5.8", | ||
"jest": "24.9.0", | ||
"ts-jest": "24.1.0", | ||
"typescript": "3.6.4" | ||
"typescript": "3.7.2" | ||
}, | ||
"dependencies": { | ||
"@graphql-toolkit/common": "0.6.8-alpha-a0567ec.0+a0567ec", | ||
"@graphql-toolkit/common": "0.6.8-alpha-d7391a9.3+d7391a9", | ||
"@kamilkisiela/graphql-tools": "4.0.6", | ||
@@ -40,3 +40,3 @@ "deepmerge": "4.2.2" | ||
}, | ||
"gitHead": "a0567ec3a48ffc73f84c69a7ecd25732d3c9c650" | ||
"gitHead": "d7391a953f55890c4b87b844f3b0f9557c65a443" | ||
} |
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
197119
2180