Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/draftbit/graphql-batching-helpers
📊 GraphQL Batching Helpers for Creating & Deleting
https://github.com/draftbit/graphql-batching-helpers
graphql
Last synced: 6 days ago
JSON representation
📊 GraphQL Batching Helpers for Creating & Deleting
- Host: GitHub
- URL: https://github.com/draftbit/graphql-batching-helpers
- Owner: draftbit
- License: mit
- Created: 2017-09-01T16:19:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-01T16:42:35.000Z (about 7 years ago)
- Last Synced: 2024-10-08T10:11:15.549Z (about 1 month ago)
- Topics: graphql
- Language: JavaScript
- Size: 5.86 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL Batching Helpers
## Installation
```
yarn add graphql-batching-helpersor
npm install --save graphql-batching-helpers
```## Setup
- process.env.GRAPHQL_ENDPOINT
- process.env.GRAPHQL_ACCESS_TOKEN## Quick Start
```es6
await BatchQueryHelpers.batchDeleteAllModels({
modelName: 'Contact',
first: 100,
concurrency: 4,
})
```
What happens in order:
1. generate generate batch query name:```graphql
query getContacts {
contacts: allContacts(first: 100) {
id
}
}
```2. Request first N `Contact`s
3. 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)