@graphql-tools/batch-execute
Advanced tools
Comparing version 8.5.20 to 8.5.21-rc-20230424102936-52af4983
@@ -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, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36623
827
2