npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

graphql-batching-helpers

0.1.2 • Public • Published

GraphQL Batching Helpers

Installation

yarn add graphql-batching-helpers

or

npm install --save graphql-batching-helpers

Setup

  • process.env.GRAPHQL_ENDPOINT
  • process.env.GRAPHQL_ACCESS_TOKEN

Quick Start

  await BatchQueryHelpers.batchDeleteAllModels({
    modelName: 'Contact',
    first: 100,
    concurrency: 4,
  })

What happens in order:

  1. generate generate batch query name:
query getContacts {
  contacts: allContacts(first: 100) {
    id
  }
}
  1. Request first N Contacts
  2. If there are more than 0:
  • Generate match query mutations
  • Delete first N with concurrency N

API

  • generateBatchQuery
    • modelName: String ("Contact")
    • first: Int (100)
  • generateBatchDeleteMutation
    • modelName: String ("Contact")
    • id
  • generateBatchDeleteMutations
    • values
      • id: String ("xyz")
    • options
      • modelName: String ("Contact")
  • runBatchQuery
    • options
      • modelName: String ("Contact")
      • first: Int (100)
  • runBatchDelete
    • mutations
    • options
      • concurrency: Int (4)
  • batchDeleteAllModels
    • options
      • modelName: String ("Contact")
      • first: Int (100)
      • concurrency: Int (4)

install

npm i graphql-batching-helpers

Downloadsweekly downloads

3

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability