UNPKG

graphql-paper

Version:

A flexible in-memory store based on a GraphQL Schema

20 lines (17 loc) 578 B
'use strict'; var graphql = require('graphql'); var unwrap = require('./unwrap.js'); // eslint-disable-next-line @typescript-eslint/no-explicit-any function extractObjectTypes(schema, type) { const unwrapped = unwrap.unwrap(type); if (graphql.isObjectType(unwrapped)) { return [unwrapped]; } if (graphql.isAbstractType(unwrapped)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any return schema.getPossibleTypes(unwrapped); } return []; } exports.extractObjectTypes = extractObjectTypes; //# sourceMappingURL=extract-object-types.js.map