concatAST.js 601 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true,
  4. });
  5. exports.concatAST = concatAST;
  6. var _kinds = require('../language/kinds.js');
  7. /**
  8. * Provided a collection of ASTs, presumably each from different files,
  9. * concatenate the ASTs together into batched AST, useful for validating many
  10. * GraphQL source files which together represent one conceptual application.
  11. */
  12. function concatAST(documents) {
  13. const definitions = [];
  14. for (const doc of documents) {
  15. definitions.push(...doc.definitions);
  16. }
  17. return {
  18. kind: _kinds.Kind.DOCUMENT,
  19. definitions,
  20. };
  21. }