graphqldoc
Version:
Generate GraphQL docs from schema.
21 lines (20 loc) • 611 B
JavaScript
;
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;