diff --git a/.vscode/settings.json b/.vscode/settings.json index 4321723..efc6b09 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "dirsfirst", "eslintignore", "fullname", + "hstore", "LGPL", "nargs", "nodemon", diff --git a/example/fastify/.sequelizerc b/example/fastify/.sequelizerc new file mode 100644 index 0000000..a832be6 --- /dev/null +++ b/example/fastify/.sequelizerc @@ -0,0 +1,4 @@ +module.exports = { + config: './src/database/postgres/config.js', + 'migrations-path': './src/database/postgres/migrations/' +} \ No newline at end of file diff --git a/example/fastify/nodemon.json b/example/fastify/nodemon.json deleted file mode 100644 index 7309d2d..0000000 --- a/example/fastify/nodemon.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "watch": [ - ".env", - "src" - ], - "ext": "ts", - "ignore": [ - "src/**/*.test.ts" - ], - "exec": "npx ts-node -r dotenv/config ./src/index" -} diff --git a/example/fastify/package.json b/example/fastify/package.json index 64bd133..cd15edf 100644 --- a/example/fastify/package.json +++ b/example/fastify/package.json @@ -11,7 +11,10 @@ "start": "node dist/index.js", "release": "standard-version", "test:ci": "jest --ci -i", - "test:local": "NODE_ENV=local jest --ci -i" + "test:local": "NODE_ENV=local jest --ci -i", + "migrations:run": "sequelize db:migrate --to", + "migrations:run:last": "sequelize db:migrate --to $(ls src/database/postgres/migrations | sort -r | head -n 1)", + "migration": "ts-node -r dotenv/config src/scripts/migration.ts" }, "author": "AnthonyLzq ", "license": "MIT", @@ -23,13 +26,20 @@ "fastify": "^3", "http-errors": "^2.0.0", "mongoose": "^6.4.4", - "pino-pretty": "^8.1.0" + "pg": "^8.7.3", + "pg-hstore": "^2.3.4", + "pino-pretty": "^8.1.0", + "reflect-metadata": "^0.1.13", + "sequelize": "^6.21.3", + "sequelize-typescript": "^2.1.3", + "sequelize-typescript-migration-lts": "^3.1.5" }, "devDependencies": { "@jest/types": "^28.1.3", "@types/http-errors": "^1.8.2", "@types/jest": "^28.1.5", - "@types/node": "^18.0.4", + "@types/node": "^18.0.6", + "@types/validator": "^13.7.4", "@typescript-eslint/eslint-plugin": "^5.30.6", "@typescript-eslint/parser": "^5.30.6", "axios": "^0.27.2", @@ -47,6 +57,7 @@ "jest-unit": "^0.0.1", "nodemon": "^2.0.19", "prettier": "^2.7.1", + "sequelize-cli": "^6.4.1", "standard-version": "^9.5.0", "ts-jest": "^28.0.6", "ts-loader": "^9.3.1", @@ -57,5 +68,19 @@ "webpack": "^5.73.0", "webpack-cli": "^4.10.0", "webpack-node-externals": "^3.0.0" + }, + "nodemonConfig": { + "ignore": [ + "test", + ".git", + "node_modules" + ], + "watch": [ + "src", + "package.json", + ".env" + ], + "exec": "npx ts-node -r dotenv/config ./src/index", + "ext": "ts" } } diff --git a/example/fastify/src/@types/models/user.d.ts b/example/fastify/src/@types/models/user.d.ts index 88ed063..ed255eb 100644 --- a/example/fastify/src/@types/models/user.d.ts +++ b/example/fastify/src/@types/models/user.d.ts @@ -1,4 +1,5 @@ interface UserDBO { + id: number name: string lastName: string createdAt: Date diff --git a/example/fastify/src/database/index.ts b/example/fastify/src/database/index.ts index 098ea10..2dd7d39 100644 --- a/example/fastify/src/database/index.ts +++ b/example/fastify/src/database/index.ts @@ -1 +1 @@ -export * from './mongo' +export * from './postgres' diff --git a/example/fastify/src/database/mongo/connection.ts b/example/fastify/src/database/mongo/connection.ts deleted file mode 100644 index b32b33b..0000000 --- a/example/fastify/src/database/mongo/connection.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { connect, connection } from 'mongoose' -import { FastifyLoggerInstance } from 'fastify' - -const ENVIRONMENTS_WITHOUT_RECONNECTION = ['ci', 'local'] -const dbConnection = async ( - logger: FastifyLoggerInstance -): Promise<{ - connect: () => Promise - disconnect: () => Promise -}> => { - const connectionConfig = { - keepAlive: true, - useNewUrlParser: true, - useUnifiedTopology: true - } - - connection.on('connected', () => { - logger.info('Mongo connection established.') - }) - connection.on('reconnected', () => { - logger.info('Mongo connection reestablished') - }) - connection.on('disconnected', () => { - if ( - !ENVIRONMENTS_WITHOUT_RECONNECTION.includes( - process.env.NODE_ENV as string - ) - ) { - logger.info( - 'Mongo connection disconnected. Trying to reconnected to Mongo...' - ) - setTimeout(() => { - connect(process.env.MONGO_URI as string, { - ...connection, - connectTimeoutMS: 3000, - socketTimeoutMS: 3000 - }) - }, 3000) - } - }) - connection.on('close', () => { - logger.info('Mongo connection closed') - }) - connection.on('error', (e: Error) => { - logger.info('Mongo connection error:') - logger.error(e) - }) - - return { - connect: () => connect(process.env.MONGO_URI as string, connectionConfig), - disconnect: () => connection.close() - } -} - -export { dbConnection } diff --git a/example/fastify/src/database/mongo/models/user.ts b/example/fastify/src/database/mongo/models/user.ts deleted file mode 100644 index ce63794..0000000 --- a/example/fastify/src/database/mongo/models/user.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { model, Schema } from 'mongoose' - -const UserSchema = new Schema( - { - lastName: { - required: true, - type: String - }, - name: { - required: true, - type: String - } - }, - { - timestamps: true, - versionKey: false, - toObject: { - transform: (_, ret) => { - ret.id = ret._id.toString() - delete ret._id - } - } - } -) - -const UserModel = model('users', UserSchema) - -export { UserModel } diff --git a/example/fastify/src/database/mongo/queries/user.ts b/example/fastify/src/database/mongo/queries/user.ts deleted file mode 100644 index 64aa826..0000000 --- a/example/fastify/src/database/mongo/queries/user.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Document, MergeType, Types } from 'mongoose' - -import { UserModel } from '..' -import { User, UserDTO, UserWithId } from 'schemas' - -const userDBOtoDTO = ( - userDBO: Document> & - Omit & - UserDBO & { - _id: Types.ObjectId - } -): UserDTO => ({ - ...userDBO.toObject(), - createdAt: userDBO.createdAt.toISOString(), - updatedAt: userDBO.updatedAt.toISOString() -}) - -const store = async (userData: User): Promise => { - const user = new UserModel(userData) - - await user.save() - - return userDBOtoDTO(user) -} - -const remove = async ( - id: string | null = null -): Promise => { - if (id) { - const removedUser = await UserModel.findByIdAndRemove(id) - - if (!removedUser) return null - - return userDBOtoDTO(removedUser) - } - - return (await UserModel.deleteMany({})).deletedCount -} - -const get = async ( - id: string | null = null -): Promise => { - if (id) { - const user = await UserModel.findById(id) - - return user ? userDBOtoDTO(user) : null - } - - const users = await UserModel.find({}) - - return users.map(u => userDBOtoDTO(u)) -} - -const update = async (userData: UserWithId): Promise => { - const { id, ...rest } = userData - const user = await UserModel.findByIdAndUpdate(id, rest, { new: true }) - - return user ? userDBOtoDTO(user) : null -} - -export { store, remove, get, update } diff --git a/example/fastify/src/database/postgres/config.js b/example/fastify/src/database/postgres/config.js new file mode 100644 index 0000000..a17420f --- /dev/null +++ b/example/fastify/src/database/postgres/config.js @@ -0,0 +1,12 @@ +require('dotenv').config() + +module.exports = { + development: { + url: process.env.DB_URI, + dialect: 'postgres' + }, + production: { + url: process.env.DB_URI, + dialect: 'postgres' + } +} diff --git a/example/fastify/src/database/postgres/connection.ts b/example/fastify/src/database/postgres/connection.ts new file mode 100644 index 0000000..5e20e08 --- /dev/null +++ b/example/fastify/src/database/postgres/connection.ts @@ -0,0 +1,46 @@ +import { Sequelize } from 'sequelize-typescript' +import { FastifyLoggerInstance } from 'fastify' + +import * as models from './models' +import { join } from 'path' + +let sequelize: Sequelize + +const dbConnection = async ( + logger?: FastifyLoggerInstance +): Promise<{ + connect: () => Promise + disconnect: () => Promise + createMigration: (migrationName: string) => Promise +}> => { + return { + connect: async () => { + if (!sequelize) { + sequelize = new Sequelize(process.env.DB_URI as string, { + models: Object.values(models) + }) + logger?.info('Postgres connection established.') + } + + return sequelize + }, + disconnect: () => { + logger?.info('Postgres connection closed.') + + return sequelize?.close() + }, + createMigration: async (migrationName: string) => { + const { SequelizeTypescriptMigration } = await import( + 'sequelize-typescript-migration-lts' + ) + + await SequelizeTypescriptMigration.makeMigration(sequelize, { + outDir: join(__dirname, './migrations'), + migrationName, + preview: false + }) + } + } +} + +export { dbConnection } diff --git a/example/fastify/src/database/mongo/index.ts b/example/fastify/src/database/postgres/index.ts similarity index 100% rename from example/fastify/src/database/mongo/index.ts rename to example/fastify/src/database/postgres/index.ts index 3aefe13..cde634b 100644 --- a/example/fastify/src/database/mongo/index.ts +++ b/example/fastify/src/database/postgres/index.ts @@ -1,3 +1,3 @@ +export * from './connection' export * from './models' export * from './queries' -export * from './connection' diff --git a/example/fastify/src/database/postgres/migrations/00000001-create_user_table.js b/example/fastify/src/database/postgres/migrations/00000001-create_user_table.js new file mode 100644 index 0000000..d5e1630 --- /dev/null +++ b/example/fastify/src/database/postgres/migrations/00000001-create_user_table.js @@ -0,0 +1,160 @@ +'use strict' + +const Sequelize = require('sequelize') + +/** + * Actions summary: + * + * createTable "users", deps: [] + * + **/ + +const info = { + revision: 1, + name: 'create-user-table', + created: '2022-07-27T00:28:34.934Z', + comment: '' +} + +const migrationCommands = [ + { + fn: 'createTable', + params: [ + 'SequelizeMigrationsMeta', + { + revision: { + primaryKey: true, + type: Sequelize.INTEGER + }, + name: { + allowNull: false, + type: Sequelize.STRING + }, + state: { + allowNull: false, + type: Sequelize.JSON + } + }, + {} + ] + }, + { + fn: 'bulkDelete', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision + } + ], + {} + ] + }, + { + fn: 'bulkInsert', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision, + name: info.name, + state: + '{"revision":1,"tables":{"users":{"tableName":"users","schema":{"id":{"seqType":"Sequelize.INTEGER","allowNull":false,"primaryKey":true,"autoIncrement":true},"name":{"seqType":"Sequelize.STRING"},"lastName":{"seqType":"Sequelize.STRING"},"createdAt":{"seqType":"Sequelize.DATE","allowNull":false},"updatedAt":{"seqType":"Sequelize.DATE","allowNull":false},"deletedAt":{"seqType":"Sequelize.DATE"}},"indexes":{}}}}' + } + ], + {} + ] + }, + + { + fn: 'createTable', + params: [ + 'users', + { + id: { + autoIncrement: true, + primaryKey: true, + allowNull: false, + type: Sequelize.INTEGER + }, + name: { + type: Sequelize.STRING + }, + lastName: { + type: Sequelize.STRING + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE + }, + deletedAt: { + type: Sequelize.DATE + } + }, + {} + ] + } +] + +const rollbackCommands = [ + { + fn: 'bulkDelete', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision + } + ], + {} + ] + }, + + { + fn: 'dropTable', + params: ['users'] + } +] + +module.exports = { + pos: 0, + up(queryInterface, Sequelize) { + let index = this.pos + + return new Promise(function (resolve, reject) { + function next() { + if (index < migrationCommands.length) { + const command = migrationCommands[index] + console.log('[#' + index + '] execute: ' + command.fn) + index++ + queryInterface[command.fn] + .apply(queryInterface, command.params) + .then(next, reject) + } else resolve() + } + next() + }) + }, + down(queryInterface, Sequelize) { + let index = this.pos + + return new Promise(function (resolve, reject) { + function next() { + if (index < rollbackCommands.length) { + const command = rollbackCommands[index] + console.log('[#' + index + '] execute: ' + command.fn) + index++ + queryInterface[command.fn] + .apply(queryInterface, command.params) + .then(next, reject) + } else resolve() + } + next() + }) + }, + info +} diff --git a/example/fastify/src/database/postgres/migrations/00000002-update_user_table.js b/example/fastify/src/database/postgres/migrations/00000002-update_user_table.js new file mode 100644 index 0000000..78dc4d9 --- /dev/null +++ b/example/fastify/src/database/postgres/migrations/00000002-update_user_table.js @@ -0,0 +1,138 @@ +'use strict' + +const Sequelize = require('sequelize') + +/** + * Actions summary: + * + * addColumn "email" to table "users" + * + **/ + +const info = { + revision: 2, + name: 'update-user-table', + created: '2022-07-27T00:33:17.010Z', + comment: '' +} + +const migrationCommands = [ + { + fn: 'createTable', + params: [ + 'SequelizeMigrationsMeta', + { + revision: { + primaryKey: true, + type: Sequelize.INTEGER + }, + name: { + allowNull: false, + type: Sequelize.STRING + }, + state: { + allowNull: false, + type: Sequelize.JSON + } + }, + {} + ] + }, + { + fn: 'bulkDelete', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision + } + ], + {} + ] + }, + { + fn: 'bulkInsert', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision, + name: info.name, + state: + '{"revision":2,"tables":{"users":{"tableName":"users","schema":{"id":{"seqType":"Sequelize.INTEGER","allowNull":false,"primaryKey":true,"autoIncrement":true},"name":{"seqType":"Sequelize.STRING"},"lastName":{"seqType":"Sequelize.STRING"},"email":{"seqType":"Sequelize.STRING"},"createdAt":{"seqType":"Sequelize.DATE","allowNull":false},"updatedAt":{"seqType":"Sequelize.DATE","allowNull":false},"deletedAt":{"seqType":"Sequelize.DATE"}},"indexes":{}}}}' + } + ], + {} + ] + }, + + { + fn: 'addColumn', + params: [ + 'users', + 'email', + { + type: Sequelize.STRING + } + ] + } +] + +const rollbackCommands = [ + { + fn: 'bulkDelete', + params: [ + 'SequelizeMigrationsMeta', + [ + { + revision: info.revision + } + ], + {} + ] + }, + + { + fn: 'removeColumn', + params: ['users', 'email'] + } +] + +module.exports = { + pos: 0, + up(queryInterface, Sequelize) { + let index = this.pos + + return new Promise(function (resolve, reject) { + function next() { + if (index < migrationCommands.length) { + const command = migrationCommands[index] + console.log('[#' + index + '] execute: ' + command.fn) + index++ + queryInterface[command.fn] + .apply(queryInterface, command.params) + .then(next, reject) + } else resolve() + } + next() + }) + }, + down(queryInterface, Sequelize) { + let index = this.pos + + return new Promise(function (resolve, reject) { + function next() { + if (index < rollbackCommands.length) { + const command = rollbackCommands[index] + console.log('[#' + index + '] execute: ' + command.fn) + index++ + queryInterface[command.fn] + .apply(queryInterface, command.params) + .then(next, reject) + } else resolve() + } + next() + }) + }, + info +} diff --git a/example/fastify/src/database/postgres/migrations/00000003-update_user_table_with_age.js b/example/fastify/src/database/postgres/migrations/00000003-update_user_table_with_age.js new file mode 100644 index 0000000..d3afc53 --- /dev/null +++ b/example/fastify/src/database/postgres/migrations/00000003-update_user_table_with_age.js @@ -0,0 +1,139 @@ +'use strict'; + +var Sequelize = require('sequelize'); + +/** + * Actions summary: + * + * addColumn "age" to table "users" + * + **/ + +var info = { + "revision": 3, + "name": "update-user-table-with-age", + "created": "2022-07-27T00:57:59.689Z", + "comment": "" +}; + +var migrationCommands = [ + + { + fn: "createTable", + params: [ + "SequelizeMigrationsMeta", + { + "revision": { + "primaryKey": true, + "type": Sequelize.INTEGER + }, + "name": { + "allowNull": false, + "type": Sequelize.STRING + }, + "state": { + "allowNull": false, + "type": Sequelize.JSON + }, + }, + {} + ] + }, + { + fn: "bulkDelete", + params: [ + "SequelizeMigrationsMeta", + [{ + revision: info.revision + }], + {} + ] + }, + { + fn: "bulkInsert", + params: [ + "SequelizeMigrationsMeta", + [{ + revision: info.revision, + name: info.name, + state: '{"revision":3,"tables":{"users":{"tableName":"users","schema":{"id":{"seqType":"Sequelize.INTEGER","allowNull":false,"primaryKey":true,"autoIncrement":true},"name":{"seqType":"Sequelize.STRING"},"lastName":{"seqType":"Sequelize.STRING"},"email":{"seqType":"Sequelize.STRING"},"age":{"seqType":"Sequelize.INTEGER"},"createdAt":{"seqType":"Sequelize.DATE","allowNull":false},"updatedAt":{"seqType":"Sequelize.DATE","allowNull":false},"deletedAt":{"seqType":"Sequelize.DATE"}},"indexes":{}}}}' + }], + {} + ] + }, + + + + { + fn: "addColumn", + params: [ + "users", + "age", + { + "type": Sequelize.INTEGER + } + ] + } +]; + +var rollbackCommands = [ + + { + fn: "bulkDelete", + params: [ + "SequelizeMigrationsMeta", + [{ + revision: info.revision, + }], + {} + ] + }, + + + + { + fn: "removeColumn", + params: ["users", "age"] + } +]; + +module.exports = { + pos: 0, + up: function(queryInterface, Sequelize) + { + var index = this.pos; + return new Promise(function(resolve, reject) { + function next() { + if (index < migrationCommands.length) + { + let command = migrationCommands[index]; + console.log("[#"+index+"] execute: " + command.fn); + index++; + queryInterface[command.fn].apply(queryInterface, command.params).then(next, reject); + } + else + resolve(); + } + next(); + }); + }, + down: function(queryInterface, Sequelize) + { + var index = this.pos; + return new Promise(function(resolve, reject) { + function next() { + if (index < rollbackCommands.length) + { + let command = rollbackCommands[index]; + console.log("[#"+index+"] execute: " + command.fn); + index++; + queryInterface[command.fn].apply(queryInterface, command.params).then(next, reject); + } + else + resolve(); + } + next(); + }); + }, + info: info +}; diff --git a/example/fastify/src/database/mongo/models/index.ts b/example/fastify/src/database/postgres/models/index.ts similarity index 100% rename from example/fastify/src/database/mongo/models/index.ts rename to example/fastify/src/database/postgres/models/index.ts diff --git a/example/fastify/src/database/postgres/models/user.ts b/example/fastify/src/database/postgres/models/user.ts new file mode 100644 index 0000000..da4efe3 --- /dev/null +++ b/example/fastify/src/database/postgres/models/user.ts @@ -0,0 +1,30 @@ +/* eslint-disable no-use-before-define */ +import { Model, Column, Table, DataType } from 'sequelize-typescript' + +@Table({ + paranoid: true, + tableName: 'users' +}) +class User extends Model { + @Column({ + type: DataType.STRING + }) + name!: string + + @Column({ + type: DataType.STRING + }) + lastName!: string + + @Column({ + type: DataType.STRING + }) + email!: string + + @Column({ + type: DataType.INTEGER + }) + age!: string +} + +export { User } diff --git a/example/fastify/src/database/mongo/queries/index.ts b/example/fastify/src/database/postgres/queries/index.ts similarity index 100% rename from example/fastify/src/database/mongo/queries/index.ts rename to example/fastify/src/database/postgres/queries/index.ts diff --git a/example/fastify/src/database/postgres/queries/user.ts b/example/fastify/src/database/postgres/queries/user.ts new file mode 100644 index 0000000..aebd3e3 --- /dev/null +++ b/example/fastify/src/database/postgres/queries/user.ts @@ -0,0 +1,67 @@ +import { User } from '..' +import { User as UserSchema, UserDTO, UserWithId } from 'schemas' +import { Transaction } from 'sequelize/types' + +const userDBOtoDTO = (userDBO: User): UserDTO => ({ + ...userDBO.get(), + createdAt: userDBO.createdAt.toISOString(), + updatedAt: userDBO.updatedAt.toISOString() +}) + +const store = async ( + userData: UserSchema, + transaction: Transaction | null = null +): Promise => { + const user = await User.create(userData, { + transaction + }) + + return userDBOtoDTO(user) +} + +const remove = async ( + id: number | null = null, + transaction: Transaction | null = null +): Promise => { + if (id) { + const removedUser = await User.destroy({ + where: { id }, + transaction + }) + + return removedUser + } + + const w = await User.destroy({ truncate: true, transaction }) + + console.log(w) + + return w +} + +const get = async ( + id: number | null = null +): Promise => { + if (id) { + const user = await User.findByPk(id) + + return user ? userDBOtoDTO(user) : null + } + + const { rows: users } = await User.findAndCountAll() + + return users.map(u => userDBOtoDTO(u)) +} + +const update = async (userData: UserWithId): Promise => { + const { id, ...rest } = userData + const [, user] = await User.update(rest, { + where: { id }, + returning: true, + limit: 1 + }) + + return user[0] ? userDBOtoDTO(user[0]) : null +} + +export { store, remove, get, update } diff --git a/example/fastify/src/network/server.ts b/example/fastify/src/network/server.ts index cabad81..d8ee8a9 100644 --- a/example/fastify/src/network/server.ts +++ b/example/fastify/src/network/server.ts @@ -46,6 +46,10 @@ class Server { try { await this.#dbConnection() await this.#connection?.connect() + + if (process.env.MIGRATION) + await this.#connection?.createMigration(process.env.MIGRATION) + await this.#app.listen(PORT) } catch (e) { console.error(e) diff --git a/example/fastify/src/schemas/index.ts b/example/fastify/src/schemas/index.ts index 8658f9f..618c91b 100644 --- a/example/fastify/src/schemas/index.ts +++ b/example/fastify/src/schemas/index.ts @@ -1,8 +1,6 @@ import { Static, Type } from '@sinclair/typebox' -const id = Type.String({ - pattern: '^[a-zA-Z0-9]{24,}$' -}) +const id = Type.Number() type Id = Static diff --git a/example/fastify/src/scripts/migration.ts b/example/fastify/src/scripts/migration.ts new file mode 100644 index 0000000..d9875e5 --- /dev/null +++ b/example/fastify/src/scripts/migration.ts @@ -0,0 +1,25 @@ +import { dbConnection } from 'database' +import { promisify } from 'util' + +const exec = promisify(require('child_process').exec) + +const migration = async () => { + const connection = await dbConnection() + + await connection.connect() + + console.log('Creating migration') + + if (process.env.MIGRATION) + await connection.createMigration(process.env.MIGRATION) + + console.log('Executing migration') + + await exec( + 'npx sequelize db:migrate --to $(ls src/database/postgres/migrations | sort -r | head -n 1)' + ) + + console.log('Migration complete') +} + +migration() diff --git a/example/fastify/src/services/user.ts b/example/fastify/src/services/user.ts index 94cb7c2..e70c67d 100644 --- a/example/fastify/src/services/user.ts +++ b/example/fastify/src/services/user.ts @@ -9,7 +9,7 @@ type Process = { } type Arguments = { - id?: string + id?: number user?: User userWithId?: UserWithId } @@ -67,10 +67,7 @@ class UserService { try { const usersDeleted = (await remove()) as number - if (usersDeleted >= 1) return MFU.ALL_USERS_DELETED - - if (usersDeleted === 0) - throw new httpErrors.Conflict(EFU.NOTHING_TO_DELETE) + if (usersDeleted === 0) return MFU.ALL_USERS_DELETED throw new httpErrors.InternalServerError(GE.INTERNAL_SERVER_ERROR) } catch (e) { diff --git a/example/fastify/test/index.test.ts b/example/fastify/test/index.test.ts index 663d430..2ee964c 100644 --- a/example/fastify/test/index.test.ts +++ b/example/fastify/test/index.test.ts @@ -28,13 +28,13 @@ const baseResponseDto = Type.Object({ type BaseResponseDTO = Static -describe('Simba.js tests', () => { +describe('Simba.js tests - Sequelize', () => { beforeAll(async () => { await Server.start() }) describe('API endpoints tests', () => { - let userID = '' + let userID = 0 describe('API: GET /', () => { let data: BaseResponseDTO @@ -76,7 +76,7 @@ describe('Simba.js tests', () => { data = result.data status = result.status - userID = result.data.message.id ?? '' + userID = result.data.message.id ?? 0 expect(status).toBe(201) }) diff --git a/example/fastify/tsconfig.base.json b/example/fastify/tsconfig.base.json index 3831001..a96623e 100644 --- a/example/fastify/tsconfig.base.json +++ b/example/fastify/tsconfig.base.json @@ -8,7 +8,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, + "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, // "lib": [], /* Specify library files to be included in the compilation. */ "allowJs": true /* Allow javascript files to be compiled. */, @@ -64,7 +64,7 @@ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ /* Advanced Options */ diff --git a/example/fastify/yarn.lock b/example/fastify/yarn.lock index 3ba3b4a..ec1577e 100644 --- a/example/fastify/yarn.lock +++ b/example/fastify/yarn.lock @@ -17,63 +17,63 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.18.6": +"@babel/compat-data@^7.18.8": version "7.18.8" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.18.8.tgz#2483f565faca607b8535590e84e7de323f27764d" integrity sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ== "@babel/core@^7.11.6", "@babel/core@^7.12.3": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.6.tgz#54a107a3c298aee3fe5e1947a6464b9b6faca03d" - integrity sha512-cQbWBpxcbbs/IUredIPkHiAGULLV8iwgNRMFzvbhEXISp4f3rUUXE5+TIw6KwUWUR3DwyI6gmBRnmAtYaWehwQ== + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.9.tgz#805461f967c77ff46c74ca0460ccf4fe933ddd59" + integrity sha512-1LIb1eL8APMy91/IMW+31ckrfBM4yCoLaVzoDhZUKSM4cu1L1nIidyxkCgzPAgrC5WEz36IPEr/eSeSF9pIn+g== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.6" - "@babel/helper-compilation-targets" "^7.18.6" - "@babel/helper-module-transforms" "^7.18.6" - "@babel/helpers" "^7.18.6" - "@babel/parser" "^7.18.6" + "@babel/generator" "^7.18.9" + "@babel/helper-compilation-targets" "^7.18.9" + "@babel/helper-module-transforms" "^7.18.9" + "@babel/helpers" "^7.18.9" + "@babel/parser" "^7.18.9" "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.6" - "@babel/types" "^7.18.6" + "@babel/traverse" "^7.18.9" + "@babel/types" "^7.18.9" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.18.6", "@babel/generator@^7.18.7", "@babel/generator@^7.7.2": - version "7.18.7" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.7.tgz#2aa78da3c05aadfc82dbac16c99552fc802284bd" - integrity sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A== +"@babel/generator@^7.18.9", "@babel/generator@^7.7.2": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.9.tgz#68337e9ea8044d6ddc690fb29acae39359cca0a5" + integrity sha512-wt5Naw6lJrL1/SGkipMiFxJjtyczUWTP38deiP1PO60HsBjDeKk08CGC3S8iVuvf0FmTdgKwU1KIXzSKL1G0Ug== dependencies: - "@babel/types" "^7.18.7" + "@babel/types" "^7.18.9" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" -"@babel/helper-compilation-targets@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.6.tgz#18d35bfb9f83b1293c22c55b3d576c1315b6ed96" - integrity sha512-vFjbfhNCzqdeAtZflUFrG5YIFqGTqsctrtkZ1D/NB0mDW9TwW3GmmUepYY4G9wCET5rY5ugz4OGTcLd614IzQg== +"@babel/helper-compilation-targets@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.9.tgz#69e64f57b524cde3e5ff6cc5a9f4a387ee5563bf" + integrity sha512-tzLCyVmqUiFlcFoAPLA/gL9TeYrF61VLNtb+hvkuVaB5SUjW7jcfrglBIX1vUIoT7CLP3bBlIMeyEsIl2eFQNg== dependencies: - "@babel/compat-data" "^7.18.6" + "@babel/compat-data" "^7.18.8" "@babel/helper-validator-option" "^7.18.6" browserslist "^4.20.2" semver "^6.3.0" -"@babel/helper-environment-visitor@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.6.tgz#b7eee2b5b9d70602e59d1a6cad7dd24de7ca6cd7" - integrity sha512-8n6gSfn2baOY+qlp+VSzsosjCVGFqWKmDF0cCWOybh52Dw3SEyoWR1KrhMJASjLwIEkkAufZ0xvr+SxLHSpy2Q== +"@babel/helper-environment-visitor@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" + integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== -"@babel/helper-function-name@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.18.6.tgz#8334fecb0afba66e6d87a7e8c6bb7fed79926b83" - integrity sha512-0mWMxV1aC97dhjCah5U5Ua7668r5ZmSC2DLfH2EZnf9c3/dHZKiFa5pRLMH5tjSl471tY6496ZWk/kjNONBxhw== +"@babel/helper-function-name@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.18.9.tgz#940e6084a55dee867d33b4e487da2676365e86b0" + integrity sha512-fJgWlZt7nxGksJS9a0XdSaI4XvpExnNIgRP+rVefWh5U7BL8pPuir6SJUmFKRfjWQ51OtWSzwOxhaH/EBWWc0A== dependencies: "@babel/template" "^7.18.6" - "@babel/types" "^7.18.6" + "@babel/types" "^7.18.9" "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" @@ -89,24 +89,24 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.18.6": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.8.tgz#4f8408afead0188cfa48672f9d0e5787b61778c8" - integrity sha512-che3jvZwIcZxrwh63VfnFTUzcAM9v/lznYkkRxIBGMPt1SudOKHAEec0SIRCfiuIzTcF7VGj/CaTT6gY4eWxvA== +"@babel/helper-module-transforms@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.18.9.tgz#5a1079c005135ed627442df31a42887e80fcb712" + integrity sha512-KYNqY0ICwfv19b31XzvmI/mfcylOzbLtowkw+mfvGPAQ3kfCnMLYbED3YecL5tPd8nAYFQFAd6JHp2LxZk/J1g== dependencies: - "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" "@babel/helper-simple-access" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-validator-identifier" "^7.18.6" "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.8" - "@babel/types" "^7.18.8" + "@babel/traverse" "^7.18.9" + "@babel/types" "^7.18.9" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.8.0": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.6.tgz#9448974dd4fb1d80fefe72e8a0af37809cd30d6d" - integrity sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg== + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f" + integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== "@babel/helper-simple-access@^7.18.6": version "7.18.6" @@ -132,14 +132,14 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== -"@babel/helpers@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.6.tgz#4c966140eaa1fcaa3d5a8c09d7db61077d4debfd" - integrity sha512-vzSiiqbQOghPngUYt/zWGvK3LAsPhz55vc9XNN0xAl2gV4ieShI2OQli5duxWHD+72PZPTKAcfcZDE1Cwc5zsQ== +"@babel/helpers@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.18.9.tgz#4bef3b893f253a1eced04516824ede94dcfe7ff9" + integrity sha512-Jf5a+rbrLoR4eNdUmnFu8cN5eNJT6qdTdOg5IHIzq87WwyRw9PwguLFOWYgktN/60IP4fgDUawJvs7PjQIzELQ== dependencies: "@babel/template" "^7.18.6" - "@babel/traverse" "^7.18.6" - "@babel/types" "^7.18.6" + "@babel/traverse" "^7.18.9" + "@babel/types" "^7.18.9" "@babel/highlight@^7.18.6": version "7.18.6" @@ -150,10 +150,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.6", "@babel/parser@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.8.tgz#822146080ac9c62dac0823bb3489622e0bc1cbdf" - integrity sha512-RSKRfYX20dyH+elbJK2uqAkVyucL+xXzhqlMD5/ZXx+dAAwpyB7HsvnHe/ZUGOF+xLr5Wx9/JoXVTj6BQE2/oA== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.6", "@babel/parser@^7.18.9": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.9.tgz#f2dde0c682ccc264a9a8595efd030a5cc8fd2539" + integrity sha512-9uJveS9eY9DJ0t64YbIBZICtJy8a5QrDEVdiLCG97fVLpDTpGX7t8mMSb6OWw6Lrnjqj4O8zwjELX3dhoMgiBg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -255,26 +255,26 @@ "@babel/parser" "^7.18.6" "@babel/types" "^7.18.6" -"@babel/traverse@^7.18.6", "@babel/traverse@^7.18.8", "@babel/traverse@^7.7.2": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.8.tgz#f095e62ab46abf1da35e5a2011f43aee72d8d5b0" - integrity sha512-UNg/AcSySJYR/+mIcJQDCv00T+AqRO7j/ZEJLzpaYtgM48rMg5MnkJgyNqkzo88+p4tfRvZJCEiwwfG6h4jkRg== +"@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.9.tgz#deeff3e8f1bad9786874cb2feda7a2d77a904f98" + integrity sha512-LcPAnujXGwBgv3/WHv01pHtb2tihcyW1XuL9wd7jqh1Z8AQkTd+QVjMrMijrln0T7ED3UXLIy36P9Ao7W75rYg== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.18.7" - "@babel/helper-environment-visitor" "^7.18.6" - "@babel/helper-function-name" "^7.18.6" + "@babel/generator" "^7.18.9" + "@babel/helper-environment-visitor" "^7.18.9" + "@babel/helper-function-name" "^7.18.9" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.18.8" - "@babel/types" "^7.18.8" + "@babel/parser" "^7.18.9" + "@babel/types" "^7.18.9" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.7", "@babel/types@^7.18.8", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.8.tgz#c5af199951bf41ba4a6a9a6d0d8ad722b30cd42f" - integrity sha512-qwpdsmraq0aJ3osLJRApsc2ouSJCdnMeZwB0DhbtHAtRpZNZCdlbRnHIgcRKzdE1g0iOGg644fzjOBcdOz9cPw== +"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.9.tgz#7148d64ba133d8d73a41b3172ac4b83a1452205f" + integrity sha512-WwMLAg2MvJmt/rKEVQBBhIVffMmnilX4oe0sRe7iPOHIGsqpruFHHdrfj4O1CMMtgMtCU4oPafZjDPCRgO57Wg== dependencies: "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" @@ -662,9 +662,9 @@ fastq "^1.6.0" "@sinclair/typebox@^0.24.1", "@sinclair/typebox@^0.24.19": - version "0.24.19" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.19.tgz#5297278e0d8a1aea084685a3216074910ac6c113" - integrity sha512-gHJu8cdYTD5p4UqmQHrxaWrtb/jkH5imLXzuBypWhKzNkW0qfmgz+w1xaJccWVuJta1YYUdlDiPHXRTR4Ku0MQ== + version "0.24.20" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.20.tgz#11a657875de6008622d53f56e063a6347c51a6dd" + integrity sha512-kVaO5aEFZb33nPMTZBxiPEkY+slxiPtqC7QX8f9B3eGOMBvEfuMfxp9DSTTCsRJPumPKjrge4yagyssO4q6qzQ== "@sinonjs/commons@^1.7.0": version "1.8.3" @@ -733,6 +733,13 @@ dependencies: "@babel/types" "^7.3.0" +"@types/debug@^4.1.7": + version "4.1.7" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" + integrity sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg== + dependencies: + "@types/ms" "*" + "@types/eslint-scope@^3.7.3": version "3.7.4" resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.4.tgz#37fc1223f0786c39627068a12e94d6e6fc61de16" @@ -791,9 +798,9 @@ "@types/istanbul-lib-report" "*" "@types/jest@^28.1.5": - version "28.1.5" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.5.tgz#4337404efa059adbf96c4ac53b28fdc0af514475" - integrity sha512-TLAC2zXxGnohSP3GxgIyJn7yrTeRPDEyVFyCY1NE2wzg392auI+69uk5EPGjUXuhkq/K208J/TWpLG7J8ebIEQ== + version "28.1.6" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-28.1.6.tgz#d6a9cdd38967d2d746861fb5be6b120e38284dd4" + integrity sha512-0RbGAFMfcBJKOmqRazM8L98uokwuwD5F8rHrv/ZMbrZBwVOWZUyPG6VFNscjYr/vjM3Vu4fRrCPbOs42AfemaQ== dependencies: jest-matcher-utils "^28.0.0" pretty-format "^28.0.0" @@ -813,10 +820,15 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== -"@types/node@*", "@types/node@^18.0.4": - version "18.0.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.4.tgz#48aedbf35efb3af1248e4cd4d792c730290cd5d6" - integrity sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA== +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + +"@types/node@*", "@types/node@^18.0.6": + version "18.0.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.6.tgz#0ba49ac517ad69abe7a1508bc9b3a5483df9d5d7" + integrity sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -833,6 +845,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== +"@types/validator@^13.7.1", "@types/validator@^13.7.4": + version "13.7.4" + resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.7.4.tgz#33cc949ee87dd47c63e35ba4ad94f6888852be04" + integrity sha512-uAaSWegu2lymY18l+s5nmcXu3sFeeTOl1zhSGoYzcr6T3wz1M+3OcW4UjfPhIhHGd13tIMRDsEpR+d8w/MexwQ== + "@types/webidl-conversions@*": version "6.1.1" resolved "https://registry.yarnpkg.com/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz#e33bc8ea812a01f63f90481c666334844b12a09e" @@ -859,13 +876,13 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.6.tgz#9c6017b6c1d04894141b4a87816388967f64c359" - integrity sha512-J4zYMIhgrx4MgnZrSDD7sEnQp7FmhKNOaqaOpaoQ/SfdMfRB/0yvK74hTnvH+VQxndZynqs5/Hn4t+2/j9bADg== + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.30.7.tgz#1621dabc1ae4084310e19e9efc80dfdbb97e7493" + integrity sha512-l4L6Do+tfeM2OK0GJsU7TUcM/1oN/N25xHm3Jb4z3OiDU4Lj8dIuxX9LpVMS9riSXQs42D1ieX7b85/r16H9Fw== dependencies: - "@typescript-eslint/scope-manager" "5.30.6" - "@typescript-eslint/type-utils" "5.30.6" - "@typescript-eslint/utils" "5.30.6" + "@typescript-eslint/scope-manager" "5.30.7" + "@typescript-eslint/type-utils" "5.30.7" + "@typescript-eslint/utils" "5.30.7" debug "^4.3.4" functional-red-black-tree "^1.0.1" ignore "^5.2.0" @@ -874,68 +891,68 @@ tsutils "^3.21.0" "@typescript-eslint/parser@^5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.30.6.tgz#add440db038fa9d777e4ebdaf66da9e7fb7abe92" - integrity sha512-gfF9lZjT0p2ZSdxO70Xbw8w9sPPJGfAdjK7WikEjB3fcUI/yr9maUVEdqigBjKincUYNKOmf7QBMiTf719kbrA== + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.30.7.tgz#99d09729392aec9e64b1de45cd63cb81a4ddd980" + integrity sha512-Rg5xwznHWWSy7v2o0cdho6n+xLhK2gntImp0rJroVVFkcYFYQ8C8UJTSuTw/3CnExBmPjycjmUJkxVmjXsld6A== dependencies: - "@typescript-eslint/scope-manager" "5.30.6" - "@typescript-eslint/types" "5.30.6" - "@typescript-eslint/typescript-estree" "5.30.6" + "@typescript-eslint/scope-manager" "5.30.7" + "@typescript-eslint/types" "5.30.7" + "@typescript-eslint/typescript-estree" "5.30.7" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.30.6.tgz#ce1b49ff5ce47f55518d63dbe8fc9181ddbd1a33" - integrity sha512-Hkq5PhLgtVoW1obkqYH0i4iELctEKixkhWLPTYs55doGUKCASvkjOXOd/pisVeLdO24ZX9D6yymJ/twqpJiG3g== +"@typescript-eslint/scope-manager@5.30.7": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.30.7.tgz#8269a931ef1e5ae68b5eb80743cc515c4ffe3dd7" + integrity sha512-7BM1bwvdF1UUvt+b9smhqdc/eniOnCKxQT/kj3oXtj3LqnTWCAM0qHRHfyzCzhEfWX0zrW7KqXXeE4DlchZBKw== dependencies: - "@typescript-eslint/types" "5.30.6" - "@typescript-eslint/visitor-keys" "5.30.6" + "@typescript-eslint/types" "5.30.7" + "@typescript-eslint/visitor-keys" "5.30.7" -"@typescript-eslint/type-utils@5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.30.6.tgz#a64aa9acbe609ab77f09f53434a6af2b9685f3af" - integrity sha512-GFVVzs2j0QPpM+NTDMXtNmJKlF842lkZKDSanIxf+ArJsGeZUIaeT4jGg+gAgHt7AcQSFwW7htzF/rbAh2jaVA== +"@typescript-eslint/type-utils@5.30.7": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.30.7.tgz#5693dc3db6f313f302764282d614cfdbc8a9fcfd" + integrity sha512-nD5qAE2aJX/YLyKMvOU5jvJyku4QN5XBVsoTynFrjQZaDgDV6i7QHFiYCx10wvn7hFvfuqIRNBtsgaLe0DbWhw== dependencies: - "@typescript-eslint/utils" "5.30.6" + "@typescript-eslint/utils" "5.30.7" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.30.6.tgz#86369d0a7af8c67024115ac1da3e8fb2d38907e1" - integrity sha512-HdnP8HioL1F7CwVmT4RaaMX57RrfqsOMclZc08wGMiDYJBsLGBM7JwXM4cZJmbWLzIR/pXg1kkrBBVpxTOwfUg== +"@typescript-eslint/types@5.30.7": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.30.7.tgz#18331487cc92d0f1fb1a6f580c8ec832528079d0" + integrity sha512-ocVkETUs82+U+HowkovV6uxf1AnVRKCmDRNUBUUo46/5SQv1owC/EBFkiu4MOHeZqhKz2ktZ3kvJJ1uFqQ8QPg== -"@typescript-eslint/typescript-estree@5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.6.tgz#a84a0d6a486f9b54042da1de3d671a2c9f14484e" - integrity sha512-Z7TgPoeYUm06smfEfYF0RBkpF8csMyVnqQbLYiGgmUSTaSXTP57bt8f0UFXstbGxKIreTwQCujtaH0LY9w9B+A== +"@typescript-eslint/typescript-estree@5.30.7": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.7.tgz#05da9f1b281985bfedcf62349847f8d168eecc07" + integrity sha512-tNslqXI1ZdmXXrHER83TJ8OTYl4epUzJC0aj2i4DMDT4iU+UqLT3EJeGQvJ17BMbm31x5scSwo3hPM0nqQ1AEA== dependencies: - "@typescript-eslint/types" "5.30.6" - "@typescript-eslint/visitor-keys" "5.30.6" + "@typescript-eslint/types" "5.30.7" + "@typescript-eslint/visitor-keys" "5.30.7" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.30.6", "@typescript-eslint/utils@^5.10.0": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.30.6.tgz#1de2da14f678e7d187daa6f2e4cdb558ed0609dc" - integrity sha512-xFBLc/esUbLOJLk9jKv0E9gD/OH966M40aY9jJ8GiqpSkP2xOV908cokJqqhVd85WoIvHVHYXxSFE4cCSDzVvA== +"@typescript-eslint/utils@5.30.7", "@typescript-eslint/utils@^5.10.0": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.30.7.tgz#7135be070349e9f7caa262b0ca59dc96123351bb" + integrity sha512-Z3pHdbFw+ftZiGUnm1GZhkJgVqsDL5CYW2yj+TB2mfXDFOMqtbzQi2dNJIyPqPbx9mv2kUxS1gU+r2gKlKi1rQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.30.6" - "@typescript-eslint/types" "5.30.6" - "@typescript-eslint/typescript-estree" "5.30.6" + "@typescript-eslint/scope-manager" "5.30.7" + "@typescript-eslint/types" "5.30.7" + "@typescript-eslint/typescript-estree" "5.30.7" eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/visitor-keys@5.30.6": - version "5.30.6" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.6.tgz#94dd10bb481c8083378d24de1742a14b38a2678c" - integrity sha512-41OiCjdL2mCaSDi2SvYbzFLlqqlm5v1ZW9Ym55wXKL/Rx6OOB1IbuFGo71Fj6Xy90gJDFTlgOS+vbmtGHPTQQA== +"@typescript-eslint/visitor-keys@5.30.7": + version "5.30.7" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.7.tgz#c093abae75b4fd822bfbad9fc337f38a7a14909a" + integrity sha512-KrRXf8nnjvcpxDFOKej4xkD7657+PClJs5cJVSG7NNoCNnjEdc46juNAQt7AyuWctuCgs6mVRc1xGctEqrjxWw== dependencies: - "@typescript-eslint/types" "5.30.6" + "@typescript-eslint/types" "5.30.7" eslint-visitor-keys "^3.3.0" "@webassemblyjs/ast@1.11.1": @@ -1127,9 +1144,9 @@ acorn-walk@^8.1.1: integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== acorn@^8.4.1, acorn@^8.5.0, acorn@^8.7.1: - version "8.7.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" - integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== + version "8.8.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" + integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== add-stream@^1.0.0: version "1.0.0" @@ -1263,6 +1280,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + atomic-sleep@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" @@ -1361,6 +1383,11 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1419,6 +1446,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer-writer@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" + integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== + buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" @@ -1467,9 +1499,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001366: - version "1.0.30001366" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001366.tgz#c73352c83830a9eaf2dea0ff71fb4b9a4bbaa89c" - integrity sha512-yy7XLWCubDobokgzudpkKux8e0UOOnLHE6mlNJBzT3lZJz6s5atSEzjoL+fsCPkI0G8MP5uVdDx1ur/fXEWkZA== + version "1.0.30001369" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001369.tgz#58ca6974acf839a72a02003258a005cbb0cb340d" + integrity sha512-OY1SBHaodJc4wflDIKnlkdqWzJZd1Ls/2zbVJHBSv3AT7vgOJ58yAhd2CN4d57l2kPJrgMb7P9+N1Mhy4tNSQA== chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" @@ -1523,6 +1555,17 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== +cli-color@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.3.tgz#73769ba969080629670f3f2ef69a4bf4e7cc1879" + integrity sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.61" + es6-iterator "^2.0.3" + memoizee "^0.4.15" + timers-ext "^0.1.7" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -1587,7 +1630,7 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" -commander@^2.20.0: +commander@^2.19.0, commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -1620,6 +1663,14 @@ concat-stream@^2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" +config-chain@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.13.tgz#fad0795aa6a6cdaff9ed1b68e9dff94372c232f4" + integrity sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + content-disposition@^0.5.3: version "0.5.4" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" @@ -1821,6 +1872,14 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + dargs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" @@ -1843,7 +1902,7 @@ debug@2.6.9, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4.x, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@4.x, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1875,6 +1934,11 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +deep-diff@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/deep-diff/-/deep-diff-1.0.2.tgz#afd3d1f749115be965e89c63edc7abb1506b9c26" + integrity sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg== + deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -1899,9 +1963,9 @@ delayed-stream@~1.0.0: integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== denque@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.0.1.tgz#bcef4c1b80dc32efe97515744f21a4229ab8934a" - integrity sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ== + version "2.1.0" + resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== depd@2.0.0: version "2.0.0" @@ -1979,15 +2043,30 @@ dotgitignore@^2.1.0: find-up "^3.0.0" minimatch "^3.0.4" +dottie@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.2.tgz#cc91c0726ce3a054ebf11c55fbc92a7f266dd154" + integrity sha512-fmrwR04lsniq/uSr8yikThDTrM7epXHBAAjH9TbeH3rEA8tdCO7mRzB9hdmdGyJCxF8KERo9CITcm3kGuoyMhg== + +editorconfig@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5" + integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g== + dependencies: + commander "^2.19.0" + lru-cache "^4.1.5" + semver "^5.6.0" + sigmund "^1.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.4.188: - version "1.4.191" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.191.tgz#01dd4bf32502a48ce24bf3890b5553a1c5f93539" - integrity sha512-MeEaiuoSFh4G+rrN+Ilm1KJr8pTTZloeLurcZ+PRcthvdK1gWThje+E6baL7/7LoNctrzCncavAG/j/vpES9jg== + version "1.4.199" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.199.tgz#e0384fde79fdda89880e8be58196a9153e04db3b" + integrity sha512-WIGME0Cs7oob3mxsJwHbeWkH0tYkIE/sjkJ8ML2BYmuRcjhRl/q5kVDXG7W9LOOKwzPU5M0LBlXRq9rlSgnNlg== emittery@^0.10.2: version "0.10.2" @@ -2086,6 +2165,42 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.61" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" + integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -2263,9 +2378,9 @@ eslint-visitor-keys@^3.3.0: integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== eslint@^8.19.0: - version "8.19.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.19.0.tgz#7342a3cbc4fbc5c106a1eefe0fd0b50b6b1a7d28" - integrity sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw== + version "8.20.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.20.0.tgz#048ac56aa18529967da8354a478be4ec0a2bc81b" + integrity sha512-d4ixhz5SKCa1D6SCPrivP7yYVi7nyD6A4vs6HIAul9ujBzcEmZVM3/0NN/yu5nKhmO1wjp5xQ46iRfmDGlOviA== dependencies: "@eslint/eslintrc" "^1.3.0" "@humanwhocodes/config-array" "^0.9.2" @@ -2351,6 +2466,14 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== + dependencies: + d "1" + es5-ext "~0.10.14" + event-target-shim@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" @@ -2392,6 +2515,13 @@ expect@^28.1.3: jest-message-util "^28.1.3" jest-util "^28.1.3" +ext@^1.1.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== + dependencies: + type "^2.5.0" + fast-copy@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/fast-copy/-/fast-copy-2.1.3.tgz#bf6e05ac3cb7a9d66fbf12c51dd4440e9ddd4afb" @@ -2454,9 +2584,9 @@ fast-safe-stringify@^2.0.8, fast-safe-stringify@^2.1.1: integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== fastest-levenshtein@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2" - integrity sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow== + version "1.0.14" + resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.14.tgz#9054384e4b7a78c88d01a4432dc18871af0ac859" + integrity sha512-tFfWHjnuUfKE186Tfgr+jtaFc0mZTApEgKDOeyN+FwOqRkO/zK/3h1AiRd8u8CY53owL3CUmGr/oI9p/RdyLTA== fastify-plugin@^3.0.0: version "3.0.1" @@ -2601,6 +2731,16 @@ fresh@0.5.2: resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -2636,6 +2776,13 @@ functions-have-names@^1.2.2: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== +generate-function@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f" + integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ== + dependencies: + is-property "^1.0.2" + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -2736,6 +2883,18 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -2765,9 +2924,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.15.0: - version "13.16.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.16.0.tgz#9be4aca28f311aaeb974ea54978ebbb5e35ce46a" - integrity sha512-A1lrQfpNF+McdPOnnFqY3kSN0AFTy485bTi1bkLk4mVPODIUEcSfhHgRqA+QdXPksrSTTztYXx37NFV+GpGk3Q== + version "13.17.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" + integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== dependencies: type-fest "^0.20.2" @@ -2783,7 +2942,7 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" -graceful-fs@^4.1.2, graceful-fs@^4.2.4, graceful-fs@^4.2.9: +graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== @@ -2898,6 +3057,13 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +iconv-lite@^0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + ieee754@^1.1.13: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -2939,6 +3105,11 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== +inflection@^1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.13.2.tgz#15e8c797c6c3dadf31aa658f8df8a4ea024798b0" + integrity sha512-cmZlljCRTBFouT8UzMzrGcVEvkv6D/wBdcdKG7J1QH5cXjtU75Dm+P27v9EKu/Y43UYyCJd1WC4zLebRrC8NBw== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -2952,7 +3123,7 @@ inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -ini@^1.3.2: +ini@^1.3.2, ini@^1.3.4: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== @@ -2971,10 +3142,10 @@ interpret@^2.2.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== -ip@^1.1.5: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48" - integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg== +ip@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ip/-/ip-2.0.0.tgz#4cf4ab182fee2314c75ede1276f8c80b479936da" + integrity sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ== ipaddr.js@1.9.1: version "1.9.1" @@ -3083,6 +3254,16 @@ is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-promise@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== + +is-property@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + integrity sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g== + is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -3567,6 +3748,16 @@ joycon@^3.1.1: resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== +js-beautify@^1.14.0: + version "1.14.4" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.14.4.tgz#187d600a835f84de67a6d09ceaf3f199b7284c82" + integrity sha512-+b4A9c3glceZEmxyIbxDOYB0ZJdReLvyU1077RqKsO4dZx9FUHjTOJn8VHwpg33QoucIykOiYbh7MfqBOghnrA== + dependencies: + config-chain "^1.1.13" + editorconfig "^0.15.3" + glob "^7.1.3" + nopt "^5.0.0" + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3643,6 +3834,15 @@ json5@^2.2.1: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -3677,9 +3877,9 @@ levn@^0.4.1: type-check "~0.4.0" light-my-request@^4.2.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/light-my-request/-/light-my-request-4.10.1.tgz#09a93fa5af6a7b4339322b2e2b3f5d1c9679ed02" - integrity sha512-l+zWk0HXGhGzY7IYTZnYEqIpj3Mpcyk2f8+FkKUyREywvaiWCf2jyQVxpasKRsploY/nVpoqTlxx72CIeQNcIQ== + version "4.12.0" + resolved "https://registry.yarnpkg.com/light-my-request/-/light-my-request-4.12.0.tgz#fd59329a7b4f794842103c7bef69e12252478831" + integrity sha512-0y+9VIfJEsPVzK5ArSIJ8Dkxp8QMP7/aCuxCUtG/tr9a2NoOf/snATE/OUc05XUplJCEnRh6gTkH7xh9POt1DQ== dependencies: ajv "^8.1.0" cookie "^0.5.0" @@ -3751,11 +3951,24 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.15: +lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +lru-cache@^4.1.3, lru-cache@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -3763,6 +3976,13 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ== + dependencies: + es5-ext "~0.10.2" + make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -3792,6 +4012,20 @@ map-obj@^4.0.0: resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== +memoizee@^0.4.15: + version "0.4.15" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" + integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-weak-map "^2.0.3" + event-emitter "^0.3.5" + is-promise "^2.2.2" + lru-queue "^0.1.0" + next-tick "^1.1.0" + timers-ext "^0.1.7" + memory-pager@^1.0.2: version "1.5.0" resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.5.0.tgz#d8751655d22d384682741c972f2c3d6dfa3e66b5" @@ -3892,10 +4126,22 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +moment-timezone@^0.5.34: + version "0.5.34" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.34.tgz#a75938f7476b88f155d3504a9343f7519d9a405c" + integrity sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg== + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0", moment@^2.29.1: + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + mongodb-connection-string-url@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz#f075c8d529e8d3916386018b8a396aed4f16e5ed" - integrity sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA== + version "2.5.3" + resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.3.tgz#c0c572b71570e58be2bd52b33dffd1330cfb6990" + integrity sha512-f+/WsED+xF4B74l3k9V/XkTVj5/fxFH2o5ToKXd8Iyi5UhM+sO9u0Ape17Mvl/GkZaFtM0HQnzAG5OTmhKw+tQ== dependencies: "@types/whatwg-url" "^8.2.1" whatwg-url "^11.0.0" @@ -3913,9 +4159,9 @@ mongodb@4.7.0: saslprep "^1.0.3" mongoose@^6.4.4: - version "6.4.4" - resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-6.4.4.tgz#4e22a36373d8a867ee8f73063d8b31f1e451316d" - integrity sha512-r6sp96veRNhNIWFtHHe4Lqak+ilgiExYnnMLhYTGdzjIMR90G1ayx0JKFVdHuC6dKNHGFX0ETJGbf36N8Romjg== + version "6.4.6" + resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-6.4.6.tgz#57bc7ae68de56abcc5e890284f2d10acac863aa2" + integrity sha512-ZAfNCWgXhwev6k/+rMzjHIJ/+wLkundQU/i+aUTqmCgGoYqc+B5e4EC4Y3E1XaLzNXiWID1/vocSM6zs5IAGvA== dependencies: bson "^4.6.2" kareem "2.4.1" @@ -3952,6 +4198,27 @@ ms@2.1.3, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +mysql2@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/mysql2/-/mysql2-2.3.3.tgz#944f3deca4b16629052ff8614fbf89d5552545a0" + integrity sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA== + dependencies: + denque "^2.0.1" + generate-function "^2.3.1" + iconv-lite "^0.6.3" + long "^4.0.0" + lru-cache "^6.0.0" + named-placeholders "^1.1.2" + seq-queue "^0.0.5" + sqlstring "^2.3.2" + +named-placeholders@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/named-placeholders/-/named-placeholders-1.1.2.tgz#ceb1fbff50b6b33492b5cf214ccf5e39cef3d0e8" + integrity sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA== + dependencies: + lru-cache "^4.1.3" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -3962,6 +4229,11 @@ neo-async@^2.6.0, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +next-tick@1, next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -3988,6 +4260,13 @@ nodemon@^2.0.19: touch "^3.1.0" undefsafe "^2.0.5" +nopt@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" + integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ== + dependencies: + abbrev "1" + nopt@~1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" @@ -4158,6 +4437,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +packet-reader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" + integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -4220,6 +4504,64 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pg-connection-string@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" + integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== + +pg-hstore@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/pg-hstore/-/pg-hstore-2.3.4.tgz#4425e3e2a3e15d2a334c35581186c27cf2e9b8dd" + integrity sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA== + dependencies: + underscore "^1.13.1" + +pg-int8@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" + integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== + +pg-pool@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.5.1.tgz#f499ce76f9bf5097488b3b83b19861f28e4ed905" + integrity sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ== + +pg-protocol@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" + integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== + +pg-types@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" + integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== + dependencies: + pg-int8 "1.0.1" + postgres-array "~2.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.4" + postgres-interval "^1.1.0" + +pg@^8.7.3: + version "8.7.3" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.3.tgz#8a5bdd664ca4fda4db7997ec634c6e5455b27c44" + integrity sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.5.0" + pg-pool "^3.5.1" + pg-protocol "^1.5.0" + pg-types "^2.1.0" + pgpass "1.x" + +pgpass@1.x: + version "1.0.5" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== + dependencies: + split2 "^4.1.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -4298,6 +4640,28 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +postgres-array@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" + integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== + +postgres-date@~1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" + integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== + +postgres-interval@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" + integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== + dependencies: + xtend "^4.0.0" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -4343,6 +4707,11 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== + proxy-addr@^2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" @@ -4351,6 +4720,11 @@ proxy-addr@^2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ== + pstree.remy@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" @@ -4493,6 +4867,11 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" +reflect-metadata@^0.1.13: + version "0.1.13" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" + integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== + regexp.prototype.flags@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" @@ -4553,6 +4932,11 @@ ret@~0.2.0: resolved "https://registry.yarnpkg.com/ret/-/ret-0.2.2.tgz#b6861782a1f4762dce43402a71eb7a283f44573c" integrity sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ== +retry-as-promised@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/retry-as-promised/-/retry-as-promised-5.0.0.tgz#f4ecc25133603a2d2a7aff4a128691d7bc506d54" + integrity sha512-6S+5LvtTl2ggBumk04hBo/4Uf6fRJUwIgunGZ7CYEBCeufGFW1Pu6ucUf/UskHeWOIsUcLOGLFXPig5tR5V1nA== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -4594,6 +4978,11 @@ safe-regex2@^2.0.0: dependencies: ret "~0.2.0" +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + saslprep@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/saslprep/-/saslprep-1.0.3.tgz#4c02f946b56cf54297e347ba1093e7acac4cf226" @@ -4620,7 +5009,7 @@ semver-store@^0.3.0: resolved "https://registry.yarnpkg.com/semver-store/-/semver-store-0.3.0.tgz#ce602ff07df37080ec9f4fb40b29576547befbe9" integrity sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg== -"semver@2 || 3 || 4 || 5", semver@^5.7.1: +"semver@2 || 3 || 4 || 5", semver@^5.6.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -4661,6 +5050,72 @@ send@^0.17.1: range-parser "~1.2.1" statuses "~1.5.0" +seq-queue@^0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e" + integrity sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q== + +sequelize-cli@^6.4.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/sequelize-cli/-/sequelize-cli-6.4.1.tgz#fb9fbbde733ae887970316a700d264fcf0683770" + integrity sha512-gIzzFitUGUErq6DYd1JDnsmx7z7XcxzRNe4Py3AqeaxcyjpCAZU2BQnsNPGPMKAaXfMtKi/d9Tu4MtLrehVzIQ== + dependencies: + cli-color "^2.0.1" + fs-extra "^9.1.0" + js-beautify "^1.14.0" + lodash "^4.17.21" + resolve "^1.20.0" + umzug "^2.3.0" + yargs "^16.2.0" + +sequelize-pool@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-7.1.0.tgz#210b391af4002762f823188fd6ecfc7413020768" + integrity sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg== + +sequelize-typescript-migration-lts@^3.1.5: + version "3.1.6" + resolved "https://registry.yarnpkg.com/sequelize-typescript-migration-lts/-/sequelize-typescript-migration-lts-3.1.6.tgz#dfc7afd787dfaf08d3b63ff9e6146862b755353b" + integrity sha512-784qRm4vsAmU3AWHt2vacUs/7HX5gnBB0irAtGyL0SzrtHM+R+b3x3PSTxKqPpZeHGiuYO2jw4u1E8EEFHz/kw== + dependencies: + deep-diff "^1.0.2" + inflection "^1.13.2" + js-beautify "^1.14.0" + mysql2 "^2.3.3" + reflect-metadata "^0.1.13" + sequelize "^6.17.0" + sequelize-typescript "^2.1.3" + typescript "^4.6.3" + +sequelize-typescript@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/sequelize-typescript/-/sequelize-typescript-2.1.3.tgz#94a8d0a4b5739fc917c8d8fa66e1acb5aadc1274" + integrity sha512-0mejGAaLywuCoOOLSXCQs2sMBNudU/QtWZkGY5VT2dfTHToXZi5bOxCa3/CukNNk7wJwXnLuIdeHdlqjvVoj1g== + dependencies: + glob "7.2.0" + +sequelize@^6.17.0, sequelize@^6.21.3: + version "6.21.3" + resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-6.21.3.tgz#6026b088b5327f8cc0501b0e7e5a8de1bf0346ce" + integrity sha512-cJPrTTVCofUxaaNKoIETiXCYh2xJ+OFq5jMHJQqftp34M4kNoLpTfUMPSwYtRUeTcSh1/5HodfJXIBi7troIFA== + dependencies: + "@types/debug" "^4.1.7" + "@types/validator" "^13.7.1" + debug "^4.3.3" + dottie "^2.0.2" + inflection "^1.13.2" + lodash "^4.17.21" + moment "^2.29.1" + moment-timezone "^0.5.34" + pg-connection-string "^2.5.0" + retry-as-promised "^5.0.0" + semver "^7.3.5" + sequelize-pool "^7.1.0" + toposort-class "^1.0.1" + uuid "^8.3.2" + validator "^13.7.0" + wkx "^0.5.0" + serialize-javascript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -4711,6 +5166,11 @@ sift@16.0.0: resolved "https://registry.yarnpkg.com/sift/-/sift-16.0.0.tgz#447991577db61f1a8fab727a8a98a6db57a23eb8" integrity sha512-ILTjdP2Mv9V1kIxWMXeMTIRbOBrqKc4JAXmFMnFq3fKeyQ2Qwa3Dw1ubcye3vR+Y6ofA0b9gNDr/y2t6eUeIzQ== +sigmund@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + integrity sha512-fCvEXfh6NWpm+YSuY2bpXb/VIihqWA6hLsgboC+0nl71Q7N7o2eaCW8mJa/NLvQhs6jpd3VZV4UiUQlV6+lc8g== + signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" @@ -4739,11 +5199,11 @@ smart-buffer@^4.2.0: integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== socks@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.6.2.tgz#ec042d7960073d40d94268ff3bb727dc685f111a" - integrity sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA== + version "2.7.0" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.0.tgz#f9225acdb841e874dca25f870e9130990f3913d0" + integrity sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA== dependencies: - ip "^1.1.5" + ip "^2.0.0" smart-buffer "^4.2.0" sonic-boom@^1.0.2: @@ -4755,9 +5215,9 @@ sonic-boom@^1.0.2: flatstr "^1.0.12" sonic-boom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.0.0.tgz#235119a6606e2646919a27d83ef687f2ba6c0fba" - integrity sha512-p5DiZOZHbJ2ZO5MADczp5qrfOd3W5Vr2vHxfCpe7G4AzPwVOweIjbfgku8wSQUuk+Y5Yuo8W7JqRe6XKmKistg== + version "3.1.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.1.0.tgz#c79f4298ae841f236f3bc0d6c1225d39d51f8eb2" + integrity sha512-qVr246G5307nz5JmhtsvHudxNMrRTWTCmTg+tA4gHQJnVyx/SsyQnky/5peC23B8etvlKli9P6sNXWQGDxoskQ== dependencies: atomic-sleep "^1.0.0" @@ -4822,7 +5282,7 @@ split2@^3.0.0: dependencies: readable-stream "^3.0.0" -split2@^4.0.0: +split2@^4.0.0, split2@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== @@ -4839,6 +5299,11 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== +sqlstring@^2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/sqlstring/-/sqlstring-2.3.3.tgz#2ddc21f03bce2c387ed60680e739922c65751d0c" + integrity sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg== + stack-utils@^2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5" @@ -5076,6 +5541,14 @@ through@2, "through@>=2.2.7 <3": resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== +timers-ext@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== + dependencies: + es5-ext "~0.10.46" + next-tick "1" + tiny-lru@^8.0.1: version "8.0.2" resolved "https://registry.yarnpkg.com/tiny-lru/-/tiny-lru-8.0.2.tgz#812fccbe6e622ded552e3ff8a4c3b5ff34a85e4c" @@ -5103,6 +5576,11 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== +toposort-class@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toposort-class/-/toposort-class-1.0.1.tgz#7ffd1f78c8be28c3ba45cd4e1a3f5ee193bd9988" + integrity sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg== + touch@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" @@ -5128,9 +5606,9 @@ ts-essentials@^7.0.3: integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== ts-jest@^28.0.6: - version "28.0.6" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.6.tgz#d63df9a9908044cd891e066ad869b1a432e70d67" - integrity sha512-yLAWoaSJ6c9o+IT7+nyutp5uvwGzhMYb/LD5WEQAi2tBq4ZSAPay4Lf69pP/IU+GFYg87pdg5eADSzuNAFSK4g== + version "28.0.7" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.7.tgz#e18757a9e44693da9980a79127e5df5a98b37ac6" + integrity sha512-wWXCSmTwBVmdvWrOpYhal79bDpioDy4rTT+0vyUnE3ZzM7LOAAGG9NXwzkEL/a516rQEgnMmS/WKP9jBPCVJyA== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" @@ -5247,12 +5725,22 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" + integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@^4.7.4: +typescript@^4.6.3, typescript@^4.7.4: version "4.7.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== @@ -5262,6 +5750,13 @@ uglify-js@^3.1.4: resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.2.tgz#0481e1dbeed343ad1c2ddf3c6d42e89b7a6d4def" integrity sha512-AaQNokTNgExWrkEYA24BTNMSjyqEXPSfhqoS0AxmHkCJ4U+Dyy5AvbGV/sqxuxficEfGGoX3zWw9R7QpLFfEsg== +umzug@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/umzug/-/umzug-2.3.0.tgz#0ef42b62df54e216b05dcaf627830a6a8b84a184" + integrity sha512-Z274K+e8goZK8QJxmbRPhl89HPO1K+ORFtm6rySPhFKfKc5GHhqdzD0SGhSWHkzoXasqJuItdhorSvY7/Cgflw== + dependencies: + bluebird "^3.7.2" + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -5277,10 +5772,20 @@ undefsafe@^2.0.5: resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== +underscore@^1.13.1: + version "1.13.4" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.4.tgz#7886b46bbdf07f768e0052f1828e1dcab40c0dee" + integrity sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ== + +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + update-browserslist-db@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.4.tgz#dbfc5a789caa26b1db8990796c2c8ebbce304824" - integrity sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA== + version "1.0.5" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.5.tgz#be06a5eedd62f107b7c19eb5bcefb194411abf38" + integrity sha512-dteFFpCyvuDdr9S/ff1ISkKt/9YZxKjI9WlRR99c180GaztJtRa/fn18FdxGVKVsnPY7/a/FDN68mcvUmP4U7Q== dependencies: escalade "^3.1.1" picocolors "^1.0.0" @@ -5297,6 +5802,11 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" @@ -5324,6 +5834,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +validator@^13.7.0: + version "13.7.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.7.0.tgz#4f9658ba13ba8f3d82ee881d3516489ea85c0857" + integrity sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw== + vary@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -5446,6 +5961,13 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== +wkx@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/wkx/-/wkx-0.5.0.tgz#c6c37019acf40e517cc6b94657a25a3d4aa33e8c" + integrity sha512-Xng/d4Ichh8uN4l0FToV/258EjMGU9MGcA0HV2d9B/ZpZB3lqQm7nkOdZdm5GhKtLLhAE7PiVQwN4eN+2YJJUg== + dependencies: + "@types/node" "*" + word-wrap@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" @@ -5478,7 +6000,7 @@ write-file-atomic@^4.0.1: imurmurhash "^0.1.4" signal-exit "^3.0.7" -xtend@~4.0.1: +xtend@^4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== @@ -5488,6 +6010,11 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" diff --git a/lib/src/functions/api/express.js b/lib/src/functions/api/express.js new file mode 100644 index 0000000..8ea89fd --- /dev/null +++ b/lib/src/functions/api/express.js @@ -0,0 +1,550 @@ +const { platform } = require('os') +const { promisify } = require('util') +const exec = promisify(require('child_process').exec) +const writeFile = require('../../utils/writeFile') + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {Boolean} args.graphQL + */ +const types = async ({ projectName, graphQL }) => { + const createFoldersCommand = `mkdir ${projectName}/src/@types ${projectName}/src/@types/models ${projectName}/src/@types/custom ${ + graphQL ? `${projectName}/src/@types/graphQL` : '' + }` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const types = { + index: { + content: `/* eslint-disable no-var */ +declare global {} + +export {} +`, + file: `${projectName}/src/@types/index.d.ts` + }, + models: { + user: { + content: `interface UserDBO { + name: string + lastName: string + createdAt: Date + updatedAt: Date +} +`, + file: `${projectName}/src/@types/models/user.d.ts` + } + }, + custom: { + request: { + content: `type ExpressRequest = import('express').Request + +interface CustomRequest extends ExpressRequest { + log: import('express-pino-logger').HttpLogger['logger'] + body: { + args?: import('schemas').UserDTO + } + // We can add custom headers via intersection, remember that for some reason + // headers must be in Snake-Pascal-Case + headers: import('http').IncomingHttpHeaders & { + 'Custom-Header'?: string + } +} +`, + file: `${projectName}/src/@types/custom/request.d.ts` + }, + response: { + content: `type ExpressResponse = import('express').Response + +interface CustomResponse extends ExpressResponse { + newValue?: string +} +`, + file: `${projectName}/src/@types/custom/response.d.ts` + } + }, + ...(graphQL && { + graphQL: { + context: { + content: `type Context = { + log: import('express-pino-logger').HttpLogger['logger'] +} +`, + file: `${projectName}/src/@types/graphQL/context.d.ts` + } + } + }) + } + const processes = [ + writeFile(types.index.file, types.index.content), + writeFile(types.models.user.file, types.models.user.content), + writeFile(types.custom.request.file, types.custom.request.content), + writeFile(types.custom.response.file, types.custom.response.content) + ] + + if (graphQL) + processes.push( + writeFile(types.graphQL.context.file, types.graphQL.context.content) + ) + + await Promise.all(processes) +} + +/** + * @param {Object} args + * @param {String} args.projectName + */ +const mongo = async ({ projectName }) => { + const createFoldersCommand = `mkdir ${projectName}/src/database/mongo \ +${projectName}/src/database/mongo/models \ +${projectName}/src/database/mongo/queries` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const database = { + index: { + content: "export * from './mongo'\n", + file: `${projectName}/src/database/index.ts` + }, + mongo: { + connection: { + content: `import { connect, connection } from 'mongoose' +import { FastifyLoggerInstance } from 'fastify' + +const ENVIRONMENTS_WITHOUT_RECONNECTION = ['ci', 'local'] +const dbConnection = async ( + logger: FastifyLoggerInstance +): Promise<{ + connect: () => Promise + disconnect: () => Promise +}> => { + const connectionConfig = { + keepAlive: true, + useNewUrlParser: true, + useUnifiedTopology: true + } + + connection.on('connected', () => { + logger.info('Mongo connection established.') + }) + connection.on('reconnected', () => { + logger.info('Mongo connection reestablished') + }) + connection.on('disconnected', () => { + if ( + !ENVIRONMENTS_WITHOUT_RECONNECTION.includes( + process.env.NODE_ENV as string + ) + ) { + logger.info( + 'Mongo connection disconnected. Trying to reconnected to Mongo...' + ) + setTimeout(() => { + connect(process.env.MONGO_URI as string, { + ...connection, + connectTimeoutMS: 3000, + socketTimeoutMS: 3000 + }) + }, 3000) + } + }) + connection.on('close', () => { + logger.info('Mongo connection closed') + }) + connection.on('error', (e: Error) => { + logger.info('Mongo connection error:') + logger.error(e) + }) + + return { + connect: () => connect(process.env.MONGO_URI as string, connectionConfig), + disconnect: () => connection.close() + } +} + +export { dbConnection } +`, + file: `${projectName}/src/database/mongo/connection.ts` + }, + index: { + content: `export * from './models' +export * from './queries' +export * from './connection' +`, + file: `${projectName}/src/database/mongo/index.ts` + }, + models: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/mongo/models/index.ts` + }, + user: { + content: `import { model, Schema } from 'mongoose' + +const UserSchema = new Schema( + { + lastName: { + required: true, + type: String + }, + name: { + required: true, + type: String + } + }, + { + timestamps: true, + versionKey: false, + toObject: { + transform: (_, ret) => { + ret.id = ret._id.toString() + delete ret._id + } + } + } +) + +const UserModel = model('users', UserSchema) + +export { UserModel } +`, + file: `${projectName}/src/database/mongo/models/user.ts` + } + }, + queries: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/mongo/queries/index.ts` + }, + user: { + content: `import { Document, MergeType, Types } from 'mongoose' + +import { UserModel } from '..' +import { User, UserDTO, UserWithId } from 'schemas' + +const userDBOtoDTO = ( + userDBO: Document> & + Omit & + UserDBO & { + _id: Types.ObjectId + } +): UserDTO => ({ + ...userDBO.toObject(), + createdAt: userDBO.createdAt.toISOString(), + updatedAt: userDBO.updatedAt.toISOString() +}) + +const store = async (userData: User): Promise => { + const user = new UserModel(userData) + + await user.save() + + return userDBOtoDTO(user) +} + +const remove = async ( + id: string | null = null +): Promise => { + if (id) { + const removedUser = await UserModel.findByIdAndRemove(id) + + if (!removedUser) return null + + return userDBOtoDTO(removedUser) + } + + return (await UserModel.deleteMany({})).deletedCount +} + +const get = async ( + id: string | null = null +): Promise => { + if (id) { + const user = await UserModel.findById(id) + + return user ? userDBOtoDTO(user) : null + } + + const users = await UserModel.find({}) + + return users.map(u => userDBOtoDTO(u)) +} + +const update = async (userData: UserWithId): Promise => { + const { id, ...rest } = userData + const user = await UserModel.findByIdAndUpdate(id, rest, { new: true }) + + return user ? userDBOtoDTO(user) : null +} + +export { store, remove, get, update } +`, + file: `${projectName}/src/database/mongo/queries/user.ts` + } + } + } + } + + await Promise.all([ + writeFile(database.index.file, database.index.content), + writeFile( + database.mongo.connection.file, + database.mongo.connection.content + ), + writeFile(database.mongo.index.file, database.mongo.index.content), + writeFile( + database.mongo.models.index.file, + database.mongo.models.index.content + ), + writeFile( + database.mongo.models.user.file, + database.mongo.models.user.content + ), + writeFile( + database.mongo.queries.index.file, + database.mongo.queries.index.content + ), + writeFile( + database.mongo.queries.user.file, + database.mongo.queries.user.content + ) + ]) +} + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {import('../../../../').Config['database']} args.db + */ +const sql = async ({ projectName, db }) => { + const createFoldersCommand = `mkdir ${projectName}/src/database/${db} \ +${projectName}/src/database/${db}/models \ +${projectName}/src/database/${db}/queries` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const database = { + index: { + content: `export * from './${db}'\n`, + file: `${projectName}/src/database/index.ts` + }, + [db]: { + connection: { + content: `import { Sequelize } from 'sequelize' +import { HttpLogger } from 'express-pino-logger' + +import { initUser } from './models' + +const initArray = [initUser] +let sequelizeConnection: Sequelize + +const dbConnection = async ( + logger: HttpLogger['logger'] +): Promise<{ + connect: () => Sequelize + disconnect: () => Promise +}> => { + return { + connect: () => { + if (!sequelizeConnection) { + sequelizeConnection = new Sequelize(process.env.DB_URI as string) + initArray.forEach(initFn => initFn(sequelizeConnection)) + logger.info('Postgres connection established.') + } + + return sequelizeConnection + }, + disconnect: () => { + logger.info('Postgres connection closed.') + + return sequelizeConnection?.close() + } + } +} + +export { dbConnection } +`, + file: `${projectName}/src/database/${db}/connection.ts` + }, + index: { + content: ``, + file: `${projectName}/src/database/${db}/connection.ts` + }, + models: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/${db}/models/index.ts` + }, + user: { + content: `/* eslint-disable no-use-before-define */ +import { + Model, + InferAttributes, + InferCreationAttributes, + CreationOptional, + DataTypes, + Sequelize +} from 'sequelize' + +class UserModel extends Model< + InferAttributes, + InferCreationAttributes +> { + declare id: CreationOptional + declare name: string + declare lastName: string + declare createdAt: CreationOptional + declare updatedAt: CreationOptional +} + +const initUser = (sequelize: Sequelize) => { + UserModel.init( + { + id: { + type: DataTypes.INTEGER, + autoIncrement: true, + primaryKey: true + }, + name: { + type: DataTypes.STRING, + allowNull: false + }, + lastName: { + type: DataTypes.STRING, + allowNull: false + }, + createdAt: DataTypes.DATE, + updatedAt: DataTypes.DATE + }, + { + sequelize, + tableName: 'users' + } + ) +} + +export { UserModel, initUser } +`, + file: `${projectName}/src/database/${db}/models/user.ts` + } + }, + queries: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/${db}/queries/index.ts` + }, + user: { + content: `import { UserModel } from '..' +import { User, UserDTO, UserWithId } from 'schemas' +import { Transaction } from 'sequelize/types' + +const userDBOtoDTO = (userDBO: UserModel): UserDTO => ({ + ...userDBO.get(), + createdAt: userDBO.createdAt.toISOString(), + updatedAt: userDBO.updatedAt.toISOString() +}) + +const store = async ( + userData: User, + transaction: Transaction | null = null +): Promise => { + const user = await UserModel.create(userData, { + transaction + }) + + return userDBOtoDTO(user) +} + +const remove = async ( + id: number | null = null, + transaction: Transaction | null = null +): Promise => { + if (id) { + const removedUser = await UserModel.destroy({ + where: { id }, + transaction + }) + + return removedUser + } + + const w = await UserModel.destroy({ truncate: true, transaction }) + + console.log(w) + + return w +} + +const get = async ( + id: number | null = null +): Promise => { + if (id) { + const user = await UserModel.findByPk(id) + + return user ? userDBOtoDTO(user) : null + } + + const { rows: users } = await UserModel.findAndCountAll() + + return users.map(u => userDBOtoDTO(u)) +} + +const update = async (userData: UserWithId): Promise => { + const { id, ...rest } = userData + const [, user] = await UserModel.update(rest, { + where: { id }, + returning: true, + limit: 1 + }) + + return user[0] ? userDBOtoDTO(user[0]) : null +} + +export { store, remove, get, update } +`, + file: `${projectName}/src/database/${db}/queries/user.ts` + } + } + } + } + + await Promise.all([ + writeFile(database.index.file, database.index.content), + writeFile(database[db].connection.file, database[db].connection.content), + writeFile(database[db].index.file, database[db].index.content), + writeFile( + database[db].models.index.file, + database[db].models.index.content + ), + writeFile(database[db].models.user.file, database[db].models.user.content), + writeFile( + database[db].queries.index.file, + database[db].queries.index.content + ), + writeFile(database[db].queries.user.file, database[db].queries.user.content) + ]) +} + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {Boolean} args.graphQL + * @param {import('../../../../').Config['database']} args.database + */ +const main = async ({ projectName, graphQL, database }) => { + const dbIsSQL = database !== 'mongo' + + await types(projectName, graphQL) + + if (dbIsSQL) await sql({ projectName, db: database }) + else await mongo({ projectName }) +} + +module.exports = main diff --git a/lib/src/functions/api/fastify.js b/lib/src/functions/api/fastify.js new file mode 100644 index 0000000..88d333a --- /dev/null +++ b/lib/src/functions/api/fastify.js @@ -0,0 +1,521 @@ +const { platform } = require('os') +const { promisify } = require('util') +const exec = promisify(require('child_process').exec) +const writeFile = require('../../utils/writeFile') + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {Boolean} args.graphQL + * @param {Boolean} args.dbIsSQL + */ +const types = async ({ projectName, graphQL, dbIsSQL }) => { + const createFoldersCommand = `mkdir ${projectName}/src/@types ${projectName}/src/@types/models ${ + graphQL ? `${projectName}/src/@types/graphQL` : '' + }` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const types = { + index: { + content: `/* eslint-disable no-var */ +declare global {} + +export {} +`, + file: `${projectName}/src/@types/index.d.ts` + }, + models: { + user: { + content: `interface UserDBO { + ${dbIsSQL ? 'id: number\n' : ''}name: string + lastName: string + createdAt: Date + updatedAt: Date +} +`, + file: `${projectName}/src/@types/models/user.d.ts` + } + }, + ...(graphQL && { + graphQL: { + context: { + content: `type Context = { + log: import('fastify').FastifyInstance['log'] +} +`, + file: `${projectName}/src/@types/graphQL/context.d.ts` + } + } + }) + } + const processes = [ + writeFile(types.index.file, types.index.content), + writeFile(types.models.user.file, types.models.user.content) + ] + + if (graphQL) + processes.push( + writeFile(types.graphQL.context.file, types.graphQL.context.content) + ) + + await Promise.all(processes) +} + +/** + * @param {Object} args + * @param {String} args.projectName + */ +const mongo = async ({ projectName }) => { + const createFoldersCommand = `mkdir ${projectName}/src/database/mongo \ +${projectName}/src/database/mongo/models \ +${projectName}/src/database/mongo/queries` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const database = { + index: { + content: "export * from './mongo'\n", + file: `${projectName}/src/database/index.ts` + }, + mongo: { + connection: { + content: `import { connect, connection } from 'mongoose' +import { FastifyLoggerInstance } from 'fastify' + +const ENVIRONMENTS_WITHOUT_RECONNECTION = ['ci', 'local'] +const dbConnection = async ( + logger: FastifyLoggerInstance +): Promise<{ + connect: () => Promise + disconnect: () => Promise +}> => { + const connectionConfig = { + keepAlive: true, + useNewUrlParser: true, + useUnifiedTopology: true + } + + connection.on('connected', () => { + logger.info('Mongo connection established.') + }) + connection.on('reconnected', () => { + logger.info('Mongo connection reestablished') + }) + connection.on('disconnected', () => { + if ( + !ENVIRONMENTS_WITHOUT_RECONNECTION.includes( + process.env.NODE_ENV as string + ) + ) { + logger.info( + 'Mongo connection disconnected. Trying to reconnected to Mongo...' + ) + setTimeout(() => { + connect(process.env.MONGO_URI as string, { + ...connection, + connectTimeoutMS: 3000, + socketTimeoutMS: 3000 + }) + }, 3000) + } + }) + connection.on('close', () => { + logger.info('Mongo connection closed') + }) + connection.on('error', (e: Error) => { + logger.info('Mongo connection error:') + logger.error(e) + }) + + return { + connect: () => connect(process.env.MONGO_URI as string, connectionConfig), + disconnect: () => connection.close() + } +} + +export { dbConnection } +`, + file: `${projectName}/src/database/mongo/connection.ts` + }, + index: { + content: `export * from './models' +export * from './queries' +export * from './connection' +`, + file: `${projectName}/src/database/mongo/index.ts` + }, + models: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/mongo/models/index.ts` + }, + user: { + content: `import { model, Schema } from 'mongoose' + +const UserSchema = new Schema( + { + lastName: { + required: true, + type: String + }, + name: { + required: true, + type: String + } + }, + { + timestamps: true, + versionKey: false, + toObject: { + transform: (_, ret) => { + ret.id = ret._id.toString() + delete ret._id + } + } + } +) + +const UserModel = model('users', UserSchema) + +export { UserModel } +`, + file: `${projectName}/src/database/mongo/models/user.ts` + } + }, + queries: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/mongo/queries/index.ts` + }, + user: { + content: `import { Document, MergeType, Types } from 'mongoose' + +import { UserModel } from '..' +import { User, UserDTO, UserWithId } from 'schemas' + +const userDBOtoDTO = ( + userDBO: Document> & + Omit & + UserDBO & { + _id: Types.ObjectId + } +): UserDTO => ({ + ...userDBO.toObject(), + createdAt: userDBO.createdAt.toISOString(), + updatedAt: userDBO.updatedAt.toISOString() +}) + +const store = async (userData: User): Promise => { + const user = new UserModel(userData) + + await user.save() + + return userDBOtoDTO(user) +} + +const remove = async ( + id: string | null = null +): Promise => { + if (id) { + const removedUser = await UserModel.findByIdAndRemove(id) + + if (!removedUser) return null + + return userDBOtoDTO(removedUser) + } + + return (await UserModel.deleteMany({})).deletedCount +} + +const get = async ( + id: string | null = null +): Promise => { + if (id) { + const user = await UserModel.findById(id) + + return user ? userDBOtoDTO(user) : null + } + + const users = await UserModel.find({}) + + return users.map(u => userDBOtoDTO(u)) +} + +const update = async (userData: UserWithId): Promise => { + const { id, ...rest } = userData + const user = await UserModel.findByIdAndUpdate(id, rest, { new: true }) + + return user ? userDBOtoDTO(user) : null +} + +export { store, remove, get, update } +`, + file: `${projectName}/src/database/mongo/queries/user.ts` + } + } + } + } + + await Promise.all([ + writeFile(database.index.file, database.index.content), + writeFile( + database.mongo.connection.file, + database.mongo.connection.content + ), + writeFile(database.mongo.index.file, database.mongo.index.content), + writeFile( + database.mongo.models.index.file, + database.mongo.models.index.content + ), + writeFile( + database.mongo.models.user.file, + database.mongo.models.user.content + ), + writeFile( + database.mongo.queries.index.file, + database.mongo.queries.index.content + ), + writeFile( + database.mongo.queries.user.file, + database.mongo.queries.user.content + ) + ]) +} + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {import('../../../../').Config['database']} args.db + */ +const sql = async ({ projectName, db }) => { + const createFoldersCommand = `mkdir ${projectName}/src/database/${db} \ +${projectName}/src/database/${db}/models \ +${projectName}/src/database/${db}/queries` + + if (platform() === 'win32') + await exec(createFoldersCommand.replaceAll('/', '\\')) + else await exec(createFoldersCommand) + + const database = { + index: { + content: `export * from './${db}'\n`, + file: `${projectName}/src/database/index.ts` + }, + [db]: { + connection: { + content: `import { Sequelize } from 'sequelize' +import { FastifyLoggerInstance } from 'fastify' + +import { initUser } from './models' + +const initArray = [initUser] +let sequelizeConnection: Sequelize + +const dbConnection = async ( + logger: FastifyLoggerInstance +): Promise<{ + connect: () => Sequelize + disconnect: () => Promise +}> => { + return { + connect: () => { + if (!sequelizeConnection) { + sequelizeConnection = new Sequelize(process.env.DB_URI as string) + initArray.forEach(initFn => initFn(sequelizeConnection)) + logger.info('Postgres connection established.') + } + + return sequelizeConnection + }, + disconnect: () => { + logger.info('Postgres connection closed.') + + return sequelizeConnection?.close() + } + } +} + +export { dbConnection } +`, + file: `${projectName}/src/database/${db}/connection.ts` + }, + index: { + content: ``, + file: `${projectName}/src/database/${db}/connection.ts` + }, + models: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/${db}/models/index.ts` + }, + user: { + content: `/* eslint-disable no-use-before-define */ +import { + Model, + InferAttributes, + InferCreationAttributes, + CreationOptional, + DataTypes, + Sequelize +} from 'sequelize' + +class UserModel extends Model< + InferAttributes, + InferCreationAttributes +> { + declare id: CreationOptional + declare name: string + declare lastName: string + declare createdAt: CreationOptional + declare updatedAt: CreationOptional +} + +const initUser = (sequelize: Sequelize) => { + UserModel.init( + { + id: { + type: DataTypes.INTEGER, + autoIncrement: true, + primaryKey: true + }, + name: { + type: DataTypes.STRING, + allowNull: false + }, + lastName: { + type: DataTypes.STRING, + allowNull: false + }, + createdAt: DataTypes.DATE, + updatedAt: DataTypes.DATE + }, + { + sequelize, + tableName: 'users' + } + ) +} + +export { UserModel, initUser } +`, + file: `${projectName}/src/database/${db}/models/user.ts` + } + }, + queries: { + index: { + content: "export * from './user'\n", + file: `${projectName}/src/database/${db}/queries/index.ts` + }, + user: { + content: `import { UserModel } from '..' +import { User, UserDTO, UserWithId } from 'schemas' +import { Transaction } from 'sequelize/types' + +const userDBOtoDTO = (userDBO: UserModel): UserDTO => ({ + ...userDBO.get(), + createdAt: userDBO.createdAt.toISOString(), + updatedAt: userDBO.updatedAt.toISOString() +}) + +const store = async ( + userData: User, + transaction: Transaction | null = null +): Promise => { + const user = await UserModel.create(userData, { + transaction + }) + + return userDBOtoDTO(user) +} + +const remove = async ( + id: number | null = null, + transaction: Transaction | null = null +): Promise => { + if (id) { + const removedUser = await UserModel.destroy({ + where: { id }, + transaction + }) + + return removedUser + } + + const w = await UserModel.destroy({ truncate: true, transaction }) + + console.log(w) + + return w +} + +const get = async ( + id: number | null = null +): Promise => { + if (id) { + const user = await UserModel.findByPk(id) + + return user ? userDBOtoDTO(user) : null + } + + const { rows: users } = await UserModel.findAndCountAll() + + return users.map(u => userDBOtoDTO(u)) +} + +const update = async (userData: UserWithId): Promise => { + const { id, ...rest } = userData + const [, user] = await UserModel.update(rest, { + where: { id }, + returning: true, + limit: 1 + }) + + return user[0] ? userDBOtoDTO(user[0]) : null +} + +export { store, remove, get, update } +`, + file: `${projectName}/src/database/${db}/queries/user.ts` + } + } + } + } + + await Promise.all([ + writeFile(database.index.file, database.index.content), + writeFile(database[db].connection.file, database[db].connection.content), + writeFile(database[db].index.file, database[db].index.content), + writeFile( + database[db].models.index.file, + database[db].models.index.content + ), + writeFile(database[db].models.user.file, database[db].models.user.content), + writeFile( + database[db].queries.index.file, + database[db].queries.index.content + ), + writeFile(database[db].queries.user.file, database[db].queries.user.content) + ]) +} + +/** + * @param {Object} args + * @param {String} args.projectName + * @param {Boolean} args.graphQL + * @param {import('../../../../').Config['database']} args.database + */ +const main = async ({ projectName, graphQL, database }) => { + const dbIsSQL = database !== 'mongo' + + await types({ projectName, graphQL, dbIsSQL }) + + if (dbIsSQL) await sql({ projectName, db: database }) + else await mongo({ projectName }) +} + +module.exports = main diff --git a/lib/src/functions/api/index.js b/lib/src/functions/api/index.js index 77cb2bf..93201bb 100644 --- a/lib/src/functions/api/index.js +++ b/lib/src/functions/api/index.js @@ -2,7 +2,7 @@ const os = require('os') const util = require('util') const exec = util.promisify(require('child_process').exec) -const database = require('./database') +const databaseF = require('./database') const schemas = require('./schemas') const services = require('./services') const types = require('./types') @@ -11,100 +11,6 @@ const utils = require('./utils') const writeFile = require('../../utils/writeFile') const { ENVIRONMENTS_WITH_MONGO_URI } = require('../../utils/constants') -/* - * Express api: - * src - * |- @types: - * |- |- custom: - * |- |- |- request: content, file - * |- |- |- response: content, file - * |- |- dto: - * |- |- |- user: content, file - * |- |- models: - * |- |- |- user: content, file - * | |- index: content, file - * |- database: - * | |- mongo: - * | |- |- models: - * | |- |- |- index: content, file - * | |- |- |- user: content, file - * | |- |- queries: - * | |- |- |- index: content, file - * | |- |- |- user: content, file - * | |- |- index: content, file - * | |- index: content, file - * |- network: - * | |- routes: - * | | |- schemas: - * | | | |- user: content, file - * | | | |- index: content, file - * | | |- home: content, file - * | | |- index: content, file - * | | |- user: content, file - * | |- response: content, file - * | |- router: content, file - * | |- server: content, file - * | |- index: content, file - * |- services: - * | |- utils: - * | | |- messages: - * | | | |- user: content, file - * | | | |- index: content, file - * | | |- index: content, file - * | |- user: content, file - * | |- index: content, file - * |- utils: - * | |- docs.json: content, file - * | |- index: content, file - * |- .env: content, file - * |- index: content, file - * index.http: content, file - */ - -/* - * Fastify api: - * src - * |- @types: - * |- |- dto: - * |- |- |- user: content, file - * |- |- models: - * |- |- |- user: content, file - * | |- index: content, file - * |- database: - * | |- mongo: - * | |- |- models: - * | |- |- |- index: content, file - * | |- |- |- user: content, file - * | |- |- queries: - * | |- |- |- index: content, file - * | |- |- |- user: content, file - * | |- |- index: content, file - * | |- index: content, file - * |- network: - * | |- routes: - * | | |- schemas: - * | | | |- user: content, file - * | | | |- index: content, file - * | | |- home: content, file - * | | |- user: content, file - * | | |- index: content, file - * | |- response: content, file - * | |- router: content, file - * | |- server: content, file - * | |- index: content, file - * |- services: - * | |- utils: - * | | |- messages: - * | | | |- user: content, file - * | | | |- index: content, file - * | | |- index: content, file - * | |- user: content, file - * | |- index: content, file - * |- .env: content, file - * |- index: content, file - * index.http: content, file - */ - /** * @param {Object} args * @param {String} args.projectName @@ -112,7 +18,7 @@ const { ENVIRONMENTS_WITH_MONGO_URI } = require('../../utils/constants') * @param {String} args.email * @param {Boolean} args.fastify * @param {Boolean} args.graphql - * @param {Boolean|undefined} args.mongo + * @param {import('../../../').Config['database']} args.database */ module.exports = async ({ projectName, @@ -120,7 +26,7 @@ module.exports = async ({ email, fastify, graphql, - mongo = true + database }) => { const data = { test: { @@ -193,8 +99,8 @@ Server.start() graphql }), // /database - database({ - mongo, + databaseF({ + mongo: false, projectName, fastify }), diff --git a/lib/src/index.js b/lib/src/index.js index 0322eee..d6c40fb 100644 --- a/lib/src/index.js +++ b/lib/src/index.js @@ -35,7 +35,7 @@ const setOptions = process => { } /** - * @param {Config} config configuration to build the project + * @param {import('../').Config} config configuration to build the project */ module.exports = async ({ author, @@ -51,7 +51,8 @@ module.exports = async ({ fastify, graphql, tests, - ghat + ghat, + database }) => { const process = 4 let i = 0 @@ -66,11 +67,32 @@ module.exports = async ({ const fastifyProdPackages = `fastify@^3 @fastify/swagger@^6 @fastify/cors@^7 ${ graphql ? 'apollo-server-fastify apollo-server-plugin-base' : '' }` - const prodPackages = `${manager} @sinclair/typebox http-errors mongoose pino-pretty ${ + let prodPackages = `${manager} @sinclair/typebox http-errors pino-pretty ${ graphql ? '@graphql-tools/schema ajv ajv-formats apollo-server-core graphql' : 'ajv@^6' } ${fastify ? fastifyProdPackages : expressProdPackages}` + + switch (database) { + case 'mongo': + prodPackages += ' mongoose' + break + case 'postgres': + prodPackages += ' sequelize pg pg-hstore' + break + case 'mysql': + prodPackages += ' sequelize mysql2' + break + case 'mariadb': + prodPackages += ' sequelize mariadb' + break + case 'sqlite': + prodPackages += ' sequelize sqlite3' + break + case 'sqlServer': + prodPackages += ' sequelize tedious' + } + const expressDevPackages = '@types/express @types/swagger-ui-express @types/cors @types/express-pino-logger' const fastifyDevPackages = '' @@ -168,25 +190,6 @@ webpack-node-externals` } } -/** - * @typedef {Object} Config configuration to initialize a project - * @property {String} author author of the project - * @property {String} email email of the project author - * @property {String} projectName project name - * @property {String} projectDescription project description - * @property {Boolean} heroku true if the project will be deployed in heroku - * @property {'unlicensed'|'mit'|'apache-2.0'|'mpl-2.0'|'lgpl-3.0'|'gpl-3.0'|'agpl-3.0'} license project license - * @property {String} version project initial version - * @property {String} licenseYear year when the license starts in format YYYY - * @property {Boolean} npm true means that the package manager will be npm, otherwise yarn - * @property {'yarn add'|'npm i'} manager command that will be used to install packages - * @property {String} mainFile main file of the project - * @property {Boolean} fastify true means that the project will be using Fastify - * @property {Boolean} graphql true means that the project will be using GraphQL - * @property {Boolean} tests true means that the project will have a basic suit of tests with Jest - * @property {Boolean} ghat true means that the project will have a GitHub Action for the suit of tests - */ - /** * @typedef {Object} CliOptions * @property {String} format cli format to show the progress to the user diff --git a/package.json b/package.json index 83b6f73..9e17b71 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "service:q": "node ./bin -q", "help": "node ./bin -h", "lint": "eslint --ext js lib/ --fix", + "example": "node -r dotenv/config ./bin -N local-example -D 'This is a test using fastify' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -F", "build": "npm run rm && npm run build:express && npm run build:fastify && npm run build:express:graphql && npm run build:fastify:graphql", "build:express": "npm run rm:express && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express -D 'This is a test using express' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat && npm run rm:git:express", "build:fastify": "npm run rm:fastify && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify -D 'This is a test using fastify' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -F --tests --ghat && npm run rm:git:fastify",