Updates
This commit is contained in:
@@ -20,6 +20,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
|
||||
*/
|
||||
function DB_HANDLER(...args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
const CONNECTION = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
if (!CONNECTION)
|
||||
@@ -28,7 +29,7 @@ function DB_HANDLER(...args) {
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
}
|
||||
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 {
|
||||
success: false,
|
||||
error: error.message,
|
||||
|
||||
@@ -20,6 +20,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
|
||||
*/
|
||||
function DSQL_USER_DB_HANDLER(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ paradigm, queryString, queryValues, }) {
|
||||
var _b;
|
||||
const CONNECTION = paradigm == "Read Only"
|
||||
? (0, grab_dsql_connection_1.default)({ ro: 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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -19,13 +19,14 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
|
||||
*/
|
||||
function LOCAL_DB_HANDLER(...args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
const MASTER = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
const results = yield MASTER.query(...args);
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
}
|
||||
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 {
|
||||
success: false,
|
||||
error: error.message,
|
||||
|
||||
@@ -9,6 +9,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
function NO_DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const CONNECTION = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -27,6 +28,7 @@ function NO_DB_HANDLER(...args) {
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `NO_DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
|
||||
@@ -9,6 +9,7 @@ const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connecti
|
||||
* # Root DB handler
|
||||
*/
|
||||
function ROOT_DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const CONNECTION = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -27,6 +28,7 @@ function ROOT_DB_HANDLER(...args) {
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `ROOT_DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ exports.default = parseCookies;
|
||||
* returns the cookies as a JS object
|
||||
*/
|
||||
function parseCookies({ request, cookieString, }) {
|
||||
var _a;
|
||||
try {
|
||||
/** @type {string | undefined} */
|
||||
const cookieStr = request
|
||||
@@ -36,7 +37,7 @@ function parseCookies({ request, cookieString, }) {
|
||||
return cookieObject;
|
||||
}
|
||||
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 {};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -20,7 +20,7 @@ const numberfy_1 = __importDefault(require("../numberfy"));
|
||||
const crud_1 = __importDefault(require("./crud"));
|
||||
function dsqlMethodCrud(_a) {
|
||||
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 = {
|
||||
success: false,
|
||||
};
|
||||
@@ -157,6 +157,7 @@ function dsqlMethodCrud(_a) {
|
||||
return result;
|
||||
}
|
||||
catch (error) {
|
||||
(_d = global.ERROR_CALLBACK) === null || _d === void 0 ? void 0 : _d.call(global, `Method Crud Error`, error);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
+3
-3
@@ -29,6 +29,7 @@ query,
|
||||
*/
|
||||
values) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a, _b;
|
||||
try {
|
||||
if (!conn)
|
||||
throw new Error("No Connection Found!");
|
||||
@@ -47,7 +48,7 @@ values) {
|
||||
resArray.push(JSON.parse(JSON.stringify(queryObjRes)));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -58,8 +59,7 @@ values) {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`connDbHandler Error: ${error.message}`);
|
||||
console.log(conn === null || conn === void 0 ? void 0 : conn.config());
|
||||
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `Connection DB Handler Error`, error);
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user