Roll Back compile version
This commit is contained in:
+37
-20
@@ -1,25 +1,42 @@
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = DB_HANDLER;
|
||||
const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connection"));
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
* @requires DSQL_DB_CONN - Gobal Variable for Datasquirel Database
|
||||
*/
|
||||
export default async function DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
try {
|
||||
if (!CONNECTION)
|
||||
throw new Error("No Connection provided to DB_HANDLER function!");
|
||||
const results = await CONNECTION.query(...args);
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
finally {
|
||||
await (CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end());
|
||||
}
|
||||
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)
|
||||
throw new Error("No Connection provided to DB_HANDLER function!");
|
||||
const results = yield CONNECTION.query(...args);
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
finally {
|
||||
yield (CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,21 +1,38 @@
|
||||
import connDbHandler from "../../db/conn-db-handler";
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = DSQL_USER_DB_HANDLER;
|
||||
const conn_db_handler_1 = __importDefault(require("../../db/conn-db-handler"));
|
||||
const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connection"));
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
export default async function DSQL_USER_DB_HANDLER({ paradigm, queryString, queryValues, }) {
|
||||
var _a;
|
||||
const CONNECTION = paradigm == "Read Only"
|
||||
? grabDSQLConnection({ ro: true })
|
||||
: grabDSQLConnection({ fa: true });
|
||||
try {
|
||||
return await connDbHandler(CONNECTION, queryString, queryValues);
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `DSQL_USER_DB_HANDLER Error`, error);
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end();
|
||||
}
|
||||
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 });
|
||||
try {
|
||||
return yield (0, conn_db_handler_1.default)(CONNECTION, queryString, queryValues);
|
||||
}
|
||||
catch (error) {
|
||||
(_b = global.ERROR_CALLBACK) === null || _b === void 0 ? void 0 : _b.call(global, `DSQL_USER_DB_HANDLER Error`, error);
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+35
-18
@@ -1,22 +1,39 @@
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = LOCAL_DB_HANDLER;
|
||||
const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connection"));
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
export default async function LOCAL_DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const MASTER = grabDSQLConnection();
|
||||
try {
|
||||
const results = await MASTER.query(...args);
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
}
|
||||
catch (error) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `LOCAL_DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
finally {
|
||||
await (MASTER === null || MASTER === void 0 ? void 0 : MASTER.end());
|
||||
}
|
||||
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) {
|
||||
(_a = global.ERROR_CALLBACK) === null || _a === void 0 ? void 0 : _a.call(global, `LOCAL_DB_HANDLER Error`, error);
|
||||
return {
|
||||
success: false,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
finally {
|
||||
yield (MASTER === null || MASTER === void 0 ? void 0 : MASTER.end());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = NO_DB_HANDLER;
|
||||
const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connection"));
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
export default function NO_DB_HANDLER(...args) {
|
||||
function NO_DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
const CONNECTION = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
CONNECTION.query(...args)
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = ROOT_DB_HANDLER;
|
||||
const grab_dsql_connection_1 = __importDefault(require("../../grab-dsql-connection"));
|
||||
/**
|
||||
* # Root DB handler
|
||||
*/
|
||||
export default function ROOT_DB_HANDLER(...args) {
|
||||
function ROOT_DB_HANDLER(...args) {
|
||||
var _a;
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
const CONNECTION = (0, grab_dsql_connection_1.default)();
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
CONNECTION.query(...args)
|
||||
|
||||
Reference in New Issue
Block a user