UNPKG

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