emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/graphql-mode 1f3bd34b18 064/122: Merge pull request #14 fr


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 1f3bd34b18 064/122: Merge pull request #14 from davazp/next
Date: Sat, 29 Jan 2022 08:03:33 -0500 (EST)

branch: elpa/graphql-mode
commit 1f3bd34b18a41dbda75a0baee38aa0f0f1fffb7a
Merge: 3c25bf5cbd 1210279ff4
Author: David Vázquez Púa <davazp@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #14 from davazp/next
    
    Release
---
 graphql-mode.el           | 181 +++++++++++++++++-----
 test/index.js             |   5 +-
 test/package-lock.json    | 374 ++++++++++++++++++++++++++++++++++++++++++++++
 test/schema.graphql       |   3 +-
 test/simple-query.graphql |   5 +-
 test/variables.json       |   3 +
 6 files changed, 532 insertions(+), 39 deletions(-)

diff --git a/graphql-mode.el b/graphql-mode.el
index aa8879623c..5b7d65a635 100644
--- a/graphql-mode.el
+++ b/graphql-mode.el
@@ -4,7 +4,7 @@
 
 ;; Author: David Vazquez Pua <davazp@gmail.com>
 ;; Keywords: languages
-;; Package-Requires: ((emacs "24.3"))
+;; Package-Requires: ((emacs "24.3") (request "20170131.1747"))
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 ;;; Commentary:
 
 ;; This package implements a major mode to edit GraphQL schemas and
-;; query. The basic functionality includes:
+;; query.  The basic functionality includes:
 ;;
 ;;    - Syntax highlight
 ;;    - Automatic indentation
