This commit is contained in:
Benjamin Toby 2025-02-19 20:01:50 +01:00
parent c08db13f3d
commit e9bb9fb07f
113 changed files with 253 additions and 63 deletions

3
dist/engine/dump.js vendored
View File

@ -3,7 +3,7 @@
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
var _a, _b; var _a, _b, _c;
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path")); const path_1 = __importDefault(require("path"));
const child_process_1 = require("child_process"); const child_process_1 = require("child_process");
@ -46,5 +46,6 @@ try {
//////////////////////////////////////// ////////////////////////////////////////
} }
catch (error) { catch (error) {
(_c = global.ERROR_CALLBACK) === null || _c === void 0 ? void 0 : _c.call(global, `MariaDB Dump Error`, error);
console.log("Dump Error: ", error.message); console.log("Dump Error: ", error.message);
} }

2
dist/index.d.ts vendored
View File

@ -4,6 +4,7 @@ declare global {
var DSQL_READ_ONLY_DB_CONN: ServerlessMysql | undefined; var DSQL_READ_ONLY_DB_CONN: ServerlessMysql | undefined;
var DSQL_FULL_ACCESS_DB_CONN: ServerlessMysql | undefined; var DSQL_FULL_ACCESS_DB_CONN: ServerlessMysql | undefined;
var DSQL_USE_LOCAL: boolean | undefined; var DSQL_USE_LOCAL: boolean | undefined;
var ERROR_CALLBACK: ErrorCallback | undefined;
} }
import get from "./package-shared/actions/get"; import get from "./package-shared/actions/get";
import post from "./package-shared/actions/post"; import post from "./package-shared/actions/post";
@ -38,6 +39,7 @@ import deleteUser from "./package-shared/actions/users/delete-user";
import dsqlCrud from "./package-shared/utils/data-fetching/crud"; import dsqlCrud from "./package-shared/utils/data-fetching/crud";
import dsqlMethodCrud from "./package-shared/utils/data-fetching/method-crud"; import dsqlMethodCrud from "./package-shared/utils/data-fetching/method-crud";
import debugLog from "./package-shared/utils/logging/debug-log"; import debugLog from "./package-shared/utils/logging/debug-log";
import { ErrorCallback } from "./package-shared/types";
/** /**
* Main Export * Main Export
*/ */

View File

