![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@hydre/graphql-batch-executor
Advanced tools
A transform stream executing multiple graphql operations in parallel
This library is made to be used by servers or tools implementer, it can't be used alone.
npm install @hydre/graphql-batch-executor
Initialize a new Executor per client
import Executor from '@hydre/graphql-batch-executor'
import make_schema from '@hydre/graphql-batch-executor/make_schema'
// i actually wrote a light and efficient version of makeExecutableSchema
// without the shitty code and the 7500 dependencies of graphql-tools
// and using mjs exports of graphql.js
const schema = make_schema({
document: 'type Query { ping: String! }',
resolvers: {
Query: {
ping: () => 'pong'
},
Subscription: {
ping: {
resolve: () => 'pong',
async *subscribe() {
yield 0
}
}
}
},
directives: {
foo: ({ resolve, // original resolver
root, // resolver params in the same order
parameters, // .
context, // .
info, // .
directive_arguments, // parameters for the directive
}) => {}
}
})
const executor = new Executor({
schema, // schema
context: async () => ({}),
formatError: x => x // format array of errors
})
The executor generator takes an option object
import stream from 'stream'
stream.pipeline(
executor.execute({
document: /* GraphQL */`
query foo {
ping
}
query bar {
ping
}
`,
variables: {},
}),
async source => {
for await (const chunk of source) {
const {
// query, mutation, subscription
operation_type,
// the name
// note that you can't send queries
// without names if there are more than one
operation_name,
// data result or null
data,
// gql errors or []
errors,
} = chunk
}
},
() => {
log('client disconnected')
},
)
see /examples
FAQs
A transform stream executing multiple graphql operations in parallel
The npm package @hydre/graphql-batch-executor receives a total of 1 weekly downloads. As such, @hydre/graphql-batch-executor popularity was classified as not popular.
We found that @hydre/graphql-batch-executor demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.