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)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i graphql-batching-helpers

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • peterpme