concatAST.js 616 B

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