From bf1d7f5fcd146406d0ef57dc6259bbbecaae624c Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 18 Oct 2024 07:02:16 +0100 Subject: [PATCH] Update Types and Bugfixes --- package.json | 2 +- utils/functions/serialize-query.js | 1 + utils/get.js | 15 --------------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 9997932..7950ee0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "2.1.7", + "version": "2.2.0", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/utils/functions/serialize-query.js b/utils/functions/serialize-query.js index a05fa09..5e56d62 100644 --- a/utils/functions/serialize-query.js +++ b/utils/functions/serialize-query.js @@ -8,6 +8,7 @@ function serializeQuery({ query }) { /** @type {string[]} */ const queryArr = []; keys.forEach((key) => { + if (!key || !query[key]) return; queryArr.push(`${key}=${query[key]}`); }); str += queryArr.join("&"); diff --git a/utils/get.js b/utils/get.js index 093c232..29b3b0e 100644 --- a/utils/get.js +++ b/utils/get.js @@ -101,23 +101,8 @@ async function get({ key, db, query, queryValues, tableName }) { const queryString = serializeQuery({ query: queryObject }); - // let path = `/api/query/get?db=${db}&query=${query - // .replace(/\n|\r|\n\r/g, "") - // .replace(/ {2,}/g, " ") - // .replace(/ /g, "+")}`; - - console.log("queryString =>", queryString); - let path = `/api/query/get${queryString}`; - if (queryValues) { - path += `&queryValues=${JSON.stringify(queryValues)}`; - } - - if (tableName) { - path += `&tableName=${tableName}`; - } - /** @type {https.RequestOptions} */ const requestObject = { method: "GET",