Skip to content

easy way to import and parse graphql files 🎡

License

Notifications You must be signed in to change notification settings

crewdevio/importql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IMPORTQL 🎡

easy way to import and parse graphql files in deno

importql

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