dsql-admin/dsql-app/.local_dist/server/chunks/2896.js
Benjamin Toby 748ff55092 Bug Fixes
2024-11-05 15:18:40 +01:00

173 lines
7.0 KiB
JavaScript

"use strict";
exports.id = 2896;
exports.ids = [2896];
exports.modules = {
/***/ 9350:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DocsGenereicHero)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {string} props.title
* @param {string} props.description
*/ function DocsGenereicHero({ title , description }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("section", {
className: "py-14",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "w-full gap-10 justify-between items-start flex-col lg:flex-row relative z-10",
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex-col items-start max-w-[740px] text-left",
style: {
minWidth: "45%"
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h1", {
className: "m-0 leading-tight",
children: title
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "font-normal text-xl -my-4",
dangerouslySetInnerHTML: {
__html: description
}
})
]
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/grid.webp",
alt: "Dotted image background",
className: "absolute top-0 left-0 w-full h-full object-cover opacity-5 z-0"
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ }),
/***/ 1273:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const serverError = __webpack_require__(7023);
const mysql = __webpack_require__(2261);
const path = __webpack_require__(1017);
const SSL_DIR = "/app/ssl";
const connection = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_USERNAME,
password: process.env.DSQL_DB_PASSWORD,
database: process.env.DSQL_DB_NAME,
charset: "utf8mb4",
ssl: {
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
}
}
});
/**
* Main DB Handler Function
* ==============================================================================
* @async
*
* @param {any} args
* @returns {Promise<object|null>}
*/ module.exports = async function dbHandler(...args) {
"production"?.match(/dev/) && fs.appendFileSync("./.tmp/sqlQuery.sql", args[0] + "\n" + Date() + "\n\n\n", "utf8");
/**
* Declare variables
*
* @description Declare "results" variable
*/ let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/ try {
results = await new Promise((resolve, reject)=>{
// @ts-ignore
connection.query(...args, (error, result, fields)=>{
if (error) {
resolve({
error: error.message
});
} else {
resolve(result);
}
});
});
await connection.end();
} catch (/** @type {any} */ error) {
fs.appendFileSync("./.tmp/dbErrorLogs.txt", JSON.stringify(error, null, 4) + "\n" + Date() + "\n\n\n", "utf8");
results = null;
serverError({
component: "dbHandler",
message: error.message
});
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/ if (results) {
return JSON.parse(JSON.stringify(results));
} else {
return null;
}
};
/***/ })
};
;