diff --git a/.gitignore b/.gitignore index f0bf4d8..cc84e42 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ uploads/* !.gitkeep docker-compose.override.yml -out/ \ No newline at end of file +out/ +out.zip +debug.log \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..63f0717 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "attach", + "name": "Attach by Process ID", + "processId": "${command:PickProcess}" + }, + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\" + } + ] +} \ No newline at end of file diff --git a/frontend/.editorconfig b/frontend/.editorconfig new file mode 100644 index 0000000..4a7ea30 --- /dev/null +++ b/frontend/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..3c0d0bb --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,29 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +release +.vscode/.debug.env +package-lock.json +pnpm-lock.yaml +yarn.lock +dist-electron diff --git a/frontend/.vscode/.debug.script.mjs b/frontend/.vscode/.debug.script.mjs new file mode 100644 index 0000000..ade3e79 --- /dev/null +++ b/frontend/.vscode/.debug.script.mjs @@ -0,0 +1,24 @@ +import fs from 'fs' +import path from 'path' +import { fileURLToPath } from 'url' +import { createRequire } from 'module' +import { spawn } from 'child_process' + +const __dirname = path.dirname(fileURLToPath(import.meta.url)) +const require = createRequire(import.meta.url) +const pkg = require('../package.json') + +// write .debug.env +const envContent = Object.entries(pkg.debug.env).map(([key, val]) => `${key}=${val}`) +fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n')) + +// bootstrap +spawn( + // TODO: terminate `npm run dev` when Debug exits. + process.platform === 'win32' ? 'npm.cmd' : 'npm', + ['run', 'dev'], + { + stdio: 'inherit', + env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }), + }, +) diff --git a/frontend/.vscode/extensions.json b/frontend/.vscode/extensions.json new file mode 100644 index 0000000..47466d4 --- /dev/null +++ b/frontend/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "editorconfig.editorconfig", + "mrmlnc.vscode-json5", + "rbbit.typescript-hero", + "syler.sass-indented", + ] +} diff --git a/frontend/.vscode/launch.json b/frontend/.vscode/launch.json new file mode 100644 index 0000000..e7aefc2 --- /dev/null +++ b/frontend/.vscode/launch.json @@ -0,0 +1,54 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "compounds": [ + { + "name": "Debug App", + "preLaunchTask": "start .debug.script.mjs", + "configurations": [ + "Debug Main Process", + "Debug Renderer Process" + ], + "presentation": { + "hidden": false, + "group": "", + "order": 1 + }, + "stopAll": true + } + ], + "configurations": [ + { + "name": "Debug Main Process", + "type": "pwa-node", + "request": "launch", + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", + "windows": { + "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" + }, + "runtimeArgs": [ + "--no-sandbox", + "--remote-debugging-port=9229", + "." + ], + "envFile": "${workspaceFolder}/.vscode/.debug.env", + "console": "integratedTerminal" + }, + { + "name": "Debug Renderer Process", + "port": 9229, + "request": "attach", + "type": "pwa-chrome", + "timeout": 60000, + "skipFiles": [ + "/**", + "${workspaceRoot}/node_modules/**", + "${workspaceRoot}/dist-electron/**", + // Skip files in host(VITE_DEV_SERVER_URL) + "http://127.0.0.1:7777/**" + ] + }, + ] +} diff --git a/frontend/.vscode/tasks.json b/frontend/.vscode/tasks.json new file mode 100644 index 0000000..7ee1598 --- /dev/null +++ b/frontend/.vscode/tasks.json @@ -0,0 +1,35 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "start .debug.script.mjs", + "type": "shell", + "command": "node .vscode/.debug.script.mjs", + "isBackground": true, + "problemMatcher": { + "owner": "typescript", + "fileLocation": "relative", + "pattern": { + // TODO: correct "regexp" + "regexp": "^([a-zA-Z]\\:\/?([\\w\\-]\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$", + "file": 1, + "line": 3, + "column": 4, + "code": 5, + "message": 6 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "^.*VITE v.* ready in \\d* ms.*$", + "endsPattern": "^.*\\[startup\\] Electron App.*$" + } + } + } + ] +} + +// https://code.visualstudio.com/docs/editor/tasks#_operating-system-specific-properties +// https://code.visualstudio.com/docs/editor/tasks#_background-watching-tasks +// https://code.visualstudio.com/docs/editor/tasks#_can-a-background-task-be-used-as-a-prelaunchtask-in-launchjson diff --git a/frontend/LICENSE b/frontend/LICENSE new file mode 100644 index 0000000..8fd5175 --- /dev/null +++ b/frontend/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 草鞋没号 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..c754e81 --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,81 @@ +# electron-vite-react + +[![awesome-vite](https://awesome.re/mentioned-badge.svg)](https://github.com/vitejs/awesome-vite) +![GitHub stars](https://img.shields.io/github/stars/caoxiemeihao/vite-react-electron?color=fa6470) +![GitHub issues](https://img.shields.io/github/issues/caoxiemeihao/vite-react-electron?color=d8b22d) +![GitHub license](https://img.shields.io/github/license/caoxiemeihao/vite-react-electron) +[![Required Node.JS >= 14.18.0 || >=16.0.0](https://img.shields.io/static/v1?label=node&message=14.18.0%20||%20%3E=16.0.0&logo=node.js&color=3f893e)](https://nodejs.org/about/releases) + +English | [简体中文](README.zh-CN.md) + +## 👀 Overview + +📦 Ready out of the box +🎯 Based on the official [template-react-ts](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts), project structure will be familiar to you +🌱 Easily extendable and customizable +💪 Supports Node.js API in the renderer process +🔩 Supports C/C++ native addons +🐞 Debugger configuration included +🖥 Easy to implement multiple windows + +## 🛫 Quick start + +```sh +npm create electron-vite +``` + +![electron-vite-react.gif](https://github.com/electron-vite/electron-vite-react/blob/main/public/electron-vite-react.gif?raw=true) + +## 🐞 Debug + +![electron-vite-react-debug.gif](https://github.com/electron-vite/electron-vite-react/blob/main/public/electron-vite-react-debug.gif?raw=true) + +## 📂 Directory structure + +Familiar React application structure, just with `electron` folder on the top :wink: +*Files in this folder will be separated from your React application and built into `dist/electron`* + +```tree +├── electron Electron-related code +│ ├── main Main-process source code +│ ├── preload Preload-scripts source code +│ └── resources Resources for the production build +│ ├── icon.icns Icon for the application on macOS +│ ├── icon.ico Icon for the application +│ ├── installerIcon.ico Icon for the application installer +│ ├── uninstallerIcon.ico Icon for the application uninstaller +| └── iconset +| └── 256x256.png Icon for the application on Linux +│ +├── release Generated after production build, contains executables +│ └── {version} +│ ├── {os}-unpacked Contains unpacked application executable +│ └── Setup.{ext} Installer for the application +│ +├── public Static assets +└── src Renderer source code, your React application +``` + +## 🚨 Be aware + +This template integrates Node.js API to the renderer process by default. If you want to follow **Electron Security Concerns** you might want to disable this feature. You will have to expose needed API by yourself. + +To get started, remove the option as shown below. This will [modify the Vite configuration and disable this feature](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#config-presets-opinionated). + +```diff +# vite.config.ts + +export default { + plugins: [ +- // Use Node.js API in the Renderer-process +- renderer({ +- nodeIntegration: true, +- }), + ], +} +``` + +## ❔ FAQ + +- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies) +- [C/C++ addons, Node.js modules - Pre-Bundling](https://github.com/electron-vite/vite-plugin-electron-renderer#dependency-pre-bundling) diff --git a/frontend/README.zh-CN.md b/frontend/README.zh-CN.md new file mode 100644 index 0000000..b3df3dc --- /dev/null +++ b/frontend/README.zh-CN.md @@ -0,0 +1,75 @@ +# vite-react-electron + +[![awesome-vite](https://awesome.re/mentioned-badge.svg)](https://github.com/vitejs/awesome-vite) +![GitHub stars](https://img.shields.io/github/stars/caoxiemeihao/vite-react-electron?color=fa6470) +![GitHub issues](https://img.shields.io/github/issues/caoxiemeihao/vite-react-electron?color=d8b22d) +![GitHub license](https://img.shields.io/github/license/caoxiemeihao/vite-react-electron) +[![Required Node.JS >= 14.18.0 || >=16.0.0](https://img.shields.io/static/v1?label=node&message=14.18.0%20||%20%3E=16.0.0&logo=node.js&color=3f893e)](https://nodejs.org/about/releases) + +[English](README.md) | 简体中文 + +## 概述 + +📦 开箱即用 +🎯 基于官方的 [template-react-ts](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts), 低侵入性 +🌱 结构清晰,可塑性强 +💪 支持在渲染进程中使用 Electron、Node.js API +🔩 支持 C/C++ 模块 +🖥 很容易实现多窗口 + +## 快速开始 + +```sh +npm create electron-vite +``` + +![electron-vite-react.gif](https://github.com/electron-vite/electron-vite-react/blob/main/public/electron-vite-react.gif?raw=true) + +## 调试 + +![electron-vite-react-debug.gif](https://github.com/electron-vite/electron-vite-react/blob/main/public/electron-vite-react-debug.gif?raw=true) + +## 目录 + +*🚨 默认情况下, `electron` 文件夹下的文件将会被构建到 `dist/electron`* + +```tree +├── electron Electron 源码文件夹 +│ ├── main Main-process 源码 +│ ├── preload Preload-scripts 源码 +│ └── resources 应用打包的资源文件夹 +│ ├── icon.icns 应用图标(macOS) +│ ├── icon.ico 应用图标 +│ ├── installerIcon.ico 安装图标 +│ └── uninstallerIcon.ico 卸载图标 +│ +├── release 构建后生成程序目录 +│ └── {version} +│ ├── {os}-unpacked 未打包的程序(绿色运行版) +│ └── Setup.{ext} 应用安装文件 +│ +├── public 同 Vite 模板的 public +└── src 渲染进程源码、React代码 +``` + + +## 🚨 这需要留神 + +默认情况下,该模板在渲染进程中集成了 Node.js,如果你不需要它,你只需要删除下面的选项. [因为它会修改 Vite 默认的配置](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#config-presets-opinionated). + +```diff +# vite.config.ts + +electron({ +- renderer: {} +}) +``` + +## FAQ + +- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies) +- [C/C++ addons, Node.js modules - Pre-Bundling](https://github.com/electron-vite/vite-plugin-electron-renderer#dependency-pre-bundling) + +## 🍵 🍰 🍣 🍟 + + diff --git a/frontend/electron-builder.json5 b/frontend/electron-builder.json5 new file mode 100644 index 0000000..80c81c1 --- /dev/null +++ b/frontend/electron-builder.json5 @@ -0,0 +1,41 @@ +/** + * @see https://www.electron.build/configuration/configuration + */ +{ + appId: "YourAppID", + productName: "YourAppName", + copyright: "Copyright © 2022 ${author}", + asar: true, + directories: { + output: "release/${version}", + buildResources: "electron/resources", + }, + files: [ + "dist-electron", + "dist" + ], + win: { + target: [ + { + target: "nsis", + arch: ["x64"], + }, + ], + artifactName: "${productName}-Windows-${version}-Setup.${ext}", + }, + nsis: { + oneClick: false, + perMachine: false, + allowToChangeInstallationDirectory: true, + deleteAppDataOnUninstall: false, + }, + mac: { + target: ["dmg"], + artifactName: "${productName}-Mac-${version}-Installer.${ext}", + }, + linux: { + icon: "electron/resources/iconset", + target: ["AppImage", "deb"], + artifactName: "${productName}-Linux-${version}.${ext}", + }, +} diff --git a/frontend/electron/electron-env.d.ts b/frontend/electron/electron-env.d.ts new file mode 100644 index 0000000..3b33998 --- /dev/null +++ b/frontend/electron/electron-env.d.ts @@ -0,0 +1,11 @@ +/// + +declare namespace NodeJS { + interface ProcessEnv { + VSCODE_DEBUG?: 'true' + DIST_ELECTRON: string + DIST: string + /** /dist/ or /public/ */ + PUBLIC: string + } +} diff --git a/frontend/electron/main/index.ts b/frontend/electron/main/index.ts new file mode 100644 index 0000000..8f0c0f7 --- /dev/null +++ b/frontend/electron/main/index.ts @@ -0,0 +1,106 @@ +// The built directory structure +// +// ├─┬ dist-electron +// │ ├─┬ main +// │ │ └── index.js > Electron-Main +// │ └─┬ preload +// │ └── index.js > Preload-Scripts +// ├─┬ dist +// │ └── index.html > Electron-Renderer +// +process.env.DIST_ELECTRON = join(__dirname, '../..') +process.env.DIST = join(process.env.DIST_ELECTRON, '../dist') +process.env.PUBLIC = app.isPackaged ? process.env.DIST : join(process.env.DIST_ELECTRON, '../public') + +import { app, BrowserWindow, shell, ipcMain } from 'electron' +import { release } from 'os' +import { join } from 'path' + +// Disable GPU Acceleration for Windows 7 +if (release().startsWith('6.1')) app.disableHardwareAcceleration() + +// Set application name for Windows 10+ notifications +if (process.platform === 'win32') app.setAppUserModelId(app.getName()) + +if (!app.requestSingleInstanceLock()) { + app.quit() + process.exit(0) +} + +let win: BrowserWindow | null = null +// Here, you can also use other preload +const preload = join(__dirname, '../preload/index.js') +const url = process.env.VITE_DEV_SERVER_URL +const indexHtml = join(process.env.DIST, 'index.html') + +async function createWindow() { + win = new BrowserWindow({ + title: 'Main window', + icon: join(process.env.PUBLIC, 'favicon.svg'), + webPreferences: { + preload, + nodeIntegration: true, + contextIsolation: false, + }, + }) + + if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298 + win.loadURL(url) + // Open devTool if the app is not packaged + win.webContents.openDevTools() + } else { + win.loadFile(indexHtml) + } + + // Test actively push message to the Electron-Renderer + win.webContents.on('did-finish-load', () => { + win?.webContents.send('main-process-message', new Date().toLocaleString()) + }) + + // Make all links open with the browser, not with the application + win.webContents.setWindowOpenHandler(({ url }) => { + if (url.startsWith('https:')) shell.openExternal(url) + return { action: 'deny' } + }) +} + +app.whenReady().then(createWindow) + +app.on('window-all-closed', () => { + win = null + if (process.platform !== 'darwin') app.quit() +}) + +app.on('second-instance', () => { + if (win) { + // Focus on the main window if the user tried to open another + if (win.isMinimized()) win.restore() + win.focus() + } +}) + +app.on('activate', () => { + const allWindows = BrowserWindow.getAllWindows() + if (allWindows.length) { + allWindows[0].focus() + } else { + createWindow() + } +}) + +// new window example arg: new windows url +ipcMain.handle('open-win', (event, arg) => { + const childWindow = new BrowserWindow({ + webPreferences: { + preload, + nodeIntegration: true, + contextIsolation: false, + }, + }) + + if (process.env.VITE_DEV_SERVER_URL) { + childWindow.loadURL(`${url}#${arg}`) + } else { + childWindow.loadFile(indexHtml, { hash: arg }) + } +}) diff --git a/frontend/electron/preload/index.ts b/frontend/electron/preload/index.ts new file mode 100644 index 0000000..0ee2dcc --- /dev/null +++ b/frontend/electron/preload/index.ts @@ -0,0 +1,92 @@ +function domReady(condition: DocumentReadyState[] = ['complete', 'interactive']) { + return new Promise(resolve => { + if (condition.includes(document.readyState)) { + resolve(true) + } else { + document.addEventListener('readystatechange', () => { + if (condition.includes(document.readyState)) { + resolve(true) + } + }) + } + }) +} + +const safeDOM = { + append(parent: HTMLElement, child: HTMLElement) { + if (!Array.from(parent.children).find(e => e === child)) { + return parent.appendChild(child) + } + }, + remove(parent: HTMLElement, child: HTMLElement) { + if (Array.from(parent.children).find(e => e === child)) { + return parent.removeChild(child) + } + }, +} + +/** + * https://tobiasahlin.com/spinkit + * https://connoratherton.com/loaders + * https://projects.lukehaas.me/css-loaders + * https://matejkustec.github.io/SpinThatShit + */ +function useLoading() { + const className = `loaders-css__square-spin` + const styleContent = ` +@keyframes square-spin { + 25% { transform: perspective(100px) rotateX(180deg) rotateY(0); } + 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); } + 75% { transform: perspective(100px) rotateX(0) rotateY(180deg); } + 100% { transform: perspective(100px) rotateX(0) rotateY(0); } +} +.${className} > div { + animation-fill-mode: both; + width: 50px; + height: 50px; + background: #fff; + animation: square-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite; +} +.app-loading-wrap { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + display: flex; + align-items: center; + justify-content: center; + background: #282c34; + z-index: 9; +} + ` + const oStyle = document.createElement('style') + const oDiv = document.createElement('div') + + oStyle.id = 'app-loading-style' + oStyle.innerHTML = styleContent + oDiv.className = 'app-loading-wrap' + oDiv.innerHTML = `
` + + return { + appendLoading() { + safeDOM.append(document.head, oStyle) + safeDOM.append(document.body, oDiv) + }, + removeLoading() { + safeDOM.remove(document.head, oStyle) + safeDOM.remove(document.body, oDiv) + }, + } +} + +// ---------------------------------------------------------------------- + +const { appendLoading, removeLoading } = useLoading() +domReady().then(appendLoading) + +window.onmessage = ev => { + ev.data.payload === 'removeLoading' && removeLoading() +} + +setTimeout(removeLoading, 4999) diff --git a/frontend/electron/resources/icon.icns b/frontend/electron/resources/icon.icns new file mode 100644 index 0000000..9a9c785 Binary files /dev/null and b/frontend/electron/resources/icon.icns differ diff --git a/frontend/electron/resources/icon.ico b/frontend/electron/resources/icon.ico new file mode 100644 index 0000000..bf153e1 Binary files /dev/null and b/frontend/electron/resources/icon.ico differ diff --git a/frontend/electron/resources/iconset/256x256.png b/frontend/electron/resources/iconset/256x256.png new file mode 100644 index 0000000..4526115 Binary files /dev/null and b/frontend/electron/resources/iconset/256x256.png differ diff --git a/frontend/electron/resources/installerIcon.ico b/frontend/electron/resources/installerIcon.ico new file mode 100644 index 0000000..bf153e1 Binary files /dev/null and b/frontend/electron/resources/installerIcon.ico differ diff --git a/frontend/electron/resources/uninstallerIcon.ico b/frontend/electron/resources/uninstallerIcon.ico new file mode 100644 index 0000000..bf153e1 Binary files /dev/null and b/frontend/electron/resources/uninstallerIcon.ico differ diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..4874016 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,14 @@ + + + + + + + + Vite App + + +
+ + + diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..16b4cd9 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,41 @@ +{ + "name": "electron-vite-react", + "productName": "Electron", + "private": true, + "version": "2.1.0", + "description": "Vite React Electron boilerplate.", + "author": "草鞋没号 <308487730@qq.com>", + "license": "MIT", + "main": "dist-electron/electron/main/index.js", + "scripts": { + "dev": "vite", + "build": "tsc && vite build && electron-builder" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "dependencies": { + "@emotion/react": "^11.10.5", + "@mantine/core": "^5.8.4", + "@mantine/hooks": "^5.8.4" + }, + "devDependencies": { + "@types/react": "^18.0.25", + "@types/react-dom": "^18.0.9", + "@vitejs/plugin-react": "^2.2.0", + "electron": "^21.3.1", + "electron-builder": "^23.6.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.56.1", + "typescript": "^4.9.3", + "vite": "^3.2.4", + "vite-electron-plugin": "^0.5.2", + "vite-plugin-electron-renderer": "^0.11.3" + }, + "debug": { + "env": { + "VITE_DEV_SERVER_URL": "http://127.0.0.1:7777" + } + } +} diff --git a/frontend/public/electron-vite-react-debug.gif b/frontend/public/electron-vite-react-debug.gif new file mode 100644 index 0000000..4f87992 Binary files /dev/null and b/frontend/public/electron-vite-react-debug.gif differ diff --git a/frontend/public/electron-vite-react.gif b/frontend/public/electron-vite-react.gif new file mode 100644 index 0000000..a4b5da5 Binary files /dev/null and b/frontend/public/electron-vite-react.gif differ diff --git a/frontend/public/electron.png b/frontend/public/electron.png new file mode 100644 index 0000000..45c8adb Binary files /dev/null and b/frontend/public/electron.png differ diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg new file mode 100644 index 0000000..de4aedd --- /dev/null +++ b/frontend/public/favicon.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/frontend/public/node.png b/frontend/public/node.png new file mode 100644 index 0000000..1cd6519 Binary files /dev/null and b/frontend/public/node.png differ diff --git a/frontend/public/react.svg b/frontend/public/react.svg new file mode 100644 index 0000000..6b60c10 --- /dev/null +++ b/frontend/public/react.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/frontend/public/vite.svg b/frontend/public/vite.svg new file mode 100644 index 0000000..6471ae0 --- /dev/null +++ b/frontend/public/vite.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx new file mode 100644 index 0000000..8fb4043 --- /dev/null +++ b/frontend/src/App.tsx @@ -0,0 +1,73 @@ +import { useState } from 'react' +import styles from 'styles/app.module.scss' + +const App: React.FC = () => { + const [count, setCount] = useState(0) + + return ( +
+
+
+
+ electron +
+
+ vite +
+
+ logo +
+
+

Hello Electron + Vite + React!

+

+ +

+

+ Edit App.tsx and save to test HMR updates. +

+
+ + Learn React + + {' | '} + + Vite Docs + +
+ Place static files into the{' '} + /public folder + +
+
+
+
+ ) +} + +export default App diff --git a/frontend/src/assets/styles/app.module.scss b/frontend/src/assets/styles/app.module.scss new file mode 100644 index 0000000..7edf79a --- /dev/null +++ b/frontend/src/assets/styles/app.module.scss @@ -0,0 +1,65 @@ +.app { + text-align: center; + + .appHeader { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; + + .logos { + display: flex; + box-sizing: border-box; + align-items: center; + padding: 0 5vw; + width: 100%; + + .imgBox { + width: 33.33%; + + .appLogo { + pointer-events: none; + } + + @media (prefers-reduced-motion: no-preference) { + .appLogo { + animation: App-logo-spin infinite 20s linear; + } + @keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } + } + } + } + } + + button { + font-size: calc(10px + 2vmin); + } + + .appLink { + color: #61dafb; + } + + .staticPublic { + display: flex; + align-items: center; + + code { + padding: 4px 7px; + margin: 0 4px; + border-radius: 4px; + background-color: rgb(30, 30, 30, .7); + font-size: 13px; + } + } + } +} diff --git a/frontend/src/assets/styles/index.css b/frontend/src/assets/styles/index.css new file mode 100644 index 0000000..ec2585e --- /dev/null +++ b/frontend/src/assets/styles/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + monospace; +} diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx new file mode 100644 index 0000000..412bad4 --- /dev/null +++ b/frontend/src/main.tsx @@ -0,0 +1,13 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App' +import './samples/node-api' +import 'styles/index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + +) + +postMessage({ payload: 'removeLoading' }, '*') diff --git a/frontend/src/samples/node-api.ts b/frontend/src/samples/node-api.ts new file mode 100644 index 0000000..db31e5f --- /dev/null +++ b/frontend/src/samples/node-api.ts @@ -0,0 +1,13 @@ +import { lstat } from 'fs/promises' +import { cwd } from 'process' +import { ipcRenderer } from 'electron' + +ipcRenderer.on('main-process-message', (_event, ...args) => { + console.log('[Receive Main-process message]:', ...args) +}) + +lstat(cwd()).then(stats => { + console.log('[fs.lstat]', stats) +}).catch(err => { + console.error(err) +}) diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/frontend/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json new file mode 100644 index 0000000..c81e322 --- /dev/null +++ b/frontend/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "target": "ESNext", + "useDefineForClassFields": true, + "lib": ["DOM", "DOM.Iterable", "ESNext"], + "paths": { + "@/*": ["src/*"], + "styles/*": ["src/assets/styles/*"] + }, + "allowJs": false, + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "ESNext", + "moduleResolution": "Node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} + diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json new file mode 100644 index 0000000..1eb1b76 --- /dev/null +++ b/frontend/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true + }, + "include": ["package.json", "electron"] +} diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..6692bda --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,62 @@ +import { rmSync } from 'fs' +import path from 'path' +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' +import electron from 'vite-electron-plugin' +import { customStart, loadViteEnv } from 'vite-electron-plugin/plugin' +import renderer from 'vite-plugin-electron-renderer' +import pkg from './package.json' + +rmSync(path.join(__dirname, 'dist-electron'), { recursive: true, force: true }) + +// https://vitejs.dev/config/ +export default defineConfig({ + resolve: { + alias: { + '@': path.join(__dirname, 'src'), + 'styles': path.join(__dirname, 'src/assets/styles'), + }, + }, + plugins: [ + react(), + electron({ + include: [ + 'electron', + 'preload', + ], + transformOptions: { + sourcemap: !!process.env.VSCODE_DEBUG, + }, + plugins: [ + ...(process.env.VSCODE_DEBUG + ? [ + // Will start Electron via VSCode Debug + customStart(debounce(() => console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App'))), + ] + : []), + // Allow use `import.meta.env.VITE_SOME_KEY` in Electron-Main + loadViteEnv(), + ], + }), + // Use Node.js API in the Renderer-process + renderer({ + nodeIntegration: true, + }), + ], + server: process.env.VSCODE_DEBUG ? (() => { + const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL) + return { + host: url.hostname, + port: +url.port, + } + })() : undefined, + clearScreen: false, +}) + +function debounce void>(fn: Fn, delay = 299) { + let t: NodeJS.Timeout + return ((...args) => { + clearTimeout(t) + t = setTimeout(() => fn(...args), delay) + }) as Fn +} diff --git a/getListMembers.js b/getListMembers.js new file mode 100644 index 0000000..3a265ea --- /dev/null +++ b/getListMembers.js @@ -0,0 +1,37 @@ + +var Mailgun = require('mailgun-js'); +var json2csv = require('json2csv'); + + +var apiKey = '4a3e61c20c5a43e82c2ac9ce349e6aa4-2de3d545-31866b1f'; +var domain = 'sandbox7c5e141eccf7446c83f519e64d6ae781.mailgun.org'; + + +var mailgun = new Mailgun({ apiKey: apiKey, domain: domain }); + +var mailing_list = []; +var mailing_options = ""; +mailgun.get('/lists/pages', function (error, body) { + mailing_options = ""; + for (let item of body.items) { + mailing_list.push({ name: item.name, email: item.address }); + mailing_options += ``; + } + console.log('Get pages /lists/pages', mailing_list); +}); + +// oshanetest +// testoshane@sandbox7c5e141eccf7446c83f519e64d6ae781.mailgun.org + +mailgun.get('/lists/testoshane@sandbox7c5e141eccf7446c83f519e64d6ae781.mailgun.org', function (error, body) { + console.log('Get /lists/testoshane@sandbox7c5e141eccf7446c83f519e64d6ae781.mailgun.org', body); +}); + + + +mailgun.get('/lists/testoshane@sandbox7c5e141eccf7446c83f519e64d6ae781.mailgun.org/members', function (error, body) { + console.log('Get Members', body); + var fields = ['address', 'name', 'subscribed']; + var data = json2csv.parse(body.items, { fields }); + console.log("CSV Output", data); +}); diff --git a/package-lock.json b/package-lock.json index 0e753b9..4e2f73d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,19 +9,29 @@ "version": "0.0.0", "dependencies": { "body-parser": "^1.19.0", - "cookie-parser": "^1.4.5", + "convert-csv-to-json": "^1.4.0", + "cookie-parser": "^1.4.6", + "csv-parse": "^5.3.2", + "csvtojson": "^2.0.10", "electron-squirrel-startup": "^1.0.0", "express": "^4.17.1", "express-fileupload": "^1.2.1", "express-session": "^1.17.2", + "flat": "^5.0.2", + "form-data": "^4.0.0", "html-to-text": "^8.0.0", "jquery": "^3.6.0", + "jsdom": "^21.1.0", + "json2csv": "^5.0.7", "mailgun-js": "^0.22.0", + "mailgun.js": "^8.0.6", "md5": "^2.3.0", "mime-types": "^2.1.32", - "multer": "^1.4.3", + "multer": "^1.4.4", + "node-html-parser": "^6.1.4", "pug": "^3.0.2", - "tinymce": "^5.8.2" + "tinymce": "^5.8.2", + "uuid": "^9.0.0" }, "devDependencies": { "@electron-forge/cli": "^6.0.0-beta.66", @@ -29,7 +39,8 @@ "@electron-forge/maker-rpm": "^6.0.0-beta.66", "@electron-forge/maker-squirrel": "^6.0.0-beta.66", "@electron-forge/maker-zip": "^6.0.0-beta.66", - "electron": "^21.0.1" + "electron": "^21.0.1", + "nodemon": "^2.0.20" } }, "node_modules/@babel/helper-validator-identifier": { @@ -1792,7 +1803,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true, "engines": { "node": ">= 10" } @@ -1877,6 +1887,11 @@ "@types/node": "*" } }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -1906,6 +1921,34 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, + "node_modules/acorn-globals/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -2018,6 +2061,19 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -2172,6 +2228,15 @@ "node": ">=0.8" } }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "node_modules/babel-walk": { "version": "3.0.0-canary-5", "resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz", @@ -2189,6 +2254,11 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base-64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", + "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -2209,6 +2279,15 @@ } ] }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -2272,8 +2351,7 @@ "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "node_modules/body-parser": { "version": "1.19.0", @@ -2295,6 +2373,11 @@ "node": ">= 0.8" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, "node_modules/boolean": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", @@ -2599,6 +2682,33 @@ "node": "*" } }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -2850,6 +2960,11 @@ "node": ">= 0.6" } }, + "node_modules/convert-csv-to-json": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/convert-csv-to-json/-/convert-csv-to-json-1.4.0.tgz", + "integrity": "sha512-oIW5geW3MzNaVj8959m4Zgr2QMcnF7/ap+oIiHu47mtv8Fz1jaV643eEpZSzvTY9hfc508HRXUtEHKp1nw01Vg==" + }, "node_modules/cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", @@ -2859,17 +2974,25 @@ } }, "node_modules/cookie-parser": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", - "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", "dependencies": { - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6" }, "engines": { "node": ">= 0.8.0" } }, + "node_modules/cookie-parser/node_modules/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", @@ -2971,6 +3094,136 @@ "node": "*" } }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-select/node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/css-select/node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/css-select/node_modules/domutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", + "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/css-select/node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + }, + "node_modules/csv-parse": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.2.tgz", + "integrity": "sha512-3jQ/JMs+voKxr4vwpmElS1d37J0o6rQdQyEKoPyA9HG8fYczpLaBJnmp5ykvkXL8ZeEGVP0qwLU645BZVykXKw==" + }, + "node_modules/csvtojson": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/csvtojson/-/csvtojson-2.0.10.tgz", + "integrity": "sha512-lUWFxGKyhraKCW8Qghz6Z0f2l/PqB1W3AO0HKJzGIQ5JRSlR651ekJDiGJbBT4sRNNv5ddnSGVEnsxP9XRCVpQ==", + "dependencies": { + "bluebird": "^3.5.1", + "lodash": "^4.17.3", + "strip-bom": "^2.0.0" + }, + "bin": { + "csvtojson": "bin/csvtojson" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/csvtojson/node_modules/strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/cuint": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", @@ -2983,6 +3236,50 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz", "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==" }, + "node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/data-urls/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -3001,6 +3298,11 @@ "node": ">=0.10.0" } }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" + }, "node_modules/decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -3195,9 +3497,9 @@ } }, "node_modules/domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", "funding": [ { "type": "github", @@ -3205,6 +3507,25 @@ } ] }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/domexception/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, "node_modules/domhandler": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", @@ -5042,6 +5363,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "bin": { + "flat": "cli.js" + } + }, "node_modules/flora-colossus": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-1.0.1.tgz", @@ -5092,17 +5421,36 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", + "combined-stream": "^1.0.8", "mime-types": "^2.1.12" }, "engines": { - "node": ">= 0.12" + "node": ">= 6" } }, "node_modules/forwarded": { @@ -5153,6 +5501,20 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/ftp": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", @@ -5644,6 +6006,17 @@ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/html-to-text": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.0.0.tgz", @@ -5800,6 +6173,12 @@ } ] }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -5898,6 +6277,18 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -5992,6 +6383,11 @@ "node": ">=0.12.0" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" + }, "node_modules/is-promise": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", @@ -6032,6 +6428,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -6086,6 +6487,190 @@ "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=" }, + "node_modules/jsdom": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", + "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/jsdom/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/jsdom/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/escodegen": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", + "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/jsdom/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/jsdom/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/jsdom/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -6099,6 +6684,31 @@ "dev": true, "optional": true }, + "node_modules/json2csv": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/json2csv/-/json2csv-5.0.7.tgz", + "integrity": "sha512-YRZbUnyaJZLZUJSRi2G/MqahCyRv9n/ds+4oIetjDF3jWQA7AG7iSeKTiZiCNqtMZM7HDyt0e/W6lEnoGEmMGA==", + "dependencies": { + "commander": "^6.1.0", + "jsonparse": "^1.3.1", + "lodash.get": "^4.4.2" + }, + "bin": { + "json2csv": "bin/json2csv.js" + }, + "engines": { + "node": ">= 10", + "npm": ">= 6.13.0" + } + }, + "node_modules/json2csv/node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "engines": { + "node": ">= 6" + } + }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -6108,6 +6718,14 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ] + }, "node_modules/jstransformer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", @@ -6201,8 +6819,7 @@ "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" }, "node_modules/lodash.template": { "version": "4.5.0", @@ -6355,11 +6972,34 @@ } } }, + "node_modules/mailgun-js/node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/mailgun-js/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/mailgun.js": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-8.0.6.tgz", + "integrity": "sha512-b+c7QO1T4oFsudEcRB2H7oZKth8ZDeYRW4xjW12QQVNYDSJCVxqSQfps6ofcH8fqcCMJdzc76HVNGdnUZgBPCw==", + "dependencies": { + "axios": "^0.27.2", + "base-64": "^1.0.0", + "url-join": "^4.0.1" + } + }, "node_modules/make-fetch-happen": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", @@ -6782,9 +7422,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/multer": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.3.tgz", - "integrity": "sha512-np0YLKncuZoTzufbkM6wEKp68EhWJXcU6fq6QqrSwkckd2LlMgd1UqhUJLj6NS/5sZ8dE8LYDWslsltJznnXlg==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz", + "integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==", "deprecated": "Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.", "dependencies": { "append-field": "^1.0.0", @@ -7021,15 +7661,97 @@ "semver": "bin/semver.js" }, "engines": { - "node": ">=10" + "node": ">=10" + } + }, + "node_modules/node-gyp/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/node-html-parser": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-6.1.4.tgz", + "integrity": "sha512-3muP9Uy/Pz7bQa9TNYVQzWJhNZMqyCx7xJle8kz2/y1UgzAUyXXShc1IcPaJy6u07CE3K5rQcRwlvHzmlySRjg==", + "dependencies": { + "css-select": "^5.1.0", + "he": "1.2.0" + } + }, + "node_modules/nodemon": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", + "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/node-gyp/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -7066,6 +7788,15 @@ "semver": "bin/semver" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/normalize-url": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", @@ -7125,6 +7856,22 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/nwsapi": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", + "integrity": "sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw==" + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -7431,6 +8178,28 @@ "node": ">=0.10.0" } }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/parseley": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/parseley/-/parseley-0.7.0.tgz", @@ -7777,6 +8546,17 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/pug": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/pug/-/pug-3.0.2.tgz", @@ -7899,6 +8679,14 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", @@ -7907,6 +8695,11 @@ "node": ">=0.6" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -8103,6 +8896,18 @@ "string_decoder": "~0.10.x" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -8119,6 +8924,11 @@ "dev": true, "optional": true }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "node_modules/resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -8296,6 +9106,17 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/selderee": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/selderee/-/selderee-0.6.0.tgz", @@ -8419,6 +9240,27 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-update-notifier": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.8.tgz", + "integrity": "sha512-KPXw773wEyrIIhjZh83kmHGrmiAWTxwhAFOhN09IIN1I6ZAmh1luQnS9KPmFaz3X53dcIJ4II80iYV7z7LsUjQ==", + "dev": true, + "dependencies": { + "semver": "~7.0.0" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -8673,6 +9515,11 @@ "node": ">=8" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, "node_modules/tar": { "version": "6.1.11", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", @@ -8835,6 +9682,55 @@ "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", "integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ=" }, + "node_modules/touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/touch/node_modules/nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -8937,6 +9833,12 @@ "node": ">= 0.8" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/unique-filename": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", @@ -8978,6 +9880,20 @@ "node": ">= 0.8" } }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -9016,6 +9932,14 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -9042,6 +9966,17 @@ "node": ">=0.10.0" } }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -9057,6 +9992,36 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "engines": { + "node": ">=12" + } + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -9151,6 +10116,34 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "node_modules/ws": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz", + "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "engines": { + "node": ">=12" + } + }, "node_modules/xmlbuilder": { "version": "15.1.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", @@ -9160,6 +10153,11 @@ "node": ">=8.0" } }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" + }, "node_modules/xregexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", @@ -10651,8 +11649,7 @@ "@tootallnate/once": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==" }, "@types/cacheable-request": { "version": "6.0.2", @@ -10734,6 +11731,11 @@ "@types/node": "*" } }, + "abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==" + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -10754,6 +11756,27 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" }, + "acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "requires": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + }, + "dependencies": { + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + } + } + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + }, "agent-base": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", @@ -10832,6 +11855,16 @@ "color-convert": "^2.0.1" } }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -10950,6 +11983,15 @@ "integrity": "sha512-KbWgR8wOYRAPekEmMXrYYdc7BRyhn2Ftk7KWfMUnQ43hFdojWEFRxhhRUm3/OFEdPa1r0KAvTTg9YQK57xTe0g==", "dev": true }, + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "babel-walk": { "version": "3.0.0-canary-5", "resolved": "https://registry.npmjs.org/babel-walk/-/babel-walk-3.0.0-canary-5.tgz", @@ -10964,12 +12006,23 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "base-64": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", + "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -11018,8 +12071,7 @@ "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "body-parser": { "version": "1.19.0", @@ -11038,6 +12090,11 @@ "type-is": "~1.6.17" } }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, "boolean": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", @@ -11272,6 +12329,22 @@ "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=" }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -11473,18 +12546,30 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, + "convert-csv-to-json": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/convert-csv-to-json/-/convert-csv-to-json-1.4.0.tgz", + "integrity": "sha512-oIW5geW3MzNaVj8959m4Zgr2QMcnF7/ap+oIiHu47mtv8Fz1jaV643eEpZSzvTY9hfc508HRXUtEHKp1nw01Vg==" + }, "cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" }, "cookie-parser": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", - "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", "requires": { - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6" + }, + "dependencies": { + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + } } }, "cookie-signature": { @@ -11541,6 +12626,103 @@ "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" }, + "css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "dependencies": { + "dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + } + }, + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + }, + "domutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", + "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "requires": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + } + }, + "entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" + } + } + }, + "css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==" + }, + "cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" + }, + "cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + } + } + }, + "csv-parse": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.3.2.tgz", + "integrity": "sha512-3jQ/JMs+voKxr4vwpmElS1d37J0o6rQdQyEKoPyA9HG8fYczpLaBJnmp5ykvkXL8ZeEGVP0qwLU645BZVykXKw==" + }, + "csvtojson": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/csvtojson/-/csvtojson-2.0.10.tgz", + "integrity": "sha512-lUWFxGKyhraKCW8Qghz6Z0f2l/PqB1W3AO0HKJzGIQ5JRSlR651ekJDiGJbBT4sRNNv5ddnSGVEnsxP9XRCVpQ==", + "requires": { + "bluebird": "^3.5.1", + "lodash": "^4.17.3", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, "cuint": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", @@ -11553,6 +12735,40 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz", "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==" }, + "data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "requires": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "dependencies": { + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "requires": { + "punycode": "^2.1.1" + } + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + } + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -11568,6 +12784,11 @@ "dev": true, "optional": true }, + "decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -11725,9 +12946,24 @@ } }, "domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==" + }, + "domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "requires": { + "webidl-conversions": "^7.0.0" + }, + "dependencies": { + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" + } + } }, "domhandler": { "version": "4.2.0", @@ -13091,6 +14327,11 @@ "path-exists": "^4.0.0" } }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==" + }, "flora-colossus": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-1.0.1.tgz", @@ -13129,13 +14370,18 @@ } } }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "requires": { "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", + "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } }, @@ -13175,6 +14421,13 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, "ftp": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", @@ -13580,6 +14833,14 @@ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, + "html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "requires": { + "whatwg-encoding": "^2.0.0" + } + }, "html-to-text": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-8.0.0.tgz", @@ -13698,6 +14959,12 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -13781,6 +15048,15 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -13848,6 +15124,11 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" + }, "is-promise": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", @@ -13873,6 +15154,11 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -13918,6 +15204,130 @@ "resolved": "https://registry.npmjs.org/js-stringify/-/js-stringify-1.0.2.tgz", "integrity": "sha1-Fzb939lyTyijaCrcYjCufk6Weds=" }, + "jsdom": { + "version": "21.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.0.tgz", + "integrity": "sha512-m0lzlP7qOtthD918nenK3hdItSd2I+V3W9IrBcB36sqDwG+KnUs66IF5GY7laGWUnlM9vTsD0W1QwSEBYWWcJg==", + "requires": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "dependencies": { + "acorn": { + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "escodegen": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz", + "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==", + "requires": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "requires": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "requires": { + "punycode": "^2.1.1" + } + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + } + } + }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -13931,6 +15341,23 @@ "dev": true, "optional": true }, + "json2csv": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/json2csv/-/json2csv-5.0.7.tgz", + "integrity": "sha512-YRZbUnyaJZLZUJSRi2G/MqahCyRv9n/ds+4oIetjDF3jWQA7AG7iSeKTiZiCNqtMZM7HDyt0e/W6lEnoGEmMGA==", + "requires": { + "commander": "^6.1.0", + "jsonparse": "^1.3.1", + "lodash.get": "^4.4.2" + }, + "dependencies": { + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" + } + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -13940,6 +15367,11 @@ "graceful-fs": "^4.1.6" } }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" + }, "jstransformer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/jstransformer/-/jstransformer-1.0.0.tgz", @@ -14017,8 +15449,7 @@ "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" }, "lodash.template": { "version": "4.5.0", @@ -14128,6 +15559,16 @@ "ms": "2.1.2" } }, + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -14135,6 +15576,16 @@ } } }, + "mailgun.js": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-8.0.6.tgz", + "integrity": "sha512-b+c7QO1T4oFsudEcRB2H7oZKth8ZDeYRW4xjW12QQVNYDSJCVxqSQfps6ofcH8fqcCMJdzc76HVNGdnUZgBPCw==", + "requires": { + "axios": "^0.27.2", + "base-64": "^1.0.0", + "url-join": "^4.0.1" + } + }, "make-fetch-happen": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", @@ -14462,9 +15913,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "multer": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.3.tgz", - "integrity": "sha512-np0YLKncuZoTzufbkM6wEKp68EhWJXcU6fq6QqrSwkckd2LlMgd1UqhUJLj6NS/5sZ8dE8LYDWslsltJznnXlg==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4.tgz", + "integrity": "sha512-2wY2+xD4udX612aMqMcB8Ws2Voq6NIUPEtD1be6m411T4uDH/VtL9i//xvcyFlTVfRdaBsk7hV5tgrGQqhuBiw==", "requires": { "append-field": "^1.0.0", "busboy": "^0.2.11", @@ -14644,6 +16095,71 @@ "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", "dev": true }, + "node-html-parser": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-6.1.4.tgz", + "integrity": "sha512-3muP9Uy/Pz7bQa9TNYVQzWJhNZMqyCx7xJle8kz2/y1UgzAUyXXShc1IcPaJy6u07CE3K5rQcRwlvHzmlySRjg==", + "requires": { + "css-select": "^5.1.0", + "he": "1.2.0" + } + }, + "nodemon": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz", + "integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -14673,6 +16189,12 @@ } } }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "normalize-url": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", @@ -14719,6 +16241,19 @@ "set-blocking": "^2.0.0" } }, + "nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "requires": { + "boolbase": "^1.0.0" + } + }, + "nwsapi": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz", + "integrity": "sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -14938,6 +16473,21 @@ "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", "dev": true }, + "parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "requires": { + "entities": "^4.4.0" + }, + "dependencies": { + "entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" + } + } + }, "parseley": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/parseley/-/parseley-0.7.0.tgz", @@ -15203,6 +16753,17 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "pug": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/pug/-/pug-3.0.2.tgz", @@ -15325,11 +16886,21 @@ "once": "^1.3.1" } }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -15469,6 +17040,15 @@ "string_decoder": "~0.10.x" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -15482,6 +17062,11 @@ "dev": true, "optional": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -15610,6 +17195,14 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "requires": { + "xmlchars": "^2.2.0" + } + }, "selderee": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/selderee/-/selderee-0.6.0.tgz", @@ -15711,6 +17304,23 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "simple-update-notifier": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.8.tgz", + "integrity": "sha512-KPXw773wEyrIIhjZh83kmHGrmiAWTxwhAFOhN09IIN1I6ZAmh1luQnS9KPmFaz3X53dcIJ4II80iYV7z7LsUjQ==", + "dev": true, + "requires": { + "semver": "~7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, "smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -15913,6 +17523,11 @@ "has-flag": "^4.0.0" } }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==" + }, "tar": { "version": "6.1.11", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", @@ -16048,6 +17663,44 @@ "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", "integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ=" }, + "touch": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "dev": true, + "requires": { + "nopt": "~1.0.10" + }, + "dependencies": { + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", + "dev": true, + "requires": { + "abbrev": "1" + } + } + } + }, + "tough-cookie": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz", + "integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } + } + }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -16125,6 +17778,12 @@ "random-bytes": "~1.0.0" } }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "unique-filename": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", @@ -16154,6 +17813,20 @@ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, + "url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -16183,6 +17856,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -16203,6 +17881,14 @@ "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", "integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=" }, + "w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "requires": { + "xml-name-validator": "^4.0.0" + } + }, "wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -16218,6 +17904,29 @@ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, + "whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "requires": { + "iconv-lite": "0.6.3" + }, + "dependencies": { + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + } + } + }, + "whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==" + }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -16291,12 +18000,28 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "ws": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz", + "integrity": "sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==", + "requires": {} + }, + "xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==" + }, "xmlbuilder": { "version": "15.1.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", "dev": true }, + "xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==" + }, "xregexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", diff --git a/package.json b/package.json index cde4d16..6268597 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "description": "Mailgun Email", "scripts": { - "serve": "node server.js", + "serve": "nodemon server.js", "start": "electron-forge start", "prd": "NODE_ENV=production node server.js", "test": "echo \"Error: no test specified\" && exit 1", @@ -19,19 +19,29 @@ }, "dependencies": { "body-parser": "^1.19.0", - "cookie-parser": "^1.4.5", + "convert-csv-to-json": "^1.4.0", + "cookie-parser": "^1.4.6", + "csv-parse": "^5.3.2", + "csvtojson": "^2.0.10", "electron-squirrel-startup": "^1.0.0", "express": "^4.17.1", "express-fileupload": "^1.2.1", "express-session": "^1.17.2", + "flat": "^5.0.2", + "form-data": "^4.0.0", "html-to-text": "^8.0.0", "jquery": "^3.6.0", + "jsdom": "^21.1.0", + "json2csv": "^5.0.7", "mailgun-js": "^0.22.0", + "mailgun.js": "^8.0.6", "md5": "^2.3.0", "mime-types": "^2.1.32", - "multer": "^1.4.3", + "multer": "^1.4.4", + "node-html-parser": "^6.1.4", "pug": "^3.0.2", - "tinymce": "^5.8.2" + "tinymce": "^5.8.2", + "uuid": "^9.0.0" }, "devDependencies": { "@electron-forge/cli": "^6.0.0-beta.66", @@ -39,7 +49,8 @@ "@electron-forge/maker-rpm": "^6.0.0-beta.66", "@electron-forge/maker-squirrel": "^6.0.0-beta.66", "@electron-forge/maker-zip": "^6.0.0-beta.66", - "electron": "^21.0.1" + "electron": "^21.0.1", + "nodemon": "^2.0.20" }, "config": { "forge": { diff --git a/server.js b/server.js index 8335ebe..1adc5c7 100644 --- a/server.js +++ b/server.js @@ -1,216 +1,95 @@ -var express = require('express'); -const fileUpload = require('express-fileupload'); -const fs = require('fs') -var path = require('path'); -const bodyParser = require('body-parser'); -const { convert } = require('html-to-text'); -const router = express.Router(); -var mime = require('mime-types') +var express = require("express"); +const fileUpload = require("express-fileupload"); +var path = require("path"); +const bodyParser = require("body-parser"); var app = express(); -var Mailgun = require('mailgun-js'); -var md5 = require('md5'); -var session = require('express-session') -var session_store = new session.MemoryStore(); +var md5 = require("md5"); +var session = require("express-session"); +const { v4: uuidv4 } = require("uuid"); +const cookieParser = require("cookie-parser"); -const uploadDir = path.join(__dirname, 'uploads'); +global.__basedir = __dirname; + +app.set("views", path.join(__dirname, "src")); +app.set("view engine", "pug"); +app.use(bodyParser.urlencoded({ extended: false })); +app.use(bodyParser.json()); +app.use(cookieParser()); -app.set('views', path.join(__dirname, 'src')); -app.set('view engine', 'pug'); -app.use(bodyParser.urlencoded({ extended: false})); -app.use(bodyParser.json()) app.use(fileUpload()); -app.set('trust proxy', 1) // trust first proxy -app.use(session({ - secret: 'secret-key', -// resave: false, - saveUninitialized: false, - cookie: { secure: true }, - store: session_store -})); +app.set("trust proxy", 1); // trust first proxy +// app.use(session({ +// secret: 'secret-key', +// // resave: false, +// saveUninitialized: false, +// cookie: { secure: true }, +// store: session_store +// })); +app.use( + session({ + genid: function (req) { + return uuidv4(); // use UUIDs for session IDs + }, + secret: "sdanusadnasid1", + }) +); var passcode = process.env.APP_PASSCODE || "pEala2o2h%RTa21Y"; var serverPort = process.env.APP_PORT || 19081; var server = app.listen(serverPort, function () { - var host = server.address().address; - var port = server.address().port; - - if (host == "::") { - host = 'http://localhost'; - } + var host = server.address().address; + var port = server.address().port; - console.log("===> Passcode: ") - console.log(passcode) - console.log(""); - console.log("MailGun app listening at %s:%s", host, port) -}) + if (host == "::") { + host = "http://localhost"; + } -app.use(express.static(path.join(__dirname, 'src', 'assets'))); -app.get('/', function (req, res) { - res.render("index"); + console.log("===> Passcode: "); + console.log(passcode); + console.log(""); + console.log("MailGun app listening at %s:%s", host, port); }); -app.post('/', function (req, res) { - if ( req.body.passcode == passcode ) { - req.session.authenticated = true; - req.session.passhash = md5(req.body.passcode); - - console.log("Got passcode", req.body.passcode); - console.log("Got passhas", req.session.passhash); - res.render("mailgun", {}); - } else { - req.session.passhash = 0; - console.log("Got passhas", req.session.passhash); - res.render("index", { error: "Invalid Mailing credentials"}); - } +function slugify(text) { + return text + .toLowerCase() + .replace(/ /g, "-") + .replace(/[^\w-]+/g, ""); +} + +app.use(express.static(path.join(__dirname, "src", "assets"))); +app.get("/", function (req, res) { + console.log("Check passhas", req.session.passhash); + if (req.session.passhash == md5(passcode)) { + return res.render("mailgun", {}); + } + res.render("index"); }); - -app.post('/mg', function(req, res) { - try { - var mailgun = new Mailgun({ apiKey: req.body.apiKey, domain: req.body.domain }); - mailgun.get('/lists/pages', function (error, body) { - mailing_list = []; - mailing_options = ""; - console.log("body", body); - console.log('error',) - if ( ! body.items ) { - res.render("mailgun", { - error: body.message - }); - } else { - for(let item of body.items) { - mailing_list.push({name: item.name, email: item.address}); - mailing_options += ``; - } - console.log(mailing_list); - res.render("message", { - apiKey: req.body.apiKey, domain: req.body.domain, - req_data: req.body, - mailing_list: mailing_list, mailing_options: mailing_options, - msg: 'Send Custom Message to Mailing List.', err: false - }); - } - }); - } catch (e) { - res.send("Invalid Mailing credentials"); - } +app.post("/", function (req, res) { + if (req.body.passcode == passcode) { + req.session.authenticated = true; + req.session.passhash = md5(req.body.passcode); + + console.log("Got passcode", req.body.passcode); + console.log("Got passhas", req.session.passhash); + res.render("mailgun", {}); + } else { + req.session.passhash = 0; + console.log("Got passhas", req.session.passhash); + res.render("index", { error: "Invalid Mailing credentials" }); + } }); +// Initialize Routers +const mailgunRouter = require("./src/routes/mailgun"); +const testRouter = require("./src/routes/index"); -app.post('/message', function(req, res) { - try { - var mailgun = new Mailgun({ apiKey: req.body.apiKey, domain: req.body.domain }); - var mailing_list = []; - var mailing_options = ""; - mailgun.get('/lists/pages', function (error, body) { - mailing_options = ""; - for(let item of body.items) { - mailing_list.push({name: item.name, email: item.address}); - mailing_options += ``; - } - console.log(mailing_list); - }); - } catch (e) { - res.send("Invalid Mailing credentials"); - } - - var filepaths = []; - var fileAttachments = []; - try { - console.log('TEST REST', req.files); - if ( req.files && req.files.file ) { - if ( Array.isArray(req.files.file) ) { - var uploadPath; - for(let attachment of req.files.file) { - if ( ! attachment ) { - continue; - } - uploadPath = path.join(uploadDir, attachment.name); - - // Use the mv() method to place the file somewhere on your server - attachment.mv(uploadPath, function(err) { - if (err) - return res.status(500).send(err); - console.log(`${attachment.name} File uploaded!`); - }); - filepaths.push(uploadPath); - fileAttachments.push( - new mailgun.Attachment({ - data: attachment.data, - contentType: attachment.mimetype, - filename: path.basename(attachment.name) - }), - ); - } - } else { - let attachment = req.files.file; - var uploadPath = path.join(uploadDir, attachment.name); - // Use the mv() method to place the file somewhere on your server - attachment.mv(uploadPath, function(err) { - if (err) - return res.status(500).send(err); - console.log(`${attachment.name} File uploaded!`); - }); - filepaths.push(uploadPath); - fileAttachments.push( - new mailgun.Attachment({ - data: attachment.data, - contentType: attachment.mimetype, - filename: path.basename(attachment.name) - }), - ); - } - } - } catch (e) { - console.log('err', e); - } - - - const plaintext = convert(req.body.message, { - wordwrap: 130 - }); +app.use("/test", testRouter); +app.use("/mailgun", mailgunRouter); - var data = { - from: req.body.from_email, - to: req.body.mailing_list, - subject: req.body.subject, - text: plaintext, - html: req.body.message - }; - - - if ( fileAttachments.length >= 0 ) { - data.attachment = fileAttachments; - } - // res.send(JSON.stringify(data)); - - mailgun.messages().send(data, function(error, body) { - console.log(body); - - var list = mailgun.lists(req.body.to); - list.members().list(function (err, members) { - // `members` is the list of members - console.log('send to members: '); - }); - - if (error) { - // email not sent - res.render("message", { - apiKey: req.body.apiKey, domain: req.body.domain, - req_data: req.body, - mailing_list: mailing_list, mailing_options: mailing_options, - msg: 'Error. Something went wrong.', err: true - }); - - } else { - // Yay!! Email sent - res.render("message", { - apiKey: req.body.apiKey, domain: req.body.domain, - req_data: req.body, - mailing_list: mailing_list, mailing_options: mailing_options, - msg: 'Message successfully sent.', err: false - }); - } - }); -}); \ No newline at end of file +app.use(express.static(path.join(__dirname, "src", "assets"))); +app.get("/", function (req, res) { + res.render("index"); +}); diff --git a/src/assets/app.js b/src/assets/app.js index 9827088..b8bd4ab 100644 --- a/src/assets/app.js +++ b/src/assets/app.js @@ -1,18 +1,140 @@ -$(document).ready(function() { - tinymce.init({ - selector: 'textarea#message', - height: 300, - menubar: false, - plugins: [ - 'advlist autolink lists link image charmap print preview anchor', - 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table paste code help wordcount' +$(document).ready(function () { + var pretendFetchedData = [ + { title: "100x100", value: "http://via.placeholder.com/100x100" }, + { title: "120x120", value: "http://via.placeholder.com/120x120" }, + { title: "150x150", value: "http://via.placeholder.com/150x150" }, + ]; + + tinymce.init({ + selector: "textarea#message", + height: 300, + menubar: false, + plugins: [ + "advlist autolink lists link image charmap print preview anchor", + "searchreplace visualblocks code fullscreen", + "insertdatetime media table paste code help wordcount image", + ], + help_tabs: [ + "shortcuts", // the default shortcuts tab + "keyboardnav", // the default keyboard navigation tab + "plugins", // the default plugins tab + { + name: "versions", + title: "Version", + items: [ + { + type: "htmlpanel", + html: "

Mailgun Send Version

v2023-03-28

", + }, ], - toolbar: 'undo redo | formatselect | ' + - 'bold italic backcolor | alignleft aligncenter ' + - 'alignright alignjustify | bullist numlist outdent indent | ' + - 'removeformat | help', - content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }' - }); - -}); \ No newline at end of file + }, + ], + + a11y_advanced_options: true, + toolbar: + "undo redo | formatselect | " + + "bold italic backcolor | alignleft aligncenter " + + "alignright alignjustify | bullist numlist outdent indent | " + + "table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol" + + "removeformat | image | help | code", + table_toolbar: + "tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol", + // image_prepend_url: "cid:", + content_style: + "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }", + + file_picker_types: "image", + image_title: true, + // image_list: pretendFetchedData, + /* enable automatic uploads of images represented by blob or data URIs*/ + // automatic_uploads: true, + + // setup: function (editor) { + // editor.on("NodeChange", function (e) { + // if (e.element.tagName === "IMG") { + // e.element.setAttribute("data-original", e.element.currentSrc); + // e.element.setAttribute("src", `cid:${e.element.currentSrc}`); + // } + // }); + // }, + + /* and here's our custom image picker*/ + // file_picker_callback: function (cb, value, meta) { + // var input = document.createElement("input"); + // input.setAttribute("type", "file"); + // input.setAttribute("accept", "image/*"); + + // /* + // Note: In modern browsers input[type="file"] is functional without + // even adding it to the DOM, but that might not be the case in some older + // or quirky browsers like IE, so you might want to add it to the DOM + // just in case, and visually hide it. And do not forget do remove it + // once you do not need it anymore. + // */ + + // input.onchange = function () { + // var file = this.files[0]; + + // var reader = new FileReader(); + // reader.onload = function () { + // /* + // Note: Now we need to register the blob in TinyMCEs image blob + // registry. In the next release this part hopefully won't be + // necessary, as we are looking to handle it internally. + // */ + // var id = "blobid" + new Date().getTime(); + // var blobCache = tinymce.activeEditor.editorUpload.blobCache; + // var base64 = reader.result.split(",")[1]; + // var blobInfo = blobCache.create(id, file, base64); + // blobCache.add(blobInfo); + + // /* call the callback and populate the Title field with the file name */ + // cb(blobInfo.blobUri(), { title: file.name }); + // }; + // reader.readAsDataURL(file); + // }; + + // input.click(); + // }, + + // file_picker_types: 'image', + /* and here's our custom image picker*/ + file_picker_callback: function (cb, value, meta) { + var input = document.createElement("input"); + input.setAttribute("type", "file"); + input.setAttribute("accept", "image/*"); + + /* + Note: In modern browsers input[type="file"] is functional without + even adding it to the DOM, but that might not be the case in some older + or quirky browsers like IE, so you might want to add it to the DOM + just in case, and visually hide it. And do not forget do remove it + once you do not need it anymore. + */ + + input.onchange = function () { + var file = this.files[0]; + + var reader = new FileReader(); + reader.onload = function () { + /* + Note: Now we need to register the blob in TinyMCEs image blob + registry. In the next release this part hopefully won't be + necessary, as we are looking to handle it internally. + */ + var id = "blobid" + new Date().getTime(); + var blobCache = tinymce.activeEditor.editorUpload.blobCache; + var base64 = reader.result.split(",")[1]; + var blobInfo = blobCache.create(id, file, base64); + blobCache.add(blobInfo); + + /* call the callback and populate the Title field with the file name */ + cb(blobInfo.blobUri(), { title: file.name }); + }; + reader.readAsDataURL(file); + }; + + input.click(); + }, + }); +}); diff --git a/src/assets/styles.css b/src/assets/styles.css index a0cf2f3..e304377 100644 --- a/src/assets/styles.css +++ b/src/assets/styles.css @@ -1,17 +1,69 @@ * { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } .error { - color: rgb(251 243 243); - background: #7d0e0ea1; - text-transform: capitalize; - padding: 10px; - font-weight: bold; - max-width: 400px; - margin: 0 auto 10px auto; + color: rgb(251 243 243); + background: #7d0e0ea1; + text-transform: capitalize; + padding: 10px; + font-weight: bold; + max-width: 400px; + margin: 0 auto 10px auto; +} + +.text-white { + color: white; +} + +.text-left { + text-align: left; +} + +.card { + /* Add shadows to create the "card" effect */ + background-color: white; + padding: 20px; + transition: 0.3s; + border-radius: 8px; +} + +table { + border-collapse: collapse; + width: 100%; +} + +th, +td { + padding: 8px; + text-align: left; + border-bottom: 1px solid #ddd; +} + +.overflow-x-hidden { + overflow-x: hidden !important; +} + +.overflow-email { + overflow-x: hidden !important; +} + +@media screen and (max-width: 1440px) { + .overflow-email { + max-width: 500px !important; + white-space: nowrap; + text-overflow: ellipsis; + } +} + +@media screen and (max-width: 1140px) { + .overflow-email { + max-width: 260px !important; + white-space: nowrap; + text-overflow: ellipsis; + } } /* @@ -19,9 +71,9 @@ * Most of these are inherited from Base, but I want to change a few. */ body { - line-height: 1.7em; - color: #7f8c8d; - font-size: 13px; + line-height: 1.7em; + color: #7f8c8d; + font-size: 13px; } h1, @@ -31,12 +83,12 @@ h4, h5, h6, label { - color: #34495e; + color: #34495e; } .pure-img-responsive { - max-width: 100%; - height: auto; + max-width: 100%; + height: auto; } /* @@ -44,42 +96,40 @@ label { * These are some useful classes which I will need */ .l-box { - padding: 1em; + padding: 1em; } .l-box-lrg { - padding: 2em; - border-bottom: 1px solid rgba(0,0,0,0.1); + padding: 2em; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); } .is-center { - text-align: center; + text-align: center; } - - /* * -- PURE FORM STYLES -- * Style the form inputs and labels */ .pure-form label { - margin: 1em 0 0; - font-weight: bold; - font-size: 100%; + margin: 1em 0 0; + font-weight: bold; + font-size: 100%; } .pure-padding { - padding-right: 10px; - padding-left: 10px; + padding-right: 10px; + padding-left: 10px; } .pure-form input, .form-control { - border: 2px solid #ddd; - box-shadow: none; - font-size: 100%; - width: 100%; - margin-bottom: 1em; + border: 2px solid #ddd; + box-shadow: none; + font-size: 100%; + width: 100%; + margin-bottom: 1em; } /* @@ -87,19 +137,26 @@ label { * I want my pure-button elements to look a little different */ .pure-button { - background-color: #1f8dd6; - color: white; - padding: 0.5em 2em; - border-radius: 5px; + background-color: #1f8dd6; + color: white; + padding: 0.5em 2em; + border-radius: 5px; } a.pure-button-primary { - background: white; - color: #1f8dd6; - border-radius: 5px; - font-size: 120%; + background: white; + color: #1f8dd6; + border-radius: 5px; + font-size: 120%; } +.d-inline-block { + display: inline-block; +} + +.d-block { + display: block; +} /* * -- MENU STYLES -- @@ -107,92 +164,95 @@ a.pure-button-primary { */ .home-menu { - padding: 0.5em; - text-align: center; - box-shadow: 0 1px 1px rgba(0,0,0, 0.10); + padding: 0.5em; + text-align: center; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); } + .home-menu { - background: #2d3e50; + background: #2d3e50; } + .pure-menu.pure-menu-fixed { - /* Fixed menus normally have a border at the bottom. */ - border-bottom: none; - /* I need a higher z-index here because of the scroll-over effect. */ - z-index: 4; + /* Fixed menus normally have a border at the bottom. */ + border-bottom: none; + /* I need a higher z-index here because of the scroll-over effect. */ + z-index: 4; } .home-menu .pure-menu-heading { - color: white; - font-weight: 400; - font-size: 120%; + color: white; + font-weight: 400; + font-size: 120%; } .home-menu .pure-menu-selected a { - color: white; + color: white; } .home-menu a { - color: #6FBEF3; + color: #6fbef3; } + .home-menu li a:hover, .home-menu li a:focus { - background: none; - border: none; - color: #AECFE5; + background: none; + border: none; + color: #aecfe5; } - /* * -- SPLASH STYLES -- * This is the blue top section that appears on the page. */ .splash-container { - background: #1f8dd6; - z-index: 1; - overflow: scroll; - /* The following styles are required for the "scroll-over" effect */ - width: 100%; - height: 100%; - top: 0; - left: 0; - position: fixed !important; + background: #1f8dd6; + z-index: 1; + overflow: scroll; + /* The following styles are required for the "scroll-over" effect */ + width: 100%; + height: 100%; + top: 0; + left: 0; + position: fixed !important; } .splash { - /* absolute center .splash within .splash-container */ - width: 80%; - height: 50%; - margin: 0 auto; - text-align: center; - text-transform: uppercase; + /* absolute center .splash within .splash-container */ + width: 80%; + height: 50%; + margin: 0 auto; + text-align: center; + text-transform: uppercase; } /* This is the main heading that appears on the blue section */ .splash-head { - font-size: 20px; - font-weight: bold; - color: white; - border: 3px solid white; - padding: 1em 1.6em; - font-weight: 100; - border-radius: 5px; - line-height: 1em; + font-size: 20px; + font-weight: bold; + color: white; + border: 3px solid white; + padding: 1em 1.6em; + font-weight: 100; + border-radius: 5px; + line-height: 1em; } /* This is the subheading that appears on the blue section */ .splash-subhead { - color: white; - letter-spacing: 0.05em; - opacity: 0.8; - text-transform: initial; + color: white; + letter-spacing: 0.05em; + opacity: 0.8; + text-transform: initial; } .splash-subhead.err { - background: rgba(255, 0, 0, 0.671); + background: rgba(255, 0, 0, 0.671); } + .splash-subhead.success { - background: rgba(0, 255, 21, 0.671); + background: rgba(0, 255, 21, 0.671); } /* @@ -200,54 +260,54 @@ a.pure-button-primary { * This represents the content area (everything below the blue section) */ .content-wrapper { - /* These styles are required for the "scroll-over" effect */ - position: absolute; - top: 87%; - width: 100%; - min-height: 12%; - z-index: 2; - background: white; - + /* These styles are required for the "scroll-over" effect */ + position: absolute; + top: 87%; + width: 100%; + min-height: 12%; + z-index: 2; + background: white; } /* We want to give the content area some more padding */ .content { - padding: 1em 1em 3em; + padding: 1em 1em 3em; } /* This is the class used for the main content headers (

) */ .content-head { - font-weight: 400; - text-transform: uppercase; - letter-spacing: 0.1em; - margin: 2em 0 1em; + font-weight: 400; + text-transform: uppercase; + letter-spacing: 0.1em; + margin: 2em 0 1em; } /* This is a modifier class used when the content-head is inside a ribbon */ .content-head-ribbon { - color: white; + color: white; } /* This is the class used for the content sub-headers (

) */ .content-subhead { - color: #1f8dd6; + color: #1f8dd6; +} + +.content-subhead i { + margin-right: 7px; } - .content-subhead i { - margin-right: 7px; - } /* This is the class used for the dark-background areas. */ .ribbon { - background: #2d3e50; - color: #aaa; + background: #2d3e50; + color: #aaa; } /* This is the class used for the footer */ .footer { - background: #111; - position: fixed; - bottom: 0; - width: 100%; + background: #111; + position: fixed; + bottom: 0; + width: 100%; } /* @@ -256,43 +316,41 @@ a.pure-button-primary { * of the mobile styles. */ @media (min-width: 48em) { + /* We increase the body font size */ + body { + font-size: 16px; + } - /* We increase the body font size */ - body { - font-size: 16px; - } - - /* We can align the menu header to the left, but float the + /* We can align the menu header to the left, but float the menu items to the right. */ - .home-menu { - text-align: left; - } - .home-menu ul { - float: right; - } - - /* We increase the height of the splash-container */ -/* .splash-container { + .home-menu { + text-align: left; + } + + .home-menu ul { + float: right; + } + + /* We increase the height of the splash-container */ + /* .splash-container { height: 500px; }*/ - /* We decrease the width of the .splash, since we have more width + /* We decrease the width of the .splash, since we have more width to work with */ - .splash { - width: 70%; - height: 50%; - } - - .splash-head { - font-size: 250%; - } - + .splash { + width: 70%; + height: 50%; + } - /* We remove the border-separator assigned to .l-box-lrg */ - .l-box-lrg { - border: none; - } + .splash-head { + font-size: 250%; + } + /* We remove the border-separator assigned to .l-box-lrg */ + .l-box-lrg { + border: none; + } } /* @@ -301,48 +359,84 @@ a.pure-button-primary { * of the mobile and tablet styles. */ @media (min-width: 78em) { - /* We increase the header font size even more */ - .splash-head { - font-size: 300%; - } + /* We increase the header font size even more */ + .splash-head { + font-size: 300%; + } } input[type="file"] { - background: white; - padding: 20px 10px; + background: white; + padding: 20px 10px; } .button-success, .button-error, .button-warning, .button-secondary { - color: white; - border-radius: 4px; - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); + color: white; + border-radius: 4px; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } .button-success { - background: rgb(28, 184, 65); - /* this is a green */ + background: rgb(28, 184, 65); + /* this is a green */ } .button-error { - background: rgb(202, 60, 60); - /* this is a maroon */ + background: rgb(202, 60, 60); + /* this is a maroon */ } .button-warning { - background: rgb(223, 117, 20); - /* this is an orange */ + background: rgb(223, 117, 20); + /* this is an orange */ } .button-secondary { - background: rgb(66, 184, 221); - /* this is a light blue */ + background: rgb(66, 184, 221); + /* this is a light blue */ } .micromodal-slide.is-open { - display: block; - position: absolute; - z-index: 100000; - } \ No newline at end of file + display: block; + position: absolute; + z-index: 100000; +} + +.lds-ring { + display: inline-block; + position: relative; + width: 80px; + height: 80px; +} +.lds-ring div { + box-sizing: border-box; + display: block; + position: absolute; + width: 64px; + height: 64px; + margin: 8px; + border: 8px solid red; + border-radius: 50%; + animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: red transparent transparent transparent; +} +.lds-ring div:nth-child(1) { + animation-delay: -0.45s; +} +.lds-ring div:nth-child(2) { + animation-delay: -0.3s; +} +.lds-ring div:nth-child(3) { + animation-delay: -0.15s; +} +@keyframes lds-ring { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/src/controllers/attachments.js b/src/controllers/attachments.js new file mode 100644 index 0000000..cb7c786 --- /dev/null +++ b/src/controllers/attachments.js @@ -0,0 +1,92 @@ +const path = require("path"); +const fs = require("fs"); +const csv = require("csvtojson"); +const { parse } = require("csv-parse/sync"); +const flatten = require("flat"); + +const attachFile = async (res, uploadDir, attachment, fileAttachments) => { + // Uploads file to server + let uploadPath = path.join(uploadDir, attachment.name); + + console.log(attachment); + // Move the file somewhere onto your server + attachment.mv(uploadPath, (err) => { + if (err) { + return res.status(500).send(err); + } else { + // Prepare file for mailgun + const file = { + filename: attachment.name, + data: fs.readFileSync(uploadPath), + }; + + console.log(file); + fileAttachments.push(file); + } + }); +}; +const attachFiles = async (req, res, uploadDir) => { + // Check for attachment + let fileAttachments = []; + + if (req.files && req.files.file) { + console.log("Files"); + console.log(req.files); + if (Array.isArray(req.files.file)) { + for (let attachment of req.files.file) { + if (!attachment) { + continue; + } + attachFile(res, uploadDir, attachment, fileAttachments); + } + } else { + attachFile(res, uploadDir, req.files.file, fileAttachments); + } + } + + return fileAttachments; +}; + +const renameKey = (oldKey, newKey) => { + _.reduce( + obj, + (newObj, value, key) => { + newObj[oldKey === key ? newKey : key] = value; + return newObj; + }, + {} + ); +}; + +const generateRecipientVariablesCSV = async (req) => { + let custom_vars = {}; + if (req.files && req.files.varfile) { + console.log("Mailgun variables", req.files); + var var_data = req.files.varfile.data.toString("utf8"); + const csv_var_data = parse(var_data, { + columns: true, + skip_empty_lines: true, + }); + console.log("Var data", csv_var_data); + for (const element of csv_var_data) { + if (!element.email) { + continue; + } + + // Remove whitespace from values + for (let [key, value] of Object.entries(element)) { + element[key] = value.trim(); + } + + var cemail = element.email; + var cdata = Object.assign({}, element); + delete cdata["email"]; + custom_vars[cemail] = cdata; + } + console.log("Variables", custom_vars); + } + + return custom_vars; +}; + +module.exports = { attachFile, attachFiles, generateRecipientVariablesCSV }; diff --git a/src/controllers/mailingList.js b/src/controllers/mailingList.js new file mode 100644 index 0000000..3770830 --- /dev/null +++ b/src/controllers/mailingList.js @@ -0,0 +1,90 @@ +const { initializeMailgunClient } = require("../util/initializeClient"); +const { getMembers, getAllMembers } = require("./members"); + +const { parse } = require("csv-parse/sync"); +const json2csv = require("json2csv"); +const { slugify } = require("../util/stringUtil"); +const createMailingList = async (req, res) => { + const client = initializeMailgunClient(req.body.apiKey); + const listAddress = `${req.body.name}@${req.body.domain}`; + + let newList = []; + try { + newList = await client.lists.create({ + address: listAddress, + name: req.body.name, + description: req.body.description, + access_level: req.body.accessLevel, // readonly (default), members, everyone + }); + console.log("newList", newList); + res.status(200).send({ status: "Success", data: newList }); + } catch (error) { + console.error(error); + res.status(400).send(error); + } +}; + +const getMailingLists = async (req, res) => { + let mailingList = []; + let mailingOptions = ""; + let apiKey = undefined; + console.log(req.body); + console.log(`Session is`); + console.log(req.session); + + if (!req.session.apiKey) { + apiKey = req.body.apiKey; + } else { + apiKey = req.session.apiKey; + } + const client = initializeMailgunClient(apiKey); + + // Pull mailing list from mailgun + let list = {}; + try { + list = await client.lists.list(); + } catch (error) { + res.status(400).send({ error: error }); + } + + // If no list items render error + if (!list.items) { + res.render("mailgun", { + error: list.message, + }); + } + + // Render html element for each mailing list + for (let item of list.items) { + mailingList.push({ name: item.name, email: item.address }); + mailingOptions += ``; + } + + return { mailing_list: mailingList, mailing_options: mailingOptions }; +}; + +const downloadMailingList = async (req, res) => { + const email = req.query.email || ""; + + // Get mailing list members + const members = await getAllMembers(req, res, email); + // console.log(members); + // const fields = ["address", "name", "subscribed"]; + // const data = json2csv.parse(members.items, { fields }); + + const fields = ["address", "name", "subscribed"]; + const data = json2csv.parse(members, { fields }); + + res.attachment(`${slugify(email)}.csv`); + + // Set cookie to track download progress + const cookie = req.cookies.progressCookie; + + if (cookie === undefined) { + // Set cookie once download is completed, expires within 5 minutes + res.cookie("downloadCookie", "done", { maxAge: 300000 }); + } + + res.status(200).send(data); +}; +module.exports = { createMailingList, getMailingLists, downloadMailingList }; diff --git a/src/controllers/members.js b/src/controllers/members.js new file mode 100644 index 0000000..6a30991 --- /dev/null +++ b/src/controllers/members.js @@ -0,0 +1,114 @@ +const { initializeMailgunClient } = require("../util/initializeClient"); + +const getAllMembers = async (req, res, mailingList) => { + // Initalize params for pagination + let members = []; + let emailSet = new Set(); + let count = []; + const params = { + limit: 1000, + skip: 0, + }; + + const client = initializeMailgunClient(req.session.apiKey); + + // Get count of members from mailing list + const { members_count } = await client.lists + .get(mailingList) + .then((data) => data) + .catch((err) => { + console.log(err); + res.status(400).send({ error: err }); + }); + + // Get initial list of members + const initialMemberQuery = await client.lists.members.listMembers( + mailingList, + { + limit: 1000, // Maximum value for mailgun pagination + } + ); + members = [...initialMemberQuery.items]; + count += members.length; + + // Calculate the number of pages. + const numPages = Math.ceil(members_count / params.limit); + + // Update initial pagination params + params.page = initialMemberQuery.pages.next.page; + + for (let page = 1; page <= numPages; page++) { + let memberDetails = await client.lists.members.listMembers( + mailingList, + params + ); + + // Update pagination params + params.page = memberDetails.pages.next.page; + + // Check for duplicates and skip them + let currentMembers = memberDetails.items; + for (let member of currentMembers) { + if (emailSet.has(member.address)) { + continue; + } else { + emailSet.add(member.address); + members.push(member); + } + } + console.log( + `Page: ${page} \n Members: ${currentMembers.length} Page: ${params.page}` + ); + console.log(members.length); + } + return members; +}; + +/** + * Returns paginated list of members + * @param {Request} req + * @param {Response} res + * @param {string} mailingList + * @returns + */ +const getMembers = async (req, res, mailingList) => { + const client = initializeMailgunClient(req.session.apiKey); + try { + const members = await client.lists.members.listMembers(mailingList); + return members; + } catch (error) { + console.log(error); + res.status(400).send({ error: error }); + } +}; + +const addMembers = async (mailingList, members, client, res) => { + console.log(members); + try { + const result = await client.lists.members.createMembers(mailingList, { + members: members, + upsert: "yes", + }); + console.log(result); + return result; + } catch (error) { + console.log(error); + return error; + } +}; + +const updateMember = async (req, res) => { + const client = initializeMailgunClient(req.session.apiKey); + // Attempt to update member + try { + const updatedMember = await client.lists.members.updateMember( + req.body.mailing_list, + req.body.member_address, + req.body.update_fields + ); + return updatedMember; + } catch (error) { + res.status(400).send({ status: "Error", error: error }); + } +}; +module.exports = { getMembers, addMembers, updateMember, getAllMembers }; diff --git a/src/controllers/message.js b/src/controllers/message.js new file mode 100644 index 0000000..dfd8225 --- /dev/null +++ b/src/controllers/message.js @@ -0,0 +1,164 @@ +const { convert } = require("html-to-text"); +const { JSDOM } = require("jsdom"); +const HTMLParser = require('node-html-parser'); + + +const signatures = { + JVBERi0: "application/pdf", + R0lGODdh: "image/gif", + R0lGODlh: "image/gif", + iVBORw0KGgo: "image/png", + "/9j/": "image/jpg" +}; + +const detectMimeType = function (b64) { + for (var s in signatures) { + if (b64.indexOf(s) === 0) { + return signatures[s]; + } + } +} + +const parseAttachment = (html, fileAttachments, inLineImages) => { + var images = []; + + var html_parsed = HTMLParser.parse(html); + var images = html_parsed.querySelectorAll('img'); + for (let index = 0; index < images.length; index++) { + const img = images[index]; + var codec, extension; + var image_src = img.getAttribute('src'); + + if (image_src.toLowerCase().indexOf("data:image/png;base64,") != -1) { + codec = "png"; + extension = ".png"; + } else if (image_src.toLowerCase().indexOf("data:image/jpeg;base64,") != -1) { + codec = "jpeg"; + extension = ".jpg"; + } else if (image_src.toLowerCase().indexOf("data:image/webp;base64,") != -1) { + codec = "webp"; + extension = ".webp"; + } else if (image_src.toLowerCase().indexOf("data:image/gif;base64,") != -1) { + codec = "gif"; + extension = ".gif"; + } + + if (codec) { + var name = "image" + index + extension, + base64 = image_src.replace("data:image/" + codec + ";base64,", ""); + var buffer = Buffer.from(base64, "base64"); + inLineImages.push({ + contentType: "image/" + codec, + filename: name, + data: buffer, + // data: buffer, + cid: name, + knownLength: buffer.length, + }); + // return `src='${match.replace(match, "cid:" + name)}'`; + img.setAttribute('src', "cid:" + name); + } + + } + let result = html_parsed.toString(); + return result; +}; + +const sendMessage = async ( + req, + res, + fileAttachments, + mailgunClient, + mailingList, + recipientVariables +) => { + console.log("Attachments"); + // console.log(req.body.message.slice(0, 300)); + let inLineImages = []; + var html = parseAttachment(req.body.message, fileAttachments, inLineImages); + // const html = req.body.message; + // Convert HTML Message to plaintext + console.log(html); + const plaintext = convert(html, { + wordwrap: 130, + }); + + const emailData = { + from: req.body.from_email, + to: req.body.mailing_list, + subject: req.body.subject, + text: plaintext, + html: html, + inline: inLineImages, + "recipient-variables": JSON.stringify(recipientVariables), + }; + + if (fileAttachments.length >= 0) { + emailData.attachment = fileAttachments; + } + + // Attempt to send email + try { + const result = await mailgunClient.messages.create( + req.body.domain, + emailData + ); + + console.log("Email sent"); + // console.log(result); + res.render("message", { + apiKey: req.body.apiKey, + domain: req.body.domain, + req_data: req.body, + mailing_list: mailingList.mailing_list, + mailing_options: mailingList.mailing_options, + msg: "Message successfully sent.", + err: false, + }); + } catch (err) { + res.render("message", { + apiKey: req.body.apiKey, + domain: req.body.domain, + req_data: req.body, + mailing_list: mailingList.mailing_list, + mailing_options: mailingList.mailing_options, + msg: "Error. Something went wrong.", + err: true, + }); + } +}; + +/** + * Adds recipient variable to list of available recipient variables + */ +const generateRecipientVariables = (recipientVariables, members) => { + let defaultFields = ["name", "address", "subscribed"]; + for (let member of members) { + // Create empty object to store recipient variables if none are present + if (!recipientVariables[member.address]) { + console.log(recipientVariables[member.address]); + recipientVariables[member.address] = {}; + } + + // Add existing variables to recipient variables + console.log("Updating fields from recipient Old"); + console.log(member); + Object.assign(recipientVariables[member.address], { ...member.vars }); + + console.log("new Fields"); + console.log(member); + // Add default fields + console.log("Adding default fields"); + for (let field of defaultFields) + try { + recipientVariables[member.address][field] = member[field]; + } catch (err) { + console.log(err); + continue; + } + } + + return recipientVariables; +}; + +module.exports = { sendMessage, generateRecipientVariables }; diff --git a/src/error.pug b/src/error.pug new file mode 100644 index 0000000..edf5fbb --- /dev/null +++ b/src/error.pug @@ -0,0 +1,22 @@ +doctype html +head + meta(charset='utf-8') + meta(name='viewport' content='width=device-width, initial-scale=1.0') + meta(name='description' content='A layout example that shows off a responsive product landing page.') + title MailGun Send + link(rel='stylesheet' type="text/css" href='/pure.css') + link(rel='stylesheet' type="text/css" href='/modal.css') + link(rel='stylesheet' type="text/css" href='/styles.css') + // + script(src='/tinymce/tinymce.min.js') +.splash-container + .splash +

Mailgun
Send Email

+ h2.splash-subhead.error.text-white #{error} + div(style="text-align: center") + a.button-success.d-inline-block.pure-button(href='/', style="margin-right: 10px") Home + a.button-success.d-inline-block.pure-button(href='/', style="margin-right: 10px") Message + a.button-success.d-inline-block.pure-button(href='/') Mailing List + +script(src='/jquery/jquery.min.js' type="application/javascript") +script(src='/app.js' type="application/javascript") diff --git a/src/index.pug b/src/index.pug index 9175693..f4efb43 100644 --- a/src/index.pug +++ b/src/index.pug @@ -11,7 +11,7 @@ head script(src='/tinymce/tinymce.min.js') .splash-container .splash - //

Mailgun
Send Email

+

Mailgun
Send Email

p.splash-subhead | Please enter the passcode before continuing if ( error ) diff --git a/src/mailgun.pug b/src/mailgun.pug index 154f0e9..34b1746 100644 --- a/src/mailgun.pug +++ b/src/mailgun.pug @@ -21,7 +21,7 @@ head p.error | #{error} div - form#credform.pure-form.pure-form-stacked.pure-g(method='post' action="/mg") + form#credform.pure-form.pure-form-stacked.pure-g(method='post' action="/mailgun") .pure-u-1-2(style='padding-right: 10px') input#usrDomain(type='text' name='domain' required='' placeholder='Domain' title='Domain' style='display: inline-block; margin-right: 10px;') .pure-u-1-2(style='padding-right: 10px') diff --git a/src/mailing_list.pug b/src/mailing_list.pug new file mode 100644 index 0000000..f050e8c --- /dev/null +++ b/src/mailing_list.pug @@ -0,0 +1,121 @@ +doctype html +head + meta(charset='utf-8') + meta(name='viewport' content='width=device-width, initial-scale=1.0') + meta(name='description' content='A layout example that shows off a responsive product landing page.') + title MailGun Send + link(rel='stylesheet' type="text/css" href='/pure.css') + link(rel='stylesheet' type="text/css" href='/modal.css') + link(rel='stylesheet' type="text/css" href='/styles.css') + link(rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css") + + // + script(src='/tinymce/tinymce.min.js') + + +.splash-container + .splash +

Mailgun
Mailing List

+ .card + h4.text-left Mailing Lists + table + thead + tr + th.text-left(width="20%") Name + th.text-left(width="60%") Email + th.text-center(width="20%") Action + tbody + each item, index in mailing_list + tr + td.text-left(width="20%") #{item.name} + td.text-left + .overflow-email(title=item.email) #{item.email} + td.text-center(width="20%") + .div() + a.button-success.d-inline-block.pure-button(href='/mailgun/list/download?email='+item.email onclick='getDownloadProgress(' + index + ')' id='download-btn-' + index) DOWNLOAD + +script(src='/jquery/jquery.min.js' type="application/javascript") +script(src='/app.js' type="application/javascript") +script(type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js") +script. + var result = true + var interval = null; + function getCookie(cookieName) { + var name = cookieName + "="; + var cookies = document.cookie + var cs = cookies.split(';'); + for (var i = 0; i < cs.length; i++) { + var c = cs[i]; + while(c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; + } + + function isDownloadInProgress(index) { + var loadState = getCookie("downloadCookie"); + if (loadState == "done") { + // Delete the cookie + + document.cookie = "downloadCookie=; Path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;"; + const btn = document.getElementById('download-btn-' + index) + btn.innerHTML = 'Download' + + Toastify({ + text: "Mailing List Successfully Downloaded", + duration: 3000, + close: true, + gravity: "top", // `top` or `bottom` + position: "center", // `left`, `center` or `right` + stopOnFocus: true, // Prevents dismissing of toast on hover + style: { + background: "white", + borderRadius: "5px", + color: "#282828" + }, + onClick: function(){} // Callback after click + }).showToast(); + + result = false + clearInterval(interval) + } + + result = true + } + function showWaitingSpinner(){ + const loader = document.getElementById("loader") + loader.classList.remove("hidden") + } + + function getDownloadProgress(index){ + console.log("Check Download Progress") + const btn = document.getElementById('download-btn-' + index) + btn.innerHTML = 'Downloading...' + + interval = setInterval(isDownloadInProgress, 1000, index) + + //- while (result){ + //- result = isDownloadInProgress(index); + //- } + //- for(let i=0; i < 1000; i++){ + //- let result = + //- console.log(result) + //- if(result){ + //- continue; + //- }else{ + //- break; + //- } + //- while(true){ + + //- } + } + + + + + + diff --git a/src/message.pug b/src/message.pug index 5b69d2b..ab2687d 100644 --- a/src/message.pug +++ b/src/message.pug @@ -12,7 +12,7 @@ head .splash-container .splash h1.splash-head - | Mailgun #{domain} + | Mailgun br small Send Email p.splash-subhead @@ -22,7 +22,7 @@ head else p.success.splash-subhead= msg div - form#credform.pure-form.pure-form-stacked.pure-g(enctype="multipart/form-data" method='post' action="/message") + form#credform.pure-form.pure-form-stacked.pure-g(enctype="multipart/form-data" method='post' action="/mailgun/message") .pure-u-1-2.pure-padding input#usrDomain(type='text' name='domain' required='' value=domain placeholder='Domain' title='Domain') .pure-u-1-2.pure-padding @@ -38,11 +38,18 @@ head option(value='') Select Mailing List each item in mailing_list option(value=item.email)=item.name + " ( " + item.email + " )" + .pure-u-1-4.pure-padding + a.button-success.d-inline-block.pure-button(href='/mailgun/list', target='mailing_list', style="margin-top: 4px;") Download Addresses .pure-u-1.pure-padding textarea#message(name='message' placeholder='Message')= (( req_data.message )? req_data.message : '') .pure-u-1.pure-padding .fallback + label(class="text-white") Attachments input(name='file' type='file' multiple='') + .pure-u-1.pure-padding + .fallback + label(class="text-white") Template Variable File + input(name='varfile' type='file' multiple='') .pure-u-1.pure-padding button.button-success.pure-button(style=' min-height: 38px; margin-top: 4px; ' type='submit') Send Message #notice.modal.micromodal-slide(aria-hidden='true') diff --git a/src/routes/auth.js b/src/routes/auth.js new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/index.js b/src/routes/index.js new file mode 100644 index 0000000..c502387 --- /dev/null +++ b/src/routes/index.js @@ -0,0 +1,9 @@ +var express = require("express"); +var router = express.Router(); + +/* GET home page. */ +router.get("/", function (req, res, next) { + res.send(200, { message: "ok" }); +}); + +module.exports = router; diff --git a/src/routes/mailgun.js b/src/routes/mailgun.js new file mode 100644 index 0000000..dc93026 --- /dev/null +++ b/src/routes/mailgun.js @@ -0,0 +1,189 @@ +/** Express router providing mailgun related routes + * @module routers/users + * @requires express + * @requires fs + */ + +const express = require("express"); + +const path = require("path"); +const uploadDir = path.join(__basedir, "uploads"); + +// Module Imports +const { initializeMailgunClient } = require("../util/initializeClient"); +const { + createMailingList, + getMailingLists, + downloadMailingList, +} = require("../controllers/mailingList"); +const { getMembers, addMembers } = require("../controllers/members"); +const { + attachFiles, + generateRecipientVariablesCSV, +} = require("../controllers/attachments"); +const { + sendMessage, + generateRecipientVariables, +} = require("../controllers/message"); + +/** + * Express router to mount mailgun related functions on. + * @type {object} + * @const + * @namespace mailgunRouter + */ +const router = express.Router(); + +/** + * Route to create mailing list with members + * @name post/list/create + * @function + * @memberof module:routers/mailgun~mailgunRouter + * @param {string} apiKey The mailgun api key + * @param {string} domain The mailgun domain (e.g example.com) + * @param {string} name The name of the mailing list + * @param {string} description + * @param {string} accessLevel + * @param {string[]} members The members to be added to the list + */ + +router.get("/list", async (req, res) => { + const mailingList = await getMailingLists(req, res); + + res.render("mailing_list", { + mailing_list: mailingList.mailing_list, + }); +}); +router.post("/list/create", async (req, res) => { + createMailingList(req, res); +}); + +router.post("/list/add-members", async (req, res) => { + const client = initializeMailgunClient(req.body.apiKey); + const members = addMembers( + req.body.mailing_list, + req.body.members, + client, + res + ); + res.status(201).send({ status: "Success", data: { ...members } }); +}); + +router.delete("/list/delete", async (req, res) => { + const client = initializeMailgunClient(req.body.apiKey); + try { + const result = await client.lists.destroy(req.body.mailing_list_address); + res.status(200).send({ + status: "Success", + data: result, + }); + } catch (err) { + res.status(400).send({ status: "Error", error: err }); + } +}); + +router.post("/upload", async (req, res) => { + console.log("Called upload"); + + console.log("\n\n"); + if (req.files) { + console.log(req.files.file); + const file = req.files.file; + } +}); +/** + * Route serving mailing list. + * @name get/list + * @function + * @memberof module:routers/mailgun~mailgunRouter + * @param {string} apiKey The mailgun api key + * @param {string} domain The mailgun domain (e.g example.com) + */ +router.post("/", async (req, res) => { + const result = await getMailingLists(req, res); + + req.session.apiKey = req.body.apiKey; + req.session.domain = req.body.domain; + + res.render("message", { + apiKey: req.body.apiKey, + domain: req.body.domain, + req_data: req.body, + mailing_list: result.mailing_list, + mailing_options: result.mailing_options, + msg: "Send Custom Message to Mailing List.", + err: false, + }); +}); + +router.get("/list/download", async (req, res) => { + downloadMailingList(req, res); +}); + +router.get("/list/members", async (req, res) => { + const members = await getMembers(req, res, req.body.mailing_list); + res.status(200).send({ data: members }); +}); + +router.post("/message", async (req, res) => { + const client = initializeMailgunClient(req.body.apiKey); + const mailingList = await getMailingLists(req, res); + + let fileAttachments = await attachFiles(req, res, uploadDir); + + // Generate Recipient Variables + const members = await getMembers(req, res, req.body.mailing_list); + + let recipientVariables = {}; + if (req.files && req.files.varfile) { + // Create recipient variables from CSV + recipientVariables = await generateRecipientVariablesCSV(req); + + // Update member variables if recipient variables are uploaded + for (let member of members.items) { + member.vars = { ...recipientVariables[member.address] }; + } + + const updatedMembers = await addMembers( + req.body.mailing_list, + members.items, + client, + res + ); + console.log("Update members"); + console.log(updatedMembers); + } + + // Update recipient variables for mail + try { + generateRecipientVariables(recipientVariables, members.items); + sendMessage( + req, + res, + fileAttachments, + client, + mailingList, + recipientVariables + ); + } catch (error) { + console.error(error); + res.render("message", { + apiKey: req.body.apiKey, + domain: req.body.domain, + req_data: req.body, + mailing_list: mailingList.mailing_list, + mailing_options: mailingList.mailing_options, + msg: "Error. Something went wrong.", + err: true, + }); + + } + + // res.status(200).send({ + // vars: recipientVariables, + // members: members.items, + // attachments: fileAttachments, + // }); +}); + +module.exports = router; diff --git a/src/util/initializeClient.js b/src/util/initializeClient.js new file mode 100644 index 0000000..3786332 --- /dev/null +++ b/src/util/initializeClient.js @@ -0,0 +1,15 @@ +const formData = require("form-data"); +const Mailgun = require("mailgun.js"); + +/** Initializes Mailgun Client with API Key*/ +const initializeMailgunClient = (apiKey) => { + const mailgun = new Mailgun(formData); + const client = mailgun.client({ + username: "api", + key: apiKey, + }); + + return client; +}; + +module.exports = { initializeMailgunClient }; diff --git a/src/util/stringUtil.js b/src/util/stringUtil.js new file mode 100644 index 0000000..1d43ae8 --- /dev/null +++ b/src/util/stringUtil.js @@ -0,0 +1,8 @@ +function slugify(text) { + return text + .toLowerCase() + .replace(/ /g, "-") + .replace(/[^\w-]+/g, ""); +} + +module.exports = { slugify };