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
+2 -1
View File
@@ -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,