UNPKG

@graphql-tools/graphql

Version:
18 lines (17 loc) 588 B
import { memoize1 } from '../jsutils/memoize1.js'; export const getRootTypeMap = memoize1(function getRootTypeMap(schema) { const rootTypeMap = new Map(); const queryType = schema.getQueryType(); if (queryType) { rootTypeMap.set('query', queryType); } const mutationType = schema.getMutationType(); if (mutationType) { rootTypeMap.set('mutation', mutationType); } const subscriptionType = schema.getSubscriptionType(); if (subscriptionType) { rootTypeMap.set('subscription', subscriptionType); } return rootTypeMap; });