plural.js 805 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true,
  4. });
  5. exports.pluralIdentifyingRootField = pluralIdentifyingRootField;
  6. var _graphql = require('graphql');
  7. function pluralIdentifyingRootField(config) {
  8. return {
  9. description: config.description,
  10. type: new _graphql.GraphQLList(config.outputType),
  11. args: {
  12. [config.argName]: {
  13. type: new _graphql.GraphQLNonNull(
  14. new _graphql.GraphQLList(
  15. new _graphql.GraphQLNonNull(
  16. (0, _graphql.getNullableType)(config.inputType),
  17. ),
  18. ),
  19. ),
  20. },
  21. },
  22. resolve(_obj, args, context, info) {
  23. const inputs = args[config.argName];
  24. return inputs.map((input) =>
  25. config.resolveSingleInput(input, context, info),
  26. );
  27. },
  28. };
  29. }