This commit is contained in:
Tben 2023-08-08 15:55:27 +01:00
parent 1f9990f80e
commit 92b3c94db7
3 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.3.8", "version": "1.3.9",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -28,10 +28,11 @@ const https = require("https");
* @param {string} params.db - Database Name * @param {string} params.db - Database Name
* @param {string} params.query - SQL Query * @param {string} params.query - SQL Query
* @param {string[]} [params.queryValues] - An array of query values if using "?" placeholders * @param {string[]} [params.queryValues] - An array of query values if using "?" placeholders
* @param {string} [params.tableName] - Name of the table to query
* *
* @returns { Promise<GetReturn> } - Return Object * @returns { Promise<GetReturn> } - Return Object
*/ */
async function get({ key, db, query, queryValues }) { async function get({ key, db, query, queryValues, tableName }) {
/** /**
* Make https request * Make https request
* *
@ -44,7 +45,7 @@ async function get({ key, db, query, queryValues }) {
.replace(/ /g, "+")}`; .replace(/ /g, "+")}`;
if (queryValues) { if (queryValues) {
path += `&queryValues=${JSON.stringify(queryValues)}`; path += `&queryValues=${JSON.stringify(queryValues)}${tableName ? `&tableName=${tableName}` : ""}}`;
} }
https https

View File

@ -1,3 +1,5 @@
// @ts-check
/** /**
* Imports * Imports
*/ */
@ -42,10 +44,11 @@ const https = require("https");
* @param {string} params.database - Database Name * @param {string} params.database - Database Name
* @param {PostDataPayload | string} params.query - SQL query String or Request Object * @param {PostDataPayload | string} params.query - SQL query String or Request Object
* @param {any[]} [params.queryValues] - Query Values if using "?" placeholders * @param {any[]} [params.queryValues] - Query Values if using "?" placeholders
* @param {string} [params.tableName] - Name of the table to query
* *
* @returns { Promise<PostReturn> } - Return Object * @returns { Promise<PostReturn> } - Return Object
*/ */
async function post({ key, query, queryValues, database }) { async function post({ key, query, queryValues, database, tableName }) {
/** /**
* Make https request * Make https request
* *
@ -56,6 +59,7 @@ async function post({ key, query, queryValues, database }) {
query, query,
queryValues, queryValues,
database, database,
tableName,
}).replace(/\n|\r|\n\r/gm, ""); }).replace(/\n|\r|\n\r/gm, "");
try { try {