Repository
Current version released
4 years ago
Versions
IMPORTQL 🎡
easy way to import and parse graphql files in deno
install
install using Trex package manager
$ trex install --map importql
or use url
import { importQL } from "https://deno.land/x/importql/mod.ts";
use
# query.graphql file
type User {
firstName: String
lastName: String
}
input UserInput {
firstName: String
lastName: String
}
type ResolveType {
done: Boolean
}
type Query {
getUser(id: String): User
}
type Mutation {
setUser(input: UserInput!): ResolveType!
}
import { importQL } from "https://deno.land/x/importql/mod.ts";
const query = importQL("query.graphql"); // import the .graphql file
// query is now a GraphQL syntax tree object.
// {
// "kind": "Document",
// "definitions": [
// {
// "kind": "OperationDefinition",
// "operation": "query",
// "name": null,
// "variableDefinitions": null,
// "directives": [],
// "selectionSet": {
// "kind": "SelectionSet",
// "selections": [
// {
// "kind": "Field",
// "alias": null,
// "name": {
// "kind": "Name",
// "value": "user",
// ...
permissions
- –allow-read