UNPKG

488 BJavaScriptView Raw
1import { Kind } from '../language/kinds.mjs';
2/**
3 * Provided a collection of ASTs, presumably each from different files,
4 * concatenate the ASTs together into batched AST, useful for validating many
5 * GraphQL source files which together represent one conceptual application.
6 */
7
8export function concatAST(documents) {
9 const definitions = [];
10
11 for (const doc of documents) {
12 definitions.push(...doc.definitions);
13 }
14
15 return {
16 kind: Kind.DOCUMENT,
17 definitions,
18 };
19}