New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-query-factory

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-query-factory - npm Package Compare versions

Comparing version 1.0.18 to 1.0.19

2

dist/batcher.js

@@ -10,3 +10,3 @@ "use strict";

function batcher(queries, concurrent) {
function batcher(queries, concurrent = 4) {
let batcherHandle = new QueryBatcher(queries, concurrent);

@@ -13,0 +13,0 @@ let executedBatchPromise = batcherHandle.queryBatchExecute();

@@ -82,8 +82,8 @@ "use strict";

async buildQueries() {
buildQueries() {
let q = this.getQuery();
let v = this.getVariables();
try {
let p = await this.extractQueryParams(q);
let interpolatedQuery = await this.injectQueryArguments(q, p, v);
let p = this.extractQueryParams(q);
let interpolatedQuery = this.injectQueryArguments(q, p, v);
return interpolatedQuery;

@@ -90,0 +90,0 @@ } catch (error) {

{
"name": "graphql-query-factory",
"version": "1.0.18",
"version": "1.0.19",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -5,5 +5,7 @@ # GraphQL Query Batcher

## Status
> You can use QueryBuilder today. QueryBuilder takes an array of variable objects and injects them into your GraphQL query.
> * QueryBuilder available.
> * QueryBatcher is close.
> * Broke sample into its own repo: [graphql-query-factory-test](https://github.com/alechp/graphql-query-factory-test)
> * Fixed some breaking changes in last version that prevented module from being used. This was a result of main pointing to /index instead of src/index. Should be fixed now.
### Roadmap

@@ -33,3 +35,3 @@ | Status | Summary | Comment |

QueryBuilder - [Sample Project](https://github.com/alechp/graphql-query-factory/tree/master/graphql-query-factory-test-project)
##### QueryBuilder - [Sample Project](https://github.com/alechp/graphql-query-factory/tree/master/graphql-query-factory-test-project)
```js

@@ -39,3 +41,3 @@ const { builder } = require('graphql-query-factory');

const sampleMutation = `mutation {
const mutationTemplate = `mutation {
createContent(

@@ -50,3 +52,3 @@ markup: $markup

const queryVariablesArray = [
const mutationVariables = [
{

@@ -66,11 +68,7 @@ "markup": "markup1",

let queries = builder(sampleMutation, queryVariablesArray)
.then( data =>
data.map(d => log(d))
)
.catch(err => log(`QueryBuilder failed. Error: ${err}`));
let queries = builder(mutationTemplate, mutationVariables);
```
QueryBuilder Output:
```js
```graphql
mutation {

@@ -116,3 +114,3 @@ createContent(

When using `QueryBatcher()` or `batcher` you must include two environment variables:
* `GQL_SIMPLE_ENDPOINT`:
* `GQL_SIMPLE_ENDPOINT`
* `GQL_AUTH_TOKEN`
//@flow
const fetch = require("node-fetch");

@@ -9,3 +10,3 @@ global.fetch = fetch;

function batcher(queries: Array<string>, concurrent: number): mixed {
function batcher(queries: Array<string>, concurrent: number = 4): mixed {
let batcherHandle = new QueryBatcher(queries, concurrent);

@@ -12,0 +13,0 @@ let executedBatchPromise = batcherHandle.queryBatchExecute();

@@ -7,3 +7,3 @@ //@flow

function builder(query: string, variables: Array<mixed>): mixed {
function builder(query: string, variables: Array<mixed>): Array<string> {
let qb = new QueryBuilder(query, variables);

@@ -95,12 +95,8 @@ let queries = qb.buildQueries();

async buildQueries() {
buildQueries() {
let q: string = this.getQuery();
let v: mixed = this.getVariables();
try {
let p: ?Array<string> = await this.extractQueryParams(q);
let interpolatedQuery: Array<string> = await this.injectQueryArguments(
q,
p,
v
);
let p: ?Array<string> = this.extractQueryParams(q);
let interpolatedQuery: Array<string> = this.injectQueryArguments(q, p, v);
return interpolatedQuery;

@@ -107,0 +103,0 @@ } catch (error) {

@@ -35,4 +35,8 @@ ### Todo

* [ ] Split `...-test` local implementation test (for local) into separate file
* [ ]
##### Docs
* [ ] Update docs to represent changes
* [ ] Publish link to new test project
* [ ] Rename the "query" helper methods to be agnostic (e.g. "Request", "Template" or something along those lines... confusing when talking about GraphQL's query and mutation paradigm)
##### Schema

@@ -39,0 +43,0 @@ * [x] Update Graphcool instance to random staging

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc