concatAST.js 683 B

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.concatAST = concatAST;
  6. var _flatMap = _interopRequireDefault(require("../polyfills/flatMap"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. /**
  9. * Provided a collection of ASTs, presumably each from different files,
  10. * concatenate the ASTs together into batched AST, useful for validating many
  11. * GraphQL source files which together represent one conceptual application.
  12. */
  13. function concatAST(asts) {
  14. return {
  15. kind: 'Document',
  16. definitions: (0, _flatMap.default)(asts, function (ast) {
  17. return ast.definitions;
  18. })
  19. };
  20. }