├── .gitignore ├── LICENSE ├── README.md ├── _helpers ├── db.js ├── role.js ├── send-email.js └── swagger.js ├── _middleware ├── authorize.js ├── error-handler.js └── validate-request.js ├── accounts ├── account.model.js ├── account.service.js ├── accounts.controller.js └── refresh-token.model.js ├── config.json ├── package-lock.json ├── package.json ├── server.js └── swagger.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | typings 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional REPL history 38 | .node_repl_history -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Jason Watmore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-mysql-signup-verification-api 2 | 3 | NodeJS + MySQL - Boilerplate API with Email Sign Up, Verification, Authentication & Forgot Password 4 | 5 | For documentation and instructions see https://jasonwatmore.com/post/2020/09/08/nodejs-mysql-boilerplate-api-with-email-sign-up-verification-authentication-forgot-password -------------------------------------------------------------------------------- /_helpers/db.js: -------------------------------------------------------------------------------- 1 | const config = require('config.json'); 2 | const mysql = require('mysql2/promise'); 3 | const { Sequelize } = require('sequelize'); 4 | 5 | module.exports = db = {}; 6 | 7 | initialize(); 8 | 9 | async function initialize() { 10 | // create db if it doesn't already exist 11 | const { host, port, user, password, database } = config.database; 12 | const connection = await mysql.createConnection({ host, port, user, password }); 13 | await connection.query(`CREATE DATABASE IF NOT EXISTS \`${database}\`;`); 14 | 15 | // connect to db 16 | const sequelize = new Sequelize(database, user, password, { dialect: 'mysql' }); 17 | 18 | // init models and add them to the exported db object 19 | db.Account = require('../accounts/account.model')(sequelize); 20 | db.RefreshToken = require('../accounts/refresh-token.model')(sequelize); 21 | 22 | // define relationships 23 | db.Account.hasMany(db.RefreshToken, { onDelete: 'CASCADE' }); 24 | db.RefreshToken.belongsTo(db.Account); 25 | 26 | // sync all models with database 27 | await sequelize.sync(); 28 | } -------------------------------------------------------------------------------- /_helpers/role.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Admin: 'Admin', 3 | User: 'User' 4 | } -------------------------------------------------------------------------------- /_helpers/send-email.js: -------------------------------------------------------------------------------- 1 | const nodemailer = require('nodemailer'); 2 | const config = require('config.json'); 3 | 4 | module.exports = sendEmail; 5 | 6 | async function sendEmail({ to, subject, html, from = config.emailFrom }) { 7 | const transporter = nodemailer.createTransport(config.smtpOptions); 8 | await transporter.sendMail({ from, to, subject, html }); 9 | } -------------------------------------------------------------------------------- /_helpers/swagger.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const swaggerUi = require('swagger-ui-express'); 4 | const YAML = require('yamljs'); 5 | const swaggerDocument = YAML.load('./swagger.yaml'); 6 | 7 | router.use('/', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); 8 | 9 | module.exports = router; -------------------------------------------------------------------------------- /_middleware/authorize.js: -------------------------------------------------------------------------------- 1 | const jwt = require('express-jwt'); 2 | const { secret } = require('config.json'); 3 | const db = require('_helpers/db'); 4 | 5 | module.exports = authorize; 6 | 7 | function authorize(roles = []) { 8 | // roles param can be a single role string (e.g. Role.User or 'User') 9 | // or an array of roles (e.g. [Role.Admin, Role.User] or ['Admin', 'User']) 10 | if (typeof roles === 'string') { 11 | roles = [roles]; 12 | } 13 | 14 | return [ 15 | // authenticate JWT token and attach user to request object (req.user) 16 | jwt({ secret, algorithms: ['HS256'] }), 17 | 18 | // authorize based on user role 19 | async (req, res, next) => { 20 | const account = await db.Account.findByPk(req.user.id); 21 | 22 | if (!account || (roles.length && !roles.includes(account.role))) { 23 | // account no longer exists or role not authorized 24 | return res.status(401).json({ message: 'Unauthorized' }); 25 | } 26 | 27 | // authentication and authorization successful 28 | req.user.role = account.role; 29 | const refreshTokens = await account.getRefreshTokens(); 30 | req.user.ownsToken = token => !!refreshTokens.find(x => x.token === token); 31 | next(); 32 | } 33 | ]; 34 | } -------------------------------------------------------------------------------- /_middleware/error-handler.js: -------------------------------------------------------------------------------- 1 | module.exports = errorHandler; 2 | 3 | function errorHandler(err, req, res, next) { 4 | switch (true) { 5 | case typeof err === 'string': 6 | // custom application error 7 | const is404 = err.toLowerCase().endsWith('not found'); 8 | const statusCode = is404 ? 404 : 400; 9 | return res.status(statusCode).json({ message: err }); 10 | case err.name === 'UnauthorizedError': 11 | // jwt authentication error 12 | return res.status(401).json({ message: 'Unauthorized' }); 13 | default: 14 | return res.status(500).json({ message: err.message }); 15 | } 16 | } -------------------------------------------------------------------------------- /_middleware/validate-request.js: -------------------------------------------------------------------------------- 1 | module.exports = validateRequest; 2 | 3 | function validateRequest(req, next, schema) { 4 | const options = { 5 | abortEarly: false, // include all errors 6 | allowUnknown: true, // ignore unknown props 7 | stripUnknown: true // remove unknown props 8 | }; 9 | const { error, value } = schema.validate(req.body, options); 10 | if (error) { 11 | next(`Validation error: ${error.details.map(x => x.message).join(', ')}`); 12 | } else { 13 | req.body = value; 14 | next(); 15 | } 16 | } -------------------------------------------------------------------------------- /accounts/account.model.js: -------------------------------------------------------------------------------- 1 | const { DataTypes } = require('sequelize'); 2 | 3 | module.exports = model; 4 | 5 | function model(sequelize) { 6 | const attributes = { 7 | email: { type: DataTypes.STRING, allowNull: false }, 8 | passwordHash: { type: DataTypes.STRING, allowNull: false }, 9 | title: { type: DataTypes.STRING, allowNull: false }, 10 | firstName: { type: DataTypes.STRING, allowNull: false }, 11 | lastName: { type: DataTypes.STRING, allowNull: false }, 12 | acceptTerms: { type: DataTypes.BOOLEAN }, 13 | role: { type: DataTypes.STRING, allowNull: false }, 14 | verificationToken: { type: DataTypes.STRING }, 15 | verified: { type: DataTypes.DATE }, 16 | resetToken: { type: DataTypes.STRING }, 17 | resetTokenExpires: { type: DataTypes.DATE }, 18 | passwordReset: { type: DataTypes.DATE }, 19 | created: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }, 20 | updated: { type: DataTypes.DATE }, 21 | isVerified: { 22 | type: DataTypes.VIRTUAL, 23 | get() { return !!(this.verified || this.passwordReset); } 24 | } 25 | }; 26 | 27 | const options = { 28 | // disable default timestamp fields (createdAt and updatedAt) 29 | timestamps: false, 30 | defaultScope: { 31 | // exclude password hash by default 32 | attributes: { exclude: ['passwordHash'] } 33 | }, 34 | scopes: { 35 | // include hash with this scope 36 | withHash: { attributes: {}, } 37 | } 38 | }; 39 | 40 | return sequelize.define('account', attributes, options); 41 | } -------------------------------------------------------------------------------- /accounts/account.service.js: -------------------------------------------------------------------------------- 1 | const config = require('config.json'); 2 | const jwt = require('jsonwebtoken'); 3 | const bcrypt = require('bcryptjs'); 4 | const crypto = require("crypto"); 5 | const { Op } = require('sequelize'); 6 | const sendEmail = require('_helpers/send-email'); 7 | const db = require('_helpers/db'); 8 | const Role = require('_helpers/role'); 9 | 10 | module.exports = { 11 | authenticate, 12 | refreshToken, 13 | revokeToken, 14 | register, 15 | verifyEmail, 16 | forgotPassword, 17 | validateResetToken, 18 | resetPassword, 19 | getAll, 20 | getById, 21 | create, 22 | update, 23 | delete: _delete 24 | }; 25 | 26 | async function authenticate({ email, password, ipAddress }) { 27 | const account = await db.Account.scope('withHash').findOne({ where: { email } }); 28 | 29 | if (!account || !account.isVerified || !(await bcrypt.compare(password, account.passwordHash))) { 30 | throw 'Email or password is incorrect'; 31 | } 32 | 33 | // authentication successful so generate jwt and refresh tokens 34 | const jwtToken = generateJwtToken(account); 35 | const refreshToken = generateRefreshToken(account, ipAddress); 36 | 37 | // save refresh token 38 | await refreshToken.save(); 39 | 40 | // return basic details and tokens 41 | return { 42 | ...basicDetails(account), 43 | jwtToken, 44 | refreshToken: refreshToken.token 45 | }; 46 | } 47 | 48 | async function refreshToken({ token, ipAddress }) { 49 | const refreshToken = await getRefreshToken(token); 50 | const account = await refreshToken.getAccount(); 51 | 52 | // replace old refresh token with a new one and save 53 | const newRefreshToken = generateRefreshToken(account, ipAddress); 54 | refreshToken.revoked = Date.now(); 55 | refreshToken.revokedByIp = ipAddress; 56 | refreshToken.replacedByToken = newRefreshToken.token; 57 | await refreshToken.save(); 58 | await newRefreshToken.save(); 59 | 60 | // generate new jwt 61 | const jwtToken = generateJwtToken(account); 62 | 63 | // return basic details and tokens 64 | return { 65 | ...basicDetails(account), 66 | jwtToken, 67 | refreshToken: newRefreshToken.token 68 | }; 69 | } 70 | 71 | async function revokeToken({ token, ipAddress }) { 72 | const refreshToken = await getRefreshToken(token); 73 | 74 | // revoke token and save 75 | refreshToken.revoked = Date.now(); 76 | refreshToken.revokedByIp = ipAddress; 77 | await refreshToken.save(); 78 | } 79 | 80 | async function register(params, origin) { 81 | // validate 82 | if (await db.Account.findOne({ where: { email: params.email } })) { 83 | // send already registered error in email to prevent account enumeration 84 | return await sendAlreadyRegisteredEmail(params.email, origin); 85 | } 86 | 87 | // create account object 88 | const account = new db.Account(params); 89 | 90 | // first registered account is an admin 91 | const isFirstAccount = (await db.Account.count()) === 0; 92 | account.role = isFirstAccount ? Role.Admin : Role.User; 93 | account.verificationToken = randomTokenString(); 94 | 95 | // hash password 96 | account.passwordHash = await hash(params.password); 97 | 98 | // save account 99 | await account.save(); 100 | 101 | // send email 102 | await sendVerificationEmail(account, origin); 103 | } 104 | 105 | async function verifyEmail({ token }) { 106 | const account = await db.Account.findOne({ where: { verificationToken: token } }); 107 | 108 | if (!account) throw 'Verification failed'; 109 | 110 | account.verified = Date.now(); 111 | account.verificationToken = null; 112 | await account.save(); 113 | } 114 | 115 | async function forgotPassword({ email }, origin) { 116 | const account = await db.Account.findOne({ where: { email } }); 117 | 118 | // always return ok response to prevent email enumeration 119 | if (!account) return; 120 | 121 | // create reset token that expires after 24 hours 122 | account.resetToken = randomTokenString(); 123 | account.resetTokenExpires = new Date(Date.now() + 24*60*60*1000); 124 | await account.save(); 125 | 126 | // send email 127 | await sendPasswordResetEmail(account, origin); 128 | } 129 | 130 | async function validateResetToken({ token }) { 131 | const account = await db.Account.findOne({ 132 | where: { 133 | resetToken: token, 134 | resetTokenExpires: { [Op.gt]: Date.now() } 135 | } 136 | }); 137 | 138 | if (!account) throw 'Invalid token'; 139 | 140 | return account; 141 | } 142 | 143 | async function resetPassword({ token, password }) { 144 | const account = await validateResetToken({ token }); 145 | 146 | // update password and remove reset token 147 | account.passwordHash = await hash(password); 148 | account.passwordReset = Date.now(); 149 | account.resetToken = null; 150 | await account.save(); 151 | } 152 | 153 | async function getAll() { 154 | const accounts = await db.Account.findAll(); 155 | return accounts.map(x => basicDetails(x)); 156 | } 157 | 158 | async function getById(id) { 159 | const account = await getAccount(id); 160 | return basicDetails(account); 161 | } 162 | 163 | async function create(params) { 164 | // validate 165 | if (await db.Account.findOne({ where: { email: params.email } })) { 166 | throw 'Email "' + params.email + '" is already registered'; 167 | } 168 | 169 | const account = new db.Account(params); 170 | account.verified = Date.now(); 171 | 172 | // hash password 173 | account.passwordHash = await hash(params.password); 174 | 175 | // save account 176 | await account.save(); 177 | 178 | return basicDetails(account); 179 | } 180 | 181 | async function update(id, params) { 182 | const account = await getAccount(id); 183 | 184 | // validate (if email was changed) 185 | if (params.email && account.email !== params.email && await db.Account.findOne({ where: { email: params.email } })) { 186 | throw 'Email "' + params.email + '" is already taken'; 187 | } 188 | 189 | // hash password if it was entered 190 | if (params.password) { 191 | params.passwordHash = await hash(params.password); 192 | } 193 | 194 | // copy params to account and save 195 | Object.assign(account, params); 196 | account.updated = Date.now(); 197 | await account.save(); 198 | 199 | return basicDetails(account); 200 | } 201 | 202 | async function _delete(id) { 203 | const account = await getAccount(id); 204 | await account.destroy(); 205 | } 206 | 207 | // helper functions 208 | 209 | async function getAccount(id) { 210 | const account = await db.Account.findByPk(id); 211 | if (!account) throw 'Account not found'; 212 | return account; 213 | } 214 | 215 | async function getRefreshToken(token) { 216 | const refreshToken = await db.RefreshToken.findOne({ where: { token } }); 217 | if (!refreshToken || !refreshToken.isActive) throw 'Invalid token'; 218 | return refreshToken; 219 | } 220 | 221 | async function hash(password) { 222 | return await bcrypt.hash(password, 10); 223 | } 224 | 225 | function generateJwtToken(account) { 226 | // create a jwt token containing the account id that expires in 15 minutes 227 | return jwt.sign({ sub: account.id, id: account.id }, config.secret, { expiresIn: '15m' }); 228 | } 229 | 230 | function generateRefreshToken(account, ipAddress) { 231 | // create a refresh token that expires in 7 days 232 | return new db.RefreshToken({ 233 | accountId: account.id, 234 | token: randomTokenString(), 235 | expires: new Date(Date.now() + 7*24*60*60*1000), 236 | createdByIp: ipAddress 237 | }); 238 | } 239 | 240 | function randomTokenString() { 241 | return crypto.randomBytes(40).toString('hex'); 242 | } 243 | 244 | function basicDetails(account) { 245 | const { id, title, firstName, lastName, email, role, created, updated, isVerified } = account; 246 | return { id, title, firstName, lastName, email, role, created, updated, isVerified }; 247 | } 248 | 249 | async function sendVerificationEmail(account, origin) { 250 | let message; 251 | if (origin) { 252 | const verifyUrl = `${origin}/account/verify-email?token=${account.verificationToken}`; 253 | message = `

