![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@tracworx/nestjs-dataloader
Advanced tools
Quick and easy GraphQL dataloaders for NestJS.
$ npm install @tracworx/nestjs-dataloader
Import the DataloaderModule
in your root module.
import { Module } from '@nestjs/common';
import { DataloaderModule } from '@tracworx/nestjs-dataloader';
import { ItemResolver } from './item.resolver';
import { ItemLoader } from './item.loader';
@Module({
imports: [DataloaderModule],
providers: [ItemResolver, ItemLoader],
})
export class AppModule {}
Decorate dataloader factory classes with @DataloaderProvider()
to automatically provide them to the GraphQL context object for each request.
import DataLoader from 'dataloader';
import { DataloaderProvider } from '@tracworx/nestjs-dataloader';
@DataloaderProvider()
class ItemLoader {
createDataloader(ctx: GqlExecutionContext) {
// Fetch request-scoped context data if needed
const user = ctx.getContext().req.user;
// Replace this with your actual dataloader implementation
return new DataLoader<string, Item>(async (ids) => getItemsWithIds(user, ids));
}
}
Use @Loader(...)
to inject a dataloader instance into your resolver methods.
import DataLoader from 'dataloader';
import { Loader } from '@tracworx/nestjs-dataloader';
import { ItemLoader } from './item.loader';
@Resolver()
class ItemResolver {
@Query(() => Item, { name: 'item' })
getItem(@Args('id') id: string, @Loader(ItemLoader) itemLoader) {
return itemLoader.load(id);
}
}
And that's it. Happy coding!
# build
$ npm run build
# format with prettier
$ npm run format
# lint with eslint
$ npm run lint
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
@tracworx/nestjs-dataloader
is MIT licensed.
FAQs
Quick and easy GraphQL dataloaders for NestJS
The npm package @tracworx/nestjs-dataloader receives a total of 0 weekly downloads. As such, @tracworx/nestjs-dataloader popularity was classified as not popular.
We found that @tracworx/nestjs-dataloader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.