@cran/gql.reflect
v0.1.0
Published
Cranberry Introspection Utilities for GraphQL
Downloads
6
Maintainers
Readme
Cranberry / GQL / Reflect
Introspection Utilities for GraphQL
Usage
import { ReflectSchema, getIntrospectionQuery } from "@cran/gql.reflect";
(async function main ( ) {
const { data: { __schema: schema } } = await query(getIntrospectionQuery());
const reflection = new ReflectSchema(schema);
})();
Filtering
Optionally, the ReflectSchema
constructor may take
a filter to remove types.
const reflection = new ReflectSchema(schema, {
filter ( type ) {
return !(/^_|Query|Mutation|Subscription/).test(type.name);
}
});
Extra Fields
Compatible with
@cran/vue.core
const { data: { __schema: schema } } = await query(getIntrospectionQuery({
default: [ "title", "color", "icon", ],
}));