@ -58,6 +58,7 @@ function post(_a) {
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
*/ */
const httpResponse = yield new Promise((resolve, reject) => { const httpResponse = yield new Promise((resolve, reject) => {
var _a;
const reqPayloadString = JSON.stringify({ const reqPayloadString = JSON.stringify({
query, query,
queryValues, queryValues,
@ -68,8 +69,7 @@ function post(_a) {
JSON.parse(reqPayloadString); JSON.parse(reqPayloadString);
} }
catch (error) { catch (error) {
console.log(error); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Parsing HTTP response for post action`, error);
console.log(reqPayloadString);
return { return {
success: false, success: false,
payload: null, payload: null,

View File

@ -19,6 +19,7 @@ const grab_host_names_1 = __importDefault(require("../utils/grab-host-names"));
*/ */
function uploadImage(_a) { function uploadImage(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, user_id, }) { return __awaiter(this, arguments, void 0, function* ({ key, payload, user_id, }) {
var _b;
const grabedHostNames = (0, grab_host_names_1.default)(); const grabedHostNames = (0, grab_host_names_1.default)();
const { host, port, scheme } = grabedHostNames; const { host, port, scheme } = grabedHostNames;
try { try {
@ -66,6 +67,7 @@ function uploadImage(_a) {
} }
catch (error) { catch (error) {
console.log("Error in uploading file: ", error.message); console.log("Error in uploading file: ", error.message);
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Uploading File`, error);
return { return {
success: false, success: false,
payload: null, payload: null,

View File

@ -20,6 +20,7 @@ const grab_host_names_1 = __importDefault(require("../utils/grab-host-names"));
*/ */
function uploadImage(_a) { function uploadImage(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, user_id, }) { return __awaiter(this, arguments, void 0, function* ({ key, payload, user_id, }) {
var _b;
const grabedHostNames = (0, grab_host_names_1.default)(); const grabedHostNames = (0, grab_host_names_1.default)();
const { host, port, scheme } = grabedHostNames; const { host, port, scheme } = grabedHostNames;
try { try {
@ -67,6 +68,7 @@ function uploadImage(_a) {
} }
catch (error) { catch (error) {
console.log("Error in uploading image: ", error.message); console.log("Error in uploading image: ", error.message);
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Uploading Image`, error);
return { return {
success: false, success: false,
payload: null, payload: null,

View File

@ -14,6 +14,7 @@ const parseCookies_1 = __importDefault(require("../../utils/backend/parseCookies
* string and csrf token string * string and csrf token string
*/ */
function getToken({ request, encryptionKey, encryptionSalt, cookieString, }) { function getToken({ request, encryptionKey, encryptionSalt, cookieString, }) {
var _a;
try { try {
/** /**
* Grab the payload * Grab the payload
@ -61,6 +62,7 @@ function getToken({ request, encryptionKey, encryptionSalt, cookieString, }) {
return { key, csrf }; return { key, csrf };
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Getting Token`, error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -26,7 +26,7 @@ const debug_log_1 = __importDefault(require("../../utils/logging/debug-log"));
*/ */
function loginUser(_a) { function loginUser(_a) {
return __awaiter(this, arguments, void 0, function* ({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, }) { return __awaiter(this, arguments, void 0, function* ({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, apiUserID, skipWriteAuthFile, dbUserId, debug, }) {
var _b; var _b, _c;
const grabedHostNames = (0, grab_host_names_1.default)({ userId: user_id || apiUserID }); const grabedHostNames = (0, grab_host_names_1.default)({ userId: user_id || apiUserID });
const { host, port, scheme } = grabedHostNames; const { host, port, scheme } = grabedHostNames;
const defaultTempLoginFieldName = "temp_login_code"; const defaultTempLoginFieldName = "temp_login_code";
@ -164,7 +164,9 @@ function loginUser(_a) {
if (token && encryptedPayload) if (token && encryptedPayload)
httpResponse["token"] = encryptedPayload; httpResponse["token"] = encryptedPayload;
} }
catch (error) { } catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Login User HTTP Response Error`, error);
}
const cookieNames = (0, get_auth_cookie_names_1.default)({ const cookieNames = (0, get_auth_cookie_names_1.default)({
database, database,
userId: grabedHostNames.user_id, userId: grabedHostNames.user_id,
@ -183,7 +185,7 @@ function loginUser(_a) {
} }
response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [ response === null || response === void 0 ? void 0 : response.setHeader("Set-Cookie", [
`${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Secure=true`, `${authKeyName}=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Secure=true`,
`${csrfName}=${(_b = httpResponse.payload) === null || _b === void 0 ? void 0 : _b.csrf_k};samesite=strict;path=/;HttpOnly=true`, `${csrfName}=${(_c = httpResponse.payload) === null || _c === void 0 ? void 0 : _c.csrf_k};samesite=strict;path=/;HttpOnly=true`,
]); ]);
if (debug) { if (debug) {
debugFn("Response Sent!"); debugFn("Response Sent!");

View File

@ -15,6 +15,7 @@ const debug_log_1 = __importDefault(require("../../utils/logging/debug-log"));
* # Logout user * # Logout user
*/ */
function logoutUser({ response, database, dsqlUserId, encryptedUserString, request, cookieString, debug, }) { function logoutUser({ response, database, dsqlUserId, encryptedUserString, request, cookieString, debug, }) {
var _a;
/** /**
* Check Encryption Keys * Check Encryption Keys
* *
@ -83,6 +84,7 @@ function logoutUser({ response, database, dsqlUserId, encryptedUserString, reque
} }
catch (error) { catch (error) {
console.log("Logout Error:", error.message); console.log("Logout Error:", error.message);
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Logout User Error`, error);
return { return {
success: false, success: false,
msg: "Logout Failed", msg: "Logout Failed",

View File

@ -123,11 +123,12 @@ function githubAuth(_a) {
str += chunk; str += chunk;
}); });
response.on("end", function () { response.on("end", function () {
var _a;
try { try {
resolve(JSON.parse(str)); resolve(JSON.parse(str));
} }
catch (error) { catch (error) {
console.log(error); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Github Auth Error`, error);
resolve({ resolve({
success: false, success: false,
user: null, user: null,

View File

@ -23,6 +23,7 @@ const yearInMilliseconds = dayInMilliseconds * 365;
* with the user's data * with the user's data
*/ */
function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, dsqlUserId, encryptedUserString, expiry = weekInMilliseconds, cookieString, csrfHeaderName, debug, }) { function userAuth({ request, req, encryptionKey, encryptionSalt, level, database, dsqlUserId, encryptedUserString, expiry = weekInMilliseconds, cookieString, csrfHeaderName, debug, }) {
var _a;
try { try {
const finalRequest = req || request; const finalRequest = req || request;
const { user_id } = (0, grab_host_names_1.default)({ userId: dsqlUserId }); const { user_id } = (0, grab_host_names_1.default)({ userId: dsqlUserId });
@ -147,6 +148,7 @@ function userAuth({ request, req, encryptionKey, encryptionSalt, level, database
}; };
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `User Auth Error`, error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -22,6 +22,7 @@ const ejson_1 = __importDefault(require("../../utils/ejson"));
*/ */
function validateTempEmailCode(_a) { function validateTempEmailCode(_a) {
return __awaiter(this, arguments, void 0, function* ({ request, email, cookieString, }) { return __awaiter(this, arguments, void 0, function* ({ request, email, cookieString, }) {
var _b;
try { try {
const keyNames = (0, get_auth_cookie_names_1.default)(); const keyNames = (0, get_auth_cookie_names_1.default)();
const oneTimeCodeCookieName = keyNames.oneTimeCodeName; const oneTimeCodeCookieName = keyNames.oneTimeCodeName;
@ -40,6 +41,7 @@ function validateTempEmailCode(_a) {
return null; return null;
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Validate Temp Email Code Error`, error);
console.log("validateTempEmailCode error:", error.message); console.log("validateTempEmailCode error:", error.message);
return null; return null;
} }

View File

@ -11,6 +11,7 @@ const decrypt_1 = __importDefault(require("../../functions/dsql/decrypt"));
* @description This Function takes in a encrypted token and returns a user object * @description This Function takes in a encrypted token and returns a user object
*/ */
function validateToken({ token, encryptionKey, encryptionSalt, }) { function validateToken({ token, encryptionKey, encryptionSalt, }) {
var _a;
try { try {
/** /**
* Grab the payload * Grab the payload
@ -53,6 +54,7 @@ function validateToken({ token, encryptionKey, encryptionSalt, }) {
return userObject; return userObject;
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Validate Token Error`, error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -22,6 +22,7 @@ const grab_query_and_values_1 = __importDefault(require("../../../utils/grab-que
*/ */
function apiGet(_a) { function apiGet(_a) {
return __awaiter(this, arguments, void 0, function* ({ query, dbFullName, queryValues, tableName, dbSchema, debug, dbContext, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ query, dbFullName, queryValues, tableName, dbSchema, debug, dbContext, forceLocal, }) {
var _b;
const queryAndValues = (0, grab_query_and_values_1.default)({ const queryAndValues = (0, grab_query_and_values_1.default)({
query, query,
values: queryValues, values: queryValues,
@ -78,6 +79,7 @@ function apiGet(_a) {
component: "/api/query/get/lines-85-94", component: "/api/query/get/lines-85-94",
message: error.message, message: error.message,
}); });
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `API Get Error`, error);
if (debug && global.DSQL_USE_LOCAL) { if (debug && global.DSQL_USE_LOCAL) {
console.log("apiGet:error", error.message); console.log("apiGet:error", error.message);
} }

View File

@ -21,7 +21,7 @@ const runQuery_1 = __importDefault(require("../../backend/db/runQuery"));
*/ */
function apiPost(_a) { function apiPost(_a) {
return __awaiter(this, arguments, void 0, function* ({ query, dbFullName, queryValues, tableName, dbSchema, dbContext, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ query, dbFullName, queryValues, tableName, dbSchema, dbContext, forceLocal, }) {
var _b; var _b, _c;
if (typeof query === "string" && (query === null || query === void 0 ? void 0 : query.match(/^create |^alter |^drop /i))) { if (typeof query === "string" && (query === null || query === void 0 ? void 0 : query.match(/^create |^alter |^drop /i))) {
return { success: false, msg: "Wrong Input" }; return { success: false, msg: "Wrong Input" };
} }
@ -75,6 +75,7 @@ function apiPost(_a) {
component: "/api/query/post/lines-132-142", component: "/api/query/post/lines-132-142",
message: error.message, message: error.message,
}); });
(_c = global.ERROR_CALLBACK) === null || _c === void 0 ? void 0 : _c.call(global, `API Post Error`, error);
return { return {
success: false, success: false,
payload: results, payload: results,

View File

@ -22,7 +22,7 @@ const hashPassword_1 = __importDefault(require("../../dsql/hashPassword"));
*/ */
function googleLogin(_a) { function googleLogin(_a) {
return __awaiter(this, arguments, void 0, function* ({ usertype, foundUser, isSocialValidated, isUserValid, reqBody, serverRes, loginFailureReason, }) { return __awaiter(this, arguments, void 0, function* ({ usertype, foundUser, isSocialValidated, isUserValid, reqBody, serverRes, loginFailureReason, }) {
var _b; var _b, _c;
const client = new google_auth_library_1.OAuth2Client(process.env.DSQL_GOOGLE_CLIENT_ID); const client = new google_auth_library_1.OAuth2Client(process.env.DSQL_GOOGLE_CLIENT_ID);
let isGoogleAuthValid = false; let isGoogleAuthValid = false;
let newFoundUser = null; let newFoundUser = null;
@ -114,6 +114,7 @@ function googleLogin(_a) {
component: "googleLogin", component: "googleLogin",
message: error.message, message: error.message,
}); });
(_c = global.ERROR_CALLBACK) === null || _c === void 0 ? void 0 : _c.call(global, `Google Login Error`, error);
loginFailureReason = error; loginFailureReason = error;
isUserValid = false; isUserValid = false;
isSocialValidated = false; isSocialValidated = false;

View File

@ -26,6 +26,7 @@ const loginSocialUser_1 = __importDefault(require("./loginSocialUser"));
*/ */
function handleSocialDb(_a) { function handleSocialDb(_a) {
return __awaiter(this, arguments, void 0, function* ({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, }) { return __awaiter(this, arguments, void 0, function* ({ database, social_id, email, social_platform, payload, invitation, supEmail, additionalFields, debug, }) {
var _b;
try { try {
const finalDbName = global.DSQL_USE_LOCAL const finalDbName = global.DSQL_USE_LOCAL
? undefined ? undefined
@ -209,6 +210,7 @@ function handleSocialDb(_a) {
} }
catch (error) { catch (error) {
console.log("ERROR in 'handleSocialDb.ts' backend function =>", error.message); console.log("ERROR in 'handleSocialDb.ts' backend function =>", error.message);
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Handle Social DB Error`, error);
return { return {
success: false, success: false,
payload: null, payload: null,

View File

@ -27,6 +27,7 @@ const LOCAL_DB_HANDLER_1 = __importDefault(require("../../utils/backend/global-d
*/ */
function addAdminUserOnLogin(_a) { function addAdminUserOnLogin(_a) {
return __awaiter(this, arguments, void 0, function* ({ query, user, }) { return __awaiter(this, arguments, void 0, function* ({ query, user, }) {
var _b;
try { try {
const finalDbHandler = global.DSQL_USE_LOCAL const finalDbHandler = global.DSQL_USE_LOCAL
? LOCAL_DB_HANDLER_1.default ? LOCAL_DB_HANDLER_1.default
@ -100,6 +101,7 @@ function addAdminUserOnLogin(_a) {
} }
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Add Admin User On Login Error`, error);
(0, serverError_1.default)({ (0, serverError_1.default)({
component: "addAdminUserOnLogin", component: "addAdminUserOnLogin",
message: error.message, message: error.message,

View File

@ -16,6 +16,7 @@ const grabAuthDirs = () => {
}; };
exports.grabAuthDirs = grabAuthDirs; exports.grabAuthDirs = grabAuthDirs;
const initAuthFiles = () => { const initAuthFiles = () => {
var _a;
try { try {
const authDirs = (0, exports.grabAuthDirs)(); const authDirs = (0, exports.grabAuthDirs)();
if (!fs_1.default.existsSync(authDirs.root)) if (!fs_1.default.existsSync(authDirs.root))
@ -26,6 +27,7 @@ const initAuthFiles = () => {
} }
catch (error) { catch (error) {
console.log(`Error initializing Auth Files: ${error.message}`); console.log(`Error initializing Auth Files: ${error.message}`);
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Initializing Auth Files`, error);
return false; return false;
} }
}; };

View File

@ -24,7 +24,7 @@ const check_if_is_master_1 = __importDefault(require("../../../utils/check-if-is
*/ */
function addDbEntry(_a) { function addDbEntry(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt, forceLocal, }) {
var _b, _c; var _b, _c, _d;
/** /**
* Initialize variables * Initialize variables
*/ */
@ -132,6 +132,7 @@ function addDbEntry(_a) {
} }
catch (error) { catch (error) {
console.log("DSQL: Error in parsing data keys =>", error.message); console.log("DSQL: Error in parsing data keys =>", error.message);
(_d = global.ERROR_CALLBACK) === null || _d === void 0 ? void 0 : _d.call(global, `Error parsing Data Keys`, error);
continue; continue;
} }
} }

View File

@ -21,6 +21,7 @@ const conn_db_handler_1 = __importDefault(require("../../../utils/db/conn-db-han
*/ */
function deleteDbEntry(_a) { function deleteDbEntry(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbContext, dbFullName, tableName, identifierColumnName, identifierValue, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ dbContext, dbFullName, tableName, identifierColumnName, identifierValue, forceLocal, }) {
var _b;
try { try {
const isMaster = forceLocal const isMaster = forceLocal
? true ? true
@ -46,6 +47,7 @@ function deleteDbEntry(_a) {
return deletedEntry; return deletedEntry;
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Deleting Entry`, error);
return null; return null;
} }
}); });

View File

@ -22,7 +22,7 @@ const path_1 = __importDefault(require("path"));
*/ */
function dbHandler(...args) { function dbHandler(...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a; var _a, _b;
((_a = process.env.NODE_ENV) === null || _a === void 0 ? void 0 : _a.match(/dev/)) && ((_a = process.env.NODE_ENV) === null || _a === void 0 ? void 0 : _a.match(/dev/)) &&
fs_1.default.appendFileSync("./.tmp/sqlQuery.sql", args[0] + "\n" + Date() + "\n\n\n", "utf8"); fs_1.default.appendFileSync("./.tmp/sqlQuery.sql", args[0] + "\n" + Date() + "\n\n\n", "utf8");
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
@ -50,6 +50,7 @@ function dbHandler(...args) {
fs_1.default.mkdirSync(tmpFolder, { recursive: true }); fs_1.default.mkdirSync(tmpFolder, { recursive: true });
fs_1.default.appendFileSync(path_1.default.resolve(tmpFolder, "./dbErrorLogs.txt"), JSON.stringify(error, null, 4) + "\n" + Date() + "\n\n\n", "utf8"); fs_1.default.appendFileSync(path_1.default.resolve(tmpFolder, "./dbErrorLogs.txt"), JSON.stringify(error, null, 4) + "\n" + Date() + "\n\n\n", "utf8");
results = null; results = null;
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `DB Handler Error`, error);
(0, serverError_1.default)({ (0, serverError_1.default)({
component: "dbHandler", component: "dbHandler",
message: error.message, message: error.message,

View File

@ -21,6 +21,7 @@ const serverError_1 = __importDefault(require("./serverError"));
*/ */
function fullAccessDbHandler(_a) { function fullAccessDbHandler(_a) {
return __awaiter(this, arguments, void 0, function* ({ queryString, tableSchema, queryValuesArray, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ queryString, tableSchema, queryValuesArray, forceLocal, }) {
var _b;
/** /**
* Declare variables * Declare variables
* *
@ -41,6 +42,7 @@ function fullAccessDbHandler(_a) {
} }
catch (error) { catch (error) {
//////////////////////////////////////// ////////////////////////////////////////
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Full Access DB Handler Error`, error);
(0, serverError_1.default)({ (0, serverError_1.default)({
component: "fullAccessDbHandler", component: "fullAccessDbHandler",
message: error.message, message: error.message,

View File

@ -11,6 +11,7 @@ const path_1 = __importDefault(require("path"));
* # Grab User Schema Data * # Grab User Schema Data
*/ */
function grabUserSchemaData({ userId, }) { function grabUserSchemaData({ userId, }) {
var _a;
try { try {
const userSchemaFilePath = path_1.default.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`); const userSchemaFilePath = path_1.default.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`);
const userSchemaData = JSON.parse(fs_1.default.readFileSync(userSchemaFilePath, "utf-8")); const userSchemaData = JSON.parse(fs_1.default.readFileSync(userSchemaFilePath, "utf-8"));
@ -21,6 +22,7 @@ function grabUserSchemaData({ userId, }) {
component: "grabUserSchemaData", component: "grabUserSchemaData",
message: error.message, message: error.message,
}); });
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Grabbing User Schema Data`, error);
return null; return null;
} }
} }

View File

@ -11,6 +11,7 @@ const path_1 = __importDefault(require("path"));
* # Set User Schema Data * # Set User Schema Data
*/ */
function setUserSchemaData({ userId, schemaData, }) { function setUserSchemaData({ userId, schemaData, }) {
var _a;
try { try {
const userSchemaFilePath = path_1.default.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`); const userSchemaFilePath = path_1.default.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`);
fs_1.default.writeFileSync(userSchemaFilePath, JSON.stringify(schemaData), "utf8"); fs_1.default.writeFileSync(userSchemaFilePath, JSON.stringify(schemaData), "utf8");
@ -21,6 +22,7 @@ function setUserSchemaData({ userId, schemaData, }) {
component: "/functions/backend/setUserSchemaData", component: "/functions/backend/setUserSchemaData",
message: error.message, message: error.message,
}); });
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Setting User Schema`, error);
return false; return false;
} }
} }

View File

@ -23,7 +23,7 @@ const grabSchemaFieldsFromData_1 = __importDefault(require("./grabSchemaFieldsFr
*/ */
function updateUsersTableSchema(_a) { function updateUsersTableSchema(_a) {
return __awaiter(this, arguments, void 0, function* ({ userId, database, newFields, newPayload, }) { return __awaiter(this, arguments, void 0, function* ({ userId, database, newFields, newPayload, }) {
var _b, _c; var _b, _c, _d;
try { try {
const dbFullName = database; const dbFullName = database;
const userSchemaData = (0, grabUserSchemaData_1.default)({ userId }); const userSchemaData = (0, grabUserSchemaData_1.default)({ userId });
@ -52,7 +52,7 @@ function updateUsersTableSchema(_a) {
return `Done!`; return `Done!`;
} }
catch (error) { catch (error) {
console.log(`addUsersTableToDb.ts ERROR: ${error.message}`); (_d = global.ERROR_CALLBACK) === null || _d === void 0 ? void 0 : _d.call(global, `Error Updating User Table Schema`, error);
(0, serverError_1.default)({ (0, serverError_1.default)({
component: "addUsersTableToDb", component: "addUsersTableToDb",
message: error.message, message: error.message,

View File

@ -22,6 +22,7 @@ const conn_db_handler_1 = __importDefault(require("../../utils/db/conn-db-handle
*/ */
function varDatabaseDbHandler(_a) { function varDatabaseDbHandler(_a) {
return __awaiter(this, arguments, void 0, function* ({ queryString, queryValuesArray, database, tableSchema, debug, }) { return __awaiter(this, arguments, void 0, function* ({ queryString, queryValuesArray, database, tableSchema, debug, }) {
var _b;
let CONNECTION = (0, grab_dsql_connection_1.default)({ fa: true }); let CONNECTION = (0, grab_dsql_connection_1.default)({ fa: true });
if (global.DSQL_USE_LOCAL) if (global.DSQL_USE_LOCAL)
CONNECTION = (0, grab_dsql_connection_1.default)({ local: true }); CONNECTION = (0, grab_dsql_connection_1.default)({ local: true });
@ -47,6 +48,7 @@ function varDatabaseDbHandler(_a) {
} }
catch (error) { catch (error) {
console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>", database, error); console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>", database, error);
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `VarDb Handler Error`, error);
(0, serverError_1.default)({ (0, serverError_1.default)({
component: "varDatabaseDbHandler/lines-52-53", component: "varDatabaseDbHandler/lines-52-53",
message: error.message, message: error.message,

View File

@ -22,6 +22,7 @@ const conn_db_handler_1 = __importDefault(require("../../utils/db/conn-db-handle
*/ */
function varReadOnlyDatabaseDbHandler(_a) { function varReadOnlyDatabaseDbHandler(_a) {
return __awaiter(this, arguments, void 0, function* ({ queryString, queryValuesArray, tableSchema, forceLocal, }) { return __awaiter(this, arguments, void 0, function* ({ queryString, queryValuesArray, tableSchema, forceLocal, }) {
var _b;
let results; let results;
const DB_CONN = forceLocal const DB_CONN = forceLocal
? global.DSQL_DB_CONN ? global.DSQL_DB_CONN
@ -35,6 +36,7 @@ function varReadOnlyDatabaseDbHandler(_a) {
message: error.message, message: error.message,
noMail: true, noMail: true,
}); });
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `VarReadOnlyDB Handler Error`, error);
return error.message; return error.message;
} }
finally { finally {

View File

@ -12,6 +12,7 @@ const grab_keys_1 = __importDefault(require("../../utils/grab-keys"));
* # Decrypt Function * # Decrypt Function
*/ */
function decrypt({ encryptedString, encryptionKey, encryptionSalt, }) { function decrypt({ encryptedString, encryptionKey, encryptionSalt, }) {
var _a;
if (!(encryptedString === null || encryptedString === void 0 ? void 0 : encryptedString.match(/./))) { if (!(encryptedString === null || encryptedString === void 0 ? void 0 : encryptedString.match(/./))) {
console.log("Encrypted string is invalid"); console.log("Encrypted string is invalid");
return encryptedString; return encryptedString;
@ -35,6 +36,7 @@ function decrypt({ encryptedString, encryptionKey, encryptionSalt, }) {
} }
catch (error) { catch (error) {
console.log("Error in decrypting =>", error.message); console.log("Error in decrypting =>", error.message);
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Decrypting data`, error);
return encryptedString; return encryptedString;
} }
} }

View File

@ -12,6 +12,7 @@ const grab_keys_1 = __importDefault(require("../../utils/grab-keys"));
* # Encrypt String * # Encrypt String
*/ */
function encrypt({ data, encryptionKey, encryptionSalt, }) { function encrypt({ data, encryptionKey, encryptionSalt, }) {
var _a;
if (!(data === null || data === void 0 ? void 0 : data.match(/./))) { if (!(data === null || data === void 0 ? void 0 : data.match(/./))) {
console.log("Encryption string is invalid"); console.log("Encryption string is invalid");
return data; return data;
@ -36,6 +37,7 @@ function encrypt({ data, encryptionKey, encryptionSalt, }) {
} }
catch (error) { catch (error) {
console.log("Error in encrypting =>", error.message); console.log("Error in encrypting =>", error.message);
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Encrypting Data`, error);
return data; return data;
} }
} }

View File

@ -26,6 +26,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
* @returns {Promise<object|null>} * @returns {Promise<object|null>}
*/ */
(() => __awaiter(void 0, void 0, void 0, function* () { (() => __awaiter(void 0, void 0, void 0, function* () {
var _a;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
try { try {
const result = yield CONNECTION.query("SELECT id,first_name,last_name FROM users LIMIT 3"); const result = yield CONNECTION.query("SELECT id,first_name,last_name FROM users LIMIT 3");
@ -33,6 +34,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
} }
catch (error) { catch (error) {
console.log("Connection query ERROR =>", error.message); console.log("Connection query ERROR =>", error.message);
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Checking DB`, error);
} }
finally { finally {
CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end(); CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end();

View File

@ -22,6 +22,7 @@ const addDbEntry_1 = __importDefault(require("../../functions/backend/db/addDbEn
*/ */
function checkDbRecordCreateDbSchema(_a) { function checkDbRecordCreateDbSchema(_a) {
return __awaiter(this, arguments, void 0, function* ({ userId, dbSchema, }) { return __awaiter(this, arguments, void 0, function* ({ userId, dbSchema, }) {
var _b;
try { try {
const { dbFullName, dbName, dbSlug, dbDescription, dbImage, childDatabase, childDatabaseDbFullName, } = dbSchema; const { dbFullName, dbName, dbSlug, dbDescription, dbImage, childDatabase, childDatabaseDbFullName, } = dbSchema;
let recordedDbEntryArray = userId let recordedDbEntryArray = userId
@ -58,6 +59,7 @@ function checkDbRecordCreateDbSchema(_a) {
return recordedDbEntry; return recordedDbEntry;
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Checking DB Record on Creating Schema`, error);
return undefined; return undefined;
} }
}); });

View File

@ -23,6 +23,7 @@ const addDbEntry_1 = __importDefault(require("../../functions/backend/db/addDbEn
*/ */
function checkTableRecordCreateDbSchema(_a) { function checkTableRecordCreateDbSchema(_a) {
return __awaiter(this, arguments, void 0, function* ({ userId, tableSchema, dbSchema, dbRecord, dbFullName, }) { return __awaiter(this, arguments, void 0, function* ({ userId, tableSchema, dbSchema, dbRecord, dbFullName, }) {
var _b;
if (!tableSchema) if (!tableSchema)
return undefined; return undefined;
try { try {
@ -86,6 +87,7 @@ function checkTableRecordCreateDbSchema(_a) {
return recordedTableEntry; return recordedTableEntry;
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Checking Table Record on Creating Schema`, error);
return undefined; return undefined;
} }
}); });

View File

@ -22,6 +22,7 @@ const varDatabaseDbHandler_1 = __importDefault(require("../utils/varDatabaseDbHa
*/ */
function handleIndexescreateDbFromSchema(_a) { function handleIndexescreateDbFromSchema(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbFullName, tableName, indexes, }) { return __awaiter(this, arguments, void 0, function* ({ dbFullName, tableName, indexes, }) {
var _b;
for (let g = 0; g < indexes.length; g++) { for (let g = 0; g < indexes.length; g++) {
const { indexType, indexName, indexTableFields, alias } = indexes[g]; const { indexType, indexName, indexTableFields, alias } = indexes[g];
if (!(alias === null || alias === void 0 ? void 0 : alias.match(/./))) if (!(alias === null || alias === void 0 ? void 0 : alias.match(/./)))
@ -42,6 +43,7 @@ function handleIndexescreateDbFromSchema(_a) {
throw new Error("This Index Does not Exist"); throw new Error("This Index Does not Exist");
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Handling Indexes on Creating Schema`, error);
/** /**
* @description Create new index if determined that it * @description Create new index if determined that it
* doesn't exist in MYSQL db * doesn't exist in MYSQL db

View File

@ -27,7 +27,7 @@ const defaultMariadbUserHost = process.env.DSQL_DB_HOST || "127.0.0.1";
*/ */
function refreshUsersAndGrants(_a) { function refreshUsersAndGrants(_a) {
return __awaiter(this, arguments, void 0, function* ({ userId, mariadbUserHost, mariadbUsername, sqlUserID, }) { return __awaiter(this, arguments, void 0, function* ({ userId, mariadbUserHost, mariadbUsername, sqlUserID, }) {
var _b, _c, _d, _e; var _b, _c, _d, _e, _f;
const mariadbUsers = (yield (0, dbHandler_1.default)({ const mariadbUsers = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM mariadb_users`, query: `SELECT * FROM mariadb_users`,
})); }));
@ -190,7 +190,7 @@ function refreshUsersAndGrants(_a) {
} }
} }
catch (error) { catch (error) {
console.log(`Error in adding SQL user =>`, error.message); (_f = global.ERROR_CALLBACK) === null || _f === void 0 ? void 0 : _f.call(global, `Error Refreshing MariaDB Users and Grants`, error);
} }
} }
}); });

View File

@ -22,6 +22,7 @@ const encrypt_1 = __importDefault(require("../../functions/dsql/encrypt"));
*/ */
function resetSQLCredentialsPasswords() { function resetSQLCredentialsPasswords() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const users = (yield (0, dbHandler_1.default)({ const users = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM users`, query: `SELECT * FROM users`,
})); }));
@ -61,7 +62,7 @@ function resetSQLCredentialsPasswords() {
} }
} }
catch (error) { catch (error) {
console.log(`Error Updating User ${user.id} Password =>`, error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Resetting MariaDB User Password`, error);
} }
} }
process.exit(); process.exit();

View File

@ -28,6 +28,7 @@ const tmpDir = process.argv[process.argv.length - 1];
*/ */
function createUser() { function createUser() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
/** /**
* Validate Form * Validate Form
* *
@ -126,7 +127,7 @@ function createUser() {
return true; return true;
} }
catch (error) { catch (error) {
console.log(`Error in creating user => ${error.message}`); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Creating User`, error);
return false; return false;
} }
}); });

View File

@ -24,6 +24,7 @@ const tmpDir = process.argv[process.argv.length - 1];
*/ */
function createUser() { function createUser() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
/** /**
* Validate Form * Validate Form
* *
@ -65,7 +66,7 @@ function createUser() {
return true; return true;
} }
catch (error) { catch (error) {
console.log(`Error in creating user => ${error.message}`); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Updating User`, error);
return false; return false;
} }
}); });

View File

@ -25,6 +25,7 @@ const encrypt_1 = __importDefault(require("../functions/dsql/encrypt"));
*/ */
function resetSQLCredentials() { function resetSQLCredentials() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const users = (yield (0, dbHandler_1.default)({ const users = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM users`, query: `SELECT * FROM users`,
})); }));
@ -63,6 +64,7 @@ function resetSQLCredentials() {
console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`); console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`);
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Resetting SQL credentials`, error);
console.log(`Error in adding SQL user =>`, error.message); console.log(`Error in adding SQL user =>`, error.message);
} }
} }

View File

@ -22,6 +22,7 @@ const encrypt_1 = __importDefault(require("../functions/dsql/encrypt"));
*/ */
function resetSQLCredentialsPasswords() { function resetSQLCredentialsPasswords() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const users = (yield (0, dbHandler_1.default)({ const users = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM users`, query: `SELECT * FROM users`,
})); }));
@ -51,7 +52,7 @@ function resetSQLCredentialsPasswords() {
console.log(`User ${user.id}: ${user.first_name} ${user.last_name} Password Updated successfully added.`); console.log(`User ${user.id}: ${user.first_name} ${user.last_name} Password Updated successfully added.`);
} }
catch (error) { catch (error) {
console.log(`Error Updating User ${user.id} Password =>`, error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Updating MariaDB User`, error);
} }
} }
process.exit(); process.exit();

View File

@ -28,6 +28,7 @@ const encrypt_1 = __importDefault(require("../functions/dsql/encrypt"));
*/ */
function setSQLCredentials() { function setSQLCredentials() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const users = (yield (0, dbHandler_1.default)({ const users = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM users`, query: `SELECT * FROM users`,
})); }));
@ -61,7 +62,7 @@ function setSQLCredentials() {
console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`); console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`);
} }
catch (error) { catch (error) {
console.log(`Error in adding SQL user =>`, error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Setting SQL credentials`, error);
} }
} }
}); });

View File

@ -26,6 +26,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
* @returns {Promise<object|null>} * @returns {Promise<object|null>}
*/ */
(() => __awaiter(void 0, void 0, void 0, function* () { (() => __awaiter(void 0, void 0, void 0, function* () {
var _a;
const CONNECTION = (0, grab_dsql_connection_1.default)({ noDb: true }); const CONNECTION = (0, grab_dsql_connection_1.default)({ noDb: true });
/** /**
* Switch Database * Switch Database
@ -38,7 +39,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
console.log("parsedResults =>", parsedResults); console.log("parsedResults =>", parsedResults);
} }
catch (error) { catch (error) {
console.log("Connection query ERROR =>", error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Testing External Server`, error);
} }
finally { finally {
CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end(); CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end();

View File

@ -33,6 +33,7 @@ const encrypt_1 = __importDefault(require("../functions/dsql/encrypt"));
*/ */
function testSQLEscape() { function testSQLEscape() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const users = (yield (0, dbHandler_1.default)({ const users = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM users`, query: `SELECT * FROM users`,
})); }));
@ -70,7 +71,7 @@ function testSQLEscape() {
console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`); console.log(`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`);
} }
catch (error) { catch (error) {
console.log(`Error in adding SQL user =>`, error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Testing SQL Escape`, error);
} }
} }
process.exit(); process.exit();

View File

@ -17,6 +17,7 @@ const fs_1 = __importDefault(require("fs"));
require("dotenv").config({ path: "./../.env" }); require("dotenv").config({ path: "./../.env" });
function updateChildrenTablesOnDb() { function updateChildrenTablesOnDb() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
/** /**
* Grab Schema * Grab Schema
* *
@ -48,7 +49,7 @@ function updateChildrenTablesOnDb() {
} }
} }
catch (error) { catch (error) {
console.log(error); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Updating Children Tables on DB`, error);
} }
process.exit(); process.exit();
}); });

View File

@ -32,6 +32,7 @@ const DB_HANDLER_1 = __importDefault(require("../utils/backend/global-db/DB_HAND
}).then((tables) => __awaiter(void 0, void 0, void 0, function* () { }).then((tables) => __awaiter(void 0, void 0, void 0, function* () {
// console.log(tables); // console.log(tables);
// process.exit(); // process.exit();
var _a;
for (let i = 0; i < tables.length; i++) { for (let i = 0; i < tables.length; i++) {
const table = tables[i]; const table = tables[i];
try { try {
@ -45,6 +46,7 @@ const DB_HANDLER_1 = __importDefault(require("../utils/backend/global-db/DB_HAND
message: error.message, message: error.message,
user: {}, user: {},
}); });
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Error Updating DB Slugs For Table Records`, error);
} }
} }
process.exit(); process.exit();

View File

@ -26,7 +26,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
* @returns {Promise<object|null>} * @returns {Promise<object|null>}
*/ */
(() => __awaiter(void 0, void 0, void 0, function* () { (() => __awaiter(void 0, void 0, void 0, function* () {
var _a; var _a, _b;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
try { try {
const result = yield CONNECTION.query("SELECT user,host,ssl_type FROM mysql.user"); const result = yield CONNECTION.query("SELECT user,host,ssl_type FROM mysql.user");
@ -47,7 +47,7 @@ const grab_dsql_connection_1 = __importDefault(require("../utils/grab-dsql-conne
} }
} }
catch (error) { catch (error) {
console.log("Connection query ERROR =>", error.message); (_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Error Updating SSL Users`, error);
} }
finally { finally {
CONNECTION.end(); CONNECTION.end();

View File

@ -22,6 +22,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../utils/grab-dsql-co
*/ */
function dbHandler(_a) { function dbHandler(_a) {
return __awaiter(this, arguments, void 0, function* ({ query, values, }) { return __awaiter(this, arguments, void 0, function* ({ query, values, }) {
var _b;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
let results; let results;
try { try {
@ -33,6 +34,7 @@ function dbHandler(_a) {
} }
} }
catch (error) { catch (error) {
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `DB Handler Error...`, error);
if (process.env.FIRST_RUN) { if (process.env.FIRST_RUN) {
return null; return null;
} }

View File

@ -16,12 +16,13 @@ exports.default = noDatabaseDbHandler;
const dbHandler_1 = __importDefault(require("./dbHandler")); const dbHandler_1 = __importDefault(require("./dbHandler"));
function noDatabaseDbHandler(queryString) { function noDatabaseDbHandler(queryString) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
let results; let results;
try { try {
results = yield (0, dbHandler_1.default)({ query: queryString }); results = yield (0, dbHandler_1.default)({ query: queryString });
} }
catch (error) { catch (error) {
console.log("ERROR in noDatabaseDbHandler =>", error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `No DB Handler Error`, error);
} }
if (results) { if (results) {
return results; return results;

View File

@ -1351,4 +1351,5 @@ export type DsqlCrudParam<T extends {
sanitize?: (data?: T) => T; sanitize?: (data?: T) => T;
debug?: boolean; debug?: boolean;
}; };
export type ErrorCallback = (title: string, error: Error) => void;
export {}; export {};

View File

@ -20,6 +20,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
*/ */
function DB_HANDLER(...args) { function DB_HANDLER(...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
try { try {
if (!CONNECTION) if (!CONNECTION)
@ -28,7 +29,7 @@ function DB_HANDLER(...args) {
return JSON.parse(JSON.stringify(results)); return JSON.parse(JSON.stringify(results));
} }
catch (error) { catch (error) {
console.log("DB Error =>", error); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `DB_HANDLER Error`, error);
return { return {
success: false, success: false,
error: error.message, error: error.message,

View File

@ -20,6 +20,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
*/ */
function DSQL_USER_DB_HANDLER(_a) { function DSQL_USER_DB_HANDLER(_a) {
return __awaiter(this, arguments, void 0, function* ({ paradigm, queryString, queryValues, }) { return __awaiter(this, arguments, void 0, function* ({ paradigm, queryString, queryValues, }) {
var _b;
const CONNECTION = paradigm == "Read Only" const CONNECTION = paradigm == "Read Only"
? (0, grab_dsql_connection_1.default)({ ro: true }) ? (0, grab_dsql_connection_1.default)({ ro: true })
: (0, grab_dsql_connection_1.default)({ fa: true }); : (0, grab_dsql_connection_1.default)({ fa: true });
@ -27,7 +28,7 @@ function DSQL_USER_DB_HANDLER(_a) {
return yield (0, conn_db_handler_1.default)(CONNECTION, queryString, queryValues); return yield (0, conn_db_handler_1.default)(CONNECTION, queryString, queryValues);
} }
catch (error) { catch (error) {
console.log(`DSQL_USER_DB_HANDLER Error: ${error.message}`); (_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `DSQL_USER_DB_HANDLER Error`, error);
return null; return null;
} }
finally { finally {

View File

@ -19,13 +19,14 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
*/ */
function LOCAL_DB_HANDLER(...args) { function LOCAL_DB_HANDLER(...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a;
const MASTER = (0, grab_dsql_connection_1.default)(); const MASTER = (0, grab_dsql_connection_1.default)();
try { try {
const results = yield MASTER.query(...args); const results = yield MASTER.query(...args);
return JSON.parse(JSON.stringify(results)); return JSON.parse(JSON.stringify(results));
} }
catch (error) { catch (error) {
console.log("DB Error =>", error.message); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `LOCAL_DB_HANDLER Error`, error);
return { return {
success: false, success: false,
error: error.message, error: error.message,

View File

@ -9,6 +9,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
* # DSQL user read-only DB handler * # DSQL user read-only DB handler
*/ */
function NO_DB_HANDLER(...args) { function NO_DB_HANDLER(...args) {
var _a;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
try { try {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -27,6 +28,7 @@ function NO_DB_HANDLER(...args) {
}); });
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `NO_DB_HANDLER Error`, error);
return { return {
success: false, success: false,
error: error.message, error: error.message,

View File

@ -9,6 +9,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
* # Root DB handler * # Root DB handler
*/ */
function ROOT_DB_HANDLER(...args) { function ROOT_DB_HANDLER(...args) {
var _a;
const CONNECTION = (0, grab_dsql_connection_1.default)(); const CONNECTION = (0, grab_dsql_connection_1.default)();
try { try {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -27,6 +28,7 @@ function ROOT_DB_HANDLER(...args) {
}); });
} }
catch (error) { catch (error) {
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `ROOT_DB_HANDLER Error`, error);
return { return {
success: false, success: false,
error: error.message, error: error.message,

View File

@ -9,6 +9,7 @@ exports.default = parseCookies;
* returns the cookies as a JS object * returns the cookies as a JS object
*/ */
function parseCookies({ request, cookieString, }) { function parseCookies({ request, cookieString, }) {
var _a;
try { try {
/** @type {string | undefined} */ /** @type {string | undefined} */
const cookieStr = request const cookieStr = request
@ -36,7 +37,7 @@ function parseCookies({ request, cookieString, }) {
return cookieObject; return cookieObject;
} }
catch (error) { catch (error) {
console.log(`ERROR parsing cookies: ${error.message}`); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Parse Cookies Error`, error);
return {}; return {};
} }
} }

View File

@ -20,7 +20,7 @@ const numberfy_1 = __importDefault(require("../numberfy"));
const crud_1 = __importDefault(require("./crud")); const crud_1 = __importDefault(require("./crud"));
function dsqlMethodCrud(_a) { function dsqlMethodCrud(_a) {
return __awaiter(this, arguments, void 0, function* ({ method, tableName, addUser, user, extraData, transformData, existingData, body, query, targetId, sanitize, transformQuery, debug, }) { return __awaiter(this, arguments, void 0, function* ({ method, tableName, addUser, user, extraData, transformData, existingData, body, query, targetId, sanitize, transformQuery, debug, }) {
var _b, _c; var _b, _c, _d;
let result = { let result = {
success: false, success: false,
}; };
@ -157,6 +157,7 @@ function dsqlMethodCrud(_a) {
return result; return result;
} }
catch (error) { catch (error) {
(_d = global.ERROR_CALLBACK) === null || _d === void 0 ? void 0 : _d.call(global, `Method Crud Error`, error);
return result; return result;
} }
}); });

View File

@ -29,6 +29,7 @@ query,
*/ */
values) { values) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
var _a, _b;
try { try {
if (!conn) if (!conn)
throw new Error("No Connection Found!"); throw new Error("No Connection Found!");
@ -47,7 +48,7 @@ values) {
resArray.push(JSON.parse(JSON.stringify(queryObjRes))); resArray.push(JSON.parse(JSON.stringify(queryObjRes)));
} }
catch (error) { catch (error) {
console.log(`connDbHandler Query Error: ${error.message}`); (_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `Connection DB Handler Query Error`, error);
resArray.push(null); resArray.push(null);
} }
} }
@ -58,8 +59,7 @@ values) {
} }
} }
catch (error) { catch (error) {
console.log(`connDbHandler Error: ${error.message}`); (_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Connection DB Handler Error`, error);
console.log(conn === null || conn === void 0 ? void 0 : conn.config());
return null; return null;
} }
finally { finally {

View File

@ -57,5 +57,6 @@ try {
//////////////////////////////////////// ////////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////////
} catch (error: any) { } catch (error: any) {
global.ERROR_CALLBACK?.(`MariaDB Dump Error`, error as Error);
console.log("Dump Error: ", error.message); console.log("Dump Error: ", error.message);
} }

View File

@ -5,6 +5,7 @@ declare global {
var DSQL_READ_ONLY_DB_CONN: ServerlessMysql | undefined; var DSQL_READ_ONLY_DB_CONN: ServerlessMysql | undefined;
var DSQL_FULL_ACCESS_DB_CONN: ServerlessMysql | undefined; var DSQL_FULL_ACCESS_DB_CONN: ServerlessMysql | undefined;
var DSQL_USE_LOCAL: boolean | undefined; var DSQL_USE_LOCAL: boolean | undefined;
var ERROR_CALLBACK: ErrorCallback | undefined;
} }
import get from "./package-shared/actions/get"; import get from "./package-shared/actions/get";
@ -46,6 +47,7 @@ import deleteUser from "./package-shared/actions/users/delete-user";
import dsqlCrud from "./package-shared/utils/data-fetching/crud"; import dsqlCrud from "./package-shared/utils/data-fetching/crud";
import dsqlMethodCrud from "./package-shared/utils/data-fetching/method-crud"; import dsqlMethodCrud from "./package-shared/utils/data-fetching/method-crud";
import debugLog from "./package-shared/utils/logging/debug-log"; import debugLog from "./package-shared/utils/logging/debug-log";
import { ErrorCallback } from "./package-shared/types";
/** /**
* User Functions Object * User Functions Object

View File

@ -83,8 +83,10 @@ export default async function post({
try { try {
JSON.parse(reqPayloadString); JSON.parse(reqPayloadString);
} catch (error) { } catch (error) {
console.log(error); global.ERROR_CALLBACK?.(
console.log(reqPayloadString); `Error Parsing HTTP response for post action`,
error as Error
);
return { return {
success: false, success: false,

View File

@ -87,6 +87,7 @@ export default async function uploadImage({
return httpResponse as Return; return httpResponse as Return;
} catch (error: any) { } catch (error: any) {
console.log("Error in uploading file: ", error.message); console.log("Error in uploading file: ", error.message);
global.ERROR_CALLBACK?.(`Error Uploading File`, error as Error);
return { return {
success: false, success: false,

View File

@ -91,6 +91,7 @@ export default async function uploadImage({
return httpResponse as FunctionReturn; return httpResponse as FunctionReturn;
} catch (error: any) { } catch (error: any) {
console.log("Error in uploading image: ", error.message); console.log("Error in uploading image: ", error.message);
global.ERROR_CALLBACK?.(`Error Uploading Image`, error as Error);
return { return {
success: false, success: false,

View File

@ -80,6 +80,8 @@ export default function getToken({
*/ */
return { key, csrf }; return { key, csrf };
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(`Error Getting Token`, error as Error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -229,7 +229,12 @@ export default async function loginUser({
try { try {
if (token && encryptedPayload) if (token && encryptedPayload)
httpResponse["token"] = encryptedPayload; httpResponse["token"] = encryptedPayload;
} catch (error) {} } catch (error) {
global.ERROR_CALLBACK?.(
`Login User HTTP Response Error`,
error as Error
);
}
const cookieNames = getAuthCookieNames({ const cookieNames = getAuthCookieNames({
database, database,

View File

@ -117,6 +117,8 @@ export default function logoutUser({
}; };
} catch (error: any) { } catch (error: any) {
console.log("Logout Error:", error.message); console.log("Logout Error:", error.message);
global.ERROR_CALLBACK?.(`Logout User Error`, error as Error);
return { return {
success: false, success: false,
msg: "Logout Failed", msg: "Logout Failed",

View File

@ -183,7 +183,10 @@ export default async function githubAuth({
try { try {
resolve(JSON.parse(str)); resolve(JSON.parse(str));
} catch (error) { } catch (error) {
console.log(error); global.ERROR_CALLBACK?.(
`Github Auth Error`,
error as Error
);
resolve({ resolve({
success: false, success: false,

View File

@ -199,6 +199,8 @@ export default function userAuth({
payload: userObject, payload: userObject,
}; };
} catch (error: any) { } catch (error: any) {
global.ERROR_CALLBACK?.(`User Auth Error`, error as Error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -44,6 +44,10 @@ export default async function validateTempEmailCode({
return null; return null;
} catch (error: any) { } catch (error: any) {
global.ERROR_CALLBACK?.(
`Validate Temp Email Code Error`,
error as Error
);
console.log("validateTempEmailCode error:", error.message); console.log("validateTempEmailCode error:", error.message);
return null; return null;
} }

View File

@ -66,6 +66,7 @@ export default function validateToken({
*/ */
return userObject; return userObject;
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(`Validate Token Error`, error as Error);
/** /**
* Return User Object * Return User Object
* *

View File

@ -101,6 +101,8 @@ export default async function apiGet<
message: error.message, message: error.message,
}); });
global.ERROR_CALLBACK?.(`API Get Error`, error as Error);
if (debug && global.DSQL_USE_LOCAL) { if (debug && global.DSQL_USE_LOCAL) {
console.log("apiGet:error", error.message); console.log("apiGet:error", error.message);
} }

View File

@ -94,6 +94,8 @@ export default async function apiPost({
message: error.message, message: error.message,
}); });
global.ERROR_CALLBACK?.(`API Post Error`, error as Error);
return { return {
success: false, success: false,
payload: results, payload: results,

View File

@ -139,6 +139,8 @@ export default async function googleLogin({
message: error.message, message: error.message,
}); });
global.ERROR_CALLBACK?.(`Google Login Error`, error as Error);
loginFailureReason = error; loginFailureReason = error;
isUserValid = false; isUserValid = false;

View File

@ -271,6 +271,8 @@ export default async function handleSocialDb({
error.message error.message
); );
global.ERROR_CALLBACK?.(`Handle Social DB Error`, error as Error);
return { return {
success: false, success: false,
payload: null, payload: null,

View File

@ -132,6 +132,11 @@ export default async function addAdminUserOnLogin({
); );
} }
} catch (error: any) { } catch (error: any) {
global.ERROR_CALLBACK?.(
`Add Admin User On Login Error`,
error as Error
);
serverError({ serverError({
component: "addAdminUserOnLogin", component: "addAdminUserOnLogin",
message: error.message, message: error.message,

View File

@ -22,6 +22,10 @@ export const initAuthFiles = () => {
return true; return true;
} catch (error: any) { } catch (error: any) {
console.log(`Error initializing Auth Files: ${error.message}`); console.log(`Error initializing Auth Files: ${error.message}`);
global.ERROR_CALLBACK?.(
`Error Initializing Auth Files`,
error as Error
);
return false; return false;
} }
}; };

View File

@ -170,6 +170,7 @@ export default async function addDbEntry({
} }
} catch (error: any) { } catch (error: any) {
console.log("DSQL: Error in parsing data keys =>", error.message); console.log("DSQL: Error in parsing data keys =>", error.message);
global.ERROR_CALLBACK?.(`Error parsing Data Keys`, error as Error);
continue; continue;
} }
} }

View File

@ -54,6 +54,7 @@ export default async function deleteDbEntry({
*/ */
return deletedEntry; return deletedEntry;
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(`Error Deleting Entry`, error as Error);
return null; return null;
} }
} }

View File

@ -49,6 +49,8 @@ export default async function dbHandler(...args: any[]) {
results = null; results = null;
global.ERROR_CALLBACK?.(`DB Handler Error`, error as Error);
serverError({ serverError({
component: "dbHandler", component: "dbHandler",
message: error.message, message: error.message,

View File

@ -41,6 +41,8 @@ export default async function fullAccessDbHandler({
} catch (error: any) { } catch (error: any) {
//////////////////////////////////////// ////////////////////////////////////////
global.ERROR_CALLBACK?.(`Full Access DB Handler Error`, error as Error);
serverError({ serverError({
component: "fullAccessDbHandler", component: "fullAccessDbHandler",
message: error.message, message: error.message,

View File

@ -26,6 +26,11 @@ export default function grabUserSchemaData({
message: error.message, message: error.message,
}); });
global.ERROR_CALLBACK?.(
`Error Grabbing User Schema Data`,
error as Error
);
return null; return null;
} }
} }

View File

@ -33,6 +33,8 @@ export default function setUserSchemaData({
message: error.message, message: error.message,
}); });
global.ERROR_CALLBACK?.(`Error Setting User Schema`, error as Error);
return false; return false;
} }
} }

View File

@ -65,7 +65,10 @@ export default async function updateUsersTableSchema({
return `Done!`; return `Done!`;
} catch (error: any) { } catch (error: any) {
console.log(`addUsersTableToDb.ts ERROR: ${error.message}`); global.ERROR_CALLBACK?.(
`Error Updating User Table Schema`,
error as Error
);
serverError({ serverError({
component: "addUsersTableToDb", component: "addUsersTableToDb",

View File

@ -55,6 +55,9 @@ export default async function varDatabaseDbHandler({
database, database,
error error
); );
global.ERROR_CALLBACK?.(`VarDb Handler Error`, error as Error);
serverError({ serverError({
component: "varDatabaseDbHandler/lines-52-53", component: "varDatabaseDbHandler/lines-52-53",
message: error.message, message: error.message,

View File

@ -34,6 +34,8 @@ export default async function varReadOnlyDatabaseDbHandler({
noMail: true, noMail: true,
}); });
global.ERROR_CALLBACK?.(`VarReadOnlyDB Handler Error`, error as Error);
return error.message; return error.message;
} finally { } finally {
DB_CONN?.end(); DB_CONN?.end();

View File

@ -52,6 +52,7 @@ export default function decrypt({
return decrypted; return decrypted;
} catch (error: any) { } catch (error: any) {
console.log("Error in decrypting =>", error.message); console.log("Error in decrypting =>", error.message);
global.ERROR_CALLBACK?.(`Error Decrypting data`, error as Error);
return encryptedString; return encryptedString;
} }
} }

View File

@ -53,6 +53,7 @@ export default function encrypt({
return encrypted; return encrypted;
} catch (error: any) { } catch (error: any) {
console.log("Error in encrypting =>", error.message); console.log("Error in encrypting =>", error.message);
global.ERROR_CALLBACK?.(`Error Encrypting Data`, error as Error);
return data; return data;
} }
} }

View File

@ -23,6 +23,7 @@ import grabDSQLConnection from "../utils/grab-dsql-connection";
console.log("Connection Query Success =>", result); console.log("Connection Query Success =>", result);
} catch (error: any) { } catch (error: any) {
console.log("Connection query ERROR =>", error.message); console.log("Connection query ERROR =>", error.message);
global.ERROR_CALLBACK?.(`Error Checking DB`, error as Error);
} finally { } finally {
CONNECTION?.end(); CONNECTION?.end();
process.exit(); process.exit();

View File

@ -67,6 +67,10 @@ export default async function checkDbRecordCreateDbSchema({
return recordedDbEntry; return recordedDbEntry;
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(
`Error Checking DB Record on Creating Schema`,
error as Error
);
return undefined; return undefined;
} }
} }

View File

@ -110,6 +110,10 @@ export default async function checkTableRecordCreateDbSchema({
return recordedTableEntry; return recordedTableEntry;
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(
`Error Checking Table Record on Creating Schema`,
error as Error
);
return undefined; return undefined;
} }
} }

View File

@ -42,6 +42,11 @@ export default async function handleIndexescreateDbFromSchema({
if (!existingKeyInDb[0]) if (!existingKeyInDb[0])
throw new Error("This Index Does not Exist"); throw new Error("This Index Does not Exist");
} catch (error) { } catch (error) {
global.ERROR_CALLBACK?.(
`Error Handling Indexes on Creating Schema`,
error as Error
);
/** /**
* @description Create new index if determined that it * @description Create new index if determined that it
* doesn't exist in MYSQL db * doesn't exist in MYSQL db

View File

@ -250,7 +250,10 @@ export default async function refreshUsersAndGrants({
} }
} }
} catch (error: any) { } catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message); global.ERROR_CALLBACK?.(
`Error Refreshing MariaDB Users and Grants`,
error as Error
);
} }
} }
} }

View File

@ -59,9 +59,9 @@ async function resetSQLCredentialsPasswords() {
); );
} }
} catch (error: any) { } catch (error: any) {
console.log( global.ERROR_CALLBACK?.(
`Error Updating User ${user.id} Password =>`, `Error Resetting MariaDB User Password`,
error.message error as Error
); );
} }
} }

View File

@ -168,7 +168,7 @@ async function createUser() {
return true; return true;
} catch (error: any) { } catch (error: any) {
console.log(`Error in creating user => ${error.message}`); global.ERROR_CALLBACK?.(`Error Creating User`, error as Error);
return false; return false;
} }
} }

View File

@ -56,7 +56,7 @@ async function createUser() {
return true; return true;
} catch (error: any) { } catch (error: any) {
console.log(`Error in creating user => ${error.message}`); global.ERROR_CALLBACK?.(`Error Updating User`, error as Error);
return false; return false;
} }
} }

View File

@ -66,6 +66,10 @@ async function resetSQLCredentials() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.` `User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
); );
} catch (error: any) { } catch (error: any) {
global.ERROR_CALLBACK?.(
`Error Resetting SQL credentials`,
error as Error
);
console.log(`Error in adding SQL user =>`, error.message); console.log(`Error in adding SQL user =>`, error.message);
} }
} }

View File

@ -47,9 +47,9 @@ async function resetSQLCredentialsPasswords() {
`User ${user.id}: ${user.first_name} ${user.last_name} Password Updated successfully added.` `User ${user.id}: ${user.first_name} ${user.last_name} Password Updated successfully added.`
); );
} catch (error: any) { } catch (error: any) {
console.log( global.ERROR_CALLBACK?.(
`Error Updating User ${user.id} Password =>`, `Error Updating MariaDB User`,
error.message error as Error
); );
} }
} }

View File

@ -60,7 +60,10 @@ async function setSQLCredentials() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.` `User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
); );
} catch (error: any) { } catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message); global.ERROR_CALLBACK?.(
`Error Setting SQL credentials`,
error as Error
);
} }
} }
} }

View File

@ -27,7 +27,10 @@ import grabDSQLConnection from "../utils/grab-dsql-connection";
console.log("parsedResults =>", parsedResults); console.log("parsedResults =>", parsedResults);
} catch (error: any) { } catch (error: any) {
console.log("Connection query ERROR =>", error.message); global.ERROR_CALLBACK?.(
`Error Testing External Server`,
error as Error
);
} finally { } finally {
CONNECTION?.end(); CONNECTION?.end();
process.exit(); process.exit();

View File

@ -75,7 +75,7 @@ export default async function testSQLEscape() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.` `User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
); );
} catch (error: any) { } catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message); global.ERROR_CALLBACK?.(`Error Testing SQL Escape`, error as Error);
} }
} }

View File

@ -45,7 +45,10 @@ async function updateChildrenTablesOnDb() {
} }
} }
} catch (error) { } catch (error) {
console.log(error); global.ERROR_CALLBACK?.(
`Error Updating Children Tables on DB`,
error as Error
);
} }
process.exit(); process.exit();

View File

@ -42,6 +42,11 @@ varDatabaseDbHandler({
message: error.message, message: error.message,
user: {}, user: {},
}); });
global.ERROR_CALLBACK?.(
`Error Updating DB Slugs For Table Records`,
error as Error
);
} }
} }

Some files were not shown because too many files have changed in this diff Show More