Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/batch-execute

Package Overview
Dependencies
Maintainers
3
Versions
496
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/batch-execute - npm Package Compare versions

Comparing version 8.5.20 to 8.5.21-rc-20230424102936-52af4983

11

cjs/createBatchingExecutor.js

@@ -9,2 +9,3 @@ "use strict";

const splitResult_js_1 = require("./splitResult.js");
const value_or_promise_1 = require("value-or-promise");
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer = defaultExtensionsReducer) {

@@ -20,3 +21,3 @@ const loadFn = createLoadFn(executor, extensionsReducer);

function createLoadFn(executor, extensionsReducer) {
return async function batchExecuteLoadFn(requests) {
return function batchExecuteLoadFn(requests) {
const execBatches = [];

@@ -44,8 +45,6 @@ let index = 0;

}
const results = await Promise.all(execBatches.map(async (execBatch) => {
return value_or_promise_1.ValueOrPromise.all(execBatches.map(execBatch => new value_or_promise_1.ValueOrPromise(() => {
const mergedRequests = (0, mergeRequests_js_1.mergeRequests)(execBatch, extensionsReducer);
const resultBatches = (await executor(mergedRequests));
return (0, splitResult_js_1.splitResult)(resultBatches, execBatch.length);
}));
return results.flat();
return executor(mergedRequests);
}).then(resultBatches => (0, splitResult_js_1.splitResult)(resultBatches, execBatch.length)))).then(results => results.flat());
};

@@ -52,0 +51,0 @@ }

@@ -5,2 +5,3 @@ import DataLoader from 'dataloader';

import { splitResult } from './splitResult.js';
import { ValueOrPromise } from 'value-or-promise';
export function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer = defaultExtensionsReducer) {

@@ -15,3 +16,3 @@ const loadFn = createLoadFn(executor, extensionsReducer);

function createLoadFn(executor, extensionsReducer) {
return async function batchExecuteLoadFn(requests) {
return function batchExecuteLoadFn(requests) {
const execBatches = [];

@@ -39,8 +40,6 @@ let index = 0;

}
const results = await Promise.all(execBatches.map(async (execBatch) => {
return ValueOrPromise.all(execBatches.map(execBatch => new ValueOrPromise(() => {
const mergedRequests = mergeRequests(execBatch, extensionsReducer);
const resultBatches = (await executor(mergedRequests));
return splitResult(resultBatches, execBatch.length);
}));
return results.flat();
return executor(mergedRequests);
}).then(resultBatches => splitResult(resultBatches, execBatch.length)))).then(results => results.flat());
};

@@ -47,0 +46,0 @@ }

{
"name": "@graphql-tools/batch-execute",
"version": "8.5.20",
"version": "8.5.21-rc-20230424102936-52af4983",
"description": "A set of utils for faster development of GraphQL tools",

@@ -5,0 +5,0 @@ "sideEffects": false,

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