Socket
Socket
Sign inDemoInstall

@graphql-tools/utils

Package Overview
Dependencies
Maintainers
3
Versions
1273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/utils - npm Package Compare versions

Comparing version 10.5.1 to 10.5.2

57

cjs/getDirectiveExtensions.js

@@ -8,30 +8,39 @@ "use strict";

const directiveExtensions = {};
if (directableObj.astNode?.directives?.length) {
for (const directive of directableObj.astNode.directives) {
const directiveName = directive.name.value;
let existingDirectiveExtensions = directiveExtensions[directiveName];
if (!existingDirectiveExtensions) {
existingDirectiveExtensions = [];
directiveExtensions[directiveName] = existingDirectiveExtensions;
}
const directiveInSchema = schema?.getDirective(directiveName);
let value = {};
if (directiveInSchema) {
value = (0, getArgumentValues_js_1.getArgumentValues)(directiveInSchema, directive);
}
if (directive.arguments) {
for (const argNode of directive.arguments) {
const argName = argNode.name.value;
if (value[argName] == null) {
const argInDirective = directiveInSchema?.args.find(arg => arg.name === argName);
if (argInDirective) {
value[argName] = (0, graphql_1.valueFromAST)(argNode.value, argInDirective.type);
const astNodes = [];
if (directableObj.astNode) {
astNodes.push(directableObj.astNode);
}
if (directableObj.extensionASTNodes) {
astNodes.push(...directableObj.extensionASTNodes);
}
for (const astNode of astNodes) {
if (astNode.directives?.length) {
for (const directive of astNode.directives) {
const directiveName = directive.name.value;
let existingDirectiveExtensions = directiveExtensions[directiveName];
if (!existingDirectiveExtensions) {
existingDirectiveExtensions = [];
directiveExtensions[directiveName] = existingDirectiveExtensions;
}
const directiveInSchema = schema?.getDirective(directiveName);
let value = {};
if (directiveInSchema) {
value = (0, getArgumentValues_js_1.getArgumentValues)(directiveInSchema, directive);
}
if (directive.arguments) {
for (const argNode of directive.arguments) {
const argName = argNode.name.value;
if (value[argName] == null) {
const argInDirective = directiveInSchema?.args.find(arg => arg.name === argName);
if (argInDirective) {
value[argName] = (0, graphql_1.valueFromAST)(argNode.value, argInDirective.type);
}
}
if (value[argName] == null) {
value[argName] = (0, graphql_1.valueFromASTUntyped)(argNode.value);
}
}
if (value[argName] == null) {
value[argName] = (0, graphql_1.valueFromASTUntyped)(argNode.value);
}
}
existingDirectiveExtensions.push(value);
}
existingDirectiveExtensions.push(value);
}

@@ -38,0 +47,0 @@ }

@@ -5,30 +5,39 @@ import { valueFromAST, valueFromASTUntyped } from 'graphql';

const directiveExtensions = {};
if (directableObj.astNode?.directives?.length) {
for (const directive of directableObj.astNode.directives) {
const directiveName = directive.name.value;
let existingDirectiveExtensions = directiveExtensions[directiveName];
if (!existingDirectiveExtensions) {
existingDirectiveExtensions = [];
directiveExtensions[directiveName] = existingDirectiveExtensions;
}
const directiveInSchema = schema?.getDirective(directiveName);
let value = {};
if (directiveInSchema) {
value = getArgumentValues(directiveInSchema, directive);
}
if (directive.arguments) {
for (const argNode of directive.arguments) {
const argName = argNode.name.value;
if (value[argName] == null) {
const argInDirective = directiveInSchema?.args.find(arg => arg.name === argName);
if (argInDirective) {
value[argName] = valueFromAST(argNode.value, argInDirective.type);
const astNodes = [];
if (directableObj.astNode) {
astNodes.push(directableObj.astNode);
}
if (directableObj.extensionASTNodes) {
astNodes.push(...directableObj.extensionASTNodes);
}
for (const astNode of astNodes) {
if (astNode.directives?.length) {
for (const directive of astNode.directives) {
const directiveName = directive.name.value;
let existingDirectiveExtensions = directiveExtensions[directiveName];
if (!existingDirectiveExtensions) {
existingDirectiveExtensions = [];
directiveExtensions[directiveName] = existingDirectiveExtensions;
}
const directiveInSchema = schema?.getDirective(directiveName);
let value = {};
if (directiveInSchema) {
value = getArgumentValues(directiveInSchema, directive);
}
if (directive.arguments) {
for (const argNode of directive.arguments) {
const argName = argNode.name.value;
if (value[argName] == null) {
const argInDirective = directiveInSchema?.args.find(arg => arg.name === argName);
if (argInDirective) {
value[argName] = valueFromAST(argNode.value, argInDirective.type);
}
}
if (value[argName] == null) {
value[argName] = valueFromASTUntyped(argNode.value);
}
}
if (value[argName] == null) {
value[argName] = valueFromASTUntyped(argNode.value);
}
}
existingDirectiveExtensions.push(value);
}
existingDirectiveExtensions.push(value);
}

@@ -35,0 +44,0 @@ }

{
"name": "@graphql-tools/utils",
"version": "10.5.1",
"version": "10.5.2",
"description": "Common package containing utils and types for GraphQL tools",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -7,2 +7,3 @@ import type { ASTNode, DirectiveNode, GraphQLSchema } from 'graphql';

astNode?: DirectableASTNode | null;
extensionASTNodes?: readonly DirectableASTNode[] | null;
extensions?: {

@@ -9,0 +10,0 @@ directives?: Record<string, any>;

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