@cran/gql.reflect
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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", ],
}));

Package Sidebar

Install

npm i @cran/gql.reflect

Weekly Downloads

0

Version

0.1.0

License

CC-BY-ND-4.0

Unpacked Size

37.8 kB

Total Files

84

Last publish

Collaborators

  • common-cranberry