@graphql-toolkit/schema-merging
Advanced tools
Comparing version 0.6.8-alpha-0aec269.1 to 0.6.8-alpha-0fa63c6.8
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function alreadyExists(arr, other) { | ||
return !!arr.find(v => v.name.value === other.name.value); | ||
} | ||
const _1 = require("."); | ||
function mergeEnumValues(first, second) { | ||
return [...second, ...first.filter(d => !alreadyExists(second, d))]; | ||
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()]; | ||
} | ||
exports.mergeEnumValues = mergeEnumValues; | ||
//# sourceMappingURL=enum-values.js.map |
@@ -34,2 +34,3 @@ "use strict"; | ||
existing['directives'] = directives_1.mergeDirectives(field['directives'], existing['directives'], config); | ||
existing['description'] = field['description'] || existing['description']; | ||
} | ||
@@ -36,0 +37,0 @@ else { |
@@ -1,7 +0,20 @@ | ||
function alreadyExists(arr, other) { | ||
return !!arr.find(v => v.name.value === other.name.value); | ||
} | ||
import { mergeDirectives } from '.'; | ||
export function mergeEnumValues(first, second) { | ||
return [...second, ...first.filter(d => !alreadyExists(second, d))]; | ||
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()]; | ||
} | ||
//# sourceMappingURL=enum-values.js.map |
@@ -32,2 +32,3 @@ import { extractType, isWrappingTypeNode, isListTypeNode, isNonNullTypeNode, printTypeNode } from './utils'; | ||
existing['directives'] = mergeDirectives(field['directives'], existing['directives'], config); | ||
existing['description'] = field['description'] || existing['description']; | ||
} | ||
@@ -34,0 +35,0 @@ else { |
{ | ||
"name": "@graphql-toolkit/schema-merging", | ||
"version": "0.6.8-alpha-0aec269.1+0aec269", | ||
"version": "0.6.8-alpha-0fa63c6.8+0fa63c6", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -25,3 +25,3 @@ "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", | ||
@@ -33,5 +33,6 @@ "jest": "24.9.0", | ||
"dependencies": { | ||
"@graphql-toolkit/common": "0.6.8-alpha-0aec269.1+0aec269", | ||
"@graphql-toolkit/common": "0.6.8-alpha-0fa63c6.8+0fa63c6", | ||
"@kamilkisiela/graphql-tools": "4.0.6", | ||
"deepmerge": "4.2.2" | ||
"deepmerge": "4.2.2", | ||
"tslib": "1.10.0" | ||
}, | ||
@@ -41,3 +42,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "0aec269a77e1dd82cfaa778f92766ec79f019717" | ||
"gitHead": "0fa63c6dfa82e8aaab5850752a44a2883f3b3379" | ||
} |
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
199360
2208
5
+ Addedtslib@1.10.0
+ Addedtslib@1.10.0(transitive)
- Removedtslib@1.14.1(transitive)
Updated@graphql-toolkit/common@0.6.8-alpha-0fa63c6.8+0fa63c6