Updates
This commit is contained in:
@@ -10,13 +10,13 @@ exports.modules = {
|
||||
|
||||
const fs = __webpack_require__(7147);
|
||||
const decrypt = __webpack_require__(5425);
|
||||
/** @type {import("@/package-shared/types").CheckApiCredentialsFn} */ const grabApiCred = ({ key , database , table })=>{
|
||||
if (!key) return undefined;
|
||||
/** @type {import("../../types").CheckApiCredentialsFn} */ const grabApiCred = ({ key , database , table })=>{
|
||||
if (!key) return null;
|
||||
try {
|
||||
const allowedKeysPath = process.env.DSQL_API_KEYS_PATH;
|
||||
if (!allowedKeysPath) throw new Error("process.env.DSQL_API_KEYS_PATH variable not found");
|
||||
const ApiJSON = decrypt(key);
|
||||
/** @type {import("@/package-shared/types").ApiKeyObject} */ const ApiObject = JSON.parse(ApiJSON || "");
|
||||
/** @type {import("../../types").ApiKeyObject} */ const ApiObject = JSON.parse(ApiJSON || "");
|
||||
const isApiKeyValid = fs.existsSync(`${allowedKeysPath}/${ApiObject.sign}`);
|
||||
if (!isApiKeyValid) return null;
|
||||
if (!ApiObject.target_database) return ApiObject;
|
||||
|
||||
@@ -31,7 +31,7 @@ exports.modules = {
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {DSQL_MYSQL_user_databases_Type | undefined} props.targetDatabase
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type | undefined} props.targetDatabase
|
||||
*/ function DeleteDatabaseConfirmationPopup({ targetDatabase }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
|
||||
@@ -11,14 +11,14 @@ exports.modules = {
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
const MASTER = 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,
|
||||
port: process.env.DB_PORT ? Number(process.env.DB_PORT) : undefined,
|
||||
port: process.env.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
|
||||
charset: "utf8mb4",
|
||||
ssl: {
|
||||
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
|
||||
|
||||
@@ -102,7 +102,7 @@ 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 SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../ssl");
|
||||
const connection = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
@@ -3,7 +3,7 @@ exports.id = 3314;
|
||||
exports.ids = [3314];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 3314:
|
||||
/***/ 2527:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
|
||||
@@ -11,7 +11,7 @@ exports.modules = {
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
let DSQL_USER = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
@@ -861,15 +861,8 @@ const NO_DB_HANDLER = __webpack_require__(2020);
|
||||
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
// const mysql = require("mysql");
|
||||
// const NO_DB = mysql.createConnection({
|
||||
// host: process.env.DSQL_DB_HOST,
|
||||
// user: process.env.DSQL_DB_USERNAME,
|
||||
// password: process.env.DSQL_DB_PASSWORD,
|
||||
// charset: "utf8mb4",
|
||||
// });
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
let NO_DB = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
@@ -42,14 +42,14 @@ module.exports = decrypt;
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
const MASTER = 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,
|
||||
port: process.env.DB_PORT ? Number(process.env.DB_PORT) : undefined,
|
||||
port: process.env.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
|
||||
charset: "utf8mb4",
|
||||
ssl: {
|
||||
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
|
||||
|
||||
@@ -28,7 +28,7 @@ var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_)
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} params
|
||||
* @param {DSQL_FieldSchemaType} params.fieldObject
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} params.fieldObject
|
||||
* @param {any} params.dataTypeSchema
|
||||
* @param {React.MutableRefObject<any>} params.elementRef
|
||||
* @param {any} params.entry
|
||||
|
||||
@@ -22,19 +22,22 @@ const serverError = __webpack_require__(3017);
|
||||
const addDbEntry = __webpack_require__(5338);
|
||||
const updateDbEntry = __webpack_require__(5886);
|
||||
const deleteDbEntry = __webpack_require__(6147);
|
||||
const DB_HANDLER = __webpack_require__(2224);
|
||||
const parseDbResults = __webpack_require__(8326);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* Run DSQL users queries
|
||||
* ==============================================================================
|
||||
* @param {object} params - An object containing the function parameters.
|
||||
* @param {string} params.dbFullName - Database full name. Eg. "datasquire_user_2_test"
|
||||
* @param {string|any} params.query - Query string or object
|
||||
* @param {string | any} params.query - Query string or object
|
||||
* @param {boolean} [params.readOnly] - Is this operation read only?
|
||||
* @param {boolean} [params.local] - Is this operation read only?
|
||||
* @param {import("../../../types").DSQL_DatabaseSchemaType} [params.dbSchema] - Database schema
|
||||
* @param {string[]} [params.queryValuesArray] - An optional array of query values if "?" is used in the query string
|
||||
* @param {string} [params.tableName] - Table Name
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/ async function runQuery({ dbFullName , query , readOnly , dbSchema , queryValuesArray , tableName , }) {
|
||||
*/ async function runQuery({ dbFullName , query , readOnly , dbSchema , queryValuesArray , tableName , local , }) {
|
||||
/**
|
||||
* Declare variables
|
||||
*
|
||||
@@ -57,7 +60,13 @@ const deleteDbEntry = __webpack_require__(6147);
|
||||
* @description Declare "results" variable
|
||||
*/ try {
|
||||
if (typeof query === "string") {
|
||||
if (readOnly) {
|
||||
if (local) {
|
||||
const rawResults = await DB_HANDLER(query, queryValuesArray);
|
||||
result = tableSchema ? parseDbResults({
|
||||
unparsedResults: rawResults,
|
||||
tableSchema
|
||||
}) : rawResults;
|
||||
} else if (readOnly) {
|
||||
result = await varReadOnlyDatabaseDbHandler({
|
||||
queryString: query,
|
||||
queryValuesArray,
|
||||
@@ -81,7 +90,7 @@ const deleteDbEntry = __webpack_require__(6147);
|
||||
switch(action.toLowerCase()){
|
||||
case "insert":
|
||||
result = await addDbEntry({
|
||||
dbContext: "Dsql User",
|
||||
dbContext: local ? "Master" : "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: table1,
|
||||
@@ -97,7 +106,7 @@ const deleteDbEntry = __webpack_require__(6147);
|
||||
break;
|
||||
case "update":
|
||||
result = await updateDbEntry({
|
||||
dbContext: "Dsql User",
|
||||
dbContext: local ? "Master" : "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: table1,
|
||||
@@ -109,7 +118,7 @@ const deleteDbEntry = __webpack_require__(6147);
|
||||
break;
|
||||
case "delete":
|
||||
result = await deleteDbEntry({
|
||||
dbContext: "Dsql User",
|
||||
dbContext: local ? "Master" : "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: table1,
|
||||
@@ -194,10 +203,11 @@ const serverError = __webpack_require__(3017);
|
||||
* @param {object} param0
|
||||
* @param {string} param0.queryString
|
||||
* @param {string} param0.database
|
||||
* @param {boolean} [param0.local]
|
||||
* @param {import("../../types").DSQL_TableSchemaType | null} [param0.tableSchema]
|
||||
* @param {string[]} [param0.queryValuesArray]
|
||||
* @returns
|
||||
*/ module.exports = async function fullAccessDbHandler({ queryString , database , tableSchema , queryValuesArray , }) {
|
||||
*/ module.exports = async function fullAccessDbHandler({ queryString , database , tableSchema , queryValuesArray , local , }) {
|
||||
/**
|
||||
* Declare variables
|
||||
*
|
||||
|
||||
@@ -32,8 +32,8 @@ var external_gsap_default = /*#__PURE__*/__webpack_require__.n(external_gsap_);
|
||||
* Auth user on client side
|
||||
* ==============================================================================
|
||||
* @param {object} params
|
||||
* @param {DSQL_FieldSchemaType[]} params.tableFields
|
||||
* @param {React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>} params.setTableFields
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType[]} params.tableFields
|
||||
* @param {React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_FieldSchemaType[]>>} params.setTableFields
|
||||
* @param {React.Dispatch<React.SetStateAction<number>>} [params.setRefresh]
|
||||
* @param {React.Dispatch<React.SetStateAction<number>>} [params.setPageRefresh]
|
||||
* @param {React.MutableRefObject<React.Dispatch<React.SetStateAction<number>> | undefined>} params.refreshFieldsListRef
|
||||
@@ -78,11 +78,11 @@ var external_lodash_default = /*#__PURE__*/__webpack_require__.n(external_lodash
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} params
|
||||
* @param {DSQL_FieldSchemaType[]} params.tableFields
|
||||
* @param {React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType[]>>} params.setTableFields
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType[]} params.tableFields
|
||||
* @param {React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_FieldSchemaType[]>>} params.setTableFields
|
||||
* @param {React.MutableRefObject<React.Dispatch<React.SetStateAction<number>> | undefined>} params.refreshFieldsListRef
|
||||
* @param {"up" | "down"} params.order
|
||||
* @param {DSQL_FieldSchemaType} params.field
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} params.field
|
||||
* @param {any} params.e
|
||||
*/ function reorderField({ tableFields , setTableFields , refreshFieldsListRef , order , field , e , }) {
|
||||
/**
|
||||
|
||||
@@ -1927,7 +1927,7 @@ var AssignmentTwoTone_default = /*#__PURE__*/__webpack_require__.n(AssignmentTwo
|
||||
/* 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__);
|
||||
/* harmony import */ var _functions_frontend_inputFileToBase64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8345);
|
||||
/* harmony import */ var _functions_frontend_inputFileToBase64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3314);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
@@ -2125,7 +2125,7 @@ var AssignmentTwoTone_default = /*#__PURE__*/__webpack_require__.n(AssignmentTwo
|
||||
/* 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__);
|
||||
/* harmony import */ var _functions_frontend_inputFileToBase64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8345);
|
||||
/* harmony import */ var _functions_frontend_inputFileToBase64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3314);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
|
||||
@@ -10,15 +10,8 @@ exports.modules = {
|
||||
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
// const mysql = require("mysql");
|
||||
// const NO_DB = mysql.createConnection({
|
||||
// host: process.env.DSQL_DB_HOST,
|
||||
// user: process.env.DSQL_DB_USERNAME,
|
||||
// password: process.env.DSQL_DB_PASSWORD,
|
||||
// charset: "utf8mb4",
|
||||
// });
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
let NO_DB = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
@@ -347,7 +347,7 @@ var TableViewTwoTone_default = /*#__PURE__*/__webpack_require__.n(TableViewTwoTo
|
||||
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
||||
var fetchApi = __webpack_require__(6729);
|
||||
// EXTERNAL MODULE: ./functions/frontend/inputFileToBase64.js
|
||||
var inputFileToBase64 = __webpack_require__(8345);
|
||||
var inputFileToBase64 = __webpack_require__(3314);
|
||||
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
|
||||
var LoadingBlock = __webpack_require__(5264);
|
||||
;// CONCATENATED MODULE: ./components/admin/databases/ImportDbComponent.jsx
|
||||
|
||||
@@ -3,7 +3,7 @@ exports.id = 8345;
|
||||
exports.ids = [8345];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 8345:
|
||||
/***/ 3314:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
|
||||
@@ -11,7 +11,7 @@ exports.modules = {
|
||||
const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const mysql = __webpack_require__(2261);
|
||||
const SSL_DIR = "/app/ssl";
|
||||
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
||||
let DSQL_USER = mysql({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
@@ -20,7 +20,7 @@ var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_)
|
||||
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
|
||||
var LoadingBlock = __webpack_require__(5264);
|
||||
// EXTERNAL MODULE: ./functions/frontend/inputFileToBase64.js
|
||||
var inputFileToBase64 = __webpack_require__(8345);
|
||||
var inputFileToBase64 = __webpack_require__(3314);
|
||||
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
||||
var fetchApi = __webpack_require__(6729);
|
||||
;// CONCATENATED MODULE: ./components/admin/databases/functions/import-export-handler.js
|
||||
@@ -34,8 +34,8 @@ var fetchApi = __webpack_require__(6729);
|
||||
* @param {"import" | "export"} param0.paradigm
|
||||
* @param {any} [param0.payload]
|
||||
* @param {any} param0.setLoading
|
||||
* @param {DSQL_TableSchemaType} param0.table
|
||||
* @param {DSQL_MYSQL_user_databases_Type} param0.database
|
||||
* @param {import("@/package-shared/types").DSQL_TableSchemaType} param0.table
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} param0.database
|
||||
*/ function importExportHandler({ paradigm , payload , setLoading , table , database , }) {
|
||||
setLoading(true);
|
||||
if (paradigm === "import") {}
|
||||
@@ -94,8 +94,8 @@ var fetchApi = __webpack_require__(6729);
|
||||
* # Import Export Entries
|
||||
* ===================================================
|
||||
* @param {object} props
|
||||
* @param {DSQL_MYSQL_user_databases_Type} props.database
|
||||
* @param {DSQL_TableSchemaType} props.table
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
|
||||
* @param {import("@/package-shared/types").DSQL_TableSchemaType} props.table
|
||||
* @returns
|
||||
*/ function ImportExportEntries({ database , table }) {
|
||||
const [loading, setLoading] = external_react_default().useState(false);
|
||||
|
||||
@@ -385,7 +385,7 @@ var external_lucide_react_ = __webpack_require__(2423);
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} props.targetField - Field object
|
||||
*/ function CSSFiles({ targetField }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
@@ -496,8 +496,8 @@ var external_lucide_react_ = __webpack_require__(2423);
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType>>} props.setFieldData - React state dispatch function
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_FieldSchemaType>>} props.setFieldData - React state dispatch function
|
||||
*/ function EncryptionSelect({ targetField , setFieldData }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
@@ -587,8 +587,8 @@ var ForeignKey = __webpack_require__(3699);
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {React.Dispatch<React.SetStateAction<DSQL_FieldSchemaType>>} [props.setFieldData] - React state dispatch function
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_FieldSchemaType>>} [props.setFieldData] - React state dispatch function
|
||||
*/ function AutoIncrement({ targetField , setFieldData }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
@@ -675,7 +675,7 @@ var ForeignKey = __webpack_require__(3699);
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {DSQL_FieldSchemaType} props.targetField - Field object
|
||||
* @param {import("@/package-shared/types").DSQL_FieldSchemaType} props.targetField - Field object
|
||||
*/ function RegexPattern({ targetField }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
|
||||
Reference in New Issue
Block a user