3.0.8 • Published 6 months ago

extract-schema-coordinates v3.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

extract-schema-coordinates

Extract a list of "schema coordinates" contained in a GraphQL document

Install

$ yarn add extract-schema-coordinates

Example

e.g. for the following query:

query GET_BUSINESS($BizId: String) {
    business(id: $BizId) {
        name
        location {
            city
        }
    }
}

We would return the following set of schema coordinates:

["Query.business", "Business.name", "Business.location", "Location.city"]

API

extractSchemaCoordinates(
    /**
     * The text of the document to analyse, in raw string format
     */
    documentText: string,
    /**
     * The text of your schema, in string SDL format (e.g. as created by printSchema)
     * @see https://graphql.org/graphql-js/utilities/#printschema
     */
    schemaText: string,
): Set<string>

Usage:

import extractSchemaCoordinates from 'extract-schema-coordinates';
const coordinates = extractSchemaCoordinates(documentString, schemaText);
3.0.2

6 months ago

0.0.1-initial

6 months ago

3.0.8

6 months ago

3.0.7

6 months ago

3.0.0

6 months ago

2.0.0

1 year ago

1.0.3

1 year ago