@graphql-tools/batch-execute
Advanced tools
Comparing version 7.0.0-alpha-39c4dd36.0 to 7.0.0-alpha-3aeac777.0
import DataLoader from 'dataloader'; | ||
import { ExecutionParams, Executor } from './types'; | ||
export declare const createBatchingExecutor: (A1: Executor, A2: Record<string, any>, A3: (mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>, A4: DataLoader.Options<any, any, any>) => Executor; | ||
export declare function createBatchingExecutor(executor: Executor, dataLoaderOptions?: DataLoader.Options<any, any, any>, extensionsReducer?: (mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>): Executor; |
import DataLoader from 'dataloader'; | ||
import { ExecutionParams, Executor } from './types'; | ||
export declare const createBatchingExecutor: (A1: Executor, A2: Record<string, any>, A3: (mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>, A4: DataLoader.Options<any, any, any>) => Executor; | ||
export declare function createBatchingExecutor(executor: Executor, dataLoaderOptions?: DataLoader.Options<any, any, any>, extensionsReducer?: (mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>): Executor; |
@@ -13,32 +13,2 @@ 'use strict'; | ||
function memoize2of4(fn) { | ||
var cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
var cache2_1 = new WeakMap(); | ||
cache1.set(a1, cache2_1); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2_1.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
// adapted from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/src/batching/merge-queries.js | ||
@@ -318,6 +288,6 @@ function createPrefix(index) { | ||
var createBatchingExecutor = memoize2of4(function (executor, _context, extensionsReducer, dataLoaderOptions) { | ||
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer) { | ||
var loader = new DataLoader(createLoadFn(executor, extensionsReducer !== null && extensionsReducer !== void 0 ? extensionsReducer : defaultExtensionsReducer), dataLoaderOptions); | ||
return function (executionParams) { return loader.load(executionParams); }; | ||
}); | ||
} | ||
function createLoadFn(executor, extensionsReducer) { | ||
@@ -379,3 +349,38 @@ var _this = this; | ||
function memoize2of4(fn) { | ||
var cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
var cache2_1 = new WeakMap(); | ||
cache1.set(a1, cache2_1); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2_1.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
var getBatchingExecutor = memoize2of4(function (_context, executor, dataLoaderOptions, extensionsReducer) { | ||
return createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer); | ||
}); | ||
exports.createBatchingExecutor = createBatchingExecutor; | ||
exports.getBatchingExecutor = getBatchingExecutor; | ||
//# sourceMappingURL=index.cjs.js.map |
export * from './createBatchingExecutor'; | ||
export * from './getBatchingExecutor'; |
@@ -7,32 +7,2 @@ import { __spread, __assign, __awaiter, __generator } from 'tslib'; | ||
function memoize2of4(fn) { | ||
var cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
var cache2_1 = new WeakMap(); | ||
cache1.set(a1, cache2_1); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2_1.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
// adapted from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/src/batching/merge-queries.js | ||
@@ -312,6 +282,6 @@ function createPrefix(index) { | ||
var createBatchingExecutor = memoize2of4(function (executor, _context, extensionsReducer, dataLoaderOptions) { | ||
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer) { | ||
var loader = new DataLoader(createLoadFn(executor, extensionsReducer !== null && extensionsReducer !== void 0 ? extensionsReducer : defaultExtensionsReducer), dataLoaderOptions); | ||
return function (executionParams) { return loader.load(executionParams); }; | ||
}); | ||
} | ||
function createLoadFn(executor, extensionsReducer) { | ||
@@ -373,3 +343,37 @@ var _this = this; | ||
export { createBatchingExecutor }; | ||
function memoize2of4(fn) { | ||
var cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
var cache2_1 = new WeakMap(); | ||
cache1.set(a1, cache2_1); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2_1.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
var cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
var newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
var getBatchingExecutor = memoize2of4(function (_context, executor, dataLoaderOptions, extensionsReducer) { | ||
return createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer); | ||
}); | ||
export { createBatchingExecutor, getBatchingExecutor }; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@graphql-tools/batch-execute/es5", | ||
"version": "7.0.0-alpha-39c4dd36.0", | ||
"version": "7.0.0-alpha-3aeac777.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,3 +10,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/utils": "7.0.0-alpha-39c4dd36.0", | ||
"@graphql-tools/utils": "7.0.0-alpha-3aeac777.0", | ||
"dataloader": "2.0.0", | ||
@@ -13,0 +13,0 @@ "is-promise": "4.0.0", |
@@ -12,32 +12,2 @@ 'use strict'; | ||
function memoize2of4(fn) { | ||
let cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
const cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
let cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
const cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
// adapted from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/src/batching/merge-queries.js | ||
@@ -338,6 +308,6 @@ function createPrefix(index) { | ||
const createBatchingExecutor = memoize2of4(function (executor, _context, extensionsReducer, dataLoaderOptions) { | ||
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer) { | ||
const loader = new DataLoader(createLoadFn(executor, extensionsReducer !== null && extensionsReducer !== void 0 ? extensionsReducer : defaultExtensionsReducer), dataLoaderOptions); | ||
return (executionParams) => loader.load(executionParams); | ||
}); | ||
} | ||
function createLoadFn(executor, extensionsReducer) { | ||
@@ -395,3 +365,38 @@ return async (execs) => { | ||
function memoize2of4(fn) { | ||
let cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
const cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
let cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
const cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
const getBatchingExecutor = memoize2of4(function (_context, executor, dataLoaderOptions, extensionsReducer) { | ||
return createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer); | ||
}); | ||
exports.createBatchingExecutor = createBatchingExecutor; | ||
exports.getBatchingExecutor = getBatchingExecutor; | ||
//# sourceMappingURL=index.cjs.js.map |
export * from './createBatchingExecutor'; | ||
export * from './getBatchingExecutor'; |
@@ -6,32 +6,2 @@ import { Kind, visit, getOperationAST } from 'graphql'; | ||
function memoize2of4(fn) { | ||
let cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
const cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
let cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
const cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
// adapted from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/src/batching/merge-queries.js | ||
@@ -332,6 +302,6 @@ function createPrefix(index) { | ||
const createBatchingExecutor = memoize2of4(function (executor, _context, extensionsReducer, dataLoaderOptions) { | ||
function createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer) { | ||
const loader = new DataLoader(createLoadFn(executor, extensionsReducer !== null && extensionsReducer !== void 0 ? extensionsReducer : defaultExtensionsReducer), dataLoaderOptions); | ||
return (executionParams) => loader.load(executionParams); | ||
}); | ||
} | ||
function createLoadFn(executor, extensionsReducer) { | ||
@@ -389,3 +359,37 @@ return async (execs) => { | ||
export { createBatchingExecutor }; | ||
function memoize2of4(fn) { | ||
let cache1; | ||
function memoized(a1, a2, a3, a4) { | ||
if (!cache1) { | ||
cache1 = new WeakMap(); | ||
const cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
let cache2 = cache1.get(a1); | ||
if (!cache2) { | ||
cache2 = new WeakMap(); | ||
cache1.set(a1, cache2); | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
const cachedValue = cache2.get(a2); | ||
if (cachedValue === undefined) { | ||
const newValue = fn(a1, a2, a3, a4); | ||
cache2.set(a2, newValue); | ||
return newValue; | ||
} | ||
return cachedValue; | ||
} | ||
return memoized; | ||
} | ||
const getBatchingExecutor = memoize2of4(function (_context, executor, dataLoaderOptions, extensionsReducer) { | ||
return createBatchingExecutor(executor, dataLoaderOptions, extensionsReducer); | ||
}); | ||
export { createBatchingExecutor, getBatchingExecutor }; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@graphql-tools/batch-execute", | ||
"version": "7.0.0-alpha-39c4dd36.0", | ||
"version": "7.0.0-alpha-3aeac777.0", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -10,3 +10,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@graphql-tools/utils": "7.0.0-alpha-39c4dd36.0", | ||
"@graphql-tools/utils": "7.0.0-alpha-3aeac777.0", | ||
"dataloader": "2.0.0", | ||
@@ -13,0 +13,0 @@ "is-promise": "4.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
178669
26
1646
+ Added@graphql-tools/utils@7.0.0-alpha-3aeac777.0(transitive)
- Removed@graphql-tools/utils@7.0.0-alpha-39c4dd36.0(transitive)