Please click the below link to verify your email address:

254 |

${verifyUrl}

`; 255 | } else { 256 | message = `

Please use the below token to verify your email address with the /account/verify-email api route:

257 |

${account.verificationToken}

`; 258 | } 259 | 260 | await sendEmail({ 261 | to: account.email, 262 | subject: 'Sign-up Verification API - Verify Email', 263 | html: `

Verify Email

264 |

Thanks for registering!

265 | ${message}` 266 | }); 267 | } 268 | 269 | async function sendAlreadyRegisteredEmail(email, origin) { 270 | let message; 271 | if (origin) { 272 | message = `

If you don't know your password please visit the forgot password page.

`; 273 | } else { 274 | message = `

If you don't know your password you can reset it via the /account/forgot-password api route.

`; 275 | } 276 | 277 | await sendEmail({ 278 | to: email, 279 | subject: 'Sign-up Verification API - Email Already Registered', 280 | html: `

Email Already Registered

281 |

Your email ${email} is already registered.

282 | ${message}` 283 | }); 284 | } 285 | 286 | async function sendPasswordResetEmail(account, origin) { 287 | let message; 288 | if (origin) { 289 | const resetUrl = `${origin}/account/reset-password?token=${account.resetToken}`; 290 | message = `

Please click the below link to reset your password, the link will be valid for 1 day:

291 |

${resetUrl}

`; 292 | } else { 293 | message = `

Please use the below token to reset your password with the /account/reset-password api route:

294 |

${account.resetToken}

`; 295 | } 296 | 297 | await sendEmail({ 298 | to: account.email, 299 | subject: 'Sign-up Verification API - Reset Password', 300 | html: `

Reset Password Email

