This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
admin-panel/graphql-types/node_modules/@graphql-tools/batch-execute/mergeExecutionParams.d.ts

37 lines
1.4 KiB
TypeScript

import { ExecutionParams } from './types';
/**
* Merge multiple queries into a single query in such a way that query results
* can be split and transformed as if they were obtained by running original queries.
*
* Merging algorithm involves several transformations:
* 1. Replace top-level fragment spreads with inline fragments (... on Query {})
* 2. Add unique aliases to all top-level query fields (including those on inline fragments)
* 3. Prefix all variable definitions and variable usages
* 4. Prefix names (and spreads) of fragments
*
* i.e transform:
* [
* `query Foo($id: ID!) { foo, bar(id: $id), ...FooQuery }
* fragment FooQuery on Query { baz }`,
*
* `query Bar($id: ID!) { foo: baz, bar(id: $id), ... on Query { baz } }`
* ]
* to:
* query (
* $graphqlTools1_id: ID!
* $graphqlTools2_id: ID!
* ) {
* graphqlTools1_foo: foo,
* graphqlTools1_bar: bar(id: $graphqlTools1_id)
* ... on Query {
* graphqlTools1__baz: baz
* }
* graphqlTools1__foo: baz
* graphqlTools1__bar: bar(id: $graphqlTools1__id)
* ... on Query {
* graphqlTools1__baz: baz
* }
* }
*/
export declare function mergeExecutionParams(execs: Array<ExecutionParams>, extensionsReducer: (mergedExtensions: Record<string, any>, executionParams: ExecutionParams) => Record<string, any>): ExecutionParams;