mirror of
https://github.com/Ratstail91/sineQL.git
synced 2025-11-29 02:34:28 +11:00
tweak
This commit is contained in:
@@ -19,7 +19,6 @@ const sineQL = (schema, { queryHandlers }, options = {}) => {
|
|||||||
try {
|
try {
|
||||||
//parse the query
|
//parse the query
|
||||||
const tokens = parseInput(reqBody, true, options);
|
const tokens = parseInput(reqBody, true, options);
|
||||||
const queryTree = parseQueryTree(tokens, typeGraph, options);
|
|
||||||
|
|
||||||
switch(tokens[0]) {
|
switch(tokens[0]) {
|
||||||
//check for leading keywords
|
//check for leading keywords
|
||||||
@@ -32,6 +31,7 @@ const sineQL = (schema, { queryHandlers }, options = {}) => {
|
|||||||
|
|
||||||
//no leading keyword - regular query
|
//no leading keyword - regular query
|
||||||
default: {
|
default: {
|
||||||
|
const queryTree = parseQueryTree(tokens, typeGraph, options);
|
||||||
const result = await queryHandlers[queryTree.typeName](queryTree, typeGraph);
|
const result = await queryHandlers[queryTree.typeName](queryTree, typeGraph);
|
||||||
|
|
||||||
if (options.debug) {
|
if (options.debug) {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
const parseQueryTree = (tokens, typeGraph, options) => {
|
const parseQueryTree = (tokens, typeGraph, options) => {
|
||||||
let current = 1; //primed
|
let current = 1; //primed
|
||||||
|
|
||||||
//TODO: check for top-level keywords
|
|
||||||
|
|
||||||
//get a token that matches a type
|
//get a token that matches a type
|
||||||
if (!typeGraph[tokens[current - 1]]) {
|
if (!typeGraph[tokens[current - 1]]) {
|
||||||
throw `Expected a type in the type graph (found ${tokens[current - 1]})`;
|
throw `Expected a type in the type graph (found ${tokens[current - 1]})`;
|
||||||
|
|||||||
Reference in New Issue
Block a user