diff --git a/engine/db/addDb.js b/engine/db/addDb.js index 6ba0fb6..1a40c09 100644 --- a/engine/db/addDb.js +++ b/engine/db/addDb.js @@ -133,9 +133,6 @@ async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumn const query = `INSERT INTO \`${tableName}\` (${insertKeysArray.join(",")}) VALUES (${insertValuesArray.map(() => "?").join(",")})`; const queryValuesArray = insertValuesArray; - console.log("DSQL: Query =>", query); - console.log("DSQL: Query Values =>", queryValuesArray); - const newInsert = await handler({ queryString: query, database: dbFullName, diff --git a/engine/index.js b/engine/index.js index 3d6db65..9767d8f 100644 --- a/engine/index.js +++ b/engine/index.js @@ -35,3 +35,8 @@ module.exports = dsqlEngine; //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// + +exports.add = dsqlEngine.db.add; +exports.update = dsqlEngine.db.update; +exports.delete = dsqlEngine.db.delete; +exports.query = dsqlEngine.db.query; diff --git a/engine/utils/handler.js b/engine/utils/handler.js index d49dd55..b45b1b4 100644 --- a/engine/utils/handler.js +++ b/engine/utils/handler.js @@ -18,7 +18,7 @@ const parseDbResults = require("./parseDbResults"); * * @returns {Promise} */ -module.exports = async function handler({ queryString, queryValuesArray, database, tableSchema, dbHost, dbUsername, dbPassword, encryptionKey, encryptionSalt }) { +async function handler({ queryString, queryValuesArray, database, tableSchema, dbHost, dbUsername, dbPassword, encryptionKey, encryptionSalt }) { const mysql = require("serverless-mysql")({ config: { host: dbHost, @@ -89,4 +89,6 @@ module.exports = async function handler({ queryString, queryValuesArray, databas console.log("\x1b[31mDSQL Database Handler No results returned\x1b[0m =>", results); return null; } -}; +} + +module.exports = handler; diff --git a/index.js b/index.js index d700e66..a484a63 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,7 @@ const reAuthUser = require("./users/reauth-user"); const getUser = require("./users/get-user"); const loginWithGoogle = require("./users/social/google-auth"); const sanitizeSql = require("./utils/functions/sanitizeSql"); +const engine = require("./engine/index"); /** ****************************************************************************** */ /** ****************************************************************************** */ @@ -24,9 +25,8 @@ const sanitizeSql = require("./utils/functions/sanitizeSql"); /** ****************************************************************************** */ /** - * ============================================================================== * User Functions Object - * ============================================================================== + * =================================== */ const user = { createUser: createUser, @@ -42,18 +42,16 @@ const user = { }; /** - * ============================================================================== * Media Functions Object - * ============================================================================== + * =================================== */ const media = { uploadImage: uploadImage, }; /** - * ============================================================================== * Main Export - * ============================================================================== + * =================================== */ const datasquirel = { get: get, @@ -61,10 +59,22 @@ const datasquirel = { media: media, user: user, sanitizeSql: sanitizeSql, + engine: engine, }; module.exports = datasquirel; -/** ********************************************** */ -/** ********************************************** */ -/** ********************************************** */ +//////////////////////////////////////// +//////////////////////////////////////// +//////////////////////////////////////// + +exports.get = datasquirel.get; +exports.post = datasquirel.post; +exports.media = datasquirel.media; +exports.user = datasquirel.user; +exports.sanitizeSql = datasquirel.sanitizeSql; +exports.engine = datasquirel.engine; + +//////////////////////////////////////// +//////////////////////////////////////// +//////////////////////////////////////// diff --git a/package.json b/package.json index 587c430..decbc02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.73", + "version": "1.1.74", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": {