Update Types and Bugfixes

This commit is contained in:
Benjamin Toby 2024-10-18 07:02:16 +01:00
parent 30f607ce8d
commit bf1d7f5fcd
3 changed files with 2 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "2.1.7", "version": "2.2.0",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@ -8,6 +8,7 @@ function serializeQuery({ query }) {
/** @type {string[]} */ /** @type {string[]} */
const queryArr = []; const queryArr = [];
keys.forEach((key) => { keys.forEach((key) => {
if (!key || !query[key]) return;
queryArr.push(`${key}=${query[key]}`); queryArr.push(`${key}=${query[key]}`);
}); });
str += queryArr.join("&"); str += queryArr.join("&");

View File

@ -101,23 +101,8 @@ async function get({ key, db, query, queryValues, tableName }) {
const queryString = serializeQuery({ query: queryObject }); 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}`; let path = `/api/query/get${queryString}`;
if (queryValues) {
path += `&queryValues=${JSON.stringify(queryValues)}`;
}
if (tableName) {
path += `&tableName=${tableName}`;
}
/** @type {https.RequestOptions} */ /** @type {https.RequestOptions} */
const requestObject = { const requestObject = {
method: "GET", method: "GET",