concatAST.mjs 511 B

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