concatAST.mjs 439 B

123456789101112131415
  1. import flatMap from '../polyfills/flatMap';
  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. export function concatAST(asts) {
  8. return {
  9. kind: 'Document',
  10. definitions: flatMap(asts, function (ast) {
  11. return ast.definitions;
  12. })
  13. };
  14. }