First Commit
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,300 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 2888;
|
||||
exports.ids = [2888];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 7218:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"default": () => (/* binding */ DataSquirel)
|
||||
});
|
||||
|
||||
// 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: ./node_modules/next/script.js
|
||||
var script = __webpack_require__(4298);
|
||||
var script_default = /*#__PURE__*/__webpack_require__.n(script);
|
||||
// EXTERNAL MODULE: external "next/head"
|
||||
var head_ = __webpack_require__(968);
|
||||
var head_default = /*#__PURE__*/__webpack_require__.n(head_);
|
||||
// EXTERNAL MODULE: external "@mui/material/styles"
|
||||
var styles_ = __webpack_require__(8442);
|
||||
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
||||
var fetchApi = __webpack_require__(6729);
|
||||
// EXTERNAL MODULE: ./layouts/GeneralLayout.jsx + 1 modules
|
||||
var GeneralLayout = __webpack_require__(6217);
|
||||
// EXTERNAL MODULE: ./components/general/PageHeadTags.jsx
|
||||
var PageHeadTags = __webpack_require__(4097);
|
||||
;// CONCATENATED MODULE: ./components/ErrorBoundary.jsx
|
||||
// @ts-check
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ErrorBoundary extends (external_react_default()).Component {
|
||||
constructor(/** @type {any} */ props){
|
||||
super(props);
|
||||
// Define a state variable to track whether is an error or not
|
||||
this.state = {
|
||||
hasError: false
|
||||
};
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ const pageTitle = "Error | Datasquirel";
|
||||
const pageDescription = "Datasquirel is a fast and efficient cloud-based SQL data management system that takes away the entire hassle of dealing with data both locally and across different platforms.";
|
||||
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("title", {
|
||||
children: pageTitle
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
||||
name: "description",
|
||||
content: pageDescription
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(PageHeadTags/* default */.Z, {
|
||||
pageTitle: pageTitle,
|
||||
pageDescription: pageDescription,
|
||||
pagePathname: "/"
|
||||
})
|
||||
]
|
||||
});
|
||||
// @ts-ignore
|
||||
this.state.head = head;
|
||||
}
|
||||
static getDerivedStateFromError() {
|
||||
return {
|
||||
hasError: true
|
||||
};
|
||||
}
|
||||
componentDidCatch(/** @type {any} */ error, /** @type {any} */ errorInfo) {
|
||||
(0,fetchApi/* default */.Z)("/api/admin/clientError", {
|
||||
method: "post",
|
||||
body: {
|
||||
component: "ErrorBoundary-class-component",
|
||||
message: error.message + " ==== Error Info => " + errorInfo,
|
||||
user: {}
|
||||
}
|
||||
});
|
||||
}
|
||||
render() {
|
||||
// Check if the error is thrown
|
||||
if (this.state.hasError) {
|
||||
// You can render any custom fallback UI
|
||||
return /*#__PURE__*/ jsx_runtime_.jsx(GeneralLayout/* default */.Z, {
|
||||
// @ts-ignore
|
||||
head: this.state.head,
|
||||
user: null,
|
||||
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "paper items-center px-20",
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("h2", {
|
||||
className: "text-base text-slate-400 m-0",
|
||||
children: "Application Error!"
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("h1", {
|
||||
className: "text-2xl m-0 mb-4",
|
||||
children: "Please try again!"
|
||||
}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("a", {
|
||||
href: "/",
|
||||
className: "button outlined",
|
||||
children: "Home"
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("button", {
|
||||
onClick: (e)=>{
|
||||
window.history.back();
|
||||
},
|
||||
children: "Go Back"
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
}
|
||||
// Return children components in case of no error
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
/* harmony default export */ const components_ErrorBoundary = (ErrorBoundary);
|
||||
|
||||
;// CONCATENATED MODULE: ./functions/theme.js
|
||||
// @ts-check
|
||||
|
||||
const theme = (0,styles_.createTheme)({
|
||||
typography: {
|
||||
fontFamily: "inherit",
|
||||
fontSize: 14
|
||||
},
|
||||
palette: {
|
||||
primary: {
|
||||
main: "#00948a"
|
||||
},
|
||||
secondary: {
|
||||
main: "#107ab8"
|
||||
},
|
||||
light: {
|
||||
main: "#c48ff0"
|
||||
},
|
||||
white: {
|
||||
main: "#ffffff"
|
||||
},
|
||||
grey: {
|
||||
// @ts-ignore
|
||||
main: "#64748b"
|
||||
},
|
||||
gray: {
|
||||
main: "#64748b"
|
||||
},
|
||||
dark: {
|
||||
main: "#1e293b"
|
||||
}
|
||||
}
|
||||
});
|
||||
/* harmony default export */ const functions_theme = (theme);
|
||||
|
||||
;// CONCATENATED MODULE: ./pages/_app.js
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
// import "../styles/main.css";
|
||||
|
||||
|
||||
|
||||
|
||||
// require()();
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* App Component
|
||||
* ==============================================================================
|
||||
* @param {import("next/app").AppProps} props
|
||||
*/ function DataSquirel({ Component , pageProps }) {
|
||||
/**
|
||||
* React Hooks
|
||||
*
|
||||
* @description { useState, useEffect, useRef, etc ... }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @description Main Function Return
|
||||
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx((head_default()), {
|
||||
children: /*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
||||
name: "viewport",
|
||||
content: "width=device-width, initial-scale=1"
|
||||
})
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(components_ErrorBoundary, {
|
||||
children: /*#__PURE__*/ jsx_runtime_.jsx(styles_.ThemeProvider, {
|
||||
theme: functions_theme,
|
||||
children: /*#__PURE__*/ jsx_runtime_.jsx(Component, {
|
||||
...pageProps
|
||||
})
|
||||
})
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx((script_default()), {
|
||||
src: "/scripts/main.js",
|
||||
strategy: "afterInteractive"
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8442:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/material/styles");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2796:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/shared/lib/head-manager-context.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4298,4017,8313,5264,6729,5449,913,9360,6217,4097], () => (__webpack_exec__(7218)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,229 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 660;
|
||||
exports.ids = [660];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4065:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ Document)
|
||||
/* 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 next_document__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6859);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
*/ function Document(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__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(next_document__WEBPACK_IMPORTED_MODULE_2__.Html, {
|
||||
lang: "en",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(next_document__WEBPACK_IMPORTED_MODULE_2__.Head, {
|
||||
children: [
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "author",
|
||||
content: "Datasquirel"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "Copyright",
|
||||
content: `Copyright (c) ${new Date().getFullYear()} Datasquirel`
|
||||
}),
|
||||
"dev_dev"?.match(/dev/) && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "robots",
|
||||
content: "noindex,nofollow"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "preconnect",
|
||||
href: "https://fonts.googleapis.com/",
|
||||
crossOrigin: "anonymous"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "preconnect",
|
||||
href: "https://fonts.gstatic.com",
|
||||
crossOrigin: "anonymous"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "stylesheet",
|
||||
href: "https://fonts.googleapis.com/css?family=Poppins"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "stylesheet",
|
||||
href: "https://fonts.googleapis.com/css?family=Inter"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "stylesheet",
|
||||
href: "https://fonts.googleapis.com/css?family=IBM+Plex+Mono"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("script", {
|
||||
src: "/scripts/themeSelector.js"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
httpEquiv: "Content-Type",
|
||||
content: "text/html; charset=UTF-8"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
property: "og:site_name",
|
||||
content: "DATASQUIREL"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
property: "og:type",
|
||||
content: "website"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "twitter:card",
|
||||
content: "summary"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
property: "og:image",
|
||||
content: "https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
itemProp: "image",
|
||||
content: "https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "twitter:image",
|
||||
content: "https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
|
||||
rel: "stylesheet",
|
||||
href: "/styles/prism.css"
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("script", {
|
||||
src: "/scripts/prism.js",
|
||||
async: true
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("script", {
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: "var DSQL = {}"
|
||||
}
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("body", {
|
||||
children: [
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(next_document__WEBPACK_IMPORTED_MODULE_2__.Main, {}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(next_document__WEBPACK_IMPORTED_MODULE_2__.NextScript, {})
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4140:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/server/get-page-files.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9716:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/server/htmlescape.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6368:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/server/utils.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6724:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/shared/lib/constants.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8743:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/shared/lib/html-context.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8524:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/shared/lib/is-plain-object.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [6859], () => (__webpack_exec__(4065)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
{"version":1,"files":["../webpack-runtime.js","../chunks/6859.js","../../package.json","../../../node_modules/next/package.json","../../../node_modules/react/package.json","../../../node_modules/react/index.js","../../../node_modules/react/jsx-runtime.js","../../../node_modules/next/dist/shared/lib/constants.js","../../../node_modules/next/dist/shared/lib/html-context.js","../../../node_modules/next/dist/shared/lib/is-plain-object.js","../../../node_modules/next/dist/server/get-page-files.js","../../../node_modules/next/dist/server/utils.js","../../../node_modules/next/dist/server/htmlescape.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/next/dist/shared/lib/utils.js","../../../node_modules/next/dist/shared/lib/page-path/denormalize-page-path.js","../../../node_modules/next/dist/shared/lib/page-path/normalize-page-path.js","../../../node_modules/@swc/helpers/package.json","../../../node_modules/next/dist/shared/lib/page-path/ensure-leading-slash.js","../../../node_modules/next/dist/shared/lib/page-path/normalize-path-sep.js","../../../node_modules/@swc/helpers/lib/_async_to_generator.js","../../../node_modules/next/dist/shared/lib/router/utils/index.js","../../../node_modules/next/dist/shared/lib/router/utils/sorted-routes.js","../../../node_modules/next/dist/shared/lib/router/utils/is-dynamic.js","../../../package.json"]}
|
||||
@@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 4820;
|
||||
exports.ids = [4820];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2648:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
var __webpack_unused_export__;
|
||||
|
||||
__webpack_unused_export__ = ({
|
||||
value: true
|
||||
});
|
||||
exports.Z = _interopRequireDefault;
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9185:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({
|
||||
value: true
|
||||
}));
|
||||
exports["default"] = void 0;
|
||||
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
||||
var _react = _interop_require_default(__webpack_require__(6689));
|
||||
var _head = _interop_require_default(__webpack_require__(4957));
|
||||
const statusCodes = {
|
||||
400: "Bad Request",
|
||||
404: "This page could not be found",
|
||||
405: "Method Not Allowed",
|
||||
500: "Internal Server Error"
|
||||
};
|
||||
function _getInitialProps({ res , err }) {
|
||||
const statusCode = res && res.statusCode ? res.statusCode : err ? err.statusCode : 404;
|
||||
return {
|
||||
statusCode
|
||||
};
|
||||
}
|
||||
const styles = {
|
||||
error: {
|
||||
fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif',
|
||||
height: "100vh",
|
||||
textAlign: "center",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
},
|
||||
desc: {
|
||||
display: "inline-block",
|
||||
textAlign: "left",
|
||||
lineHeight: "49px",
|
||||
height: "49px",
|
||||
verticalAlign: "middle"
|
||||
},
|
||||
h1: {
|
||||
display: "inline-block",
|
||||
margin: 0,
|
||||
marginRight: "20px",
|
||||
padding: "0 23px 0 0",
|
||||
fontSize: "24px",
|
||||
fontWeight: 500,
|
||||
verticalAlign: "top",
|
||||
lineHeight: "49px"
|
||||
},
|
||||
h2: {
|
||||
fontSize: "14px",
|
||||
fontWeight: "normal",
|
||||
lineHeight: "49px",
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}
|
||||
};
|
||||
var _Component;
|
||||
class Error extends (_Component = _react.default.Component) {
|
||||
render() {
|
||||
const { statusCode , withDarkMode =true } = this.props;
|
||||
const title = this.props.title || statusCodes[statusCode] || "An unexpected error has occurred";
|
||||
return /*#__PURE__*/ _react.default.createElement("div", {
|
||||
style: styles.error
|
||||
}, /*#__PURE__*/ _react.default.createElement(_head.default, null, /*#__PURE__*/ _react.default.createElement("title", null, statusCode ? `${statusCode}: ${title}` : "Application error: a client-side exception has occurred")), /*#__PURE__*/ _react.default.createElement("div", null, /*#__PURE__*/ _react.default.createElement("style", {
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: `
|
||||
body { margin: 0; color: #000; background: #fff; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
${withDarkMode ? `@media (prefers-color-scheme: dark) {
|
||||
body { color: #fff; background: #000; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(255, 255, 255, .3);
|
||||
}
|
||||
}` : ""}`
|
||||
}
|
||||
}), statusCode ? /*#__PURE__*/ _react.default.createElement("h1", {
|
||||
className: "next-error-h1",
|
||||
style: styles.h1
|
||||
}, statusCode) : null, /*#__PURE__*/ _react.default.createElement("div", {
|
||||
style: styles.desc
|
||||
}, /*#__PURE__*/ _react.default.createElement("h2", {
|
||||
style: styles.h2
|
||||
}, this.props.title || statusCode ? title : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, "Application error: a client-side exception has occurred (see the browser console for more information)"), "."))));
|
||||
}
|
||||
}
|
||||
Error.displayName = "ErrorPage";
|
||||
Error.getInitialProps = _getInitialProps;
|
||||
Error.origGetInitialProps = _getInitialProps;
|
||||
exports["default"] = Error; //# sourceMappingURL=_error.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4957:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/dist/shared/lib/head.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = (__webpack_exec__(9185));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
{"version":1,"files":["../webpack-runtime.js","../../package.json","../../../node_modules/next/package.json","../../../node_modules/react/package.json","../../../node_modules/react/index.js","../../../node_modules/next/dist/shared/lib/head.js","../../../node_modules/next/dist/shared/lib/head-manager-context.js","../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/cjs/react.development.js","../../../node_modules/next/dist/shared/lib/side-effect.js","../../../node_modules/next/dist/shared/lib/amp-context.js","../../../node_modules/next/dist/shared/lib/amp-mode.js","../../../node_modules/next/dist/shared/lib/utils.js","../../../node_modules/@swc/helpers/lib/_extends.js","../../../node_modules/@swc/helpers/package.json","../../../node_modules/@swc/helpers/lib/_interop_require_default.js","../../../node_modules/@swc/helpers/lib/_interop_require_wildcard.js","../../../node_modules/@swc/helpers/lib/_async_to_generator.js","../../../package.json"]}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,346 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 6964;
|
||||
exports.ids = [6964,133,4135];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 1174:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "DashboardContext": () => (/* binding */ DashboardContext),
|
||||
/* harmony export */ "default": () => (/* binding */ Dashboard),
|
||||
/* harmony export */ "getServerSideProps": () => (/* binding */ getServerSideProps)
|
||||
/* 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 _layouts_AdminLayout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4858);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(370);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _components_admin_dashboard_DashboardContent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8124);
|
||||
/* harmony import */ var _components_admin_databases_DeleteDatabaseConfirmationPopup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5012);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** @type {import("@/package-shared/types").DashboardContextType} */ let DashboardContextObject = {};
|
||||
const DashboardContext = /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createContext(DashboardContextObject);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {import("@/package-shared/types").UserType} props.user - Server props
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type[]} props.databases - Server props
|
||||
* @param {import("@/package-shared/types").MetricsType} props.metrics - Server props
|
||||
*/ function Dashboard({ user , databases , metrics }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
*
|
||||
* @abstract { React.useContext }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ const pageTitle = "User Dashboard | Datasquirel";
|
||||
const pageDescription = "Welcome to your data app";
|
||||
let head = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("title", {
|
||||
children: pageTitle
|
||||
}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
|
||||
name: "description",
|
||||
content: pageDescription
|
||||
})
|
||||
]
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* React Hooks
|
||||
*
|
||||
* @abstract { useState, useEffect, useRef, etc ... }
|
||||
*/ /** @type {*} */ const targetDbState = react__WEBPACK_IMPORTED_MODULE_1___default().useState(null);
|
||||
/** @type { [ targetDatabase: import("@/package-shared/types").DSQL_MYSQL_user_databases_Type | undefined, setTargetDatabase: React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_MYSQL_user_databases_Type>> ] } */ const [targetDatabase, setTargetDatabase] = targetDbState;
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @abstract Main Function Return
|
||||
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_layouts_AdminLayout__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
|
||||
head: head,
|
||||
user: user,
|
||||
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(DashboardContext.Provider, {
|
||||
value: {
|
||||
user,
|
||||
databases,
|
||||
targetDatabase,
|
||||
setTargetDatabase,
|
||||
metrics
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_admin_dashboard_DashboardContent__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {}),
|
||||
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_admin_databases_DeleteDatabaseConfirmationPopup__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
|
||||
targetDatabase: targetDatabase
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Server Side Props or Static Props
|
||||
* ==============================================================================
|
||||
* @type {import("next").GetServerSideProps}
|
||||
*/ async function getServerSideProps({ req , res , query }) {
|
||||
/**
|
||||
* User Auth
|
||||
*
|
||||
* @description User Auth
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3___default()(req, res);
|
||||
if (!user?.logged_in_status) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/login",
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/admin/${user.id}`,
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5050:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CopyAllTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7039:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DeleteForeverTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 930:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DifferenceTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8193:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4063:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/StorageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,7946,1500,75,9282,7926], () => (__webpack_exec__(1174)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,207 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 4135;
|
||||
exports.ids = [4135,133];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5050:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CopyAllTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7039:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DeleteForeverTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 930:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DifferenceTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8193:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4063:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/StorageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,7946,1500,75,9282,7926], () => (__webpack_exec__(1457)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,207 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 133;
|
||||
exports.ids = [133,4135];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5050:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CopyAllTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7039:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DeleteForeverTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 930:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DifferenceTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8193:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4063:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/StorageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,7946,1500,75,9282], () => (__webpack_exec__(2109)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+636
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+2458
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+1138
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+326
@@ -0,0 +1,326 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 372;
|
||||
exports.ids = [372,8105,133,4135];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2587:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@monaco-editor/react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3257:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1522:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/BackupTableTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3849:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CodeRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5050:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CopyAllTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7039:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DeleteForeverTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 930:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DifferenceTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8193:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9438:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LibraryAddTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 399:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5453:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MoreHoriz");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6500:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SendToMobileTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4063:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/StorageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7428:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SummarizeTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3851:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/TableViewTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 507:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/TipsAndUpdatesTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5692:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/material");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6451:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@tinymce/tinymce-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2329:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("html-prettify");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7849:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react-dom/client");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7076:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react-tiny-popover");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../../../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,1781,9360,4941,7023,7901,4114,8682,2317,1206,5116,8345,4986,9594,8264,9471,464,9788,9035], () => (__webpack_exec__(7722)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
+1
File diff suppressed because one or more lines are too long
+938
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+932
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+1176
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+1310
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,214 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 8105;
|
||||
exports.ids = [8105];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3257:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3849:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CodeRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5050:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CopyAllTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6500:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SendToMobileTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7428:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SummarizeTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 507:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/TipsAndUpdatesTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,1781,4941,7023,8682,1206,5116,6718,2733,7531], () => (__webpack_exec__(7531)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
+1
File diff suppressed because one or more lines are too long
+502
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+742
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+639
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,207 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 3316;
|
||||
exports.ids = [3316];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3257:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4173:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/Close");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6405:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react-dom");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7849:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react-dom/client");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,1781,7023,7901,6718,9594,9471,9486,7037,9967,4105,3974], () => (__webpack_exec__(6706)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,498 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 1383;
|
||||
exports.ids = [1383];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 7650:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"SingleDatabaseUsersContext": () => (/* binding */ SingleDatabaseUsersContext),
|
||||
"default": () => (/* binding */ DatabaseUsersPage),
|
||||
"getServerSideProps": () => (/* binding */ getServerSideProps)
|
||||
});
|
||||
|
||||
// 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: ./layouts/AdminLayout.jsx + 2 modules
|
||||
var AdminLayout = __webpack_require__(4858);
|
||||
// EXTERNAL MODULE: ./functions/backend/userAuth.js
|
||||
var userAuth = __webpack_require__(370);
|
||||
var userAuth_default = /*#__PURE__*/__webpack_require__.n(userAuth);
|
||||
// EXTERNAL MODULE: ./components/admin/users/TargetUserPreviewPopup.jsx
|
||||
var TargetUserPreviewPopup = __webpack_require__(9417);
|
||||
// EXTERNAL MODULE: ./components/general/Breadcrumbs.jsx
|
||||
var Breadcrumbs = __webpack_require__(424);
|
||||
// EXTERNAL MODULE: ./components/admin/users/UserListCard.jsx
|
||||
var UserListCard = __webpack_require__(3863);
|
||||
// EXTERNAL MODULE: ./components/general/BackButton.jsx
|
||||
var BackButton = __webpack_require__(1781);
|
||||
;// CONCATENATED MODULE: ./components/admin/users/SingleDatabaseUsersContent.jsx
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
*/ function SingleDatabaseUsersContent(props) {
|
||||
/**
|
||||
* Get Contexts
|
||||
*
|
||||
* @abstract { React.useContext }
|
||||
*/ const { database , users , user } = external_react_default().useContext(SingleDatabaseUsersContext);
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* React Hooks
|
||||
*
|
||||
* @abstract { useState, useEffect, useRef, etc ... }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @abstract Main Function Return
|
||||
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "flex-col items-start gap-0 w-full",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "w-full justify-between flex-wrap",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(BackButton/* default */.Z, {}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("h1", {
|
||||
className: "text-3xl m-0",
|
||||
children: [
|
||||
database.db_name,
|
||||
" Users"
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||||
href: `/admin/${user?.id}/users/add-user?db=${database.db_slug}`,
|
||||
className: "flex items-center gap-2 whitespace-normal button",
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
className: "symbol",
|
||||
children: "+"
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
children: "Add New User"
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(Breadcrumbs/* default */.Z, {
|
||||
user: user
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||||
className: "paper w-full flex-col items-stretch",
|
||||
children: users && users[0] ? users.map((userObject)=>{
|
||||
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||||
href: `/admin/${user?.id}/users/databases/${database.db_slug}/${userObject.id}`,
|
||||
className: "w-full flex items-center gap-2 p-4 border border-solid border-slate-200 rounded cursor-pointer hover:border-slate-400 flex-wrap",
|
||||
onClick: (e)=>{
|
||||
// @ts-ignore
|
||||
if (e.target.closest("button")) return e.preventDefault();
|
||||
// setTargetUser(userObject)
|
||||
// openPopup("target-media-popup")
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("img", {
|
||||
src: userObject.image_thumbnail,
|
||||
alt: "",
|
||||
className: "w-10 h-10 rounded-full object-cover bg-slate-200"
|
||||
}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "flex-col items-start gap-1",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
|
||||
className: "font-bold",
|
||||
children: [
|
||||
userObject.first_name,
|
||||
" ",
|
||||
userObject.last_name
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
className: "text-xs text-slate-500",
|
||||
children: userObject.date_created?.substring(0, 16)
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("button", {
|
||||
className: "ml-auto outlined gray pointer-events-none",
|
||||
children: "Edit User"
|
||||
})
|
||||
]
|
||||
});
|
||||
}) : /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
children: "No Users for this database yet"
|
||||
})
|
||||
})
|
||||
]
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
||||
|
||||
// EXTERNAL MODULE: ./package-shared/utils/backend/global-db/DB_HANDLER.js
|
||||
var DB_HANDLER = __webpack_require__(9395);
|
||||
var DB_HANDLER_default = /*#__PURE__*/__webpack_require__.n(DB_HANDLER);
|
||||
;// CONCATENATED MODULE: ./pages/admin/[user_id]/users/databases/[database]/index.jsx
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** @type {import("@/package-shared/types").DelegatedDbContextType} */ // @ts-ignore
|
||||
const init = {};
|
||||
const SingleDatabaseUsersContext = /*#__PURE__*/ external_react_default().createContext(init);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {import("@/package-shared/types").UserType} props.user
|
||||
* @param {import("@/package-shared/types").MYSQL_user_users_table_def[]} props.users
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
|
||||
*/ function DatabaseUsersPage({ user , users , database }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
*
|
||||
* @abstract { React.useContext }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ const pageTitle = `${database.db_name} Users | Datasquirel"`;
|
||||
const pageDescription = "Welcome to your data app";
|
||||
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("title", {
|
||||
children: pageTitle
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
||||
name: "description",
|
||||
content: pageDescription
|
||||
})
|
||||
]
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* React Hooks
|
||||
*
|
||||
* @abstract { useState, useEffect, useRef, etc ... }
|
||||
*/ const [newUser, setNewUser] = external_react_default().useState(null);
|
||||
/** @type {[ targetUser: import("@/package-shared/types").MYSQL_user_users_table_def | null, setTargetUser: React.Dispatch<React.SetStateAction<import("@/package-shared/types").MYSQL_user_users_table_def | null>> ]} */ // @ts-ignore
|
||||
const [targetUser, setTargetUser] = external_react_default().useState(null);
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @abstract Main Function Return
|
||||
*/ return /*#__PURE__*/ jsx_runtime_.jsx(AdminLayout/* default */.Z, {
|
||||
head: head,
|
||||
user: user,
|
||||
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(SingleDatabaseUsersContext.Provider, {
|
||||
value: {
|
||||
user,
|
||||
users,
|
||||
targetUser,
|
||||
setTargetUser,
|
||||
database
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(SingleDatabaseUsersContent, {}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(TargetUserPreviewPopup/* default */.Z, {
|
||||
targetUser: targetUser,
|
||||
user: user,
|
||||
setTargetUser: setTargetUser
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Server Side Props or Static Props
|
||||
* ==============================================================================
|
||||
* @type {import("next").GetServerSideProps}
|
||||
*/ async function getServerSideProps({ req , res , query }) {
|
||||
/**
|
||||
* User Auth
|
||||
*
|
||||
* @description User Auth
|
||||
*/ const user = await userAuth_default()(req, res);
|
||||
if (!user?.logged_in_status) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/logout",
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Page/Site Data Data Fetching
|
||||
*
|
||||
* @description Fetch data on the server before returning
|
||||
*/ const users = await DB_HANDLER_default()(`SELECT * FROM user_users WHERE user_id='${user.id}' AND \`database\`='${query.database}'`);
|
||||
const database = await DB_HANDLER_default()(`SELECT db_name,db_slug,db_image FROM user_databases WHERE user_id='${user.id}' AND db_slug='${query.database}'`);
|
||||
if (!database || !database[0]) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/admin/${user?.id}/users`,
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Server props return
|
||||
*
|
||||
* @description Return data fetched on the server side
|
||||
*/ return {
|
||||
props: {
|
||||
user: user,
|
||||
users: users,
|
||||
database: database[0]
|
||||
}
|
||||
};
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3257:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 69:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudOffTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4008:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CloudQueueRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7306:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CollectionsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8979:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LanguageOutlined");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2814:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/LockTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5557:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9806:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 36:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/RefreshRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1799:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/SchemaTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2423:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lucide-react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 968:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("next/head");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6689:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 997:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("react/jsx-runtime");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../../../../webpack-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,5304,913,9395,370,424,4858,5472,1781,4114,9486,9417,3863], () => (__webpack_exec__(7650)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
+1
File diff suppressed because one or more lines are too long
+647
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,222 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 9361;
|
||||
exports.ids = [9361];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6765:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6517);
|
||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_4__);
|
||||
// @ts-check
|
||||
const fs = __webpack_require__(7147);
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
user: null,
|
||||
msg: "Registration Failed!"
|
||||
});
|
||||
/**
|
||||
* User Auth
|
||||
*
|
||||
* @description User Auth
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Validate Form
|
||||
*
|
||||
* @description Check if request body is valid
|
||||
*/ // const { id, inviting_user_id, invited_user_email, invitation_status, database_access, priviledge } = req.body;
|
||||
const sanitizedReqBody = lodash__WEBPACK_IMPORTED_MODULE_2___default().cloneDeep(req.body);
|
||||
const inviting_user_id = sanitizedReqBody.inviting_user_id;
|
||||
const invited_user_email = sanitizedReqBody.invited_user_email;
|
||||
const database_access = sanitizedReqBody.database_access;
|
||||
const priviledge = sanitizedReqBody.priviledge;
|
||||
/**
|
||||
* Validate Form
|
||||
*
|
||||
* @description Check if request body is valid
|
||||
*/ try {
|
||||
const existingUserUser = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default()(`SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?`, [
|
||||
inviting_user_id,
|
||||
user.id,
|
||||
user.email
|
||||
]);
|
||||
if (existingUserUser && existingUserUser[0]) {
|
||||
return res.json({
|
||||
success: false
|
||||
});
|
||||
}
|
||||
/** @type {any} */ const newUserUser = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_4___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_users",
|
||||
data: {
|
||||
user_id: inviting_user_id,
|
||||
invited_user_id: user.id,
|
||||
database_access: database_access,
|
||||
user_priviledge: priviledge,
|
||||
user_type: "admin",
|
||||
first_name: user.first_name,
|
||||
last_name: user.last_name,
|
||||
email: user.email,
|
||||
username: user.first_name,
|
||||
image: user.image,
|
||||
image_thumbnail: user.image_thumbnail
|
||||
}
|
||||
});
|
||||
const inviteAccepted = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default()(`UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?`, [
|
||||
inviting_user_id,
|
||||
invited_user_email
|
||||
]);
|
||||
const dbTableData = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default()(`SELECT db_tables_data FROM invitations WHERE inviting_user_id=?`, [
|
||||
inviting_user_id
|
||||
]);
|
||||
// const dbTableData = await DB_HANDLER(`SELECT db_tables_data FROM invitations WHERE inviting_user_id='${inviting_user_id}' AND invited_user_email='${invited_user_email}'`);
|
||||
const clearEntries = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default()(`DELETE FROM delegated_user_tables WHERE root_user_id='${inviting_user_id}' AND delegated_user_id='${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 _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_4___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "delegated_user_tables",
|
||||
data: {
|
||||
delegated_user_id: user.id,
|
||||
root_user_id: inviting_user_id,
|
||||
database: db_slug,
|
||||
table: table_slug,
|
||||
priviledge: priviledge
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: newUserUser?.insertId ? true : false
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
component: "/api/acceptUserInvitation/catch-error",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false
|
||||
});
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338], () => (__webpack_exec__(6765)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 3488;
|
||||
exports.ids = [3488];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 9538:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("datasquirel");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3278:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_addAdminUserOnLogin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(613);
|
||||
/* harmony import */ var _functions_backend_addAdminUserOnLogin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_addAdminUserOnLogin__WEBPACK_IMPORTED_MODULE_1__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_0___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ console.log("Invitation Received by current logged in user, Loggin in VIA API ...");
|
||||
const acceptInvitation = await _functions_backend_addAdminUserOnLogin__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
// @ts-ignore
|
||||
query: req.body.query,
|
||||
user
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: true,
|
||||
result: acceptInvitation
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338,613], () => (__webpack_exec__(3278)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 1600;
|
||||
exports.ids = [1600];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 3785:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("generate-password");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2081:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("child_process");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5241:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _package_shared_functions_backend_encrypt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7547);
|
||||
/* harmony import */ var _package_shared_functions_backend_encrypt__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_encrypt__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const { execSync } = __webpack_require__(2081);
|
||||
const generator = __webpack_require__(3785);
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ /** @type {import("@/package-shared/types").AddApiKeyRequestBody} */ const reqBody = req.body;
|
||||
const { api_key_name , api_key_slug , api_key_scope , target_database , target_table , } = reqBody;
|
||||
/**
|
||||
* Input Validation
|
||||
*
|
||||
* @description Input Validation
|
||||
*/ if (!api_key_name?.match(/./) || !api_key_slug?.match(/./) || !api_key_scope?.match(/./)) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Wrong Input"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
const allowedKeysPath = process.env.DSQL_API_KEYS_PATH;
|
||||
if (!allowedKeysPath) throw new Error("process.env.DSQL_API_KEYS_PATH variable not found");
|
||||
if (!fs.existsSync(allowedKeysPath)) {
|
||||
fs.mkdirSync(allowedKeysPath, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
let sign = generator.generate({
|
||||
length: 24,
|
||||
numbers: true,
|
||||
uppercase: true,
|
||||
lowercase: true,
|
||||
symbols: "-"
|
||||
}) + "-" + Date.now();
|
||||
/** @type {import("@/package-shared/types").ApiKeyObject} */ let payload = {
|
||||
user_id: user.id,
|
||||
date_code: Date.now(),
|
||||
sign,
|
||||
target_database,
|
||||
target_table
|
||||
};
|
||||
if (api_key_scope == "fullAccess") {
|
||||
const extraPayload = {
|
||||
full_access: true
|
||||
};
|
||||
payload = {
|
||||
...payload,
|
||||
...extraPayload
|
||||
};
|
||||
}
|
||||
const apiKey = _package_shared_functions_backend_encrypt__WEBPACK_IMPORTED_MODULE_0___default()(JSON.stringify(payload));
|
||||
if (!apiKey) return res.json({
|
||||
success: false,
|
||||
msg: "Couldn't encrypt API key"
|
||||
});
|
||||
const encryptedApiKey = _package_shared_functions_backend_encrypt__WEBPACK_IMPORTED_MODULE_0___default()(apiKey);
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ /** @type {any} */ let dbEntryObject = {
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "api_keys",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
name: api_key_name,
|
||||
slug: api_key_slug,
|
||||
key: encryptedApiKey,
|
||||
scope: api_key_scope
|
||||
}
|
||||
};
|
||||
if (sign) dbEntryObject.data.csrf = sign;
|
||||
let newApiKey = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default()(dbEntryObject);
|
||||
if (!newApiKey.insertId) {
|
||||
throw new Error("Api Key Couldn't be added");
|
||||
}
|
||||
fs.writeFileSync(`${allowedKeysPath}/${sign}`, JSON.stringify(payload), "utf-8");
|
||||
res.json({
|
||||
success: true
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
////////////////////////////////////////
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
component: "/api/addApiKey/catch-error",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Database Files could not be written!"
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338], () => (__webpack_exec__(5241)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 8066;
|
||||
exports.ids = [8066];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2029:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("datasquirel/functions/hashPassword");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5078:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2029);
|
||||
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_2__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const sanitizedReqBody = req.body;
|
||||
const { payload , dbFullName , dbId } = sanitizedReqBody;
|
||||
/**
|
||||
* Input Validation
|
||||
*
|
||||
* @description Input Validation
|
||||
*/ const newUser = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_2___default()({
|
||||
dbContext: "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: "users",
|
||||
data: (()=>{
|
||||
const reqBodyKeys = Object.keys(payload);
|
||||
/** @type {any} */ let finalData = {};
|
||||
reqBodyKeys.forEach((key)=>{
|
||||
if (key?.match(/paradigm|priviledge|database_access|databases|confirm/)) return;
|
||||
finalData[key] = payload[key];
|
||||
});
|
||||
finalData["password"] = datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
encryptionKey: process.env.DSQL_ENCRYPTION_PASSWORD || "",
|
||||
password: payload.password
|
||||
});
|
||||
finalData["email"] = payload.email_address;
|
||||
finalData["image"] = "/images/user_images/user-preset.png";
|
||||
finalData["image_thumbnail"] = "/images/user_images/user-preset-thumbnail.png";
|
||||
delete finalData["email_address"];
|
||||
return finalData;
|
||||
})()
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: newUser?.insertId ? true : false,
|
||||
msg: "New User User Added",
|
||||
newUserId: newUser.insertId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,6825,3017,3403,7547,5886,5338], () => (__webpack_exec__(5078)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,312 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 8336;
|
||||
exports.ids = [8336];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2250:
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
// @ts-check
|
||||
|
||||
const _ = __webpack_require__(6517);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Sanitize SQL function
|
||||
* ==============================================================================
|
||||
* @description this function takes in a text(or number) and returns a sanitized
|
||||
* text, usually without spaces
|
||||
*
|
||||
* @param {any} text - Text or number or object
|
||||
* @param {boolean} [spaces] - Allow spaces
|
||||
* @param {RegExp?} [regex] - Regular expression, removes any match
|
||||
*
|
||||
* @returns {any}
|
||||
*/ function sanitizeSql(text, spaces, regex) {
|
||||
/**
|
||||
* Initial Checks
|
||||
*
|
||||
* @description Initial Checks
|
||||
*/ if (!text) return "";
|
||||
if (typeof text == "number" || typeof text == "boolean") return text;
|
||||
if (typeof text == "string" && !text?.toString()?.match(/./)) return "";
|
||||
if (typeof text == "object" && !Array.isArray(text)) {
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
const newObject = sanitizeObjects(text, spaces);
|
||||
return newObject;
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} else if (typeof text == "object" && Array.isArray(text)) {
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
const newArray = sanitizeArrays(text, spaces);
|
||||
return newArray;
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
// if (text?.toString()?.match(/\'|\"/)) {
|
||||
// console.log("TEXT containing commas =>", text);
|
||||
// return "";
|
||||
// }
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Declare variables
|
||||
*
|
||||
* @description Declare "results" variable
|
||||
*/ let finalText = text;
|
||||
if (regex) {
|
||||
finalText = text.toString().replace(regex, "");
|
||||
}
|
||||
if (spaces) {} else {
|
||||
finalText = text.toString().replace(/\n|\r|\n\r|\r\n/g, "").replace(/ /g, "");
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
const escapeRegex = /select |insert |drop |delete |alter |create |exec | union | or | like | concat|LOAD_FILE|ASCII| COLLATE | HAVING | information_schema|DECLARE |\#|WAITFOR |delay |BENCHMARK |\/\*.*\*\//gi;
|
||||
finalText = finalText.replace(/(?<!\\)\'/g, "\\'").replace(/(?<!\\)\`/g, "\\`")// .replace(/(?<!\\)\"/g, '\\"')
|
||||
.replace(/\/\*\*\//g, "").replace(escapeRegex, "\\$&");
|
||||
// const injectionRegexp = /select .* from|\*|delete from|drop database|drop table|update .* set/i;
|
||||
// if (text?.toString()?.match(injectionRegexp)) {
|
||||
// console.log("ATTEMPTED INJECTION =>", text);
|
||||
// return "";
|
||||
// }
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
return finalText;
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Sanitize Objects Function
|
||||
* ==============================================================================
|
||||
* @description Sanitize objects in the form { key: "value" }
|
||||
*
|
||||
* @param {any} object - Database Full Name
|
||||
* @param {boolean} [spaces] - Allow spaces
|
||||
*
|
||||
* @returns {object}
|
||||
*/ function sanitizeObjects(object, spaces) {
|
||||
/** @type {any} */ let objectUpdated = {
|
||||
...object
|
||||
};
|
||||
const keys = Object.keys(objectUpdated);
|
||||
keys.forEach((key)=>{
|
||||
const value = objectUpdated[key];
|
||||
if (!value) {
|
||||
delete objectUpdated[key];
|
||||
return;
|
||||
}
|
||||
if (typeof value == "string" || typeof value == "number") {
|
||||
objectUpdated[key] = sanitizeSql(value, spaces);
|
||||
} else if (typeof value == "object" && !Array.isArray(value)) {
|
||||
objectUpdated[key] = sanitizeObjects(value, spaces);
|
||||
} else if (typeof value == "object" && Array.isArray(value)) {
|
||||
objectUpdated[key] = sanitizeArrays(value, spaces);
|
||||
}
|
||||
});
|
||||
return objectUpdated;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Sanitize Objects Function
|
||||
* ==============================================================================
|
||||
* @description Sanitize objects in the form { key: "value" }
|
||||
*
|
||||
* @param {any[]} array - Database Full Name
|
||||
* @param {boolean} [spaces] - Allow spaces
|
||||
*
|
||||
* @returns {string[]|number[]|object[]}
|
||||
*/ function sanitizeArrays(array, spaces) {
|
||||
let arrayUpdated = _.cloneDeep(array);
|
||||
arrayUpdated.forEach((item, index)=>{
|
||||
const value = item;
|
||||
if (!value) {
|
||||
arrayUpdated.splice(index, 1);
|
||||
return;
|
||||
}
|
||||
if (typeof item == "string" || typeof item == "number") {
|
||||
arrayUpdated[index] = sanitizeSql(value, spaces);
|
||||
} else if (typeof item == "object" && !Array.isArray(value)) {
|
||||
arrayUpdated[index] = sanitizeObjects(value, spaces);
|
||||
} else if (typeof item == "object" && Array.isArray(value)) {
|
||||
arrayUpdated[index] = sanitizeArrays(item, spaces);
|
||||
}
|
||||
});
|
||||
return arrayUpdated;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
module.exports = sanitizeSql;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4373:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1017);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_sanitizeSql__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2250);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_sanitizeSql__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_sanitizeSql__WEBPACK_IMPORTED_MODULE_2__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const sanitizedReqBody = _package_shared_functions_backend_db_sanitizeSql__WEBPACK_IMPORTED_MODULE_2___default()(req.body);
|
||||
const { name } = sanitizedReqBody;
|
||||
const STATIC_ROOT = process.env.DSQL_STATIC_SERVER_DIR;
|
||||
if (!STATIC_ROOT) {
|
||||
console.log("Static File ENV not Found!");
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "No Static File Path"
|
||||
});
|
||||
}
|
||||
const folderPath = path__WEBPACK_IMPORTED_MODULE_0___default().join(STATIC_ROOT, `images/user-images/user-${user.id}/`);
|
||||
const newFolderPath = folderPath + name;
|
||||
const doesFolderExist = fs.existsSync(newFolderPath);
|
||||
if (doesFolderExist) return res.json({
|
||||
success: false
|
||||
});
|
||||
fs.mkdirSync(newFolderPath);
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ res.json({
|
||||
success: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,6825], () => (__webpack_exec__(4373)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 5012;
|
||||
exports.ids = [5012];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2081:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("child_process");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1541:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const { execSync } = __webpack_require__(2081);
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ // import { get, set } from "lodash";
|
||||
// const rateLimit = 10; // Number of allowed requests per minute
|
||||
// const rateLimiter = {};
|
||||
// const rateLimiterMiddleware = (ip) => {
|
||||
// const now = Date.now();
|
||||
// const windowStart = now - 60 * 1000; // 1 minute ago
|
||||
// const requestTimestamps = get(rateLimiter, ip, []).filter((timestamp) => timestamp > windowStart);
|
||||
// requestTimestamps.push(now);
|
||||
// set(rateLimiter, ip, requestTimestamps);
|
||||
// return requestTimestamps.length <= rateLimit;
|
||||
// };
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ // const ip = req.headers["x-real-ip"] || req.connection.remoteAddress;
|
||||
// if (!rateLimiterMiddleware(ip)) {
|
||||
// // res.status(429).json({ message: "Too Many Requests" });
|
||||
// return res.status(429).json({ msg: "Too Many Requests" });
|
||||
// }
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const sanitizedReqBody = req.body;
|
||||
const { dbFullName , dbSlug , paradigm , platforms } = sanitizedReqBody;
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const userEnvFilePath = `./jsonData/dbSchemas/users/user-${user.id}/env.json`;
|
||||
if (!fs.existsSync(userEnvFilePath)) {
|
||||
fs.writeFileSync(userEnvFilePath, "{}", "utf8");
|
||||
}
|
||||
const envObject = JSON.parse(fs.readFileSync(userEnvFilePath, "utf8"));
|
||||
let databseObject = envObject[dbFullName];
|
||||
if (!databseObject) {
|
||||
databseObject = {
|
||||
social: []
|
||||
};
|
||||
envObject[dbFullName] = databseObject;
|
||||
}
|
||||
/** @type {object[]} */ let socialLogins = databseObject.social;
|
||||
socialLogins = [];
|
||||
for(let i = 0; i < platforms.length; i++){
|
||||
const platform = platforms[i];
|
||||
const { clientId , clientSecret , domain1 , domain2 , callbackUrl } = platform;
|
||||
if (paradigm?.match(/personal/) && !clientId?.match(/./)) {
|
||||
throw new Error("Client Id Must be present");
|
||||
}
|
||||
if (paradigm?.match(/personal/) && !clientSecret?.match(/./)) {
|
||||
throw new Error("Client Secret Must be present");
|
||||
}
|
||||
if (paradigm?.match(/datasquirel/) && !domain1?.match(/./)) {
|
||||
throw new Error("Atleast one Domain Must be present");
|
||||
}
|
||||
// const existingPlatformIndex = socialLogins.findIndex((scObj) => scObj.platform === platform.platform);
|
||||
// console.log(existingPlatformIndex);
|
||||
// if (existingPlatformIndex >= 0) {
|
||||
// if (paradigm?.match(/personal/)) {
|
||||
// socialLogins[existingPlatformIndex] = { ...platform, paradigm };
|
||||
// } else {
|
||||
// socialLogins[existingPlatformIndex] = { paradigm, platform: platform.platform };
|
||||
// }
|
||||
// } else {
|
||||
// socialLogins.push({ paradigm, ...platform });
|
||||
// }
|
||||
if (paradigm?.match(/personal/)) {
|
||||
socialLogins.push({
|
||||
platform: platform.platform,
|
||||
paradigm,
|
||||
clientId,
|
||||
clientSecret,
|
||||
callbackUrl
|
||||
});
|
||||
} else {
|
||||
socialLogins.push({
|
||||
platform: platform.platform,
|
||||
paradigm,
|
||||
domain1,
|
||||
domain2
|
||||
});
|
||||
}
|
||||
}
|
||||
databseObject.social = socialLogins;
|
||||
fs.writeFileSync(userEnvFilePath, JSON.stringify(envObject, null, 4), "utf-8");
|
||||
res.json({
|
||||
success: true
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
console.log(error.message);
|
||||
////////////////////////////////////////
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
component: "/api/addSocialLogin/catch-error",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: error.message
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825], () => (__webpack_exec__(1541)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,216 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 8325;
|
||||
exports.ids = [8325];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2771:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_handleTableEntryOrder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(766);
|
||||
/* harmony import */ var _functions_backend_handleTableEntryOrder__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_handleTableEntryOrder__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DSQL_USER_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3403);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DSQL_USER_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DSQL_USER_DB_HANDLER__WEBPACK_IMPORTED_MODULE_3__);
|
||||
// @ts-check
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const checkUserRights = __webpack_require__(8999);
|
||||
const grabDelegatedUserFromCookie = __webpack_require__(1352);
|
||||
const serverError = __webpack_require__(2163);
|
||||
const userAuth = __webpack_require__(6825);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* @typedef {object} AddTableEntryRequestBody
|
||||
* @property {string} tableName
|
||||
* @property {any} payload
|
||||
* @property {import("@/package-shared/types").DSQL_TableSchemaType} tableSchema
|
||||
* @property {string} dbSlug
|
||||
* @property {number} dbId
|
||||
* @property {boolean} delegated
|
||||
*/ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await userAuth(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "User Auth Failed"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ /** @type {AddTableEntryRequestBody} */ const sanitizedReqBody = req.body;
|
||||
const { tableName , payload , tableSchema , dbSlug , dbId , delegated } = sanitizedReqBody;
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Check if user has rights to this table
|
||||
*
|
||||
* @description Check if user has rights to this table
|
||||
*/ const delegatedUser = await grabDelegatedUserFromCookie({
|
||||
databaseSlug: dbSlug,
|
||||
request: req,
|
||||
user: user,
|
||||
query: req.query
|
||||
});
|
||||
const checkUserRightsBoolean = await checkUserRights({
|
||||
user: user,
|
||||
confirmedDelegetedUser: delegatedUser,
|
||||
database: dbSlug,
|
||||
table: tableName,
|
||||
dbId: dbId,
|
||||
priviledgeRegex: /Update Entries/i
|
||||
});
|
||||
if (!checkUserRightsBoolean) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
const dbFullName = delegatedUser?.rootUserId ? `datasquirel_user_${delegatedUser.rootUserId}_${dbSlug}` : `datasquirel_user_${user.id}_${dbSlug}`;
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const newTableEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
dbContext: "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: tableName,
|
||||
data: payload,
|
||||
tableSchema: tableSchema
|
||||
});
|
||||
if (!newTableEntry.insertId) {
|
||||
console.log("Table Insertion Failed =>", newTableEntry);
|
||||
throw new Error("Table Insertion Failed");
|
||||
}
|
||||
const handleOrder = await _functions_backend_handleTableEntryOrder__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
dbName: dbFullName,
|
||||
entryId: newTableEntry.insertId,
|
||||
entryOrder: payload.order,
|
||||
tableName: tableName,
|
||||
tableSchema: tableSchema
|
||||
});
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: true
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
////////////////////////////////////////
|
||||
serverError({
|
||||
component: "/api/addTableEntry/catch-error",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Database Files could not be written!",
|
||||
err: error.message
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338,1352,8999,766], () => (__webpack_exec__(2771)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,355 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 3909;
|
||||
exports.ids = [3909];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7441:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sharp");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2081:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("child_process");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9146:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "config": () => (/* binding */ config),
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* 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__);
|
||||
/* harmony import */ var _functions_backend_fsWriteImageToDiskFromBase64__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5910);
|
||||
/* harmony import */ var _functions_backend_fsWriteImageToDiskFromBase64__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_fsWriteImageToDiskFromBase64__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _functions_backend_grabPaths__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6715);
|
||||
/* harmony import */ var _functions_backend_grabPaths__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_grabPaths__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_4__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const { execSync } = __webpack_require__(2081);
|
||||
const config = {
|
||||
api: {
|
||||
responseLimit: "1mb",
|
||||
bodyParser: {
|
||||
sizeLimit: "200mb"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_4___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const sanitizedReqBody = req.body;
|
||||
const { media } = sanitizedReqBody;
|
||||
const folder = sanitizedReqBody.folder;
|
||||
const type = sanitizedReqBody.type;
|
||||
const newMediaArray = media;
|
||||
const isProduction = "production".match(/production/);
|
||||
const STATIC_ROOT = process.env.DSQL_STATIC_SERVER_DIR;
|
||||
if (!STATIC_ROOT) {
|
||||
console.log("Static File ENV not Found!");
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "No Static File Path"
|
||||
});
|
||||
}
|
||||
if (folder) {
|
||||
const folderPath = path.join(STATIC_ROOT, `images/user-images/user-${user.id}/${folder}`);
|
||||
const folderExists = fs.existsSync(folderPath);
|
||||
if (!folderExists) {
|
||||
fs.mkdirSync(folderPath, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
const privateFolderPath = `./jsonData/dbSchemas/users/user-${user.id}/media/${folder}`;
|
||||
const privateFolderExists = fs.existsSync(privateFolderPath);
|
||||
if (!privateFolderExists) {
|
||||
fs.mkdirSync(privateFolderPath, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const mediaData = [];
|
||||
for(let i = 0; i < newMediaArray.length; i++){
|
||||
const newMedia = newMediaArray[i];
|
||||
if (type?.match(/image/i)) {
|
||||
const { imageBase64 , imageName , imageSize , mimeType } = newMedia;
|
||||
const imageWrite = await _functions_backend_fsWriteImageToDiskFromBase64__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
imageName: imageName.replace(/ /g, "-"),
|
||||
imageSourceBase64: imageBase64,
|
||||
user: user,
|
||||
folder,
|
||||
mimeType,
|
||||
isPrivate: newMedia.private
|
||||
});
|
||||
if (!imageWrite) {
|
||||
console.log("Image Write Failed!");
|
||||
continue;
|
||||
}
|
||||
const { urlPath , urlThumbnailPath , urlRelativePath , urlThumbnailRelativePath , } = imageWrite;
|
||||
let newMediaEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_media",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
media_name: imageName.replace(/ /g, "-"),
|
||||
media_url: urlPath,
|
||||
media_type: "image",
|
||||
media_thumbnail_url: urlThumbnailPath,
|
||||
media_path: urlRelativePath,
|
||||
media_thumbnail_path: urlThumbnailRelativePath,
|
||||
folder: folder,
|
||||
private: newMedia.private ? 1 : 0
|
||||
},
|
||||
duplicateColumnName: "media_url",
|
||||
duplicateColumnValue: urlPath
|
||||
});
|
||||
// if (newMediaEntry?.insertId) {
|
||||
mediaData.push({
|
||||
media_name: imageName.replace(/ /g, "-"),
|
||||
media_url: urlPath,
|
||||
media_thumbnail_url: urlThumbnailPath
|
||||
});
|
||||
// }
|
||||
} else if (type?.match(/file/i)) {
|
||||
const { fileBase64 , fileSize , fileType } = newMedia;
|
||||
const fileName = newMedia.fileName.replace(/ /g, "-").replace(/\./g, "");
|
||||
/**
|
||||
* Grab URL Paths
|
||||
*/ const grabedPaths = _functions_backend_grabPaths__WEBPACK_IMPORTED_MODULE_2___default()({
|
||||
isPrivate: newMedia.private,
|
||||
user: user,
|
||||
folder: folder
|
||||
});
|
||||
if (!grabedPaths) {
|
||||
continue;
|
||||
}
|
||||
const { fileRootPath , urlRootPath , relativePath } = grabedPaths;
|
||||
const fileExt = (()=>{
|
||||
if (fileType?.match(/pdf/)) return ".pdf";
|
||||
if (fileType?.match(/xlsx/)) return ".xlsx";
|
||||
if (fileType?.match(/csv/)) return ".csv";
|
||||
if (fileType?.match(/json/)) return ".json";
|
||||
return null;
|
||||
})();
|
||||
if (!fileExt) continue;
|
||||
const writePath = fileRootPath + fileName + fileExt;
|
||||
const urlPath1 = urlRootPath + fileName + fileExt;
|
||||
const urlRelativePath1 = relativePath + fileName + fileExt;
|
||||
fs.writeFileSync(writePath, fileBase64, "base64");
|
||||
let newMediaEntry1 = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_media",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
media_name: fileName,
|
||||
media_url: urlPath1,
|
||||
media_thumbnail_url: urlPath1,
|
||||
media_path: urlRelativePath1,
|
||||
media_thumbnail_path: urlRelativePath1,
|
||||
media_type: "file" + "/" + fileExt.replace(/\./, ""),
|
||||
folder: folder,
|
||||
private: newMedia.private ? 1 : 0
|
||||
},
|
||||
duplicateColumnName: "media_url",
|
||||
duplicateColumnValue: urlPath1
|
||||
});
|
||||
mediaData.push({
|
||||
media_name: fileName,
|
||||
media_url: urlPath1,
|
||||
media_thumbnail_url: urlPath1
|
||||
});
|
||||
} else if (type?.match(/video/i)) {
|
||||
const { fileBase64: fileBase641 , fileSize: fileSize1 , fileType: fileType1 } = newMedia;
|
||||
const fileName1 = newMedia.fileName.replace(/ /g, "-").replace(/\./g, "");
|
||||
/**
|
||||
* Grab URL Paths
|
||||
*/ const grabedPaths1 = _functions_backend_grabPaths__WEBPACK_IMPORTED_MODULE_2___default()({
|
||||
isPrivate: newMedia.private,
|
||||
user: user,
|
||||
folder: folder,
|
||||
video: true
|
||||
});
|
||||
if (!grabedPaths1) {
|
||||
continue;
|
||||
}
|
||||
const { fileRootPath: fileRootPath1 , urlRootPath: urlRootPath1 , relativePath: relativePath1 } = grabedPaths1;
|
||||
const fileExt1 = (()=>{
|
||||
if (fileType1?.match(/mp4/)) return ".mp4";
|
||||
return null;
|
||||
})();
|
||||
if (!fileExt1) continue;
|
||||
const writePath1 = fileRootPath1 + fileName1 + fileExt1;
|
||||
const urlPath2 = urlRootPath1 + fileName1 + fileExt1;
|
||||
const urlRelativePath2 = relativePath1 + fileName1 + fileExt1;
|
||||
fs.writeFileSync(writePath1, fileBase641, "base64");
|
||||
let newMediaEntry2 = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_media",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
media_name: fileName1,
|
||||
media_url: urlPath2,
|
||||
media_thumbnail_url: urlPath2,
|
||||
media_path: urlRelativePath2,
|
||||
media_thumbnail_path: urlRelativePath2,
|
||||
media_type: "video" + "/" + fileExt1.replace(/\./, ""),
|
||||
folder: folder,
|
||||
private: newMedia.private ? 1 : 0
|
||||
},
|
||||
duplicateColumnName: "media_url",
|
||||
duplicateColumnValue: urlPath2
|
||||
});
|
||||
mediaData.push({
|
||||
media_name: fileName1,
|
||||
media_url: urlPath2,
|
||||
media_thumbnail_url: urlPath2
|
||||
});
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: true,
|
||||
mediaData: mediaData
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error) {
|
||||
console.log(`Add User Media Error: ${error.message}`);
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
component: "/api/addUserMedia/catch-error",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Database Files could not be written!"
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338,6715,5910], () => (__webpack_exec__(9146)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,304 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 8448;
|
||||
exports.ids = [8448];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2081:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("child_process");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8583:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _functions_backend_grabUserSchemaData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8164);
|
||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6517);
|
||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _functions_backend_setUserSchemaData__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7638);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_6__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const { execSync } = __webpack_require__(2081);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_1___default()(req, res, true);
|
||||
if (!user) {
|
||||
console.log("No User");
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const { payload } = req.body;
|
||||
const dbFullName = req.body.dbFullName.replace(/[^a-z\_0-9]/g, "");
|
||||
const dbSlug = req.body.dbSlug;
|
||||
const dbId = req.body.dbId;
|
||||
const parentDatabase = req.body.parentDatabase;
|
||||
const parentTable = req.body.parentTable;
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
let userSchemaData = (0,_functions_backend_grabUserSchemaData__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
||||
userId: user.id
|
||||
});
|
||||
if (!userSchemaData) {
|
||||
throw new Error("No User Schema found!");
|
||||
}
|
||||
let targetDatabaseIndex = userSchemaData.findIndex((db)=>db.dbFullName === dbFullName);
|
||||
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ let targetDatabase = userSchemaData[targetDatabaseIndex];
|
||||
if (!targetDatabase) {
|
||||
throw new Error("No Target Database Found!");
|
||||
}
|
||||
let existingTableIndex = targetDatabase.tables.findIndex((table)=>table.tableName === payload.tableName);
|
||||
if (existingTableIndex >= 0) {
|
||||
userSchemaData[targetDatabaseIndex].tables[existingTableIndex] = payload;
|
||||
} else {
|
||||
userSchemaData[targetDatabaseIndex].tables.push(payload);
|
||||
}
|
||||
if (payload?.childTable) {
|
||||
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType | undefined} */ const parentDb = userSchemaData.find((db)=>db.dbFullName === parentDatabase);
|
||||
const parentTableObject = parentDb?.tables.find((table)=>{
|
||||
if (table.tableName === parentTable) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!parentTableObject) {
|
||||
throw new Error("Child Table Parent Doesn't Exist!");
|
||||
}
|
||||
if (parentTableObject.childrenTables?.[0]) {
|
||||
parentTableObject.childrenTables.push({
|
||||
dbNameFull: dbFullName,
|
||||
tableName: payload.tableName,
|
||||
tableNameFull: payload.tableNameFull
|
||||
});
|
||||
} else {
|
||||
parentTableObject.childrenTables = [
|
||||
{
|
||||
dbNameFull: dbFullName,
|
||||
tableName: payload.tableName,
|
||||
tableNameFull: payload.tableFullName
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Check Children Databases
|
||||
*
|
||||
* @description Check Children Databases
|
||||
*/ if (targetDatabase.childrenDatabases) {
|
||||
for(let i = 0; i < targetDatabase.childrenDatabases.length; i++){
|
||||
const childDb = targetDatabase.childrenDatabases[i];
|
||||
try {
|
||||
const targetChildIndex = userSchemaData.findIndex((db)=>db.dbFullName === childDb.dbFullName);
|
||||
if (userSchemaData[targetChildIndex]) userSchemaData[targetChildIndex].tables = lodash__WEBPACK_IMPORTED_MODULE_3___default().cloneDeep(targetDatabase.tables);
|
||||
const targetDbRecord = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5___default()(`SELECT * FROM user_databases WHERE user_id = ? AND db_full_name = ?`, [
|
||||
user.id,
|
||||
childDb.dbFullName
|
||||
]);
|
||||
const existingEntry = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_5___default()(`SELECT * FROM user_database_tables WHERE db_id=? AND user_id=? AND table_slug=?`, [
|
||||
targetDbRecord[0].id,
|
||||
user.id,
|
||||
payload.tableName
|
||||
]);
|
||||
if (existingEntry?.[0]) continue;
|
||||
const newChildTableEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_6___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_database_tables",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
db_id: targetDbRecord[0].id,
|
||||
db_slug: targetDbRecord[0].db_slug,
|
||||
table_name: payload.tableFullName,
|
||||
table_slug: payload.tableName
|
||||
}
|
||||
});
|
||||
} catch (/** @type {any} */ error) {
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
component: "/api/addUserTable/lines-124-140",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
// console.log("Done ...");
|
||||
// fs.writeFileSync(
|
||||
// "./.tmp/newTableSchema.json",
|
||||
// JSON.stringify(userSchemaData, null, 4),
|
||||
// "utf8"
|
||||
// );
|
||||
// return res.json({
|
||||
// success: false,
|
||||
// msg: "Testing",
|
||||
// });
|
||||
(0,_functions_backend_setUserSchemaData__WEBPACK_IMPORTED_MODULE_4__["default"])({
|
||||
userId: user.id,
|
||||
schemaData: userSchemaData
|
||||
});
|
||||
////////////////////////////////////////
|
||||
/** @type {any} */ const newTableInsertObject = {
|
||||
user_id: user.id,
|
||||
db_id: dbId,
|
||||
db_slug: dbSlug,
|
||||
table_name: payload.tableFullName,
|
||||
table_slug: payload.tableName
|
||||
};
|
||||
if (payload?.childTable) {
|
||||
newTableInsertObject["child_table"] = "1";
|
||||
newTableInsertObject["child_table_parent_database"] = parentDatabase;
|
||||
newTableInsertObject["child_table_parent_table"] = parentTable;
|
||||
}
|
||||
const newTableEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_6___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_database_tables",
|
||||
data: newTableInsertObject
|
||||
});
|
||||
////////////////////////////////////////
|
||||
const targetPath = path.join(process.cwd(), "/shell");
|
||||
const dbShellUpdate = execSync(`node createDbFromSchema.js --user ${user.id} --database ${dbFullName}${payload?.childTable ? " --clone" : ""}`, {
|
||||
cwd: targetPath
|
||||
});
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: true
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error1) {
|
||||
////////////////////////////////////////
|
||||
console.log(error1.message);
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
component: "/api/addUserTable/main-catch-error",
|
||||
message: error1.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Database Files could not be written!"
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338,8164,7638], () => (__webpack_exec__(8583)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,231 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 5402;
|
||||
exports.ids = [5402];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 2029:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("datasquirel/functions/hashPassword");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5184:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("nodemailer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9210:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6926);
|
||||
/* harmony import */ var _functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2029);
|
||||
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_4__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ // const sanitizedReqBody = sanitizeSql(req.body);
|
||||
const sanitizedReqBody = req.body;
|
||||
const paradigm = sanitizedReqBody.paradigm;
|
||||
/**
|
||||
* Input Validation
|
||||
*
|
||||
* @description Input Validation
|
||||
*/ if (paradigm?.match(/database/)) {
|
||||
const newUser = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_users",
|
||||
data: (()=>{
|
||||
const reqBodyKeys = Object.keys(sanitizedReqBody);
|
||||
/** @type {any} */ const finalData = {};
|
||||
reqBodyKeys.forEach((key)=>{
|
||||
if (key?.match(/paradigm|priviledge|database_access|databases|confirm/)) return;
|
||||
finalData[key] = sanitizedReqBody[key];
|
||||
});
|
||||
finalData["user_id"] = user.id;
|
||||
finalData["password"] = datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
encryptionKey: process.env.DSQL_ENCRYPTION_PASSWORD || "",
|
||||
password: sanitizedReqBody.password
|
||||
});
|
||||
finalData["user_type"] = "database";
|
||||
finalData["email"] = sanitizedReqBody.email_address;
|
||||
finalData["image"] = "/images/user_images/user-preset.png";
|
||||
finalData["image_thumbnail"] = "/images/user_images/user-preset-thumbnail.png";
|
||||
delete finalData["email_address"];
|
||||
return finalData;
|
||||
})()
|
||||
});
|
||||
res.json({
|
||||
success: newUser?.insertId ? true : false,
|
||||
msg: "New User User Added",
|
||||
newUserId: newUser.insertId
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} else {
|
||||
if (user?.email === sanitizedReqBody.email_address) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Can't Invite yourself"
|
||||
});
|
||||
}
|
||||
const existingInvitation = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_4___default()(`SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?`, [
|
||||
sanitizedReqBody.email_address,
|
||||
user.id
|
||||
]);
|
||||
if (existingInvitation && existingInvitation[0]) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "User Already Invited"
|
||||
});
|
||||
}
|
||||
const newInvitation = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "invitations",
|
||||
data: {
|
||||
inviting_user_id: user.id,
|
||||
invited_user_email: sanitizedReqBody.email_address,
|
||||
database_access: sanitizedReqBody.database_access,
|
||||
priviledge: sanitizedReqBody.priviledge,
|
||||
db_tables_data: sanitizedReqBody.db_tables
|
||||
}
|
||||
});
|
||||
const sendInvitationMail = await _functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0___default()({
|
||||
to: sanitizedReqBody.email_address,
|
||||
subject: `${user.first_name} ${user.last_name} Invited you`,
|
||||
text: `${user.first_name} ${user.last_name} has invited you to manage a datasquirel account`,
|
||||
html: `
|
||||
<h2>${user.first_name} ${user.last_name} has invited you to manage a datasquirel account.</h2>
|
||||
<a href="${process.env.DSQL_HOST}/create-account?invite=${user.id}&database_access=${sanitizedReqBody.database_access}&priviledge=${sanitizedReqBody.priviledge}&email=${sanitizedReqBody.email_address}">Accept Invitation</a>
|
||||
`
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: sendInvitationMail?.accepted ? true : false,
|
||||
msg: "This is an invitation request"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,6825,3017,3403,7547,5886,5338,6926], () => (__webpack_exec__(9210)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,265 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 9372;
|
||||
exports.ids = [9372];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6517:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("lodash");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6109:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("sanitize-html");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2261:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("serverless-mysql");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4300:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("buffer");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2081:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("child_process");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6113:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7147:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("fs");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3685:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("http");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1017:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2066:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (/* binding */ handler)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2224);
|
||||
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2163);
|
||||
/* harmony import */ var _functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6825);
|
||||
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5338);
|
||||
/* harmony import */ var _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3__);
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/ const fs = __webpack_require__(7147);
|
||||
const path = __webpack_require__(1017);
|
||||
const { execSync } = __webpack_require__(2081);
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* API handler
|
||||
* ==============================================================================
|
||||
* @type {import("next").NextApiHandler}
|
||||
*/ async function handler(req, res) {
|
||||
/**
|
||||
* Check method
|
||||
*
|
||||
* @description Check request method and return if invalid
|
||||
*/ if (req.method !== "POST") return res.json({
|
||||
msg: "Failed!"
|
||||
});
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_2___default()(req, res, true);
|
||||
if (!user) {
|
||||
return res.json({
|
||||
success: false,
|
||||
msg: "Unauthorized"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* User auth
|
||||
*
|
||||
* @description Authenticate user
|
||||
*/ const sanitizedReqBody = req.body;
|
||||
const { dbFullName , dbSlug , dbId } = sanitizedReqBody;
|
||||
const userPreset = __webpack_require__(9258);
|
||||
const defaultFields = __webpack_require__(2439);
|
||||
const finalFields = [
|
||||
...defaultFields.slice(0, 2),
|
||||
...userPreset.fields,
|
||||
...defaultFields.slice(2),
|
||||
];
|
||||
userPreset.fields = [
|
||||
...finalFields
|
||||
];
|
||||
/**
|
||||
* Send Response
|
||||
*
|
||||
* @description Send a boolean response
|
||||
*/ try {
|
||||
/**
|
||||
* Create new user folder and file
|
||||
*
|
||||
* @description Create new user folder and file
|
||||
*/ const userSchemaMainFilePath = `./jsonData/dbSchemas/users/user-${user.id}/main.json`;
|
||||
/** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType[]} */ let userSchemaData = JSON.parse(fs.readFileSync(userSchemaMainFilePath, "utf8"));
|
||||
let targetDatabase = userSchemaData.filter((db)=>db.dbFullName === dbFullName)[0];
|
||||
/** @type {number | undefined} */ let existingTableIndex;
|
||||
let existingTable = targetDatabase.tables.filter((table, index)=>{
|
||||
if (table.tableName === "users") {
|
||||
existingTableIndex = index;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// if (typeof existingTableIndex !== "number")
|
||||
// return res.json({ success: false });
|
||||
if (existingTable?.[0] && typeof existingTableIndex == "number") {
|
||||
targetDatabase.tables[existingTableIndex] = userPreset;
|
||||
} else {
|
||||
targetDatabase.tables.push(userPreset);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Check Children Databases
|
||||
*
|
||||
* @description Check Children Databases
|
||||
*/ if (targetDatabase.childrenDatabases) {
|
||||
for(let i = 0; i < targetDatabase.childrenDatabases.length; i++){
|
||||
const childDb = targetDatabase.childrenDatabases[i];
|
||||
try {
|
||||
const targetChild = userSchemaData.filter((db)=>db.dbFullName === childDb.dbFullName)[0];
|
||||
targetChild.tables = targetDatabase.tables;
|
||||
const targetDbRecord = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default()(`SELECT * FROM user_databases WHERE user_id = ? AND db_full_name = ?`, [
|
||||
user.id,
|
||||
childDb.dbFullName
|
||||
]);
|
||||
const newChildTableEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_database_tables",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
db_id: targetDbRecord[0].id,
|
||||
db_slug: targetDbRecord[0].db_slug,
|
||||
table_name: "Users",
|
||||
table_slug: "users"
|
||||
}
|
||||
});
|
||||
} catch (/** @type {any} */ error) {
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
component: "/api/addUsersTableToDatabase/lines-100-115",
|
||||
message: error.message,
|
||||
user: user
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
fs.writeFileSync(`${userSchemaMainFilePath}`, JSON.stringify(userSchemaData), "utf8");
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
const newTableEntry = await _package_shared_functions_backend_db_addDbEntry__WEBPACK_IMPORTED_MODULE_3___default()({
|
||||
dbFullName: "datasquirel",
|
||||
tableName: "user_database_tables",
|
||||
data: {
|
||||
user_id: user.id,
|
||||
db_id: dbId,
|
||||
db_slug: dbSlug,
|
||||
table_name: "Users",
|
||||
table_slug: "users"
|
||||
}
|
||||
});
|
||||
////////////////////////////////////////
|
||||
const targetPath = path.join(process.cwd(), "/shell");
|
||||
const sanitizedDbName = dbFullName.replace(/[^a-z\_0-9]/g, "");
|
||||
const dbShellUpdate = execSync(`node createDbFromSchema.js --user ${user.id} --database ${sanitizedDbName}`, {
|
||||
cwd: targetPath
|
||||
});
|
||||
console.log(dbShellUpdate.toString());
|
||||
////////////////////////////////////////
|
||||
res.json({
|
||||
success: true
|
||||
});
|
||||
////////////////////////////////////////
|
||||
} catch (/** @type {any} */ error1) {
|
||||
////////////////////////////////////////
|
||||
_functions_backend_serverError__WEBPACK_IMPORTED_MODULE_1___default()({
|
||||
component: "/api/addUsersTableToDatabase/main-catch-error",
|
||||
message: error1.message,
|
||||
user: user
|
||||
});
|
||||
res.json({
|
||||
success: false,
|
||||
msg: "Database Files could not be written!"
|
||||
});
|
||||
////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2439:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = JSON.parse('[{"fieldName":"id","dataType":"BIGINT","notNullValue":true,"primaryKey":true,"autoIncrement":true},{"fieldName":"uuid","dataType":"UUID","defaultValueLiteral":"UUID()"},{"fieldName":"date_created","dataType":"VARCHAR(250)","nullValue":true},{"fieldName":"date_created_code","dataType":"BIGINT","nullValue":true},{"fieldName":"date_created_timestamp","dataType":"TIMESTAMP","defaultValueLiteral":"CURRENT_TIMESTAMP"},{"fieldName":"date_updated","dataType":"VARCHAR(250)","nullValue":true},{"fieldName":"date_updated_code","dataType":"BIGINT","nullValue":true},{"fieldName":"date_updated_timestamp","dataType":"TIMESTAMP","defaultValueLiteral":"CURRENT_TIMESTAMP","onUpdateLiteral":"CURRENT_TIMESTAMP"}]');
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
|
||||
// load runtime
|
||||
var __webpack_require__ = require("../../webpack-api-runtime.js");
|
||||
__webpack_require__.C(exports);
|
||||
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
|
||||
var __webpack_exports__ = __webpack_require__.X(0, [5425,2224,2163,6825,3017,3403,7547,5886,5338,9258], () => (__webpack_exec__(2066)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user