@@ -40,7 +40,7 @@
 (require 'json)
 (require 'url)
 (require 'cl-lib)
-
+(require 'request)
 
 ;;; User Customizations:
 
@@ -51,23 +51,65 @@
 
 (defcustom graphql-indent-level 2
   "Number of spaces for each indentation step in `graphql-mode'."
+  :tag "GraphQL"
   :type 'integer
-  :safe 'integerp)
+  :safe 'integerp
+  :group 'graphql)
 
+(defcustom graphql-url nil
+  "URL address of the graphql server endpoint."
+  :tag "GraphQL"
+  :type 'string
+  :group 'graphql)
 
-(defvar graphql-url
-  nil)
-(make-variable-buffer-local 'graphql-url)
-
-(defun graphql--query (query)
-  "Send QUERY to the server at `graphql-url' and return the
-response from the server."
-  (let ((url-request-method "POST")
-        (url (format "%s?query=%s" graphql-url (url-encode-url query))))
-    (with-current-buffer (url-retrieve-synchronously url t)
-      (goto-char (point-min))
-      (search-forward "\n\n")
-      (buffer-substring (point) (point-max)))))
+(defcustom graphql-variables-file nil
+  "File name containing graphql variables."
+  :tag "GraphQL"
+  :type 'file
+  :group 'graphql)
+
+(defun graphql-encode-json (query &optional operation variables)
+  "Put together a json like object with QUERY, OPERATION, and VARIABLES."
+  (let* ((body '()))
+    (push (cons 'query query) body)
+    (when operation
+      (push (cons 'operationName operation) body))
+    (when variables
+      (push (cons 'variables variables) body))
+    (json-encode body)))
+
+(defun graphql--query (query &optional operation variables)
+  "Send QUERY to the server and return the response.
+
+The query is sent as a HTTP POST request to the URL at
+`graphql-url'.  The query can be any GraphQL definition (query,
+mutation or subscription).  OPERATION is a name for the
+operation.  VARIABLES is the JSON string that specifies the values
+of the variables used in the query."
+  (let* ((body (graphql-encode-json query operation variables))
+         (url graphql-url))
+    (with-temp-buffer
+      (graphql-post-request url query operation variables))))
+
+(defun graphql-post-request (url query &optional operation variables)
+  "Make post request to graphql server with url and body.
+
+URL hostname, path, search parameters, such as operationName and variables
+QUERY query definition(s) of query, mutation, and/or subscription
+OPERATION name of the operation if multiple definition is given in QUERY
+VARIABLES list of variables for query operation"
+  (let* ((body (graphql-encode-json query operation variables))
+         (response (request url
+                            :type "POST"
+                            :data body
+                            :headers '(("Content-Type" . "application/json"))
+                            :parser 'json-read
+                            :sync t
+                            :complete (lambda (&rest _)
+                                        (message "%s" (if (string-equal "" 
operation)
+                                                          url
+                                                        (format 
"%s?operationName=%s" endpoint operation)))))))
+    (json-encode (request-response-data response))))
 
 (defun graphql-beginning-of-query ()
   "Move the point to the beginning of the current query."
@@ -86,6 +128,7 @@ response from the server."
     (forward-line 1)))
 
 (defun graphql-current-query ()
+  "Return the current query/mutation/subscription definition."
   (let ((start
          (save-excursion
            (graphql-beginning-of-query)
@@ -94,44 +137,94 @@ response from the server."
          (save-excursion
            (graphql-end-of-query)
            (point))))
-    (buffer-substring-no-properties start end)))
-
+    (if (not (equal start end))
+       (buffer-substring-no-properties start end)
+      (save-excursion
+       (let ((saved-point (point))
+             (line (thing-at-point 'line t)))
+         (when (string-match-p (regexp-quote "}") line)
+           (search-backward "}" (beginning-of-line)))
+         (when (string-match-p (regexp-quote "{") line)
+           (search-forward "{" (end-of-line)))
+         (if (= (point) saved-point)
+             nil
+           (graphql-current-query)))))))
+
+(defun graphql-current-operation ()
+  "Return the name of the current graphql query."
+  (let* ((query
+         (save-excursion
+           (replace-regexp-in-string "^[ \t\n]*" "" (or 
(graphql-current-query) ""))))
+         (tokens
+          (split-string query "[ \f\t\n\r\v]+"))
+         (first (nth 0 tokens)))
+
+    (if (or (string-equal first "{") (string-equal first ""))
+        nil
+      (replace-regexp-in-string "[({].*" "" (nth 1 tokens)))))
+
+(defun graphql-current-variables (filename)
+  "Return the current variables contained in FILENAME."
+  (if (and filename
+           (not (string-equal filename ""))
+           (not (file-directory-p filename))
+           (file-exists-p filename))
+      (condition-case nil
+          (progn (get-buffer-create (find-file-noselect filename))
+                 (json-encode (json-read-file filename)))
+        (error nil))
+    nil))
 
 (defun graphql-send-query ()
+  "Send the current GraphQL query/mutation/subscription to server."
   (interactive)
-  (let ((url (or graphql-url (read-string "GraphQL URL: " ))))
-    (let ((graphql-url url))
+  (let* ((url (or graphql-url (read-string "GraphQL URL: " )))
+         (var (or graphql-variables-file (read-file-name "GraphQL Variables: 
"))))
+    (let ((graphql-url url)
+          (graphql-variables-file var))
+
       (let* ((query (buffer-substring-no-properties (point-min) (point-max)))
-             (response (graphql--query query)))
+             (operation (graphql-current-operation))
+             (variables (graphql-current-variables var))
+             (response (graphql--query query operation variables)))
         (with-current-buffer-window
          "*GraphQL*" 'display-buffer-pop-up-window nil
          (erase-buffer)
          (when (fboundp 'json-mode)
-           (json-mode))
+           ;; TODO: This line has been disabled temporarily as
+           ;; json-mode does not support enabling the mode for buffers
+           ;; without files at this point:
+           ;;
+           ;; https://github.com/joshwnj/json-mode/issues/55
+           ;;
+           ;; (json-mode)
+           )
          (insert response)
          (json-pretty-print-buffer))))
     ;; If the query was successful, then save the value of graphql-url
     ;; in the current buffer (instead of the introduced local
     ;; binding).
     (setq graphql-url url)
+    (setq graphql-variables-file var)
     nil))
 
-
-
 (defvar graphql-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "C-c C-c") 'graphql-send-query)
-    map))
+    map)
+  "Key binding for GraphQL mode.")
 
 (defvar graphql-mode-syntax-table
   (let ((st (make-syntax-table)))
     (modify-syntax-entry ?\# "<" st)
     (modify-syntax-entry ?\n ">" st)
     (modify-syntax-entry ?\$ "'" st)
-    st))
+    st)
+  "Syntax table for GraphQL mode.")
 
 
 (defun graphql-indent-line ()
+  "Indent GraphQL schema language."
   (let ((position (point))
         (indent-pos))
     (save-excursion
@@ -147,20 +240,37 @@ response from the server."
     (when (< position indent-pos)
       (goto-char indent-pos))))
 
+(defvar graphql-keywords
+  '("type" "input" "interface" "fragment" "query" "enum" "mutation" 
"subscription"
+    "Int" "Float" "String" "Boolean" "ID"
+       "true" "false" "null"))
+
+(defun graphql-completion-at-point ()
+  "Return the list of candidates for completion.
+This is the function to be used for the hook `completion-at-point-functions'."
+  (let* ((bds (bounds-of-thing-at-point 'symbol))
+         (start (car bds))
+         (end (cdr bds)))
+    (list start end graphql-keywords . nil)))
+
 
 (defvar graphql-definition-regex
-  (concat "\\(" (regexp-opt '("type" "input" "interface" "fragment" "query" 
"enum")) "\\)"
-          "[[:space:]]+\\(\\_<.+?\\_>\\)"))
+  (concat "\\(" (regexp-opt '("type" "input" "interface" "fragment" "query" 
"mutation" "subscription" "enum")) "\\)"
+          "[[:space:]]+\\(\\_<.+?\\_>\\)")
+  "Keyword Regular Expressions.")
 
 (defvar graphql-builtin-types
-  '("Int" "Float" "String" "Boolean" "ID"))
+  '("Int" "Float" "String" "Boolean" "ID")
+  "Built-in GraphQL Types.")
 
 (defvar graphql-constants
-  '("true" "false" "null"))
+  '("true" "false" "null")
+  "Constant GraphQL Types.")
 
 
 ;;; Check if the point is in an argument list.
 (defun graphql--in-arguments-p ()
+  "Return t if the point is in the arguments list of a GraphQL query."
   (let ((opening (cl-second (syntax-ppss))))
     (eql (char-after opening) ?\()))
 
@@ -204,7 +314,7 @@ response from the server."
     (,graphql-definition-regex
      (1 font-lock-keyword-face)
      (2 font-lock-function-name-face))
-    
+
     ;; Constants
     (,(regexp-opt graphql-constants) . font-lock-constant-face)
 
@@ -220,7 +330,8 @@ response from the server."
 
     ;; Field parameters
     (graphql--field-parameter-matcher
-     (1 font-lock-variable-name-face))))
+     (1 font-lock-variable-name-face)))
+  "Font Lock keywords.")
 
 
 ;;;###autoload
@@ -234,8 +345,8 @@ response from the server."
           nil
           nil
           nil))
-  (setq imenu-generic-expression
-        `((nil ,graphql-definition-regex 2))))
+  (setq imenu-generic-expression `((nil ,graphql-definition-regex 2)))
+  (add-hook 'completion-at-point-functions 'graphql-completion-at-point nil 
'local))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.graphql\\'" . graphql-mode))
diff --git a/test/index.js b/test/index.js
index f33df4b7f8..ade808fcdf 100644
--- a/test/index.js
+++ b/test/index.js
@@ -9,11 +9,14 @@ var fs = require('fs');
 var schemaContent = fs.readFileSync(__dirname + '/schema.graphql', 'utf-8');
 var schema = buildSchema(schemaContent);
 
+
 var root = {
-  person: (obj, args) => ({
+  person: (args) => ({
+    id: args.id,
     name: "David",
     friends: ()=>[
       {
+        id: 999,
         name: "Ana"
       }
     ]
diff --git a/test/package-lock.json b/test/package-lock.json
new file mode 100644
index 0000000000..598f0d3280
--- /dev/null
+++ b/test/package-lock.json
@@ -0,0 +1,374 @@
+{
+  "name": "graphql-mode-test-server",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "accepts": {
+      "version": "1.3.4",
+      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz";,
+      "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=",
+      "requires": {
+        "mime-types": "2.1.17",
+        "negotiator": "0.6.1"
+      }
+    },
+    "array-flatten": {
+      "version": "1.1.1",
+      "resolved": 
"https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz";,
+      "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
+    },
+    "body-parser": {
+      "version": "1.18.2",
+      "resolved": 
"https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz";,
+      "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
+      "requires": {
+        "bytes": "3.0.0",
+        "content-type": "1.0.4",
+        "debug": "2.6.9",
+        "depd": "1.1.1",
+        "http-errors": "1.6.2",
+        "iconv-lite": "0.4.19",
+        "on-finished": "2.3.0",
+        "qs": "6.5.1",
+        "raw-body": "2.3.2",
+        "type-is": "1.6.15"
+      }
+    },
+    "bytes": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz";,
+      "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
+    },
+    "content-disposition": {
+      "version": "0.5.2",
+      "resolved": 
"https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz";,
+      "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
+    },
+    "content-type": {
+      "version": "1.0.4",
+      "resolved": 
"https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz";,
+      "integrity": 
"sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
+    },
+    "cookie": {
+      "version": "0.3.1",
+      "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz";,
+      "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
+    },
+    "cookie-signature": {
+      "version": "1.0.6",
+      "resolved": 
"https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz";,
+      "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
+    },
+    "debug": {
+      "version": "2.6.9",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz";,
+      "integrity": 
"sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+      "requires": {
+        "ms": "2.0.0"
+      }
+    },
+    "depd": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz";,
+      "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
+    },
+    "destroy": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz";,
+      "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
+    },
+    "ee-first": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz";,
+      "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
+    },
+    "encodeurl": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz";,
+      "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA="
+    },
+    "escape-html": {
+      "version": "1.0.3",
+      "resolved": 
"https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz";,
+      "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
+    },
+    "etag": {
+      "version": "1.8.1",
+      "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz";,
+      "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
+    },
+    "express": {
+      "version": "4.15.5",
+      "resolved": "https://registry.npmjs.org/express/-/express-4.15.5.tgz";,
+      "integrity": "sha1-ZwI1ypWYiQpa6BcLg9tyK4Qu2Sc=",
+      "requires": {
+        "accepts": "1.3.4",
+        "array-flatten": "1.1.1",
+        "content-disposition": "0.5.2",
+        "content-type": "1.0.4",
+        "cookie": "0.3.1",
+        "cookie-signature": "1.0.6",
+        "debug": "2.6.9",
+        "depd": "1.1.1",
+        "encodeurl": "1.0.1",
+        "escape-html": "1.0.3",
+        "etag": "1.8.1",
+        "finalhandler": "1.0.6",
+        "fresh": "0.5.2",
+        "merge-descriptors": "1.0.1",
+        "methods": "1.1.2",
+        "on-finished": "2.3.0",
+        "parseurl": "1.3.2",
+        "path-to-regexp": "0.1.7",
+        "proxy-addr": "1.1.5",
+        "qs": "6.5.0",
+        "range-parser": "1.2.0",
+        "send": "0.15.6",
+        "serve-static": "1.12.6",
+        "setprototypeof": "1.0.3",
+        "statuses": "1.3.1",
+        "type-is": "1.6.15",
+        "utils-merge": "1.0.0",
+        "vary": "1.1.2"
+      },
+      "dependencies": {
+        "qs": {
+          "version": "6.5.0",
+          "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.0.tgz";,
+          "integrity": 
"sha512-fjVFjW9yhqMhVGwRExCXLhJKrLlkYSaxNWdyc9rmHlrVZbk35YHH312dFd7191uQeXkI3mKLZTIbSvIeFwFemg=="
+        }
+      }
+    },
+    "express-graphql": {
+      "version": "0.6.11",
+      "resolved": 
"https://registry.npmjs.org/express-graphql/-/express-graphql-0.6.11.tgz";,
+      "integrity": 
"sha512-dC/FAun5rqcRxhDe78047hqc048mo3xZpBDS0Z7RZOw9UleO9mZE0rHMS9yrVSaYzsLiz+q4PldKu6Oaqop+CA==",
+      "requires": {
+        "accepts": "1.3.4",
+        "content-type": "1.0.4",
+        "http-errors": "1.6.2",
+        "raw-body": "2.3.2"
+      }
+    },
+    "finalhandler": {
+      "version": "1.0.6",
+      "resolved": 
"https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz";,
+      "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=",
+      "requires": {
+        "debug": "2.6.9",
+        "encodeurl": "1.0.1",
+        "escape-html": "1.0.3",
+        "on-finished": "2.3.0",
+        "parseurl": "1.3.2",
+        "statuses": "1.3.1",
+        "unpipe": "1.0.0"
+      }
+    },
+    "forwarded": {
+      "version": "0.1.2",
+      "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz";,
+      "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
+    },
+    "fresh": {
+      "version": "0.5.2",
+      "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz";,
+      "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
+    },
+    "graphql": {
+      "version": "0.9.6",
+      "resolved": "https://registry.npmjs.org/graphql/-/graphql-0.9.6.tgz";,
+      "integrity": "sha1-UUQh6dIlwp38j9MFRZq65YgV7yw=",
+      "requires": {
+        "iterall": "1.1.2"
+      }
+    },
+    "http-errors": {
+      "version": "1.6.2",
+      "resolved": 
"https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz";,
+      "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
+      "requires": {
+        "depd": "1.1.1",
+        "inherits": "2.0.3",
+        "setprototypeof": "1.0.3",
+        "statuses": "1.3.1"
+      }
+    },
+    "iconv-lite": {
+      "version": "0.4.19",
+      "resolved": 
"https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz";,
+      "integrity": 
"sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
+    },
+    "inherits": {
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz";,
+      "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+    },
+    "ipaddr.js": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz";,
+      "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA="
+    },
+    "iterall": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.1.2.tgz";,
+      "integrity": 
"sha512-vv9+TpxaJNixIKWNSd9v70hjDMM6I01rWZzEixZbnvQ/4YOd19cXYZ8fCqoMF6RtlZQDuk+pXFnZIpzByIFOMg=="
+    },
+    "media-typer": {
+      "version": "0.3.0",
+      "resolved": 
"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz";,
+      "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
+    },
+    "merge-descriptors": {
+      "version": "1.0.1",
+      "resolved": 
"https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz";,
+      "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
+    },
+    "methods": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz";,
+      "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
+    },
+    "mime": {
+      "version": "1.3.4",
+      "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz";,
+      "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM="
+    },
+    "mime-db": {
+      "version": "1.30.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz";,
+      "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE="
+    },
+    "mime-types": {
+      "version": "2.1.17",
+      "resolved": 
"https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz";,
+      "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=",
+      "requires": {
+        "mime-db": "1.30.0"
+      }
+    },
+    "ms": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz";,
+      "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+    },
+    "negotiator": {
+      "version": "0.6.1",
+      "resolved": 
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz";,
+      "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
+    },
+    "on-finished": {
+      "version": "2.3.0",
+      "resolved": 
"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz";,
+      "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
+      "requires": {
+        "ee-first": "1.1.1"
+      }
+    },
+    "parseurl": {
+      "version": "1.3.2",
+      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz";,
+      "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
+    },
+    "path-to-regexp": {
+      "version": "0.1.7",
+      "resolved": 
"https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz";,
+      "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
+    },
+    "proxy-addr": {
+      "version": "1.1.5",
+      "resolved": 
"https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz";,
+      "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=",
+      "requires": {
+        "forwarded": "0.1.2",
+        "ipaddr.js": "1.4.0"
+      }
+    },
+    "qs": {
+      "version": "6.5.1",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz";,
+      "integrity": 
"sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
+    },
+    "range-parser": {
+      "version": "1.2.0",
+      "resolved": 
"https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz";,
+      "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
+    },
+    "raw-body": {
+      "version": "2.3.2",
+      "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz";,
+      "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
+      "requires": {
+        "bytes": "3.0.0",
+        "http-errors": "1.6.2",
+        "iconv-lite": "0.4.19",
+        "unpipe": "1.0.0"
+      }
+    },
+    "send": {
+      "version": "0.15.6",
+      "resolved": "https://registry.npmjs.org/send/-/send-0.15.6.tgz";,
+      "integrity": "sha1-IPI6nJJbdiq4JwX+L52yUqzkfjQ=",
+      "requires": {
+        "debug": "2.6.9",
+        "depd": "1.1.1",
+        "destroy": "1.0.4",
+        "encodeurl": "1.0.1",
+        "escape-html": "1.0.3",
+        "etag": "1.8.1",
+        "fresh": "0.5.2",
+        "http-errors": "1.6.2",
+        "mime": "1.3.4",
+        "ms": "2.0.0",
+        "on-finished": "2.3.0",
+        "range-parser": "1.2.0",
+        "statuses": "1.3.1"
+      }
+    },
+    "serve-static": {
+      "version": "1.12.6",
+      "resolved": 
"https://registry.npmjs.org/serve-static/-/serve-static-1.12.6.tgz";,
+      "integrity": "sha1-uXN3P2NEmTTaVOW+ul4x2fQhFXc=",
+      "requires": {
+        "encodeurl": "1.0.1",
+        "escape-html": "1.0.3",
+        "parseurl": "1.3.2",
+        "send": "0.15.6"
+      }
+    },
+    "setprototypeof": {
+      "version": "1.0.3",
+      "resolved": 
"https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz";,
+      "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
+    },
+    "statuses": {
+      "version": "1.3.1",
+      "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz";,
+      "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4="
+    },
+    "type-is": {
+      "version": "1.6.15",
+      "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz";,
+      "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=",
+      "requires": {
+        "media-typer": "0.3.0",
+        "mime-types": "2.1.17"
+      }
+    },
+    "unpipe": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz";,
+      "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
+    },
+    "utils-merge": {
+      "version": "1.0.0",
+      "resolved": 
"https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz";,
+      "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg="
+    },
+    "vary": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz";,
+      "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
+    }
+  }
+}
diff --git a/test/schema.graphql b/test/schema.graphql
index e63a0f65ab..2ec0fd9677 100644
--- a/test/schema.graphql
+++ b/test/schema.graphql
@@ -3,6 +3,7 @@ type Query {
 }
 
 type Person_type {
+  id: ID!,
   name: String
-  friends_foo: [Person_fo]
+  friends: [Person_type]
 }
diff --git a/test/simple-query.graphql b/test/simple-query.graphql
index 081d38e6c0..5dd38cc58a 100644
--- a/test/simple-query.graphql
+++ b/test/simple-query.graphql
@@ -1,5 +1,6 @@
-{
-  person(id:1){
+query ($id: ID!) {
+  person(id:$id){
+    id
     name
     friends {
       name
diff --git a/test/variables.json b/test/variables.json
new file mode 100644
index 0000000000..abe6681c58
--- /dev/null
+++ b/test/variables.json
@@ -0,0 +1,3 @@
+{
+  "id": 42
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]