301 | ${message}` 302 | }); 303 | } -------------------------------------------------------------------------------- /accounts/accounts.controller.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | const Joi = require('joi'); 4 | const validateRequest = require('_middleware/validate-request'); 5 | const authorize = require('_middleware/authorize') 6 | const Role = require('_helpers/role'); 7 | const accountService = require('./account.service'); 8 | 9 | // routes 10 | router.post('/authenticate', authenticateSchema, authenticate); 11 | router.post('/refresh-token', refreshToken); 12 | router.post('/revoke-token', authorize(), revokeTokenSchema, revokeToken); 13 | router.post('/register', registerSchema, register); 14 | router.post('/verify-email', verifyEmailSchema, verifyEmail); 15 | router.post('/forgot-password', forgotPasswordSchema, forgotPassword); 16 | router.post('/validate-reset-token', validateResetTokenSchema, validateResetToken); 17 | router.post('/reset-password', resetPasswordSchema, resetPassword); 18 | router.get('/', authorize(Role.Admin), getAll); 19 | router.get('/:id', authorize(), getById); 20 | router.post('/', authorize(Role.Admin), createSchema, create); 21 | router.put('/:id', authorize(), updateSchema, update); 22 | router.delete('/:id', authorize(), _delete); 23 | 24 | module.exports = router; 25 | 26 | function authenticateSchema(req, res, next) { 27 | const schema = Joi.object({ 28 | email: Joi.string().required(), 29 | password: Joi.string().required() 30 | }); 31 | validateRequest(req, next, schema); 32 | } 33 | 34 | function authenticate(req, res, next) { 35 | const { email, password } = req.body; 36 | const ipAddress = req.ip; 37 | accountService.authenticate({ email, password, ipAddress }) 38 | .then(({ refreshToken, ...account }) => { 39 | setTokenCookie(res, refreshToken); 40 | res.json(account); 41 | }) 42 | .catch(next); 43 | } 44 | 45 | function refreshToken(req, res, next) { 46 | const token = req.cookies.refreshToken; 47 | const ipAddress = req.ip; 48 | accountService.refreshToken({ token, ipAddress }) 49 | .then(({ refreshToken, ...account }) => { 50 | setTokenCookie(res, refreshToken); 51 | res.json(account); 52 | }) 53 | .catch(next); 54 | } 55 | 56 | function revokeTokenSchema(req, res, next) { 57 | const schema = Joi.object({ 58 | token: Joi.string().empty('') 59 | }); 60 | validateRequest(req, next, schema); 61 | } 62 | 63 | function revokeToken(req, res, next) { 64 | // accept token from request body or cookie 65 | const token = req.body.token || req.cookies.refreshToken; 66 | const ipAddress = req.ip; 67 | 68 | if (!token) return res.status(400).json({ message: 'Token is required' }); 69 | 70 | // users can revoke their own tokens and admins can revoke any tokens 71 | if (!req.user.ownsToken(token) && req.user.role !== Role.Admin) { 72 | return res.status(401).json({ message: 'Unauthorized' }); 73 | } 74 | 75 | accountService.revokeToken({ token, ipAddress }) 76 | .then(() => res.json({ message: 'Token revoked' })) 77 | .catch(next); 78 | } 79 | 80 | function registerSchema(req, res, next) { 81 | const schema = Joi.object({ 82 | title: Joi.string().required(), 83 | firstName: Joi.string().required(), 84 | lastName: Joi.string().required(), 85 | email: Joi.string().email().required(), 86 | password: Joi.string().min(6).required(), 87 | confirmPassword: Joi.string().valid(Joi.ref('password')).required(), 88 | acceptTerms: Joi.boolean().valid(true).required() 89 | }); 90 | validateRequest(req, next, schema); 91 | } 92 | 93 | function register(req, res, next) { 94 | accountService.register(req.body, req.get('origin')) 95 | .then(() => res.json({ message: 'Registration successful, please check your email for verification instructions' })) 96 | .catch(next); 97 | } 98 | 99 | function verifyEmailSchema(req, res, next) { 100 | const schema = Joi.object({ 101 | token: Joi.string().required() 102 | }); 103 | validateRequest(req, next, schema); 104 | } 105 | 106 | function verifyEmail(req, res, next) { 107 | accountService.verifyEmail(req.body) 108 | .then(() => res.json({ message: 'Verification successful, you can now login' })) 109 | .catch(next); 110 | } 111 | 112 | function forgotPasswordSchema(req, res, next) { 113 | const schema = Joi.object({ 114 | email: Joi.string().email().required() 115 | }); 116 | validateRequest(req, next, schema); 117 | } 118 | 119 | function forgotPassword(req, res, next) { 120 | accountService.forgotPassword(req.body, req.get('origin')) 121 | .then(() => res.json({ message: 'Please check your email for password reset instructions' })) 122 | .catch(next); 123 | } 124 | 125 | function validateResetTokenSchema(req, res, next) { 126 | const schema = Joi.object({ 127 | token: Joi.string().required() 128 | }); 129 | validateRequest(req, next, schema); 130 | } 131 | 132 | function validateResetToken(req, res, next) { 133 | accountService.validateResetToken(req.body) 134 | .then(() => res.json({ message: 'Token is valid' })) 135 | .catch(next); 136 | } 137 | 138 | function resetPasswordSchema(req, res, next) { 139 | const schema = Joi.object({ 140 | token: Joi.string().required(), 141 | password: Joi.string().min(6).required(), 142 | confirmPassword: Joi.string().valid(Joi.ref('password')).required() 143 | }); 144 | validateRequest(req, next, schema); 145 | } 146 | 147 | function resetPassword(req, res, next) { 148 | accountService.resetPassword(req.body) 149 | .then(() => res.json({ message: 'Password reset successful, you can now login' })) 150 | .catch(next); 151 | } 152 | 153 | function getAll(req, res, next) { 154 | accountService.getAll() 155 | .then(accounts => res.json(accounts)) 156 | .catch(next); 157 | } 158 | 159 | function getById(req, res, next) { 160 | // users can get their own account and admins can get any account 161 | if (Number(req.params.id) !== req.user.id && req.user.role !== Role.Admin) { 162 | return res.status(401).json({ message: 'Unauthorized' }); 163 | } 164 | 165 | accountService.getById(req.params.id) 166 | .then(account => account ? res.json(account) : res.sendStatus(404)) 167 | .catch(next); 168 | } 169 | 170 | function createSchema(req, res, next) { 171 | const schema = Joi.object({ 172 | title: Joi.string().required(), 173 | firstName: Joi.string().required(), 174 | lastName: Joi.string().required(), 175 | email: Joi.string().email().required(), 176 | password: Joi.string().min(6).required(), 177 | confirmPassword: Joi.string().valid(Joi.ref('password')).required(), 178 | role: Joi.string().valid(Role.Admin, Role.User).required() 179 | }); 180 | validateRequest(req, next, schema); 181 | } 182 | 183 | function create(req, res, next) { 184 | accountService.create(req.body) 185 | .then(account => res.json(account)) 186 | .catch(next); 187 | } 188 | 189 | function updateSchema(req, res, next) { 190 | const schemaRules = { 191 | title: Joi.string().empty(''), 192 | firstName: Joi.string().empty(''), 193 | lastName: Joi.string().empty(''), 194 | email: Joi.string().email().empty(''), 195 | password: Joi.string().min(6).empty(''), 196 | confirmPassword: Joi.string().valid(Joi.ref('password')).empty('') 197 | }; 198 | 199 | // only admins can update role 200 | if (req.user.role === Role.Admin) { 201 | schemaRules.role = Joi.string().valid(Role.Admin, Role.User).empty(''); 202 | } 203 | 204 | const schema = Joi.object(schemaRules).with('password', 'confirmPassword'); 205 | validateRequest(req, next, schema); 206 | } 207 | 208 | function update(req, res, next) { 209 | // users can update their own account and admins can update any account 210 | if (Number(req.params.id) !== req.user.id && req.user.role !== Role.Admin) { 211 | return res.status(401).json({ message: 'Unauthorized' }); 212 | } 213 | 214 | accountService.update(req.params.id, req.body) 215 | .then(account => res.json(account)) 216 | .catch(next); 217 | } 218 | 219 | function _delete(req, res, next) { 220 | // users can delete their own account and admins can delete any account 221 | if (Number(req.params.id) !== req.user.id && req.user.role !== Role.Admin) { 222 | return res.status(401).json({ message: 'Unauthorized' }); 223 | } 224 | 225 | accountService.delete(req.params.id) 226 | .then(() => res.json({ message: 'Account deleted successfully' })) 227 | .catch(next); 228 | } 229 | 230 | // helper functions 231 | 232 | function setTokenCookie(res, token) { 233 | // create cookie with refresh token that expires in 7 days 234 | const cookieOptions = { 235 | httpOnly: true, 236 | expires: new Date(Date.now() + 7*24*60*60*1000) 237 | }; 238 | res.cookie('refreshToken', token, cookieOptions); 239 | } -------------------------------------------------------------------------------- /accounts/refresh-token.model.js: -------------------------------------------------------------------------------- 1 | const { DataTypes } = require('sequelize'); 2 | 3 | module.exports = model; 4 | 5 | function model(sequelize) { 6 | const attributes = { 7 | token: { type: DataTypes.STRING }, 8 | expires: { type: DataTypes.DATE }, 9 | created: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }, 10 | createdByIp: { type: DataTypes.STRING }, 11 | revoked: { type: DataTypes.DATE }, 12 | revokedByIp: { type: DataTypes.STRING }, 13 | replacedByToken: { type: DataTypes.STRING }, 14 | isExpired: { 15 | type: DataTypes.VIRTUAL, 16 | get() { return Date.now() >= this.expires; } 17 | }, 18 | isActive: { 19 | type: DataTypes.VIRTUAL, 20 | get() { return !this.revoked && !this.isExpired; } 21 | } 22 | }; 23 | 24 | const options = { 25 | // disable default timestamp fields (createdAt and updatedAt) 26 | timestamps: false 27 | }; 28 | 29 | return sequelize.define('refreshToken', attributes, options); 30 | } -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "database": { 3 | "host": "localhost", 4 | "port": 3306, 5 | "user": "root", 6 | "password": "", 7 | "database": "node-mysql-signup-verification-api" 8 | }, 9 | "secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING", 10 | "emailFrom": "info@node-mysql-signup-verification-api.com", 11 | "smtpOptions": { 12 | "host": "[ENTER YOUR OWN SMTP OPTIONS OR CREATE FREE TEST ACCOUNT IN ONE CLICK AT https://ethereal.email/]", 13 | "port": 587, 14 | "auth": { 15 | "user": "", 16 | "pass": "" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-mysql-signup-verification-api", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@hapi/address": { 8 | "version": "4.1.0", 9 | "resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz", 10 | "integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==", 11 | "requires": { 12 | "@hapi/hoek": "^9.0.0" 13 | } 14 | }, 15 | "@hapi/formula": { 16 | "version": "2.0.0", 17 | "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz", 18 | "integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==" 19 | }, 20 | "@hapi/hoek": { 21 | "version": "9.1.0", 22 | "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.1.0.tgz", 23 | "integrity": "sha512-i9YbZPN3QgfighY/1X1Pu118VUz2Fmmhd6b2n0/O8YVgGGfw0FbUYoA97k7FkpGJ+pLCFEDLUmAPPV4D1kpeFw==" 24 | }, 25 | "@hapi/pinpoint": { 26 | "version": "2.0.0", 27 | "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz", 28 | "integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==" 29 | }, 30 | "@hapi/topo": { 31 | "version": "5.0.0", 32 | "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.0.0.tgz", 33 | "integrity": "sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw==", 34 | "requires": { 35 | "@hapi/hoek": "^9.0.0" 36 | } 37 | }, 38 | "@sindresorhus/is": { 39 | "version": "0.14.0", 40 | "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", 41 | "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", 42 | "dev": true 43 | }, 44 | "@szmarczak/http-timer": { 45 | "version": "1.1.2", 46 | "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", 47 | "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", 48 | "dev": true, 49 | "requires": { 50 | "defer-to-connect": "^1.0.1" 51 | } 52 | }, 53 | "@types/color-name": { 54 | "version": "1.1.1", 55 | "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", 56 | "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", 57 | "dev": true 58 | }, 59 | "@types/node": { 60 | "version": "14.6.2", 61 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz", 62 | "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==" 63 | }, 64 | "abbrev": { 65 | "version": "1.1.1", 66 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", 67 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", 68 | "dev": true 69 | }, 70 | "accepts": { 71 | "version": "1.3.7", 72 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 73 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 74 | "requires": { 75 | "mime-types": "~2.1.24", 76 | "negotiator": "0.6.2" 77 | } 78 | }, 79 | "ansi-align": { 80 | "version": "3.0.0", 81 | "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", 82 | "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", 83 | "dev": true, 84 | "requires": { 85 | "string-width": "^3.0.0" 86 | }, 87 | "dependencies": { 88 | "string-width": { 89 | "version": "3.1.0", 90 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", 91 | "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", 92 | "dev": true, 93 | "requires": { 94 | "emoji-regex": "^7.0.1", 95 | "is-fullwidth-code-point": "^2.0.0", 96 | "strip-ansi": "^5.1.0" 97 | } 98 | } 99 | } 100 | }, 101 | "ansi-regex": { 102 | "version": "4.1.0", 103 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", 104 | "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", 105 | "dev": true 106 | }, 107 | "ansi-styles": { 108 | "version": "4.2.1", 109 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", 110 | "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", 111 | "dev": true, 112 | "requires": { 113 | "@types/color-name": "^1.1.1", 114 | "color-convert": "^2.0.1" 115 | } 116 | }, 117 | "ansicolors": { 118 | "version": "0.3.2", 119 | "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", 120 | "integrity": "sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk=" 121 | }, 122 | "any-promise": { 123 | "version": "1.3.0", 124 | "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", 125 | "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" 126 | }, 127 | "anymatch": { 128 | "version": "3.1.1", 129 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", 130 | "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", 131 | "dev": true, 132 | "requires": { 133 | "normalize-path": "^3.0.0", 134 | "picomatch": "^2.0.4" 135 | } 136 | }, 137 | "argparse": { 138 | "version": "1.0.10", 139 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", 140 | "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", 141 | "requires": { 142 | "sprintf-js": "~1.0.2" 143 | } 144 | }, 145 | "array-flatten": { 146 | "version": "1.1.1", 147 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 148 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 149 | }, 150 | "async": { 151 | "version": "1.5.2", 152 | "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", 153 | "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" 154 | }, 155 | "balanced-match": { 156 | "version": "1.0.0", 157 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 158 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 159 | }, 160 | "bcryptjs": { 161 | "version": "2.4.3", 162 | "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", 163 | "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" 164 | }, 165 | "binary-extensions": { 166 | "version": "2.1.0", 167 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", 168 | "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", 169 | "dev": true 170 | }, 171 | "body-parser": { 172 | "version": "1.19.0", 173 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 174 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", 175 | "requires": { 176 | "bytes": "3.1.0", 177 | "content-type": "~1.0.4", 178 | "debug": "2.6.9", 179 | "depd": "~1.1.2", 180 | "http-errors": "1.7.2", 181 | "iconv-lite": "0.4.24", 182 | "on-finished": "~2.3.0", 183 | "qs": "6.7.0", 184 | "raw-body": "2.4.0", 185 | "type-is": "~1.6.17" 186 | } 187 | }, 188 | "boxen": { 189 | "version": "4.2.0", 190 | "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", 191 | "integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==", 192 | "dev": true, 193 | "requires": { 194 | "ansi-align": "^3.0.0", 195 | "camelcase": "^5.3.1", 196 | "chalk": "^3.0.0", 197 | "cli-boxes": "^2.2.0", 198 | "string-width": "^4.1.0", 199 | "term-size": "^2.1.0", 200 | "type-fest": "^0.8.1", 201 | "widest-line": "^3.1.0" 202 | } 203 | }, 204 | "brace-expansion": { 205 | "version": "1.1.11", 206 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 207 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 208 | "requires": { 209 | "balanced-match": "^1.0.0", 210 | "concat-map": "0.0.1" 211 | } 212 | }, 213 | "braces": { 214 | "version": "3.0.2", 215 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 216 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 217 | "dev": true, 218 | "requires": { 219 | "fill-range": "^7.0.1" 220 | } 221 | }, 222 | "buffer-equal-constant-time": { 223 | "version": "1.0.1", 224 | "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", 225 | "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" 226 | }, 227 | "bytes": { 228 | "version": "3.1.0", 229 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 230 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" 231 | }, 232 | "cacheable-request": { 233 | "version": "6.1.0", 234 | "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", 235 | "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", 236 | "dev": true, 237 | "requires": { 238 | "clone-response": "^1.0.2", 239 | "get-stream": "^5.1.0", 240 | "http-cache-semantics": "^4.0.0", 241 | "keyv": "^3.0.0", 242 | "lowercase-keys": "^2.0.0", 243 | "normalize-url": "^4.1.0", 244 | "responselike": "^1.0.2" 245 | }, 246 | "dependencies": { 247 | "get-stream": { 248 | "version": "5.1.0", 249 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", 250 | "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", 251 | "dev": true, 252 | "requires": { 253 | "pump": "^3.0.0" 254 | } 255 | }, 256 | "lowercase-keys": { 257 | "version": "2.0.0", 258 | "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", 259 | "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", 260 | "dev": true 261 | } 262 | } 263 | }, 264 | "camelcase": { 265 | "version": "5.3.1", 266 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 267 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", 268 | "dev": true 269 | }, 270 | "cardinal": { 271 | "version": "2.1.1", 272 | "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", 273 | "integrity": "sha1-fMEFXYItISlU0HsIXeolHMe8VQU=", 274 | "requires": { 275 | "ansicolors": "~0.3.2", 276 | "redeyed": "~2.1.0" 277 | } 278 | }, 279 | "chalk": { 280 | "version": "3.0.0", 281 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", 282 | "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", 283 | "dev": true, 284 | "requires": { 285 | "ansi-styles": "^4.1.0", 286 | "supports-color": "^7.1.0" 287 | }, 288 | "dependencies": { 289 | "has-flag": { 290 | "version": "4.0.0", 291 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 292 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 293 | "dev": true 294 | }, 295 | "supports-color": { 296 | "version": "7.1.0", 297 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", 298 | "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", 299 | "dev": true, 300 | "requires": { 301 | "has-flag": "^4.0.0" 302 | } 303 | } 304 | } 305 | }, 306 | "chokidar": { 307 | "version": "3.4.1", 308 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz", 309 | "integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==", 310 | "dev": true, 311 | "requires": { 312 | "anymatch": "~3.1.1", 313 | "braces": "~3.0.2", 314 | "fsevents": "~2.1.2", 315 | "glob-parent": "~5.1.0", 316 | "is-binary-path": "~2.1.0", 317 | "is-glob": "~4.0.1", 318 | "normalize-path": "~3.0.0", 319 | "readdirp": "~3.4.0" 320 | } 321 | }, 322 | "ci-info": { 323 | "version": "2.0.0", 324 | "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", 325 | "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", 326 | "dev": true 327 | }, 328 | "cli-boxes": { 329 | "version": "2.2.0", 330 | "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", 331 | "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", 332 | "dev": true 333 | }, 334 | "clone-response": { 335 | "version": "1.0.2", 336 | "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", 337 | "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", 338 | "dev": true, 339 | "requires": { 340 | "mimic-response": "^1.0.0" 341 | } 342 | }, 343 | "color-convert": { 344 | "version": "2.0.1", 345 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 346 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 347 | "dev": true, 348 | "requires": { 349 | "color-name": "~1.1.4" 350 | } 351 | }, 352 | "color-name": { 353 | "version": "1.1.4", 354 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 355 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 356 | "dev": true 357 | }, 358 | "concat-map": { 359 | "version": "0.0.1", 360 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 361 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 362 | }, 363 | "configstore": { 364 | "version": "5.0.1", 365 | "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", 366 | "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", 367 | "dev": true, 368 | "requires": { 369 | "dot-prop": "^5.2.0", 370 | "graceful-fs": "^4.1.2", 371 | "make-dir": "^3.0.0", 372 | "unique-string": "^2.0.0", 373 | "write-file-atomic": "^3.0.0", 374 | "xdg-basedir": "^4.0.0" 375 | } 376 | }, 377 | "content-disposition": { 378 | "version": "0.5.3", 379 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", 380 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", 381 | "requires": { 382 | "safe-buffer": "5.1.2" 383 | } 384 | }, 385 | "content-type": { 386 | "version": "1.0.4", 387 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 388 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 389 | }, 390 | "cookie": { 391 | "version": "0.4.0", 392 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", 393 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" 394 | }, 395 | "cookie-parser": { 396 | "version": "1.4.5", 397 | "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", 398 | "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", 399 | "requires": { 400 | "cookie": "0.4.0", 401 | "cookie-signature": "1.0.6" 402 | } 403 | }, 404 | "cookie-signature": { 405 | "version": "1.0.6", 406 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 407 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 408 | }, 409 | "cors": { 410 | "version": "2.8.5", 411 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", 412 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", 413 | "requires": { 414 | "object-assign": "^4", 415 | "vary": "^1" 416 | } 417 | }, 418 | "crypto-random-string": { 419 | "version": "2.0.0", 420 | "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", 421 | "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", 422 | "dev": true 423 | }, 424 | "debug": { 425 | "version": "2.6.9", 426 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 427 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 428 | "requires": { 429 | "ms": "2.0.0" 430 | } 431 | }, 432 | "decompress-response": { 433 | "version": "3.3.0", 434 | "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", 435 | "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", 436 | "dev": true, 437 | "requires": { 438 | "mimic-response": "^1.0.0" 439 | } 440 | }, 441 | "deep-extend": { 442 | "version": "0.6.0", 443 | "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", 444 | "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", 445 | "dev": true 446 | }, 447 | "defer-to-connect": { 448 | "version": "1.1.3", 449 | "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", 450 | "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", 451 | "dev": true 452 | }, 453 | "denque": { 454 | "version": "1.4.1", 455 | "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", 456 | "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==" 457 | }, 458 | "depd": { 459 | "version": "1.1.2", 460 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 461 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 462 | }, 463 | "destroy": { 464 | "version": "1.0.4", 465 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 466 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 467 | }, 468 | "dot-prop": { 469 | "version": "5.2.0", 470 | "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", 471 | "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", 472 | "dev": true, 473 | "requires": { 474 | "is-obj": "^2.0.0" 475 | } 476 | }, 477 | "dottie": { 478 | "version": "2.0.2", 479 | "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.2.tgz", 480 | "integrity": "sha512-fmrwR04lsniq/uSr8yikThDTrM7epXHBAAjH9TbeH3rEA8tdCO7mRzB9hdmdGyJCxF8KERo9CITcm3kGuoyMhg==" 481 | }, 482 | "duplexer3": { 483 | "version": "0.1.4", 484 | "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", 485 | "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", 486 | "dev": true 487 | }, 488 | "ecdsa-sig-formatter": { 489 | "version": "1.0.11", 490 | "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", 491 | "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", 492 | "requires": { 493 | "safe-buffer": "^5.0.1" 494 | } 495 | }, 496 | "ee-first": { 497 | "version": "1.1.1", 498 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 499 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 500 | }, 501 | "emoji-regex": { 502 | "version": "7.0.3", 503 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", 504 | "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", 505 | "dev": true 506 | }, 507 | "encodeurl": { 508 | "version": "1.0.2", 509 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 510 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 511 | }, 512 | "end-of-stream": { 513 | "version": "1.4.4", 514 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 515 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 516 | "dev": true, 517 | "requires": { 518 | "once": "^1.4.0" 519 | } 520 | }, 521 | "escape-goat": { 522 | "version": "2.1.1", 523 | "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", 524 | "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", 525 | "dev": true 526 | }, 527 | "escape-html": { 528 | "version": "1.0.3", 529 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 530 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 531 | }, 532 | "esprima": { 533 | "version": "4.0.1", 534 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 535 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" 536 | }, 537 | "etag": { 538 | "version": "1.8.1", 539 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 540 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 541 | }, 542 | "express": { 543 | "version": "4.17.1", 544 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", 545 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", 546 | "requires": { 547 | "accepts": "~1.3.7", 548 | "array-flatten": "1.1.1", 549 | "body-parser": "1.19.0", 550 | "content-disposition": "0.5.3", 551 | "content-type": "~1.0.4", 552 | "cookie": "0.4.0", 553 | "cookie-signature": "1.0.6", 554 | "debug": "2.6.9", 555 | "depd": "~1.1.2", 556 | "encodeurl": "~1.0.2", 557 | "escape-html": "~1.0.3", 558 | "etag": "~1.8.1", 559 | "finalhandler": "~1.1.2", 560 | "fresh": "0.5.2", 561 | "merge-descriptors": "1.0.1", 562 | "methods": "~1.1.2", 563 | "on-finished": "~2.3.0", 564 | "parseurl": "~1.3.3", 565 | "path-to-regexp": "0.1.7", 566 | "proxy-addr": "~2.0.5", 567 | "qs": "6.7.0", 568 | "range-parser": "~1.2.1", 569 | "safe-buffer": "5.1.2", 570 | "send": "0.17.1", 571 | "serve-static": "1.14.1", 572 | "setprototypeof": "1.1.1", 573 | "statuses": "~1.5.0", 574 | "type-is": "~1.6.18", 575 | "utils-merge": "1.0.1", 576 | "vary": "~1.1.2" 577 | } 578 | }, 579 | "express-jwt": { 580 | "version": "6.0.0", 581 | "resolved": "https://registry.npmjs.org/express-jwt/-/express-jwt-6.0.0.tgz", 582 | "integrity": "sha512-C26y9myRjx7CyhZ+BAT3p+gQyRCoDZ7qo8plCvLDaRT6je6ALIAQknT6XLVQGFKwIy/Ux7lvM2MNap5dt0T7gA==", 583 | "requires": { 584 | "async": "^1.5.0", 585 | "express-unless": "^0.3.0", 586 | "jsonwebtoken": "^8.1.0", 587 | "lodash.set": "^4.0.0" 588 | } 589 | }, 590 | "express-unless": { 591 | "version": "0.3.1", 592 | "resolved": "https://registry.npmjs.org/express-unless/-/express-unless-0.3.1.tgz", 593 | "integrity": "sha1-JVfBRudb65A+LSR/m1ugFFJpbiA=" 594 | }, 595 | "fill-range": { 596 | "version": "7.0.1", 597 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 598 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 599 | "dev": true, 600 | "requires": { 601 | "to-regex-range": "^5.0.1" 602 | } 603 | }, 604 | "finalhandler": { 605 | "version": "1.1.2", 606 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 607 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 608 | "requires": { 609 | "debug": "2.6.9", 610 | "encodeurl": "~1.0.2", 611 | "escape-html": "~1.0.3", 612 | "on-finished": "~2.3.0", 613 | "parseurl": "~1.3.3", 614 | "statuses": "~1.5.0", 615 | "unpipe": "~1.0.0" 616 | } 617 | }, 618 | "forwarded": { 619 | "version": "0.1.2", 620 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 621 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 622 | }, 623 | "fresh": { 624 | "version": "0.5.2", 625 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 626 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 627 | }, 628 | "fs.realpath": { 629 | "version": "1.0.0", 630 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 631 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 632 | }, 633 | "fsevents": { 634 | "version": "2.1.3", 635 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", 636 | "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", 637 | "dev": true, 638 | "optional": true 639 | }, 640 | "generate-function": { 641 | "version": "2.3.1", 642 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", 643 | "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", 644 | "requires": { 645 | "is-property": "^1.0.2" 646 | } 647 | }, 648 | "get-stream": { 649 | "version": "4.1.0", 650 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", 651 | "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", 652 | "dev": true, 653 | "requires": { 654 | "pump": "^3.0.0" 655 | } 656 | }, 657 | "glob": { 658 | "version": "7.1.6", 659 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 660 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 661 | "requires": { 662 | "fs.realpath": "^1.0.0", 663 | "inflight": "^1.0.4", 664 | "inherits": "2", 665 | "minimatch": "^3.0.4", 666 | "once": "^1.3.0", 667 | "path-is-absolute": "^1.0.0" 668 | } 669 | }, 670 | "glob-parent": { 671 | "version": "5.1.1", 672 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", 673 | "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", 674 | "dev": true, 675 | "requires": { 676 | "is-glob": "^4.0.1" 677 | } 678 | }, 679 | "global-dirs": { 680 | "version": "2.0.1", 681 | "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.0.1.tgz", 682 | "integrity": "sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==", 683 | "dev": true, 684 | "requires": { 685 | "ini": "^1.3.5" 686 | } 687 | }, 688 | "got": { 689 | "version": "9.6.0", 690 | "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", 691 | "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", 692 | "dev": true, 693 | "requires": { 694 | "@sindresorhus/is": "^0.14.0", 695 | "@szmarczak/http-timer": "^1.1.2", 696 | "cacheable-request": "^6.0.0", 697 | "decompress-response": "^3.3.0", 698 | "duplexer3": "^0.1.4", 699 | "get-stream": "^4.1.0", 700 | "lowercase-keys": "^1.0.1", 701 | "mimic-response": "^1.0.1", 702 | "p-cancelable": "^1.0.0", 703 | "to-readable-stream": "^1.0.0", 704 | "url-parse-lax": "^3.0.0" 705 | } 706 | }, 707 | "graceful-fs": { 708 | "version": "4.2.4", 709 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", 710 | "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", 711 | "dev": true 712 | }, 713 | "has-flag": { 714 | "version": "3.0.0", 715 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 716 | "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", 717 | "dev": true 718 | }, 719 | "has-yarn": { 720 | "version": "2.1.0", 721 | "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", 722 | "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", 723 | "dev": true 724 | }, 725 | "http-cache-semantics": { 726 | "version": "4.1.0", 727 | "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", 728 | "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", 729 | "dev": true 730 | }, 731 | "http-errors": { 732 | "version": "1.7.2", 733 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 734 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", 735 | "requires": { 736 | "depd": "~1.1.2", 737 | "inherits": "2.0.3", 738 | "setprototypeof": "1.1.1", 739 | "statuses": ">= 1.5.0 < 2", 740 | "toidentifier": "1.0.0" 741 | } 742 | }, 743 | "iconv-lite": { 744 | "version": "0.4.24", 745 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 746 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 747 | "requires": { 748 | "safer-buffer": ">= 2.1.2 < 3" 749 | } 750 | }, 751 | "ignore-by-default": { 752 | "version": "1.0.1", 753 | "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", 754 | "integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=", 755 | "dev": true 756 | }, 757 | "import-lazy": { 758 | "version": "2.1.0", 759 | "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", 760 | "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", 761 | "dev": true 762 | }, 763 | "imurmurhash": { 764 | "version": "0.1.4", 765 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 766 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 767 | "dev": true 768 | }, 769 | "inflection": { 770 | "version": "1.12.0", 771 | "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.12.0.tgz", 772 | "integrity": "sha1-ogCTVlbW9fa8TcdQLhrstwMihBY=" 773 | }, 774 | "inflight": { 775 | "version": "1.0.6", 776 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 777 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 778 | "requires": { 779 | "once": "^1.3.0", 780 | "wrappy": "1" 781 | } 782 | }, 783 | "inherits": { 784 | "version": "2.0.3", 785 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 786 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 787 | }, 788 | "ini": { 789 | "version": "1.3.5", 790 | "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", 791 | "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", 792 | "dev": true 793 | }, 794 | "ipaddr.js": { 795 | "version": "1.9.1", 796 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 797 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 798 | }, 799 | "is-binary-path": { 800 | "version": "2.1.0", 801 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 802 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 803 | "dev": true, 804 | "requires": { 805 | "binary-extensions": "^2.0.0" 806 | } 807 | }, 808 | "is-ci": { 809 | "version": "2.0.0", 810 | "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", 811 | "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", 812 | "dev": true, 813 | "requires": { 814 | "ci-info": "^2.0.0" 815 | } 816 | }, 817 | "is-extglob": { 818 | "version": "2.1.1", 819 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 820 | "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", 821 | "dev": true 822 | }, 823 | "is-fullwidth-code-point": { 824 | "version": "2.0.0", 825 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 826 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 827 | "dev": true 828 | }, 829 | "is-glob": { 830 | "version": "4.0.1", 831 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", 832 | "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", 833 | "dev": true, 834 | "requires": { 835 | "is-extglob": "^2.1.1" 836 | } 837 | }, 838 | "is-installed-globally": { 839 | "version": "0.3.2", 840 | "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.2.tgz", 841 | "integrity": "sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==", 842 | "dev": true, 843 | "requires": { 844 | "global-dirs": "^2.0.1", 845 | "is-path-inside": "^3.0.1" 846 | } 847 | }, 848 | "is-npm": { 849 | "version": "4.0.0", 850 | "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", 851 | "integrity": "sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==", 852 | "dev": true 853 | }, 854 | "is-number": { 855 | "version": "7.0.0", 856 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 857 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 858 | "dev": true 859 | }, 860 | "is-obj": { 861 | "version": "2.0.0", 862 | "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", 863 | "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", 864 | "dev": true 865 | }, 866 | "is-path-inside": { 867 | "version": "3.0.2", 868 | "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", 869 | "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", 870 | "dev": true 871 | }, 872 | "is-property": { 873 | "version": "1.0.2", 874 | "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", 875 | "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" 876 | }, 877 | "is-typedarray": { 878 | "version": "1.0.0", 879 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 880 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", 881 | "dev": true 882 | }, 883 | "is-yarn-global": { 884 | "version": "0.3.0", 885 | "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", 886 | "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", 887 | "dev": true 888 | }, 889 | "joi": { 890 | "version": "17.2.1", 891 | "resolved": "https://registry.npmjs.org/joi/-/joi-17.2.1.tgz", 892 | "integrity": "sha512-YT3/4Ln+5YRpacdmfEfrrKh50/kkgX3LgBltjqnlMPIYiZ4hxXZuVJcxmsvxsdeHg9soZfE3qXxHC2tMpCCBOA==", 893 | "requires": { 894 | "@hapi/address": "^4.1.0", 895 | "@hapi/formula": "^2.0.0", 896 | "@hapi/hoek": "^9.0.0", 897 | "@hapi/pinpoint": "^2.0.0", 898 | "@hapi/topo": "^5.0.0" 899 | } 900 | }, 901 | "json-buffer": { 902 | "version": "3.0.0", 903 | "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", 904 | "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", 905 | "dev": true 906 | }, 907 | "jsonwebtoken": { 908 | "version": "8.5.1", 909 | "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", 910 | "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", 911 | "requires": { 912 | "jws": "^3.2.2", 913 | "lodash.includes": "^4.3.0", 914 | "lodash.isboolean": "^3.0.3", 915 | "lodash.isinteger": "^4.0.4", 916 | "lodash.isnumber": "^3.0.3", 917 | "lodash.isplainobject": "^4.0.6", 918 | "lodash.isstring": "^4.0.1", 919 | "lodash.once": "^4.0.0", 920 | "ms": "^2.1.1", 921 | "semver": "^5.6.0" 922 | }, 923 | "dependencies": { 924 | "ms": { 925 | "version": "2.1.2", 926 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 927 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 928 | } 929 | } 930 | }, 931 | "jwa": { 932 | "version": "1.4.1", 933 | "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", 934 | "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", 935 | "requires": { 936 | "buffer-equal-constant-time": "1.0.1", 937 | "ecdsa-sig-formatter": "1.0.11", 938 | "safe-buffer": "^5.0.1" 939 | } 940 | }, 941 | "jws": { 942 | "version": "3.2.2", 943 | "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", 944 | "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", 945 | "requires": { 946 | "jwa": "^1.4.1", 947 | "safe-buffer": "^5.0.1" 948 | } 949 | }, 950 | "keyv": { 951 | "version": "3.1.0", 952 | "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", 953 | "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", 954 | "dev": true, 955 | "requires": { 956 | "json-buffer": "3.0.0" 957 | } 958 | }, 959 | "latest-version": { 960 | "version": "5.1.0", 961 | "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", 962 | "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", 963 | "dev": true, 964 | "requires": { 965 | "package-json": "^6.3.0" 966 | } 967 | }, 968 | "lodash": { 969 | "version": "4.17.20", 970 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", 971 | "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" 972 | }, 973 | "lodash.includes": { 974 | "version": "4.3.0", 975 | "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", 976 | "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" 977 | }, 978 | "lodash.isboolean": { 979 | "version": "3.0.3", 980 | "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", 981 | "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" 982 | }, 983 | "lodash.isinteger": { 984 | "version": "4.0.4", 985 | "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", 986 | "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" 987 | }, 988 | "lodash.isnumber": { 989 | "version": "3.0.3", 990 | "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", 991 | "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" 992 | }, 993 | "lodash.isplainobject": { 994 | "version": "4.0.6", 995 | "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", 996 | "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" 997 | }, 998 | "lodash.isstring": { 999 | "version": "4.0.1", 1000 | "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", 1001 | "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" 1002 | }, 1003 | "lodash.once": { 1004 | "version": "4.1.1", 1005 | "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", 1006 | "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" 1007 | }, 1008 | "lodash.set": { 1009 | "version": "4.3.2", 1010 | "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", 1011 | "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" 1012 | }, 1013 | "long": { 1014 | "version": "4.0.0", 1015 | "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", 1016 | "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" 1017 | }, 1018 | "lowercase-keys": { 1019 | "version": "1.0.1", 1020 | "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", 1021 | "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", 1022 | "dev": true 1023 | }, 1024 | "lru-cache": { 1025 | "version": "5.1.1", 1026 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", 1027 | "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", 1028 | "requires": { 1029 | "yallist": "^3.0.2" 1030 | } 1031 | }, 1032 | "make-dir": { 1033 | "version": "3.1.0", 1034 | "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", 1035 | "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", 1036 | "dev": true, 1037 | "requires": { 1038 | "semver": "^6.0.0" 1039 | }, 1040 | "dependencies": { 1041 | "semver": { 1042 | "version": "6.3.0", 1043 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 1044 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", 1045 | "dev": true 1046 | } 1047 | } 1048 | }, 1049 | "media-typer": { 1050 | "version": "0.3.0", 1051 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 1052 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 1053 | }, 1054 | "merge-descriptors": { 1055 | "version": "1.0.1", 1056 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 1057 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 1058 | }, 1059 | "methods": { 1060 | "version": "1.1.2", 1061 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 1062 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 1063 | }, 1064 | "mime": { 1065 | "version": "1.6.0", 1066 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 1067 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 1068 | }, 1069 | "mime-db": { 1070 | "version": "1.44.0", 1071 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", 1072 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" 1073 | }, 1074 | "mime-types": { 1075 | "version": "2.1.27", 1076 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 1077 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 1078 | "requires": { 1079 | "mime-db": "1.44.0" 1080 | } 1081 | }, 1082 | "mimic-response": { 1083 | "version": "1.0.1", 1084 | "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", 1085 | "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", 1086 | "dev": true 1087 | }, 1088 | "minimatch": { 1089 | "version": "3.0.4", 1090 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 1091 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 1092 | "requires": { 1093 | "brace-expansion": "^1.1.7" 1094 | } 1095 | }, 1096 | "minimist": { 1097 | "version": "1.2.5", 1098 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 1099 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", 1100 | "dev": true 1101 | }, 1102 | "moment": { 1103 | "version": "2.27.0", 1104 | "resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz", 1105 | "integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==" 1106 | }, 1107 | "moment-timezone": { 1108 | "version": "0.5.31", 1109 | "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz", 1110 | "integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==", 1111 | "requires": { 1112 | "moment": ">= 2.9.0" 1113 | } 1114 | }, 1115 | "ms": { 1116 | "version": "2.0.0", 1117 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 1118 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 1119 | }, 1120 | "mysql2": { 1121 | "version": "2.1.0", 1122 | "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.1.0.tgz", 1123 | "integrity": "sha512-9kGVyi930rG2KaHrz3sHwtc6K+GY9d8wWk1XRSYxQiunvGcn4DwuZxOwmK11ftuhhwrYDwGx9Ta4VBwznJn36A==", 1124 | "requires": { 1125 | "cardinal": "^2.1.1", 1126 | "denque": "^1.4.1", 1127 | "generate-function": "^2.3.1", 1128 | "iconv-lite": "^0.5.0", 1129 | "long": "^4.0.0", 1130 | "lru-cache": "^5.1.1", 1131 | "named-placeholders": "^1.1.2", 1132 | "seq-queue": "^0.0.5", 1133 | "sqlstring": "^2.3.1" 1134 | }, 1135 | "dependencies": { 1136 | "iconv-lite": { 1137 | "version": "0.5.2", 1138 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz", 1139 | "integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==", 1140 | "requires": { 1141 | "safer-buffer": ">= 2.1.2 < 3" 1142 | } 1143 | } 1144 | } 1145 | }, 1146 | "named-placeholders": { 1147 | "version": "1.1.2", 1148 | "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz", 1149 | "integrity": "sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==", 1150 | "requires": { 1151 | "lru-cache": "^4.1.3" 1152 | }, 1153 | "dependencies": { 1154 | "lru-cache": { 1155 | "version": "4.1.5", 1156 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", 1157 | "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", 1158 | "requires": { 1159 | "pseudomap": "^1.0.2", 1160 | "yallist": "^2.1.2" 1161 | } 1162 | }, 1163 | "yallist": { 1164 | "version": "2.1.2", 1165 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", 1166 | "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" 1167 | } 1168 | } 1169 | }, 1170 | "negotiator": { 1171 | "version": "0.6.2", 1172 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 1173 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 1174 | }, 1175 | "nodemailer": { 1176 | "version": "6.4.11", 1177 | "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.4.11.tgz", 1178 | "integrity": "sha512-BVZBDi+aJV4O38rxsUh164Dk1NCqgh6Cm0rQSb9SK/DHGll/DrCMnycVDD7msJgZCnmVa8ASo8EZzR7jsgTukQ==" 1179 | }, 1180 | "nodemon": { 1181 | "version": "2.0.4", 1182 | "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.4.tgz", 1183 | "integrity": "sha512-Ltced+hIfTmaS28Zjv1BM552oQ3dbwPqI4+zI0SLgq+wpJhSyqgYude/aZa/3i31VCQWMfXJVxvu86abcam3uQ==", 1184 | "dev": true, 1185 | "requires": { 1186 | "chokidar": "^3.2.2", 1187 | "debug": "^3.2.6", 1188 | "ignore-by-default": "^1.0.1", 1189 | "minimatch": "^3.0.4", 1190 | "pstree.remy": "^1.1.7", 1191 | "semver": "^5.7.1", 1192 | "supports-color": "^5.5.0", 1193 | "touch": "^3.1.0", 1194 | "undefsafe": "^2.0.2", 1195 | "update-notifier": "^4.0.0" 1196 | }, 1197 | "dependencies": { 1198 | "debug": { 1199 | "version": "3.2.6", 1200 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 1201 | "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", 1202 | "dev": true, 1203 | "requires": { 1204 | "ms": "^2.1.1" 1205 | } 1206 | }, 1207 | "ms": { 1208 | "version": "2.1.2", 1209 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1210 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 1211 | "dev": true 1212 | } 1213 | } 1214 | }, 1215 | "nopt": { 1216 | "version": "1.0.10", 1217 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", 1218 | "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", 1219 | "dev": true, 1220 | "requires": { 1221 | "abbrev": "1" 1222 | } 1223 | }, 1224 | "normalize-path": { 1225 | "version": "3.0.0", 1226 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 1227 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 1228 | "dev": true 1229 | }, 1230 | "normalize-url": { 1231 | "version": "4.5.0", 1232 | "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", 1233 | "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", 1234 | "dev": true 1235 | }, 1236 | "object-assign": { 1237 | "version": "4.1.1", 1238 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 1239 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 1240 | }, 1241 | "on-finished": { 1242 | "version": "2.3.0", 1243 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 1244 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 1245 | "requires": { 1246 | "ee-first": "1.1.1" 1247 | } 1248 | }, 1249 | "once": { 1250 | "version": "1.4.0", 1251 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1252 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1253 | "requires": { 1254 | "wrappy": "1" 1255 | } 1256 | }, 1257 | "p-cancelable": { 1258 | "version": "1.1.0", 1259 | "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", 1260 | "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", 1261 | "dev": true 1262 | }, 1263 | "package-json": { 1264 | "version": "6.5.0", 1265 | "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", 1266 | "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", 1267 | "dev": true, 1268 | "requires": { 1269 | "got": "^9.6.0", 1270 | "registry-auth-token": "^4.0.0", 1271 | "registry-url": "^5.0.0", 1272 | "semver": "^6.2.0" 1273 | }, 1274 | "dependencies": { 1275 | "semver": { 1276 | "version": "6.3.0", 1277 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 1278 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", 1279 | "dev": true 1280 | } 1281 | } 1282 | }, 1283 | "parseurl": { 1284 | "version": "1.3.3", 1285 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 1286 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 1287 | }, 1288 | "path-is-absolute": { 1289 | "version": "1.0.1", 1290 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1291 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 1292 | }, 1293 | "path-to-regexp": { 1294 | "version": "0.1.7", 1295 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 1296 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 1297 | }, 1298 | "picomatch": { 1299 | "version": "2.2.2", 1300 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", 1301 | "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", 1302 | "dev": true 1303 | }, 1304 | "prepend-http": { 1305 | "version": "2.0.0", 1306 | "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", 1307 | "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", 1308 | "dev": true 1309 | }, 1310 | "proxy-addr": { 1311 | "version": "2.0.6", 1312 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", 1313 | "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", 1314 | "requires": { 1315 | "forwarded": "~0.1.2", 1316 | "ipaddr.js": "1.9.1" 1317 | } 1318 | }, 1319 | "pseudomap": { 1320 | "version": "1.0.2", 1321 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 1322 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" 1323 | }, 1324 | "pstree.remy": { 1325 | "version": "1.1.8", 1326 | "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", 1327 | "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", 1328 | "dev": true 1329 | }, 1330 | "pump": { 1331 | "version": "3.0.0", 1332 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 1333 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 1334 | "dev": true, 1335 | "requires": { 1336 | "end-of-stream": "^1.1.0", 1337 | "once": "^1.3.1" 1338 | } 1339 | }, 1340 | "pupa": { 1341 | "version": "2.0.1", 1342 | "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz", 1343 | "integrity": "sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA==", 1344 | "dev": true, 1345 | "requires": { 1346 | "escape-goat": "^2.0.0" 1347 | } 1348 | }, 1349 | "qs": { 1350 | "version": "6.7.0", 1351 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", 1352 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" 1353 | }, 1354 | "range-parser": { 1355 | "version": "1.2.1", 1356 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 1357 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 1358 | }, 1359 | "raw-body": { 1360 | "version": "2.4.0", 1361 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", 1362 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", 1363 | "requires": { 1364 | "bytes": "3.1.0", 1365 | "http-errors": "1.7.2", 1366 | "iconv-lite": "0.4.24", 1367 | "unpipe": "1.0.0" 1368 | } 1369 | }, 1370 | "rc": { 1371 | "version": "1.2.8", 1372 | "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", 1373 | "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", 1374 | "dev": true, 1375 | "requires": { 1376 | "deep-extend": "^0.6.0", 1377 | "ini": "~1.3.0", 1378 | "minimist": "^1.2.0", 1379 | "strip-json-comments": "~2.0.1" 1380 | } 1381 | }, 1382 | "readdirp": { 1383 | "version": "3.4.0", 1384 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", 1385 | "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", 1386 | "dev": true, 1387 | "requires": { 1388 | "picomatch": "^2.2.1" 1389 | } 1390 | }, 1391 | "redeyed": { 1392 | "version": "2.1.1", 1393 | "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", 1394 | "integrity": "sha1-iYS1gV2ZyyIEacme7v/jiRPmzAs=", 1395 | "requires": { 1396 | "esprima": "~4.0.0" 1397 | } 1398 | }, 1399 | "registry-auth-token": { 1400 | "version": "4.2.0", 1401 | "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", 1402 | "integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", 1403 | "dev": true, 1404 | "requires": { 1405 | "rc": "^1.2.8" 1406 | } 1407 | }, 1408 | "registry-url": { 1409 | "version": "5.1.0", 1410 | "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", 1411 | "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", 1412 | "dev": true, 1413 | "requires": { 1414 | "rc": "^1.2.8" 1415 | } 1416 | }, 1417 | "responselike": { 1418 | "version": "1.0.2", 1419 | "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", 1420 | "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", 1421 | "dev": true, 1422 | "requires": { 1423 | "lowercase-keys": "^1.0.0" 1424 | } 1425 | }, 1426 | "retry-as-promised": { 1427 | "version": "3.2.0", 1428 | "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-3.2.0.tgz", 1429 | "integrity": "sha512-CybGs60B7oYU/qSQ6kuaFmRd9sTZ6oXSc0toqePvV74Ac6/IFZSI1ReFQmtCN+uvW1Mtqdwpvt/LGOiCBAY2Mg==", 1430 | "requires": { 1431 | "any-promise": "^1.3.0" 1432 | } 1433 | }, 1434 | "rootpath": { 1435 | "version": "0.1.2", 1436 | "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", 1437 | "integrity": "sha1-Wzeah9ypBum5HWkKWZQ5vvJn6ms=" 1438 | }, 1439 | "safe-buffer": { 1440 | "version": "5.1.2", 1441 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1442 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 1443 | }, 1444 | "safer-buffer": { 1445 | "version": "2.1.2", 1446 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1447 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1448 | }, 1449 | "semver": { 1450 | "version": "5.7.1", 1451 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 1452 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 1453 | }, 1454 | "semver-diff": { 1455 | "version": "3.1.1", 1456 | "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", 1457 | "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", 1458 | "dev": true, 1459 | "requires": { 1460 | "semver": "^6.3.0" 1461 | }, 1462 | "dependencies": { 1463 | "semver": { 1464 | "version": "6.3.0", 1465 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 1466 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", 1467 | "dev": true 1468 | } 1469 | } 1470 | }, 1471 | "send": { 1472 | "version": "0.17.1", 1473 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", 1474 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", 1475 | "requires": { 1476 | "debug": "2.6.9", 1477 | "depd": "~1.1.2", 1478 | "destroy": "~1.0.4", 1479 | "encodeurl": "~1.0.2", 1480 | "escape-html": "~1.0.3", 1481 | "etag": "~1.8.1", 1482 | "fresh": "0.5.2", 1483 | "http-errors": "~1.7.2", 1484 | "mime": "1.6.0", 1485 | "ms": "2.1.1", 1486 | "on-finished": "~2.3.0", 1487 | "range-parser": "~1.2.1", 1488 | "statuses": "~1.5.0" 1489 | }, 1490 | "dependencies": { 1491 | "ms": { 1492 | "version": "2.1.1", 1493 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 1494 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 1495 | } 1496 | } 1497 | }, 1498 | "seq-queue": { 1499 | "version": "0.0.5", 1500 | "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", 1501 | "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" 1502 | }, 1503 | "sequelize": { 1504 | "version": "6.3.5", 1505 | "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.3.5.tgz", 1506 | "integrity": "sha512-MiwiPkYSA8NWttRKAXdU9h0TxP6HAc1fl7qZmMO/VQqQOND83G4nZLXd0kWILtAoT9cxtZgFqeb/MPYgEeXwsw==", 1507 | "requires": { 1508 | "debug": "^4.1.1", 1509 | "dottie": "^2.0.0", 1510 | "inflection": "1.12.0", 1511 | "lodash": "^4.17.15", 1512 | "moment": "^2.26.0", 1513 | "moment-timezone": "^0.5.31", 1514 | "retry-as-promised": "^3.2.0", 1515 | "semver": "^7.3.2", 1516 | "sequelize-pool": "^6.0.0", 1517 | "toposort-class": "^1.0.1", 1518 | "uuid": "^8.1.0", 1519 | "validator": "^10.11.0", 1520 | "wkx": "^0.5.0" 1521 | }, 1522 | "dependencies": { 1523 | "debug": { 1524 | "version": "4.1.1", 1525 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", 1526 | "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", 1527 | "requires": { 1528 | "ms": "^2.1.1" 1529 | } 1530 | }, 1531 | "ms": { 1532 | "version": "2.1.2", 1533 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1534 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 1535 | }, 1536 | "semver": { 1537 | "version": "7.3.2", 1538 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", 1539 | "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" 1540 | } 1541 | } 1542 | }, 1543 | "sequelize-pool": { 1544 | "version": "6.1.0", 1545 | "resolved": "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-6.1.0.tgz", 1546 | "integrity": "sha512-4YwEw3ZgK/tY/so+GfnSgXkdwIJJ1I32uZJztIEgZeAO6HMgj64OzySbWLgxj+tXhZCJnzRfkY9gINw8Ft8ZMg==" 1547 | }, 1548 | "serve-static": { 1549 | "version": "1.14.1", 1550 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", 1551 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", 1552 | "requires": { 1553 | "encodeurl": "~1.0.2", 1554 | "escape-html": "~1.0.3", 1555 | "parseurl": "~1.3.3", 1556 | "send": "0.17.1" 1557 | } 1558 | }, 1559 | "setprototypeof": { 1560 | "version": "1.1.1", 1561 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 1562 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 1563 | }, 1564 | "signal-exit": { 1565 | "version": "3.0.3", 1566 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", 1567 | "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", 1568 | "dev": true 1569 | }, 1570 | "sprintf-js": { 1571 | "version": "1.0.3", 1572 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 1573 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" 1574 | }, 1575 | "sqlstring": { 1576 | "version": "2.3.2", 1577 | "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz", 1578 | "integrity": "sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg==" 1579 | }, 1580 | "statuses": { 1581 | "version": "1.5.0", 1582 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 1583 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 1584 | }, 1585 | "string-width": { 1586 | "version": "4.2.0", 1587 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", 1588 | "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", 1589 | "dev": true, 1590 | "requires": { 1591 | "emoji-regex": "^8.0.0", 1592 | "is-fullwidth-code-point": "^3.0.0", 1593 | "strip-ansi": "^6.0.0" 1594 | }, 1595 | "dependencies": { 1596 | "ansi-regex": { 1597 | "version": "5.0.0", 1598 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", 1599 | "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", 1600 | "dev": true 1601 | }, 1602 | "emoji-regex": { 1603 | "version": "8.0.0", 1604 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 1605 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 1606 | "dev": true 1607 | }, 1608 | "is-fullwidth-code-point": { 1609 | "version": "3.0.0", 1610 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 1611 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 1612 | "dev": true 1613 | }, 1614 | "strip-ansi": { 1615 | "version": "6.0.0", 1616 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", 1617 | "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", 1618 | "dev": true, 1619 | "requires": { 1620 | "ansi-regex": "^5.0.0" 1621 | } 1622 | } 1623 | } 1624 | }, 1625 | "strip-ansi": { 1626 | "version": "5.2.0", 1627 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 1628 | "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", 1629 | "dev": true, 1630 | "requires": { 1631 | "ansi-regex": "^4.1.0" 1632 | } 1633 | }, 1634 | "strip-json-comments": { 1635 | "version": "2.0.1", 1636 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 1637 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", 1638 | "dev": true 1639 | }, 1640 | "supports-color": { 1641 | "version": "5.5.0", 1642 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 1643 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 1644 | "dev": true, 1645 | "requires": { 1646 | "has-flag": "^3.0.0" 1647 | } 1648 | }, 1649 | "swagger-ui-dist": { 1650 | "version": "3.30.0", 1651 | "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.30.0.tgz", 1652 | "integrity": "sha512-S8eqXrAjwcriY968zV6OauZEKDQZ4uobJKHNpUFt/4UXxZEvuX0Ujjc5eZ3T+42g9Ccb71KKmX9M3eQwpyP/lQ==" 1653 | }, 1654 | "swagger-ui-express": { 1655 | "version": "4.1.4", 1656 | "resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-4.1.4.tgz", 1657 | "integrity": "sha512-Ea96ecpC+Iq9GUqkeD/LFR32xSs8gYqmTW1gXCuKg81c26WV6ZC2FsBSPVExQP6WkyUuz5HEiR0sEv/HCC343g==", 1658 | "requires": { 1659 | "swagger-ui-dist": "^3.18.1" 1660 | } 1661 | }, 1662 | "term-size": { 1663 | "version": "2.2.0", 1664 | "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", 1665 | "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", 1666 | "dev": true 1667 | }, 1668 | "to-readable-stream": { 1669 | "version": "1.0.0", 1670 | "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", 1671 | "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", 1672 | "dev": true 1673 | }, 1674 | "to-regex-range": { 1675 | "version": "5.0.1", 1676 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 1677 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 1678 | "dev": true, 1679 | "requires": { 1680 | "is-number": "^7.0.0" 1681 | } 1682 | }, 1683 | "toidentifier": { 1684 | "version": "1.0.0", 1685 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 1686 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" 1687 | }, 1688 | "toposort-class": { 1689 | "version": "1.0.1", 1690 | "resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz", 1691 | "integrity": "sha1-f/0feMi+KMO6Rc1OGj9e4ZO9mYg=" 1692 | }, 1693 | "touch": { 1694 | "version": "3.1.0", 1695 | "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", 1696 | "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", 1697 | "dev": true, 1698 | "requires": { 1699 | "nopt": "~1.0.10" 1700 | } 1701 | }, 1702 | "type-fest": { 1703 | "version": "0.8.1", 1704 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", 1705 | "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", 1706 | "dev": true 1707 | }, 1708 | "type-is": { 1709 | "version": "1.6.18", 1710 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1711 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 1712 | "requires": { 1713 | "media-typer": "0.3.0", 1714 | "mime-types": "~2.1.24" 1715 | } 1716 | }, 1717 | "typedarray-to-buffer": { 1718 | "version": "3.1.5", 1719 | "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", 1720 | "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", 1721 | "dev": true, 1722 | "requires": { 1723 | "is-typedarray": "^1.0.0" 1724 | } 1725 | }, 1726 | "undefsafe": { 1727 | "version": "2.0.3", 1728 | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.3.tgz", 1729 | "integrity": "sha512-nrXZwwXrD/T/JXeygJqdCO6NZZ1L66HrxM/Z7mIq2oPanoN0F1nLx3lwJMu6AwJY69hdixaFQOuoYsMjE5/C2A==", 1730 | "dev": true, 1731 | "requires": { 1732 | "debug": "^2.2.0" 1733 | } 1734 | }, 1735 | "unique-string": { 1736 | "version": "2.0.0", 1737 | "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", 1738 | "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", 1739 | "dev": true, 1740 | "requires": { 1741 | "crypto-random-string": "^2.0.0" 1742 | } 1743 | }, 1744 | "unpipe": { 1745 | "version": "1.0.0", 1746 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1747 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 1748 | }, 1749 | "update-notifier": { 1750 | "version": "4.1.0", 1751 | "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz", 1752 | "integrity": "sha512-w3doE1qtI0/ZmgeoDoARmI5fjDoT93IfKgEGqm26dGUOh8oNpaSTsGNdYRN/SjOuo10jcJGwkEL3mroKzktkew==", 1753 | "dev": true, 1754 | "requires": { 1755 | "boxen": "^4.2.0", 1756 | "chalk": "^3.0.0", 1757 | "configstore": "^5.0.1", 1758 | "has-yarn": "^2.1.0", 1759 | "import-lazy": "^2.1.0", 1760 | "is-ci": "^2.0.0", 1761 | "is-installed-globally": "^0.3.1", 1762 | "is-npm": "^4.0.0", 1763 | "is-yarn-global": "^0.3.0", 1764 | "latest-version": "^5.0.0", 1765 | "pupa": "^2.0.1", 1766 | "semver-diff": "^3.1.1", 1767 | "xdg-basedir": "^4.0.0" 1768 | } 1769 | }, 1770 | "url-parse-lax": { 1771 | "version": "3.0.0", 1772 | "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", 1773 | "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", 1774 | "dev": true, 1775 | "requires": { 1776 | "prepend-http": "^2.0.0" 1777 | } 1778 | }, 1779 | "utils-merge": { 1780 | "version": "1.0.1", 1781 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 1782 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 1783 | }, 1784 | "uuid": { 1785 | "version": "8.3.0", 1786 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", 1787 | "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" 1788 | }, 1789 | "validator": { 1790 | "version": "10.11.0", 1791 | "resolved": "https://registry.npmjs.org/validator/-/validator-10.11.0.tgz", 1792 | "integrity": "sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==" 1793 | }, 1794 | "vary": { 1795 | "version": "1.1.2", 1796 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 1797 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 1798 | }, 1799 | "widest-line": { 1800 | "version": "3.1.0", 1801 | "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", 1802 | "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", 1803 | "dev": true, 1804 | "requires": { 1805 | "string-width": "^4.0.0" 1806 | } 1807 | }, 1808 | "wkx": { 1809 | "version": "0.5.0", 1810 | "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.5.0.tgz", 1811 | "integrity": "sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg==", 1812 | "requires": { 1813 | "@types/node": "*" 1814 | } 1815 | }, 1816 | "wrappy": { 1817 | "version": "1.0.2", 1818 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1819 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 1820 | }, 1821 | "write-file-atomic": { 1822 | "version": "3.0.3", 1823 | "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", 1824 | "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", 1825 | "dev": true, 1826 | "requires": { 1827 | "imurmurhash": "^0.1.4", 1828 | "is-typedarray": "^1.0.0", 1829 | "signal-exit": "^3.0.2", 1830 | "typedarray-to-buffer": "^3.1.5" 1831 | } 1832 | }, 1833 | "xdg-basedir": { 1834 | "version": "4.0.0", 1835 | "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", 1836 | "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", 1837 | "dev": true 1838 | }, 1839 | "yallist": { 1840 | "version": "3.1.1", 1841 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", 1842 | "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" 1843 | }, 1844 | "yamljs": { 1845 | "version": "0.3.0", 1846 | "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", 1847 | "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", 1848 | "requires": { 1849 | "argparse": "^1.0.7", 1850 | "glob": "^7.0.5" 1851 | } 1852 | } 1853 | } 1854 | } 1855 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-mysql-signup-verification-api", 3 | "version": "1.0.0", 4 | "description": "NodeJS + MySQL API for Email Sign Up with Verification, Authentication & Forgot Password", 5 | "license": "MIT", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/cornflourblue/node-mysql-signup-verification-api.git" 9 | }, 10 | "scripts": { 11 | "start": "node ./server.js", 12 | "start:dev": "nodemon ./server.js" 13 | }, 14 | "dependencies": { 15 | "bcryptjs": "^2.4.3", 16 | "body-parser": "^1.19.0", 17 | "cookie-parser": "^1.4.5", 18 | "cors": "^2.8.5", 19 | "express-jwt": "^6.0.0", 20 | "express": "^4.17.1", 21 | "joi": "^17.2.1", 22 | "jsonwebtoken": "^8.5.1", 23 | "mysql2": "^2.1.0", 24 | "nodemailer": "^6.4.11", 25 | "rootpath": "^0.1.2", 26 | "sequelize": "^6.3.4", 27 | "swagger-ui-express": "^4.1.4", 28 | "yamljs": "^0.3.0" 29 | }, 30 | "devDependencies": { 31 | "nodemon": "^2.0.3" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | require('rootpath')(); 2 | const express = require('express'); 3 | const app = express(); 4 | const bodyParser = require('body-parser'); 5 | const cookieParser = require('cookie-parser'); 6 | const cors = require('cors'); 7 | const errorHandler = require('_middleware/error-handler'); 8 | 9 | app.use(bodyParser.urlencoded({ extended: false })); 10 | app.use(bodyParser.json()); 11 | app.use(cookieParser()); 12 | 13 | // allow cors requests from any origin and with credentials 14 | app.use(cors({ origin: (origin, callback) => callback(null, true), credentials: true })); 15 | 16 | // api routes 17 | app.use('/accounts', require('./accounts/accounts.controller')); 18 | 19 | // swagger docs route 20 | app.use('/api-docs', require('_helpers/swagger')); 21 | 22 | // global error handler 23 | app.use(errorHandler); 24 | 25 | // start server 26 | const port = process.env.NODE_ENV === 'production' ? (process.env.PORT || 80) : 4000; 27 | app.listen(port, () => console.log('Server listening on port ' + port)); 28 | -------------------------------------------------------------------------------- /swagger.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | title: Node.js Sign-up and Verification API 4 | description: Node.js + MySQL - API with email sign-up, verification, authentication and forgot password 5 | version: 1.0.0 6 | 7 | servers: 8 | - url: http://localhost:4000 9 | description: Local development server 10 | 11 | paths: 12 | /accounts/authenticate: 13 | post: 14 | summary: Authenticate account credentials and return a JWT token and a cookie with a refresh token 15 | description: Accounts must be verified before authenticating. 16 | operationId: authenticate 17 | requestBody: 18 | required: true 19 | content: 20 | application/json: 21 | schema: 22 | type: object 23 | properties: 24 | email: 25 | type: string 26 | example: "jason@example.com" 27 | password: 28 | type: string 29 | example: "pass123" 30 | required: 31 | - email 32 | - password 33 | responses: 34 | "200": 35 | description: Account details, a JWT access token and a refresh token cookie 36 | headers: 37 | Set-Cookie: 38 | description: "`refreshToken`" 39 | schema: 40 | type: string 41 | example: refreshToken=51872eca5efedcf424db4cf5afd16a9d00ad25b743a034c9c221afc85d18dcd5e4ad6e3f08607550; Path=/; Expires=Tue, 16 Jun 2020 09:14:17 GMT; HttpOnly 42 | content: 43 | application/json: 44 | schema: 45 | type: object 46 | properties: 47 | id: 48 | type: string 49 | example: "5eb12e197e06a76ccdefc121" 50 | title: 51 | type: string 52 | example: "Mr" 53 | firstName: 54 | type: string 55 | example: "Jason" 56 | lastName: 57 | type: string 58 | example: "Watmore" 59 | email: 60 | type: string 61 | example: "jason@example.com" 62 | role: 63 | type: string 64 | example: "Admin" 65 | created: 66 | type: string 67 | example: "2020-05-05T09:12:57.848Z" 68 | isVerified: 69 | type: boolean 70 | example: true 71 | jwtToken: 72 | type: string 73 | example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWIxMmUxOTdlMDZhNzZjY2RlZmMxMjEiLCJpZCI6IjVlYjEyZTE5N2UwNmE3NmNjZGVmYzEyMSIsImlhdCI6MTU4ODc1ODE1N30.xR9H0STbFOpSkuGA9jHNZOJ6eS7umHHqKRhI807YT1Y" 74 | "400": 75 | description: The email or password is incorrect 76 | content: 77 | application/json: 78 | schema: 79 | type: object 80 | properties: 81 | message: 82 | type: string 83 | example: "Email or password is incorrect" 84 | /accounts/refresh-token: 85 | post: 86 | summary: Use a refresh token to generate a new JWT token and a new refresh token 87 | description: The refresh token is sent and returned via cookies. 88 | operationId: refreshToken 89 | parameters: 90 | - in: cookie 91 | name: refreshToken 92 | description: The `refreshToken` cookie 93 | schema: 94 | type: string 95 | example: 51872eca5efedcf424db4cf5afd16a9d00ad25b743a034c9c221afc85d18dcd5e4ad6e3f08607550 96 | responses: 97 | "200": 98 | description: Account details, a JWT access token and a new refresh token cookie 99 | headers: 100 | Set-Cookie: 101 | description: "`refreshToken`" 102 | schema: 103 | type: string 104 | example: refreshToken=51872eca5efedcf424db4cf5afd16a9d00ad25b743a034c9c221afc85d18dcd5e4ad6e3f08607550; Path=/; Expires=Tue, 16 Jun 2020 09:14:17 GMT; HttpOnly 105 | content: 106 | application/json: 107 | schema: 108 | type: object 109 | properties: 110 | id: 111 | type: string 112 | example: "5eb12e197e06a76ccdefc121" 113 | title: 114 | type: string 115 | example: "Mr" 116 | firstName: 117 | type: string 118 | example: "Jason" 119 | lastName: 120 | type: string 121 | example: "Watmore" 122 | email: 123 | type: string 124 | example: "jason@example.com" 125 | role: 126 | type: string 127 | example: "Admin" 128 | created: 129 | type: string 130 | example: "2020-05-05T09:12:57.848Z" 131 | isVerified: 132 | type: boolean 133 | example: true 134 | jwtToken: 135 | type: string 136 | example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWIxMmUxOTdlMDZhNzZjY2RlZmMxMjEiLCJpZCI6IjVlYjEyZTE5N2UwNmE3NmNjZGVmYzEyMSIsImlhdCI6MTU4ODc1ODE1N30.xR9H0STbFOpSkuGA9jHNZOJ6eS7umHHqKRhI807YT1Y" 137 | "400": 138 | description: The refresh token is invalid, revoked or expired 139 | content: 140 | application/json: 141 | schema: 142 | type: object 143 | properties: 144 | message: 145 | type: string 146 | example: "Invalid token" 147 | /accounts/revoke-token: 148 | post: 149 | summary: Revoke a refresh token 150 | description: Admin users can revoke the tokens of any account, regular users can only revoke their own tokens. 151 | operationId: revokeToken 152 | security: 153 | - bearerAuth: [] 154 | parameters: 155 | - in: cookie 156 | name: refreshToken 157 | description: The refresh token can be sent in a cookie or the post body, if both are sent the token in the body is used. 158 | schema: 159 | type: string 160 | example: 51872eca5efedcf424db4cf5afd16a9d00ad25b743a034c9c221afc85d18dcd5e4ad6e3f08607550 161 | requestBody: 162 | content: 163 | application/json: 164 | schema: 165 | type: object 166 | properties: 167 | token: 168 | type: string 169 | example: "51872eca5efedcf424db4cf5afd16a9d00ad25b743a034c9c221afc85d18dcd5e4ad6e3f08607550" 170 | responses: 171 | "200": 172 | description: The refresh token was successfully revoked 173 | content: 174 | application/json: 175 | schema: 176 | type: object 177 | properties: 178 | message: 179 | type: string 180 | example: "Token revoked" 181 | "400": 182 | description: The refresh token is invalid 183 | content: 184 | application/json: 185 | schema: 186 | type: object 187 | properties: 188 | message: 189 | type: string 190 | example: "Invalid token" 191 | "401": 192 | $ref: "#/components/responses/UnauthorizedError" 193 | /accounts/register: 194 | post: 195 | summary: Register a new user account and send a verification email 196 | description: The first account registered in the system is assigned the `Admin` role, other accounts are assigned the `User` role. 197 | operationId: register 198 | requestBody: 199 | required: true 200 | content: 201 | application/json: 202 | schema: 203 | type: object 204 | properties: 205 | title: 206 | type: string 207 | example: "Mr" 208 | firstName: 209 | type: string 210 | example: "Jason" 211 | lastName: 212 | type: string 213 | example: "Watmore" 214 | email: 215 | type: string 216 | example: "jason@example.com" 217 | password: 218 | type: string 219 | example: "pass123" 220 | confirmPassword: 221 | type: string 222 | example: "pass123" 223 | acceptTerms: 224 | type: boolean 225 | required: 226 | - title 227 | - firstName 228 | - lastName 229 | - email 230 | - password 231 | - confirmPassword 232 | - acceptTerms 233 | responses: 234 | "200": 235 | description: The registration request was successful and a verification email has been sent to the specified email address 236 | content: 237 | application/json: 238 | schema: 239 | type: object 240 | properties: 241 | message: 242 | type: string 243 | example: "Registration successful, please check your email for verification instructions" 244 | /accounts/verify-email: 245 | post: 246 | summary: Verify a new account with a verification token received by email after registration 247 | operationId: verifyEmail 248 | requestBody: 249 | required: true 250 | content: 251 | application/json: 252 | schema: 253 | type: object 254 | properties: 255 | token: 256 | type: string 257 | example: "3c7f8d9c4cb348ff95a0b74a1452aa24fc9611bb76768bb9eafeeb826ddae2935f1880bc7713318f" 258 | required: 259 | - token 260 | responses: 261 | "200": 262 | description: Verification was successful so you can now login to the account 263 | content: 264 | application/json: 265 | schema: 266 | type: object 267 | properties: 268 | message: 269 | type: string 270 | example: "Verification successful, you can now login" 271 | "400": 272 | description: Verification failed due to an invalid token 273 | content: 274 | application/json: 275 | schema: 276 | type: object 277 | properties: 278 | message: 279 | type: string 280 | example: "Verification failed" 281 | /accounts/forgot-password: 282 | post: 283 | summary: Submit email address to reset the password on an account 284 | operationId: forgotPassword 285 | requestBody: 286 | required: true 287 | content: 288 | application/json: 289 | schema: 290 | type: object 291 | properties: 292 | email: 293 | type: string 294 | example: "jason@example.com" 295 | required: 296 | - email 297 | responses: 298 | "200": 299 | description: The request was received and an email has been sent to the specified address with password reset instructions (if the email address is associated with an account) 300 | content: 301 | application/json: 302 | schema: 303 | type: object 304 | properties: 305 | message: 306 | type: string 307 | example: "Please check your email for password reset instructions" 308 | /accounts/validate-reset-token: 309 | post: 310 | summary: Validate the reset password token received by email after submitting to the /accounts/forgot-password route 311 | operationId: validateResetToken 312 | requestBody: 313 | required: true 314 | content: 315 | application/json: 316 | schema: 317 | type: object 318 | properties: 319 | token: 320 | type: string 321 | example: "3c7f8d9c4cb348ff95a0b74a1452aa24fc9611bb76768bb9eafeeb826ddae2935f1880bc7713318f" 322 | required: 323 | - token 324 | responses: 325 | "200": 326 | description: Token is valid 327 | content: 328 | application/json: 329 | schema: 330 | type: object 331 | properties: 332 | message: 333 | type: string 334 | example: "Token is valid" 335 | "400": 336 | description: Token is invalid 337 | content: 338 | application/json: 339 | schema: 340 | type: object 341 | properties: 342 | message: 343 | type: string 344 | example: "Invalid token" 345 | /accounts/reset-password: 346 | post: 347 | summary: Reset the password for an account 348 | operationId: resetPassword 349 | requestBody: 350 | required: true 351 | content: 352 | application/json: 353 | schema: 354 | type: object 355 | properties: 356 | token: 357 | type: string 358 | example: "3c7f8d9c4cb348ff95a0b74a1452aa24fc9611bb76768bb9eafeeb826ddae2935f1880bc7713318f" 359 | password: 360 | type: string 361 | example: "newPass123" 362 | confirmPassword: 363 | type: string 364 | example: "newPass123" 365 | required: 366 | - token 367 | - password 368 | - confirmPassword 369 | responses: 370 | "200": 371 | description: Password reset was successful so you can now login to the account with the new password 372 | content: 373 | application/json: 374 | schema: 375 | type: object 376 | properties: 377 | message: 378 | type: string 379 | example: "Password reset successful, you can now login" 380 | "400": 381 | description: Password reset failed due to an invalid token 382 | content: 383 | application/json: 384 | schema: 385 | type: object 386 | properties: 387 | message: 388 | type: string 389 | example: "Invalid token" 390 | /accounts: 391 | get: 392 | summary: Get a list of all accounts 393 | description: Restricted to admin users. 394 | operationId: getAllAccounts 395 | security: 396 | - bearerAuth: [] 397 | responses: 398 | "200": 399 | description: An array of all accounts 400 | content: 401 | application/json: 402 | schema: 403 | type: array 404 | items: 405 | type: object 406 | properties: 407 | id: 408 | type: string 409 | example: "5eb12e197e06a76ccdefc121" 410 | title: 411 | type: string 412 | example: "Mr" 413 | firstName: 414 | type: string 415 | example: "Jason" 416 | lastName: 417 | type: string 418 | example: "Watmore" 419 | email: 420 | type: string 421 | example: "jason@example.com" 422 | role: 423 | type: string 424 | example: "Admin" 425 | created: 426 | type: string 427 | example: "2020-05-05T09:12:57.848Z" 428 | updated: 429 | type: string 430 | example: "2020-05-08T03:11:21.553Z" 431 | "401": 432 | $ref: "#/components/responses/UnauthorizedError" 433 | post: 434 | summary: Create a new account 435 | description: Restricted to admin users. 436 | operationId: createAccount 437 | security: 438 | - bearerAuth: [] 439 | requestBody: 440 | required: true 441 | content: 442 | application/json: 443 | schema: 444 | type: object 445 | properties: 446 | title: 447 | type: string 448 | example: "Mr" 449 | firstName: 450 | type: string 451 | example: "Jason" 452 | lastName: 453 | type: string 454 | example: "Watmore" 455 | email: 456 | type: string 457 | example: "jason@example.com" 458 | password: 459 | type: string 460 | example: "pass123" 461 | confirmPassword: 462 | type: string 463 | example: "pass123" 464 | role: 465 | type: string 466 | enum: [Admin, User] 467 | required: 468 | - title 469 | - firstName 470 | - lastName 471 | - email 472 | - password 473 | - confirmPassword 474 | - role 475 | responses: 476 | "200": 477 | description: Account created successfully, verification is not required for accounts created with this endpoint. The details of the new account are returned. 478 | content: 479 | application/json: 480 | schema: 481 | type: object 482 | properties: 483 | id: 484 | type: string 485 | example: "5eb12e197e06a76ccdefc121" 486 | title: 487 | type: string 488 | example: "Mr" 489 | firstName: 490 | type: string 491 | example: "Jason" 492 | lastName: 493 | type: string 494 | example: "Watmore" 495 | email: 496 | type: string 497 | example: "jason@example.com" 498 | role: 499 | type: string 500 | example: "Admin" 501 | created: 502 | type: string 503 | example: "2020-05-05T09:12:57.848Z" 504 | "400": 505 | description: Email is already registered 506 | content: 507 | application/json: 508 | schema: 509 | type: object 510 | properties: 511 | message: 512 | type: string 513 | example: "Email 'jason@example.com' is already registered" 514 | "401": 515 | $ref: "#/components/responses/UnauthorizedError" 516 | /accounts/{id}: 517 | parameters: 518 | - in: path 519 | name: id 520 | description: Account id 521 | required: true 522 | example: "5eb12e197e06a76ccdefc121" 523 | schema: 524 | type: string 525 | get: 526 | summary: Get a single account by id 527 | description: Admin users can access any account, regular users are restricted to their own account. 528 | operationId: getAccountById 529 | security: 530 | - bearerAuth: [] 531 | responses: 532 | "200": 533 | description: Details of the specified account 534 | content: 535 | application/json: 536 | schema: 537 | type: object 538 | properties: 539 | id: 540 | type: string 541 | example: "5eb12e197e06a76ccdefc121" 542 | title: 543 | type: string 544 | example: "Mr" 545 | firstName: 546 | type: string 547 | example: "Jason" 548 | lastName: 549 | type: string 550 | example: "Watmore" 551 | email: 552 | type: string 553 | example: "jason@example.com" 554 | role: 555 | type: string 556 | example: "Admin" 557 | created: 558 | type: string 559 | example: "2020-05-05T09:12:57.848Z" 560 | updated: 561 | type: string 562 | example: "2020-05-08T03:11:21.553Z" 563 | "404": 564 | $ref: "#/components/responses/NotFoundError" 565 | "401": 566 | $ref: "#/components/responses/UnauthorizedError" 567 | put: 568 | summary: Update an account 569 | description: Admin users can update any account including role, regular users are restricted to their own account and cannot update role. 570 | operationId: updateAccount 571 | security: 572 | - bearerAuth: [] 573 | requestBody: 574 | required: true 575 | content: 576 | application/json: 577 | schema: 578 | type: object 579 | properties: 580 | title: 581 | type: string 582 | example: "Mr" 583 | firstName: 584 | type: string 585 | example: "Jason" 586 | lastName: 587 | type: string 588 | example: "Watmore" 589 | email: 590 | type: string 591 | example: "jason@example.com" 592 | password: 593 | type: string 594 | example: "pass123" 595 | confirmPassword: 596 | type: string 597 | example: "pass123" 598 | role: 599 | type: string 600 | enum: [Admin, User] 601 | responses: 602 | "200": 603 | description: Account updated successfully. The details of the updated account are returned. 604 | content: 605 | application/json: 606 | schema: 607 | type: object 608 | properties: 609 | id: 610 | type: string 611 | example: "5eb12e197e06a76ccdefc121" 612 | title: 613 | type: string 614 | example: "Mr" 615 | firstName: 616 | type: string 617 | example: "Jason" 618 | lastName: 619 | type: string 620 | example: "Watmore" 621 | email: 622 | type: string 623 | example: "jason@example.com" 624 | role: 625 | type: string 626 | example: "Admin" 627 | created: 628 | type: string 629 | example: "2020-05-05T09:12:57.848Z" 630 | updated: 631 | type: string 632 | example: "2020-05-08T03:11:21.553Z" 633 | "404": 634 | $ref: "#/components/responses/NotFoundError" 635 | "401": 636 | $ref: "#/components/responses/UnauthorizedError" 637 | delete: 638 | summary: Delete an account 639 | description: Admin users can delete any account, regular users are restricted to their own account. 640 | operationId: deleteAccount 641 | security: 642 | - bearerAuth: [] 643 | responses: 644 | "200": 645 | description: Account deleted successfully 646 | content: 647 | application/json: 648 | schema: 649 | type: object 650 | properties: 651 | message: 652 | type: string 653 | example: "Account deleted successfully" 654 | "404": 655 | $ref: "#/components/responses/NotFoundError" 656 | "401": 657 | $ref: "#/components/responses/UnauthorizedError" 658 | 659 | components: 660 | securitySchemes: 661 | bearerAuth: 662 | type: http 663 | scheme: bearer 664 | bearerFormat: JWT 665 | responses: 666 | UnauthorizedError: 667 | description: Access token is missing or invalid, or the user does not have access to perform the action 668 | content: 669 | application/json: 670 | schema: 671 | type: object 672 | properties: 673 | message: 674 | type: string 675 | example: "Unauthorized" 676 | NotFoundError: 677 | description: Not Found 678 | content: 679 | application/json: 680 | schema: 681 | type: object 682 | properties: 683 | message: 684 | type: string 685 | example: "Not Found" --------------------------------------------------------------------------------