Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/merge

Package Overview
Dependencies
Maintainers
3
Versions
1122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/merge - npm Package Compare versions

Comparing version 6.0.0-alpha.1 to 6.0.0-alpha.2

47

index.cjs.js

@@ -814,2 +814,5 @@ 'use strict';

function applyExtensionObject(obj, extensions) {
if (!obj) {
return;
}
obj.extensions = [obj.extensions || {}, extensions || {}].reduce(utils.mergeDeep, {});

@@ -821,22 +824,26 @@ }

const type = schema.getType(typeName);
applyExtensionObject(type, data.extensions);
if (data.type === 'object' || data.type === 'interface') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
for (const [arg, argData] of Object.entries(fieldData.arguments)) {
applyExtensionObject(field.args.find(a => a.name === arg), argData);
if (type) {
applyExtensionObject(type, data.extensions);
if (data.type === 'object' || data.type === 'interface') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
if (field) {
applyExtensionObject(field, fieldData.extensions);
for (const [arg, argData] of Object.entries(fieldData.arguments)) {
applyExtensionObject(field.args.find(a => a.name === arg), argData);
}
}
}
}
}
else if (data.type === 'input') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
else if (data.type === 'input') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
}
}
}
else if (data.type === 'enum') {
for (const [valueName, valueData] of Object.entries(data.values)) {
const value = type.getValue(valueName);
applyExtensionObject(value, valueData);
else if (data.type === 'enum') {
for (const [valueName, valueData] of Object.entries(data.values)) {
const value = type.getValue(valueName);
applyExtensionObject(value, valueData);
}
}

@@ -912,6 +919,6 @@ }

function makeSchema({ resolvers, typeDefs, extensions, }, config) {
const schema$1 = typeof typeDefs === 'string' ? graphql.buildSchema(typeDefs, config) : graphql.buildASTSchema(typeDefs, config);
let schema$1 = typeof typeDefs === 'string' ? graphql.buildSchema(typeDefs, config) : graphql.buildASTSchema(typeDefs, config);
// add resolvers
if (resolvers) {
schema.addResolversToSchema({
schema$1 = schema.addResolversToSchema({
schema: schema$1,

@@ -927,3 +934,3 @@ resolvers,

if (config.logger) {
schema.addErrorLoggingToSchema(schema$1, config.logger);
schema$1 = schema.addErrorLoggingToSchema(schema$1, config.logger);
}

@@ -930,0 +937,0 @@ // use schema directives

@@ -810,2 +810,5 @@ import { mergeDeep, compareNodes, isNotEqual, printSchemaWithDirectives, createSchemaDefinition, asArray, getResolversFromSchema, SchemaDirectiveVisitor } from '@graphql-tools/utils';

function applyExtensionObject(obj, extensions) {
if (!obj) {
return;
}
obj.extensions = [obj.extensions || {}, extensions || {}].reduce(mergeDeep, {});

@@ -817,22 +820,26 @@ }

const type = schema.getType(typeName);
applyExtensionObject(type, data.extensions);
if (data.type === 'object' || data.type === 'interface') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
for (const [arg, argData] of Object.entries(fieldData.arguments)) {
applyExtensionObject(field.args.find(a => a.name === arg), argData);
if (type) {
applyExtensionObject(type, data.extensions);
if (data.type === 'object' || data.type === 'interface') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
if (field) {
applyExtensionObject(field, fieldData.extensions);
for (const [arg, argData] of Object.entries(fieldData.arguments)) {
applyExtensionObject(field.args.find(a => a.name === arg), argData);
}
}
}
}
}
else if (data.type === 'input') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
else if (data.type === 'input') {
for (const [fieldName, fieldData] of Object.entries(data.fields)) {
const field = type.getFields()[fieldName];
applyExtensionObject(field, fieldData.extensions);
}
}
}
else if (data.type === 'enum') {
for (const [valueName, valueData] of Object.entries(data.values)) {
const value = type.getValue(valueName);
applyExtensionObject(value, valueData);
else if (data.type === 'enum') {
for (const [valueName, valueData] of Object.entries(data.values)) {
const value = type.getValue(valueName);
applyExtensionObject(value, valueData);
}
}

@@ -908,6 +915,6 @@ }

function makeSchema({ resolvers, typeDefs, extensions, }, config) {
const schema = typeof typeDefs === 'string' ? buildSchema(typeDefs, config) : buildASTSchema(typeDefs, config);
let schema = typeof typeDefs === 'string' ? buildSchema(typeDefs, config) : buildASTSchema(typeDefs, config);
// add resolvers
if (resolvers) {
addResolversToSchema({
schema = addResolversToSchema({
schema,

@@ -923,3 +930,3 @@ resolvers,

if (config.logger) {
addErrorLoggingToSchema(schema, config.logger);
schema = addErrorLoggingToSchema(schema, config.logger);
}

@@ -926,0 +933,0 @@ // use schema directives

{
"name": "@graphql-tools/merge",
"version": "6.0.0-alpha.1",
"version": "6.0.0-alpha.2",
"description": "A set of utils for faster development of GraphQL tools",

@@ -9,5 +9,5 @@ "peerDependencies": {

"dependencies": {
"@graphql-tools/schema": "6.0.0-alpha.1",
"@graphql-tools/utils": "6.0.0-alpha.1",
"tslib": "1.11.1"
"@graphql-tools/schema": "6.0.0-alpha.2",
"@graphql-tools/utils": "6.0.0-alpha.2",
"tslib": "~2.0.0"
},

@@ -14,0 +14,0 @@ "repository": "git@github.com:ardatan/graphql-tools.git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc