This commit is contained in:
Benjamin Toby 2024-12-05 08:03:33 +01:00
parent 9686a22c96
commit 3ffd2d6777
821 changed files with 3251 additions and 91996 deletions

1
.gitignore vendored
View File

@ -136,6 +136,7 @@ REDEPLOY
/dsql-data/* /dsql-data/*
!/dsql-data/static-config !/dsql-data/static-config
!/dsql-data/db-config !/dsql-data/db-config
!/dsql-data/db-load-balancer-config
new-user.json new-user.json
update-user.json update-user.json

View File

@ -1 +1 @@
JWcGy7ApzQNGHJR0-bv4k oGdR-cyIqmUbg3SEpT2k4

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"telemetry": { "telemetry": {
"notifiedAt": "1732727159063", "notifiedAt": "1733381940702",
"anonymousId": "f2e11bd1d663763cae6484ea95ac15d21c82e9f41210d579ed3534c3be101973", "anonymousId": "5d24cac332882d2f217e531c4a8385aadd4c29462533bb5298dded168fa6c45d",
"salt": "ec1001fc65a100749ca913db791bc81c" "salt": "74b70355ffe776d3977e1e6fe58ea345"
} }
} }

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,6 @@
{
"buildStage": "static-generation",
"buildOptions": {
"useBuildWorker": "false"
}
}

View File

@ -0,0 +1 @@
{"name":"Next.js","version":"15.0.3"}

View File

@ -1 +1 @@
{"version":1,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","domains":[],"disableStaticImages":false,"minimumCacheTTL":60,"formats":["image/webp"],"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","remotePatterns":[],"unoptimized":false,"sizes":[640,750,828,1080,1200,1920,2048,3840,16,32,48,64,96,128,256,384]}} {"version":1,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":60,"formats":["image/webp"],"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","remotePatterns":[],"unoptimized":false,"sizes":[640,750,828,1080,1200,1920,2048,3840,16,32,48,64,96,128,256,384]}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"routes":{"/docs/quick-start":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/quick-start.json"},"/docs/gui-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/gui-reference.json"},"/docs/api-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/api-reference.json"},"/docs/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/getting-started.json"},"/docs/database-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/database-reference.json"},"/docs/gui-reference/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/gui-reference/getting-started.json"},"/docs/gui-reference/upload-media":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/gui-reference/upload-media.json"},"/docs/api-reference/get":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/api-reference/get.json"},"/docs/api-reference/post":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/api-reference/post.json"},"/docs/database-reference/data-types":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/database-reference/data-types.json"},"/docs/database-reference/querying-data":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/database-reference/querying-data.json"}},"dynamicRoutes":{"/docs/[page]":{"routeRegex":"^/docs/([^/]+?)(?:/)?$","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/JWcGy7ApzQNGHJR0\\-bv4k/docs/([^/]+?)\\.json$"},"/docs/[page]/[sub-page]":{"routeRegex":"^/docs/([^/]+?)/([^/]+?)(?:/)?$","dataRoute":"/_next/data/JWcGy7ApzQNGHJR0-bv4k/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/JWcGy7ApzQNGHJR0\\-bv4k/docs/([^/]+?)/([^/]+?)\\.json$"}},"notFoundRoutes":[],"preview":{"previewModeId":"baea329f42fab065df2ae58f429ca2d3","previewModeSigningKey":"1c301e84f7303ef08555bb8044f002caa4515b27e8f4dc401292c8965e178809","previewModeEncryptionKey":"3ec50cd6723be41bb5c28cf1b0997586240279bf523534693df920a04a553ee3"}} {"version":4,"routes":{"/docs/quick-start":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/quick-start.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/gui-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/api-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/database-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/gui-reference/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference/upload-media":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/gui-reference/upload-media.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/get":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/api-reference/get.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/post":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/api-reference/post.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/data-types":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/database-reference/data-types.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/querying-data":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/database-reference/querying-data.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"dynamicRoutes":{"/docs/[page]":{"routeRegex":"^/docs/([^/]+?)(?:/)?$","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/oGdR\\-cyIqmUbg3SEpT2k4/docs/([^/]+?)\\.json$","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/[page]/[sub-page]":{"routeRegex":"^/docs/([^/]+?)/([^/]+?)(?:/)?$","dataRoute":"/_next/data/oGdR-cyIqmUbg3SEpT2k4/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/oGdR\\-cyIqmUbg3SEpT2k4/docs/([^/]+?)/([^/]+?)\\.json$","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"notFoundRoutes":[],"preview":{"previewModeId":"728c552f2b4532705c882ec783d20514","previewModeSigningKey":"e683f68eb79eef906f767e994606d1f93b03b8272582fca1ec4411515032eea3","previewModeEncryptionKey":"5fccb521ed9a7854b2293781e1e232ae2004b42e8d84f01be9792521ff351e21"}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,43 +0,0 @@
"use strict";
exports.id = 1007;
exports.ids = [1007];
exports.modules = {
/***/ 1007:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const decrypt = __webpack_require__(5425);
/** @type {import("../../types").CheckApiCredentialsFn} */ const grabApiCred = ({ key , database , table , user_id })=>{
if (!key) return null;
if (!user_id) 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("../../types").ApiKeyObject} */ const ApiObject = JSON.parse(ApiJSON || "");
const isApiKeyValid = fs.existsSync(`${allowedKeysPath}/${ApiObject.sign}`);
if (String(ApiObject.user_id) !== String(user_id)) return null;
if (!isApiKeyValid) return null;
if (!ApiObject.target_database) return ApiObject;
if (!database && ApiObject.target_database) return null;
const isDatabaseAllowed = ApiObject.target_database?.split(",").includes(String(database));
if (isDatabaseAllowed && !ApiObject.target_table) return ApiObject;
if (isDatabaseAllowed && !table && ApiObject.target_table) return null;
const isTableAllowed = ApiObject.target_table?.split(",").includes(String(table));
if (isTableAllowed) return ApiObject;
return null;
} catch (/** @type {any} */ error) {
console.log(`api-cred ERROR: ${error.message}`);
return null;
}
};
module.exports = grabApiCred;
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,182 +0,0 @@
"use strict";
exports.id = 1206;
exports.ids = [1206];
exports.modules = {
/***/ 7410:
/***/ ((module) => {
// @ts-check
/**
* Regular expression to match default fields
*
* @description Regular expression to match default fields
*/
const defaultFieldsRegexp = /^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
module.exports = defaultFieldsRegexp;
/***/ }),
/***/ 7432:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const decrypt = __webpack_require__(5304);
const defaultFieldsRegexp = __webpack_require__(7410);
/**
* Parse Database results
* ==============================================================================
* @description this function takes a database results array gotten from a DB handler
* function, decrypts encrypted fields, and returns an updated array with no encrypted
* fields
*
* @param {object} params - Single object params
* @param {any[]} params.unparsedResults - Array of data objects containing Fields(keys)
* and corresponding values of the fields(values)
* @param {import("../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @returns {Promise<object[]|null>}
*/ module.exports = async function parseDbResults({ unparsedResults , tableSchema , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ let parsedResults = [];
try {
/**
* Declare variables
*
* @description Declare "results" variable
*/ for(let pr = 0; pr < unparsedResults.length; pr++){
let result = unparsedResults[pr];
let resultFieldNames = Object.keys(result);
for(let i = 0; i < resultFieldNames.length; i++){
const resultFieldName = resultFieldNames[i];
let resultFieldSchema = tableSchema?.fields[i];
if (resultFieldName?.match(defaultFieldsRegexp)) {
continue;
}
let value = result[resultFieldName];
if (typeof value !== "number" && !value) {
continue;
}
if (resultFieldSchema?.encrypted) {
if (value?.match(/./)) {
result[resultFieldName] = decrypt(value);
}
}
}
parsedResults.push(result);
}
/**
* Declare variables
*
* @description Declare "results" variable
*/ return parsedResults;
} catch (/** @type {any} */ error) {
console.log("ERROR in parseDbResults Function =>", error.message);
return unparsedResults;
}
};
/***/ }),
/***/ 1206:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const parseDbResults = __webpack_require__(7432);
const serverError = __webpack_require__(7023);
const DB_HANDLER = __webpack_require__(9395);
const DSQL_USER_DB_HANDLER = __webpack_require__(8682);
/**
* DB handler for specific database
* ==============================================================================
* @async
* @param {object} params - Single object params
* @param {string} params.queryString - SQL string
* @param {*[]} [params.queryValuesArray] - Values Array
* @param {string} [params.database] - Database name
* @param {import("../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @returns {Promise<any>}
*/ module.exports = async function varDatabaseDbHandler({ queryString , queryValuesArray , database , tableSchema , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ const isMaster = database?.match(/^datasquirel$/) ? true : false;
/** @type {any} */ const FINAL_DB_HANDLER = isMaster ? DB_HANDLER : DSQL_USER_DB_HANDLER;
let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/ try {
if (queryString && queryValuesArray && Array.isArray(queryValuesArray) && queryValuesArray[0]) {
results = isMaster ? await FINAL_DB_HANDLER(queryString, queryValuesArray) : await FINAL_DB_HANDLER({
paradigm: "Full Access",
database,
queryString,
queryValues: queryValuesArray
});
} else {
results = isMaster ? await FINAL_DB_HANDLER(queryString) : await FINAL_DB_HANDLER({
paradigm: "Full Access",
database,
queryString
});
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (/** @type {any} */ error) {
serverError({
component: "varDatabaseDbHandler/lines-29-32",
message: error.message
});
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/ if (results && tableSchema) {
try {
const unparsedResults = results;
const parsedResults = await parseDbResults({
unparsedResults: unparsedResults,
tableSchema: tableSchema
});
return parsedResults;
} catch (/** @type {any} */ error1) {
console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>", database, error1);
serverError({
component: "varDatabaseDbHandler/lines-52-53",
message: error1.message
});
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} else if (results) {
return results;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} else {
return null;
}
};
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,99 +0,0 @@
"use strict";
exports.id = 1311;
exports.ids = [1311];
exports.modules = {
/***/ 1311:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const parseDbResults = __webpack_require__(8326);
const serverError = __webpack_require__(3017);
const DB_HANDLER = __webpack_require__(2224);
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
/**
* DB handler for specific database
* ==============================================================================
* @async
* @param {object} params - Single object params
* @param {string} params.queryString - SQL string
* @param {*[]} [params.queryValuesArray] - Values Array
* @param {string} [params.database] - Database name
* @param {import("../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @returns {Promise<any>}
*/ module.exports = async function varDatabaseDbHandler({ queryString , queryValuesArray , database , tableSchema , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ const isMaster = database?.match(/^datasquirel$/) ? true : false;
/** @type {any} */ const FINAL_DB_HANDLER = isMaster ? DB_HANDLER : DSQL_USER_DB_HANDLER;
let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/ try {
if (queryString && queryValuesArray && Array.isArray(queryValuesArray) && queryValuesArray[0]) {
results = isMaster ? await FINAL_DB_HANDLER(queryString, queryValuesArray) : await FINAL_DB_HANDLER({
paradigm: "Full Access",
database,
queryString,
queryValues: queryValuesArray
});
} else {
results = isMaster ? await FINAL_DB_HANDLER(queryString) : await FINAL_DB_HANDLER({
paradigm: "Full Access",
database,
queryString
});
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (/** @type {any} */ error) {
serverError({
component: "varDatabaseDbHandler/lines-29-32",
message: error.message
});
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/ if (results && tableSchema) {
try {
const unparsedResults = results;
const parsedResults = await parseDbResults({
unparsedResults: unparsedResults,
tableSchema: tableSchema
});
return parsedResults;
} catch (/** @type {any} */ error1) {
console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>", database, error1);
serverError({
component: "varDatabaseDbHandler/lines-52-53",
message: error1.message
});
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} else if (results) {
return results;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} else {
return null;
}
};
/***/ })
};
;

View File

@ -1,158 +0,0 @@
"use strict";
exports.id = 1336;
exports.ids = [1336];
exports.modules = {
/***/ 1336:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ UserCard)
/* 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 {import("@/package-shared/types").UserType} props.userObject
* @param {boolean} [props.userPage]
*/ function UserCard({ userObject , userPage }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const userTitles = Object.keys(userObject);
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
const [refresh, setRefresh] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
const [collapsed, setCollapsed] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(userPage ? false : true);
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* Function Return
*
* @description Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "card col green w-full overflow-hidden" + (collapsed ? userPage ? " h-[100px]" : " h-[85px]" : " "),
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "items-center w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: userObject["image_thumbnail"],
alt: "",
className: "rounded-full object-cover" + (userPage ? " w-16 h-16" : " w-12 h-12")
}),
!userPage && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("h3", {
className: "m-0 text-xl",
children: [
userObject["first_name"],
" ",
userObject["last_name"],
" "
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "ml-auto",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined gray small-text",
onClick: (e)=>{
if (collapsed) {
setCollapsed(false);
} else {
setCollapsed(true);
}
},
children: collapsed ? "More Details" : "Collapse"
}),
!userPage && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/su/users/${userObject.id}`,
className: "button outlined gray small-text",
children: "View User"
})
]
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "card no-hover col w-full light-gray-bg",
children: userTitles.map((userTitle, utIndex)=>{
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
style: {
wordBreak: "break-all"
},
children: [
userTitle,
":",
" ",
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
children: // @ts-ignore
userObject[userTitle]
})
]
})
}),
utIndex < userTitles.length - 1 && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {})
]
}, utIndex + 1);
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined gray small-text w-full",
onClick: (e)=>{
setCollapsed(true);
},
children: "Collapse"
})
]
});
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
/***/ })
};
;

View File

@ -1,99 +0,0 @@
"use strict";
exports.id = 1352;
exports.ids = [1352];
exports.modules = {
/***/ 1352:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const http = __webpack_require__(3685);
const decrypt = __webpack_require__(5425);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* @typedef {object} grabDelegatedUserFromCookieReturn
* @property {number} dbUserId
* @property {number} [dbUserId]
* @property {number} [rootUserId]
* @property {string} [rootUserName]
* @property {string} [rootUserEmail]
* @property {string} [rootUserImage]
* @property {string} [databaseFullName]
* @property {string} [databaseSlug]
* @property {string[]} [allowedTables]
* @property {string} [priviledges]
* @property {string} [database]
* @property {boolean} [delegated]
*/ /**
* @param {object} params - user id
* @param {import("next").NextApiRequest | http.IncomingMessage & { cookies: Partial<{ [key: string]: string; }>}} params.request - HTTPS request object
* @param {string | string[]} params.databaseSlug - Database name slug
* @param {{ id: number, first_name: string, last_name: string }} params.user
* @param {any} params.query - query params
*
* @returns {Promise<grabDelegatedUserFromCookieReturn | null>} new user auth object payload
*/ module.exports = async function grabDelegatedUserFromCookie({ request , databaseSlug , user , query , }) {
try {
/**
* Fetch user
*
* @description Fetch user from db
*/ let dbUserId = user.id;
let delegatedUserObject = null;
if (!query?.delegated) return {
dbUserId
};
const rootUserId = query.dbUserId;
const dbFullName = `${process.env.DSQL_USER_DB_PREFIX}${rootUserId}_${databaseSlug}`;
const tokenName = `${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${dbFullName}`;
try {
if (!request.cookies?.[tokenName]) throw new Error("Cookie not present");
// @ts-ignore
const decryptedToken = decrypt(request.cookies[tokenName]);
if (!decryptedToken) throw new Error("Invalid Token");
delegatedUserObject = JSON.parse(decryptedToken);
if (delegatedUserObject.databaseSlug === databaseSlug) {
dbUserId = delegatedUserObject.rootUserId;
return {
dbUserId: dbUserId,
rootUserId: delegatedUserObject.rootUserId,
rootUserName: delegatedUserObject.rootUserName,
rootUserEmail: delegatedUserObject.rootUserEmail,
rootUserImage: delegatedUserObject.rootUserImage,
databaseFullName: delegatedUserObject.databaseFullName,
databaseSlug: delegatedUserObject.databaseSlug,
allowedTables: delegatedUserObject.allowedTables,
priviledges: delegatedUserObject.priviledges,
database: delegatedUserObject.databaseSlug,
delegated: true
};
}
} catch (error) {
// serverError({
// component: "grabDelegatedUserFromCookie",
// message: error.message,
// user: user,
// });
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return {
dbUserId
};
} catch (error1) {
return null;
}
}; ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

View File

@ -1,124 +0,0 @@
"use strict";
exports.id = 1500;
exports.ids = [1500];
exports.modules = {
/***/ 5012:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DeleteDatabaseConfirmationPopup)
/* 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__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6729);
/* harmony import */ var _general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5472);
/* harmony import */ var _general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5264);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type | undefined} props.targetDatabase
*/ function DeleteDatabaseConfirmationPopup({ targetDatabase }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .ZP, {
title: "delete-database-confirmation",
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
width: "20px"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("h4", {
className: "m-0",
children: [
"Delete '",
targetDatabase?.db_name ? targetDatabase.db_name : "This Database",
"' database?"
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined" + (loading ? " pointer-events-none opacity-40" : ""),
onClick: (e)=>{
if (!targetDatabase) {
alert("No Target Database Selected!");
return;
}
setLoading(true);
if (window.confirm(`Note that you will loose all data in this database. Continue?`)) {
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)("/api/deleteUserDatabase", {
method: "post",
body: targetDatabase
}, true).then((res)=>{
if (res.success) {
window.location.reload();
}
});
} else {
setLoading(false);
}
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Yes"
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
onClick: (e)=>{
(0,_general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__/* .closePopup */ .j4)();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Cancel"
})
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,37 +0,0 @@
"use strict";
exports.id = 1503;
exports.ids = [1503];
exports.modules = {
/***/ 1503:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { IncomingMessage } = __webpack_require__(3685);
const decrypt = __webpack_require__(5304);
/**
* @async
* @param {import("next").NextApiRequest | IncomingMessage & { cookies: Partial<{ [key: string]: string; }>} } req - https request object
*
* @returns {Promise<({ email: string, password: string, authKey: string, logged_in_status: boolean, date: number } | null)>}
*/ module.exports = async function(req) {
/** ********************* Check for existence of required cookie */ if (!req.cookies?.datasquirelSuAdminUserAuthKey) {
return null;
}
/** ********************* Grab the payload */ let userPayload = decrypt(req.cookies.datasquirelSuAdminUserAuthKey);
/** ********************* Return if no payload */ if (!userPayload) return null;
/** ********************* Parse the payload */ let userObject = JSON.parse(userPayload);
if (userObject.password !== process.env.DSQL_USER_KEY) return null;
if (userObject.authKey !== process.env.DSQL_SPECIAL_KEY) return null;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ********************* return user object */ return userObject;
};
/***/ })
};
;

View File

@ -1,122 +0,0 @@
"use strict";
exports.id = 1674;
exports.ids = [1674];
exports.modules = {
/***/ 1674:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DeleteTableConfirmationPopup)
/* 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__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6729);
/* harmony import */ var _general_Breadcrumbs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(424);
/* harmony import */ var _general_GeneralPopup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5472);
/* harmony import */ var _components_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5264);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
* @param {import("@/package-shared/types").MYSQL_user_database_tables_table_def | null} [props.targetTable]
*/ function DeleteTableConfirmationPopup({ targetTable , database , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_general_GeneralPopup__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP, {
title: "delete-table-confirmation",
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
width: "20px"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("h4", {
className: "m-0",
children: [
"Delete '",
targetTable?.table_name ? targetTable.table_name : "This Database",
"' Table?"
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined" + (loading ? " pointer-events-none opacity-40" : ""),
onClick: (e)=>{
setLoading(true);
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)("/api/deleteUserTable", {
method: "post",
body: {
database: database,
table: targetTable
}
}, true).then((res)=>{
if (res.success) {
window.location.reload();
}
});
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Yes"
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
onClick: (e)=>{
(0,_general_GeneralPopup__WEBPACK_IMPORTED_MODULE_3__/* .closePopup */ .j4)();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Cancel"
})
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,46 +0,0 @@
"use strict";
exports.id = 1781;
exports.ids = [1781];
exports.modules = {
/***/ 1781:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ BackButton)
/* 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__);
/* harmony import */ var _mui_icons_material_ArrowBackIosRounded__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3257);
/* harmony import */ var _mui_icons_material_ArrowBackIosRounded__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_ArrowBackIosRounded__WEBPACK_IMPORTED_MODULE_2__);
// @ts-check
/**
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Main Component { Functional }
* ==============================================================================
*/ function BackButton() {
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined gray p-2 w-9 h-9 flex items-center justify-center rounded-full",
onClick: (e)=>{
window.history.back();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_ArrowBackIosRounded__WEBPACK_IMPORTED_MODULE_2___default()), {
color: "inherit",
className: "opacity-50 text-black",
fontSize: "small"
})
});
}
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,309 +0,0 @@
"use strict";
exports.id = 1926;
exports.ids = [1926];
exports.modules = {
/***/ 1926:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DbCreateDbUserForm)
/* 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__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6729);
/* harmony import */ var _general_FormAlertBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7037);
/* harmony import */ var _general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5264);
/* harmony import */ var _form_FormInput__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7901);
/* harmony import */ var _UserImage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2733);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
/** @type {any} */ let timeout;
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {string} props.targetDb
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} [props.database]
* @param {import("@/package-shared/types").UserType} [props.user]
* @param {any} props.userImage
* @param {React.Dispatch<React.SetStateAction<any>>} props.setUserImage
*/ function DbCreateDbUserForm({ targetDb , database , user , userImage , setUserImage , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ /** @type {[ alert: string | null, setAlert: React.Dispatch<React.SetStateAction<string | null>> ]} */ // @ts-ignore
const [alert, setAlert] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(null);
const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {}),
alert && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_FormAlertBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
message: alert
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
className: "m-0 text-lg font-semibold mb-1 text-slate-600 mt-4",
children: "User information"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "First Name",
inputType: "text",
name: "first_name",
autoComplete: "given-name",
onInputHandler: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
},
required: true
})
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: "last_name",
children: "Last Name"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "text",
name: "last_name",
id: "last_name",
placeholder: "Last Name",
autoComplete: "family-name",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
},
required: true
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: "username",
children: "Username"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "text",
name: "username",
id: "username",
placeholder: "Username",
autoComplete: "username",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
window.clearTimeout(timeout);
timeout = setTimeout(()=>{
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(`/api/checkDuplicateData?type=username&value=${inputEl.value}&tableName=users&dbFullName=${targetDb}`).then((res)=>{
// console.log(res);
if (res?.result) {
setAlert("Username Already Exists");
inputEl.classList.add("warning");
} else {
setAlert(null);
inputEl.classList.remove("warning");
}
});
}, 300);
}
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: "email_address",
children: "Email Address"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "email",
name: "email_address",
id: "email_address",
placeholder: "Email Address",
autoComplete: "email",
onInput: (e)=>{
window.clearTimeout(timeout);
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
timeout = setTimeout(()=>{
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(`/api/checkDuplicateData?type=email&value=${inputEl.value}&tableName=users&dbFullName=${targetDb}`).then((res)=>{
// console.log(res);
if (res?.result) {
setAlert("Email Already Exists");
inputEl.classList.add("warning");
} else {
setAlert(null);
inputEl.classList.remove("warning");
}
});
}, 300);
},
required: true
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "Phone Number",
inputType: "text",
name: "phone",
autoComplete: "tel"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "Address",
name: "address",
autoComplete: "address"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex-wrap xl:flex-nowrap",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "City",
name: "city",
autoComplete: "city"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "State",
name: "state",
autoComplete: "state"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "Country",
name: "country",
autoComplete: "country"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_form_FormInput__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
title: "Zip Code",
name: "zip_code",
autoComplete: "zip_code"
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: "password",
children: "Password"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "password",
name: "password",
id: "password",
placeholder: "Password",
required: true
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: "confirm_password",
children: "Confirm Password"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "password",
name: "confirm_password",
id: "confirm_password",
placeholder: "Confirm Password",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
let passwordInput = inputEl.closest("form")?.["password"].value;
let passwordRepeatInput = inputEl.value;
if (passwordInput === passwordRepeatInput) {
inputEl.classList.remove("warning");
} else {
inputEl.classList.add("warning");
}
},
required: true
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "paper",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h3", {
className: "m-0 text-lg font-semibold mb-1 text-slate-600",
children: "User Image"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_UserImage__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
userImage: userImage,
setUserImage: setUserImage,
className: "w-full"
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,45 +0,0 @@
"use strict";
exports.id = 2163;
exports.ids = [2163];
exports.modules = {
/***/ 2163:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const fs = __webpack_require__(7147);
// const handleNodemailer = require("./handleNodemailer");
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Function
* ==============================================================================
* @param {{
* user?: { id?: number | string, first_name?: string, last_name?: string, email?: string } & *,
* message: string,
* component?: string,
* noMail?: boolean,
* }} params - user id
*
* @returns {Promise<void>}
*/ module.exports = async function serverError({ user , message , component , noMail , }) {
const log = `🚀 SERVER ERROR ===========================\nUser Id: ${user?.id}\nUser Name: ${user?.first_name} ${user?.last_name}\nUser Email: ${user?.email}\nError Message: ${message}\nComponent: ${component}\nDate: ${Date()}\n========================================`;
if (!fs.existsSync(`./.tmp/error.log`)) {
fs.writeFileSync(`./.tmp/error.log`, "", "utf-8");
}
const initialText = fs.readFileSync(`./.tmp/error.log`, "utf-8");
fs.writeFileSync(`./.tmp/error.log`, log);
fs.appendFileSync(`./.tmp/error.log`, `\n\n\n\n\n${initialText}`);
}; ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

View File

@ -1,51 +0,0 @@
"use strict";
exports.id = 2186;
exports.ids = [2186];
exports.modules = {
/***/ 2186:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ FormSuccessBlock)
/* 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 - React component props
* @param {string} props.message - Message
* @param {string} [props.className] - Additional Class Names
*/ function FormSuccessBlock({ message , className }) {
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "info green" + (className ? " " + className : ""),
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/checkmark.svg",
alt: "Warning Image Icon",
width: 22,
className: "-my-2"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: message
})
]
});
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,77 +0,0 @@
"use strict";
exports.id = 2224;
exports.ids = [2224];
exports.modules = {
/***/ 2224:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const mysql = __webpack_require__(2261);
const grabDbSSL = __webpack_require__(4824);
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.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
charset: "utf8mb4",
ssl: grabDbSSL()
}
});
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {string} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/ // @ts-ignore
async function DB_HANDLER(...args) {
try {
const results = await MASTER.query(...args);
/** ********************* Clean up */ await MASTER.end();
return JSON.parse(JSON.stringify(results));
} catch (/** @type {any} */ error) {
console.log("DB Error =>", error);
return {
success: false,
error: error.message
};
}
}
module.exports = DB_HANDLER;
/***/ }),
/***/ 4824:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
/**
* @returns {string | (import("tls").SecureContextOptions & { rejectUnauthorized?: boolean | undefined;}) | undefined}
*/ module.exports = function grabDbSSL() {
const SSL_DIR = process.env.DSQL_SSL_DIR;
if (!SSL_DIR?.match(/./)) {
return undefined;
}
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
if (!fs.existsSync(caFilePath)) {
console.log(`${caFilePath} does not exist`);
return undefined;
}
return {
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
};
};
/***/ })
};
;

View File

@ -1,45 +0,0 @@
"use strict";
exports.id = 2317;
exports.ids = [2317];
exports.modules = {
/***/ 2317:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const fs = __webpack_require__(7147);
// const handleNodemailer = require("./handleNodemailer");
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Function
* ==============================================================================
* @param {{
* user?: { id?: number | string, first_name?: string, last_name?: string, email?: string } & *,
* message: string,
* component?: string,
* noMail?: boolean,
* }} params - user id
*
* @returns {Promise<void>}
*/ module.exports = async function serverError({ user , message , component , noMail , }) {
const log = `🚀 SERVER ERROR ===========================\nUser Id: ${user?.id}\nUser Name: ${user?.first_name} ${user?.last_name}\nUser Email: ${user?.email}\nError Message: ${message}\nComponent: ${component}\nDate: ${Date()}\n========================================`;
if (!fs.existsSync(`./.tmp/error.log`)) {
fs.writeFileSync(`./.tmp/error.log`, "", "utf-8");
}
const initialText = fs.readFileSync(`./.tmp/error.log`, "utf-8");
fs.writeFileSync(`./.tmp/error.log`, log);
fs.appendFileSync(`./.tmp/error.log`, `\n\n\n\n\n${initialText}`);
}; ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,118 +0,0 @@
"use strict";
exports.id = 2348;
exports.ids = [2348];
exports.modules = {
/***/ 2348:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ FormRadios)
/* 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 {{
* title: string,
* payload: string | boolean,
* default?: boolean,
* jsx?: React.ReactNode,
* onChangeHandler?: (e: any) => void,
* }[]} props.radioValues - array of objects
* @param {string} props.name - form radios collective name
* @param {(e: any) => void} [props.onChangeHandler] - when radios change
* @param {React.Dispatch<React.SetStateAction<any>>} [props.setAlert] - set an external alert dispatch
* @param {boolean} [props.flexRow] - if the radio and label are stacked on each other or side-by-side
* @param {string} [props.labelColor] - Label color using tailwind syntax
* @param {boolean} [props.baseText] - Font size regular
* @param {boolean} [props.smallText] - Font size smaller
* @param {string} [props.className] - Additional class names for the wrapper
*/ function FormRadios({ radioValues , name , onChangeHandler , setAlert , flexRow , labelColor , baseText , smallText , className , }) {
try {
/**
* 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__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "flex items-start gap-4 flex-wrap " + (flexRow ? "" : " flex-col ") + (className ? className : ""),
children: radioValues.map((value, index)=>{
const { payload , title , jsx } = value;
const radioPayload = payload === false ? payload : payload ? payload : title ? title : null;
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex items-center gap-2",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
className: "m-0" + (baseText ? " w-5 h-5" : smallText ? " w-4 h-4" : " w-6 h-6"),
type: "radio",
defaultChecked: value.default ? true : false,
name: name,
id: name + "_" + radioPayload,
onChange: (e)=>{
if (setAlert) setAlert(null);
if (value.onChangeHandler) {
value.onChangeHandler(e);
} else if (onChangeHandler) {
onChangeHandler(e);
}
},
value: typeof radioPayload == "string" ? radioPayload : undefined
}),
jsx ? jsx : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("label", {
htmlFor: name + "_" + radioPayload,
className: "text-lg m-0 " + (labelColor ? labelColor : "text-slate-800") + (baseText ? " text-base" : smallText ? " text-sm" : " text-lg"),
children: title
})
]
}, index + 1);
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
console.log("ERROR in FormRadio =>", error);
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
children: "Form Radio Error"
});
}
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
"use strict";exports.id=2414,exports.ids=[2414],exports.modules={72414:(e,s,c)=>{function t({user:e,userType:s,setLoading:c}){return null}c.d(s,{A:()=>t}),c(8732),c(82015),c(63715),c(76601)},76601:(e,s,c)=>{c.d(s,{A:()=>t});async function t(){try{let e=await caches.keys();e[0]&&await Promise.all(e.map(e=>caches.delete(e)))}catch(e){console.log("Error in clearing cache =>",e.message)}}}};

View File

@ -1,151 +0,0 @@
"use strict";
exports.id = 2434;
exports.ids = [2434];
exports.modules = {
/***/ 1095:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ CodeBlock)
/* 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__);
/* harmony import */ var _mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6843);
/* harmony import */ var _mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9174);
/* harmony import */ var _mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {{
* content: string,
* language: string,
* style?: React.CSSProperties,
* }} props - React component props including { children }
*/ function CodeBlock({ content , language , style }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const [open, setOpen] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
const handleClick = ()=>{
setOpen(true);
};
/**
* ## Handle Close
* @param {*} event
* @param {*} reason
* @returns
*/ const handleClose = (event, reason)=>{
if (reason === "clickaway") {
return;
}
setOpen(false);
};
const action = /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined gray",
style: {
border: "none",
padding: "2px",
width: "20px",
height: "20px",
color: "white"
},
// @ts-ignore
onClick: handleClose,
children: "✖"
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("pre", {
className: `language-${language ? language : "javascript"} w-full overflow-hidden code-block relative max-w-4xl`,
style: style ? style : {},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("code", {
className: `w-full`,
style: {
wordBreak: "break-all"
},
children: content
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined absolute top-2 right-2 z-20 copy-code hover:opacity-50",
style: {
padding: "2px",
border: "none"
},
onClick: (/** @type {any} */ e)=>{
navigator.clipboard.writeText(content).then(()=>{
handleClick();
});
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2___default()), {
fontSize: "small",
color: "action"
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3___default()), {
open: open,
autoHideDuration: 2000,
onClose: handleClose,
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "h-full text-white px-4 py-2 justify-between rounded",
style: {
maxWidth: "250px",
width: "250px",
backgroundColor: "#0b8862"
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Code Copied!"
}),
action
]
})
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

View File

@ -1,348 +0,0 @@
"use strict";
exports.id = 2435;
exports.ids = [2435];
exports.modules = {
/***/ 2435:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ SuDocsPageListContent)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: external "@mui/icons-material/ArticleTwoTone"
var ArticleTwoTone_ = __webpack_require__(1891);
var ArticleTwoTone_default = /*#__PURE__*/__webpack_require__.n(ArticleTwoTone_);
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var fetchApi = __webpack_require__(6729);
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
var LoadingBlock = __webpack_require__(5264);
// EXTERNAL MODULE: external "@mui/icons-material/AccountTreeTwoTone"
var AccountTreeTwoTone_ = __webpack_require__(4118);
var AccountTreeTwoTone_default = /*#__PURE__*/__webpack_require__.n(AccountTreeTwoTone_);
;// CONCATENATED MODULE: ./components/su/components/PageCard.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
/**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - Server props
* @param {import("@/package-shared/types").MYSQL_docs_pages_table_def} props.docPageObject
*/ function PageCard({ docPageObject }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = external_react_default().useState(false);
/** @type {[ childPages: import("@/package-shared/types").MYSQL_docs_pages_table_def[], setChildPages: React.Dispatch<React.SetStateAction<import("@/package-shared/types").MYSQL_docs_pages_table_def[]>> ]} */ // @ts-ignore
const [childPages, setChildPages] = external_react_default().useState([]);
external_react_default().useEffect(()=>{
(0,fetchApi/* default */.Z)("/api/admin/docs/get-child-pages", {
method: "post",
body: {
pageId: docPageObject.id
}
}).then((res)=>{
if (res.success) {
setChildPages(res.result);
}
});
}, []);
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/**
* Function Return
*
* @description Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "card col relative cursor-pointer",
onClick: (e)=>{
// @ts-ignore
if (e.target?.closest(".cancel-link")) {
e.preventDefault();
} else {
window.location.pathname = `/su/docs/pages/${docPageObject.id}`;
}
},
children: [
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {
width: "20px"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "w-full items-start",
children: [
/*#__PURE__*/ jsx_runtime_.jsx((ArticleTwoTone_default()), {
color: "inherit",
className: "opacity-40 text-gray-600"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex-col items-start gap-0 relative z-10",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "title",
children: docPageObject.title
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "-my-3",
dangerouslySetInnerHTML: {
__html: docPageObject.description || ""
}
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "ml-auto cancel-link",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("button", {
onClick: ()=>{
window.location.href = `/su/docs/edit-page?id=${docPageObject.id}`;
},
className: "outlined small-text light-gray",
children: "Edit Page"
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
onClick: ()=>{
if (window.confirm("Delete this page?")) {
setLoading(true);
(0,fetchApi/* default */.Z)("/api/admin/docs/delete-page", {
method: "post",
body: docPageObject
}).then((res)=>{
if (res.success) {
window.location.reload();
} else {}
setTimeout(()=>{
setLoading(false);
}, 1000);
});
}
},
className: "outlined small-text light-gray",
children: "Delete Page"
})
]
})
]
}),
childPages && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "-mt-[40px] pt-[40px] ml-[10px] pl-[20px] border-0 border-l border-slate-200 border-solid w-full flex-col items-start cancel-link",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
children: [
/*#__PURE__*/ jsx_runtime_.jsx((AccountTreeTwoTone_default()), {
className: "opacity-20",
fontSize: "small"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "text-slate-300 font-semibold",
children: "Children Pages"
})
]
}),
childPages.map((childPage, index)=>{
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "card w-full",
onClick: ()=>{
window.location.pathname = `/su/docs/pages/${childPage.id}`;
},
children: [
/*#__PURE__*/ jsx_runtime_.jsx((ArticleTwoTone_default()), {
color: "inherit",
className: "opacity-40 text-gray-500"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: childPage.title
})
]
}, index);
})
]
})
]
});
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// EXTERNAL MODULE: ./components/general/ui/ButtonGroup.jsx
var ButtonGroup = __webpack_require__(5449);
;// CONCATENATED MODULE: ./components/su/docs/SuDocsPageListContent.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Super User Page List Component
* ==============================================================================
* @param {Object} props - Server props
* @param {any} props.data
*/ function SuDocsPageListContent({ data }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ const { env } = data;
/** @type {import("@/package-shared/types").MYSQL_docs_pages_table_def[]} */ const docPages = data.docPages;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = external_react_default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* ## Persist Function
* @param {boolean} pull
*/ function persist(pull) {
if (window.confirm(pull ? "Update Docs DB from JSON file?" : "Update docs json file?")) {
setLoading(true);
(0,fetchApi/* default */.Z)("/api/admin/docs/persist", {
method: "post",
body: {
pull
}
}).then((res)=>{
if (res.success) {
window.alert(pull ? "Docs database table Updated Sucessfully!" : "JSON data written Successfully!");
} else {
window.alert("Operation failed!");
}
setTimeout(()=>{
setLoading(false);
}, 1000);
}).catch((err)=>{
setTimeout(()=>{
setLoading(false);
}, 1000);
});
}
}
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
className: "items-start justify-start p-6",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex items-center justify-between w-full mb-6",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("h2", {
className: "text-xl m-0",
children: "Documentation Pages"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: `/su/docs/create-page`,
className: "button",
children: "Create Page"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ButtonGroup/* default */.Z, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("button", {
className: "outlined gray",
onClick: ()=>{
persist(false);
},
children: "Push"
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
className: "outlined gray",
onClick: ()=>{
persist(true);
},
children: "Pull"
})
]
})
]
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "paper flex-col items-stretch gap-10 w-full",
children: docPages.map((docPageObject, index)=>/*#__PURE__*/ jsx_runtime_.jsx(PageCard, {
docPageObject: docPageObject
}, index))
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,77 +0,0 @@
"use strict";
exports.id = 2630;
exports.ids = [2630];
exports.modules = {
/***/ 2630:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ importExportTableDataFn)
/* harmony export */ });
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5338);
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0__);
// @ts-check
const serverError = __webpack_require__(2163);
const DB_HANDLER = __webpack_require__(2224);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* @typedef {object} ExportTableDataFnReturn
* @property {any} [tableData]
*/ /**
* ==============================================================================
* @param {Object} params - Single object parameter
* @param {"export" | "import"} params.paradigm
* @param {string | number} params.userId
* @param {string} params.dbName
* @param {string} params.tableName
* @param {any} params.payload
* @param {"JSON" | "base64" | "object"} params.payloadType
* @return {Promise<ExportTableDataFnReturn | null>}
*/ async function importExportTableDataFn({ paradigm , userId , dbName , tableName , payload , payloadType , }) {
/** @type {ExportTableDataFnReturn} */ let returnObject = {};
try {
const dbFullName = `${process.env.DSQL_USER_DB_PREFIX}${userId}_${dbName.replace(/ /g, "")}`;
switch(paradigm){
case "export":
const tableData = await DB_HANDLER(`SELECT * FROM \`${dbFullName}\`.\`${tableName}\``);
returnObject["tableData"] = tableData;
break;
case "import":
const jsonData = payloadType == "base64" ? Buffer.from(payload, "base64").toString() : payloadType == "JSON" ? payload : payload;
const writeData = payloadType === "object" ? payload : JSON.parse(jsonData);
for(let i = 0; i < writeData.length; i++){
const dataToWrite = writeData[i];
const newEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0___default()({
data: dataToWrite,
dbFullName: dbFullName,
tableName: tableName,
dbContext: "Dsql User",
paradigm: "Full Access",
duplicateColumnName: "id",
duplicateColumnValue: dataToWrite?.id,
update: true
});
if (newEntry.error) {
throw new Error(newEntry.error);
}
}
break;
default:
return null;
}
return returnObject;
} catch (/** @type {any} */ error) {
serverError({
component: "/functions/backend/importExportTableDataFn",
message: error.message
});
return null;
}
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,118 +0,0 @@
"use strict";
exports.id = 2733;
exports.ids = [2733];
exports.modules = {
/***/ 2733:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ UserImage)
/* 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__);
/* harmony import */ var _functions_frontend_imageInputFileToBase64__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6718);
/* harmony import */ var _general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5472);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ let timeout;
/** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").UserType} [props.user]
* @param {string | import("@/package-shared/types").ImageObjectType} props.userImage
* @param {React.Dispatch<React.SetStateAction<string | import("@/package-shared/types").ImageObjectType>>} props.setUserImage
* @param {Object} [props.database]
* @param {Object} [props.className]
*/ function UserImage({ user , userImage , setUserImage , database , className , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const imagePreviewRef = react__WEBPACK_IMPORTED_MODULE_1___default().useRef();
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "card no-hover col" + (className ? " " + className : ""),
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "bg-white rounded-full overflow-hidden w-24 h-24",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: userImage ? typeof userImage === "string" ? userImage : userImage.imageBase64Full : "/images/user-preset.png",
alt: "Database Image",
width: 100,
className: "w-full h-full object-cover",
// @ts-ignore
ref: imagePreviewRef,
"data-imagepreview": "image"
})
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "w-full flex-col image-selector-wrapper",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "button outlined secondary w-full whitespace-normal",
onClick: (e)=>{
e.target// @ts-ignore
.closest(".image-selector-wrapper").querySelector("input").click();
},
children: "Upload Image"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "file",
accept: ".png,.jpg,.jpeg,.webp",
placeholder: "Choose Database Image",
className: "hidden",
onChange: async (e)=>{
let imageData = await (0,_functions_frontend_imageInputFileToBase64__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)({
// @ts-ignore
imageInputFile: e.target.files[0],
maxWidth: 400
});
setUserImage(imageData);
}
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,196 +0,0 @@
"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 grabDbSSL = __webpack_require__(3260);
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: grabDbSSL()
}
});
/**
* 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;
}
};
/***/ }),
/***/ 3260:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
/**
* @returns {string | (import("tls").SecureContextOptions & { rejectUnauthorized?: boolean | undefined;}) | undefined}
*/ module.exports = function grabDbSSL() {
const SSL_DIR = process.env.DSQL_SSL_DIR;
if (!SSL_DIR?.match(/./)) {
return undefined;
}
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
if (!fs.existsSync(caFilePath)) {
console.log(`${caFilePath} does not exist`);
return undefined;
}
return {
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
};
};
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,45 +0,0 @@
"use strict";
exports.id = 3017;
exports.ids = [3017];
exports.modules = {
/***/ 3017:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const fs = __webpack_require__(7147);
// const handleNodemailer = require("./handleNodemailer");
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Function
* ==============================================================================
* @param {{
* user?: { id?: number | string, first_name?: string, last_name?: string, email?: string } & *,
* message: string,
* component?: string,
* noMail?: boolean,
* }} params - user id
*
* @returns {Promise<void>}
*/ module.exports = async function serverError({ user , message , component , noMail , }) {
const log = `🚀 SERVER ERROR ===========================\nUser Id: ${user?.id}\nUser Name: ${user?.first_name} ${user?.last_name}\nUser Email: ${user?.email}\nError Message: ${message}\nComponent: ${component}\nDate: ${Date()}\n========================================`;
if (!fs.existsSync(`./.tmp/error.log`)) {
fs.writeFileSync(`./.tmp/error.log`, "", "utf-8");
}
const initialText = fs.readFileSync(`./.tmp/error.log`, "utf-8");
fs.writeFileSync(`./.tmp/error.log`, log);
fs.appendFileSync(`./.tmp/error.log`, `\n\n\n\n\n${initialText}`);
}; ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

View File

@ -0,0 +1,14 @@
"use strict";exports.id=3247,exports.ids=[3247],exports.modules={43001:(e,t,s)=>{s.d(t,{A:()=>b});var a=s(8732),r=s(82015),i=s.n(r),n=s(26295),d=s(58548),l=s(24671);s(37515);var c=s(42602);function x(e){let{databases:t,setTargetDatabase:s,user:r}=i().useContext(n.DashboardContext);return(0,a.jsx)(i().Fragment,{children:(0,a.jsx)(c.A,{databases:t,setTargetDatabase:s,title:"Recently added Databases",more:!0,user:r})})}var o=s(92736),u=s(34637),m=s(93213),h=s(83158);let j=(0,s(82544).A)("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);function y({icon:e,metric:t,count:s,url:r}){return(0,a.jsxs)("a",{href:r,className:"card col w-full",children:[(0,a.jsx)("div",{className:"absolute top-4 right-4",children:e}),(0,a.jsxs)("div",{className:"content-block",children:[(0,a.jsx)("span",{className:"metric text-slate-800 dark:text-white",children:s}),(0,a.jsx)("span",{className:"text-sm text-slate-600 dark:text-slate-400",children:t})]})]})}function C(e){let{databases:t,setTargetDatabase:s,metrics:r,user:d}=i().useContext(n.DashboardContext);return(0,a.jsx)("section",{className:"p-0",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 w-full gap-6 items-stretch",children:[(0,a.jsx)(y,{metric:"Databases Created",count:r?.dbCount||0,icon:(0,a.jsx)(u.A,{size:20,className:"text-secondary2"}),url:`/admin/${d?.id}/databases`}),(0,a.jsx)(y,{metric:"Tables Created",count:r?.tablesCount||0,icon:(0,a.jsx)(m.A,{size:20,className:"text-primary"})}),(0,a.jsx)(y,{metric:"Media Added",count:r?.mediaCount||0,icon:(0,a.jsx)(h.A,{size:20,className:"text-slate-500"}),url:`/admin/${d?.id}/media`}),(0,a.jsx)(y,{metric:"API Keys",count:r?.apiKeysCount||0,icon:(0,a.jsx)(j,{size:20,className:"text-slate-900 dark:text-white"}),url:`/admin/${d?.id}/api-keys`})]})})}function b(e){let{databases:t,user:s}=i().useContext(n.DashboardContext);return(0,a.jsxs)(i().Fragment,{children:[(0,a.jsxs)("div",{className:"flex-col items-start gap-0",children:[(0,a.jsx)("h1",{className:"text-3xl m-0",children:"Dashboard"}),(0,a.jsx)(d.A,{user:s})]}),s?.verification_status?.toString().match(/1/)?(0,a.jsxs)(i().Fragment,{children:[(0,a.jsx)(C,{}),(0,a.jsx)(x,{}),(0,a.jsx)(o.A,{user:s})]}):(0,a.jsx)(l.A,{})]})}},93213:(e,t,s)=>{s.d(t,{A:()=>a});let a=(0,s(82544).A)("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]])},26295:(e,t,s)=>{s.r(t),s.d(t,{DashboardContext:()=>m,default:()=>h,getServerSideProps:()=>j});var a=s(8732),r=s(82015),i=s.n(r),n=s(95222),d=s(20048),l=s.n(d),c=s(43001),x=s(34033),o=s(67216),u=s.n(o);let m=i().createContext({});function h({user:e,databases:t,metrics:s}){let r=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,a.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[d,l]=i().useState(null);return(0,a.jsx)(n.A,{head:r,user:e,children:(0,a.jsxs)(m.Provider,{value:{user:e,databases:t,targetDatabase:d,setTargetDatabase:l,metrics:s},children:[(0,a.jsx)(c.A,{}),(0,a.jsx)(x.A,{targetDatabase:d})]})})}async function j({req:e,res:t,query:s}){let a=await l()(e,t);if(!a?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let r=await u()("SELECT * FROM user_databases WHERE user_id=? ORDER BY id DESC LIMIT 3",[a.id]),i=await u()(`
SELECT (
SELECT COUNT(id) FROM user_databases WHERE user_id=?
) AS dbCount,
(
SELECT COUNT(id) FROM user_database_tables WHERE user_id=?
) AS tablesCount,
(
SELECT COUNT(id) FROM user_media WHERE user_id=?
) AS mediaCount,
(
SELECT COUNT(id) FROM api_keys WHERE user_id=?
) AS apiKeysCount
`,[a.id,a.id,a.id,a.id]);return{props:{user:a,databases:r,metrics:i&&i[0]?i[0]:{}}}}}};

View File

@ -1,39 +0,0 @@
"use strict";
exports.id = 3314;
exports.ids = [3314];
exports.modules = {
/***/ 3314:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ grabUserSchemaData)
/* harmony export */ });
// @ts-check
const serverError = __webpack_require__(2317);
const fs = __webpack_require__(7147);
const path = __webpack_require__(1017);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* @param {Object} params
* @param {string | number} params.userId
* @returns {import("@/package-shared/types").DSQL_DatabaseSchemaType[] | null}
*/ function grabUserSchemaData({ userId }) {
try {
const userSchemaFilePath = path.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`);
const userSchemaData = JSON.parse(fs.readFileSync(userSchemaFilePath, "utf-8"));
return userSchemaData;
} catch (/** @type {any} */ error) {
serverError({
component: "/functions/backend/grabUserSchemaData",
message: error.message
});
return null;
}
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,103 +0,0 @@
"use strict";
exports.id = 3403;
exports.ids = [3403];
exports.modules = {
/***/ 3403:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const path = __webpack_require__(1017);
const mysql = __webpack_require__(2261);
const grabDbSSL = __webpack_require__(4824);
let DSQL_USER = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_READ_ONLY_USERNAME,
password: process.env.DSQL_DB_READ_ONLY_PASSWORD,
charset: "utf8mb4",
ssl: grabDbSSL()
}
});
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {"Full Access" | "FA" | "Read Only"} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/ function DSQL_USER_DB_HANDLER({ paradigm , database , queryString , queryValues , }) {
try {
return new Promise((resolve, reject)=>{
const fullAccess = paradigm?.match(/full.access|^fa$/i) ? true : false;
try {
if (fullAccess) {
DSQL_USER = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_FULL_ACCESS_USERNAME,
password: process.env.DSQL_DB_FULL_ACCESS_PASSWORD,
database: database,
ssl: grabDbSSL()
}
});
} else {
DSQL_USER = mysql({
config: {
host: process.env.DSQL_DB_HOST,
user: process.env.DSQL_DB_READ_ONLY_USERNAME,
password: process.env.DSQL_DB_READ_ONLY_PASSWORD,
database: database,
ssl: grabDbSSL()
}
});
}
/**
* ### Run query Function
* @param {any} results
*/ function runQuery(results) {
DSQL_USER.end();
resolve(JSON.parse(JSON.stringify(results)));
}
/**
* ### Query Error
* @param {any} err
*/ function queryError(err) {
DSQL_USER.end();
resolve({
error: err.message,
queryStringGenerated: queryString,
queryValuesGenerated: queryValues,
sql: err.sql
});
}
if (queryValues && Array.isArray(queryValues) && queryValues[0]) {
DSQL_USER.query(queryString, queryValues).then(runQuery).catch(queryError);
} else {
DSQL_USER.query(queryString).then(runQuery).catch(queryError);
}
////////////////////////////////////////
} catch (/** @type {any} */ error) {
////////////////////////////////////////
fs.appendFileSync("./.tmp/dbErrorLogs.txt", error.message + "\n" + Date() + "\n\n\n", "utf8");
resolve({
error: error.message
});
}
});
} catch (/** @type {any} */ error) {
return {
success: false,
error: error.message
};
}
}
module.exports = DSQL_USER_DB_HANDLER;
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,84 +0,0 @@
"use strict";
exports.id = 370;
exports.ids = [370];
exports.modules = {
/***/ 370:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const http = __webpack_require__(3685);
const DB_HANDLER = __webpack_require__(9395);
const decrypt = __webpack_require__(5304);
const fs = __webpack_require__(7147);
const EXPIRY_TIME = 1000 * 60 * 60 * 24 * 1 * 7; // 7 days
/**
* @async
* @param {import("next").NextApiRequest | http.IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }} req - https request object
* @param {import("next").NextApiResponse | http.ServerResponse} res - https response object
* @param {boolean | null} [csrf] - csrf key
* @param {any} [query] - query object
*
* @returns {Promise<(import("@/package-shared/types").UserType | null)>}
*/ module.exports = async function userAuth(req, res, csrf, query) {
/** ********************* Check for existence of required cookie */ if (!req.cookies?.datasquirelAuthKey?.match(/./)) {
// console.log("No datasquirel key cookie present");
return null;
}
/** ********************* Grab the payload */ let userPayload = decrypt(req.cookies.datasquirelAuthKey);
/** ********************* Return if no payload */ if (!userPayload) {
// console.log("Couldn't Decrypt cookie");
return null;
}
/** ********************* Parse the payload */ let userObject = JSON.parse(userPayload);
if (!userObject.csrf_k) {
// console.log("No CSRF_K in decrypted payload");
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
if (csrf && // @ts-ignore
!req.headers["x-csrf-auth"]?.match(new RegExp(`${userObject.csrf_k}`))) {
// console.log("CSRF_K requested but does not match payload");
return null;
}
const allowedAuthKeysPath = process.env.DSQL_USER_LOGIN_KEYS_PATH;
if (!allowedAuthKeysPath) {
console.log(`DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.`);
return null;
}
if (csrf && !fs.existsSync(`${allowedAuthKeysPath}/${userObject.csrf_k}`)) {
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ********************* check user verification */ if (userObject.verification_status == 0 && !csrf) {
let currentVerificationStatus = await DB_HANDLER(`SELECT verification_status FROM users WHERE id='${userObject.id}'`);
if (currentVerificationStatus && currentVerificationStatus[0] && currentVerificationStatus[0].verification_status == 1) {
// userObject = await reAuthUser({ userId: userObject.id, res });
res.setHeader("Set-Cookie", [
`user_refresh=1`
]);
}
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
if (userObject?.date && Date.now() - userObject.date > EXPIRY_TIME) {
// console.log("Cookie expired");
return null;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ********************* return user object */ return userObject;
};
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,157 +0,0 @@
"use strict";
exports.id = 3863;
exports.ids = [3863];
exports.modules = {
/***/ 3863:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ UserListCard)
/* 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__);
/* harmony import */ var _general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5472);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6729);
/* harmony import */ var _general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5264);
/* harmony import */ var _general_ui_ButtonGroup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5449);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").MYSQL_user_users_table_def} props.userObject
* @param {React.Dispatch<React.SetStateAction<import("@/package-shared/types").MYSQL_user_users_table_def | null>>} props.setTargetUser
* @param {string} [props.paradigm]
*/ function UserListCard({ userObject , setTargetUser , paradigm }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const userName = (()=>{
if (paradigm?.match(/invited/)) {
return `${userObject.inviteeFirstName} ${userObject.inviteeLastName} (${userObject.inviteeEmail})`;
}
return `${userObject.first_name} ${userObject.last_name} (${userObject.email})`;
})();
const userImage = (()=>{
if (paradigm?.match(/invited/)) {
return `${userObject.inviteeImage}`;
}
return `${userObject.image_thumbnail}`;
})();
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "card no-hover items-center " + (paradigm?.match(/invited/) ? " green green-bg" : " primary"),
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: userImage,
className: "w-8 h-8 rounded-full object-cover bg-slate-200",
onError: (e)=>{
// @ts-ignore
e.target.src = "/images/user-preset-thumbnail.png";
}
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-sm font-semibold",
children: userName
}),
userObject?.user_priviledge?.match(/./) && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
className: "text-sm ml-auto text-slate-900/50",
children: [
"Priviledges:",
" ",
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-slate-600 font-semibold",
children: userObject.user_priviledge.split("|").join(" | ")
})
]
}),
!paradigm?.match(/invited/) && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_general_ui_ButtonGroup__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined text-xs px-3 py-1",
onClick: (e)=>{
setTargetUser(userObject);
setTimeout(()=>{
(0,_general_GeneralPopup__WEBPACK_IMPORTED_MODULE_2__/* .openPopup */ .Mw)("target-user-popup");
}, 200);
},
children: "Edit User Access"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined text-xs px-3 py-1",
onClick: (e)=>{
setLoading(true);
if (window.confirm("Delete this user")) {
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z)("/api/deleteUserUser", {
method: "post",
body: {
...userObject
}
}, true).then((res)=>{
setTimeout(()=>{
setLoading(false);
}, 500);
window.location.reload();
});
}
},
children: "Delete User"
})
]
})
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

File diff suppressed because it is too large Load Diff

View File

@ -1,120 +0,0 @@
"use strict";
exports.id = 4017;
exports.ids = [4017];
exports.modules = {
/***/ 4017:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ Logo)
/* 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__);
/* harmony import */ var _mui_icons_material_MenuBookTwoTone__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5557);
/* harmony import */ var _mui_icons_material_MenuBookTwoTone__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_MenuBookTwoTone__WEBPACK_IMPORTED_MODULE_2__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Main Component { Functional }
* ==============================================================================
* @param {{
* size?: string,
* adminAside?: boolean,
* collapseAsideMobile?: boolean,
* setCollapseAsideMobile?: React.Dispatch<React.SetStateAction<boolean>>,
* }} props - React component props
*/ function Logo({ size , adminAside , collapseAsideMobile , setCollapseAsideMobile , }) {
/**
* 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)("a", {
href: "/",
className: "logo",
onClick: (e)=>{
/** @type {*} */ const targetElement = e.target;
if (targetElement?.closest("button")) {
return e.preventDefault();
}
},
children: [
adminAside && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", {
className: "flex lg:hidden small-text mr-2 primary-light",
onClick: (e)=>{
if (collapseAsideMobile && setCollapseAsideMobile) {
setCollapseAsideMobile(false);
} else if (setCollapseAsideMobile) {
setCollapseAsideMobile(true);
}
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "-mt-0.5",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_MenuBookTwoTone__WEBPACK_IMPORTED_MODULE_2___default()), {
color: "action"
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "dark:text-white",
children: "Menu"
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/logo-icon-alt-2.webp",
alt: "Datasquirel Logo",
width: 35,
className: "dark:hidden -mt-1.5 -mr-1.5"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/logo-icon-alt-2.webp",
alt: "Datasquirel Logo",
width: 35,
className: "hidden dark:flex -mt-1.5 -mr-1.5"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-slate-800 dark:text-white text-[20px] font-bold hidden sm:flex -mt-[1px]",
children: "Datasquirel"
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

View File

@ -0,0 +1,13 @@
"use strict";exports.id=4050,exports.ids=[4050],exports.modules={96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},47670:(e,t,r)=>{let a=r(82703),s=r(72583),n=r(16570);r(33364);let o=r(33364);r(27825);let c=r(51348),i=r(21339);async function l({dbContext:e,paradigm:t,dbFullName:r,tableName:l,data:d,tableSchema:u,duplicateColumnName:p,duplicateColumnValue:_,update:S,encryptionKey:f,encryptionSalt:h}){let m=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),g=m?c:i;if(d?.date_created_timestamp&&delete d.date_created_timestamp,d?.date_updated_timestamp&&delete d.date_updated_timestamp,d?.date_updated&&delete d.date_updated,d?.date_updated_code&&delete d.date_updated_code,d?.date_created&&delete d.date_created,d?.date_created_code&&delete d.date_created_code,p&&"string"==typeof p){let a=m?await g(`SELECT * FROM \`${l}\` WHERE \`${p}\`=?`,[_]):await g({paradigm:"Read Only",database:r,queryString:`SELECT * FROM \`${l}\` WHERE \`${p}\`=?`,queryValues:[_]});if(a?.[0]&&!S)return null;if(a&&a[0]&&S)return await o({dbContext:e,paradigm:t,dbFullName:r,tableName:l,data:d,tableSchema:u,encryptionKey:f,encryptionSalt:h,identifierColumnName:p,identifierValue:_||""})}let y=Object.keys(d),D=[],E=[];for(let e=0;e<y.length;e++)try{let t=y[e],r=d?.[t],o=u?u?.fields?.filter(e=>e.fieldName==t):null,c=o&&o[0]?o[0]:null;if(null==r||void 0==r||c?.dataType?.match(/int$/i)&&"string"==typeof r&&!r?.match(/./))continue;c?.encrypted&&(r=a(r,f,h),console.log("DSQL: Encrypted value =>",r)),c?.richText&&(r=s(r,n)),c?.pattern&&!new RegExp(c.pattern,c.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),D.push("`"+t+"`"),"object"==typeof r&&(r=JSON.stringify(r)),"number"==typeof r?E.push(String(r)):E.push(r)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}d?.date_created||(D.push("`date_created`"),E.push(Date())),d?.date_created_code||(D.push("`date_created_code`"),E.push(Date.now())),d?.date_updated||(D.push("`date_updated`"),E.push(Date())),d?.date_updated_code||(D.push("`date_updated_code`"),E.push(Date.now()));let L=`INSERT INTO \`${l}\` (${D.join(",")}) VALUES (${E.map(()=>"?").join(",")})`;return m?await g(L,E):await g({paradigm:t,database:r,queryString:L,queryValues:E})}e.exports=l},33364:(e,t,r)=>{let a=r(82703),s=r(72583),n=r(16570),o=r(51348),c=r(21339);async function i({dbContext:e,paradigm:t,dbFullName:r,tableName:i,data:l,tableSchema:d,identifierColumnName:u,identifierValue:p,encryptionKey:_,encryptionSalt:S}){if(!l||!Object.keys(l).length)return null;let f=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),h=f?o:c,m=Object.keys(l),g=[],y=[];for(let e=0;e<m.length;e++)try{let t=m[e],r=l[t],o=d?d?.fields?.filter(e=>e.fieldName===t):null,c=o&&o[0]?o[0]:null;if(null==r||void 0==r)continue;c?.richText&&(r=s(r,n)),c?.encrypted&&(r=a(r,_,S)),"object"==typeof r&&(r=JSON.stringify(r)),c?.pattern&&!new RegExp(c.pattern,c.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),"string"==typeof r&&r.match(/^null$/i)&&(r={toSqlString:function(){return"NULL"}}),"string"!=typeof r||r.match(/./i)||(r={toSqlString:function(){return"NULL"}}),g.push(`\`${t}\`=?`),"number"==typeof r?y.push(String(r)):y.push(r)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}g.push(`date_updated='${Date()}'`),g.push(`date_updated_code='${Date.now()}'`);let D=`UPDATE ${i} SET ${g.join(",")} WHERE \`${u}\`=?`;return y.push(p),f?await h(D,y):await h({paradigm:t,database:r,queryString:D,queryValues:y})}e.exports=i},82703:(e,t,r)=>{let{scryptSync:a,createCipheriv:s}=r(55511),{Buffer:n}=r(79428),o=r(48225);e.exports=(e,t,r)=>{let c=s("aes-192-cbc",a(t||process.env.DSQL_ENCRYPTION_PASSWORD||"",r||process.env.DSQL_ENCRYPTION_SALT||"",24),n.alloc(16,0));try{let t=c.update(e,"utf8","hex");return t+=c.final("hex")}catch(e){return o({component:"encrypt",message:e.message}),null}}},16570:e=>{e.exports={allowedTags:["b","i","em","strong","a","p","span","ul","ol","li","h1","h2","h3","h4","h5","h6","img","div","button","pre","code","br"],allowedAttributes:{a:["href"],img:["src","alt","width","height","class","style"],"*":["style","class"]}}},48225:(e,t,r)=>{let a=r(29021);e.exports=async function({user:e,message:t,component:r,noMail:s}){let n=`🚀 SERVER ERROR ===========================
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}
Error Message: ${t}
Component: ${r}
Date: ${Date()}
========================================`;a.existsSync("./.tmp/error.log")||a.writeFileSync("./.tmp/error.log","","utf-8");let o=a.readFileSync("./.tmp/error.log","utf-8");a.writeFileSync("./.tmp/error.log",n),a.appendFileSync("./.tmp/error.log",`
${o}`)}},51348:(e,t,r)=>{let a=r(9973),s=r(21580),n=a({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.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:s()}});async function o(...e){try{let t=await n.query(...e);return await n.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21339:(e,t,r)=>{let a=r(29021);r(33873);let s=r(9973),n=r(21580),o=s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:n()}});e.exports=function({paradigm:e,database:t,queryString:r,queryValues:c}){try{return new Promise((i,l)=>{let d=!!e?.match(/full.access|^fa$/i);try{function u(e){o.end(),i(JSON.parse(JSON.stringify(e)))}function p(e){o.end(),i({error:e.message,queryStringGenerated:r,queryValuesGenerated:c,sql:e.sql})}o=d?s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:t,ssl:n()}}):s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:t,ssl:n()}}),c&&Array.isArray(c)&&c[0]?o.query(r,c).then(u).catch(p):o.query(r).then(u).catch(p)}catch(e){a.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),i({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},21580:(e,t,r)=>{let a=r(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let t=`${e}/ca-cert.pem`;if(!a.existsSync(t)){console.log(`${t} does not exist`);return}return{ca:a.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,t)=>{var r;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return r}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(r||(r={}))},89947:(e,t,r)=>{e.exports=r(75600)}};

View File

@ -1,106 +0,0 @@
"use strict";
exports.id = 4097;
exports.ids = [4097];
exports.modules = {
/***/ 4097:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ PageHeadTags)
/* 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.pageTitle
* @param {string} props.pageDescription
* @param {string} props.pagePathname
* @param {boolean} [props.aceEditor]
*/ function PageHeadTags({ pageTitle , pageDescription , pagePathname , aceEditor , }) {
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
rel: "canonical",
href: "http://localhost:7070" + pagePathname
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
property: "og:url",
content: "http://localhost:7070" + pagePathname
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
itemProp: "url",
content: "http://localhost:7070" + pagePathname
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
name: "twitter:url",
content: "http://localhost:7070" + pagePathname
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
property: "og:title",
content: pageTitle
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
property: "og:description",
content: pageDescription
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
itemProp: "name",
content: pageTitle
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
itemProp: "description",
content: pageDescription
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
name: "twitter:title",
content: pageTitle
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
name: "twitter:description",
content: pageDescription
}),
aceEditor && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("script", {
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",
integrity: "sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",
crossOrigin: "anonymous",
referrerPolicy: "no-referrer"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("script", {
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",
integrity: "sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",
crossOrigin: "anonymous",
referrerPolicy: "no-referrer"
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,54 +0,0 @@
"use strict";
exports.id = 4105;
exports.ids = [4105];
exports.modules = {
/***/ 4105:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ checkUniqueField)
/* harmony export */ });
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6405);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _fetchApi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6729);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
let timeout;
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} params
* @param {string} params.tableName
* @param {string} params.columnName
* @param {string} params.value
* @param {string} [params.dbFullName]
* @param {any} [params.dispatch]
* @param {number} [params.userId]
* @param {number} [params.dbId]
*/ async function checkUniqueField({ tableName , columnName , value , dbFullName , dispatch , userId , dbId , }) {
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const duplicate = await (0,_fetchApi__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(`/api/checkDuplicateData?tableName=${tableName}&type=${columnName}&value=${value}${dbFullName ? "&dbFullName=" + dbFullName : ""}${userId ? "&userId=" + userId : ""}${dbId ? "&dbId=" + dbId : ""}`);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return duplicate;
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,179 +0,0 @@
"use strict";
exports.id = 4114;
exports.ids = [4114];
exports.modules = {
/***/ 4114:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ FormSelect)
/* 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 lucide_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2423);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* @typedef {object} OptionObject
* @property {string} title
* @property {string} payload
* @property {boolean} [default]
*/ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {OptionObject[]} props.selectOptions - array of option objects
* @param {string} [props.name]
* @param {(e:any) => void} [props.onChangeHandler]
* @param {boolean} [props.required]
* @param {React.Dispatch<React.SetStateAction<any>>} [props.setAlert]
* @param {string | React.ReactNode} [props.title]
* @param {string} [props.defaultValue]
* @param {string} [props.info]
* @param {string} [props.id]
*/ function FormSelect({ selectOptions , name , onChangeHandler , required , setAlert , title , defaultValue , info , id , }) {
try {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ function toggleDropdown(/** @type {any} */ e) {
if (e.type.match(/enter/i) && window.innerWidth < 1200) {
return;
}
const infoWrapper = e.target.closest(".info-wrapper");
const dropdown = infoWrapper.querySelector(".info-dropdown");
if (e.type.match(/leave/i) && !dropdown.classList.contains("hidden")) {
dropdown.classList.add("hidden");
return;
} else if (e.type.match(/leave/i) && dropdown.classList.contains("hidden")) {
return;
}
if (!infoWrapper) {
dropdown.classList.add("hidden");
return;
}
if (dropdown.classList.contains("hidden")) {
dropdown.classList.remove("hidden");
return;
}
dropdown.classList.add("hidden");
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "form-select-block flex items-start flex-col gap-0.5 w-full relative" + (info ? " pr-8" : ""),
children: [
title && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("label", {
htmlFor: name,
children: [
title,
required ? "" : " (optional)"
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex items-center w-full relative",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("select", {
name: name,
id: id ? id : name,
className: "w-full bg-white",
required: required,
onChange: (/** @type {any} */ e)=>{
if (setAlert) setAlert(null);
e.target.classList.remove("warning");
if (onChangeHandler) onChangeHandler(e);
},
defaultValue: defaultValue ? defaultValue : undefined,
children: selectOptions.map((value, index)=>{
const { payload , title } = value;
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("option", {
value: payload,
selected: value.default ? true : false,
children: title
}, index + 1);
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_1__.ChevronDown, {
className: "absolute right-2 text-base text-slate-500 pointer-events-none",
size: 20
}),
info && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "info-wrapper absolute -right-10 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",
style: {
top: "50%",
transform: "translate(0,-50%)"
},
onMouseEnter: toggleDropdown,
onMouseLeave: toggleDropdown,
onClick: toggleDropdown,
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/info-outlined-black.png",
alt: "",
className: "w-6 h-6 object-contain opacity-60 pointer-events-none"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: info
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "absolute -top-2 w-12",
style: {
height: "45px"
}
})
]
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
console.log("ERROR in FormSelect =>", error);
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
children: "Form Select Error"
});
}
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,166 +0,0 @@
"use strict";
exports.id = 4187;
exports.ids = [4187];
exports.modules = {
/***/ 4187:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ SuDashboardContent)
/* 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__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6729);
/* harmony import */ var _general_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5264);
/* harmony import */ var _components_UserCard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1336);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {any} props.data
*/ function SuDashboardContent({ data }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const userTitles = Object.keys(data.users[0]);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ /** @type {[ errorLog: string | null, setErrorLog: React.Dispatch<React.SetStateAction<string | null>> ]} */ // @ts-ignore
const [errorLog, setErrorLog] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(null);
const [refresh, setRefresh] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
const [clearErrorLogLoading, setClearErrorLogLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
function fetchErrorLogs() {
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)("/api/admin/grabErrorLogs").then((res)=>{
if (res?.log && typeof res.log === "string" && !res.log?.match(/./)) {
setErrorLog("No Logs Yet");
return;
} else if (res?.log) {
setErrorLog("No Logs");
}
setErrorLog(res.log.replace(/\n|\r|\n\r|\\n/gm, "<br/>"));
});
}
console.log(typeof errorLog);
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
fetchErrorLogs();
if (refresh === 0) {
setInterval(()=>{
fetchErrorLogs();
}, 10000);
}
}, [
refresh
]);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "items-stretch gap-10 w-full",
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("section", {
className: "paper w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h2", {
className: "text-xl m-0 mb-6",
children: "Users"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "flex-col items-stretch gap-10",
children: data.users.map((/** @type {any} */ userObject, /** @type {number} */ index)=>{
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_UserCard__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
userObject: userObject
}, index + 1);
})
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("section", {
className: "paper",
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "w-full justify-between",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h2", {
className: "text-xl m-0",
children: "Error Logs"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", {
onClick: (e)=>{
if (window.confirm("Clear Error Logs?")) {
setClearErrorLogLoading(true);
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)("/api/admin/clearErrorLogs", "post").then((res)=>{
setRefresh((prev)=>prev + 1);
});
setTimeout(()=>{
setClearErrorLogLoading(false);
}, 2000);
}
},
className: "outlined gray relative",
children: [
clearErrorLogLoading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
width: "20px"
}),
"Clear Error Log"
]
})
})
]
}),
errorLog && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
dangerouslySetInnerHTML: {
__html: errorLog ? errorLog : "No Log"
}
}),
typeof errorLog !== "string" && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_general_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
position: "relative",
width: "25px"
})
]
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,66 +0,0 @@
"use strict";
exports.id = 4194;
exports.ids = [4194];
exports.modules = {
/***/ 4194:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const os = __webpack_require__(2037);
const { execSync } = __webpack_require__(2081);
const serverError = __webpack_require__(2163);
const { ServerResponse } = __webpack_require__(3685);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Function
* ==============================================================================
* @param {Object} params - Single object parameter
* @param {string} params.dbName - Database Full Name
* @param {import("@/package-shared/types").UserType} params.user - Database Full Name
* @param {ServerResponse} params.res - Http response object
*/ module.exports = async function exportDb({ dbName , user , res }) {
const mysqlDumpPath = os.platform().match(/win/i) ? "'" + "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe" + "'" : "mysqldump";
try {
/** @type {import("child_process").ExecSyncOptions} */ let execSyncOptions = {
cwd: process.cwd()
};
const filePath = `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${user.id}/export.sql`;
if (os.platform().match(/win/i)) execSyncOptions.shell = "bash.exe";
const exe = `${mysqlDumpPath} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${dbName} > ${filePath}`;
console.log(`exportDb.js exe => ${exe}`);
const dumpDb = execSync(exe, execSyncOptions);
// const file = fs.createWriteStream(filePath);
res.setHeader("Content-Type", "application/zip");
res.setHeader("Content-Disposition", `attachment; filename=export.sql`);
const fileStream = fs.createReadStream(filePath);
/** ********************* Write response header */ fileStream.pipe(res);
// res.pipe(file);
// res.writeHead(200);
// await new Promise((resolve, reject) => {
// file.on("finish", () => {
// // res.pipe(file);
// resolve(true);
// });
// });
// return fs.readFileSync(filePath, "utf-8");
// return file;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (/** @type {any} */ error) {
serverError({
component: "/functions/backend/exportDb/lines-30-46",
message: error.message,
user: user
});
}
}; /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

File diff suppressed because one or more lines are too long

View File

@ -1,137 +0,0 @@
"use strict";
exports.id = 424;
exports.ids = [424];
exports.modules = {
/***/ 424:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ Breadcrumbs)
/* 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 {any} [props.confirmedDelegetedUser]
* @param {any} [props.linksArray]
* @param {import("@/package-shared/types").UserType} [props.user]
*/ function Breadcrumbs({ confirmedDelegetedUser , linksArray , user , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const isDelegated = confirmedDelegetedUser?.delegated;
const isTableEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Tables/i);
const isTableDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Tables/i);
const isTableCreatable = confirmedDelegetedUser?.priviledges?.match(/Create Tables/i);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ /** @type {any} */ const linksState = react__WEBPACK_IMPORTED_MODULE_1___default().useState(linksArray ? linksArray : null);
/** @type { [ links:any[], setLinks: React.Dispatch<React.SetStateAction<any[]>> ] } */ const [links, setLinks] = linksState;
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
if (linksArray) return;
let pathname = window.location.pathname;
let pathLinks = pathname.split("/");
let validPathLinks = [];
validPathLinks.push({
title: "Home",
path: pathname.match(/admin/) ? "/admin" : "/"
});
const isDelegated = window.location.search?.match(/delegated=true/);
pathLinks.forEach((linkText, index, array)=>{
if (!linkText?.match(/./) || index == 1) {
return;
}
if (linkText.match(/^\d+$/) && user) {
// validPathLinks.push({
// title: user.first_name,
// path: `/admin/${linkText}`,
// });
return;
}
validPathLinks.push({
title: linkText,
path: (()=>{
let path = "";
for(let i = 0; i < array.length; i++){
const lnText = array[i];
if (i > index || !lnText.match(/./)) continue;
path += `/${lnText}`;
}
return path;
})()
});
});
setLinks(validPathLinks);
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ if (!links || !links[1]) {
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {});
}
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "text-sm mt-2 flex-wrap",
children: links.map((linkObject, index, array)=>{
if (index === links.length - 1) {
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: linkObject.path,
className: "text-slate-400 dark:text-slate-500 pointer-events-none",
children: linkObject.title
}, index);
} else {
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: linkObject.path,
className: "query-url",
children: linkObject.title
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "opacity-20",
children: "|"
})
]
}, index);
}
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,67 +0,0 @@
"use strict";
exports.id = 4294;
exports.ids = [4294];
exports.modules = {
/***/ 4294:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const generator = __webpack_require__(3785);
const DB_HANDLER = __webpack_require__(2224);
const NO_DB_HANDLER = __webpack_require__(7487);
const encrypt = __webpack_require__(7547);
const addDbEntry = __webpack_require__(5338);
/**
* # Add Mariadb User
*
* @description this function adds a Mariadb user to the database server
*
* @param {object} params - parameters object *
* @param {number | string} params.userId - invited user object
*
* @returns {Promise<any>} new user auth object payload
*/ module.exports = async function addMariadbUser({ userId }) {
try {
const defaultMariadbUserHost = process.env.DSQL_DB_HOST || "127.0.0.1";
const username = `dsql_user_${userId}`;
const password = generator.generate({
length: 16,
numbers: true,
symbols: true,
uppercase: true,
exclude: "*#.'`\""
});
const encryptedPassword = encrypt(password);
await NO_DB_HANDLER(`CREATE USER IF NOT EXISTS '${username}'@'127.0.0.1' IDENTIFIED BY '${password}' REQUIRE SSL`);
const updateUser = await DB_HANDLER(`UPDATE users SET mariadb_user = ?, mariadb_host = '127.0.0.1', mariadb_pass = ? WHERE id = ?`, [
username,
encryptedPassword,
userId
]);
const addMariadbUser1 = await addDbEntry({
tableName: "mariadb_users",
data: {
user_id: userId,
username,
host: defaultMariadbUserHost,
password: encryptedPassword,
primary: "1",
grants: '[{"database":"*","table":"*","privileges":["ALL"]}]'
},
dbContext: "Master"
});
console.log(`User ${userId} SQL credentials successfully added.`);
} catch (/** @type {any} */ error) {
console.log(`Error in adding SQL user in 'addMariadbUser' function =>`, error.message);
}
}; ////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/***/ })
};
;

View File

@ -1,523 +0,0 @@
exports.id = 4298;
exports.ids = [4298];
exports.modules = {
/***/ 6495:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _extends;
function _extends() {
return extends_.apply(this, arguments);
}
function extends_() {
extends_ = Object.assign || function(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i];
for(var key in source){
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return extends_.apply(this, arguments);
}
/***/ }),
/***/ 1598:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _interopRequireWildcard;
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _getRequireWildcardCache(nodeInterop1) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop1);
}
/***/ }),
/***/ 7273:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = ({
value: true
});
exports.Z = _objectWithoutPropertiesLoose;
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
/***/ }),
/***/ 6007:
/***/ ((module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = initHeadManager;
exports.isEqualNode = isEqualNode;
exports.DOMAttributeNames = void 0;
function initHeadManager() {
return {
mountedInstances: new Set(),
updateHead: (head)=>{
const tags = {};
head.forEach((h)=>{
if (// it won't be inlined. In this case revert to the original behavior
h.type === "link" && h.props["data-optimized-fonts"]) {
if (document.querySelector(`style[data-href="${h.props["data-href"]}"]`)) {
return;
} else {
h.props.href = h.props["data-href"];
h.props["data-href"] = undefined;
}
}
const components = tags[h.type] || [];
components.push(h);
tags[h.type] = components;
});
const titleComponent = tags.title ? tags.title[0] : null;
let title = "";
if (titleComponent) {
const { children } = titleComponent.props;
title = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
}
if (title !== document.title) document.title = title;
[
"meta",
"base",
"link",
"style",
"script"
].forEach((type)=>{
updateElements(type, tags[type] || []);
});
}
};
}
const DOMAttributeNames = {
acceptCharset: "accept-charset",
className: "class",
htmlFor: "for",
httpEquiv: "http-equiv",
noModule: "noModule"
};
exports.DOMAttributeNames = DOMAttributeNames;
function reactElementToDOM({ type , props }) {
const el = document.createElement(type);
for(const p in props){
if (!props.hasOwnProperty(p)) continue;
if (p === "children" || p === "dangerouslySetInnerHTML") continue;
// we don't render undefined props to the DOM
if (props[p] === undefined) continue;
const attr = DOMAttributeNames[p] || p.toLowerCase();
if (type === "script" && (attr === "async" || attr === "defer" || attr === "noModule")) {
el[attr] = !!props[p];
} else {
el.setAttribute(attr, props[p]);
}
}
const { children , dangerouslySetInnerHTML } = props;
if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || "";
} else if (children) {
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
}
return el;
}
function isEqualNode(oldTag, newTag) {
if (oldTag instanceof HTMLElement && newTag instanceof HTMLElement) {
const nonce = newTag.getAttribute("nonce");
// Only strip the nonce if `oldTag` has had it stripped. An element's nonce attribute will not
// be stripped if there is no content security policy response header that includes a nonce.
if (nonce && !oldTag.getAttribute("nonce")) {
const cloneTag = newTag.cloneNode(true);
cloneTag.setAttribute("nonce", "");
cloneTag.nonce = nonce;
return nonce === oldTag.nonce && oldTag.isEqualNode(cloneTag);
}
}
return oldTag.isEqualNode(newTag);
}
function updateElements(type, components) {
const headEl = document.getElementsByTagName("head")[0];
const headCountEl = headEl.querySelector("meta[name=next-head-count]");
if (false) {}
const headCount = Number(headCountEl.content);
const oldTags = [];
for(let i = 0, j = headCountEl.previousElementSibling; i < headCount; i++, j = (j == null ? void 0 : j.previousElementSibling) || null){
var ref;
if ((j == null ? void 0 : (ref = j.tagName) == null ? void 0 : ref.toLowerCase()) === type) {
oldTags.push(j);
}
}
const newTags = components.map(reactElementToDOM).filter((newTag)=>{
for(let k = 0, len = oldTags.length; k < len; k++){
const oldTag = oldTags[k];
if (isEqualNode(oldTag, newTag)) {
oldTags.splice(k, 1);
return false;
}
}
return true;
});
oldTags.forEach((t)=>{
var ref;
return (ref = t.parentNode) == null ? void 0 : ref.removeChild(t);
});
newTags.forEach((t)=>headEl.insertBefore(t, headCountEl));
headCountEl.content = (headCount - oldTags.length + newTags.length).toString();
}
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
Object.defineProperty(exports.default, "__esModule", {
value: true
});
Object.assign(exports.default, exports);
module.exports = exports.default;
} //# sourceMappingURL=head-manager.js.map
/***/ }),
/***/ 9311:
/***/ ((module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.cancelIdleCallback = exports.requestIdleCallback = void 0;
const requestIdleCallback = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
let start = Date.now();
return setTimeout(function() {
cb({
didTimeout: false,
timeRemaining: function() {
return Math.max(0, 50 - (Date.now() - start));
}
});
}, 1);
};
exports.requestIdleCallback = requestIdleCallback;
const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
return clearTimeout(id);
};
exports.cancelIdleCallback = cancelIdleCallback;
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
Object.defineProperty(exports.default, "__esModule", {
value: true
});
Object.assign(exports.default, exports);
module.exports = exports.default;
} //# sourceMappingURL=request-idle-callback.js.map
/***/ }),
/***/ 699:
/***/ ((module, exports, __webpack_require__) => {
"use strict";
"client";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.handleClientScriptLoad = handleClientScriptLoad;
exports.initScriptLoader = initScriptLoader;
exports["default"] = void 0;
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
var _react = _interop_require_wildcard(__webpack_require__(6689));
var _headManagerContext = __webpack_require__(2796);
var _headManager = __webpack_require__(6007);
var _requestIdleCallback = __webpack_require__(9311);
"client";
const ScriptCache = new Map();
const LoadCache = new Set();
const ignoreProps = [
"onLoad",
"onReady",
"dangerouslySetInnerHTML",
"children",
"onError",
"strategy",
];
const loadScript = (props)=>{
const { src , id , onLoad =()=>{} , onReady =null , dangerouslySetInnerHTML , children ="" , strategy ="afterInteractive" , onError , } = props;
const cacheKey = id || src;
// Script has already loaded
if (cacheKey && LoadCache.has(cacheKey)) {
return;
}
// Contents of this script are already loading/loaded
if (ScriptCache.has(src)) {
LoadCache.add(cacheKey);
// It is possible that multiple `next/script` components all have same "src", but has different "onLoad"
// This is to make sure the same remote script will only load once, but "onLoad" are executed in order
ScriptCache.get(src).then(onLoad, onError);
return;
}
/** Execute after the script first loaded */ const afterLoad = ()=>{
// Run onReady for the first time after load event
if (onReady) {
onReady();
}
// add cacheKey to LoadCache when load successfully
LoadCache.add(cacheKey);
};
const el = document.createElement("script");
const loadPromise = new Promise((resolve, reject)=>{
el.addEventListener("load", function(e) {
resolve();
if (onLoad) {
onLoad.call(this, e);
}
afterLoad();
});
el.addEventListener("error", function(e) {
reject(e);
});
}).catch(function(e) {
if (onError) {
onError(e);
}
});
if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || "";
afterLoad();
} else if (children) {
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
afterLoad();
} else if (src) {
el.src = src;
// do not add cacheKey into LoadCache for remote script here
// cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)
ScriptCache.set(src, loadPromise);
}
for (const [k, value] of Object.entries(props)){
if (value === undefined || ignoreProps.includes(k)) {
continue;
}
const attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
el.setAttribute(attr, value);
}
if (strategy === "worker") {
el.setAttribute("type", "text/partytown");
}
el.setAttribute("data-nscript", strategy);
document.body.appendChild(el);
};
function handleClientScriptLoad(props) {
const { strategy ="afterInteractive" } = props;
if (strategy === "lazyOnload") {
window.addEventListener("load", ()=>{
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
});
} else {
loadScript(props);
}
}
function loadLazyScript(props) {
if (document.readyState === "complete") {
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
} else {
window.addEventListener("load", ()=>{
(0, _requestIdleCallback).requestIdleCallback(()=>loadScript(props));
});
}
}
function addBeforeInteractiveToCache() {
const scripts = [
...document.querySelectorAll('[data-nscript="beforeInteractive"]'),
...document.querySelectorAll('[data-nscript="beforePageRender"]'),
];
scripts.forEach((script)=>{
const cacheKey = script.id || script.getAttribute("src");
LoadCache.add(cacheKey);
});
}
function initScriptLoader(scriptLoaderItems) {
scriptLoaderItems.forEach(handleClientScriptLoad);
addBeforeInteractiveToCache();
}
function Script(props) {
const { id , src ="" , onLoad =()=>{} , onReady =null , strategy ="afterInteractive" , onError } = props, restProps = _object_without_properties_loose(props, [
"id",
"src",
"onLoad",
"onReady",
"strategy",
"onError"
]);
// Context is available only during SSR
const { updateScripts , scripts , getIsSsr } = (0, _react).useContext(_headManagerContext.HeadManagerContext);
/**
* - First mount:
* 1. The useEffect for onReady executes
* 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache)
* onReady is skipped, set hasOnReadyEffectCalled.current to true
* 3. The useEffect for loadScript executes
* 4. hasLoadScriptEffectCalled.current is false, loadScript executes
* Once the script is loaded, the onLoad and onReady will be called by then
* [If strict mode is enabled / is wrapped in <OffScreen /> component]
* 5. The useEffect for onReady executes again
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
* 7. The useEffect for loadScript executes again
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
*
* - Second mount:
* 1. The useEffect for onReady executes
* 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache)
* onReady is called, set hasOnReadyEffectCalled.current to true
* 3. The useEffect for loadScript executes
* 4. The script is already loaded, loadScript bails out
* [If strict mode is enabled / is wrapped in <OffScreen /> component]
* 5. The useEffect for onReady executes again
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
* 7. The useEffect for loadScript executes again
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
*/ const hasOnReadyEffectCalled = (0, _react).useRef(false);
(0, _react).useEffect(()=>{
const cacheKey = id || src;
if (!hasOnReadyEffectCalled.current) {
// Run onReady if script has loaded before but component is re-mounted
if (onReady && cacheKey && LoadCache.has(cacheKey)) {
onReady();
}
hasOnReadyEffectCalled.current = true;
}
}, [
onReady,
id,
src
]);
const hasLoadScriptEffectCalled = (0, _react).useRef(false);
(0, _react).useEffect(()=>{
if (!hasLoadScriptEffectCalled.current) {
if (strategy === "afterInteractive") {
loadScript(props);
} else if (strategy === "lazyOnload") {
loadLazyScript(props);
}
hasLoadScriptEffectCalled.current = true;
}
}, [
props,
strategy
]);
if (strategy === "beforeInteractive" || strategy === "worker") {
if (updateScripts) {
scripts[strategy] = (scripts[strategy] || []).concat([
_extends({
id,
src,
onLoad,
onReady,
onError
}, restProps),
]);
updateScripts(scripts);
} else if (getIsSsr && getIsSsr()) {
// Script has already loaded during SSR
LoadCache.add(id || src);
} else if (getIsSsr && !getIsSsr()) {
loadScript(props);
}
}
return null;
}
Object.defineProperty(Script, "__nextScript", {
value: true
});
var _default = Script;
exports["default"] = _default;
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
Object.defineProperty(exports.default, "__esModule", {
value: true
});
Object.assign(exports.default, exports);
module.exports = exports.default;
} //# sourceMappingURL=script.js.map
/***/ }),
/***/ 4298:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__(699)
/***/ })
};
;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,68 +0,0 @@
"use strict";
exports.id = 4432;
exports.ids = [4432];
exports.modules = {
/***/ 4432:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { IncomingMessage } = __webpack_require__(3685);
const decrypt = __webpack_require__(5425);
/**
* @async
* @param {import("next").NextApiRequest | IncomingMessage & { cookies: Partial<{ [key: string]: string; }>} } req - https request object
*
* @returns {Promise<({ email: string, password: string, authKey: string, logged_in_status: boolean, date: number } | null)>}
*/ module.exports = async function(req) {
/** ********************* Check for existence of required cookie */ if (!req.cookies?.datasquirelSuAdminUserAuthKey) {
return null;
}
/** ********************* Grab the payload */ let userPayload = decrypt(req.cookies.datasquirelSuAdminUserAuthKey);
/** ********************* Return if no payload */ if (!userPayload) return null;
/** ********************* Parse the payload */ let userObject = JSON.parse(userPayload);
if (userObject.password !== process.env.DSQL_USER_KEY) return null;
if (userObject.authKey !== process.env.DSQL_SPECIAL_KEY) return null;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ********************* return user object */ return userObject;
};
/***/ }),
/***/ 5425:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { scryptSync , createDecipheriv } = __webpack_require__(6113);
const { Buffer } = __webpack_require__(4300);
/**
* @param {string} encryptedString
* @returns {string | null}
*/ const decrypt = (encryptedString)=>{
const algorithm = "aes-192-cbc";
const password = process.env.DSQL_ENCRYPTION_PASSWORD || "";
const salt = process.env.DSQL_ENCRYPTION_SALT || "";
let key = scryptSync(password, salt, 24);
let iv = Buffer.alloc(16, 0);
// @ts-ignore
const decipher = createDecipheriv(algorithm, key, iv);
try {
let decrypted = decipher.update(encryptedString, "hex", "utf8");
decrypted += decipher.final("utf8");
return decrypted;
} catch (error) {
return null;
}
};
module.exports = decrypt;
/***/ })
};
;

View File

@ -1,108 +0,0 @@
"use strict";
exports.id = 4480;
exports.ids = [4480];
exports.modules = {
/***/ 5304:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { scryptSync , createDecipheriv } = __webpack_require__(6113);
const { Buffer } = __webpack_require__(4300);
/**
* @param {string} encryptedString
* @returns {string | null}
*/ const decrypt = (encryptedString)=>{
const algorithm = "aes-192-cbc";
const password = process.env.DSQL_ENCRYPTION_PASSWORD || "";
const salt = process.env.DSQL_ENCRYPTION_SALT || "";
let key = scryptSync(password, salt, 24);
let iv = Buffer.alloc(16, 0);
// @ts-ignore
const decipher = createDecipheriv(algorithm, key, iv);
try {
let decrypted = decipher.update(encryptedString, "hex", "utf8");
decrypted += decipher.final("utf8");
return decrypted;
} catch (error) {
return null;
}
};
module.exports = decrypt;
/***/ }),
/***/ 9395:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const mysql = __webpack_require__(2261);
const grabDbSSL = __webpack_require__(3260);
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.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
charset: "utf8mb4",
ssl: grabDbSSL()
}
});
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {string} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/ // @ts-ignore
async function DB_HANDLER(...args) {
try {
const results = await MASTER.query(...args);
/** ********************* Clean up */ await MASTER.end();
return JSON.parse(JSON.stringify(results));
} catch (/** @type {any} */ error) {
console.log("DB Error =>", error);
return {
success: false,
error: error.message
};
}
}
module.exports = DB_HANDLER;
/***/ }),
/***/ 3260:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
/**
* @returns {string | (import("tls").SecureContextOptions & { rejectUnauthorized?: boolean | undefined;}) | undefined}
*/ module.exports = function grabDbSSL() {
const SSL_DIR = process.env.DSQL_SSL_DIR;
if (!SSL_DIR?.match(/./)) {
return undefined;
}
const caFilePath = `${SSL_DIR}/ca-cert.pem`;
if (!fs.existsSync(caFilePath)) {
console.log(`${caFilePath} does not exist`);
return undefined;
}
return {
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
};
};
/***/ })
};
;

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
"use strict";
exports.id = 4598;
exports.ids = [4598];
exports.modules = {
/***/ 4598:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ FadedImage)
/* 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 {{
* src: string,
* alt?: string,
* className?: string,
* fadeHeight?: string,
* width?: number,
* height?: number,
* opacity?: number
* }} props - Server props
*/ function FadedImage({ src , alt , className , fadeHeight , width , height , opacity , }) {
/**
* 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)("div", {
className: "overflow-hidden z-0" + (className ? " " + className : ""),
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: src,
alt: alt,
className: "w-full h-full object-cover",
width: width,
height: height
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "fade-side",
style: {
height: fadeHeight
}
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,172 +0,0 @@
"use strict";
exports.id = 464;
exports.ids = [464];
exports.modules = {
/***/ 5753:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ generateTypeDefinition)
/* harmony export */ });
/* harmony import */ var _functions_frontend_defaultFieldsRegexp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3907);
// @ts-check
/**
* Generate a type definition for a query
* ==============================================================================
* @param {object} param0
* @param {"JavaScript" | "TypeScript" | undefined} param0.paradigm
* @param {import("@/package-shared/types").DSQL_TableSchemaType} param0.table
* @param {any} param0.query
* @param {import("@/package-shared/types").UserType} [param0.user]
* @returns {string | null}
*/ function generateTypeDefinition({ paradigm , table , query , user , }) {
/** @type {string | null} */ let typeDefinition = ``;
try {
const tdName = `DSQL_${query.single}_${query.single_table}`.toUpperCase();
const fields = table.fields;
function typeMap(/** @type {string} */ type) {
if (type?.match(/int/i)) {
return "number";
}
if (type?.match(/text|varchar|timestamp/i)) {
return "string";
}
return "string";
}
const typesArrayTypeScript = [];
const typesArrayJavascript = [];
typesArrayTypeScript.push(`type ${tdName} = {`);
typesArrayJavascript.push(`/**\n * @typedef {object} ${tdName}`);
fields.forEach((field)=>{
const nullValue = field.nullValue ? "?" : field.fieldName?.match(_functions_frontend_defaultFieldsRegexp__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z) ? "?" : "";
typesArrayTypeScript.push(` ${field.fieldName}${nullValue}: ${typeMap(field.dataType || "")};`);
typesArrayJavascript.push(` * @property {${typeMap(field.dataType || "")}${nullValue}} ${field.fieldName}`);
});
typesArrayTypeScript.push(`}`);
typesArrayJavascript.push(` */`);
if (paradigm?.match(/javascript/i)) {
typeDefinition = typesArrayJavascript.join("\n");
}
if (paradigm?.match(/typescript/i)) {
typeDefinition = typesArrayTypeScript.join("\n");
}
} catch (/** @type {any} */ error) {
console.log(error.message);
typeDefinition = null;
}
return typeDefinition;
}
/***/ }),
/***/ 6169:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ ExpandBlock)
/* 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 {boolean} props.collapse
* @param {React.Dispatch<React.SetStateAction<boolean>>} props.setCollapse
*/ function ExpandBlock({ collapse , setCollapse }) {
/**
* 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)("div", {
className: "collapse-block" + (collapse ? " -mt-16 -mb-6 pt-10" : " mt-0 mb-0 p-0"),
onClick: (e)=>{
if (collapse) {
setCollapse(false);
} else {
setCollapse(true);
}
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: collapse ? "Expand" : "Collapse"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/down-arrow-dark.svg",
alt: "Down Arrow",
width: 16,
className: "dark:hidden opacity-30 " + (collapse ? "" : "rotate-180")
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/down-arrow-white.svg",
alt: "Down Arrow",
width: 16,
className: "opacity-30 hidden dark:flex " + (collapse ? "" : "rotate-180")
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ }),
/***/ 3907:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
// @ts-check
/**
* Check for user in local storage
*
* @description Preventdefault, declare variables
*/ const defaultFieldsRegexp = /^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (defaultFieldsRegexp);
/***/ })
};
;

View File

@ -1,412 +0,0 @@
"use strict";
exports.id = 4733;
exports.ids = [4733];
exports.modules = {
/***/ 8499:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/** # MODULE TRACE
======================================================================
* Detected 3 files that call this module. The files are listed below:
======================================================================
* `import` Statement Found in [get.js] => file:///d:\GitHub\datasquirel\pages\api\query\get.js
* `import` Statement Found in [post.js] => file:///d:\GitHub\datasquirel\pages\api\query\post.js
* `import` Statement Found in [add-user.js] => file:///d:\GitHub\datasquirel\pages\api\user\add-user.js
==== MODULE TRACE END ==== */ // @ts-check
const fs = __webpack_require__(7147);
const LOCAL_DB_HANDLER = __webpack_require__(3062);
const fullAccessDbHandler = __webpack_require__(8539);
const varReadOnlyDatabaseDbHandler = __webpack_require__(3118);
const serverError = __webpack_require__(3017);
const addDbEntry = __webpack_require__(5338);
const updateDbEntry = __webpack_require__(5886);
const deleteDbEntry = __webpack_require__(6147);
const parseDbResults = __webpack_require__(8326);
const trimSql = __webpack_require__(6888);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* 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 {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 , local , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ /** @type {any} */ let result;
/** @type {any} */ let error;
/** @type {import("../../../types").DSQL_TableSchemaType | undefined} */ let tableSchema;
if (dbSchema) {
try {
const table = tableName ? tableName : typeof query == "string" ? null : query ? query?.table : null;
if (!table) throw new Error("No table name provided");
tableSchema = dbSchema.tables.filter((tb)=>tb?.tableName === table)[0];
} catch (_err) {
// console.log("ERROR getting tableSchema: ", _err.message);
}
}
/**
* Declare variables
*
* @description Declare "results" variable
*/ try {
if (typeof query === "string") {
const formattedQuery = trimSql(query);
/**
* Input Validation
*
* @description Input Validation
*/ if (readOnly && formattedQuery.match(/^alter|^delete|information_schema|databases|^create/i)) {
throw new Error("Wrong Input!");
}
if (local) {
const rawResults = await LOCAL_DB_HANDLER(formattedQuery, queryValuesArray);
result = tableSchema ? parseDbResults({
unparsedResults: rawResults,
tableSchema
}) : rawResults;
} else if (readOnly) {
result = await varReadOnlyDatabaseDbHandler({
queryString: formattedQuery,
queryValuesArray,
database: dbFullName,
tableSchema
});
} else {
result = await fullAccessDbHandler({
queryString: formattedQuery,
queryValuesArray,
database: dbFullName,
tableSchema
});
}
} else if (typeof query === "object") {
/**
* Declare variables
*
* @description Declare "results" variable
*/ const { data , action , table: table1 , identifierColumnName , identifierValue , update , duplicateColumnName , duplicateColumnValue , } = query;
switch(action.toLowerCase()){
case "insert":
result = await addDbEntry({
dbContext: local ? "Master" : "Dsql User",
paradigm: "Full Access",
dbFullName: dbFullName,
tableName: table1,
data: data,
update,
duplicateColumnName,
duplicateColumnValue,
tableSchema
});
if (!result?.insertId) {
error = new Error("Couldn't insert data");
}
break;
case "update":
result = await updateDbEntry({
dbContext: local ? "Master" : "Dsql User",
paradigm: "Full Access",
dbFullName: dbFullName,
tableName: table1,
data: data,
identifierColumnName,
identifierValue,
tableSchema
});
break;
case "delete":
result = await deleteDbEntry({
dbContext: local ? "Master" : "Dsql User",
paradigm: "Full Access",
dbFullName: dbFullName,
tableName: table1,
identifierColumnName,
identifierValue,
tableSchema
});
break;
default:
result = null;
break;
}
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (/** @type {any} */ error1) {
serverError({
component: "functions/backend/runQuery",
message: error1.message
});
result = null;
error1 = error1.message;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return {
result,
error
};
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
module.exports = runQuery;
/***/ }),
/***/ 5425:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const { scryptSync , createDecipheriv } = __webpack_require__(6113);
const { Buffer } = __webpack_require__(4300);
/**
* @param {string} encryptedString
* @returns {string | null}
*/ const decrypt = (encryptedString)=>{
const algorithm = "aes-192-cbc";
const password = process.env.DSQL_ENCRYPTION_PASSWORD || "";
const salt = process.env.DSQL_ENCRYPTION_SALT || "";
let key = scryptSync(password, salt, 24);
let iv = Buffer.alloc(16, 0);
// @ts-ignore
const decipher = createDecipheriv(algorithm, key, iv);
try {
let decrypted = decipher.update(encryptedString, "hex", "utf8");
decrypted += decipher.final("utf8");
return decrypted;
} catch (error) {
return null;
}
};
module.exports = decrypt;
/***/ }),
/***/ 8539:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
const parseDbResults = __webpack_require__(8326);
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 , local , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/ try {
/** ********************* Run Query */ results = await DSQL_USER_DB_HANDLER({
paradigm: "Full Access",
database,
queryString,
queryValues: queryValuesArray
});
////////////////////////////////////////
} catch (/** @type {any} */ error) {
////////////////////////////////////////
serverError({
component: "fullAccessDbHandler",
message: error.message
});
/**
* Return error
*/ return error.message;
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/ if (results && tableSchema) {
const unparsedResults = results;
const parsedResults = await parseDbResults({
unparsedResults: unparsedResults,
tableSchema: tableSchema
});
return parsedResults;
} else if (results) {
return results;
} else {
return null;
}
};
/***/ }),
/***/ 3118:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const serverError = __webpack_require__(3017);
const parseDbResults = __webpack_require__(8326);
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
/**
*
* @param {object} param0
* @param {string} param0.queryString
* @param {string} param0.database
* @param {string[]} [param0.queryValuesArray]
* @param {import("../../types").DSQL_TableSchemaType} [param0.tableSchema]
* @returns
*/ module.exports = async function varReadOnlyDatabaseDbHandler({ queryString , database , queryValuesArray , tableSchema , }) {
/**
* Declare variables
*
* @description Declare "results" variable
*/ let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/ try {
results = await DSQL_USER_DB_HANDLER({
paradigm: "Read Only",
database,
queryString,
queryValues: queryValuesArray
});
////////////////////////////////////////
} catch (/** @type {any} */ error) {
////////////////////////////////////////
serverError({
component: "varReadOnlyDatabaseDbHandler",
message: error.message,
noMail: true
});
/**
* Return error
*/ return error.message;
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/ if (results) {
const unparsedResults = results;
const parsedResults = await parseDbResults({
unparsedResults: unparsedResults,
tableSchema: tableSchema
});
return parsedResults;
} else {
return null;
}
};
/***/ }),
/***/ 3062:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const mysql = __webpack_require__(2261);
const grabDbSSL = __webpack_require__(4824);
/**
* DSQL user read-only DB handler
* @param {object} params
* @param {string} params.paradigm
* @param {string} params.database
* @param {string} params.queryString
* @param {string[]} [params.queryValues]
*/ async function LOCAL_DB_HANDLER(/** @type {any[]} */ ...args) {
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.DSQL_DB_PORT ? Number(process.env.DSQL_DB_PORT) : undefined,
charset: "utf8mb4",
ssl: grabDbSSL()
},
onConnect: ()=>{
console.log("Connection Successful!");
},
onConnectError: (/** @type {any} */ err)=>{
console.log("Connection Error", err.message);
},
onError: (/** @type {any} */ err)=>{
console.log("Client Error", err.message);
}
});
console.log("Querying ...");
try {
const results = await MASTER.query(...args);
await MASTER.end();
return JSON.parse(JSON.stringify(results));
} catch (/** @type {any} */ error) {
console.log("DB Error =>", error.message);
return {
success: false,
error: error.message
};
}
}
module.exports = LOCAL_DB_HANDLER;
/***/ }),
/***/ 6888:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const https = __webpack_require__(5687);
const http = __webpack_require__(3685);
/**
* @typedef {object} GrabHostNamesReturn
* @property {string} host
* @property {number | string} port
* @property {typeof http | typeof https} scheme
*/ /**
* # Trim SQL
* @description Remove Returns and miltiple spaces from SQL Query
* @param {string} sql
* @returns {string}
*/ function trimSql(sql) {
return sql.replace(/\n|\r|\n\r|\r\n/gm, " ").replace(/ {2,}/g, " ").trim();
}
module.exports = trimSql;
/***/ })
};
;

View File

@ -1,752 +0,0 @@
"use strict";
exports.id = 4858;
exports.ids = [4858];
exports.modules = {
/***/ 6355:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DiskUsageComponent)
/* 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__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6729);
/* harmony import */ var _functions_frontend_updateDiskUsage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1069);
/* harmony import */ var _LoadingBlock__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5264);
/* harmony import */ var _mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4008);
/* harmony import */ var _mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CloudQueueRounded__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(36);
/* harmony import */ var _mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_RefreshRounded__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(69);
/* harmony import */ var _mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2423);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_6__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
*/ function DiskUsageComponent(props) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(true);
/** @type {[ diskUsage: number, setDiskUsage: React.Dispatch<React.SetStateAction<number>> ]} */ // @ts-ignore
const [diskUsage, setDiskUsage] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
const [refresh, setRefresh] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(0);
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
if (diskUsage) return;
// if (localStorage.getItem("disk_usage")) {
// setDiskUsage(parseFloat(localStorage.getItem("disk_usage")));
// return;
// }
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)("/api/getDiskUsage").then((res)=>{
// console.log(res);
if (res?.total) {
setDiskUsage(res.total);
localStorage.setItem("disk_usage", res.total);
}
setLoading(false);
});
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ if (loading) return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "button ghost small-text",
style: {
height: "30px"
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
width: "15px",
position: "relative"
})
});
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: diskUsage ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "button ghost small-text normal-weight p-0",
style: {
height: "30px",
padding: 0
},
onClick: (e)=>{
setLoading(true);
(0,_functions_frontend_updateDiskUsage__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)().then(()=>{
setRefresh((prev)=>prev + 1);
setLoading(false);
});
},
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
width: "15px"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_6__.HardDrive, {
size: 20,
className: "text-slate-400 mr-[3px]"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "font-bold text-slate-700 dark:text-white",
children: diskUsage && diskUsage.toFixed(2)
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-slate-500",
children: "mb"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_6__.RotateCw, {
size: 17,
className: "text-slate-400",
strokeWidth: 2
})
]
}) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
className: "text-sm info gray font-normal w-auto",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_CloudOffTwoTone__WEBPACK_IMPORTED_MODULE_5___default()), {
color: "inherit",
className: "opacity-50 text-slate-500",
fontSize: "small"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "No Disk Usage Data Available Yet"
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ }),
/***/ 1069:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ updateDiskUsage)
/* harmony export */ });
/* harmony import */ var _fetchApi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6729);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Auth user on client side
* ==============================================================================
*
* @requires search-field name attribute
*/ async function updateDiskUsage() {
/**
* Check for user in local storage
*
* @description Preventdefault, declare variables
*/ const res = await (0,_fetchApi__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)("/api/getDiskUsage");
localStorage.setItem("disk_usage", res.total);
} ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ }),
/***/ 4858:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ AdminLayout)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: external "next/head"
var head_ = __webpack_require__(968);
var head_default = /*#__PURE__*/__webpack_require__.n(head_);
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Footer.jsx
var Footer = __webpack_require__(5281);
// EXTERNAL MODULE: external "@mui/icons-material/DynamicFormTwoTone"
var DynamicFormTwoTone_ = __webpack_require__(8979);
// EXTERNAL MODULE: external "@mui/icons-material/CollectionsTwoTone"
var CollectionsTwoTone_ = __webpack_require__(7306);
// EXTERNAL MODULE: external "@mui/icons-material/PeopleOutlineTwoTone"
var PeopleOutlineTwoTone_ = __webpack_require__(9806);
// EXTERNAL MODULE: external "@mui/icons-material/SchemaTwoTone"
var SchemaTwoTone_ = __webpack_require__(1799);
// EXTERNAL MODULE: external "@mui/icons-material/LockTwoTone"
var LockTwoTone_ = __webpack_require__(2814);
// EXTERNAL MODULE: ./components/general/Logo.jsx
var Logo = __webpack_require__(4017);
// EXTERNAL MODULE: external "@mui/icons-material/AdminPanelSettingsTwoTone"
var AdminPanelSettingsTwoTone_ = __webpack_require__(4003);
var AdminPanelSettingsTwoTone_default = /*#__PURE__*/__webpack_require__.n(AdminPanelSettingsTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/LanguageOutlined"
var LanguageOutlined_ = __webpack_require__(300);
// EXTERNAL MODULE: external "lucide-react"
var external_lucide_react_ = __webpack_require__(2423);
;// CONCATENATED MODULE: ./layouts/components/AdminLayout/Aside.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
* @param {import("@/package-shared/types").UserType} props.user
*/ function Aside({ user }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [collapseAsideMobile, setCollapseAsideMobile] = external_react_default().useState(true);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("aside", {
className: "aside" + (collapseAsideMobile ? " mobile-collapsed" : " mobile-expanded"),
children: [
/*#__PURE__*/ jsx_runtime_.jsx(Logo/* default */.Z, {
adminAside: true,
collapseAsideMobile: collapseAsideMobile,
setCollapseAsideMobile: setCollapseAsideMobile
}),
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
className: "opacity-0 mt-4"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "main-links" + (collapseAsideMobile ? " hidden lg:flex" : " "),
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: "/admin",
"data-currentlink": "/admin",
"data-strictlink": "true",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.CircleGauge, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Dashboard"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/databases`,
"data-currentlink": `/admin/${user?.id}/databases`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Database, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Databases"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/media`,
"data-currentlink": `/admin/${user?.id}/media`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Images, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Media"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/users`,
"data-currentlink": `/admin/${user?.id}/users`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Users, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Users"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/schema`,
"data-currentlink": `/admin/${user?.id}/schema`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.BookText, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Schema"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/api-keys`,
"data-currentlink": `/admin/${user?.id}/api-keys`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.FileKey2, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "API Keys"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/admin/${user?.id}/connect`,
"data-currentlink": `/admin/${user?.id}/connect`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.Globe, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Connect"
})
]
}),
true && user.id == 1 && /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su`,
"data-currentlink": `/su`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((AdminPanelSettingsTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Super Admin User"
})
]
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
className: "opacity-80"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex-col gap-0 items-start w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: `/admin/${user?.id}/settings`,
"data-currentlink": `/admin/${user?.id}/settings`,
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Settings"
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/docs",
"data-currentlink": "/docs",
target: "_blank",
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Documentation"
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/logout",
"data-currentlink": "/logout",
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Logout"
})
})
]
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Header.jsx
var Header = __webpack_require__(7108);
// EXTERNAL MODULE: ./layouts/components/AdminLayout/AdminUserBlock.jsx + 1 modules
var AdminUserBlock = __webpack_require__(5484);
;// CONCATENATED MODULE: ./layouts/components/AdminLayout/AdminHeader.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
* @param {import("@/package-shared/types").UserType} props.user - Authenticated User
* @param {import("react").ReactNode} [props.extraHeaderContent] - Extra JSX content to be inserted in the header
*/ function AdminHeader({ user , extraHeaderContent }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [activeUser, setActiveUser] = external_react_default().useState(user ? user : null);
external_react_default().useEffect(()=>{
if (user?.logged_in_status) {
setActiveUser(user ? user : null);
}
}, [
user
]);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ jsx_runtime_.jsx("section", {
className: "overflow-visible w-full px-0 md:px-8 py-0 flex justify-center bg-white dark:bg-slate-800 shadow-lg gap-4 dark:shadow-black/10 z-50 shadow-slate-900/5",
style: {
zIndex: 700,
border: "none"
},
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "w-full items-center justify-between gap-4 md:gap-8",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "hidden xl:flex flex-col items-stretch grow fixed xl:static top-0 right-0 px-4 xl:px-0 shadow-xl xl:shadow-none h-screen xl:h-auto overflow-auto xl:overflow-visible w-screen sl:w-auto bg-white xl:bg-transparent pb-10 xl:pb-0",
id: "main-nav-content-wrapper",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "items-center mb-2 flex xl:hidden",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/",
className: "hidden xl:flex",
children: /*#__PURE__*/ jsx_runtime_.jsx("img", {
src: "/images/logo-icon-alt-2.png",
alt: "Logo Icon",
width: 37
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
className: "outlined gray ml-auto",
onClick: (e)=>{
const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
mainNavWrapper?.classList.toggle("hidden");
},
style: {
border: "none"
},
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "font-semibold text-4xl",
children: "✕"
})
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "gap-6",
children: extraHeaderContent
}),
/*#__PURE__*/ jsx_runtime_.jsx(AdminUserBlock/* default */.Z, {
activeUser: activeUser
})
]
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("button", {
className: "bg-transparent w-16 p-4 gap-1.5 flex xl:hidden flex-col hover:bg-transparent transition-all ml-auto",
onClick: (e)=>{
const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
mainNavWrapper?.classList.toggle("hidden");
},
style: {
minWidth: "50px",
backgroundColor: "transparent"
},
id: "main-header-hamburger-button",
"aria-label": "Mobile Hambutget Button",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
})
]
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
// EXTERNAL MODULE: ./functions/frontend/updateNavLinks.js
var updateNavLinks = __webpack_require__(9678);
// EXTERNAL MODULE: ./components/general/DiskUsageComponent.jsx
var DiskUsageComponent = __webpack_require__(6355);
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var fetchApi = __webpack_require__(6729);
;// CONCATENATED MODULE: ./layouts/AdminLayout.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
// import updateNavLinks from '../functions/frontend/updateNavLinks';
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {{
* children: import("react").ReactNode,
* head?: import("react").ReactNode,
* user: import("@/package-shared/types").UserType,
* productionEnvironment?: string,
* extraHeaderContent?: import("react").ReactNode,
* aceEditor?: boolean,
* }} props - children component
*/ function AdminLayout({ children , head , user , productionEnvironment , extraHeaderContent , aceEditor , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ if (!extraHeaderContent) extraHeaderContent = /*#__PURE__*/ jsx_runtime_.jsx(DiskUsageComponent/* default */.Z, {});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ external_react_default().useEffect(()=>{
/** @type {NodeListOf<HTMLAnchorElement>} */ const links = document.querySelectorAll("aside .main-links a");
(0,updateNavLinks/* default */.Z)({
links: links
});
if (document.cookie.match(/user_refresh=1/)) {
(0,fetchApi/* default */.Z)("/api/reAuthenticateUser", {
method: "post",
body: {}
}, true).then((/** @type {import("@/pages/api/reAuthenticateUser").reAuthenticateUserResponse} */ res)=>{
if (res.status && res.user) {
document.cookie = "user_refresh=0;max-age=0";
localStorage.setItem("csrf", res.user.csrf_k);
localStorage.setItem("user", JSON.stringify(res.user));
window.location.reload();
}
});
}
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)((head_default()), {
children: [
head,
/*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("script", {
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",
integrity: "sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",
crossOrigin: "anonymous",
referrerPolicy: "no-referrer"
}),
/*#__PURE__*/ jsx_runtime_.jsx("script", {
src: "https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",
integrity: "sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",
crossOrigin: "anonymous",
referrerPolicy: "no-referrer"
})
]
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "admin w-full flex items-start gap-0",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(Aside, {
user: user
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("main", {
className: "relative",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(AdminHeader, {
user: user,
extraHeaderContent: extraHeaderContent
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "admin-content",
children: children
}),
/*#__PURE__*/ jsx_runtime_.jsx("footer", {
className: "flex justify-center w-full items-center p-4",
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "max-w-6xl w-full justify-center flex-wrap",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "flex items-center gap-2 scale-75",
children: /*#__PURE__*/ jsx_runtime_.jsx(Logo/* default */.Z, {})
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
className: "text-sm text-slate-400 dark:text-slate-600 text-center",
children: [
new Date().getFullYear(),
" \xa9 Datasquirel. All rights reserved."
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/docs",
children: "Docs"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/terms",
children: "Terms"
})
]
})
})
]
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

File diff suppressed because it is too large Load Diff

View File

@ -1,565 +0,0 @@
"use strict";
exports.id = 4941;
exports.ids = [4941];
exports.modules = {
/***/ 9230:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ CopySlug)
/* 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__);
/* harmony import */ var _mui_icons_material_CopyAllTwoTone__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5050);
/* harmony import */ var _mui_icons_material_CopyAllTwoTone__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CopyAllTwoTone__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2423);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_3__);
// @ts-check
/**
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Main Component { Functional }
* ==============================================================================
* @param {{
* slugText: string,
* justIcon?: boolean,
* title?: string,
* outlined?: boolean,
* }} props - React component props including { children }
*/ function CopySlug({ slugText , justIcon , title , outlined }) {
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "button small-text" + (outlined ? " outlined gray bg-white" : " ghost light-gray"),
onClick: (e)=>{
navigator.clipboard.writeText(slugText).then(()=>{
alert(`Copied: "${slugText}"`);
});
},
style: outlined ? undefined : {
padding: 0
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_3__.Copy, {
size: outlined ? 15 : 20
}),
!justIcon && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-slate-500 dark:text-slate-300",
children: title ? title : "Copy Slug"
})
]
});
}
/***/ }),
/***/ 4941:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ ExtraContentDatabase)
/* 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__);
/* harmony import */ var _CopySlug__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9230);
/* harmony import */ var _mui_icons_material_CodeRounded__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3849);
/* harmony import */ var _mui_icons_material_CodeRounded__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_CodeRounded__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _DiskUsageComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6355);
/* harmony import */ var _functions_frontend_downloadApiStream__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7851);
/* harmony import */ var _mui_icons_material_SendToMobileTwoTone__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6500);
/* harmony import */ var _mui_icons_material_SendToMobileTwoTone__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_SendToMobileTwoTone__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _mui_icons_material_SummarizeTwoTone__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7428);
/* harmony import */ var _mui_icons_material_SummarizeTwoTone__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_SummarizeTwoTone__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _mui_icons_material_TipsAndUpdatesTwoTone__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(507);
/* harmony import */ var _mui_icons_material_TipsAndUpdatesTwoTone__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_TipsAndUpdatesTwoTone__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6729);
/* harmony import */ var _LoadingBlock__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5264);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2423);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_9__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
* @param {any} [props.query]
* @param {any} [props.confirmedDelegetedUser]
* @param {import("@/package-shared/types").UserType} props.user
*/ function ExtraContentDatabase({ database , query , confirmedDelegetedUser , user , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const { active_clone , active_clone_parent_db } = database;
const isDelegated = confirmedDelegetedUser?.delegated;
const isTableEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Tables/i);
const isTableDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Tables/i);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [links, setLinks] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(null);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex-wrap justify-center gap-4",
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "dropdown-wrapper gap-4",
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "relative",
children: [
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "w-8 h-8 relative",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: database.db_image,
alt: "Database Image",
width: 20,
className: "w-full h-full rounded-full object-cover"
}),
confirmedDelegetedUser?.delegated && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: " absolute -bottom-2 left-5 gap-1",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: confirmedDelegetedUser.rootUserImage,
alt: "Root User Image",
className: "w-5 h-5 rounded-full object-cover border-2 border-white dark:border-slate-800 border-solid"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-xs",
children: confirmedDelegetedUser.rootUserEmail
})
]
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "font-semibold text-base" + (confirmedDelegetedUser?.delegated ? " -mt-3" : ""),
children: database.db_name
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_9__.ChevronDown, {
size: 20
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "dropdown p-0",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/edit-database`,
className: "button plain-text more-padding normal-weight",
children: "Edit Database"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
!active_clone && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/add-database?duplicate=${database.db_full_name}`,
className: "button plain-text more-padding normal-weight",
children: "Duplicate Database"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/schema`,
className: "button plain-text more-padding normal-weight",
children: "Schema"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/users`,
className: "button plain-text more-padding normal-weight",
children: "Database Users"
}),
!isDelegated && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(NonDelegatedSection, {
database: database,
user: user
})
]
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "vertical"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CopySlug__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
slugText: database.db_slug,
title: `Db Slug`
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "-mt-1 gap-1",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_CopySlug__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
slugText: database.db_full_name,
title: "Full DB Name"
})
}),
!isDelegated && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "vertical"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/shell`,
className: "button ghost small-text",
style: {
height: "30px",
padding: 0
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_9__.SquareTerminal, {
size: 20
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-sm font-semibold",
children: "Shell"
})
]
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "vertical"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_DiskUsageComponent__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ## Buttons for Database Root Owner
* @param {object} props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
* @param {import("@/package-shared/types").UserType} props.user
*/ function NonDelegatedSection({ database , user }) {
const [loading, setLoading] = react__WEBPACK_IMPORTED_MODULE_1___default().useState(false);
/** @type {React.RefObject<HTMLInputElement>} */ // @ts-ignore
const uploadSchemaButtonRef = react__WEBPACK_IMPORTED_MODULE_1___default().useRef();
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {
children: [
loading && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
width: "20px"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/shell`,
className: "button plain-text more-padding normal-weight",
children: "Shell"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
database?.remote_connected == 1 ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(DisconnectButton, {
database: database
}) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: `/admin/${user?.id}/databases/${database.db_slug}/connect`,
className: "button plain-text more-padding normal-weight",
children: "Connect"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("hr", {
className: "m-0"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", {
className: "button plain-text more-padding normal-weight w-full",
onClick: (e)=>{
(0,_functions_frontend_downloadApiStream__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)({
url: `/api/exportDatabase?dbName=${database.db_full_name}`,
fileName: `${database.db_full_name}.sql`
});
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_SendToMobileTwoTone__WEBPACK_IMPORTED_MODULE_5___default()), {
fontSize: "small",
color: "action",
className: "opacity-50"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Export Database"
})
]
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("input", {
type: "file",
name: "upload-update-schema",
id: "",
ref: uploadSchemaButtonRef,
className: "hidden"
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", {
className: "button green outlined more-padding normal-weight w-full rounded-none -mb-[1px]",
onClick: (e)=>{
if (!uploadSchemaButtonRef.current) return;
uploadSchemaButtonRef.current.addEventListener("change", (e)=>{
/**
* @type {HTMLInputElement}
*/ // @ts-ignore
const inputEl = e.target;
const file = inputEl.files?.[0];
if (!file) {
alert("No File Selected");
return;
}
var reader = new FileReader();
reader.onload = function(ev) {
var fileContent = ev.target?.result;
if (!fileContent) {
alert("Invalid File!");
}
try {
const fileContentString = fileContent?.toString();
if (!fileContentString) {
throw new Error("Invalid File!");
}
const schemaObject = JSON.parse(fileContentString);
if (window.confirm("Are you sure you want to use this schema file for the current database?")) {
if (window.confirm("Remember if any existing table doesn't exist in the new schema file that table and all its content will be erased forever. Continue?")) {
setLoading(true);
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)("/api/user-schema/replace-database-schema", {
method: "POST",
body: {
schema: schemaObject,
dbId: database.id
}
}, true).then((res)=>{
if (res.success) {
window.location.reload();
}
}).finally(()=>{
setLoading(false);
});
}
}
} catch (/** @type {any} */ error) {
alert("Invalid File. Please enter a valid JSON file");
}
};
reader.readAsText(file);
// if (window.confirm("Update?")) {
// console.log("Updating");
// }
});
uploadSchemaButtonRef.current?.click();
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_TipsAndUpdatesTwoTone__WEBPACK_IMPORTED_MODULE_7___default()), {
fontSize: "small",
color: "action",
className: "opacity-50 text-inherit"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Update From Schema"
})
]
}),
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("button", {
className: "button secondary outlined more-padding normal-weight w-full rounded-none",
onClick: (e)=>{
(0,_functions_frontend_downloadApiStream__WEBPACK_IMPORTED_MODULE_10__/* ["default"] */ .Z)({
url: `/api/downloadDatabaseSchema?dbName=${database.db_full_name}`,
fileName: `${database.db_full_name}.json`
});
// fetchApi(`/api/downloadDatabaseSchema?dbName=${database.db_full_name}`).then((res)=>{
// console.log(res);
// })
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((_mui_icons_material_SummarizeTwoTone__WEBPACK_IMPORTED_MODULE_6___default()), {
fontSize: "small",
color: "action",
className: "opacity-50 text-inherit"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: "Download Schema"
})
]
})
]
});
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ### Disconnect Remote Db Button
* @param {object} props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
*/ function DisconnectButton({ database }) {
return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "button plain-text more-padding normal-weight w-full",
onClick: (e)=>{
if (!window.confirm("Disconnect this Database from the remote host?")) return;
(0,_functions_frontend_fetchApi__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)(`/api/connect/disconnect`, {
method: "POST",
body: {
dbId: database.id
}
}, true).then((res)=>{
if (res.success) {
window.location.reload();
} else {
console.log(res);
alert(res.msg || "Remote disconnection failed. Please try again.");
}
});
},
children: "Disconnect"
});
}
/***/ }),
/***/ 7851:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ downloadApiStream)
/* harmony export */ });
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Auth user on client side
* ==============================================================================
* @param {{
* url: string,
* fileName: string,
* setLoading?: React.Dispatch<React.SetStateAction<boolean>>,
* }} params - params
*
* @requires search-field name attribute
*/ function downloadApiStream({ url , fileName , setLoading }) {
/**
* Check for user in local storage
*
* @description Preventdefault, declare variables
*/ if (setLoading) setLoading(true);
fetch(url, {
method: "GET",
// @ts-ignore
headers: {
"x-csrf-auth": localStorage.getItem("csrf")
}
}).then((res)=>{
return res.body;
}).then((body)=>{
const reader = body?.getReader();
if (reader) {
return new ReadableStream({
start (controller) {
return pump();
/** @type {() => any} */ function pump() {
return reader?.read().then(({ done , value })=>{
// When no more data needs to be consumed, close the stream
if (done) {
controller.close();
return;
}
// Enqueue the next data chunk into our target stream
controller.enqueue(value);
return pump();
});
}
}
});
}
// console.log(body);
// const blob = new Blob([body.text], { type: "application/pdf" });
// const url = URL.createObjectURL(blob);
// const link = document.createElement("a");
// link.href = blob;
// link.download = `${database.db_full_name}.sql`;
// link.style.display = "none";
// document.body.appendChild(link);
// link.click();
// URL.revokeObjectURL(url);
// document.body.removeChild(link);
// setTimeout(() => {
// setLoading(false);
// }, 1000);
}).then((stream)=>{
return new Response(stream);
}).then((response)=>response.blob()).then((blob)=>URL.createObjectURL(blob)).then((url)=>{
const link = document.createElement("a");
link.href = url;
link.download = fileName;
link.style.display = "none";
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(url);
document.body.removeChild(link);
setTimeout(()=>{
if (setLoading) setLoading(false);
}, 1000);
}).catch((error)=>{
console.log(error);
setTimeout(()=>{
if (setLoading) setLoading(false);
}, 1000);
});
} ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

View File

@ -1,86 +0,0 @@
"use strict";
exports.id = 4986;
exports.ids = [4986];
exports.modules = {
/***/ 4986:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ ActiveCloneDbBanner)
/* 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
* @param {object} props.database
* @param {string} props.database.active_clone_parent_db
* @param {import("@/package-shared/types").UserType} props.user
*/ function ActiveCloneDbBanner({ database , user }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const parentDbSlug = database.active_clone_parent_db?.replace(/datasquirel_user_\d+_/, "");
const targetDbUrl = `/admin/${user?.id}/databases/${parentDbSlug}`;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "info green",
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
className: "text font-normal",
children: [
"This database is an active clone of",
" ",
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: targetDbUrl,
target: "_blank",
className: "query-url",
children: parentDbSlug
})
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,424 +0,0 @@
"use strict";
exports.id = 5114;
exports.ids = [5114];
exports.modules = {
/***/ 5114:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ CreateAccountForm)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var fetchApi = __webpack_require__(6729);
;// CONCATENATED MODULE: ./functions/frontend/submitNewUserForm.js
// @ts-check
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* # Submit New Image Form
* @param {object} param0
* @param {*} param0.e
* @param {React.Dispatch<React.SetStateAction<boolean>>} param0.setLoading
* @param {import("@/package-shared/types").UserType} [param0.user]
* @param {*} [param0.image]
* @param {*} [param0.query]
*/ async function submitNewUserForm({ e , setLoading , user , image , query , }) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
setLoading(true);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
let formBody = {
first_name: e.target["first_name"].value,
last_name: e.target["last_name"].value,
email: user ? null : e.target["email_address"].value,
username: user ? null : e.target["username"].value,
password: user ? null : e.target["password"].value,
image: image ? image : null
};
// @ts-ignore
if (query?.invite) formBody["inviteObject"] = query;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
const apiRoute = user ? "/api/updateUser" : "/api/registerUser";
(0,fetchApi/* default */.Z)(apiRoute, {
method: "post",
body: formBody
}, user ? true : false).then((res)=>{
console.log(res);
if (!user && res?.insertId) {
localStorage.setItem("id", res.insertId);
(0,fetchApi/* default */.Z)("/api/loginUser", {
method: "post",
body: {
email: formBody.email,
password: formBody.password
}
}).then((_res)=>{
console.log(_res);
localStorage.setItem("csrf", _res.user.csrf_k);
localStorage.setItem("stripe_id", _res.user.stripe_id);
localStorage.setItem("user", JSON.stringify(_res.userPayload));
window.location.href = "/admin";
});
} else if (user && res?.user) {
// fetchApi("/api/reauthUser")
window.location.reload();
} else if (res?.msg) {
alert(res.msg);
}
}).catch((err)=>{
console.log(err);
}).finally(()=>{
setTimeout(()=>{
setLoading(false);
}, 2000);
});
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
// EXTERNAL MODULE: ./components/general/FormAlertBlock.jsx
var FormAlertBlock = __webpack_require__(7037);
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
var LoadingBlock = __webpack_require__(5264);
// EXTERNAL MODULE: ./components/pages/login/SocialLogin.jsx + 3 modules
var SocialLogin = __webpack_require__(8374);
;// CONCATENATED MODULE: ./components/pages/create-account/CreateAccountForm.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
/** @type {any} */ let timeout;
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").UserType} [props.user]
* @param {import("@/package-shared/types").CreateAccountQueryType} [props.query]
* @param {any} [props.image]
*/ function CreateAccountForm({ user , query , image }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const defaultEmail = query?.email ? query.email : user?.email ? user.email : "";
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ /** @type {[ alert: string | null, setAlert: React.Dispatch<React.SetStateAction<string | null>> ]} */ // @ts-ignore
const [alert, setAlert] = external_react_default().useState(null);
const [loading, setLoading] = external_react_default().useState(false);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "relative w-full max-w-2xl flex-col items-start",
children: [
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
!user && /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
className: "opacity-0"
}),
/*#__PURE__*/ jsx_runtime_.jsx(SocialLogin/* default */.Z, {
user: null,
userType: "admin",
setLoading: setLoading
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "w-full justify-center relative",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "bg-white dark:bg-slate-800 px-3 relative z-10",
children: "OR"
}),
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
className: "absolute"
})
]
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("form", {
className: "w-full flex flex-col items-start gap-4 relative",
onSubmit: (e)=>{
e.preventDefault();
submitNewUserForm({
e,
setLoading,
user,
image,
query
});
},
children: [
alert && /*#__PURE__*/ jsx_runtime_.jsx(FormAlertBlock/* default */.Z, {
message: alert
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "first_name",
children: "First Name"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
name: "first_name",
id: "first_name",
placeholder: "First Name",
autoComplete: "given-name",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
},
defaultValue: user ? user.first_name : "",
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "last_name",
children: "Last Name"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
name: "last_name",
id: "last_name",
placeholder: "Last Name",
autoComplete: "family-name",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
},
defaultValue: user ? user.last_name : "",
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "username",
children: "Username"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
name: "username",
id: "username",
placeholder: "Username",
autoComplete: "username",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
if (inputEl.value.match(/./)) {
inputEl.classList.remove("warning");
setAlert(null);
} else {
inputEl.classList.add("warning");
}
window.clearTimeout(timeout);
timeout = setTimeout(()=>{
(0,fetchApi/* default */.Z)(`/api/checkDuplicateData?type=username&value=${inputEl.value}&tableName=users`).then((res)=>{
console.log(res);
if (res?.result) {
setAlert("Username Already Exists");
inputEl.classList.add("warning");
} else {
setAlert(null);
inputEl.classList.remove("warning");
}
});
}, 300);
},
defaultValue: user ? user.username : "",
required: user ? false : true,
readOnly: user ? true : false
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "email_address",
children: "Email Address"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "email",
name: "email_address",
id: "email_address",
placeholder: "Email Address",
autoComplete: "email",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
window.clearTimeout(timeout);
timeout = setTimeout(()=>{
(0,fetchApi/* default */.Z)(`/api/checkDuplicateData?type=email&value=${inputEl.value}&tableName=users`).then((res)=>{
console.log(res);
if (res?.result) {
setAlert("Email Already Exists");
inputEl.classList.add("warning");
} else {
setAlert(null);
inputEl.classList.remove("warning");
}
});
}, 300);
},
defaultValue: defaultEmail,
required: true,
readOnly: user ? true : false
})
]
}),
!user && /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "password",
children: "Password"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "password",
name: "password",
id: "password",
placeholder: "Password",
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "flex flex-col items-start gap-0.5 w-full",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("label", {
htmlFor: "confirm_password",
children: "Confirm Password"
}),
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "password",
name: "confirm_password",
id: "confirm_password",
placeholder: "Confirm Password",
onInput: (e)=>{
/** @type {HTMLInputElement} */ // @ts-ignore
const inputEl = e.target;
let passwordInput = inputEl.closest("form")?.["password"].value;
let passwordRepeatInput = inputEl.value;
if (passwordInput === passwordRepeatInput) {
inputEl.classList.remove("warning");
} else {
inputEl.classList.add("warning");
}
},
required: true
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
className: "text-sm",
children: [
'By clicking "Create Account" you agree to our',
" ",
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/terms",
target: "_blank",
className: "font-bold",
children: "Terms and Conditions"
})
]
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
type: "submit",
className: "w-full",
children: user ? /*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Update Account Info"
}) : /*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Create Account"
})
}),
!user && /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
className: "text-sm",
children: [
"Already Have an Account?",
" ",
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/login",
className: "font-bold",
children: "Login"
})
]
})
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,99 +0,0 @@
"use strict";
exports.id = 5116;
exports.ids = [5116];
exports.modules = {
/***/ 5116:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const http = __webpack_require__(3685);
const decrypt = __webpack_require__(5304);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* @typedef {object} grabDelegatedUserFromCookieReturn
* @property {number} dbUserId
* @property {number} [dbUserId]
* @property {number} [rootUserId]
* @property {string} [rootUserName]
* @property {string} [rootUserEmail]
* @property {string} [rootUserImage]
* @property {string} [databaseFullName]
* @property {string} [databaseSlug]
* @property {string[]} [allowedTables]
* @property {string} [priviledges]
* @property {string} [database]
* @property {boolean} [delegated]
*/ /**
* @param {object} params - user id
* @param {import("next").NextApiRequest | http.IncomingMessage & { cookies: Partial<{ [key: string]: string; }>}} params.request - HTTPS request object
* @param {string | string[]} params.databaseSlug - Database name slug
* @param {{ id: number, first_name: string, last_name: string }} params.user
* @param {any} params.query - query params
*
* @returns {Promise<grabDelegatedUserFromCookieReturn | null>} new user auth object payload
*/ module.exports = async function grabDelegatedUserFromCookie({ request , databaseSlug , user , query , }) {
try {
/**
* Fetch user
*
* @description Fetch user from db
*/ let dbUserId = user.id;
let delegatedUserObject = null;
if (!query?.delegated) return {
dbUserId
};
const rootUserId = query.dbUserId;
const dbFullName = `${process.env.DSQL_USER_DB_PREFIX}${rootUserId}_${databaseSlug}`;
const tokenName = `${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${dbFullName}`;
try {
if (!request.cookies?.[tokenName]) throw new Error("Cookie not present");
// @ts-ignore
const decryptedToken = decrypt(request.cookies[tokenName]);
if (!decryptedToken) throw new Error("Invalid Token");
delegatedUserObject = JSON.parse(decryptedToken);
if (delegatedUserObject.databaseSlug === databaseSlug) {
dbUserId = delegatedUserObject.rootUserId;
return {
dbUserId: dbUserId,
rootUserId: delegatedUserObject.rootUserId,
rootUserName: delegatedUserObject.rootUserName,
rootUserEmail: delegatedUserObject.rootUserEmail,
rootUserImage: delegatedUserObject.rootUserImage,
databaseFullName: delegatedUserObject.databaseFullName,
databaseSlug: delegatedUserObject.databaseSlug,
allowedTables: delegatedUserObject.allowedTables,
priviledges: delegatedUserObject.priviledges,
database: delegatedUserObject.databaseSlug,
delegated: true
};
}
} catch (error) {
// serverError({
// component: "grabDelegatedUserFromCookie",
// message: error.message,
// user: user,
// });
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return {
dbUserId
};
} catch (error1) {
return null;
}
}; ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/***/ })
};
;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,63 +0,0 @@
"use strict";
exports.id = 5264;
exports.ids = [5264];
exports.modules = {
/***/ 5264:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ LoadingBlock)
/* 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
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Loading Block Functional Component
* ==============================================================================
* @param {{
* width?: string,
* position?: *,
* style?: import("react").CSSProperties,
* borderWidth?: string,
* screen?: boolean,
* title?: string,
* }} props - React Component Props
*/ function LoadingBlock({ width , position , style , borderWidth , screen , title , }) {
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: " top-0 left-0 w-full h-full flex items-center justify-center gap-4 bg-white/80 dark:bg-slate-800/80 z-50" + (screen ? " fixed" : " absolute"),
style: {
...style,
position: position,
zIndex: 20000
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "general_loader",
style: width ? {
width: width,
height: width,
minWidth: width,
borderWidth: borderWidth ? borderWidth : "4px"
} : {}
}),
title ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
children: title
}) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), {})
]
});
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,516 +0,0 @@
"use strict";
exports.id = 5313;
exports.ids = [5313];
exports.modules = {
/***/ 8282:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ SuAdminLayout)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: external "next/head"
var head_ = __webpack_require__(968);
var head_default = /*#__PURE__*/__webpack_require__.n(head_);
// EXTERNAL MODULE: ./components/general/Logo.jsx
var Logo = __webpack_require__(4017);
// EXTERNAL MODULE: external "@mui/icons-material/CottageTwoTone"
var CottageTwoTone_ = __webpack_require__(386);
var CottageTwoTone_default = /*#__PURE__*/__webpack_require__.n(CottageTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/PeopleAltTwoTone"
var PeopleAltTwoTone_ = __webpack_require__(8245);
var PeopleAltTwoTone_default = /*#__PURE__*/__webpack_require__.n(PeopleAltTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/ErrorTwoTone"
var ErrorTwoTone_ = __webpack_require__(6094);
var ErrorTwoTone_default = /*#__PURE__*/__webpack_require__.n(ErrorTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/BackupTwoTone"
var BackupTwoTone_ = __webpack_require__(9318);
var BackupTwoTone_default = /*#__PURE__*/__webpack_require__.n(BackupTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/DocumentScannerTwoTone"
var DocumentScannerTwoTone_ = __webpack_require__(6817);
// EXTERNAL MODULE: external "@mui/icons-material/TerminalTwoTone"
var TerminalTwoTone_ = __webpack_require__(415);
var TerminalTwoTone_default = /*#__PURE__*/__webpack_require__.n(TerminalTwoTone_);
// EXTERNAL MODULE: external "@mui/icons-material/LockPersonTwoTone"
var LockPersonTwoTone_ = __webpack_require__(6547);
var LockPersonTwoTone_default = /*#__PURE__*/__webpack_require__.n(LockPersonTwoTone_);
;// CONCATENATED MODULE: ./layouts/components/SuAdminLayout/Aside.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/ "use client";
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
*/ function Aside(props) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [collapseAsideMobile, setCollapseAsideMobile] = external_react_default().useState(true);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("aside", {
className: "aside" + (collapseAsideMobile ? " mobile-collapsed" : " mobile-expanded"),
style: {
maxWidth: collapseAsideMobile ? "250px" : "300px",
zIndex: 800
},
children: [
/*#__PURE__*/ jsx_runtime_.jsx(Logo/* default */.Z, {
adminAside: true,
collapseAsideMobile: collapseAsideMobile,
setCollapseAsideMobile: setCollapseAsideMobile
}),
/*#__PURE__*/ jsx_runtime_.jsx("hr", {
className: "opacity-0 mt-4"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "main-links" + (collapseAsideMobile ? " hidden lg:flex" : " "),
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su`,
"data-currentlink": `/su`,
"data-strictlink": "true",
children: [
/*#__PURE__*/ jsx_runtime_.jsx((CottageTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Dashboard"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su/users`,
"data-currentlink": `/su/users`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((PeopleAltTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Users"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su/error-logs`,
"data-currentlink": `/su/error-logs`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((ErrorTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Error Logs"
})
]
}),
false && /*#__PURE__*/ 0,
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su/backups`,
"data-currentlink": `/su/backups`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((BackupTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Backups"
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su/console`,
"data-currentlink": `/su/console`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((TerminalTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Console"
})
]
}),
true && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: `/su/envar`,
"data-currentlink": `/su/envar`,
children: [
/*#__PURE__*/ jsx_runtime_.jsx((LockPersonTwoTone_default()), {
className: "text-slate-400"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: "Env"
})
]
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
// EXTERNAL MODULE: ./components/general/ThemeSelector.jsx
var ThemeSelector = __webpack_require__(4981);
// EXTERNAL MODULE: external "lucide-react"
var external_lucide_react_ = __webpack_require__(2423);
;// CONCATENATED MODULE: ./layouts/components/SuAdminLayout/AdminHeader.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/ "use client";
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
* @param {import("@/package-shared/types").UserType} props.user
* @param {React.ReactNode} [props.extraHeaderContent]
*/ function AdminHeader({ user , extraHeaderContent }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const [activeUser, setActiveUser] = external_react_default().useState(user ? user : null);
external_react_default().useEffect(()=>{
if (user?.logged_in_status) {
setActiveUser(user ? user : null);
}
}, [
user
]);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ jsx_runtime_.jsx("section", {
className: "overflow-visible w-full px-0 md:px-8 py-0 flex justify-center bg-white dark:bg-slate-800 shadow-lg gap-4 dark:shadow-black/10 z-50 shadow-slate-900/5",
style: {
zIndex: 700,
border: "none"
},
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "w-full items-center justify-between gap-4 md:gap-8",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "hidden xl:flex flex-col items-stretch grow fixed xl:static top-0 right-0 px-4 xl:px-0 shadow-xl xl:shadow-none h-screen xl:h-auto overflow-auto xl:overflow-visible w-screen sl:w-auto bg-white xl:bg-transparent pb-10 xl:pb-0",
id: "main-nav-content-wrapper",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "items-center mb-2 flex xl:hidden",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/",
className: "hidden xl:flex",
children: /*#__PURE__*/ jsx_runtime_.jsx("img", {
src: "/images/logo-icon-alt-2.png",
alt: "Logo Icon",
width: 37
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("button", {
className: "outlined gray ml-auto",
onClick: (e)=>{
/** @type {any} */ const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
mainNavWrapper?.classList.toggle("hidden");
},
style: {
border: "none"
},
children: /*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "font-semibold text-4xl",
children: "✕"
})
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",
children: /*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "gap-2 flex-col-reverse xl:flex-row gap-y-6 w-full xl:w-auto py-2",
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "ml-auto dropdown-wrapper",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "bg-white rounded-full overflow-hidden",
style: {
width: "36px",
height: "36px"
},
children: /*#__PURE__*/ jsx_runtime_.jsx("img", {
src: "/images/user-preset-thumbnail.png",
alt: "User Image",
width: 35,
className: "w-full h-full object-cover"
})
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
children: /*#__PURE__*/ jsx_runtime_.jsx("b", {
children: "Super User"
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(external_lucide_react_.ChevronDown, {
size: 20
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "dropdown",
children: /*#__PURE__*/ jsx_runtime_.jsx("a", {
href: `/su/logout`,
children: "Logout"
})
})
]
})
})
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "ml-2",
children: /*#__PURE__*/ jsx_runtime_.jsx(ThemeSelector/* default */.Z, {})
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("button", {
className: "bg-transparent w-16 p-4 gap-1.5 flex xl:hidden flex-col hover:bg-transparent transition-all ml-auto",
onClick: (e)=>{
/** @type {any} */ const mainNavWrapper = document.getElementById("main-nav-content-wrapper");
mainNavWrapper?.classList.toggle("hidden");
},
style: {
minWidth: "50px",
backgroundColor: "transparent"
},
id: "main-header-hamburger-button",
"aria-label": "Mobile Hambutget Button",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"
})
]
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
// EXTERNAL MODULE: ./functions/frontend/updateNavLinks.js
var updateNavLinks = __webpack_require__(9678);
;// CONCATENATED MODULE: ./layouts/SuAdminLayout.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React Props
* @param {React.ReactNode} props.children - children component
* @param {React.ReactNode} [props.head] - head Items
* @param {import("@/package-shared/types").UserType} props.user - user object
*/ function SuAdminLayout({ children , head , user }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ external_react_default().useEffect(()=>{
/** @type { NodeListOf<HTMLAnchorElement> } */ const links = document.querySelectorAll("aside .main-links a");
(0,updateNavLinks/* default */.Z)({
links: links
});
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)((head_default()), {
children: [
/*#__PURE__*/ jsx_runtime_.jsx("link", {
rel: "stylesheet",
href: "/styles/admin.css"
}),
head
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "admin w-full flex items-start gap-0",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(Aside, {}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("main", {
className: "relative",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(AdminHeader, {
user: user
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "flex-col items-start gap-6 px-4 sl:px-8 py-8 bg-slate-50 dark:bg-slate-900",
children: children
}),
/*#__PURE__*/ jsx_runtime_.jsx("footer", {
className: "flex justify-center w-full items-center p-4",
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "max-w-6xl w-full justify-center flex-wrap",
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
href: "/",
className: "flex items-center gap-2",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("img", {
src: "/images/logo-icon-alt-2.png",
alt: "Datasquirel Logo",
width: 30
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "text-lg font-bold",
children: "Datasquirel"
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
className: "text-sm text-slate-400 dark:text-slate-600 text-center",
children: [
new Date().getFullYear(),
" \xa9 Datasquirel. All rights reserved."
]
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/docs",
children: "Docs"
}),
/*#__PURE__*/ jsx_runtime_.jsx("span", {
className: "opacity-25",
children: "|"
}),
/*#__PURE__*/ jsx_runtime_.jsx("a", {
href: "/terms",
children: "Terms"
})
]
})
})
]
})
]
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

View File

@ -1,177 +0,0 @@
"use strict";
exports.id = 5338;
exports.ids = [5338];
exports.modules = {
/***/ 5338:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* Imports: Handle imports
*/
const encrypt = __webpack_require__(7547);
const sanitizeHtml = __webpack_require__(6109);
const sanitizeHtmlOptions = __webpack_require__(9544);
const updateDb = __webpack_require__(5886);
const updateDbEntry = __webpack_require__(5886);
const _ = __webpack_require__(6517);
const DB_HANDLER = __webpack_require__(2224);
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
/**
* Add a db Entry Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {("Master" | "Dsql User")} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} [params.dbFullName] - Database full name
* @param {string} params.tableName - Table name
* @param {any} params.data - Data to add
* @param {import("../../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} [params.duplicateColumnName] - Duplicate column name
* @param {string} [params.duplicateColumnValue] - Duplicate column value
* @param {boolean} [params.update] - Update this row if it exists
* @param {string} [params.encryptionKey] - Update this row if it exists
* @param {string} [params.encryptionSalt] - Update this row if it exists
*
* @returns {Promise<any>}
*/ async function addDbEntry({ dbContext , paradigm , dbFullName , tableName , data , tableSchema , duplicateColumnName , duplicateColumnValue , update , encryptionKey , encryptionSalt , }) {
/**
* Initialize variables
*/ const isMaster = dbContext?.match(/dsql.user/i) ? false : dbFullName && !dbFullName.match(/^datasquirel$/) ? false : true;
/** @type { any } */ const dbHandler = isMaster ? DB_HANDLER : DSQL_USER_DB_HANDLER;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
if (data?.["date_created_timestamp"]) delete data["date_created_timestamp"];
if (data?.["date_updated_timestamp"]) delete data["date_updated_timestamp"];
if (data?.["date_updated"]) delete data["date_updated"];
if (data?.["date_updated_code"]) delete data["date_updated_code"];
if (data?.["date_created"]) delete data["date_created"];
if (data?.["date_created_code"]) delete data["date_created_code"];
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Handle function logic
*/ if (duplicateColumnName && typeof duplicateColumnName === "string") {
const duplicateValue = isMaster ? await dbHandler(`SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`, [
duplicateColumnValue
]) : await dbHandler({
paradigm: "Read Only",
database: dbFullName,
queryString: `SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`,
queryValues: [
duplicateColumnValue
]
});
if (duplicateValue?.[0] && !update) {
return null;
} else if (duplicateValue && duplicateValue[0] && update) {
return await updateDbEntry({
dbContext,
paradigm,
dbFullName,
tableName,
data,
tableSchema,
encryptionKey,
encryptionSalt,
identifierColumnName: duplicateColumnName,
identifierValue: duplicateColumnValue || ""
});
}
}
/**
* Declare variables
*
* @description Declare "results" variable
*/ const dataKeys = Object.keys(data);
let insertKeysArray = [];
let insertValuesArray = [];
for(let i = 0; i < dataKeys.length; i++){
try {
const dataKey = dataKeys[i];
// @ts-ignore
let value = data?.[dataKey];
const targetFieldSchemaArray = tableSchema ? tableSchema?.fields?.filter((field)=>field.fieldName == dataKey) : null;
const targetFieldSchema = targetFieldSchemaArray && targetFieldSchemaArray[0] ? targetFieldSchemaArray[0] : null;
if (value == null || value == undefined) continue;
if (targetFieldSchema?.dataType?.match(/int$/i) && typeof value == "string" && !value?.match(/./)) continue;
if (targetFieldSchema?.encrypted) {
value = encrypt(value, encryptionKey, encryptionSalt);
console.log("DSQL: Encrypted value =>", value);
}
if (targetFieldSchema?.richText) {
value = sanitizeHtml(value, sanitizeHtmlOptions);
}
if (targetFieldSchema?.pattern) {
const pattern = new RegExp(targetFieldSchema.pattern, targetFieldSchema.patternFlags || "");
if (!pattern.test(value)) {
console.log("DSQL: Pattern not matched =>", value);
value = "";
}
}
insertKeysArray.push("`" + dataKey + "`");
if (typeof value === "object") {
value = JSON.stringify(value);
}
if (typeof value == "number") {
insertValuesArray.push(String(value));
} else {
insertValuesArray.push(value);
}
} catch (/** @type {any} */ error) {
console.log("DSQL: Error in parsing data keys =>", error.message);
continue;
}
}
////////////////////////////////////////
if (!data?.["date_created"]) {
insertKeysArray.push("`date_created`");
insertValuesArray.push(Date());
}
if (!data?.["date_created_code"]) {
insertKeysArray.push("`date_created_code`");
insertValuesArray.push(Date.now());
}
////////////////////////////////////////
if (!data?.["date_updated"]) {
insertKeysArray.push("`date_updated`");
insertValuesArray.push(Date());
}
if (!data?.["date_updated_code"]) {
insertKeysArray.push("`date_updated_code`");
insertValuesArray.push(Date.now());
}
////////////////////////////////////////
const query = `INSERT INTO \`${tableName}\` (${insertKeysArray.join(",")}) VALUES (${insertValuesArray.map(()=>"?").join(",")})`;
const queryValuesArray = insertValuesArray;
const newInsert = isMaster ? await dbHandler(query, queryValuesArray) : await dbHandler({
paradigm,
database: dbFullName,
queryString: query,
queryValues: queryValuesArray
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Return statement
*/ return newInsert;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
module.exports = addDbEntry;
/***/ })
};
;

View File

@ -1,105 +0,0 @@
"use strict";
exports.id = 5449;
exports.ids = [5449];
exports.modules = {
/***/ 5449:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ ButtonGroup)
/* 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 {{
* children: React.ReactNode,
* column?: boolean,
* className?: string,
* }} props - React component props including { children }
*/ function ButtonGroup({ children , column , className }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ const btnGroupRef = react__WEBPACK_IMPORTED_MODULE_1___default().useRef();
react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
try {
/** @type {HTMLDivElement & *} */ const buttonGroupWrapper = btnGroupRef.current;
/** @type {any} */ const children = buttonGroupWrapper.childNodes;
const allAvailableBtns = Array.from(children);
if (allAvailableBtns?.length === 1) return;
allAvailableBtns.forEach((btn, index)=>{
let targetElement = btn;
if (targetElement.classList.contains("dropdown-wrapper")) {
const targetClild = Array.from(btn.childNodes).filter((node)=>node?.nodeName?.match(/button/i) || node.classList.contains("button"));
if (targetClild && targetClild[0]) {
targetElement = targetClild[0];
}
}
const targetBorderSide = column ? "borderTop" : "borderLeft";
const targetBorderRadiusStart = column ? "borderBottomRightRadius" : "borderTopRightRadius";
const targetBorderRadiusEnd = column ? "borderBottomLeftRadius" : "borderBottomRightRadius";
const targetBorderOppositeRadiusStart = column ? "borderTopRightRadius" : "borderTopLeftRadius";
const targetBorderOppositeRadiusEnd = column ? "borderTopLeftRadius" : "borderBottomLeftRadius";
if (index < allAvailableBtns.length - 1) {
targetElement.style[targetBorderRadiusStart] = 0;
targetElement.style[targetBorderRadiusEnd] = 0;
}
if (index > 0) {
targetElement.style[targetBorderSide] = "none";
targetElement.style[targetBorderOppositeRadiusStart] = 0;
targetElement.style[targetBorderOppositeRadiusEnd] = 0;
}
});
} catch (/** @type {any} */ error) {
console.log(error.message);
}
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "items-stretch gap-0" + (column ? " flex-col" : " flex-wrap xl:flex-nowrap") + (className ? " " + className : ""),
// @ts-ignore
ref: btnGroupRef,
children: children
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

View File

@ -1,184 +0,0 @@
"use strict";
exports.id = 5472;
exports.ids = [5472];
exports.modules = {
/***/ 5472:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Mw": () => (/* binding */ openPopup),
/* harmony export */ "ZP": () => (/* binding */ GeneralPopup),
/* harmony export */ "j4": () => (/* binding */ closePopup)
/* 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 lucide_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2423);
/* harmony import */ var lucide_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lucide_react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - React component props including { children }
* @param {React.ReactNode} props.children - React children
* @param {string} props.title - Popup title
* @param {Object} [props.data] - data to pass in the "data-data" attribute as JSON
* @param {boolean} [props.fullPage] - If the popup will span the full screen
* @param {string} [props.wrapperClasses] - Popup wrapper additional class names
* @param {() => void} [props.closePopupDispatch] - Function to run when popup is closed
* @param {React.CSSProperties} [props.wrapperStyle] - React styles for the popup wrapper
* @param {boolean} [props.noContainer] - If no container should be provided
*/ function GeneralPopup({ children , title , data , fullPage , wrapperClasses , closePopupDispatch , wrapperStyle , noContainer , }) {
/**
* Get Contexts
*
* @description { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @description Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @description { useState, useEffect, useRef, etc ... }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @description Main Function Return
*/ if (fullPage) {
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "popup-bg overflow-hidden " + (wrapperClasses ? wrapperClasses : ""),
"data-popupid": title ? title : null,
style: wrapperStyle,
children: [
noContainer ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), {
children: children
}) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "relative w-full h-full z-50",
"data-data": data ? JSON.stringify(data) : "",
children: children
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "popup-cancel-button fixed outlined gray",
onClick: (e)=>{
closePopup();
if (closePopupDispatch) closePopupDispatch();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(lucide_react__WEBPACK_IMPORTED_MODULE_1__.X, {
color: "white",
size: 20
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "popup-canceller",
onClick: (e)=>{
closePopup();
closePopupDispatch && closePopupDispatch();
}
})
]
});
}
////////////////////////////////////////
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "popup-bg",
"data-popupid": title ? title : null,
children: [
noContainer ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), {
children: children
}) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "popup-content-container minimal-scrollbars",
"data-data": data ? JSON.stringify(data) : "",
children: [
children,
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "outlined gray popup-cancel-button",
onClick: (e)=>{
closePopup();
closePopupDispatch && closePopupDispatch();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "font-normal",
children: "✖"
})
})
]
}),
noContainer && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
className: "gray popup-cancel-button",
onClick: (e)=>{
closePopup();
closePopupDispatch && closePopupDispatch();
},
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "font-normal",
children: "✖"
})
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "popup-canceller",
onClick: (e)=>{
closePopup();
closePopupDispatch && closePopupDispatch();
}
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Open Popup Function
* ==============================================================================
* @param {string} popupId - popup id
* @param {(popup?: Element) => void} [openPopupDispatch] - Function to run on popup open
*/ function openPopup(popupId, openPopupDispatch) {
let popup = document.querySelector(`[data-popupid='${popupId}']`);
if (popup) {
// @ts-ignore
popup.style.display = "flex";
openPopupDispatch && openPopupDispatch(popup);
}
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Close Popup Function
* ==============================================================================
* @param {() => void} [closePopupDispatch] - Function to run on popup open
*/ function closePopup(closePopupDispatch) {
document.querySelectorAll(`[data-popupid]`).forEach((popup)=>{
// @ts-ignore
popup.style.display = "none";
});
closePopupDispatch && closePopupDispatch();
}
/***/ })
};
;

View File

@ -0,0 +1,13 @@
"use strict";exports.id=5674,exports.ids=[5674],exports.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,s){return s in t?t[s]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,s)):"function"==typeof t&&"default"===s?t:void 0}}})},91479:(e,t,s)=>{s.d(t,{A:()=>n});var r=s(8732);function n({pages:e}){if(!e||!e[0])return null;let t=e?.filter(e=>1==e.level);return(0,r.jsxs)("aside",{className:"w-full lg:w-80 p-10 bg-slate-100 dark:bg-slate-800 sticky top-0 overflow-y-auto max-h-max lg:max-h-screen transition-all",children:[(0,r.jsx)("span",{className:"text-2xl m-0 mb-4 text-left font-semibold",children:"Docs"}),(0,r.jsx)("ul",{className:"pl-4 gap-4 flex flex-col items-start",children:function t(s,n){return s.map((s,a)=>{let l=`${n}/${s.slug}`,o=e.filter(e=>2==e.level&&e.parent_id==s.id);return(0,r.jsxs)("li",{children:[(0,r.jsx)("a",{href:l,className:s?.level==1?"font-semibold":"text-slate-600",children:s.title}),o&&o[0]&&(0,r.jsx)("ul",{className:"pl-4 gap-2 flex flex-col items-start text-sm mt-2",children:t(o,l)})]},a)})}(t,"/docs")})]})}s(82015)},84895:(e,t,s)=>{s.d(t,{A:()=>n});var r=s(8732);function n({title:e,description:t}){return(0,r.jsxs)("section",{className:"py-14",children:[(0,r.jsx)("div",{className:"w-full gap-10 justify-between items-start flex-col lg:flex-row relative z-10",children:(0,r.jsxs)("div",{className:"flex-col items-start max-w-[740px] text-left",style:{minWidth:"45%"},children:[(0,r.jsx)("h1",{className:"m-0 leading-tight",children:e}),(0,r.jsx)("span",{className:"font-normal text-xl -my-4",dangerouslySetInnerHTML:{__html:t}})]})}),(0,r.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"})]})}s(82015)},6845:(e,t,s)=>{s.d(t,{A:()=>n});var r=s(63715);function n({setUser:e}){let t=localStorage.getItem("user");if(t)try{e(JSON.parse(t));return}catch(t){e({});return}(0,r.A)("/api/clientSideAuth",{method:"post",body:{}},!0).then(t=>{let s=t.user?t.user:{};e(s),localStorage.setItem("user",JSON.stringify(s))}).catch(e=>{console.log(e)})}},69436:(e,t,s)=>{let r=s(29021),n=s(22373),a=s(9973),l=s(31976),o=a({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:l()}});e.exports=async function(...e){let t;"production".match(/dev/)&&r.appendFileSync("./.tmp/sqlQuery.sql",e[0]+"\n"+Date()+"\n\n\n","utf8");try{t=await new Promise((t,s)=>{o.query(...e,(e,s,r)=>{e?t({error:e.message}):t(s)})}),await o.end()}catch(e){r.appendFileSync("./.tmp/dbErrorLogs.txt",JSON.stringify(e,null,4)+"\n"+Date()+"\n\n\n","utf8"),t=null,n({component:"dbHandler",message:e.message})}return t?JSON.parse(JSON.stringify(t)):null}},22373:(e,t,s)=>{let r=s(29021);e.exports=async function({user:e,message:t,component:s,noMail:n}){let a=`🚀 SERVER ERROR ===========================
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}
Error Message: ${t}
Component: ${s}
Date: ${Date()}
========================================`;r.existsSync("./.tmp/error.log")||r.writeFileSync("./.tmp/error.log","","utf-8");let l=r.readFileSync("./.tmp/error.log","utf-8");r.writeFileSync("./.tmp/error.log",a),r.appendFileSync("./.tmp/error.log",`
${l}`)}},31976:(e,t,s)=>{let r=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let t=`${e}/ca-cert.pem`;if(!r.existsSync(t)){console.log(`${t} does not exist`);return}return{ca:r.readFileSync(`${e}/ca-cert.pem`)}}},49407:(e,t,s)=>{s.r(t),s.d(t,{default:()=>a});var r=s(8732);s(82015);var n=s(20883);function a(e){return(0,r.jsxs)(n.Html,{lang:"en",children:[(0,r.jsxs)(n.Head,{children:[(0,r.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,r.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),"dev_dev".match(/dev/)&&(0,r.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,r.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,r.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,r.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,r.jsx)("meta",{property:"og:type",content:"website"}),(0,r.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,r.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,r.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,r.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,r.jsxs)("body",{children:[(0,r.jsx)(n.Main,{}),(0,r.jsx)(n.NextScript,{})]})]})}},9455:(e,t)=>{var s;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))}};

View File

@ -1,191 +0,0 @@
"use strict";
exports.id = 5886;
exports.ids = [5886];
exports.modules = {
/***/ 5886:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* Imports: Handle imports
*/
const encrypt = __webpack_require__(7547);
const sanitizeHtml = __webpack_require__(6109);
const sanitizeHtmlOptions = __webpack_require__(9544);
const DB_HANDLER = __webpack_require__(2224);
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
/**
* Update DB Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {("Master" | "Dsql User")} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} [params.dbFullName] - Database full name
* @param {string} params.tableName - Table name
* @param {string} [params.encryptionKey]
* @param {string} [params.encryptionSalt]
* @param {any} params.data - Data to add
* @param {import("../../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} params.identifierColumnName - Update row identifier column name
* @param {string | number} params.identifierValue - Update row identifier column value
*
* @returns {Promise<object|null>}
*/ async function updateDbEntry({ dbContext , paradigm , dbFullName , tableName , data , tableSchema , identifierColumnName , identifierValue , encryptionKey , encryptionSalt , }) {
/**
* Check if data is valid
*/ if (!data || !Object.keys(data).length) return null;
const isMaster = dbContext?.match(/dsql.user/i) ? false : dbFullName && !dbFullName.match(/^datasquirel$/) ? false : true;
/** @type {(a1:any, a2?:any)=> any } */ const dbHandler = isMaster ? DB_HANDLER : DSQL_USER_DB_HANDLER;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Declare variables
*
* @description Declare "results" variable
*/ const dataKeys = Object.keys(data);
let updateKeyValueArray = [];
let updateValues = [];
for(let i = 0; i < dataKeys.length; i++){
try {
const dataKey = dataKeys[i];
// @ts-ignore
let value = data[dataKey];
const targetFieldSchemaArray = tableSchema ? tableSchema?.fields?.filter((field)=>field.fieldName === dataKey) : null;
const targetFieldSchema = targetFieldSchemaArray && targetFieldSchemaArray[0] ? targetFieldSchemaArray[0] : null;
if (value == null || value == undefined) continue;
if (targetFieldSchema?.richText) {
value = sanitizeHtml(value, sanitizeHtmlOptions);
}
if (targetFieldSchema?.encrypted) {
value = encrypt(value, encryptionKey, encryptionSalt);
}
if (typeof value === "object") {
value = JSON.stringify(value);
}
if (targetFieldSchema?.pattern) {
const pattern = new RegExp(targetFieldSchema.pattern, targetFieldSchema.patternFlags || "");
if (!pattern.test(value)) {
console.log("DSQL: Pattern not matched =>", value);
value = "";
}
}
if (typeof value === "string" && value.match(/^null$/i)) {
value = {
toSqlString: function() {
return "NULL";
}
};
}
if (typeof value === "string" && !value.match(/./i)) {
value = {
toSqlString: function() {
return "NULL";
}
};
}
updateKeyValueArray.push(`\`${dataKey}\`=?`);
if (typeof value == "number") {
updateValues.push(String(value));
} else {
updateValues.push(value);
}
////////////////////////////////////////
////////////////////////////////////////
} catch (/** @type {any} */ error) {
////////////////////////////////////////
////////////////////////////////////////
console.log("DSQL: Error in parsing data keys in update function =>", error.message);
continue;
}
}
////////////////////////////////////////
////////////////////////////////////////
updateKeyValueArray.push(`date_updated='${Date()}'`);
updateKeyValueArray.push(`date_updated_code='${Date.now()}'`);
////////////////////////////////////////
////////////////////////////////////////
const query = `UPDATE ${tableName} SET ${updateKeyValueArray.join(",")} WHERE \`${identifierColumnName}\`=?`;
updateValues.push(identifierValue);
const updatedEntry = isMaster ? await dbHandler(query, updateValues) : await dbHandler({
paradigm,
database: dbFullName,
queryString: query,
queryValues: updateValues
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Return statement
*/ return updatedEntry;
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
module.exports = updateDbEntry;
/***/ }),
/***/ 9544:
/***/ ((module) => {
// @ts-check
const sanitizeHtmlOptions = {
allowedTags: [
"b",
"i",
"em",
"strong",
"a",
"p",
"span",
"ul",
"ol",
"li",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"img",
"div",
"button",
"pre",
"code",
"br"
],
allowedAttributes: {
a: [
"href"
],
img: [
"src",
"alt",
"width",
"height",
"class",
"style"
],
"*": [
"style",
"class"
]
}
};
module.exports = sanitizeHtmlOptions;
/***/ })
};
;

View File

@ -1,130 +0,0 @@
"use strict";
exports.id = 5910;
exports.ids = [5910];
exports.modules = {
/***/ 5910:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const sharp = __webpack_require__(7441);
const serverError = __webpack_require__(2163);
const grabPaths = __webpack_require__(6715);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
*
* @param {object} params
* @param {string} params.imageSourceBase64
* @param {string} params.imageName
* @param {any} params.user
* @param {string} [params.mimeType]
* @param {number} [params.thumbnailSize]
* @param {string} [params.folder]
* @param {boolean} [params.isPrivate]
* @returns {Promise<{ urlPath: string, urlThumbnailPath: string, urlRelativePath: string, urlThumbnailRelativePath: string } | undefined | null>}
*/ module.exports = async function fsWriteImageToDiskFromBase64({ imageSourceBase64 , imageName , user , mimeType , thumbnailSize , folder , isPrivate , }) {
try {
const buffer = Buffer.from(imageSourceBase64, "base64");
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
const MAX_SIZE = 1800;
const MAX_SIZE_THUMBNAIL = thumbnailSize ? parseInt(thumbnailSize.toString()) : 400;
// const sharpImage = sharp(imagePath);
const sharpImageRaw = sharp(buffer);
const sharpImageThumbnailRaw = sharp(buffer);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Construct root paths
*/ const grabedPaths = grabPaths({
isPrivate: isPrivate,
user: user,
folder: folder
});
if (!grabedPaths) {
return null;
}
const { fileRootPath , urlRootPath , relativePath } = grabedPaths;
const imageRootPath = fileRootPath;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Main Image
*
* @description Main Image
*/ let imageMetadataRaw = await sharpImageRaw.metadata();
let { width , height , format } = imageMetadataRaw;
/** @type {keyof import("sharp").FormatEnum} */ // @ts-ignore
const finalFormat = mimeType ? mimeType : format;
if (width && height && width > MAX_SIZE) {
let resizeRatio = MAX_SIZE / width;
sharpImageRaw.resize(MAX_SIZE, Math.round(height * resizeRatio), {
fit: "cover"
});
}
sharpImageRaw.toFormat(finalFormat, {
quality: 80
});
////////////////////////////////////////
let newImageMetadataRaw = await sharpImageRaw.metadata();
////////////////////////////////////////
let imageFullName = `${imageName}.${finalFormat}`;
let imagePath = imageRootPath + imageFullName;
const urlPath = urlRootPath + imageFullName;
const urlRelativePath = relativePath + imageFullName;
await sharpImageRaw.toFile(imagePath);
/**
* Thumbnail
*
* @description Thumbnail
*/ if (width && height && width > MAX_SIZE_THUMBNAIL) {
let resizeRatio1 = MAX_SIZE_THUMBNAIL / width;
sharpImageThumbnailRaw.resize(MAX_SIZE_THUMBNAIL, Math.round(height * resizeRatio1), {
fit: "cover"
});
} else if (width && height) {
const LOWER_THUMBNAIL_SIZE = 150;
let resizeRatio2 = LOWER_THUMBNAIL_SIZE / width;
sharpImageThumbnailRaw.resize(LOWER_THUMBNAIL_SIZE, Math.round(height * resizeRatio2), {
fit: "cover"
});
}
sharpImageThumbnailRaw.toFormat(finalFormat, {
quality: 80
});
////////////////////////////////////////
let imageThumbnailFullName = `${imageName}_thumbnail.${finalFormat}`;
let imageThumbnailPath = imageRootPath + imageThumbnailFullName;
const urlThumbnailPath = urlRootPath + imageThumbnailFullName;
const urlThumbnailRelativePath = relativePath + imageThumbnailFullName;
await sharpImageThumbnailRaw.toFile(imageThumbnailPath);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return {
urlPath,
urlThumbnailPath,
urlRelativePath,
urlThumbnailRelativePath
};
// console.log("====================================");
// console.log("Complete!!!");
// console.log("====================================");
} catch (/** @type {any} */ error) {
console.log("Write Image to Disk error =>", error.message);
serverError({
component: "functions/backend/fsWriteImageToDiskFromBase64",
message: error.message
});
return null;
}
}; /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,115 +0,0 @@
"use strict";
exports.id = 6000;
exports.ids = [6000];
exports.modules = {
/***/ 6000:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ DocsAside)
/* 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 {import("@/package-shared/types").DocsAsidePageObject[]} props.pages
*/ function DocsAside({ pages }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ if (!pages || !pages[0]) return null;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const topLevelPages = pages?.filter((page)=>page.level == 1);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ react__WEBPACK_IMPORTED_MODULE_1___default().useEffect(()=>{
////////////////////////////////////////
/** @type {NodeListOf<HTMLAnchorElement>} */ let asideLinks = document.querySelectorAll("aside a");
if (asideLinks && asideLinks[0]) {
asideLinks.forEach((link)=>{
if (link.pathname === window.location.pathname) {
link.classList.add("active");
}
});
}
}, []);
////////////////////////////////////////
/**
* ## Generate List Function
* @param {import("@/package-shared/types").DocsAsidePageObject[]} cPages
* @param {string} baseUrl
* @returns
*/ function generateList(cPages, baseUrl) {
return cPages.map((page, index)=>{
const url = `${baseUrl}/${page.slug}`;
const childrenPages = pages.filter((pg)=>pg.level == 2 && pg.parent_id == page.id);
return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("li", {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("a", {
href: url,
className: page?.level == 1 ? "font-semibold" : "text-slate-600",
children: page.title
}),
childrenPages && childrenPages[0] && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("ul", {
className: "pl-4 gap-2 flex flex-col items-start text-sm mt-2",
children: generateList(childrenPages, url)
})
]
}, index);
});
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("aside", {
className: "w-full lg:w-80 p-10 bg-slate-100 dark:bg-slate-800 sticky top-0 overflow-y-auto max-h-max lg:max-h-screen transition-all",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
className: "text-2xl m-0 mb-4 text-left font-semibold",
children: "Docs"
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("ul", {
className: "pl-4 gap-4 flex flex-col items-start",
children: generateList(topLevelPages, "/docs")
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
/***/ })
};
;

View File

@ -1,184 +0,0 @@
"use strict";
exports.id = 613;
exports.ids = [613];
exports.modules = {
/***/ 613:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
const fs = __webpack_require__(7147);
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
const datasquirel = __webpack_require__(9538);
const serverError = __webpack_require__(2163);
const DB_HANDLER = __webpack_require__(2224);
const addDbEntry = __webpack_require__(5338);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* Add Admin User on Login
* ==============================================================================
*
* @description this function handles admin users that have been invited by another
* admin user. This fires when the invited user has been logged in or a new account
* has been created for the invited user
*
* @param {object} params - parameters object
*
* @param {object} params.query - query object
* @param {number} params.query.invite - Invitation user id
* @param {string} params.query.database_access - String containing authorized databases
* @param {string} params.query.priviledge - String containing databases priviledges
* @param {string} params.query.email - Inviting user email address
*
* @param {import("@/package-shared/types").UserType} params.user - invited user object
*
* @returns {Promise<any>} new user auth object payload
*/ module.exports = async function addAdminUserOnLogin({ query , user }) {
try {
/**
* Fetch user
*
* @description Fetch user from db
*/ // @ts-ignore
const { invite , database_access , priviledge , email } = query;
const lastInviteTimeArray = await DB_HANDLER(`SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?`, [
invite,
email
]);
// if (lastInviteTimeArray && lastInviteTimeArray[0]?.date_created_code) {
// const timeSinceLastInvite = Date.now() - parseInt(lastInviteTimeArray[0].date_created_code);
// if (timeSinceLastInvite > 21600000) {
// throw new Error("Invitation expired");
// }
// } else if (!lastInviteTimeArray || !lastInviteTimeArray[0]) {
// throw new Error("No Invitation Found");
// }
if (!lastInviteTimeArray || !lastInviteTimeArray[0]) {
throw new Error("No Invitation Found");
}
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
// @ts-ignore
const invitingUserDb = await DB_HANDLER(`SELECT first_name,last_name,email FROM users WHERE id=?`, [
invite
]);
if (invitingUserDb?.[0]) {
const existingUserUser = await DB_HANDLER(`SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?`, [
invite,
user.id,
email
]);
if (existingUserUser?.[0]) {
console.log("User already added");
} else {
// const newUserUser = await DB_HANDLER(
// `INSERT IGNORE INTO user_users
// (user_id, invited_user_id, database_access, first_name, last_name, phone, email, username, user_type, user_priviledge)
// VALUES
// (?,?,?,?,?,?,?,?,?,?)
// )`,
// [
// invite,
// user.id,
// database_access,
// user.first_name,
// user.last_name,
// user.phone,
// user.email,
// user.username,
// "admin",
// priviledge,
// ]
// );
addDbEntry({
dbFullName: "datasquirel",
tableName: "user_users",
data: {
user_id: invite,
invited_user_id: user.id,
database_access: database_access,
first_name: user.first_name,
last_name: user.last_name,
phone: user.phone,
email: user.email,
username: user.username,
user_type: "admin",
user_priviledge: priviledge,
image: user.image,
image_thumbnail: user.image_thumbnail
}
});
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
// @ts-ignore
const dbTableData = await DB_HANDLER(`SELECT db_tables_data FROM invitations WHERE inviting_user_id=? AND invited_user_email=?`, [
invite,
email
]);
// @ts-ignore
const clearEntries = await DB_HANDLER(`DELETE FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?`, [
invite,
user.id
]);
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
if (dbTableData && dbTableData[0]) {
const dbTableEntries = dbTableData[0].db_tables_data.split("|");
for(let i = 0; i < dbTableEntries.length; i++){
const dbTableEntry = dbTableEntries[i];
const dbTableEntryArray = dbTableEntry.split("-");
const [db_slug, table_slug] = dbTableEntryArray;
const newEntry = await addDbEntry({
dbFullName: "datasquirel",
tableName: "delegated_user_tables",
data: {
delegated_user_id: user.id,
root_user_id: invite,
database: db_slug,
table: table_slug,
priviledge: priviledge
}
});
}
}
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
}
// @ts-ignore
const inviteAccepted = await DB_HANDLER(`UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?`, [
invite,
email
]);
}
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
} catch (/** @type {any} */ error) {
////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
serverError({
component: "addAdminUserOnLogin",
message: error.message,
user: user
});
}
}; ////////////////////////////////////////////////
////////////////////////////////////////////////
////////////////////////////////////////////////
/***/ })
};
;

View File

@ -1,82 +0,0 @@
"use strict";
exports.id = 6147;
exports.ids = [6147];
exports.modules = {
/***/ 6147:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const DB_HANDLER = __webpack_require__(2224);
const DSQL_USER_DB_HANDLER = __webpack_require__(3403);
/**
* Imports: Handle imports
*/ /**
* Delete DB Entry Function
* ==============================================================================
* @description Description
* @async
*
* @param {object} params - An object containing the function parameters.
* @param {string} [params.dbContext] - What is the database context? "Master"
* or "Dsql User". Defaults to "Master"
* @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"?
* "Read only" or "Full Access"? Defaults to "Read Only"
* @param {string} params.dbFullName - Database full name
* @param {string} params.tableName - Table name
* @param {import("../../../types").DSQL_TableSchemaType} [params.tableSchema] - Table schema
* @param {string} params.identifierColumnName - Update row identifier column name
* @param {string|number} params.identifierValue - Update row identifier column value
*
* @returns {Promise<object|null>}
*/ async function deleteDbEntry({ dbContext , paradigm , dbFullName , tableName , identifierColumnName , identifierValue , }) {
try {
/**
* Check if data is valid
*/ const isMaster = dbContext?.match(/dsql.user/i) ? false : dbFullName && !dbFullName.match(/^datasquirel$/) ? false : true;
/** @type { (a1:any, a2?:any) => any } */ const dbHandler = isMaster ? DB_HANDLER : DSQL_USER_DB_HANDLER;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Execution
*
* @description
*/ const query = `DELETE FROM ${tableName} WHERE \`${identifierColumnName}\`=?`;
const deletedEntry = isMaster ? await dbHandler(query, [
identifierValue
]) : await dbHandler({
paradigm,
queryString: query,
database: dbFullName,
queryValues: [
identifierValue
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Return statement
*/ return deletedEntry;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error) {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
return null;
}
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
module.exports = deleteDbEntry;
/***/ })
};
;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,163 +0,0 @@
"use strict";
exports.id = 6217;
exports.ids = [6217];
exports.modules = {
/***/ 6217:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"Z": () => (/* binding */ GeneralLayout)
});
// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: external "next/head"
var head_ = __webpack_require__(968);
var head_default = /*#__PURE__*/__webpack_require__.n(head_);
// EXTERNAL MODULE: ./functions/frontend/updateNavLinks.js
var updateNavLinks = __webpack_require__(9678);
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Header.jsx
var Header = __webpack_require__(7108);
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/Footer.jsx
var Footer = __webpack_require__(5281);
;// CONCATENATED MODULE: ./layouts/components/GeneralLayout/ProductionHeadComponent.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React component props
* @param {*} props.head
* @param {*} props.productionEnvironment
*/ function ProductionHeadComponent(props) {
/**
* 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__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
// EXTERNAL MODULE: ./layouts/components/GeneralLayout/ScrollToTopButton.jsx
var ScrollToTopButton = __webpack_require__(9360);
;// CONCATENATED MODULE: ./layouts/GeneralLayout.jsx
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {object} props - React Component Props
* @param {React.ReactNode} props.children - children component
* @param {React.ReactNode} props.head - head Items
* @param {import("@/package-shared/types").UserType | null} [props.user] - user object
* @param {*} [props.productionEnvironment]
* @param {boolean} [props.darkBgHeader]
* @param {boolean} [props.transparentHeader]
*/ function GeneralLayout({ children , head , user , productionEnvironment , darkBgHeader , transparentHeader , }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ external_react_default().useEffect(()=>{
(0,updateNavLinks/* default */.Z)({});
}, []);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx((head_default()), {
children: head
}),
/*#__PURE__*/ jsx_runtime_.jsx(ProductionHeadComponent, {
head: head,
productionEnvironment: productionEnvironment
}),
/*#__PURE__*/ jsx_runtime_.jsx(Header/* default */.Z, {
user: user,
darkBg: darkBgHeader,
transparent: transparentHeader
}),
children,
/*#__PURE__*/ jsx_runtime_.jsx(Footer/* default */.Z, {}),
/*#__PURE__*/ jsx_runtime_.jsx(ScrollToTopButton/* default */.Z, {})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

File diff suppressed because it is too large Load Diff

View File

@ -1,90 +0,0 @@
"use strict";
exports.id = 6478;
exports.ids = [6478];
exports.modules = {
/***/ 6478:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ LoadingScreen)
/* 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__);
/* harmony import */ var _mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6843);
/* harmony import */ var _mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_mui_icons_material_ContentCopy__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9174);
/* harmony import */ var _mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_mui_material_Snackbar__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _LoadingBlock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5264);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
*/ function LoadingScreen() {
/**
* 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__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100",
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
className: "flex flex-col items-center justify-center gap-4 px-6 py-20 bg-white rounded shadow-sm max-w-2xl w-full",
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
src: "/images/logo-icon-alt-2.webp",
alt: "Datasquirel Logo",
width: 60
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
className: "w-10 h-10 flex flex-col items-center justify-center",
children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_LoadingBlock__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
width: "25px",
position: "relative"
})
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;

View File

@ -1,67 +0,0 @@
"use strict";
exports.id = 6715;
exports.ids = [6715];
exports.modules = {
/***/ 6715:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// @ts-check
const fs = __webpack_require__(7147);
const path = __webpack_require__(1017);
/**
* Imports: Handle imports
*/ /**
* Grab Paths Function
* ==============================================================================
* @description Description
*
* @param {object} params - An object containing the function parameters.
* @param {boolean} [params.isPrivate] - Is this file private or not?
* @param {any} params.user - User object
* @param {string} [params.folder] - Folder, if available
* @param {boolean} [params.video] - Video, if available
* @param {boolean} [params.pathOnly] - Just generate the directories' paths
*
* @returns {{ fileRootPath: string, urlRootPath: string, relativePath: string } | null}
*/ module.exports = function grabPaths({ isPrivate , user , folder , video , pathOnly , }) {
/**
* Initialize variables
*/ const isProduction = "production".match(/production/);
const userId = user?.id || user?.user_id;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Handle function logic
*/ const STATIC_ROOT = process.env.DSQL_STATIC_SERVER_DIR;
if (!STATIC_ROOT) {
console.log("Static File ENV not Found!");
return null;
}
const relativePath = isPrivate ? `@/${video ? "videos" : "media"}/${folder ? folder + "/" : ""}` : video ? `/videos/user-videos/user-${userId}/${folder ? folder + "/" : ""}` : `/images/user-images/user-${userId}/${folder ? folder + "/" : ""}`;
const fileRootPath = isPrivate ? `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/media/${folder ? folder + "/" : ""}` : path.join(STATIC_ROOT, relativePath);
if (!fs.existsSync(fileRootPath) && !pathOnly) {
fs.mkdirSync(fileRootPath, {
recursive: true
});
}
const urlRootPath = isPrivate ? `@/media/${folder ? folder + "/" : ""}` : `${process.env.DSQL_STATIC_HOST}${relativePath}`;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Return statement
*/ return {
fileRootPath: fileRootPath,
urlRootPath: urlRootPath,
relativePath
};
};
/***/ })
};
;

View File

@ -1,82 +0,0 @@
"use strict";
exports.id = 6718;
exports.ids = [6718];
exports.modules = {
/***/ 6718:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Z": () => (/* binding */ imageInputFileToBase64)
/* harmony export */ });
// @ts-check
/**
* Upload Image function
* ------------------------------------------------------------------------------
* @param {object} params
* @param {File} params.imageInputFile image input file
* @param {number} [params.maxWidth] optional maximum width
* @requires Image {imagePreviewNode} - optional image dispatch node
* @return object containing image data in base 64 and image name
*/ async function imageInputFileToBase64({ imageInputFile , maxWidth , }) {
/**
* Initialize
* ------------------------------------------------------------------------------
*/ /** ********************* Variables */ let imagePreviewNode = document.querySelector(`[data-imagepreview='image']`);
let imageName = imageInputFile.name.replace(/\..*/, "");
let imageDataBase64;
let imageSize;
let canvas = document.createElement("canvas");
const MIME_TYPE = imageInputFile.type;
const QUALITY = 0.95;
const MAX_WIDTH = maxWidth ? maxWidth : null;
const MAX_HEIGHT = null;
const file = imageInputFile; // get the file
const blobURL = URL.createObjectURL(file);
const img = new Image();
/** ********************* Add source to new image */ img.src = blobURL;
imageDataBase64 = await new Promise((res, rej)=>{
/** ********************* Handle Errors in loading image */ img.onerror = function() {
URL.revokeObjectURL(this.src);
console.log("Cannot load image");
};
/** ********************* Handle new image when loaded */ img.onload = function() {
// @ts-ignore
URL.revokeObjectURL(this.src);
if (MAX_WIDTH) {
const scaleSize = MAX_WIDTH / img.naturalWidth;
canvas.width = img.naturalWidth < MAX_WIDTH ? img.naturalWidth : MAX_WIDTH;
canvas.height = img.naturalWidth < MAX_WIDTH ? img.naturalHeight : img.naturalHeight * scaleSize;
} else {
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
}
const ctx = canvas.getContext("2d");
ctx?.drawImage(img, 0, 0, canvas.width, canvas.height);
const srcEncoded = canvas.toDataURL(MIME_TYPE, QUALITY);
if (imagePreviewNode) {
document.querySelectorAll(`[data-imagepreview='image']`).forEach((/** @type {any} */ img)=>{
img.src = srcEncoded;
});
}
res(srcEncoded);
};
});
imageSize = await new Promise((res, rej)=>{
canvas.toBlob((blob)=>{
res(blob?.size);
}, MIME_TYPE, QUALITY);
});
return {
imageBase64: imageDataBase64.replace(/.*?base64,/, ""),
imageBase64Full: imageDataBase64,
imageName: imageName,
imageSize: imageSize
};
}
/***/ })
};
;

Some files were not shown because too many files have changed in this diff Show More