graphql-compose-dataloader-new

1.0.6 • Public • Published

graphql-compose-dataloader-new

Greenkeeper badge Travis npm version npm

Add DataLoader to graphql-composer resolvers.

Installation

npm install graphql-compose-dataloader-new --save

Modules graphql, graphql-compose are in peerDependencies, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.

Example

import mongoose from 'mongoose';
import composeWithMongoose from 'graphql-compose-mongoose';
import composeWithDataLoader from 'graphql-compose-dataloader-new';
 
const LanguagesSchema = new mongoose.Schema({
  language: String,
  skill: {
    type: String,
    enum: ['basic', 'fluent', 'native'],
  },
});
 
const Languages = mongoose.model('Languages', LanguagesSchema);
const LanguagesTC = composeWithDataLoader(composeWithMongoose(Languages), {
  cacheExpiration: 700,
});

Props

Prop Type Description
cacheExpiration number Expiration in number of milliseconds. This will clear the one request sendt via the resolver (Default: 500)
removeProjection boolean Remove projection, this will request fields on the requested document and put it to cache (Default: true)
debug boolean Enable debug? (Default: false)
cache boolean Enable cache? (Default: false)

License

======= MIT

/graphql-compose-dataloader-new/

    Package Sidebar

    Install

    npm i graphql-compose-dataloader-new

    Weekly Downloads

    2

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    23.9 kB

    Total Files

    14

    Last publish

    Collaborators

    • jamecode