3.0.8 • Published 2 years ago

extract-schema-coordinates v3.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.1-initial

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.0.3

2 years ago