
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
@envelop/dataloader
Advanced tools
This plugin helps you to create a new [DataLoader](https://github.com/graphql/dataloader) instance every time your context is being built. The created instance is injected into the `context` with the name you wish to use.
@envelop/dataloaderThis plugin helps you to create a new DataLoader instance
every time your context is being built. The created instance is injected into the context with the
name you wish to use.
yarn add dataloader @envelop/dataloader
import DataLoader from 'dataloader'
import { execute, parse, specifiedRules, subscribe, validate } from 'graphql'
import { envelop, useEngine } from '@envelop/core'
import { useDataLoader } from '@envelop/dataloader'
const getEnveloped = envelop({
plugins: [
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
// ... other plugins ...
useDataLoader('users', context => new DataLoader(keys => myBatchGetUsers(keys)))
]
})
Then, when you need to use it in your resolvers, just take it from the context:
export const resolvers = {
Query: {
user: (root, args, context, info) => {
return context.users.load(args.id)
}
}
}
There are several ways to create and use DataLoader, please refer to: https://github.com/graphql/dataloader#caching-per-request for more details.
FAQs
This plugin helps you to create a new [DataLoader](https://github.com/graphql/dataloader) instance every time your context is being built. The created instance is injected into the `context` with the name you wish to use.
The npm package @envelop/dataloader receives a total of 3,590 weekly downloads. As such, @envelop/dataloader popularity was classified as popular.
We found that @envelop/dataloader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.