UNPKG

graphqldoc

Version:
21 lines (20 loc) 611 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isRawIntrospection(arg) { return arg.__schema !== undefined; } function isWrappedIntrospection(arg) { return arg.data !== undefined; } function getSchemaFromIntrospection(introspection) { if (isRawIntrospection(introspection)) { return introspection.__schema; } else if (isWrappedIntrospection(introspection)) { return introspection.data.__schema; } else { throw new Error('Could not parse schema'); } } exports.getSchemaFromIntrospection = getSchemaFromIntrospection;