graphql-paper
Version:
A flexible in-memory store based on a GraphQL Schema
18 lines (16 loc) • 545 B
JavaScript
import { isObjectType, isAbstractType } from 'graphql';
import { unwrap } from './unwrap.mjs';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function extractObjectTypes(schema, type) {
var unwrapped = unwrap(type);
if (isObjectType(unwrapped)) {
return [unwrapped];
}
if (isAbstractType(unwrapped)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return schema.getPossibleTypes(unwrapped);
}
return [];
}
export { extractObjectTypes };
//# sourceMappingURL=extract-object-types.mjs.map