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

@graphql-tools/delegate

Package Overview
Dependencies
Maintainers
3
Versions
1525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/delegate - npm Package Compare versions

Comparing version 10.0.15 to 10.0.16-rc-20240723153759-69d33f9c6ca6f55b0be47636e2bd24aafec03c04

21

cjs/finalizeGatewayRequest.js

@@ -5,2 +5,3 @@ "use strict";

const graphql_1 = require("graphql");
const executor_1 = require("@graphql-tools/executor");
const utils_1 = require("@graphql-tools/utils");

@@ -66,2 +67,18 @@ const getDocumentMetadata_js_1 = require("./getDocumentMetadata.js");

const { usedVariables, newDocument } = finalizeGatewayDocument(targetSchema, fragments, operations);
// Fail if the query is only the root __typename field
if (newDocument.definitions.length === 1 &&
newDocument.definitions[0].kind === graphql_1.Kind.OPERATION_DEFINITION) {
const operation = newDocument.definitions[0];
if (operation.selectionSet.selections.length === 1 &&
operation.selectionSet.selections[0].kind === graphql_1.Kind.FIELD) {
const field = operation.selectionSet.selections[0];
if (field.name.value === '__typename' && operation.operation === 'query') {
throw (0, utils_1.createGraphQLError)('Failed to create a gateway request. The query must contain at least one selection.', {
extensions: {
[executor_1.CRITICAL_ERROR]: true,
},
});
}
}
}
const newVariables = {};

@@ -258,3 +275,5 @@ if (variables != null) {

if (type == null) {
console.warn(`Invalid type for node: ${typeInfo.getParentType()?.name}.${node.name.value}`);
// console.warn(
// `Invalid type for node: ${typeInfo.getParentType()?.name}.${node.name.value}`,
// );
return null;

@@ -261,0 +280,0 @@ }

import { getNamedType, versionInfo as graphqlVersionInfo, isAbstractType, isInterfaceType, isObjectType, isUnionType, Kind, TypeInfo, TypeNameMetaFieldDef, visit, visitWithTypeInfo, } from 'graphql';
import { createVariableNameGenerator, getDefinedRootType, implementsAbstractType, serializeInputValue, updateArgument, } from '@graphql-tools/utils';
import { CRITICAL_ERROR } from '@graphql-tools/executor';
import { createGraphQLError, createVariableNameGenerator, getDefinedRootType, implementsAbstractType, serializeInputValue, updateArgument, } from '@graphql-tools/utils';
import { getDocumentMetadata } from './getDocumentMetadata.js';

@@ -62,2 +63,18 @@ function finalizeGatewayDocument(targetSchema, fragments, operations) {

const { usedVariables, newDocument } = finalizeGatewayDocument(targetSchema, fragments, operations);
// Fail if the query is only the root __typename field
if (newDocument.definitions.length === 1 &&
newDocument.definitions[0].kind === Kind.OPERATION_DEFINITION) {
const operation = newDocument.definitions[0];
if (operation.selectionSet.selections.length === 1 &&
operation.selectionSet.selections[0].kind === Kind.FIELD) {
const field = operation.selectionSet.selections[0];
if (field.name.value === '__typename' && operation.operation === 'query') {
throw createGraphQLError('Failed to create a gateway request. The query must contain at least one selection.', {
extensions: {
[CRITICAL_ERROR]: true,
},
});
}
}
}
const newVariables = {};

@@ -253,3 +270,5 @@ if (variables != null) {

if (type == null) {
console.warn(`Invalid type for node: ${typeInfo.getParentType()?.name}.${node.name.value}`);
// console.warn(
// `Invalid type for node: ${typeInfo.getParentType()?.name}.${node.name.value}`,
// );
return null;

@@ -256,0 +275,0 @@ }

4

package.json
{
"name": "@graphql-tools/delegate",
"version": "10.0.15",
"version": "10.0.16-rc-20240723153759-69d33f9c6ca6f55b0be47636e2bd24aafec03c04",
"description": "A set of utils for faster development of GraphQL tools",

@@ -11,3 +11,3 @@ "sideEffects": false,

"@graphql-tools/batch-execute": "^9.0.4",
"@graphql-tools/executor": "^1.2.8",
"@graphql-tools/executor": "1.3.0-rc-20240723153759-69d33f9c6ca6f55b0be47636e2bd24aafec03c04",
"@graphql-tools/schema": "^10.0.4",

@@ -14,0 +14,0 @@ "@graphql-tools/utils": "^10.2.3",

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