Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@graphql-tools/executor-http
Advanced tools
A set of utils for faster development of GraphQL tools
The @graphql-tools/executor-http package is designed to facilitate the execution of GraphQL queries over HTTP. It provides a simple and efficient way to interact with GraphQL APIs by sending queries and mutations directly through HTTP requests. This package is part of the larger GraphQL Tools ecosystem, which offers various utilities for building and managing GraphQL servers and clients.
Executing GraphQL queries over HTTP
This feature allows developers to execute GraphQL queries by sending them to a specified GraphQL endpoint. The executor handles the HTTP request and response, simplifying the process of querying a GraphQL server.
const { ExecutorHttp } = require('@graphql-tools/executor-http');
const executor = new ExecutorHttp({ uri: 'https://your-graphql-endpoint.com/graphql' });
const query = `{ users { id name } }`;
executor.execute({ document: query }).then(result => {
console.log(result);
}).catch(error => {
console.error(error);
});
Handling GraphQL mutations
This feature supports the execution of GraphQL mutations, allowing for data manipulation operations such as adding, updating, or deleting data. The executor sends the mutation along with any necessary variables to the GraphQL server.
const { ExecutorHttp } = require('@graphql-tools/executor-http');
const executor = new ExecutorHttp({ uri: 'https://your-graphql-endpoint.com/graphql' });
const mutation = `mutation AddUser($name: String!) { addUser(name: $name) { id } }`;
const variables = { name: 'New User' };
executor.execute({ document: mutation, variables }).then(result => {
console.log(result);
}).catch(error => {
console.error(error);
});
Apollo Link HTTP is a similar package that provides capabilities for connecting to a GraphQL server over HTTP. It is part of the Apollo ecosystem, which is widely used in the GraphQL community. Compared to @graphql-tools/executor-http, Apollo Link HTTP integrates more tightly with Apollo Client, offering features like middleware support and afterware for response processing.
graphql-request is a minimal GraphQL client for making HTTP requests. It is simpler and more lightweight than @graphql-tools/executor-http, focusing solely on sending queries and mutations without the broader context or utilities provided by GraphQL Tools. It's ideal for small projects or when a full-featured GraphQL client is not necessary.
FAQs
A set of utils for faster development of GraphQL tools
The npm package @graphql-tools/executor-http receives a total of 2,477,981 weekly downloads. As such, @graphql-tools/executor-http popularity was classified as popular.
We found that @graphql-tools/executor-http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.